Gentoo Archives: gentoo-embedded

From: Marcel Romijn <MRomijn@×××××××××××××××.com>
To: gentoo-embedded@l.g.o
Subject: RE: [gentoo-embedded] x86 SBC Gentoo Embedded HotTo version 0.07
Date: Thu, 18 Aug 2005 06:25:08
Message-Id: AAEDC66F6A58E34CA4553712A2FC80F539386B@ns1018.seagull.nl
1 Hi Steph,
2
3 I hadn't thought about that... Only mount the read/write part of the
4 filesystem in ram and mount the rest from CF readonly.
5
6 I've been reading up on GNAP. That is close to what I want to
7 accomplish. It looks like I can use that as a base and extend it for my
8 needs.
9
10 I'm not using catalyst. But it looks like I might use that if I want to
11 extend GNAP...
12
13 Thanks for the hints ;-)
14
15 Marcel
16
17 -----Original Message-----
18 From: S. ancelot [mailto:sancelot@××××.fr]
19 Sent: Tuesday, 16 August, 2005 11:29
20 To: gentoo-embedded@l.g.o
21 Subject: Re: [gentoo-embedded] x86 SBC Gentoo Embedded HotTo version
22 0.07
23
24
25 Hi,
26
27 If I remember, the best thing to do is using a squashfs filesystem.
28
29 Taking the filesystem completely in ram is a bad idea and unnecessary
30 (CF are lifetime warranty if you only read it !).
31
32 Are you using catalyst ???
33
34
35 I advice you trying GNAP in order to understand how to go on ...
36
37 Best regards
38 Steph
39
40
41 Marcel Romijn wrote:
42
43 >Hi Heath,
44 >
45 >I know about the limited number of write cycles on CF. Therefore I want
46 >the CF only to supply the kernel and the ramdisk image. My intention is
47 >to run Linux and my application completely from ramdisk.
48 >I want my device to be complately silent, therefore it has a fanless
49 >ME6000 board, no fans in the case and no harddisk (actually strange to
50 >'hear' a computer boot in complete silence!). The CF is on an IDE
51 >converter and is recognized as /dev/hda1 (although for testing it has a
52 >normal harddisk connected).
53 >
54 >I was able to follow your howto to the end.
55 >Although I had some problems where the boot process stopped after
56 >"Freeing unused kernel memory". This turned out to be a typo in
57 >/etc/fstab on my side.
58 >
59 >Now that I have bootable configuration, I can look into what it takes
60 to
61 >have the system files in a ramdisk image and have it mounted as '/'.
62 >
63 >I think I could just create an initrd from the whole system and have
64 >grub and the kernel extract it in memory and mount it.
65 >I have not done much investigation on it, be it seems to me that the
66 >/linuxrc in the initrd can be fairly simple. Actually just calling the
67 >/sbin/init once the ramdisk is mountded as '/'.
68 >
69 >Anyone any experience with this?
70 >
71 >PS. Maybe we should spawn of another thread about VIA Epia boards, CF
72 >and booting. I saw Pierre Cassimans is interested in this subject as
73 >well.
74 >This might go off topic for the Gentoo Embedded Howto.
75 >
76 >Marcel
77 >
78 >-----Original Message-----
79 >From: Heath Holcomb [mailto:liquidcable@×××××.com]
80 >Sent: Sunday, 14 August, 2005 0:53
81 >To: gentoo-embedded@l.g.o
82 >Subject: Re: [gentoo-embedded] x86 SBC Gentoo Embedded HotTo version
83 >0.07
84 >
85 >On Friday 12 August 2005 01:39 am, Marcel Romijn wrote:
86 >
87 >
88 >>Hello Heath,
89 >>
90 >>Nice writedown! I haven't made it to the end yet (lack of time), but
91 >>
92 >>
93 >I'm
94 >
95 >
96 >>getting there...
97 >>
98 >>I noticed some issues along the way (not counting grub begin spelled
99 >>
100 >>
101 >as
102 >
103 >
104 >>"grug" or "gurb" ;-) )
105 >>
106 >>In step 3 you write:
107 >>
108 >><snip>
109 >># Set root password for the embedded_rootfs
110 >>chromm /embedded_rootfs
111 >>passwd
112 >>rm /embedded_rootfs/etc/passwd-
113 >>Exit
114 >></snip>
115 >>
116 >>I presume 'chromm' should have been 'chroot' ?
117 >>If it is indeed 'chroot' then you should either do "rm /etc/passwd-"
118 >>before the "exit" or the "exit" before the "rm
119 >>/embedded_rootfs/etc/passwd-".
120 >>
121 >>
122 >
123 >Yes, "chromm" should be "chroot". The order is correct, as far as I
124 can
125 >tell.
126 >chroot /embedded_rootfs
127 >passwd
128 >rm /embedded_rootfs/etc/passwd-
129 >exit
130 >
131 >
132 >
133 >
134 >>A few lines down, you write:
135 >>
136 >><snip>
137 >>rm -R /embedded_rootfs/var/db/pkg/ *
138 >></snip>
139 >>
140 >>As a reletive newbie, doing a quick copy/paste of this command late in
141 >>the evening as root in '/', this wiped out all files, except the ones
142 >>that were firmly locked.
143 >>Fortunately, I'm going through you HowTo in VMWare, so I could restore
144 >>
145 >>
146 >a
147 >
148 >
149 >>previous snapshot ;-)
150 >>
151 >>I presume the space before the '*' should have been omitted?
152 >>
153 >><snip>
154 >>rm -R /embedded_rootfs/var/db/pkg/*
155 >></snip>
156 >>
157 >>
158 >
159 >Major typo on my part. Fixed in version 0.08.
160 >
161 >
162 >
163 >>My aim is to create an embedded Gentoo for a Via Epia ME6000, which
164 >>reads the kernel and a ramdisk image from CF and then runs completely
165 >>from RAM.
166 >>If I'm not mistaken, you were heading for a Via Epia as well?
167 >>
168 >>
169 >
170 >My target will be a Via based SBC. From what I have read using a
171 >ramdisk on a
172 >x86 based platform really does not buy you much. But you sure don't
173 >want to
174 >write to the CF all that often (limited write cycles, usallay 100,000
175 to
176 >
177 >300,000). So I plan on mounting the / partition of the CF as read only
178 >and
179 >creating a separate partition that is mounted read/write and have my
180 >embedded
181 >application and only my application write to that partition.
182 >
183 >
184 >
185 >>Regards,
186 >>
187 >>Marcel Romijn
188 >>
189 >>
190 >>-----Original Message-----
191 >>From: Heath Holcomb [mailto:liquidcable@×××××.com]
192 >>Sent: Monday, 08 August, 2005 4:17
193 >>To: gentoo-embedded@l.g.o
194 >>Subject: [gentoo-embedded] x86 SBC Gentoo Embedded HotTo version 0.07
195 >>
196 >>Version 0.07
197 >>Please add, delete, modify. Thanks!
198 >>
199 >>Several fixes. Root password now works. Several work arounds are no
200 >>longer
201 >>need, as the embedded Gentoo team has fixed them (I'm guess because I
202 >>
203 >>
204 >no
205 >
206 >
207 >>longer get those errors). There is still one problem when "emerge -e
208 >>system"
209 >>for groff. Bug 98187 (http://bugs.gentoo.org/show_bug.cgi?id=98187).
210 >>Check
211 >>out the bug report for the temp fix/work around (USE="-sandbox" emerge
212 >>-e
213 >>system).
214 >>
215 >>I've update my website with this version also.
216 >>http://www.bulah.com/embeddedgentoo.html
217 >>
218 >>
219 >>
220 >>
221 >>
222 >#----------------------------------------------------------------------
223 -
224 >
225 >
226 >>---------
227 >># Embedded Gentoo How-To for x86
228 >>#
229 >># A how-to guide to setup a Gentoo embedded environment, you must be
230 >>root.
231 >># These commands are to be run on your development system,
232 >># any x86 Gentoo Linux computer will do. The system should be fast,
233 >># to speed development. The target can be any x86 based SBC. I'm
234 >># using a Geode based SBC. Latter I'll use a Via based SBC.
235 >>#
236 >># version 0.07
237 >># 2005.8.7
238 >>#
239 >># Heath Holcomb (heath at bulah.com)
240 >># Ned Ludd (original commands posted)
241 >># Lloyd Sargent (contributor)
242 >># Yuri Vasilevski (contributor)
243 >># Mike George (contributor)
244 >># Kammi Cazze (contributor)
245 >># Marius Schaefer (contributor)
246 >>#
247 >># Definitions and Terms
248 >># system_rootfs = your regular rootfs, development computer
249 >># development_rootfs = what you use to build the embedded_rootfs
250 >># embedded_rootfs = rootfs you deploy to the target system
251 >># SBC = single board computer (here it's an x86 based)
252 >>#
253 >># References
254 >># http://www.gentoo.org/doc/en/handbook/index.xml
255 >># http://www.epiawiki.org
256 >># http://epia.kalf.org
257 >># Gentoo embedded mailing list (gentoo-embedded@l.g.o)
258 >>#
259 >>#
260 >># Overview of process (steps)
261 >># 1 - Prepare the development_rootfs from your system_rootfs
262 >># 2 - Build the development_rootfs
263 >># 3 - Build the embedded_rootfs
264 >># 4 - Build and install non-system programs to the embedded_rootfs
265 >># 5 - Build and install a kernel to the embedded_rootfs
266 >># 6 - Deploy embedded_rootfs to target
267 >>#
268 >>
269 >>
270 >>
271 >#----------------------------------------------------------------------
272 -
273 >
274 >
275 >>---------
276 >>
277 >>#----- Step 1 - Prepare the development_rootfs from your system_rootfs
278 >>-------
279 >>
280 >># You must be root.
281 >>su -
282 >>
283 >># Create the development_rootfs.
284 >># I use i586 because of target is a Geode processor.
285 >>mkdir -p /opt/i586-gentoo-uclibc-linux/usr/portage
286 >>
287 >># Download the latest stage 1 tarball.
288 >>wget \
289 >>
290 >>
291 >>
292 >http://gentoo.osuosl.org/experimental/x86/embedded/stages/stage1-x86-uc
293 l
294 >
295 >
296 >>ibc-2005.0.tar.bz2
297 >>
298 >># Untar the stage to the development_rootfs.
299 >>tar -xvjpf stage1-x86-uclibc-2005.0.tar.bz2 -C
300 >>/opt/i586-gentoo-uclibc-linux/
301 >>
302 >># Mount the proc and portage directories to your development_rootfs.
303 >># Makes your system_rootfs's proc and portage directory available from
304 >>inside
305 >># of your development_rootfs (after chrooting).
306 >>mount --bind /proc /opt/i586-gentoo-uclibc-linux/proc/
307 >>mount --bind /usr/portage /opt/i586-gentoo-uclibc-linux/usr/portage
308 >>
309 >># Copy over DNS information to the development_rootfs.
310 >>cp /etc/resolv.conf /opt/i586-gentoo-uclibc-linux/etc/resolv.conf
311 >>
312 >># Chroot into the development_rootfs.
313 >>chroot /opt/i586-gentoo-uclibc-linux /bin/bash --login
314 >>
315 >>
316 >>#----- Step 2 - Build the development_rootfs
317 >>---------------------------------
318 >>
319 >># Create new environment and load variables into memory.
320 >>env-update
321 >>source /etc/profile
322 >>
323 >># Modify make.conf file to your liking/needs.
324 >>nano -w /etc/make.conf
325 >># This is for my target, Geode x86 processor.
326 >>/*
327 >>USE="bitmap-fonts minimal truetype-fonts mmx"
328 >>CHOST="i586-gentoo-linux-uclibc"
329 >>CFLAGS="-march=i586 -Os -pipe -fomit-frame-pointer -mmmx"
330 >>CXXFLAGS="${CFLAGS}"
331 >>FEATURES="buildpkg"
332 >>
333 >>VIDEO_CARDS="chips"
334 >>UCLIBC_CPU="586MMX"
335 >>*/
336 >>
337 >># Set profile to use 2.6 kernel.
338 >># The current stage uses 2.4 by default, and for most cases you are
339 >>going
340 >># to want a 2.6.x kernel.
341 >>cd /etc/
342 >>unlink make.profile
343 >>ln -s ../usr/portage/profiles/uclibc/x86 make.profile
344 >>
345 >># Start the bootstrap script.
346 >>cd /usr/portage/scripts
347 >>./bootstrap.sh -p -v
348 >>./bootstrap.sh
349 >>
350 >># Emerge the system ebuild for the development_rootfs.
351 >>emerge -e system
352 >>
353 >>#----- Step 3 - Build the embedded_rootfs
354 >>------------------------------------
355 >>
356 >># Create the embedded_rootfs directory.
357 >>mkdir /embedded_rootfs
358 >>
359 >># Emerge baselayout-lite into embedded_rootfs.
360 >># This gives your system a basic file structure.
361 >># 1.0_pre1 is the only one that is stable, right?
362 >>cd /usr/portage/sys-apps/baselayout-lite/
363 >>ROOT=/embedded_rootfs emerge baselayout-lite-1.0_pre1.ebuild
364 >>
365 >># Workaround 1
366 >># Baselayout-lite is still beta, so a few fixes are needed.
367 >># There needs to be a directory "log" in /var.
368 >># Inittab calls for /usr/bin/tail, but it needs to /usr/bin.
369 >>mkdir /embedded_rootfs/var/log
370 >>nano -w /embedded_rootfs/etc/inittab
371 >>/*
372 >>#tty3::respawn:/usr/bin/tail -f /var/log/messages
373 >>tty3::respawn:/bin/tail -f /var/log/messages
374 >>*/
375 >>
376 >># Emerge uclibc into the embedded_rootfs.
377 >># Use the -K option because we don't get the extra files created by
378 >>
379 >>
380 >the
381 >
382 >
383 >># build/emerge process into our embedded rootfs which needs to be as
384 >># small as possible.
385 >>ROOT=/embedded_rootfs emerge -K uclibc
386 >>
387 >># Emerge busybox into the embedded_rootfs.
388 >># First you must emerge it into your development_rootfs.
389 >># This does not create the symlinks in our development embedded
390 >>
391 >>
392 >rootfs.
393 >
394 >
395 >>emerge busybox
396 >>ROOT=/embedded_rootfs emerge -K busybox
397 >>
398 >># Create the symlinks for busybox in the embedded_rootfs.
399 >>mkdir /embedded_rootfs/proc
400 >>mount -o bind /proc/ /embedded_rootfs/proc/
401 >>chroot /embedded_rootfs /bin/busybox --install -s
402 >>umount /embedded_rootfs/proc
403 >>
404 >># Set time zone in your embedded_rootfs.
405 >># See http://leaf.sourceforge.net/doc/guide/buci-tz.html for details.
406 >># For central standard time in the US, use "CST6CDT".
407 >>nano -w /embedded_rootfs/etc/TZ
408 >>/*
409 >>CST6CDT
410 >>*/
411 >>
412 >># Install a boot loader (usually grug or lilo).
413 >># Once you copy/deploy your embedded_rootfs to your target SBC you
414 >>
415 >>
416 >will
417 >
418 >
419 >># have to run grub on the command line to write to the master boot
420 >>record
421 >># (MBR).
422 >># For some reason not all of /boot/grub is copied over to the
423 >># embedded_rootfs, so a extra manual copy step is needed.
424 >># The --nodeps gets rip of the run time need of ncurses.
425 >>emerge --nodeps grub
426 >>ROOT=/embedded_rootfs emerge -K --nodeps grub
427 >>cp -R /boot/grub /embedded_rootfs/boot/
428 >>
429 >># Modify your boot configure file.
430 >># The example below is for a gurb, for a boot partition on /dev/hda1
431 >>
432 >>
433 >and
434 >
435 >
436 >>only
437 >># one partition on the target SBC system.
438 >>nano -w /embedded_rootfs/boot/grub/grub.conf
439 >>/*
440 >>default 0
441 >>timeout 10
442 >>splashimage=(hd0,0)/boot/grub/splash.xpm.gz
443 >>
444 >>title=Linux 2.6.x
445 >>root (hd0,0)
446 >>kernel /vmlinuz-2.6.x root=/dev/hda1 vga=792
447 >>*/
448 >>
449 >># Set root password for the embedded_rootfs
450 >>chromm /embedded_rootfs
451 >>passwd
452 >>rm /embedded_rootfs/etc/passwd-
453 >>exit
454 >>
455 >># Modify fstab.
456 >># Below is mine, yours may vary.
457 >>nano -w /embedded_rootfs/etc/fstab
458 >>/*
459 >>/dev/hda1 / reiserfs defaults
460 >>0 0
461 >>none /proc proc defaults
462 >>0 0
463 >>none /sys sysfs defaults
464 >>0 0
465 >>none /dev/shm tmpfs defaults 0 0
466 >>*/
467 >>
468 >># Clean up the embedded_rootfs.
469 >># Don't know why these files are there in the first place, so if
470 >>
471 >>
472 >anyone
473 >
474 >
475 >># can tell me why.....
476 >>rm -R /embedded_rootfs/var/db/pkg/ *
477 >>rm -R /embedded_rootfs/var/lib/portage/
478 >>
479 >>#---- Step 4 - Build and install non-system programs to the
480 >>embedded_rootfs --
481 >>
482 >># Emerge other software you need for you embedded target.
483 >># This is very wildly depending on your needs.
484 >># Also your proprietary application will be done here.
485 >>emerge foo*
486 >>ROOT=/embedded_rootfs emerge -K foo*
487 >>
488 >>
489 >>#---- Step 5 - Build and install a kernel to the embedded_rootfs
490 >>-------------
491 >>
492 >># Install a kernel into embedded_rootfs.
493 >># First we will emerge it into our development_rootfs, then configure
494 >>and
495 >># build it.
496 >>emerge vanilla-sources
497 >>cd /usr/src/
498 >>cd linux
499 >>make menuconfig
500 >># Configure your kernel for your TARGET SBC here. I HIGHLY suggest
501 >>
502 >>
503 >you
504 >
505 >
506 >># configure the kernel to compile everything into the kernel, and
507 >>nothing
508 >># as a module.
509 >>make
510 >>ROOT=/embedded_rootfs make modules_install
511 >>cp /usr/src/linux/arch/i386/boot/bzImage
512 >>/embedded_rootfs/boot/vmlinuz-2.6.x
513 >>
514 >># A few notes on compiling your kernel.
515 >># If deploying to Compact Flash/DiskOnChip/SD use ext2, as the
516 >>journaling
517 >># filing systems "write" to much for a flash device.
518 >># If deploying to a hard drive use a journaling filing system, such as
519 >># ext3 or reiserfs.
520 >>
521 >>
522 >>#---- Step 6 - Deploy embedded_rootfs to target
523 >>------------------------------
524 >>
525 >># Prepare a Gentoo (or any Linux distro) system on the target SBC
526 >>
527 >>
528 >using
529 >
530 >
531 >>a
532 >># harddrive. This is known as the target development rootfs.
533 >># We will create a partition (/embedded_rootfs) that will server as
534 >>
535 >>
536 >our
537 >
538 >
539 >># "test" partition to deploy our embedded_rootfs that we generate on
540 >>
541 >>
542 >our
543 >
544 >
545 >># development_system.
546 >>#
547 >># I use the following partitions to speed development (yours may
548 >>
549 >>
550 >vary):
551 >
552 >
553 >># /dev/hda1 - /embedded_rootfs - 1 GB
554 >># /dev/hda2 - /boot - 100 MB
555 >># /dev/hda3 - swap - (size varies, 512 MB is a good number)
556 >># /dev/hda4 - / - (what is left, at least 1.5 GB per 2005.0 install
557 >>guide
558 >>specs)
559 >>#
560 >># Copy over your embedded_rootfs from you development system to your
561 >>target
562 >># system and the directory /embedded_rootfs. This needs to be done
563 >>
564 >>
565 >via
566 >
567 >
568 >>NFS as
569 >># need to preserve the permissions.
570 >>#
571 >>#The following commands are done from the
572 >># target development rootfs.
573 >>mount -t reiserfs /dev/hda1 /mnt/embedded_rootfs
574 >>mount -t nfs\
575 >>192.168.0.10:/opt/i586-gentoo-uclibc-linux/embedded_rootfs\
576 >>/mnt/nfs_embedded_rootfs
577 >>cp -adpR /mnt/nfs_embedded_rootfs/* /mnt/embedded_rootfs
578 >>
579 >>
580 >># Modify your target system's gurb.conf (or lilo.conf) for allow you
581 >>
582 >>
583 >to
584 >
585 >
586 >>boot
587 >># to the embedded_rootfs partition.
588 >>#
589 >># Reboot, and if all goes well you'll be greeted with a login prompt.
590 >>#
591 >># Fin.
592 >>
593 >>
594 >>
595 >>--
596 >>heath holcomb
597 >>liquidcable at bulah.com
598 >>www.bulah.com
599 >>--
600 >>gentoo-embedded@g.o mailing list
601 >>
602 >>
603 >
604 >
605 >
606 --
607 gentoo-embedded@g.o mailing list
608
609
610
611 --
612 gentoo-embedded@g.o mailing list