minimal boot system for flash device (BusyBox + uClibc)

| | Comments (0) | TrackBacks (0)

Yesterday I updated my boot system, which I use to boot my system from an USB flash drive. It’s consists basically of BusyBox, the swiss army knife of embedded Linux and uClibc, a small c library for embedded systems plus some more tools, which I need to setup Raid and to decrypt my devices before switching to my main system. Here are the steps needed to build the system based on a stage3 snapshot of gentoo sources:

First get the snapshot, unpack it and update it:

wget http://de-mirror.org/distro/gentoo/experimental/x86/embedded/stages/stage3-x86-uclibc-2008.0.tar.bz2
tar xvfz stage3-x86-uclibc-2008.0.tar.bz2 -C bootsystem/
mount -t proc proc /boot/boot
system/proc
cp -L /etc/resolv.conf /boot/bootsystem/etc/
chroot /boot/boot
system /bin/bash
env-update && source /etc/profile
emerge sync
emerge -auDv world

after that make a directory for your boot system and emerge all required packages:

mkdir /bootimage
ROOT=/boot
image USE=”static make-symlinks” emerge -av busybox mdadm
ROOT=/boot_image USE=”static” emerge -av =gnupg-1.4.9 cryptsetup

create the config for mdadm:

/sbin/mdadm —detail —scan >> /boot_image/etc/mdadm.conf

Having the system set up, we still need to build an initrd or initramfs, which can be both loaded at boot time. I choose the latter one and you have just to tell the kernel where your boot system resides. This is done by setting the CONFIGINITRAMFSSOURCE in the kernel config. Mine looks like this:

CONFIGINITRAMFSSOURCE=”/boot/bootimage /boot/cpiolist”

/boot/bootimage is the system create above and /boot/cpiolist contains some nodes required at bootup (early userspace), which are not created by busybox:

# supporting directories
dir /proc 0755 0 0
dir /sys 0755 0 0
dir /root 0755 0 0
dir /dev 0755 0 0
#initial device files required (mdev creates the rest)
nod /dev/console 0600 0 0 c 5 1
nod /dev/null 0666 0 0 c 1 3

0 TrackBacks

Listed below are links to blogs that reference this entry: minimal boot system for flash device (BusyBox + uClibc).

TrackBack URL for this entry: http://www.rommel.stw.uni-erlangen.de/~ritschi/cgi-bin/mt/mt-tb.cgi/33

Leave a comment

About this Entry

This page contains a single entry by ritschi published on July 20, 2008 9:39 PM.

HowTo convert jpg to pdf was the previous entry in this blog.

xfig problems is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.