Friday, September 26, 2014

Upgrade Beaglebone Black (BBB) kernel

An excellent post was written up by Marcos Miranda from element 14 instructing users on how to upgrade the kernel on the BBB.
http://www.element14.com/community/blogs/mirandasoft/2014/04/02/beaglebone-black-upgrading-the-linux-kernel

In a nutshell, it's 3 basic scripts.  Before starting, make a directory to put all your scripts.  You may name the following files and scripts however you want to.  I use generic file names for readability.


1. Create your scripts:
I am naming mine test.sh, upgrade.sh, and clean.sh.

Use vim and save the separate scripts into a directory of your choosing.
mkdir ~/upgradekernel
cd ~/upgradekernel

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

vim upgrade.sh
_____________________________________________________________________________
#!/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
_____________________________________________________________________________

vim clean.sh
_____________________________________________________________________________
#!/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
_____________________________________________________________________________

1. Decide on which kernel you would like to install.  The keywords are STABLE, TESTING, or EXPERIMENTAL

Run the following to determine which kernel version are available to you.

cd ~/scriptdir
vim test.sh

(copy and paste the following into test.sh):


type in vim to quit and save - :wq

chmod +x test.sh

./test.sh
_____________________________________________________________________________

You should receive an output resembling the following:
--2014-09-26 15:06:58--  https://rcn-ee.net/deb/sid-armhf/LATEST-omap-psp
Resolving rcn-ee.net (rcn-ee.net)... 69.163.222.213
Connecting to rcn-ee.net (rcn-ee.net)|69.163.222.213|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 234 [text/plain]
Saving to: `./LatestBBBKernels.txt'

100%[=======================================================================================================>] 234         --.-K/s   in 0s    

2014-09-26 15:07:03 (659 KB/s) - `./LatestBBBKernels.txt' saved [234/234]

FINISHED --2014-09-26 15:07:03--
Total wall clock time: 4.7s
Downloaded: 1 files, 234 in 0s (659 KB/s)
root@beaglebone:~/Projects#     cat ./LatestBBBKernels.txt
ABI:1 TESTING https://rcn-ee.net/deb/sid-armhf/v3.16.3-bone6/install-me.sh
ABI:1 EXPERIMENTAL https://rcn-ee.net/deb/sid-armhf/v3.17.0-rc6-bone4/install-me.sh
ABI:1 STABLE https://rcn-ee.net/deb/sid-armhf/v3.8.13-bone67/install-me.sh
_____________________________________________________________________________

Notice the TESTING, EXPERIMENTAL, and STABLE.  Also notice their associated kernel versions.

2.  Run the scripts and modify accordingly.

Run test.sh

You should receive output that resembles the following:
_____________________________________________________________________________
--2014-09-26 15:06:58--  https://rcn-ee.net/deb/sid-armhf/LATEST-omap-psp
Resolving rcn-ee.net (rcn-ee.net)... 69.163.222.213
Connecting to rcn-ee.net (rcn-ee.net)|69.163.222.213|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 234 [text/plain]
Saving to: `./LatestBBBKernels.txt'

100%[=======================================================================================================>] 234         --.-K/s   in 0s    

2014-09-26 15:07:03 (659 KB/s) - `./LatestBBBKernels.txt' saved [234/234]

FINISHED --2014-09-26 15:07:03--
Total wall clock time: 4.7s
Downloaded: 1 files, 234 in 0s (659 KB/s)
root@beaglebone:~/Projects#     cat ./LatestBBBKernels.txt
ABI:1 TESTING https://rcn-ee.net/deb/sid-armhf/v3.16.3-bone6/install-me.sh
ABI:1 EXPERIMENTAL https://rcn-ee.net/deb/sid-armhf/v3.17.0-rc6-bone4/install-me.sh
ABI:1 STABLE https://rcn-ee.net/deb/sid-armhf/v3.8.13-bone67/install-me.sh
_____________________________________________________________________________

Analyzing the output, choose which type of kernel installation you would like.  Personally I like TESTING so I will modify the upgrade script to replace "STABLE" with "TESTING"

Once you modify upgrade.sh, run it.

./upgrade.sh

Once the upgrade is complete, run clean.sh

Reboot your system and the kernel is now updated! Enjoy!

Props to Marcos for the nice scripts.

No comments:

Post a Comment