Open masami256 opened 2 days ago
linux-kbuild-${KERNEL_NAME}
alone won't give you enough useful packages for building kernel modules. You want linux-headers-${KERNEL_NAME}
. This is also what we install in meta-iot2050, both on the target now (https://github.com/siemens/meta-iot2050/blob/088f2a9adec5f0da68c20846e81cf26fd4059949/recipes-core/images/iot2050-image-example.bb#L45) as well as in the SDK (https://github.com/siemens/meta-iot2050/blob/088f2a9adec5f0da68c20846e81cf26fd4059949/conf/distro/iot2050-debian.conf#L27).
@jan-kiszka Thank you for the answer.
linux-kbuild-${KERNEL_NAME} alone won't give you enough useful packages for building kernel modules.
Yes. I added linux-kbuild-${KERNEL_NAME} as well.
I wrote simple kernel module and built it in the SDK's chroot environment. Then I got following error.
root@testpc:/test-module# make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- V=1
make -C /usr/src/linux-headers-6.6.11-isar/ M=/test-module KBUILD_VERBOSE=0 modules
make[1]: Entering directory '/usr/src/linux-headers-6.6.11-isar'
warning: the compiler differs from the one used to build the kernel
The kernel was built by: aarch64-linux-gnu-gcc (Debian 12.2.0-14) 12.2.0
You are using: aarch64-linux-gnu-gcc-12.bin (Debian 12.2.0-14) 12.2.0
CC [M] /test-module/hello.o
/bin/sh: 1: scripts/basic/fixdep: Exec format error
make[3]: *** [scripts/Makefile.build:243: /test-module/hello.o] Error 126
make[3]: *** Deleting file '/test-module/hello.o'
make[2]: *** [/usr/src/linux-headers-6.6.11-isar/Makefile:1913: /test-module] Error 2
make[1]: *** [Makefile:234: __sub-make] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-6.6.11-isar'
make: *** [Makefile:9: all] Error 2
The fixdep command is aarch64 binary so it won't execute on x86-64 host if binfmt_misc is not enabled on the host.
root@testpc:/test-module# file /usr/src/linux-headers-6.6.11-isar/scripts/basic/fixdep
/usr/src/linux-headers-6.6.11-isar/scripts/basic/fixdep: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=50c639f1ed9acdcba3e5f4ed32dc293502eec42c, for GNU/Linux 3.7.0, stripped
So, I wanted to install native linux-kbuild package in SDK. Am I missing something?
As I wrote, only use SDK_INSTALL:append = " linux-headers-${KERNEL_NAME}"
, isar takes care of the right kbuild dependency.
Then, do not touch DISTRO_KERNELS
, linux-mainline
is and remains a custom kernel. I suspect now, changing that variable causes your problems. I cannot reproduce them when adding linux-headers only.
@jan-kiszka Understood. I’ll look into it. Thank you.
In revision "b7e3c78766c3b95198b7fbe5307e0fdad672b0cd" of isar, I was able to install the linux-kbuild-${KERNEL_NAME}-native package in the SDK's rootfs by adding the following configuration to local.conf.
The SDK build was done with the following command line.
When I check the fixdep command, it is an x86-64 binary.
However, in revision 735dc16c1e3d2a66f27504d0ceec8e28a38ab96f, the following error occurred.
I added linux-kbuild-${KERNEL_NAME}-${DISTRO_ARCH}-cross to SDK_INSTALL instead of linux-kbuild-${KERNEL_NAME}-native, but the following error occurred.
In the case of linux-kbuild-${KERNEL_NAME}, I was able to include it in the SDK's rootfs, but the binary is for the target.
How can I install the linux-kbuild package for cross-builds in the SDK's rootfs, as in revision b7e3c78766?