disable kexec-syscall-auto flag on old kernels

This commit is contained in:
Jörg Thalheim 2023-12-23 18:16:16 +01:00 committed by mergify[bot]
parent 1d92ed3028
commit eaf2d21fa9

View file

@ -54,8 +54,15 @@ done
find . | cpio -o -H newc | gzip -9 >> "$SCRIPT_DIR/initrd" find . | cpio -o -H newc | gzip -9 >> "$SCRIPT_DIR/initrd"
kexecSyscallFlags=""
# only do kexec-syscall-auto on kernels newer than 6.0.
# On older kernel we often get errors like: https://github.com/nix-community/nixos-anywhere/issues/264
if ! printf "%s\n" "6.1" "$(uname -r)" | sort -c -V; then
kexecSyscallFlags="--kexec-syscall-auto"
fi
if ! "$SCRIPT_DIR/kexec" --load "$SCRIPT_DIR/bzImage" \ if ! "$SCRIPT_DIR/kexec" --load "$SCRIPT_DIR/bzImage" \
--kexec-syscall-auto \ "$kexecSyscallFlags" \
--initrd="$SCRIPT_DIR/initrd" --no-checks \ --initrd="$SCRIPT_DIR/initrd" --no-checks \
--command-line "init=$init $kernelParams"; then --command-line "init=$init $kernelParams"; then
echo "kexec failed, dumping dmesg" echo "kexec failed, dumping dmesg"