Compiling the Linux kernel and creating a bootable ISO

This revision is from 2024/01/21 14:10. You can Restore it.

Guides to compile the Linux kernel from source, create the file system from BusyBox and then run it using QEMU. But, Create a bootable ISO of it and boot it on a computer.

The Linux Kernel

At first, compile the Linux kernel, https://kernel.org/ and grab the latest Linux kernel.

wget https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.7.1.tar.xz
tar xf linux-6.7.1.tar.xz
cd linux-6.7.1.tar.xz

General preparation environment to compile the kernel...

sudo apt install build-essential libncurses-dev bison flex libssl-dev libelf-dev

To configure the kernel:

make defconfig

This will create the default config file for compiling Linux. Then run

make menuconfig

to enter a TUI to edit the config file. One thing for older devices is unchecking 64 bit kernel. Use make -j $(nproc) to compile using all the CPU cores.

# Example: Using 4 parallel jobs
make -j4

After compiling, you should get the arch/x86/boot/bzImage . If not, check the make file log.

BusyBox

Next use BusyBox to create a minimal file system. Get the source code and extract it.

wget https://busybox.net/downloads/busybox-1.34.1.tar.bz2
tar xf busybox-1.34.1.tar.bz2
cd busybox-1.34.1

  

📝 📜 ⏱️ ⬆️