diff options
| author | Viacheslav Hletenko <v.gletenko@vyos.io> | 2026-07-15 18:26:39 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-15 18:26:39 +0300 |
| commit | fbd036a36e4bd1fa8f15638f79bc554db2cac9fb (patch) | |
| tree | 857f156523cdf83e1f45779c54a6e8828ebd9930 /scripts/package-build/linux-kernel/sign-modules.sh | |
| parent | 5e2e9a3375a0ec3845822702fb255ac03e2b661f (diff) | |
| parent | 2fde86f151627dc2940bbdd7e478d856f12f98f5 (diff) | |
| download | vyos-build-fbd036a36e4bd1fa8f15638f79bc554db2cac9fb.tar.gz vyos-build-fbd036a36e4bd1fa8f15638f79bc554db2cac9fb.zip | |
Merge pull request #1239 from c-po/compress-kernel-modules
Kernel: T5641: enable module compression to save disk space
Diffstat (limited to 'scripts/package-build/linux-kernel/sign-modules.sh')
| -rwxr-xr-x | scripts/package-build/linux-kernel/sign-modules.sh | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/scripts/package-build/linux-kernel/sign-modules.sh b/scripts/package-build/linux-kernel/sign-modules.sh index cfb368eb..1fb82165 100755 --- a/scripts/package-build/linux-kernel/sign-modules.sh +++ b/scripts/package-build/linux-kernel/sign-modules.sh @@ -1,15 +1,28 @@ -#!/bin/sh +#!/bin/sh -x BASE_DIR=$(dirname $0) MODULE_DIR=$1 +# Pass "--keep" as $2 to retain the uncompressed, signed .ko next to the +# .ko.xz it produces. Needed by callers whose build system tracks the +# uncompressed .ko as a build output (e.g. CMake custom commands) and +# would otherwise consider it missing and regenerate an unsigned copy. +KEEP_UNCOMPRESSED=$2 . ${BASE_DIR}/kernel-vars SIGN_FILE="${KERNEL_DIR}/scripts/sign-file" +CONFIG_FILE="${KERNEL_DIR}/.config" if [ -f ${EPHEMERAL_KEY} ] && [ -f ${EPHEMERAL_CERT} ]; then find ${MODULE_DIR} -type f -name \*.ko | while read MODULE; do echo "I: Signing ${MODULE} ..." ${SIGN_FILE} sha512 ${EPHEMERAL_KEY} ${EPHEMERAL_CERT} ${MODULE} + if [ -f "$CONFIG_FILE" ] && grep -qx "CONFIG_MODULE_COMPRESS_XZ=y" "$CONFIG_FILE"; then + if [ "${KEEP_UNCOMPRESSED}" = "--keep" ]; then + xz --compress --keep ${MODULE} + else + xz --compress ${MODULE} + fi + fi done + find ${MODULE_DIR} fi - |
