From a3cae20caab84efbf71e423fb75a49fa81ef0f96 Mon Sep 17 00:00:00 2001 From: Vidal Gerard Date: Wed, 29 Oct 2025 16:48:35 +0100 Subject: [PATCH] Added triple choice for kernel : build download or uselocal --- README.md | 2 +- bootstrap.d/13-kernel.sh | 30 +++++++++++++++++++++--------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 9e1578b..b7f0983 100644 --- a/README.md +++ b/README.md @@ -232,7 +232,7 @@ The following static networking parameters are only supported if `ENABLE_WIFI_DH |Option|Value|default value|value format|desciption| |---|---|---|---|---| -|BUILD_KERNEL||true|`true`\|`false`|Build and install the latest RPi 0/1/2/3/4 Linux kernel. The default RPi 0/1/2/3/ kernel configuration is used most of the time. ENABLE_NEXMON - Changes Kernel Source to [https://github.com/Re4son/](Kali Linux Kernel) Precompiled 32bit kernel for RPI0/1/2/3 by [https://github.com/hypriot/](hypriot) Precompiled 64bit kernel for RPI3/4 by [https://github.com/sakaki-/](sakaki)| +|BUILD_KERNEL||build|`build`\|`uselocal`\|`download`|Build and install the latest RPi 0/1/2/3/4 Linux kernel. The default RPi 0/1/2/3/ kernel configuration is used most of the time. ENABLE_NEXMON - Changes Kernel Source to [https://github.com/Re4son/](Kali Linux Kernel) Precompiled 32bit kernel for RPI0/1/2/3 by [https://github.com/hypriot/](hypriot) Precompiled 64bit kernel for RPI3/4 by [https://github.com/sakaki-/](sakaki)| |CROSS_COMPILE|string|||This sets the cross-compile environment for the compiler. Set by RPI_MODEL| |KERNEL_ARCH|string|||This sets the kernel architecture for the compiler. Set by RPI_MODEL| |KERNEL_IMAGE|string|||Name of the image file in the boot partition. Set by RPI_MODEL| diff --git a/bootstrap.d/13-kernel.sh b/bootstrap.d/13-kernel.sh index c5fff0a..253b3c2 100644 --- a/bootstrap.d/13-kernel.sh +++ b/bootstrap.d/13-kernel.sh @@ -14,7 +14,9 @@ if [ "$ENABLE_NEXMON" = true ] ; then fi # Fetch and build latest raspberry kernel -if [ "$BUILD_KERNEL" = true ] ; then +case "$BUILD_KERNEL" in + "build") +#if [ "$BUILD_KERNEL" = build ] ; then # Setup source directory mkdir -p "${KERNEL_DIR}" @@ -798,7 +800,9 @@ if [ "$BUILD_KERNEL" = true ] ; then chroot_exec ln -sf /usr/src/linux "/lib/modules/${KERNEL_VERSION}/source" fi fi + ;; +"download") else # BUILD_KERNEL=false if [ "$SET_ARCH" = 64 ] ; then if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then @@ -875,12 +879,20 @@ else # BUILD_KERNEL=false rm -fr "${temp_dir}" rm -f "${R}"/tmp/kernel.deb fi - - # Check if kernel installation was successful - KERNEL="$(ls -1 "${R}"/boot/firmware/kernel* | sort | tail -n 1)" - if [ -z "$KERNEL" ] ; then - echo "error: kernel installation failed! (/boot/kernel* not found)" - cleanup - exit 1 - fi fi + ;; + +"uselocal") + echo "using local kernel previous run" + ;; + +esac + +# Check if kernel installation was successful +KERNEL="$(ls -1 "${R}"/boot/firmware/kernel* | sort | tail -n 1)" +if [ -z "$KERNEL" ] ; then + echo "error: kernel installation failed! (/boot/kernel* not found)" + cleanup + exit 1 +fi +#fi