frank-w / BPI-Router-Linux

Linux kernel 4.14+ for BPI-R2, 5.4+ for R64, 6.1+ for R2Pro and R3
Other
134 stars 48 forks source link

arm64 linux-headers-6.6.25-bpi-r3-main package ships with x86-64 files #122

Closed gustavobsch closed 6 months ago

gustavobsch commented 6 months ago

Hi Frank,

I downloaded the latest 6.6-main package and I'm trying to dkms install a module having the following issue. Any idea how to resolve it?

root@bpi-r3:/tmp# dpkg -i linux-headers-6.6.25-bpi-r3-main_6.6.25-gb54960c0ce55-8_arm64.deb Selecting previously unselected package linux-headers-6.6.25-bpi-r3-main. (Reading database ... 122574 files and directories currently installed.) Preparing to unpack linux-headers-6.6.25-bpi-r3-main_6.6.25-gb54960c0ce55-8_arm64.deb ... Unpacking linux-headers-6.6.25-bpi-r3-main (6.6.25-gb54960c0ce55-8) ... Setting up linux-headers-6.6.25-bpi-r3-main (6.6.25-gb54960c0ce55-8) ... root@bpi-r3:/tmp# root@bpi-r3:/tmp# root@bpi-r3:/tmp# file /usr/src/linux-headers-6.6.25-bpi-r3-main/scripts/basic/fixdep fixdep: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=b7802d3f29393d5a235b4456107c5bf5489d9b3b, for GNU/Linux 3.2.0, not stripped

Thanks Gustavo

gustavobsch commented 6 months ago

Seems like I can re-generate the content of this folder by running make. However now I'm getting this error. Any idea how to generate the Kconfig file?

root@bpi-r3:/usr/src/linux-headers-6.6.25-bpi-r3-main# make
  SYNC    include/config/auto.conf.cmd
can't find file Kconfig
make[3]: *** [scripts/kconfig/Makefile:77: syncconfig] Error 1
make[2]: *** [Makefile:697: syncconfig] Error 2
make[1]: *** [/usr/src/linux-headers-6.6.25-bpi-r3-main/Makefile:798: include/config/auto.conf.cmd] Error 2
make: *** [Makefile:234: __sub-make] Error 2
frank-w commented 6 months ago

I'm not sure what you trying to do...headers are only h files,no full kernel code...these are only for compiling 3rd party apps needing kernel apis (if you try to build a userspace app using gpio or similar).

Kconfig files are source for menuconfig and only in full source and not generable

gustavobsch commented 6 months ago

I'm trying to build jool module via dkms and dkms is throwing an error when it tries to execute the files in the script folder. I belive this is caused due to the binaries being compiled for x86 arquitecture

root@bpi-r3:/opt# dkms install jool-4.1.11
Sign command: /lib/modules/6.6.25-bpi-r3-main/build/scripts/sign-file
Binary /lib/modules/6.6.25-bpi-r3-main/build/scripts/sign-file not found, modules won't be signed
Creating symlink /var/lib/dkms/jool/4.1.11/source -> /usr/src/jool-4.1.11

Building module:
Cleaning build area...
make -j4 KERNELRELEASE=6.6.25-bpi-r3-main -C /lib/modules/6.6.25-bpi-r3-main/build M=/var/lib/dkms/jool/4.1.11/build/src/mod/common modules && make -C /lib/modules/6.6.25-bpi-r3-main/build M=/var/lib/dkms/jool/4.1.11/build/src/mod/nat64 modules && make -C /lib/modules/6.6.25-bpi-r3-main/build M=/var/lib/dkms/jool/4.1.11/build/src/mod/siit modules.......(bad exit status: 2)
Error! Bad return status for module build on kernel: 6.6.25-bpi-r3-main (aarch64)
Consult /var/lib/dkms/jool/4.1.11/build/make.log for more information.
root@bpi-r3:/opt#
root@bpi-r3:/opt# cat /var/lib/dkms/jool/4.1.11/build/make.log
DKMS make.log for jool-4.1.11 for kernel 6.6.25-bpi-r3-main (aarch64)
Wed Apr 24 12:11:27 PM EDT 2024
make: Entering directory '/usr/src/linux-headers-6.6.25-bpi-r3-main'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: aarch64-linux-gnu-gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
  You are using:           gcc (Debian 12.2.0-14) 12.2.0
  CC [M]  /var/lib/dkms/jool/4.1.11/build/src/mod/common/rfc7915/4to6.o
  CC [M]  /var/lib/dkms/jool/4.1.11/build/src/mod/common/rfc7915/6to4.o
  CC [M]  /var/lib/dkms/jool/4.1.11/build/src/mod/common/rfc7915/common.o
  CC [M]  /var/lib/dkms/jool/4.1.11/build/src/mod/common/rfc7915/core.o
/bin/sh: 1: scripts/basic/fixdep: Exec format error
make[2]: *** [scripts/Makefile.build:243: /var/lib/dkms/jool/4.1.11/build/src/mod/common/rfc7915/core.o] Error 126
make[2]: *** Deleting file '/var/lib/dkms/jool/4.1.11/build/src/mod/common/rfc7915/core.o'
make[2]: *** Waiting for unfinished jobs....
/bin/sh: 1: scripts/basic/fixdep: Exec format error
make[2]: *** [scripts/Makefile.build:243: /var/lib/dkms/jool/4.1.11/build/src/mod/common/rfc7915/common.o] Error 126
make[2]: *** Deleting file '/var/lib/dkms/jool/4.1.11/build/src/mod/common/rfc7915/common.o'
/bin/sh: 1: scripts/basic/fixdep: Exec format error
make[2]: *** [scripts/Makefile.build:243: /var/lib/dkms/jool/4.1.11/build/src/mod/common/rfc7915/4to6.o] Error 126
make[2]: *** Deleting file '/var/lib/dkms/jool/4.1.11/build/src/mod/common/rfc7915/4to6.o'
/bin/sh: 1: scripts/basic/fixdep: Exec format error
make[2]: *** [scripts/Makefile.build:243: /var/lib/dkms/jool/4.1.11/build/src/mod/common/rfc7915/6to4.o] Error 126
make[2]: *** Deleting file '/var/lib/dkms/jool/4.1.11/build/src/mod/common/rfc7915/6to4.o'
make[1]: *** [/usr/src/linux-headers-6.6.25-bpi-r3-main/Makefile:1913: /var/lib/dkms/jool/4.1.11/build/src/mod/common] Error 2
make: *** [Makefile:234: __sub-make] Error 2
make: Leaving directory '/usr/src/linux-headers-6.6.25-bpi-r3-main'
frank-w commented 6 months ago

It is possible that the debs are not all built right, libc,headers and dbg packages are built automaticly with the kbuild system...

You can get information about a file with the command "file",afair it also shows the architecture it was built for

Package name contains the right arch,but maybe not all tools support crosscompilation

Maybe this helps https://stackoverflow.com/questions/73698666/kernel-module-on-cross-compile-kernel-bin-sh-1-scripts-basic-fixdep-exec-fo

gustavobsch commented 6 months ago

I ended up installing debian's official linux-kbuild-6.7.9 for arm64 package and using the scripts in it