update pi kernel to 6.18.21 + script to update

This commit is contained in:
local-build
2026-04-10 20:46:43 -05:00
parent 81d27edc9b
commit 7830aa03af
3 changed files with 122 additions and 8 deletions
@@ -21,10 +21,10 @@ index bb3126b..bed974f 100644
- linux_version: 6.17.7
- linux_sha256: ddf2ea0d4439e1d57136be3623102af9458f601f5b1cb77e83246e88aea09d0e
- linux_sha512: f16f28c395374099ccf21d9df654a31746ed3f09376f7f9eca172579787b7b493d3878cb0a44348c2846bba93f7950f04b0e45235152860e4789fdd2aa9711cb
+ # rpi-6.18.y branch, commit 21da81b5507a (2026-03-29), kernel 6.18.20
+ linux_version: 21da81b5507a
+ linux_sha256: a2d22af1900f3fd5dbd2f49623f18b9e618382890542c7804e76d775e63f8750
+ linux_sha512: 2fba45bbf869965b4e2c4710a3350e8f80c3c09e516f5dd4358652754744dece431470902272cf367bc9ef413f2e3937be6a474f02fbf9e9653955a71c06f725
+ # rpi-6.18.y branch, commit 8fa1bed55110 (2026-04-10), kernel 6.18.21
+ linux_version: 8fa1bed55110
+ linux_sha256: d2ffb5382c1ad2e313a3bd60d2c8fb1b8af025527abe7f95131035c10c2a419f
+ linux_sha512: 565bd11afe89ef3e1955617191c9461b6365c56fef606baceec4ff612e2484d9077d11500ee0b77160f93cd39ec69ab3fce8e0cf76ba3df087903c3c8eff7290
# renovate: datasource=git-tags extractVersion=^libaio-(?<version>.*)$ depName=https://pagure.io/libaio.git
libaio_version: 0.3.113
@@ -21,10 +21,10 @@ index edcb6dd..e2eb864 100644
- raspberrypi_kernel_version: stable_20250428
- raspberrypi_kernel_sha256: c95906cfbc7808de5860c6d86537bea22e3501f600a5209de59a86cb436886f6
- raspberrypi_kernel_sha512: 0ed5d490c491e590b5980dccf6fcac0dd3c47accbfacd40d91507c12801cff34fa6a1c68991c8a6c57bb259c909121414766f35a0b11c4bd5d62c3e11d710839
+ # rpi-6.18.y branch, commit 21da81b5507a (2026-03-29), kernel 6.18.20
+ raspberrypi_kernel_version: 21da81b5507a
+ raspberrypi_kernel_sha256: a2d22af1900f3fd5dbd2f49623f18b9e618382890542c7804e76d775e63f8750
+ raspberrypi_kernel_sha512: 2fba45bbf869965b4e2c4710a3350e8f80c3c09e516f5dd4358652754744dece431470902272cf367bc9ef413f2e3937be6a474f02fbf9e9653955a71c06f725
+ # rpi-6.18.y branch, commit 8fa1bed55110 (2026-04-10), kernel 6.18.21
+ raspberrypi_kernel_version: 8fa1bed55110
+ raspberrypi_kernel_sha256: d2ffb5382c1ad2e313a3bd60d2c8fb1b8af025527abe7f95131035c10c2a419f
+ raspberrypi_kernel_sha512: 565bd11afe89ef3e1955617191c9461b6365c56fef606baceec4ff612e2484d9077d11500ee0b77160f93cd39ec69ab3fce8e0cf76ba3df087903c3c8eff7290
# renovate: datasource=github-tags depName=revolutionpi/linux
revpi_kernel_version: v6.6.46-rt39-revpi7
+114
View File
@@ -0,0 +1,114 @@
#!/usr/bin/env bash
#
# Update the raspberrypi/linux kernel reference in both patch files.
# Takes a branch or tag name, resolves it to a commit on GitHub, downloads
# the tarball, computes sha256/sha512, extracts the kernel version from the
# top-level Makefile, and rewrites both patch files in place.
#
# Usage: ./update-rpi-kernel.sh <branch-or-tag>
# Example: ./update-rpi-kernel.sh rpi-6.18.y
#
set -euo pipefail
if [ $# -ne 1 ]; then
echo "Usage: $0 <branch-or-tag>" >&2
echo "Example: $0 rpi-6.18.y" >&2
exit 1
fi
REF="$1"
REPO="raspberrypi/linux"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PKGS_PATCH="${SCRIPT_DIR}/patches/siderolabs/pkgs/0001-Patched-for-Raspberry-Pi-5.patch"
SBC_PATCH="${SCRIPT_DIR}/patches/siderolabs/sbc-raspberrypi/0001-Patched-for-Raspberry-Pi-5.patch"
for f in "$PKGS_PATCH" "$SBC_PATCH"; do
if [ ! -f "$f" ]; then
echo "Missing patch file: $f" >&2
exit 1
fi
done
for cmd in curl tar perl awk shasum; do
if ! command -v "$cmd" >/dev/null 2>&1; then
echo "Required command not found: $cmd" >&2
exit 1
fi
done
echo "Resolving ${REPO}@${REF}..."
COMMIT_JSON=$(curl -fsSL \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/${REPO}/commits/${REF}")
FULL_SHA=$(printf '%s' "$COMMIT_JSON" | awk -F'"' '/"sha":/ {print $4; exit}')
if [ -z "$FULL_SHA" ]; then
echo "Could not resolve commit SHA for ${REF}" >&2
exit 1
fi
SHORT_SHA="${FULL_SHA:0:12}"
# Use the committer date, which is what shows up on the GitHub commit page.
COMMIT_DATE=$(printf '%s' "$COMMIT_JSON" \
| awk '/"committer":/{found=1} found && /"date":/{print; exit}' \
| awk -F'"' '{print $4}' \
| cut -d'T' -f1)
echo " commit: $FULL_SHA"
echo " short: $SHORT_SHA"
echo " date: $COMMIT_DATE"
TMPDIR=$(mktemp -d)
trap 'rm -rf "$TMPDIR"' EXIT
TARBALL="${TMPDIR}/rpi-linux.tar.gz"
echo "Downloading tarball..."
curl -fsSL -o "$TARBALL" "https://github.com/${REPO}/archive/${FULL_SHA}.tar.gz"
echo "Computing checksums..."
SHA256=$(shasum -a 256 "$TARBALL" | awk '{print $1}')
SHA512=$(shasum -a 512 "$TARBALL" | awk '{print $1}')
echo " sha256: $SHA256"
echo " sha512: $SHA512"
echo "Extracting kernel version from Makefile..."
tar -xzf "$TARBALL" -C "$TMPDIR" "linux-${FULL_SHA}/Makefile"
MAKEFILE="${TMPDIR}/linux-${FULL_SHA}/Makefile"
V=$(awk '/^VERSION[[:space:]]*=/ {print $3; exit}' "$MAKEFILE")
P=$(awk '/^PATCHLEVEL[[:space:]]*=/ {print $3; exit}' "$MAKEFILE")
S=$(awk '/^SUBLEVEL[[:space:]]*=/ {print $3; exit}' "$MAKEFILE")
KERNEL_VERSION="${V}.${P}.${S}"
echo " kernel: $KERNEL_VERSION"
COMMENT="# ${REF} branch, commit ${SHORT_SHA} (${COMMIT_DATE}), kernel ${KERNEL_VERSION}"
update_field() {
local file="$1" key="$2" value="$3"
FIELD="$key" VALUE="$value" perl -i -pe '
my $k = quotemeta($ENV{FIELD});
s/^(\+\s*${k}:\s*).*/$1$ENV{VALUE}/;
' "$file"
}
update_comment() {
local file="$1"
COMMENT="$COMMENT" perl -i -pe '
s{^(\+\s*)#\s*\S+\s+branch,\s*commit\s+[0-9a-f]+\s*\([^)]*\),\s*kernel\s+\S+.*}
{$1$ENV{COMMENT}};
' "$file"
}
echo "Updating $PKGS_PATCH..."
update_field "$PKGS_PATCH" "linux_version" "$SHORT_SHA"
update_field "$PKGS_PATCH" "linux_sha256" "$SHA256"
update_field "$PKGS_PATCH" "linux_sha512" "$SHA512"
update_comment "$PKGS_PATCH"
echo "Updating $SBC_PATCH..."
update_field "$SBC_PATCH" "raspberrypi_kernel_version" "$SHORT_SHA"
update_field "$SBC_PATCH" "raspberrypi_kernel_sha256" "$SHA256"
update_field "$SBC_PATCH" "raspberrypi_kernel_sha512" "$SHA512"
update_comment "$SBC_PATCH"
echo "Done."