From f62242aeb15b85de480b46d2b0d51722aae842ce Mon Sep 17 00:00:00 2001 From: Minecrell Date: Mon, 12 Jul 2021 14:59:25 +0200 Subject: [PATCH] helpers/envkernel.sh: Try harder to not generate Git version suffix (MR 2084) The Git version suffixes usually generated automatically by the Linux build system break packaging in Alpine because the flavor (e.g. "-postmarketos-qcom-msm8916") will no longer match the module and zImage path. So far setting LOCALVERSION= and disabling CONFIG_LOCALVERSION_AUTO was sufficient to avoid the Git version suffixes but this is no longer enough in Linux 5.14. Instead, add a better fix by creating an empty .scmversion file that will be used by the kernel instead of checking the Git status. The advantage is that this works on Linux 5.14 and it should even work when CONFIG_LOCALVERSION_AUTO is set. The .scmversion code can be found here: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/setlocalversion?h=v5.14-rc1#n38 --- helpers/envkernel.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/helpers/envkernel.sh b/helpers/envkernel.sh index 2c587eaf..f2cc894e 100644 --- a/helpers/envkernel.sh +++ b/helpers/envkernel.sh @@ -14,6 +14,9 @@ check_kernel_folder() { clean_kernel_src_dir() { + # Prevent Linux from appending Git version information to kernel version + # This will cause kernels to be packaged incorrectly. + touch .scmversion if [ -f ".config" ] || [ -d "include/config" ]; then echo "Source directory is not clean, running 'make mrproper'." @@ -222,11 +225,6 @@ set_alias_make() { cmd="$cmd make -C /mnt/linux O=/mnt/linux/.output" cmd="$cmd CC=$cc HOSTCC=$hostcc" - # Avoid "+" suffix in kernel version if the working directory is dirty. - # (Otherwise we will generate a package that uses different paths...) - # Note: Set CONFIG_LOCALVERSION_AUTO=n in kernel config additionally - cmd="$cmd LOCALVERSION=" - # shellcheck disable=SC2139 alias make="$cmd" unset cmd