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