Bootstrapping Alpine on Soekris net4xxx

From Alpine Linux
Revision as of 07:17, 1 June 2010 by Ncopa (talk | contribs) (added to category HOWTO)


This is a step-by-step guide on bootstrapping the latest (developement) Alpine Linux on a CF card for Soekris net4xxx routers


We assume our CF reader is at /dev/sdb, with a 512+ MB CF formatted card loaded and will be mounted on /mnt/flash. We also assume root priviledges.

export FLASHDEVICE=/dev/sdb1
export MNT=/mnt/flash

First, we download the latest usbdrive tarball

wget http://dev.alpinelinux.org/alpine/v1.7/usbdrive/alpine-1.7.5-i386.tar.gz

and unpack it on our CF card

mount $FLASHDEVICE $MNT
tar xzf ../alpine-1.7.5-i386.tar.gz -C $MNT

Next step is to build a custom initrd (for the serial console to work)

mkdir /tmp/alpine
cd /tmp/alpine
zcat $MNT/kernel/generic/hd-ext3.gz > soekris
tar xjf $MNT/base.tar.bz2 ./etc/inittab
sed -i -e 's/^::respawn.*//' -e 's/^tty.*//' -e 's/^#\(ttyS0.*\) 115200 \(.*\)/\1 19200 \2/' etc/inittab
echo etc/inittab | cpio -o -H newc -A -O soekris
gzip -c -9 soekris > $MNT/kernel/generic/soekris.gz

and a custom syslinux.cfg

cat > $MNT/syslinux.cfg <<EOF
serial 0 19200
timeout 0
default generic-soekris

label generic-soekris
        kernel /kernel/generic/bzImage
        append initrd=/kernel/generic/soekris.gz rw alpine_dev=hda1:vfat root_dev=none:tmpfs alpine_base=base.tar.bz2 pkg_dev=hda1:vfat pkg_subdir=/apks cfg_dev=hda1:vfat modloop=/kernel/generic/modloop.cmg console=ttyS0,19200
EOF

Finally, we make the CF bootable

syslinux $FLASHDEVICE
umount alpine