Pre-install
grab 4gb usb key, 8gb usb key, and download Vanilla .iso from Alpine. Burn ISO to 8gb stick
Boot to system, make sure you have drivers, and install to 4GB stick. Recommended step: remove other storage in prior stage.
Install
After installation
Use second PC and Gparted to remove swap, fix [inst-root]/etc/fstab (comment out the swap partition), and resize the [inst-root] so it’s as small as you can go (512MB IIRC?)
Back your disk up (sdd is 4GB usb on my 2nd machine):
dd if=/dev/sdd of=/backup/location/sdd.img && dd if=/dev/sdd3 of=/backup/location/sdd3.img
Boot your system again. Time for cleanup:
Remove unnecesary firmware and add minimal tools with
apk add linux-firmware-none wget tftp-hpa
remove drivers you don’t need in
/lib/modules/[kernel-version]/kernel/drivers/
, rundepmod
to fix dependency issuesPlug your stick back to your 2nd PC, fire up Gparted again, create small partition (160MB or so), mount sdd3 to /source, sdd2 to /dest/ and copy root files accross with
cp -afv /source/* /dest/
. Fix [inst-root]/etc/fstab and boot entry in boot partition (sda1) so it boots from/dev/sda2
instead of sda3 (or its UUID…).create image of “sda2”
Edit initramFS
Unpack it with zcat /boot/initrd-$(uname -r).img | cpio -idmv (You can rename it to .gz and use gnome archiver to extract it, xarchiver knows how to extract CPIO archive as well)
Copy tftp, wget from [inst-root]/usr/bin to initramfs/usr/bin/
Add necesary drivers (and their dependencies) from [inst-root]/lib/modules/[kernel-version]/kernel/drivers/net/ethernet and make sure to add them (and their dependencies) in [initramfs]/lib/modules/[kernel-version]/modules.dep!
Edit [initramfs]/init. I’ve added modprobe for drivers, custom kernel options, (tftps and tftpf (for PXE menu parameters)), then use those options to tftp-download a tiny SH from a server. The script uses wget to download rootFS IMG and mount it as /sysroot in RAM. Why Wget? Because it’s way faster than TFTP (100Mbps vs 6Mbps in VM test), and because it’s TCP.
mkdir [initramfs]/etc/network
mkdir [initramfs]/etc/network/{if-up.d,if-pre-up.d,if-pre-down.d,if-down.d}
echo to [initramfs]/etc/network/interfaces:
auto lo eth0
iface lo inet loopback
iface eth0 inet dhcp
mkdir [initramfs]/var/run
mkdir [initramfs]/usr/share/udhcpc
cp [inst-root]/usr/share/udhcpc/default.script [initramfs]/usr/share/udhcpc
Package initramFS from inside of the folder with
find . | cpio -ov --format=newc | gzip -9 >../initramfs-vanilla
Final steps
Deploy the custom initramfs to PXE server
Deploy the DD’d dd the img to PXE server
Try to boot and debug. Trial and error in
do-while-true
loop.