Bootstrapping Alpine on Soekris net4xxx

From Alpine Linux
Jump to: navigation, search
Out of date clock icon.svg
This material is obsolete ...

Please feel free to help us make an up-to-date version. (Discuss)

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


and unpack it on our CF card

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

Finally, we make the CF bootable

umount alpine