Skip to contentSkip to conversation

package/ocf-linux: fix build with kernels up to version 4.14

PATCH In review James Hilliard 2 participants 2 messages Oct 8, 2022 – Nov 1, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/ocf-linux: fix build with kernels up to version 4.14

Add patches fixing build on kernels up to version 4.14.

Depend on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_15 as builds fail on 4.15 and newer currently.

---
 package/cryptodev/Config.in                   |   1 +
 ...gnal.h-include-on-linux-below-4.11.0.patch |  36 +++
 ...functions-on-kernels-4.6.0-and-newer.patch | 222 ++++++++++++++++++
 ...ssing-crypto_alloc_ablkcipher-symbol.patch |  35 +++
 4 files changed, 294 insertions(+)
 create mode 100644 package/ocf-linux/0001-Fix-signal.h-include-on-linux-below-4.11.0.patch
 create mode 100644 package/ocf-linux/0002-Fix-crypto_hash-functions-on-kernels-4.6.0-and-newer.patch
 create mode 100644 package/ocf-linux/0003-Fix-missing-crypto_alloc_ablkcipher-symbol.patch
package/cryptodev/Config.in +1 -0
index d1e64498a8..e243cab6f0 100644
@@ -28,6 +28,7 @@ config BR2_PACKAGE_CRYPTODEV_LINUX
 
 config BR2_PACKAGE_OCF_LINUX
 	bool "ocf-linux"
+	depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_15
 	select BR2_PACKAGE_HAS_CRYPTODEV
 	help
 	  OCF-Linux is a Linux port of the OpenBSD/FreeBSD Cryptographic
package/ocf-linux/0001-Fix-signal.h-include-on-linux-below-4.11.0.patch new file +36 -0
new file mode 100644
index 0000000000..2517c19547
@@ -0,0 +1,36 @@
+From 9e361206c6f0c8e0f62449cdec3b277f96277cd6 Mon Sep 17 00:00:00 2001
+From: James Hilliard <[email protected]>
+Date: Fri, 7 Oct 2022 22:25:37 -0400
+Subject: [PATCH] Fix signal.h include on linux below 4.11.0
+
+The linux/signal.h header was moved to linux/sched/signal.h as
+of linux version 4.11.0.
+
+As such linux/sched/signal.h is not available on linux below 4.11.0.
+
+Signed-off-by: James Hilliard <[email protected]>
+[Upstream status:
+https://sourceforge.net/p/ocf-linux/mailman/message/37718258/]
+---
+ ocf/crypto.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/ocf/crypto.c b/ocf/crypto.c
+index 4e50328..5691b2a 100644
+--- a/ocf/crypto.c
++++ b/ocf/crypto.c
+@@ -73,7 +73,11 @@ __FBSDID("$FreeBSD: src/sys/opencrypto/crypto.c,v 1.16 2005/01/07 02:29:16 imp E
+ #include <linux/slab.h>
+ #include <linux/wait.h>
+ #include <linux/sched.h>
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0)
++#include <linux/signal.h>
++#else
+ #include <linux/sched/signal.h>
++#endif
+ #include <linux/spinlock.h>
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,4)
+ #include <linux/kthread.h>
+-- 
+2.37.3
+
package/ocf-linux/0002-Fix-crypto_hash-functions-on-kernels-4.6.0-and-newer.patch new file +222 -0

222 lines not on this page · raw message

package/ocf-linux/0003-Fix-missing-crypto_alloc_ablkcipher-symbol.patch new file +35 -0
new file mode 100644
index 0000000000..7e420f6747
@@ -0,0 +1,35 @@
+From 3a847686f8a18a50149f2f3d4ed8a661ed507154 Mon Sep 17 00:00:00 2001
+From: James Hilliard <[email protected]>
+Date: Fri, 7 Oct 2022 22:44:58 -0400
+Subject: [PATCH] Fix missing crypto_alloc_ablkcipher symbol
+
+The crypto_alloc_ablkcipher symbol was removed as of linux
+version 4.8.0.
+
+Signed-off-by: James Hilliard <[email protected]>
+[Upstream status:
+https://sourceforge.net/p/ocf-linux/mailman/message/37718259/]
+---
+ ocf/cryptosoft.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/ocf/cryptosoft.c b/ocf/cryptosoft.c
+index caf9c06..841d41e 100644
+--- a/ocf/cryptosoft.c
++++ b/ocf/cryptosoft.c
+@@ -190,9 +190,11 @@ static struct kmem_cache *swcr_req_cache;
+ 	#define plain(X)	#X , 0
+ #endif /* if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) */
+ 
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) || LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0)
++#define crypto_alloc_ablkcipher(a,b,c)		(NULL)
++#endif
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
+ /* no ablkcipher in older kernels */
+-#define crypto_alloc_ablkcipher(a,b,c)		(NULL)
+ #define crypto_ablkcipher_tfm(x)			((struct crypto_tfm *)(x))
+ #define crypto_ablkcipher_set_flags(a, b)	/* nop */
+ #define crypto_ablkcipher_setkey(x, y, z)	(-EINVAL)
+-- 
+2.37.3
+
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Hello James,

Quoted 4 lines · On Sat, 8 Oct 2022 07:44:14 -0600 James Hilliard <[email protected]>…

Add patches fixing build on kernels up to version 4.14.

Depend on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_15 as builds fail on 4.15 and newer currently.

Thing is that !BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_15 does not guarantee that the kernel is < 4.15. Indeed, the kernel version can be much more recent than the kernel headers version. For example, you can be using an external toolchain with headers 4.9... and be building a 6.0 Linux kernel, against which the ocf-linux kernel modules will be built.. and fail to build.

To be honest, the last release of ocf-linux was in 2017. It doesn't build after 4.14, and even 4.14 requires patches. I would advocate for dropping ocf-linux entirely. It was added by Gustavo back in the days, and nobody ever cared about this package except you earlier this year with the bump to 20171122. All other changes on ocf-linux have been related to tree-wide cleanup/infrastructure changes.

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot