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

Replies

Subject Author
RE: [gentoo-embedded] x86 SBC Gentoo Embedded HotTo version 0.08 Marius Schaefer/Camberg/ISBAC <Marius.Schaefer@×××××.COM>