diff mbox series

kernel/crypto: fix crypto-lib-curve25519 x86_64 build

Message ID 20220721131720.3984821-1-fe@dev.tdt.de
State Superseded
Delegated to: Petr Štetiar
Headers show
Series kernel/crypto: fix crypto-lib-curve25519 x86_64 build | expand

Commit Message

Florian Eckert July 21, 2022, 1:17 p.m. UTC
The crypto-lib-curve25519 dependency for x86_64 could not be met,
because the package for for the architecture x86_64 was not added to
crypto-lib-curve package. Also the package arch definition for x86/64
does not exist. It musst be change to x86_64 to get added.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
---
 package/kernel/linux/modules/crypto.mk | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Stijn Tintel July 21, 2022, 3:10 p.m. UTC | #1
On 21/07/2022 15:17, Florian Eckert wrote:
> The crypto-lib-curve25519 dependency for x86_64 could not be met,
> because the package for for the architecture x86_64 was not added to
> crypto-lib-curve package. Also the package arch definition for x86/64
> does not exist. It musst be change to x86_64 to get added.

Can you please elaborate why this is needed? My x86/64 image contains 
curve25519_x86_64.ko without this change. It works with x86/64 because 
of [1] and BOARD is x86 for the x86 target.

Thanks,
Stijn

[1] 
https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=include/kernel.mk;h=001718d89d8b77bf7843c5cba77ef519f808e085;hb=HEAD#l213
Florian Eckert July 22, 2022, 7:28 a.m. UTC | #2
On 2022-07-21 17:10, Stijn Tintel wrote:
> On 21/07/2022 15:17, Florian Eckert wrote:
>> The crypto-lib-curve25519 dependency for x86_64 could not be met,
>> because the package for for the architecture x86_64 was not added to
>> crypto-lib-curve package. Also the package arch definition for x86/64
>> does not exist. It musst be change to x86_64 to get added.
> 
> Can you please elaborate why this is needed? My x86/64 image contains
> curve25519_x86_64.ko without this change.

Hello Stijn

I am currently working on a target for integration in Openwrt (Lightning 
Mountain).
This is a x86_64 architecture with 4 Atoms CPUs. I have added a new 
target (mxl) and
subtarget (lgm) with $(ARCH) x86_64.

But If I do it like this, then the module could not be build because,
the dependency is not met. "Missing

So far it only works now if I set the $(BOARD) value to x86 in the 
Makefile and
I also have to add a $(SUBTARGET) 64 in my directory mxl which in my 
case does not fit.

I also wanted to make it equal to the packages kmod-crypto-lib-poly1305.
This package maps this via $(ARCH) and doesn't do any special handling.

So I would prefer if we make it dependent on the $(ARCH) variable.
Also in the linux kernel this is also  under /arch/x86.

I think we should also update [1]
https://github.com/TDT-AG/openwrt/blob/master/package/kernel/linux/modules/crypto.mk#L464


Best regards

Florian

[1] 
https://github.com/TDT-AG/openwrt/blob/master/package/kernel/linux/modules/crypto.mk#L545

> 
> Thanks,
> Stijn
> 
> [1]
> https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=include/kernel.mk;h=001718d89d8b77bf7843c5cba77ef519f808e085;hb=HEAD#l213
Petr Štetiar Sept. 22, 2022, 4:37 p.m. UTC | #3
Florian Eckert <fe@dev.tdt.de> [2022-07-22 09:28:42]:

Hi,

> This is a x86_64 architecture with 4 Atoms CPUs. I have added a new target
> (mxl) and subtarget (lgm) with $(ARCH) x86_64.

the question is, why are you doing it that way[1]? IMO it would be better to
discuss this together in one go when (even partial) support for this target is
submitted for review.

1. https://patchwork.ozlabs.org/project/openwrt/patch/20220624084233.497248-1-jialex.lu@intel.com/

Cheers,

Petr
Hauke Mehrtens Sept. 24, 2022, 3:46 p.m. UTC | #4
On 7/21/22 15:17, Florian Eckert wrote:
> The crypto-lib-curve25519 dependency for x86_64 could not be met,
> because the package for for the architecture x86_64 was not added to
> crypto-lib-curve package. Also the package arch definition for x86/64
> does not exist. It musst be change to x86_64 to get added.
Maybe you should mention that you want to change it from depending on 
the x86/64 target to the x86_64 CPU config configuration.

> Signed-off-by: Florian Eckert <fe@dev.tdt.de>
> ---
>   package/kernel/linux/modules/crypto.mk | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/package/kernel/linux/modules/crypto.mk b/package/kernel/linux/modules/crypto.mk
> index ed4e51079e..f31c4d5949 100644
> --- a/package/kernel/linux/modules/crypto.mk
> +++ b/package/kernel/linux/modules/crypto.mk
> @@ -526,11 +526,16 @@ define KernelPackage/crypto-lib-curve25519/config
>     imply PACKAGE_kmod-crypto-kpp
>   endef
>   
> -define KernelPackage/crypto-lib-curve25519/x86/64
> +define KernelPackage/crypto-lib-curve25519/x86_64
>     KCONFIG+=CONFIG_CRYPTO_CURVE25519_X86
>     FILES+=$(LINUX_DIR)/arch/x86/crypto/curve25519-x86_64.ko
>   endef

I was looking into this code some time ago.
I think the KCONFIG changes per target are not working. Does it work for 
you when nothing else directly selects the Kconfig symbol?

I think the evaluation of the next lines is only working when Kconfig is 
finished, but I am not sure.

>   
> +ifdef KernelPackage/crypto-lib-curve25519/$(ARCH)
> +  KernelPackage/crypto-lib-curve25519/$(CRYPTO_TARGET)=\
> +	  $(KernelPackage/crypto-lib-curve25519/$(ARCH))
> +endif
> +
>   define KernelPackage/crypto-lib-curve25519/arm-neon
>     KCONFIG+=CONFIG_CRYPTO_CURVE25519_NEON
>     FILES+=$(LINUX_DIR)/arch/arm/crypto/curve25519-neon.ko
diff mbox series

Patch

diff --git a/package/kernel/linux/modules/crypto.mk b/package/kernel/linux/modules/crypto.mk
index ed4e51079e..f31c4d5949 100644
--- a/package/kernel/linux/modules/crypto.mk
+++ b/package/kernel/linux/modules/crypto.mk
@@ -526,11 +526,16 @@  define KernelPackage/crypto-lib-curve25519/config
   imply PACKAGE_kmod-crypto-kpp
 endef
 
-define KernelPackage/crypto-lib-curve25519/x86/64
+define KernelPackage/crypto-lib-curve25519/x86_64
   KCONFIG+=CONFIG_CRYPTO_CURVE25519_X86
   FILES+=$(LINUX_DIR)/arch/x86/crypto/curve25519-x86_64.ko
 endef
 
+ifdef KernelPackage/crypto-lib-curve25519/$(ARCH)
+  KernelPackage/crypto-lib-curve25519/$(CRYPTO_TARGET)=\
+	  $(KernelPackage/crypto-lib-curve25519/$(ARCH))
+endif
+
 define KernelPackage/crypto-lib-curve25519/arm-neon
   KCONFIG+=CONFIG_CRYPTO_CURVE25519_NEON
   FILES+=$(LINUX_DIR)/arch/arm/crypto/curve25519-neon.ko