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