Aagaman Luitel

compiling custom kernel just for fun

compiling custom kernel just for fun

2025-01-21

Compiling custom kernel is easy actually, configuring is hard. There are some set of configurations that you must need for your kernel to boot, at least that what happened to me.

step1: clone the kernel

git clone https://github.com/torvalds/linux --depth=1

step 2

make menuconfig

This is where things get trickier. So gentoo has lots of documentation for kernel configurations. Some of the links I found useful

  • https://wiki.gentoo.org/wiki/Kernel#Configuration
  • https://wiki.gentoo.org/wiki/Zram#Enabling_zram_support_in_kernel
  • https://wiki.gentoo.org/wiki/Framebuffer
  • https://wiki.gentoo.org/wiki/Bluetooth

step 3: Follow arch wiki

https://wiki.archlinux.org/title/Kernel/Traditional_compilation

I use systemd boot so I just have to make a new loader as /boot/loader/entries/linux-spaceship.conf

title   Arch Linux Spaceship
linux   /vmlinuz-linux-spaceship
initrd  /initramfs-linux-spaceship.img
options root=PARTUUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx zswap.enabled=0 rootflags=subvol=@ rw rootfstype=btrfs

and my kernel is there when I start my pc.

So why do this? Two reasons: because its fun to configure/compile your custom kernel with your own name and second, I disabled internet in this kernel to stop myself from any internet activity.

Another thing is I also noticed my boot time got faster, maybe its because my kernel is minimal and does not has any extra modules enabled and is compiled in my machine.