Packages
nerves_system_bbb
2.7.1
2.30.0
2.29.5
2.29.4
2.29.3
2.29.2
2.29.1
2.29.0
2.28.0
2.27.3
2.27.2
2.27.1
2.27.0
2.26.1
2.26.0
2.25.1
2.25.0
2.24.0
2.23.0
2.22.1
2.22.0
2.21.0
2.20.2
2.20.1
2.20.0
2.19.1
2.19.0
2.18.2
2.18.1
2.18.0
2.17.2
2.17.1
2.17.0
2.16.2
2.16.1
2.16.0
2.15.3
2.15.2
2.15.1
2.15.0
retired
2.14.0
2.13.4
2.13.3
2.13.2
2.13.1
2.13.0
2.12.3
2.12.2
2.12.1
2.12.0
2.11.2
2.11.1
2.11.0
2.10.1
2.10.0
2.9.0
2.8.3
2.8.2
2.8.1
2.8.0
2.7.2
2.7.1
2.7.0
2.6.2
2.6.1
2.6.0
2.5.2
2.5.1
2.5.0
2.4.2
2.4.1
2.4.0
2.3.2
2.3.1
2.3.0
2.2.2
2.2.1
2.2.0
2.1.3
2.1.2
2.1.1
2.1.0
2.0.0
2.0.0-rc.0
1.4.0
1.3.0
1.2.1
1.2.0
1.1.1
1.1.0
1.0.0
1.0.0-rc.1
1.0.0-rc.0
0.20.0
0.18.0
0.17.1
0.17.0
0.16.1
0.16.0
0.15.0
0.14.0
0.13.0
0.12.0
0.11.0
0.10.0
0.9.0
0.8.0
0.7.1
0.7.0
0.6.2
0.6.1
0.6.0
0.5.0
Nerves System - BeagleBone Black, BeagleBone Green, PocketBeagle and more
Current section
Files
Jump to
Current section
Files
linux/update-kernel-patch.sh
#!/bin/sh
set -e
# Run this script to update the BBB kernel patches. See the bottom
# of the script for setting the versions.
update_kernel_patch() {
local PATCH_VERSION=$1
local KERNEL_VERSION=$2
local OUTPUT_PATCH=$3
local ORIGINAL_DIFF=patch-$PATCH_VERSION.diff
local ORIGINAL_DIFF_XZ=$ORIGINAL_DIFF.xz
local KERNEL_TARBALL=linux-$KERNEL_VERSION.tar.xz
# Work in a temporary directory
rm -fr work
mkdir -p work
cd work
echo "Downloading files..."
local RCN_PATCH_URL
local KERNEL_URL
case $KERNEL_VERSION in
4*)
RCN_PATCH_URL=http://rcn-ee.net/deb/buster-armhf/v$PATCH_VERSION/$ORIGINAL_DIFF_XZ
KERNEL_URL=https://www.kernel.org/pub/linux/kernel/v4.x/$KERNEL_TARBALL
;;
*)
echo "Unexpected kernel version: $KERNEL_VERSION"
exit 1
esac
# Download the master patch file for the RCN kernel
wget $RCN_PATCH_URL
# Download the kernel that it will patch
wget $KERNEL_URL
# Extract the kernel twice so that the patch can be compared
echo "Extracting..."
tar -x -f $KERNEL_TARBALL && mv linux-$KERNEL_VERSION a
tar -x -f $KERNEL_TARBALL && mv linux-$KERNEL_VERSION b
# Expand the "git" style patch
unxz $ORIGINAL_DIFF_XZ
# Make a git repo and apply the "git" style patch
echo "Creating temporary git repo to extract RCN patch..."
cd b
git init
git add .
git commit -q -m "Initial commit"
git apply ../$ORIGINAL_DIFF
rm -fr .git
# Now create a regular "diff" patch
echo "Creating patch..."
cd ..
diff -Naur --no-dereference a b > ../$OUTPUT_PATCH || :
# Clean up
echo "Cleaning up..."
cd ..
rm -fr work
return 0
}
# NOTE: The -rt vs. no -rt on RCN's site indicates a difference in
# the defconfigs. The patches are the same.
update_kernel_patch 4.19.120-bone50 4.19.120 0001-rcn-linux-4.19.120-bone50.patch
echo "Updated patches. Now rebuild the linux kernel."