Download linux kernel

Compile

make defconfig

make menuconfig

make -j8

make modules

make modules_install

make modules install

make install

Update grub to boot from new kernel

First, make a backup copy of /etc/default/grub. In case something goes wrong, you can easily revert

sudo cp /etc/default/grub /etc/default/grub.bak

Then edit the file using any text editor of your choice, here we are using vim editor

sudo vim /etc/default/grub

Find the line that contains

GRUB_DEFAULT=0 and set it to

GRUB_DEFAULT=x

where x is the index of grub menu item to which you would like to boot to by default. Note that the menu items are zero-indexed. That means that the first item in the list is 0 and that the sixth item is actually 5. So to boot to the sixth item in the list, the line would read:

GRUB_DEFAULT=5

If you forgot the order of the items, take a look at /boot/grub/grub.cfg. Each menu entry is specified by a line of type:

menuentry 'Ubuntu' [options] {

You can also chose the default by the name instead of index, e.g.:

GRUB_DEFAULT='Ubuntu'

if there was a menuentry 'Ubuntu' line on /boot/grub/grub.cfg. This may be a better method, as it does not depend on the order of the entries, which could change.

To use a kernel in the "Previous Linux Versions" sub-menu use:

GRUB_DEFAULT="Advanced options for Ubuntu>x"

(make sure to include the quotations), where x is the index of the old kernel on the sub-menu, or the name of the kernel as it appears in /boot/grub/grub.cfg. For example,

GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux 5.4.0-45-generic"

Then build the updated grub menu:

sudo update-grub

https://askubuntu.com/questions/100232/how-do-i-change-the-grub-boot-order

https://askubuntu.com/questions/1240152/boot-freezes-and-loading-initial-ramdisk


©2023-2024 rculock.com