34 lines
1.4 KiB
Bash
34 lines
1.4 KiB
Bash
|
|
#!/usr/bin/env bash
|
||
|
|
# Reproducible RT kernel for the Cuckoo Escapement release.
|
||
|
|
#
|
||
|
|
# KBUILD_BUILD_{USER,HOST,TIMESTAMP} are the whole point of this rebuild: without
|
||
|
|
# them the kernel bakes the builder's `user@hostname` and the wall-clock build
|
||
|
|
# time into /proc/version, which (a) publishes operator identity and (b) makes
|
||
|
|
# the artifact unreproducible. Pinning all three means anyone can rebuild this
|
||
|
|
# and diff the bytes.
|
||
|
|
set -euo pipefail
|
||
|
|
cd "$HOME/src"
|
||
|
|
|
||
|
|
PATCH="$(cd "$(dirname "$0")" && pwd)/0001-pps-gpio-keep-timestamp-in-hard-irq-under-PREEMPT_RT.patch"
|
||
|
|
|
||
|
|
[ -d linux ] || git clone --depth=1 --branch rpi-6.18.y https://github.com/raspberrypi/linux
|
||
|
|
cd linux
|
||
|
|
|
||
|
|
export ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-
|
||
|
|
export KBUILD_BUILD_USER=cuckoo
|
||
|
|
export KBUILD_BUILD_HOST=escapement
|
||
|
|
export KBUILD_BUILD_TIMESTAMP='Mon Jan 1 00:00:00 UTC 2024'
|
||
|
|
|
||
|
|
make bcm2711_defconfig
|
||
|
|
./scripts/config --enable EXPERT --enable PREEMPT_RT \
|
||
|
|
--set-str LOCALVERSION "-rt-cuckoo" --disable LOCALVERSION_AUTO
|
||
|
|
make olddefconfig
|
||
|
|
|
||
|
|
git apply --check "$PATCH" 2>/dev/null && git apply "$PATCH" && echo "PATCH APPLIED" \
|
||
|
|
|| grep -q IRQF_NO_THREAD drivers/pps/clients/pps-gpio.c && echo "PATCH ALREADY PRESENT"
|
||
|
|
|
||
|
|
grep -q "IRQF_NO_THREAD" drivers/pps/clients/pps-gpio.c || { echo "FATAL: patch missing"; exit 1; }
|
||
|
|
|
||
|
|
make -j"$(nproc)" Image modules dtbs
|
||
|
|
echo "BUILD OK: $(cat include/config/kernel.release)"
|