EBC Exercise 22 Updating the Kernel

The kernel can be easily updated with one command. Here's how to do it.

Checking kernel version and Installing
First see which version of the kernel you are running. bone$ uname -a Linux beaglebone 5.10.168-ti-r62 #1bullseye SMP PREEMPT Tue May 23 20:15:00 UTC 2023 armv7l GNU/Linux GNU/Linux

The 5.10.168-ti-r62 string is the kernel version.

To update to the current kernel, ensure that your Bone is on the Internet and then run the following commands: bone$ apt-cache pkgnames | grep linux-image | sort | less ... linux-image-5.10.162-ti-r59 linux-image-5.10.162-ti-rt-r56 linux-image-5.10.162-ti-rt-r57 linux-image-5.10.162-ti-rt-r58 linux-image-5.10.162-ti-rt-r59 linux-image-5.10.168-armv7-lpae-x71 linux-image-5.10.168-armv7-rt-x71 linux-image-5.10.168-armv7-x71 linux-image-5.10.168-bone71 linux-image-5.10.168-bone-rt-r71 linux-image-5.10.168-ti-r60 linux-image-5.10.168-ti-r61 linux-image-5.10.168-ti-r62 linux-image-5.10.168-ti-rt-r60 linux-image-5.10.168-ti-rt-r61 linux-image-5.10.168-ti-rt-r62 ... bone$ sudo apt install linux-image-5.10.162-ti-r59 bone$ ```sudo reboot```

bone$ ```uname -a``` Linux beaglebone 5.10.162-ti-r59 #1 SMP PREEMPT Wed Nov 19 21:11:08 UTC 2014 armv7l GNU/Linux The first command lists the versions of the kernel that are available. The second command installs one. After you have rebooted, the new kernel will be running.

If the current kernel is doing its job adequately, you probably don’t need to update, but sometimes a new software package requires a more up-to-date kernel. Fortunately, precompiled kernels are available and ready to download.

Seeing which kernels are installed
You can have multiple kernels install at the same time. They are saved in /boot bone$ cd /boot bone$ ls  config-5.10.168-ti-r62     initrd.img-5.10.168-ti-r63  uboot                    vmlinuz-5.10.168-ti-r63 config-5.10.168-ti-r63     SOC.sh                      uEnv.txt dtbs                       System.map-5.10.168-ti-r62  uEnv.txt.orig initrd.img-5.10.168-ti-r62 System.map-5.10.168-ti-r63  vmlinuz-5.10.168-ti-r62

Here I have two kernel versions installed. On the Bone (Not the Play) the file uEnv.txt tells which kernel to use on the next reboot. Here are the first few lines:

Line 1 #Docs: http://elinux.org/Beagleboard:U-boot_partitioning_layout_2.0 2   3 # uname_r=4.14.108-ti-r137 4 uname_r=4.19.94-ti-r50 5 # uname_r=5.4.52-ti-r17 6 #uuid=

Lines 3-5 list the various kernels, and the uncommented one on line 4 is the one that will be used next time. You will have to add your own uname's. Get the names from the files in /boot. Be careful, if you mistype the name your Bone won't boot.

Recovering
If you do mistype that name and your Bone won't boot. Do the following bone$ cd /media/$USER/rootfs/boot
 * Turn the Bone's power off.
 * Remove the SD card.
 * Put SD card is your host computer.
 * cd to /boot on the card.
 * Use your favorite editor to edit uEnv.txt and correct it.