Upgrading_the_Linux_Kernel.jpg

The Linux Kernel: Upgrading via Scripts

Hello World! After been using RPI-UPDATE on my Raspberry Pi, I wanted to do the same on my BeagleBone Black. Before I start, I must mention that my BeagleBone Black is running Debian 8 Linux in headless mode. Frequently, I write BASH scripts, lots of BASH scripts, to simplify my use of my BeagleBone Black, especially when I use JuiceSSH Pro on my Samsung Galaxy Tab 3. This blog post presumes you know how to work BASH scripting under the Linux command-line interface (CLI).

First, I wrote a script to inform me of the latest kernels:

#!/bin/bash
wget -nd -p -E https://rcn-ee.net/deb/sid-armhf/LATEST-omap-psp -O ./LatestBBBKernels.txt
cat ./LatestBBBKernels.txt

An example output look like this:

WARNING: combining -O with -r or -p will mean that all downloaded content
will be placed in the single file you specified.

--2014-04-02 09:29:45--  https://rcn-ee.net/deb/sid-armhf/LATEST-omap-psp
Resolving rcn-ee.net (rcn-ee.net)... 69.163.128.251
Connecting to rcn-ee.net (rcn-ee.net)|69.163.128.251|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 231 [text/plain]
Saving to: ‘./LatestBBBKernels.txt’

100%[==========================================================>] 231         --.-K/s   in 0.001s

2014-04-02 09:29:47 (398 KB/s) - ‘./LatestBBBKernels.txt’ saved [231/231]

FINISHED --2014-04-02 09:29:47--
Total wall clock time: 1.1s
Downloaded: 1 files, 231 in 0.001s (398 KB/s)
ABI:1 TESTING http://rcn-ee.net/deb/sid-armhf/v3.13.6-bone8/install-me.sh
ABI:1 STABLE http://rcn-ee.net/deb/sid-armhf/v3.8.13-bone43/install-me.sh
ABI:1 EXPERIMENTAL http://rcn-ee.net/deb/sid-armhf/v3.14.0-rc8-bone0/install-me.sh

Next, for this blog post, I'm only concerned about the STABLE kernel, so I wrote an automated BASH script to be executed under the root account:

#!/bin/bash
# TO BE EXECUTED UNDER ROOT ACCOUNT
# STANDARD DISCLAIMER APPLIES.
set -e
wget -nd -p -E https://rcn-ee.net/deb/sid-armhf/LATEST-omap-psp -O ./LatestBBBKernels.txt
echo -e "#!/bin/bash" > download.sh
echo -ne "wget -c " >> download.sh
sed -n -e 's/ABI:1 STABLE //p' LatestBBBKernels.txt >> download.sh
echo "sh ./install-me.sh" >> download.sh
chmod +x download.sh
sh ./download.sh
rm LatestBBBKernels.txt

Though I can't show an example output at this time, I frequently use the above scripts to know if or when to upgrade the Linux Kernel.

After rebooting the BeagleBone Black and verifying the new stable kernel is working, you will need to do some cleanup. Again, I wrote another BASH script to help me do the necessary cleanup (I've disabled operations because choices may be different for you):

#!/bin/bash
set -e
# rm -r /root/install-me.sh
# rm -r /root/download.sh
# rm -rf /boot/*-bone41
# rm -rf /boot/uboot/*bak
# rm -f /boot/uboot/tools/restore_bak.sh
# rm -rf /lib/modules/3.8.13-bone41
# apt-get remove --purge -y linux-image-3.8.13-bone41
# apt-get clean all

To check what kernels are installed: dpkg -l | grep linux-image

Thanks for Reading!

My BeagleBone Black, operating full-time, originally came from Drew Fustini in the USA. As of this writing, my BeagleBone Black is operating at 80% autonomously using a variety of BASH scripts. Thanks for Reading and Have a Nice Day!

 

Marcos "Kuya Marc" Miranda

Disabled Hobbyist & Retired Blogger