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