Compiling and Installing a Custom Kernel on Arch Linux
Siddhant Bali
UG Researcher, Computational Biology @MicroBiome Informatics Lab | Human Centered Design Dept. @PerSIsst Lab | CSD Junior @ IIIT-Delhi
In this tutorial, we'll go through the process of compiling and installing a custom kernel on an Artix Arch Linux-based system. We'll be using the Arch Linux package manager pacman, make for compiling, and grub for bootloader configuration.
Step 1: Preparation
First, let's prepare our system for kernel compilation.
uname -mrs
This command displays system information, including the current kernel version.
mkdir new_kernel
cd new_kernel
Create a new directory called new_kernel and navigate into it.
Step 2: Installing Necessary Packages
We need some packages to aid in the compilation process.
pacman -S bc
pacman -S lynx
Install bc, a basic calculator, and lynx, a text-based web browser.
Step 3: Downloading the Kernel Source
We'll download the desired kernel source from kernel.org .
lynx kernel.org
Navigate to kernel.org using lynx and download the desired kernel source. Once downloaded, extract it using:
tar -xvf linux-5.19.9.tar.xz
cd linux-5.19.9
Not : Download Latest STABLE version.
Step 4: Configuring the Kernel
Now, let's configure the kernel before compilation.
make mrproper
lynx is.am/56er
mv config-rev-9-gold .config
make nconfig
This series of commands cleans the kernel source, moves the configuration file, and opens the configuration interface.
Step 5: Compiling the Kernel
Compile the kernel and its modules.
make
make modules
make modules_install
Step 6: Copying Kernel Image
Copy the compiled kernel image to the boot directory.
cp -v arch/x86/boot/bzImage /boot/vmlinuz-linux_hocus_pocus
Step 7: Generating Initramfs
Generate the initial RAM file system.
mkinitcpio -k 5.19.9 -g /boot/initramfs-linux_hocus_pocus.img
The command mkinitcpio -k 5.19.9 -g /boot/initramfs-linux_hocus_pocus.img is used to generate an initial RAM filesystem (initramfs) image for the Linux kernel. Here’s a breakdown of what each part of the command does:
领英推荐
Step 8: Updating Bootloader Configuration
Update the GRUB bootloader configuration.
grub-mkconfig -o /boot/grub/grub.cfg
The command grub-mkconfig -o /boot/grub/grub.cfg is used to generate a new GRUB configuration file. Here’s a breakdown of what it does and why you would use it:
Command Breakdown:
Step 9: Reboot and Select New Kernel
Reboot the system and select the new kernel from the boot menu.
reboot
Choose the advanced option for Artix Linux and select the newly compiled kernel.
Step 10: Verify Installation
Finally, login to the system and verify the installation.
uname -mrs
Congratulations! You have successfully compiled and installed a custom kernel on your Arch Linux-based system.
More Tech Sorcery..
Compiling the Linux kernel:
Config File:
More Information about Arch Linux Repositories:
extra, community and multilib would be sufficient
More Resources:
If you are unable to boot into the kernel then kindly refer to the blog post ?here:
If you are unable to download Artix config file from the drive ?then you can download it from here as well:
https://github.com/gopi487krishna/ArtixConfig.git ?(Select the ‘config-rev-9-gold’ config file and click on Raw?button to get the link)
Please read manual pages for the system calls and functions required.