1 |
Hi Yuri, Heath, Gentoo-embedded folks: |
2 |
|
3 |
I've taken your suggestion, Heath, and built a 2.6 kernel (instead of |
4 |
the 2.4 I made by accident), and I've followed version 0.6 of your HOWTO |
5 |
with Yuri's comments. |
6 |
|
7 |
Grub loads, finds the kernel, and booting starts, but it doesn't go all |
8 |
the way: |
9 |
|
10 |
warning: unable to open an initial console |
11 |
kernel panic: no init found |
12 |
|
13 |
(That's not an exact quote). I've checked that my kernel's .config |
14 |
includes consoles, and that /dev/console exists and is linked to |
15 |
character device 5,1. |
16 |
|
17 |
I haven't done a whole lot of research into this yet but wonder if |
18 |
anything springs to your collective minds. |
19 |
|
20 |
As usual, any comments appreciated and any suggestions entertained. |
21 |
|
22 |
Michael |
23 |
|
24 |
|
25 |
On Mon, 6 Jun 2005, Yuri Vasilevski wrote: |
26 |
|
27 |
> Hi, |
28 |
> |
29 |
> On Mon, 6 Jun 2005 10:03:26 -0500 |
30 |
> Heath H Holcomb <liquidcable@×××××.com> wrote: |
31 |
> |
32 |
>> Version 0.06 |
33 |
>> Please add, delete, modify. Thanks! |
34 |
> |
35 |
> Just some things that came to my mind with respect to this |
36 |
> version. |
37 |
> |
38 |
>> This procedure produces a working embedded rootfs, that boots form a hard |
39 |
>> drive on a Geode based SBC (single board computer); at least on my |
40 |
>> development system. |
41 |
>> |
42 |
>> I've update my website with this version also. |
43 |
>> http://www.bulah.com/embeddedgentoo.html |
44 |
>> |
45 |
>> |
46 |
>> #-------------------------------------------------------------------------------- |
47 |
>> # Embedded Gentoo How-To for x86 |
48 |
>> # |
49 |
>> # A how-to guide to setup a Gentoo embedded environment, you must be root. |
50 |
>> # These commands are to be run on your development system, |
51 |
>> # any x86 Gentoo Linux computer will do. The system should be 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 |
>> # version 0.06 |
56 |
>> # 2005.6.6 |
57 |
>> # |
58 |
>> # Heath Holcomb (heath at bulah.com) |
59 |
>> # Ned Ludd (embedded Gentoo project lead, original commands posted) |
60 |
>> # Lloyd Sargent (contributor) |
61 |
>> # Yuri Vasilevshi (contributor) |
62 |
> |
63 |
> It's Vasilevski :-) |
64 |
> |
65 |
>> # Mike George (contributor) |
66 |
>> # Kammi Cazze (contributor) |
67 |
>> # Marius Schaefer (contributor) |
68 |
>> # |
69 |
>> # Definitions and Terms |
70 |
>> # system_rootfs = your regular rootfs |
71 |
>> # development_rootfs = what you use to build the embedded_rootfs |
72 |
>> # embedded_rootfs = rootfs you deploy to the target system |
73 |
>> # SBC = single board computer (here it's an x86 based) |
74 |
>> # |
75 |
>> # References |
76 |
>> # http://www.gentoo.org/doc/en/handbook/index.xml |
77 |
>> # http://www.epiawiki.org |
78 |
>> # http://epia.kalf.org |
79 |
>> # Gentoo embedded mailing list (gentoo-embedded@l.g.o) |
80 |
>> # |
81 |
>> # |
82 |
>> # Overview of process (steps) |
83 |
>> # 1 - Prepare the development_rootfs from your system_rootfs |
84 |
>> # 2 - Build the development_rootfs |
85 |
>> # 3 - Build the embedded_rootfs |
86 |
>> # 4 - Build and install non-system programs to the embedded_rootfs |
87 |
>> # 5 - Build and install a kernel to the embedded_rootfs |
88 |
>> # 6 - Deploy embedded_rootfs to target |
89 |
>> # |
90 |
>> #-------------------------------------------------------------------------------- |
91 |
>> |
92 |
>> #----- Step 1 - Prepare the development_rootfs from your system_rootfs ------- |
93 |
>> |
94 |
>> # You must be root. |
95 |
>> su - |
96 |
>> |
97 |
>> # Create the development_rootfs. |
98 |
>> # I use i586 because of target is a Geode processor. |
99 |
>> mkdir -p /opt/i586-gentoo-uclibc-linux/usr/portage |
100 |
>> |
101 |
>> # Download the latest stage 1 tarball. |
102 |
>> wget \ |
103 |
>> http://gentoo.osuosl.org/experimental/x86/embedded/stages/stage1-x86-uclibc-2005.0.tar.bz2 |
104 |
>> |
105 |
>> # Untar the stage to the development_rootfs. |
106 |
>> tar -xvjf stage1-x86-uclibc-2005.0.tar.bz2 -C /opt/i586-gentoo-uclibc-linux/ |
107 |
> |
108 |
> it should be tar -xvjpf ... |
109 |
> where -p stands for --preserve-permissions |
110 |
> |
111 |
>> |
112 |
>> # Mount the proc and portage directories to your development_rootfs. |
113 |
>> # Makes your system_rootfs's proc and portage directory available from inside |
114 |
>> # of your development_rootfs (after chrooting). |
115 |
>> mount --bind /proc /opt/i586-gentoo-uclibc-linux/proc/ |
116 |
>> mount --bind /usr/portage /opt/i586-gentoo-uclibc-linux/usr/portage |
117 |
>> |
118 |
>> # Copy over DNS information to the development_rootfs. |
119 |
>> cp /etc/resolv.conf /opt/i586-gentoo-uclibc-linux/etc/resolv.conf |
120 |
>> |
121 |
>> # Chroot into the development_rootfs. |
122 |
>> chroot /opt/i586-gentoo-uclibc-linux /bin/bash --login |
123 |
>> |
124 |
>> |
125 |
>> #----- Step 2 - Build the development_rootfs --------------------------------- |
126 |
>> |
127 |
>> # Create new environment and load variables into memory. |
128 |
>> env-update |
129 |
>> source /etc/profile |
130 |
>> |
131 |
>> # Modify make.conf file to your liking/needs. |
132 |
>> nano -w /etc/make.conf |
133 |
>> # This is for my target, Geode x86 processor. |
134 |
>> /* |
135 |
>> USE="bitmap-fonts minimal truetype-fonts uclibc mmx" |
136 |
> |
137 |
> The uclibc USE flag was obsoleted, see: |
138 |
> http://www.mail-archive.com/gentoo-embedded@l.g.o/msg00140.html |
139 |
> |
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 |
>> # Set profile to use 2.6 kernel. |
150 |
>> # The current stage uses 2.4 by default, and for most cases you are going |
151 |
>> # to want a 2.6.x kernel. |
152 |
>> rm /etc/make.profile |
153 |
> |
154 |
> This are equivalent but I would use: |
155 |
> unlink /etc/make.profile |
156 |
> for clarity's sake. |
157 |
> |
158 |
>> ln -s /usr/portage/profiles/uclibc/x86 /etc/make.profile |
159 |
>> |
160 |
>> # Start the bootstrap script. |
161 |
>> cd /usr/portage/scripts |
162 |
>> ./bootstrap.sh -p -v |
163 |
>> ./bootstrap.sh |
164 |
>> |
165 |
>> # Workaround 1 |
166 |
>> # Failure compiling uclibc (gcc-config error: Could not run/locate "gcc")? |
167 |
>> # If you get a failure while bootstrap is compileing uclibc here are the steps |
168 |
>> # to work around the problem. |
169 |
>> gcc-config 1 |
170 |
>> source /etc/profile |
171 |
>> ./bootstrap.sh |
172 |
>> |
173 |
>> # Emerge the system ebuild for the development_rootfs. |
174 |
>> emerge -e system |
175 |
>> |
176 |
>> # Workaround 2 |
177 |
>> # During emerge -e system, python-fchksum failes complaing about |
178 |
>> # gcc-config error: Could not run/locate "i386-gentoo-linux-uclibc-gcc" |
179 |
>> # The following commands work around this problem. |
180 |
>> emerge python |
181 |
>> emerge -e system |
182 |
>> |
183 |
>> |
184 |
>> #----- Step 3 - Build the embedded_rootfs ------------------------------------ |
185 |
>> |
186 |
>> # Create the embedded_rootfs directory. |
187 |
>> mkdir /embedded_rootfs |
188 |
>> |
189 |
>> # Emerge baselayout-lite into embedded_rootfs. |
190 |
>> # This gives your system a basic file structure. |
191 |
>> # 1.0_pre1 is the only one that is stable, right? |
192 |
>> cd /usr/portage/sys-apps/baselayout-lite/ |
193 |
>> ROOT=/embedded_rootfs emerge baselayout-lite-1.0_pre1.ebuild |
194 |
>> |
195 |
>> # Workaround 3 |
196 |
>> # Baselayout-lite is still beta, so a few fixes are needed. |
197 |
>> # There needs to be a directory "log" in /var. |
198 |
>> # Inittab calls for /usr/bin/tail, but it needs to /usr/bin. |
199 |
>> mkdir /embedded_rootfs/var/log |
200 |
>> nano -w /embedded_rootfs/etc/inittab |
201 |
>> /* |
202 |
>> #tty3::respawn:/usr/bin/tail -f /var/log/messages |
203 |
>> tty3::respawn:/bin/tail -f /var/log/messages |
204 |
>> */ |
205 |
>> |
206 |
>> # Emerge uclibc into the embedded_rootfs. |
207 |
>> # Use the -K option because we don't get the extra files created by the |
208 |
>> # build/emerge process into our embedded rootfs which needs to be as |
209 |
>> # small as possible. |
210 |
>> ROOT=/embedded_rootfs emerge -K uclibc |
211 |
>> |
212 |
>> # Emerge busybox into the embedded_rootfs. |
213 |
>> # First you must emerge it into your development_rootfs. |
214 |
>> # This does not create the symlinks in our development embedded rootfs. |
215 |
>> emerge busybox |
216 |
>> ROOT=/embedded_rootfs emerge -K busybox |
217 |
>> |
218 |
>> # Create the symlinks for busybox in the embedded_rootfs. |
219 |
> |
220 |
> I have not used it, but form the ebuild it looks like |
221 |
> if you emerge busybox with make-symlinks in USE flags |
222 |
> it'll just make them for you. I think the proper way |
223 |
> may be (gain, this is just by looking at the ebuild): |
224 |
> VERY_BRAVE_OR_VERY_DUMB=yes USE=make-symlinks emerge -B busybox |
225 |
> (this will just make the package without installing it |
226 |
> to the system and consequently without braking it with |
227 |
> the symlinks) |
228 |
> ROOT=/embedded_rootfs emerge -K busybox |
229 |
> (at this point the busybox binary package should have |
230 |
> the symlinks in it) |
231 |
> |
232 |
>> mkdir /embedded_rootfs/proc |
233 |
>> mount -o bind /proc/ /embedded_rootfs/proc/ |
234 |
>> chroot /embedded_rootfs /bin/busybox --install -s |
235 |
>> umount /embedded_rootfs/proc |
236 |
>> |
237 |
>> # Set time zone in your embedded_rootfs. |
238 |
>> # See http://leaf.sourceforge.net/doc/guide/buci-tz.html for details. |
239 |
>> # For central standard time in the US, use "CST6CDT". |
240 |
>> nano -w /embedded_rootfs/etc/TZ |
241 |
>> /* |
242 |
>> CST6CDT |
243 |
>> */ |
244 |
>> |
245 |
>> # Install a boot loader (usually grug or lilo). |
246 |
>> # Once you copy/deploy your embedded_rootfs program to you target SBC you will |
247 |
>> # have to run the grub on the command line to write to the master boot record |
248 |
>> # (MBR). |
249 |
>> # Ncurses is needed by grub, if you are not using gurb then you don't need |
250 |
>> # ncurses. 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 |
>> ROOT=/embedded_rootfs emerge -K ncurses |
253 |
>> emerge grub |
254 |
>> ROOT=/embedded_rootfs emerge -K grub |
255 |
>> cp -R /boot/grub /embedded_rootfs/boot/ |
256 |
> |
257 |
> Why not installing grub with static USE flag? |
258 |
> I think ncurses is to expensive (big) to have if it is used |
259 |
> just by grub. |
260 |
> Another option will be to install install grub with: |
261 |
> ROOT=/embedded_rootfs emerge -K --nodeps grub |
262 |
> rm -f /embedded_rootfs/sbin/grub |
263 |
> As we can still use grub-install that doesn't need ncurses. |
264 |
> |
265 |
>> |
266 |
>> # Modify your boot configure file. |
267 |
>> # The example below is for a gurb, for a boot partition on /dev/hda1 and only |
268 |
>> # one partition on the target SBC system. |
269 |
>> nano -w /embedded_rootfs/boot/grub/grub.conf |
270 |
>> /* |
271 |
>> default 0 |
272 |
>> timeout 10 |
273 |
>> splashimage=(hd0,0)/boot/grub/splash.xpm.gz |
274 |
>> |
275 |
>> title=Linux 2.6.x |
276 |
>> root (hd0,0) |
277 |
>> kernel /vmlinuz-2.6.x root=/dev/hda1 vga=792 |
278 |
>> */ |
279 |
>> |
280 |
>> # Set root password |
281 |
>> ROOT=/embedded_rootfs passwd |
282 |
>> |
283 |
>> # Modify fstab. |
284 |
>> # Below is mine, yours may vary. |
285 |
>> nano -w /embedded_rootfs/etc/fstab |
286 |
>> /* |
287 |
>> /dev/hda1 / reiserfs defaults 0 0 |
288 |
>> none /proc proc defaults 0 0 |
289 |
>> none /sys sysfs defaults 0 0 |
290 |
>> none /dev/shm tmpfs defaults 0 0 |
291 |
>> */ |
292 |
>> |
293 |
>> #---- Step 4 - Build and install non-system programs to the embedded_rootfs -- |
294 |
>> |
295 |
>> # Emerge other software you need for you embedded target. |
296 |
>> # This is very wildly depending on your needs. |
297 |
>> # Also your proprietary application will be done here. |
298 |
>> emerge foobar* |
299 |
>> ROOT=/embedded_rootfs emerge -K foobar* |
300 |
>> |
301 |
>> |
302 |
>> #---- Step 5 - Build and install a kernel to the embedded_rootfs ------------- |
303 |
>> |
304 |
>> # Install a kernel into embedded_rootfs. |
305 |
>> # First we will emerge it into our development_rootfs, then configure and |
306 |
>> # build it. |
307 |
>> emerge vanilla-sources |
308 |
>> cd /usr/src/ |
309 |
>> cd linux |
310 |
>> make menuconfig |
311 |
>> # configure your kernel for your TARGET SBC here |
312 |
>> make |
313 |
>> ROOT=/embedded_rootfs make modules_install |
314 |
>> cp /usr/src/linux/arch/i386/boot/bzImage /embedded_rootfs/boot/vmlinuz-2.6.x |
315 |
>> |
316 |
>> # A few notes on compiling your kernel. |
317 |
>> # If deploying to Compact Flash/DiskOnChip/SD us ext2, as the 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 |
>> # Prepare a Gentoo (or any Linux distro) system on the target SBC using a |
326 |
>> # harddrive. This is known as the target development rootfs. |
327 |
>> # We will create a partition (/embedded_rootfs) that will server as our |
328 |
>> # "test" partition to deploy our embedded_rootfs that we generate on our |
329 |
>> # development_system. |
330 |
>> # |
331 |
>> # I use the following partitions to speed development (yours may vary): |
332 |
>> # /dev/hda1 - /embedded_rootfs - 1 GB |
333 |
>> # /dev/hda2 - /boot - 100 MB |
334 |
>> # /dev/hda3 - swap - (size varies, 512 MB is a good number) |
335 |
>> # /dev/hda4 - / - (what is left, at least 1.5 GB per 2005.0 install guide |
336 |
>> specs) |
337 |
>> # |
338 |
>> # Copy over your embedded_rootfs from you development system to your target |
339 |
>> # system and the directory /embedded_rootfs. This needs to be done via NFS as |
340 |
>> # need to preserve the permissions. |
341 |
>> # |
342 |
>> #The following commands are done from the |
343 |
>> # target development rootfs. |
344 |
>> mount -t reiserfs /dev/hda1 /mnt/embedded_rootfs |
345 |
>> mount -t nfs |
346 |
>> 192.168.0.10:/opt/i586-gentoo-uclibc-linux/embedded_rootfs /mnt/transfer |
347 |
>> cp -adpR /mnt/transfer/* /mnt/embedded_rootfs |
348 |
>> |
349 |
>> |
350 |
>> # Modify your target system's gurb.conf (or lilo.conf) for allow you to boot |
351 |
>> # to the embedded_rootfs partition. |
352 |
>> # |
353 |
>> # Reboot, and if all goes well you'll be greeted with a login prompt. |
354 |
>> # |
355 |
>> # Fin. |
356 |
> |
357 |
> Yuri. |
358 |
> -- |
359 |
> gentoo-embedded@g.o mailing list |
360 |
> |
361 |
> |
362 |
-- |
363 |
gentoo-embedded@g.o mailing list |