1 |
>From: Heath Holcomb <liquidcable@×××××.com> |
2 |
>Reply-To: gentoo-embedded@l.g.o |
3 |
>To: gentoo-embedded@l.g.o |
4 |
>Subject: Re: [gentoo-embedded] x86 SBC Gentoo Embedded HotTo version 0.07 |
5 |
>Date: Sat, 13 Aug 2005 17:52:40 -0500 |
6 |
> |
7 |
>On Friday 12 August 2005 01:39 am, Marcel Romijn wrote: |
8 |
> > Hello Heath, |
9 |
> > |
10 |
> > Nice writedown! I haven't made it to the end yet (lack of time), but I'm |
11 |
> > getting there... |
12 |
> > |
13 |
> > I noticed some issues along the way (not counting grub begin spelled as |
14 |
> > "grug" or "gurb" ;-) ) |
15 |
> > |
16 |
> > In step 3 you write: |
17 |
> > |
18 |
> > <snip> |
19 |
> > # Set root password for the embedded_rootfs |
20 |
> > chromm /embedded_rootfs |
21 |
> > passwd |
22 |
> > rm /embedded_rootfs/etc/passwd- |
23 |
> > Exit |
24 |
> > </snip> |
25 |
> > |
26 |
> > I presume 'chromm' should have been 'chroot' ? |
27 |
> > If it is indeed 'chroot' then you should either do "rm /etc/passwd-" |
28 |
> > before the "exit" or the "exit" before the "rm |
29 |
> > /embedded_rootfs/etc/passwd-". |
30 |
> |
31 |
>Yes, "chromm" should be "chroot". The order is correct, as far as I can |
32 |
>tell. |
33 |
>chroot /embedded_rootfs |
34 |
>passwd |
35 |
>rm /embedded_rootfs/etc/passwd- |
36 |
>exit |
37 |
> |
38 |
|
39 |
I think Marcel got it right, first exit the chroot before you can remove |
40 |
something in /embedded_rootfs |
41 |
|
42 |
OR |
43 |
|
44 |
rm /etc/passwd- while you are in the chroot and exit after that. |
45 |
|
46 |
> |
47 |
> > A few lines down, you write: |
48 |
> > |
49 |
> > <snip> |
50 |
> > rm -R /embedded_rootfs/var/db/pkg/ * |
51 |
> > </snip> |
52 |
> > |
53 |
> > As a reletive newbie, doing a quick copy/paste of this command late in |
54 |
> > the evening as root in '/', this wiped out all files, except the ones |
55 |
> > that were firmly locked. |
56 |
> > Fortunately, I'm going through you HowTo in VMWare, so I could restore a |
57 |
> > previous snapshot ;-) |
58 |
> > |
59 |
> > I presume the space before the '*' should have been omitted? |
60 |
> > |
61 |
> > <snip> |
62 |
> > rm -R /embedded_rootfs/var/db/pkg/* |
63 |
> > </snip> |
64 |
> |
65 |
>Major typo on my part. Fixed in version 0.08. |
66 |
> |
67 |
> > |
68 |
> > My aim is to create an embedded Gentoo for a Via Epia ME6000, which |
69 |
> > reads the kernel and a ramdisk image from CF and then runs completely |
70 |
> > from RAM. |
71 |
> > If I'm not mistaken, you were heading for a Via Epia as well? |
72 |
> |
73 |
>My target will be a Via based SBC. From what I have read using a ramdisk |
74 |
>on a |
75 |
>x86 based platform really does not buy you much. But you sure don't want |
76 |
>to |
77 |
>write to the CF all that often (limited write cycles, usallay 100,000 to |
78 |
>300,000). So I plan on mounting the / partition of the CF as read only and |
79 |
>creating a separate partition that is mounted read/write and have my |
80 |
>embedded |
81 |
>application and only my application write to that partition. |
82 |
> |
83 |
> > Regards, |
84 |
> > |
85 |
> > Marcel Romijn |
86 |
> > |
87 |
> > |
88 |
> > -----Original Message----- |
89 |
> > From: Heath Holcomb [mailto:liquidcable@×××××.com] |
90 |
> > Sent: Monday, 08 August, 2005 4:17 |
91 |
> > To: gentoo-embedded@l.g.o |
92 |
> > Subject: [gentoo-embedded] x86 SBC Gentoo Embedded HotTo version 0.07 |
93 |
> > |
94 |
> > Version 0.07 |
95 |
> > Please add, delete, modify. Thanks! |
96 |
> > |
97 |
> > Several fixes. Root password now works. Several work arounds are no |
98 |
> > longer |
99 |
> > need, as the embedded Gentoo team has fixed them (I'm guess because I no |
100 |
> > |
101 |
> > longer get those errors). There is still one problem when "emerge -e |
102 |
> > system" |
103 |
> > for groff. Bug 98187 (http://bugs.gentoo.org/show_bug.cgi?id=98187). |
104 |
> > Check |
105 |
> > out the bug report for the temp fix/work around (USE="-sandbox" emerge |
106 |
> > -e |
107 |
> > system). |
108 |
> > |
109 |
> > I've update my website with this version also. |
110 |
> > http://www.bulah.com/embeddedgentoo.html |
111 |
> > |
112 |
> > |
113 |
> > #----------------------------------------------------------------------- |
114 |
> > --------- |
115 |
> > # Embedded Gentoo How-To for x86 |
116 |
> > # |
117 |
> > # A how-to guide to setup a Gentoo embedded environment, you must be |
118 |
> > root. |
119 |
> > # These commands are to be run on your development system, |
120 |
> > # any x86 Gentoo Linux computer will do. The system should be fast, |
121 |
> > # to speed development. The target can be any x86 based SBC. I'm |
122 |
> > # using a Geode based SBC. Latter I'll use a Via based SBC. |
123 |
> > # |
124 |
> > # version 0.07 |
125 |
> > # 2005.8.7 |
126 |
> > # |
127 |
> > # Heath Holcomb (heath at bulah.com) |
128 |
> > # Ned Ludd (original commands posted) |
129 |
> > # Lloyd Sargent (contributor) |
130 |
> > # Yuri Vasilevski (contributor) |
131 |
> > # Mike George (contributor) |
132 |
> > # Kammi Cazze (contributor) |
133 |
> > # Marius Schaefer (contributor) |
134 |
> > # |
135 |
> > # Definitions and Terms |
136 |
> > # system_rootfs = your regular rootfs, development computer |
137 |
> > # development_rootfs = what you use to build the embedded_rootfs |
138 |
> > # embedded_rootfs = rootfs you deploy to the target system |
139 |
> > # SBC = single board computer (here it's an x86 based) |
140 |
> > # |
141 |
> > # References |
142 |
> > # http://www.gentoo.org/doc/en/handbook/index.xml |
143 |
> > # http://www.epiawiki.org |
144 |
> > # http://epia.kalf.org |
145 |
> > # Gentoo embedded mailing list (gentoo-embedded@l.g.o) |
146 |
> > # |
147 |
> > # |
148 |
> > # Overview of process (steps) |
149 |
> > # 1 - Prepare the development_rootfs from your system_rootfs |
150 |
> > # 2 - Build the development_rootfs |
151 |
> > # 3 - Build the embedded_rootfs |
152 |
> > # 4 - Build and install non-system programs to the embedded_rootfs |
153 |
> > # 5 - Build and install a kernel to the embedded_rootfs |
154 |
> > # 6 - Deploy embedded_rootfs to target |
155 |
> > # |
156 |
> > #----------------------------------------------------------------------- |
157 |
> > --------- |
158 |
> > |
159 |
> > #----- Step 1 - Prepare the development_rootfs from your system_rootfs |
160 |
> > ------- |
161 |
> > |
162 |
> > # You must be root. |
163 |
> > su - |
164 |
> > |
165 |
> > # Create the development_rootfs. |
166 |
> > # I use i586 because of target is a Geode processor. |
167 |
> > mkdir -p /opt/i586-gentoo-uclibc-linux/usr/portage |
168 |
> > |
169 |
> > # Download the latest stage 1 tarball. |
170 |
> > wget \ |
171 |
> > http://gentoo.osuosl.org/experimental/x86/embedded/stages/stage1-x86-ucl |
172 |
> > ibc-2005.0.tar.bz2 |
173 |
> > |
174 |
> > # Untar the stage to the development_rootfs. |
175 |
> > tar -xvjpf stage1-x86-uclibc-2005.0.tar.bz2 -C |
176 |
> > /opt/i586-gentoo-uclibc-linux/ |
177 |
> > |
178 |
> > # Mount the proc and portage directories to your development_rootfs. |
179 |
> > # Makes your system_rootfs's proc and portage directory available from |
180 |
> > inside |
181 |
> > # of your development_rootfs (after chrooting). |
182 |
> > mount --bind /proc /opt/i586-gentoo-uclibc-linux/proc/ |
183 |
> > mount --bind /usr/portage /opt/i586-gentoo-uclibc-linux/usr/portage |
184 |
> > |
185 |
> > # Copy over DNS information to the development_rootfs. |
186 |
> > cp /etc/resolv.conf /opt/i586-gentoo-uclibc-linux/etc/resolv.conf |
187 |
> > |
188 |
> > # Chroot into the development_rootfs. |
189 |
> > chroot /opt/i586-gentoo-uclibc-linux /bin/bash --login |
190 |
> > |
191 |
> > |
192 |
> > #----- Step 2 - Build the development_rootfs |
193 |
> > --------------------------------- |
194 |
> > |
195 |
> > # Create new environment and load variables into memory. |
196 |
> > env-update |
197 |
> > source /etc/profile |
198 |
> > |
199 |
> > # Modify make.conf file to your liking/needs. |
200 |
> > nano -w /etc/make.conf |
201 |
> > # This is for my target, Geode x86 processor. |
202 |
> > /* |
203 |
> > USE="bitmap-fonts minimal truetype-fonts mmx" |
204 |
> > CHOST="i586-gentoo-linux-uclibc" |
205 |
> > CFLAGS="-march=i586 -Os -pipe -fomit-frame-pointer -mmmx" |
206 |
> > CXXFLAGS="${CFLAGS}" |
207 |
> > FEATURES="buildpkg" |
208 |
> > |
209 |
> > VIDEO_CARDS="chips" |
210 |
> > UCLIBC_CPU="586MMX" |
211 |
> > */ |
212 |
> > |
213 |
> > # Set profile to use 2.6 kernel. |
214 |
> > # The current stage uses 2.4 by default, and for most cases you are |
215 |
> > going |
216 |
> > # to want a 2.6.x kernel. |
217 |
> > cd /etc/ |
218 |
> > unlink make.profile |
219 |
> > ln -s ../usr/portage/profiles/uclibc/x86 make.profile |
220 |
> > |
221 |
> > # Start the bootstrap script. |
222 |
> > cd /usr/portage/scripts |
223 |
> > ./bootstrap.sh -p -v |
224 |
> > ./bootstrap.sh |
225 |
> > |
226 |
> > # Emerge the system ebuild for the development_rootfs. |
227 |
> > emerge -e system |
228 |
> > |
229 |
> > #----- Step 3 - Build the embedded_rootfs |
230 |
> > ------------------------------------ |
231 |
> > |
232 |
> > # Create the embedded_rootfs directory. |
233 |
> > mkdir /embedded_rootfs |
234 |
> > |
235 |
> > # Emerge baselayout-lite into embedded_rootfs. |
236 |
> > # This gives your system a basic file structure. |
237 |
> > # 1.0_pre1 is the only one that is stable, right? |
238 |
> > cd /usr/portage/sys-apps/baselayout-lite/ |
239 |
> > ROOT=/embedded_rootfs emerge baselayout-lite-1.0_pre1.ebuild |
240 |
> > |
241 |
> > # Workaround 1 |
242 |
> > # Baselayout-lite is still beta, so a few fixes are needed. |
243 |
> > # There needs to be a directory "log" in /var. |
244 |
> > # Inittab calls for /usr/bin/tail, but it needs to /usr/bin. |
245 |
> > mkdir /embedded_rootfs/var/log |
246 |
> > nano -w /embedded_rootfs/etc/inittab |
247 |
> > /* |
248 |
> > #tty3::respawn:/usr/bin/tail -f /var/log/messages |
249 |
> > tty3::respawn:/bin/tail -f /var/log/messages |
250 |
> > */ |
251 |
> > |
252 |
> > # Emerge uclibc into the embedded_rootfs. |
253 |
> > # Use the -K option because we don't get the extra files created by the |
254 |
> > # build/emerge process into our embedded rootfs which needs to be as |
255 |
> > # small as possible. |
256 |
> > ROOT=/embedded_rootfs emerge -K uclibc |
257 |
> > |
258 |
> > # Emerge busybox into the embedded_rootfs. |
259 |
> > # First you must emerge it into your development_rootfs. |
260 |
> > # This does not create the symlinks in our development embedded rootfs. |
261 |
> > emerge busybox |
262 |
> > ROOT=/embedded_rootfs emerge -K busybox |
263 |
> > |
264 |
> > # Create the symlinks for busybox in the embedded_rootfs. |
265 |
> > mkdir /embedded_rootfs/proc |
266 |
> > mount -o bind /proc/ /embedded_rootfs/proc/ |
267 |
> > chroot /embedded_rootfs /bin/busybox --install -s |
268 |
> > umount /embedded_rootfs/proc |
269 |
> > |
270 |
> > # Set time zone in your embedded_rootfs. |
271 |
> > # See http://leaf.sourceforge.net/doc/guide/buci-tz.html for details. |
272 |
> > # For central standard time in the US, use "CST6CDT". |
273 |
> > nano -w /embedded_rootfs/etc/TZ |
274 |
> > /* |
275 |
> > CST6CDT |
276 |
> > */ |
277 |
> > |
278 |
> > # Install a boot loader (usually grug or lilo). |
279 |
> > # Once you copy/deploy your embedded_rootfs to your target SBC you will |
280 |
> > # have to run grub on the command line to write to the master boot |
281 |
> > record |
282 |
> > # (MBR). |
283 |
> > # For some reason not all of /boot/grub is copied over to the |
284 |
> > # embedded_rootfs, so a extra manual copy step is needed. |
285 |
> > # The --nodeps gets rip of the run time need of ncurses. |
286 |
> > emerge --nodeps grub |
287 |
> > ROOT=/embedded_rootfs emerge -K --nodeps grub |
288 |
> > cp -R /boot/grub /embedded_rootfs/boot/ |
289 |
> > |
290 |
> > # Modify your boot configure file. |
291 |
> > # The example below is for a gurb, for a boot partition on /dev/hda1 and |
292 |
> > only |
293 |
> > # one partition on the target SBC system. |
294 |
> > nano -w /embedded_rootfs/boot/grub/grub.conf |
295 |
> > /* |
296 |
> > default 0 |
297 |
> > timeout 10 |
298 |
> > splashimage=(hd0,0)/boot/grub/splash.xpm.gz |
299 |
> > |
300 |
> > title=Linux 2.6.x |
301 |
> > root (hd0,0) |
302 |
> > kernel /vmlinuz-2.6.x root=/dev/hda1 vga=792 |
303 |
> > */ |
304 |
> > |
305 |
> > # Set root password for the embedded_rootfs |
306 |
> > chromm /embedded_rootfs |
307 |
> > passwd |
308 |
> > rm /embedded_rootfs/etc/passwd- |
309 |
> > exit |
310 |
> > |
311 |
> > # Modify fstab. |
312 |
> > # Below is mine, yours may vary. |
313 |
> > nano -w /embedded_rootfs/etc/fstab |
314 |
> > /* |
315 |
> > /dev/hda1 / reiserfs defaults |
316 |
> > 0 0 |
317 |
> > none /proc proc defaults |
318 |
> > 0 0 |
319 |
> > none /sys sysfs defaults |
320 |
> > 0 0 |
321 |
> > none /dev/shm tmpfs defaults 0 0 |
322 |
> > */ |
323 |
> > |
324 |
> > # Clean up the embedded_rootfs. |
325 |
> > # Don't know why these files are there in the first place, so if anyone |
326 |
> > # can tell me why..... |
327 |
> > rm -R /embedded_rootfs/var/db/pkg/ * |
328 |
> > rm -R /embedded_rootfs/var/lib/portage/ |
329 |
> > |
330 |
> > #---- Step 4 - Build and install non-system programs to the |
331 |
> > embedded_rootfs -- |
332 |
> > |
333 |
> > # Emerge other software you need for you embedded target. |
334 |
> > # This is very wildly depending on your needs. |
335 |
> > # Also your proprietary application will be done here. |
336 |
> > emerge foo* |
337 |
> > ROOT=/embedded_rootfs emerge -K foo* |
338 |
> > |
339 |
> > |
340 |
> > #---- Step 5 - Build and install a kernel to the embedded_rootfs |
341 |
> > ------------- |
342 |
> > |
343 |
> > # Install a kernel into embedded_rootfs. |
344 |
> > # First we will emerge it into our development_rootfs, then configure |
345 |
> > and |
346 |
> > # build it. |
347 |
> > emerge vanilla-sources |
348 |
> > cd /usr/src/ |
349 |
> > cd linux |
350 |
> > make menuconfig |
351 |
> > # Configure your kernel for your TARGET SBC here. I HIGHLY suggest you |
352 |
> > # configure the kernel to compile everything into the kernel, and |
353 |
> > nothing |
354 |
> > # as a module. |
355 |
> > make |
356 |
> > ROOT=/embedded_rootfs make modules_install |
357 |
> > cp /usr/src/linux/arch/i386/boot/bzImage |
358 |
> > /embedded_rootfs/boot/vmlinuz-2.6.x |
359 |
> > |
360 |
> > # A few notes on compiling your kernel. |
361 |
> > # If deploying to Compact Flash/DiskOnChip/SD use ext2, as the |
362 |
> > journaling |
363 |
> > # filing systems "write" to much for a flash device. |
364 |
> > # If deploying to a hard drive use a journaling filing system, such as |
365 |
> > # ext3 or reiserfs. |
366 |
> > |
367 |
> > |
368 |
> > #---- Step 6 - Deploy embedded_rootfs to target |
369 |
> > ------------------------------ |
370 |
> > |
371 |
> > # Prepare a Gentoo (or any Linux distro) system on the target SBC using |
372 |
> > a |
373 |
> > # harddrive. This is known as the target development rootfs. |
374 |
> > # We will create a partition (/embedded_rootfs) that will server as our |
375 |
> > # "test" partition to deploy our embedded_rootfs that we generate on our |
376 |
> > # development_system. |
377 |
> > # |
378 |
> > # I use the following partitions to speed development (yours may vary): |
379 |
> > # /dev/hda1 - /embedded_rootfs - 1 GB |
380 |
> > # /dev/hda2 - /boot - 100 MB |
381 |
> > # /dev/hda3 - swap - (size varies, 512 MB is a good number) |
382 |
> > # /dev/hda4 - / - (what is left, at least 1.5 GB per 2005.0 install |
383 |
> > guide |
384 |
> > specs) |
385 |
> > # |
386 |
> > # Copy over your embedded_rootfs from you development system to your |
387 |
> > target |
388 |
> > # system and the directory /embedded_rootfs. This needs to be done via |
389 |
> > NFS as |
390 |
> > # need to preserve the permissions. |
391 |
> > # |
392 |
> > #The following commands are done from the |
393 |
> > # target development rootfs. |
394 |
> > mount -t reiserfs /dev/hda1 /mnt/embedded_rootfs |
395 |
> > mount -t nfs\ |
396 |
> > 192.168.0.10:/opt/i586-gentoo-uclibc-linux/embedded_rootfs\ |
397 |
> > /mnt/nfs_embedded_rootfs |
398 |
> > cp -adpR /mnt/nfs_embedded_rootfs/* /mnt/embedded_rootfs |
399 |
> > |
400 |
> > |
401 |
> > # Modify your target system's gurb.conf (or lilo.conf) for allow you to |
402 |
> > boot |
403 |
> > # to the embedded_rootfs partition. |
404 |
> > # |
405 |
> > # Reboot, and if all goes well you'll be greeted with a login prompt. |
406 |
> > # |
407 |
> > # Fin. |
408 |
> > |
409 |
> > |
410 |
> > |
411 |
> > -- |
412 |
> > heath holcomb |
413 |
> > liquidcable at bulah.com |
414 |
> > www.bulah.com |
415 |
> > -- |
416 |
> > gentoo-embedded@g.o mailing list |
417 |
> |
418 |
>-- |
419 |
>heath holcomb |
420 |
>liquidcable at bulah.com |
421 |
>www.bulah.com |
422 |
>-- |
423 |
>gentoo-embedded@g.o mailing list |
424 |
> |
425 |
|
426 |
|
427 |
Regards, |
428 |
|
429 |
Pierre Cassimans |
430 |
|
431 |
|
432 |
-- |
433 |
gentoo-embedded@g.o mailing list |