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