E0 - The Big Upgrade 🎢

Build, install, and boot the latest Linux kernel fresh off Linus Torvalds’ tree.

Outcomes:

What to submit:

Procedure:

  1. Install dependencies:

    sudo dnf -y install gcc flex make bison openssl openssl-devel elfutils-libelf-devel ncurses-devel bc git tar dwarves

  2. Install ccache to speed up subsequent kernel builds:

    sudo dnf -y install ccache

  3. 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
    
  4. Change the current directory to the kernel tree

    cd linux
    
  5. Copy the kernel config for your running kernel to your kernel source tree

    cp /boot/config-$(uname -r) .config
    
  6. Set any new config options to the defaults

    make olddefconfig
    
  7. Set a custom version tag for your kernel build. Edit "Makefile" and add something cool to the "EXTRAVERSION" variable. We suggest it begin with a '.' character. It must NOT contain spaces.

  8. You can print the new version string to test it by:

    make kernelversion
    
  9. 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)
    
  10. 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
    
  11. Finally, install the new kernel into your system's /boot directory. The same superuser considerations from the previous step apply.

    sudo make install
    
  12. Shutdown your VM

    sudo shutdown now
    
  13. If you were running your VM in headless mode, boot your VM in normal mode (so you can see the console output, including the pre-OS bootloader).

    grub bootloader image from https://jfearn.fedorapeople.org/fdocs/en-US/Documentation/0.1/html/Fedora_Multiboot_Guide/GRUB-runtime.html

  14. Use the arrow keys to select your newly build kernel with your custom tag and hit enter when it is highlighted.

  15. 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
    
  16. Then, use this number to set the default to that index

    sudo grubby --set-default-index <index>
    
  17. 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.

Policies & Procedures


msg = (silence)
whoami = None
singularity v0.4 (staging) https://github.com/underground-software/singularity