1 |
Hello Heath, |
2 |
|
3 |
Nice writedown! I haven't made it to the end yet (lack of time), but I'm |
4 |
getting there... |
5 |
|
6 |
I noticed some issues along the way (not counting grub begin spelled as |
7 |
"grug" or "gurb" ;-) ) |
8 |
|
9 |
In step 3 you write: |
10 |
|
11 |
<snip> |
12 |
# Set root password for the embedded_rootfs |
13 |
chromm /embedded_rootfs |
14 |
passwd |
15 |
rm /embedded_rootfs/etc/passwd- |
16 |
Exit |
17 |
</snip> |
18 |
|
19 |
I presume 'chromm' should have been 'chroot' ? |
20 |
If it is indeed 'chroot' then you should either do "rm /etc/passwd-" |
21 |
before the "exit" or the "exit" before the "rm |
22 |
/embedded_rootfs/etc/passwd-". |
23 |
|
24 |
A few lines down, you write: |
25 |
|
26 |
<snip> |
27 |
rm -R /embedded_rootfs/var/db/pkg/ * |
28 |
</snip> |
29 |
|
30 |
As a reletive newbie, doing a quick copy/paste of this command late in |
31 |
the evening as root in '/', this wiped out all files, except the ones |
32 |
that were firmly locked. |
33 |
Fortunately, I'm going through you HowTo in VMWare, so I could restore a |
34 |
previous snapshot ;-) |
35 |
|
36 |
I presume the space before the '*' should have been omitted? |
37 |
|
38 |
<snip> |
39 |
rm -R /embedded_rootfs/var/db/pkg/* |
40 |
</snip> |
41 |
|
42 |
|
43 |
My aim is to create an embedded Gentoo for a Via Epia ME6000, which |
44 |
reads the kernel and a ramdisk image from CF and then runs completely |
45 |
from RAM. |
46 |
If I'm not mistaken, you were heading for a Via Epia as well? |
47 |
|
48 |
Regards, |
49 |
|
50 |
Marcel Romijn |
51 |
|
52 |
|
53 |
-----Original Message----- |
54 |
From: Heath Holcomb [mailto:liquidcable@×××××.com] |
55 |
Sent: Monday, 08 August, 2005 4:17 |
56 |
To: gentoo-embedded@l.g.o |
57 |
Subject: [gentoo-embedded] x86 SBC Gentoo Embedded HotTo version 0.07 |
58 |
|
59 |
Version 0.07 |
60 |
Please add, delete, modify. Thanks! |
61 |
|
62 |
Several fixes. Root password now works. Several work arounds are no |
63 |
longer |
64 |
need, as the embedded Gentoo team has fixed them (I'm guess because I no |
65 |
|
66 |
longer get those errors). There is still one problem when "emerge -e |
67 |
system" |
68 |
for groff. Bug 98187 (http://bugs.gentoo.org/show_bug.cgi?id=98187). |
69 |
Check |
70 |
out the bug report for the temp fix/work around (USE="-sandbox" emerge |
71 |
-e |
72 |
system). |
73 |
|
74 |
I've update my website with this version also. |
75 |
http://www.bulah.com/embeddedgentoo.html |
76 |
|
77 |
|
78 |
#----------------------------------------------------------------------- |
79 |
--------- |
80 |
# Embedded Gentoo How-To for x86 |
81 |
# |
82 |
# A how-to guide to setup a Gentoo embedded environment, you must be |
83 |
root. |
84 |
# These commands are to be run on your development system, |
85 |
# any x86 Gentoo Linux computer will do. The system should be fast, |
86 |
# to speed development. The target can be any x86 based SBC. I'm |
87 |
# using a Geode based SBC. Latter I'll use a Via based SBC. |
88 |
# |
89 |
# version 0.07 |
90 |
# 2005.8.7 |
91 |
# |
92 |
# Heath Holcomb (heath at bulah.com) |
93 |
# Ned Ludd (original commands posted) |
94 |
# Lloyd Sargent (contributor) |
95 |
# Yuri Vasilevski (contributor) |
96 |
# Mike George (contributor) |
97 |
# Kammi Cazze (contributor) |
98 |
# Marius Schaefer (contributor) |
99 |
# |
100 |
# Definitions and Terms |
101 |
# system_rootfs = your regular rootfs, development computer |
102 |
# development_rootfs = what you use to build the embedded_rootfs |
103 |
# embedded_rootfs = rootfs you deploy to the target system |
104 |
# SBC = single board computer (here it's an x86 based) |
105 |
# |
106 |
# References |
107 |
# http://www.gentoo.org/doc/en/handbook/index.xml |
108 |
# http://www.epiawiki.org |
109 |
# http://epia.kalf.org |
110 |
# Gentoo embedded mailing list (gentoo-embedded@l.g.o) |
111 |
# |
112 |
# |
113 |
# Overview of process (steps) |
114 |
# 1 - Prepare the development_rootfs from your system_rootfs |
115 |
# 2 - Build the development_rootfs |
116 |
# 3 - Build the embedded_rootfs |
117 |
# 4 - Build and install non-system programs to the embedded_rootfs |
118 |
# 5 - Build and install a kernel to the embedded_rootfs |
119 |
# 6 - Deploy embedded_rootfs to target |
120 |
# |
121 |
#----------------------------------------------------------------------- |
122 |
--------- |
123 |
|
124 |
#----- Step 1 - Prepare the development_rootfs from your system_rootfs |
125 |
------- |
126 |
|
127 |
# You must be root. |
128 |
su - |
129 |
|
130 |
# Create the development_rootfs. |
131 |
# I use i586 because of target is a Geode processor. |
132 |
mkdir -p /opt/i586-gentoo-uclibc-linux/usr/portage |
133 |
|
134 |
# Download the latest stage 1 tarball. |
135 |
wget \ |
136 |
http://gentoo.osuosl.org/experimental/x86/embedded/stages/stage1-x86-ucl |
137 |
ibc-2005.0.tar.bz2 |
138 |
|
139 |
# Untar the stage to the development_rootfs. |
140 |
tar -xvjpf stage1-x86-uclibc-2005.0.tar.bz2 -C |
141 |
/opt/i586-gentoo-uclibc-linux/ |
142 |
|
143 |
# Mount the proc and portage directories to your development_rootfs. |
144 |
# Makes your system_rootfs's proc and portage directory available from |
145 |
inside |
146 |
# of your development_rootfs (after chrooting). |
147 |
mount --bind /proc /opt/i586-gentoo-uclibc-linux/proc/ |
148 |
mount --bind /usr/portage /opt/i586-gentoo-uclibc-linux/usr/portage |
149 |
|
150 |
# Copy over DNS information to the development_rootfs. |
151 |
cp /etc/resolv.conf /opt/i586-gentoo-uclibc-linux/etc/resolv.conf |
152 |
|
153 |
# Chroot into the development_rootfs. |
154 |
chroot /opt/i586-gentoo-uclibc-linux /bin/bash --login |
155 |
|
156 |
|
157 |
#----- Step 2 - Build the development_rootfs |
158 |
--------------------------------- |
159 |
|
160 |
# Create new environment and load variables into memory. |
161 |
env-update |
162 |
source /etc/profile |
163 |
|
164 |
# Modify make.conf file to your liking/needs. |
165 |
nano -w /etc/make.conf |
166 |
# This is for my target, Geode x86 processor. |
167 |
/* |
168 |
USE="bitmap-fonts minimal truetype-fonts mmx" |
169 |
CHOST="i586-gentoo-linux-uclibc" |
170 |
CFLAGS="-march=i586 -Os -pipe -fomit-frame-pointer -mmmx" |
171 |
CXXFLAGS="${CFLAGS}" |
172 |
FEATURES="buildpkg" |
173 |
|
174 |
VIDEO_CARDS="chips" |
175 |
UCLIBC_CPU="586MMX" |
176 |
*/ |
177 |
|
178 |
# Set profile to use 2.6 kernel. |
179 |
# The current stage uses 2.4 by default, and for most cases you are |
180 |
going |
181 |
# to want a 2.6.x kernel. |
182 |
cd /etc/ |
183 |
unlink make.profile |
184 |
ln -s ../usr/portage/profiles/uclibc/x86 make.profile |
185 |
|
186 |
# Start the bootstrap script. |
187 |
cd /usr/portage/scripts |
188 |
./bootstrap.sh -p -v |
189 |
./bootstrap.sh |
190 |
|
191 |
# Emerge the system ebuild for the development_rootfs. |
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 |
# Workaround 1 |
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 by the |
219 |
# build/emerge process into our embedded rootfs which needs to be as |
220 |
# 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 rootfs. |
226 |
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 details. |
237 |
# 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 grug or lilo). |
244 |
# Once you copy/deploy your embedded_rootfs to your target SBC you will |
245 |
# have to run grub on the command line to write to the master boot |
246 |
record |
247 |
# (MBR). |
248 |
# For some reason not all of /boot/grub is copied over to the |
249 |
# embedded_rootfs, so a extra manual copy step is needed. |
250 |
# The --nodeps gets rip of the run time need of ncurses. |
251 |
emerge --nodeps grub |
252 |
ROOT=/embedded_rootfs emerge -K --nodeps grub |
253 |
cp -R /boot/grub /embedded_rootfs/boot/ |
254 |
|
255 |
# Modify your boot configure file. |
256 |
# The example below is for a gurb, for a boot partition on /dev/hda1 and |
257 |
only |
258 |
# one partition on the target SBC system. |
259 |
nano -w /embedded_rootfs/boot/grub/grub.conf |
260 |
/* |
261 |
default 0 |
262 |
timeout 10 |
263 |
splashimage=(hd0,0)/boot/grub/splash.xpm.gz |
264 |
|
265 |
title=Linux 2.6.x |
266 |
root (hd0,0) |
267 |
kernel /vmlinuz-2.6.x root=/dev/hda1 vga=792 |
268 |
*/ |
269 |
|
270 |
# Set root password for the embedded_rootfs |
271 |
chromm /embedded_rootfs |
272 |
passwd |
273 |
rm /embedded_rootfs/etc/passwd- |
274 |
exit |
275 |
|
276 |
# Modify fstab. |
277 |
# Below is mine, yours may vary. |
278 |
nano -w /embedded_rootfs/etc/fstab |
279 |
/* |
280 |
/dev/hda1 / reiserfs defaults |
281 |
0 0 |
282 |
none /proc proc defaults |
283 |
0 0 |
284 |
none /sys sysfs defaults |
285 |
0 0 |
286 |
none /dev/shm tmpfs defaults 0 0 |
287 |
*/ |
288 |
|
289 |
# Clean up the embedded_rootfs. |
290 |
# Don't know why these files are there in the first place, so if anyone |
291 |
# can tell me why..... |
292 |
rm -R /embedded_rootfs/var/db/pkg/ * |
293 |
rm -R /embedded_rootfs/var/lib/portage/ |
294 |
|
295 |
#---- Step 4 - Build and install non-system programs to the |
296 |
embedded_rootfs -- |
297 |
|
298 |
# Emerge other software you need for you embedded target. |
299 |
# This is very wildly depending on your needs. |
300 |
# Also your proprietary application will be done here. |
301 |
emerge foo* |
302 |
ROOT=/embedded_rootfs emerge -K foo* |
303 |
|
304 |
|
305 |
#---- Step 5 - Build and install a kernel to the embedded_rootfs |
306 |
------------- |
307 |
|
308 |
# Install a kernel into embedded_rootfs. |
309 |
# First we will emerge it into our development_rootfs, then configure |
310 |
and |
311 |
# build it. |
312 |
emerge vanilla-sources |
313 |
cd /usr/src/ |
314 |
cd linux |
315 |
make menuconfig |
316 |
# Configure your kernel for your TARGET SBC here. I HIGHLY suggest you |
317 |
# configure the kernel to compile everything into the kernel, and |
318 |
nothing |
319 |
# as a module. |
320 |
make |
321 |
ROOT=/embedded_rootfs make modules_install |
322 |
cp /usr/src/linux/arch/i386/boot/bzImage |
323 |
/embedded_rootfs/boot/vmlinuz-2.6.x |
324 |
|
325 |
# A few notes on compiling your kernel. |
326 |
# If deploying to Compact Flash/DiskOnChip/SD use ext2, as the |
327 |
journaling |
328 |
# filing systems "write" to much for a flash device. |
329 |
# If deploying to a hard drive use a journaling filing system, such as |
330 |
# ext3 or reiserfs. |
331 |
|
332 |
|
333 |
#---- Step 6 - Deploy embedded_rootfs to target |
334 |
------------------------------ |
335 |
|
336 |
# Prepare a Gentoo (or any Linux distro) system on the target SBC using |
337 |
a |
338 |
# harddrive. This is known as the target development rootfs. |
339 |
# We will create a partition (/embedded_rootfs) that will server as our |
340 |
# "test" partition to deploy our embedded_rootfs that we generate on our |
341 |
# development_system. |
342 |
# |
343 |
# I use the following partitions to speed development (yours may vary): |
344 |
# /dev/hda1 - /embedded_rootfs - 1 GB |
345 |
# /dev/hda2 - /boot - 100 MB |
346 |
# /dev/hda3 - swap - (size varies, 512 MB is a good number) |
347 |
# /dev/hda4 - / - (what is left, at least 1.5 GB per 2005.0 install |
348 |
guide |
349 |
specs) |
350 |
# |
351 |
# Copy over your embedded_rootfs from you development system to your |
352 |
target |
353 |
# system and the directory /embedded_rootfs. This needs to be done via |
354 |
NFS as |
355 |
# need to preserve the permissions. |
356 |
# |
357 |
#The following commands are done from the |
358 |
# target development rootfs. |
359 |
mount -t reiserfs /dev/hda1 /mnt/embedded_rootfs |
360 |
mount -t nfs\ |
361 |
192.168.0.10:/opt/i586-gentoo-uclibc-linux/embedded_rootfs\ |
362 |
/mnt/nfs_embedded_rootfs |
363 |
cp -adpR /mnt/nfs_embedded_rootfs/* /mnt/embedded_rootfs |
364 |
|
365 |
|
366 |
# Modify your target system's gurb.conf (or lilo.conf) for allow you to |
367 |
boot |
368 |
# to the embedded_rootfs partition. |
369 |
# |
370 |
# Reboot, and if all goes well you'll be greeted with a login prompt. |
371 |
# |
372 |
# Fin. |
373 |
|
374 |
|
375 |
|
376 |
-- |
377 |
heath holcomb |
378 |
liquidcable at bulah.com |
379 |
www.bulah.com |
380 |
-- |
381 |
gentoo-embedded@g.o mailing list |
382 |
|
383 |
|
384 |
|
385 |
-- |
386 |
gentoo-embedded@g.o mailing list |