Gentoo Archives: gentoo-embedded

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

Replies

Subject Author
Re: [gentoo-embedded] x86 SBC Gentoo Embedded HotTo version 0.07 Heath Holcomb <liquidcable@×××××.com>