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