Gentoo Archives: gentoo-embedded

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

Replies