Alpine LiveCD Pattern Notes
This file keeps examples and rationale. The normative rules live in contract.md.
Minimal mkimage Profile
profile_<name>() {
arch="x86_64"
hostname="<hostname>"
apkovl="genapkovl-<name>.sh"
image_ext="iso"
output_format="iso"
kernel_flavors="lts"
initfs_cmdline="modules=loop,squashfs,sd-mod,usb-storage quiet"
initfs_features="ata base cdrom ext4 mmc nvme raid scsi squashfs usb virtio"
grub_mod="all_video disk part_gpt part_msdos linux normal configfile search search_label efi_gop fat iso9660 cat echo ls test true help gzio"
apks="alpine-base linux-lts linux-firmware-none ..."
}
arch is the easiest field to miss. Without it, mkimage may silently skip the profile.
apkovl Placement
genapkovl-<name>.sh must be in the current working directory when mkimage runs.
Example:
cp "genapkovl-<name>.sh" ~/.mkimage/
cp "genapkovl-<name>.sh" /var/tmp/
cd /var/tmp
sh mkimage.sh --workdir /var/tmp/work ...
/var/tmp Build Root
Use /var/tmp instead of /tmp:
export TMPDIR=/var/tmp
cd /var/tmp
sh mkimage.sh ...
On Alpine builders, /tmp is often a small tmpfs and firmware/modloop builds overflow it.
Cache Reuse
Typical cache-preserving cleanup:
if [ -d /var/tmp/bee-iso-work ]; then
find /var/tmp/bee-iso-work -maxdepth 1 -mindepth 1 \
-not -name 'apks_*' \
-not -name 'kernel_*' \
-not -name 'syslinux_*' \
-not -name 'grub_*' \
-exec rm -rf {} +
fi
The apkovl section should still be rebuilt every time.
Faster Squashfs
mkdir -p /etc/mkinitfs
grep -q 'MKSQUASHFS_OPTS' /etc/mkinitfs/mkinitfs.conf 2>/dev/null || \
echo 'MKSQUASHFS_OPTS="-comp lz4 -Xhc"' >> /etc/mkinitfs/mkinitfs.conf
Long-Running Builds
apk add screen
screen -dmS build sh -c "sh build.sh > /var/log/build.log 2>&1"
tail -f /var/log/build.log
Firmware Reminder
Typical extra firmware packages:
linux-firmware-intellinux-firmware-mellanoxlinux-firmware-bnx2xlinux-firmware-rtl_niclinux-firmware-other