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

Replies

Subject Author
RE: [gentoo-embedded] x86 SBC Gentoo Embedded HotTo version 0.07 Lee Azzarello <lee.azzarello@×××××××××.com>