Table of Contents

Linux Kernel Mentorship Program Stable Release Contribution

Start by cloning the stable kernel git, building and installing the latest stable kernel. You can find information on the latest stable and mainline releases at The Linux Kernel Archive. An example email for 5.0.6-stable review for reference.

Use stable release rc git

Clone the git repository specified and in the email. A new directory linux-5.0.y gets created which contains the kernel sources. Starting out with the distribution configuration file is the safest approach for the very first kernel install on any system. You can do so by copying the configuration for your current kernel from /boot. Once this step is complete, it is time to compile the kernel, install the new kernel and run update-grub to add the new kernel to the grub menu. Now it is time to reboot the system to boot the newly installed kernel.

mkdir stable
cd stable
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.0.y
cd linux-5.0.y
cp /boot/<currentconfig> .config
make -j2 all
echo $?
su -c "make modules_install install"

Download stable release patch and apply

Alternately, you can download and apply the patch. The following is my workflow for getting repository ready, apply the patch, compile, and install. I apply patches and use the same repository to be able to detect regressions. I save dmesg for the current rc to compare with the next rc. Please feel free to make changes to suit your needs.

mkdir stable
cd stable
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
cd linux-stable
git checkout linux-5.0.y
cp /boot/<currentconfig> .config
wget https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.0.6-rc1.gz
git reset --hard
make clean
git pull
gunzip patch-5.0.6-rc1.gz
git apply --index patch-5.0.6-rc1
echo "Patch applied"
head Makefile
make -j2 all
echo $?
su -c "make modules_install install"

Now it is time to reboot the system to boot the newly installed kernel. Before we do that, let's save logs from the current kernel to compare and look for regressions and new errors, if any.

dmesg -t > dmesg_current
dmesg -t -k > dmesg_kernel
dmesg -t -l emerg > dmesg_current_emerg
dmesg -t -l alert > dmesg_current_alert
dmesg -t -l crit > dmesg_current_crit
dmesg -t -l err > dmesg_current_err
dmesg -t -l warn > dmesg_current_warn

In general, dmesg should be clean with no emerg, alert, crit, and err level messages. If you see any of these, it might indicate some hardware and/or kernel problem.

A couple more important steps before trying out the newly installed kernel. There is no guarantee that the new kernel will boot. As a safe guard, please ensure that there is at least one good kernel installed. Change the default grub configuration file /etc/default/grub to:

Enable printing early boot messages to vga using earlyprink=vga kernel boot option Increase the GRUB_TIMEOUT value to 30 seconds, so grub pauses in menu allowing time to choose kernel to boot from grub menu, and comment out GRUB_TIMEOUT_STYLE=hidden

GRUB_CMDLINE_LINUX="earlyprink=vga"
#GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=30

Run update-grub to update the grub configuration in /boot

sudo update-grub

Now restart the system. Once the new kernel comes up, compare the saved dmesg from the old kernel with the new one and see if there are any regressions. If the newly installed kernel fails to boot, you will have to boot a good kernel and then investigate why the new kernel failed to boot.

Run Kernel Selftests and check results.

# Running as root could reboot your system. Run as normal user.
make kselftest

Report results responding to stable release announcement. A summary such as “Compiled, booted, and no regressions” is sufficient if everything looks good or report failures if any.