Build, install, and boot the latest Linux kernel fresh off Linus Torvaldsâ tree.
template.txt
in the assignment directory renamed to firstname_lastname.txt
.
Edit it as nescessary (donât forget to include the output of uname -a
and dmesg | head
and whoami
on the system running your newly compiled Linux kernel.) and make a commit out of it.Install dependencies:
sudo dnf builddep kernel
This is roughly equivalent to:
sudo dnf -y install gcc flex make bison openssl openssl-devel elfutils-libelf-devel ncurses-devel bc git tar dwarves
Install ccache to speed up subsequent kernel builds:
sudo dnf -y install ccache
Clone the latest (v6.5) Linux kernel release from: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git.
git clone --depth=1 --branch v6.5 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Change the current directory to the kernel tree
cd linux
Copy the kernel config for your running kernel to your kernel source tree
cp /boot/config-$(uname -r) .config
Set any new config options to the defaults
make olddefconfig
You can print the new version string to test it by:
make kernelversion
Now, build the kernel. The -j
option will invoke a parallel build using the number of threads specified. The $(nproc)
will resolve to the output of the nproc
command, and the nproc
command will return the number of processor cores on your VM.
make -j $(nproc)
Next, install the kernel modules for your newly build kernel onto your system. The directories you will be writing to are owned by root, so you need superuser permission (granted by wrapping your command with sudo
) in order to complete this step.
sudo make -j $(nproc) modules_install
Finally, install the new kernel into your systemâs /boot
directory. The same superuser considerations from the previous step apply.
sudo make install
Shutdown your VM
sudo shutdown now
Use the arrow keys to select your newly build kernel with your custom tag and hit enter when it is highlighted.
If you would like to set your new kernel as the default (i.e. it will boot automatically without selecting it at the menu), then use the following command to locate the index associated with your new kernel
sudo grubby --info ALL
Then, use this number to set the default to that index
sudo grubby --set-default-index <index>
Finally, when you have booted into your new kernel and logged in, run the following commands and save their output for the assignment submission.
uname -a
dmesg | head
whoami
Seems easy enough right? đ
Expect the compilation to take a little while Make sure you have 5-10 GB of free space on the partition where you are storing the kernel tree and a bit of extra space on whatever partition /boot resides in to store the new kernel image and initramfs.