EBC Exercise 22 Updating the Kernel

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

Checking kernel version
First see which version of the kernel you are running. bone$ uname -a Linux ece434 4.19.94-ti-r50 #1buster SMP PREEMPT Mon Aug 24 23:03:55 UTC 2020 armv7l GNU/Linux Next see what's out there. bone$ cd cd /opt/scripts/tools/ bone$ '''sudo ./update_kernel.sh --bone-kernel info: checking archive 2020-09-21 17:56:56 URL:https://rcn-ee.com/repos/latest/buster-armhf/LATEST-omap-psp [228/228] -> "LATEST-omap-psp" [1] - Kernel Options: ABI:1 LTS44 4.4.145-bone23 ABI:1 LTS49 4.9.178-bone15 ABI:1 LTS414 4.14.198-bone40 ABI:1 LTS419 4.19.142-bone56 ABI:1 LTS54 5.4.61-bone35 ABI:1 STABLE 5.7.19-bone19 ABI:1 TESTING 5.8.10-bone16 ABI:1 EXPERIMENTAL 5.9.0-rc6-bone4 - Kernel version options: - LTS414: --lts-4_14 LTS419: --lts-4_19 LTS54: --lts-5_4 STABLE: --stable TESTING: --testing - Please pass one of the above kernel options to update_kernel.sh -

Installing
Suppose you want to run the 5.4 kernel. bone$ sudo ./update_kernel.sh --lts-5_4 Wait until it's installed, then bone$ reboot Once rebooted make sure you are running the new kernel. bone$ uname -a

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-4.14.108-ti-r137     initrd.img-4.19.94-ti-r50    System.map-5.4.52-ti-r17  vmlinuz-4.19.94-ti-r50 config-4.19.94-ti-r50       initrd.img-5.4.52-ti-r17     uboot                     vmlinuz-5.4.52-ti-r17 config-5.4.52-ti-r17        SOC.sh                       uEnv.txt dtbs                        System.map-4.14.108-ti-r137  uEnv.txt.orig initrd.img-4.14.108-ti-r137 System.map-4.19.94-ti-r50    vmlinuz-4.14.108-ti-r137

Here I have three kernel versions installed. 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.