Gentoo Archives: gentoo-embedded

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

Replies

Subject Author
[OT] Re: [gentoo-embedded] x86 SBC Gentoo Embedded HotTo version 0.07 Natanael Copa <mlists@××××××.org>