This guide explains how to create a custom bootable Linux ISO image using Syslinux bootloader and a minimal initramfs.
Required packages on Ubuntu/Debian:
sudo apt update
sudo apt install build-essential git curl tar
You'll need about 3GB of free disk space for the build process.
The initramfs provides the minimal root filesystem needed during the boot process.
# Download and extract minimal initramfs for boot initialization
curl -sL https://landley.net/bin/mkroot/0.8.12/x86_64.tgz | \
tar -xz -C ~ -f - --strip-components=1 x86_64/initramfs.cpio.gz
Syslinux provides the bootloader infrastructure needed to create bootable media.
# Download and configure Syslinux bootloader elements
curl -sL https://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-6.03.tar.xz | \
tar -xJf - \
syslinux-6.03/bios/core/isolinux.bin \
syslinux-6.03/bios/com32/elflink/ldlinux/ldlinux.c32 && \
sudo mkdir -p /usr/lib/syslinux && \
sudo mv \
syslinux-6.03/bios/core/isolinux.bin \
syslinux-6.03/bios/com32/elflink/ldlinux/ldlinux.c32 \
/usr/lib/syslinux/ && \
rm -rf syslinux-6.03
First, download the Linux kernel source code:
git clone --branch linux-6.12.y --depth 1 https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
cd linux-stable
Configure the kernel with the smallest possible configuration:
make tinyconfig
This creates a minimal kernel configuration with the bare essentials needed to boot. It's perfect for creating a small ISO image, but may need additional features enabled depending on your hardware requirements.
Note: If you need to enable additional features after running tinyconfig, use:
make menuconfig # Requires ncurses-dev package
Compile the Linux kernel and create the final ISO image using Make with the following configuration:
make isoimage \
FDARGS="initrd=/initramfs.cpio.gz" \
FDINITRD="../initramfs.cpio.gz" \
ISOLINUX_BIN="/usr/lib/syslinux/isolinux.bin" \
ARCH=x86_64 \
CROSS_COMPILE=x86_64-linux-gnu- \
-j 4
This command will:
- Build the Linux kernel with the specified architecture and compiler
- Package the kernel with the initramfs and bootloader into an ISO image
initramfs.cpio.gz
: Initial RAM filesystem for system initializationisolinux.bin
: BIOS bootloader binaryldlinux.c32
: Core Syslinux modulevmlinuz
: Compiled Linux kernel
FDARGS
: Kernel command line argumentsFDINITRD
: Path to initramfsISOLINUX_BIN
: Path to bootloader binaryARCH
: Target architectureCROSS_COMPILE
: Toolchain prefix-j 4
: Number of parallel build jobs