patches: fix crypto module packaging for older kernels (0060)

The MediaTek SDK uses kernel 5.4.271 which requires adjustments to
the crypto module packaging:

1. The gf128mul module location changed between kernel versions:
   - Kernels < 6.2: crypto/gf128mul.ko
   - Kernels >= 6.2: lib/crypto/gf128mul.ko
   Add version-specific file paths to handle both locations.

2. The sha512-arm64 module doesn't exist in older ARM64 kernels like 5.4,
   causing package build failures. Exclude this module for the mt7981
   target which uses the older MediaTek SDK kernel.

These changes allow the kernel modules to build correctly whilst
maintaining compatibility with newer kernel versions.

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2025-10-19 00:00:00 +02:00
parent 3b1ccdf4e9
commit 5b9baf5119

View File

@@ -0,0 +1,56 @@
From 373fb35b23635da63f8d61006542992c0ce924a1 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Wed, 1 Oct 2025 09:46:54 +0200
Subject: [PATCH] kernel: Fix crypto module packaging for older kernels
The MediaTek SDK uses kernel 5.4.271 which requires adjustments to
the crypto module packaging:
1. The gf128mul module location changed between kernel versions:
- Kernels < 6.2: crypto/gf128mul.ko
- Kernels >= 6.2: lib/crypto/gf128mul.ko
Add version-specific file paths to handle both locations.
2. The sha512-arm64 module doesn't exist in older ARM64 kernels like 5.4,
causing package build failures. Exclude this module for the mt7981
target which uses the older MediaTek SDK kernel.
These changes allow the kernel modules to build correctly whilst
maintaining compatibility with newer kernel versions.
Signed-off-by: John Crispin <john@phrozen.org>
---
package/kernel/linux/modules/crypto.mk | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/package/kernel/linux/modules/crypto.mk b/package/kernel/linux/modules/crypto.mk
index 78c9712176..35287f11a9 100644
--- a/package/kernel/linux/modules/crypto.mk
+++ b/package/kernel/linux/modules/crypto.mk
@@ -311,7 +311,9 @@ define KernelPackage/crypto-gf128
KCONFIG:= \
CONFIG_CRYPTO_GF128MUL \
CONFIG_CRYPTO_LIB_GF128MUL
- FILES:=$(LINUX_DIR)/lib/crypto/gf128mul.ko
+ FILES:= \
+ $(LINUX_DIR)/crypto/gf128mul.ko@lt6.2 \
+ $(LINUX_DIR)/lib/crypto/gf128mul.ko@ge6.2
AUTOLOAD:=$(call AutoLoad,09,gf128mul)
$(call AddDepends/crypto)
endef
@@ -1116,10 +1118,12 @@ define KernelPackage/crypto-sha512/arm
AUTOLOAD+=$(call AutoLoad,09,sha512-arm)
endef
+ifndef CONFIG_TARGET_mediatek_mt7981
define KernelPackage/crypto-sha512/aarch64
FILES+=$(LINUX_DIR)/arch/arm64/crypto/sha512-arm64.ko
AUTOLOAD+=$(call AutoLoad,09,sha512-arm64)
endef
+endif
KernelPackage/crypto-sha512/imx/cortexa7=$(KernelPackage/crypto-sha512/arm)
KernelPackage/crypto-sha512/imx/cortexa9=$(KernelPackage/crypto-sha512/arm)
--
2.34.1