Author Topic: compiling modules  (Read 841 times)

cam1965

  • Sr. Member
  • ****
  • Posts: 331
    • View Profile
    • http://
compiling modules
« on: February 18, 2020, 11:14:43 am »
Hi , I am trying to compile some modules from kernel ( available at github ) . But when I did the command : modprobe " some module" it gave me an error something about exec format. ( because the kernel module compiled  doesn't match the boot kernel ). I've also tried the kernel and kernel-headers  from repository ( using apt-get install )  but in this case the Fn key doesn't work and also no  module was loaded ( wifi also didn't work ). So what is the kernel source repository that matches the kernel boot ?
Note : I've tried all branches from the kernel available at github .
Thank you all.
« Last Edit: March 13, 2020, 12:01:40 pm by cam1965 »

mithrandir

  • Full Member
  • ***
  • Posts: 187
    • View Profile
    • http://www.mygnu.de
compiling modules
« Reply #1 on: February 18, 2020, 04:47:43 pm »
Quote from: cam1965
Hi , I am trying to compile some modules from kernel ( available at github ) . But when I did the command : modprobe " some module" it gave me an error something about exec format. ( because the kernel module compiled  doesn't match the boot kernel ). I've also tried the kernel and kernel-headers  from repository ( using apt-get install )  but in this case the Fn key doesn't work and also no  module was loaded ( wifi also didn't work ). So what is the kernel source repository that matches the kernel boot ?
Note : I've tried all branches from the kernel available at github .
Thank you all.
Just guessing, had no time to try out the Linux image, yet.
Maybe the compiler does not match the one used to compile the kernel. Had the same problem when compiling android modules.

Which compiler did you use? gcc? What is the output of cat /proc/version ?
Just to be sure, what is the version of the kernel packages?

If I am right with my guess, either use the matching compiler, probably clang, or create an own boot image. (boot image and modules compiled with same compiler).

cam1965

  • Sr. Member
  • ****
  • Posts: 331
    • View Profile
    • http://
compiling modules
« Reply #2 on: February 18, 2020, 05:43:17 pm »
Quote from: mithrandir
Quote from: cam1965
Hi , I am trying to compile some modules from kernel ( available at github ) . But when I did the command : modprobe " some module" it gave me an error something about exec format. ( because the kernel module compiled  doesn't match the boot kernel ). I've also tried the kernel and kernel-headers  from repository ( using apt-get install )  but in this case the Fn key doesn't work and also no  module was loaded ( wifi also didn't work ). So what is the kernel source repository that matches the kernel boot ?
Note : I've tried all branches from the kernel available at github .
Thank you all.
Just guessing, had no time to try out the Linux image, yet.
Maybe the compiler does not match the one used to compile the kernel. Had the same problem when compiling android modules.

Which compiler did you use? gcc? What is the output of cat /proc/version ?
Just to be sure, what is the version of the kernel packages?

If I am right with my guess, either use the matching compiler, probably clang, or create an own boot image. (boot image and modules compiled with same compiler).

The modules were compiled successfully. The problem is when I will load them.
The compiler is gcc .  I' ve compiled inside debian in cosmo communicator.
I am using the sources from https://github.com/gemian/cosmo-linux-kernel-4.4
Note : I 've compiled only the modules.
The boot  kernel is from the image provided  in planet support page. ( http://support.planetcom.co.uk/index.php/Cosmo_Linux_Beta )

gemini@cosmopda:~$ cat /proc/version
Linux version 4.4.146 (nekit@supernova) (Android (4691093 based on r316199) clang version 6.0.2 (https://android.googlesource.com/toolchain/clang 183abd29fc496f55536e7d904e0abae47888fc7f) (https://android.googlesource.com/toolchain/llvm 34361f192e41ed6e4e8f9aca80a4ea7e9856f327) (based on LLVM 6.0.2svn)) #28 SMP PREEMPT Sat Jan 18 22:23:37 GMT 2020
gemini@cosmopda:~$


thank you.
« Last Edit: February 18, 2020, 05:56:53 pm by cam1965 »

mithrandir

  • Full Member
  • ***
  • Posts: 187
    • View Profile
    • http://www.mygnu.de
compiling modules
« Reply #3 on: February 18, 2020, 06:35:00 pm »
Quote from: cam1965
gemini@cosmopda:~$ cat /proc/version
Linux version 4.4.146 (nekit@supernova) (Android (4691093 based on r316199) clang version 6.0.2 (https://android.googlesource.com/toolchain/clang 183abd29fc496f55536e7d904e0abae47888fc7f) (https://android.googlesource.com/toolchain/llvm 34361f192e41ed6e4e8f9aca80a4ea7e9856f327) (based on LLVM 6.0.2svn)) #28 SMP PREEMPT Sat Jan 18 22:23:37 GMT 2020
gemini@cosmopda:~$


thank you.

OK, that's it. From your output, the kernel has been compiled using clang. So install a clang compiler as near as possible to clang version 6.0.2. Command line should be similar to the one I have been using for the Android modules: https://www.mygnu.de/2020/02/exfat-support-...o-communicator/

First I also have tried with gcc and got the same exec format error on Android.

Another aproach would be to compile kernel and modules with gcc. For the Gemini this involved a mkbootimg step ( @see: https://github.com/gemian/gemini-keyboard-a...rnelCompilation ) to get a bootable image. I don't know if this also  applies to the Cosmo and how to do it, yet.

cam1965

  • Sr. Member
  • ****
  • Posts: 331
    • View Profile
    • http://
compiling modules
« Reply #4 on: February 18, 2020, 06:46:46 pm »
Quote from: mithrandir
Quote from: cam1965
gemini@cosmopda:~$ cat /proc/version
Linux version 4.4.146 (nekit@supernova) (Android (4691093 based on r316199) clang version 6.0.2 (https://android.googlesource.com/toolchain/clang 183abd29fc496f55536e7d904e0abae47888fc7f) (https://android.googlesource.com/toolchain/llvm 34361f192e41ed6e4e8f9aca80a4ea7e9856f327) (based on LLVM 6.0.2svn)) #28 SMP PREEMPT Sat Jan 18 22:23:37 GMT 2020
gemini@cosmopda:~$


thank you.

OK, that's it. From your output, the kernel has been compiled using clang. So install a clang compiler as near as possible to clang version 6.0.2. Command line should be similar to the one I have been using for the Android modules: https://www.mygnu.de/2020/02/exfat-support-...o-communicator/

First I also have tried with gcc and got the same exec format error on Android.

Another aproach would be to compile kernel and modules with gcc. For the Gemini this involved a mkbootimg step ( @see: https://github.com/gemian/gemini-keyboard-a...rnelCompilation ) to get a bootable image. I don't know if this also  applies to the Cosmo and how to do it, yet.

OK. Thank you so much again.

cam1965

  • Sr. Member
  • ****
  • Posts: 331
    • View Profile
    • http://
compiling modules
« Reply #5 on: February 19, 2020, 11:23:04 am »
Quote from: cam1965
Quote from: mithrandir
Quote from: cam1965
gemini@cosmopda:~$ cat /proc/version
Linux version 4.4.146 (nekit@supernova) (Android (4691093 based on r316199) clang version 6.0.2 (https://android.googlesource.com/toolchain/clang 183abd29fc496f55536e7d904e0abae47888fc7f) (https://android.googlesource.com/toolchain/llvm 34361f192e41ed6e4e8f9aca80a4ea7e9856f327) (based on LLVM 6.0.2svn)) #28 SMP PREEMPT Sat Jan 18 22:23:37 GMT 2020
gemini@cosmopda:~$


thank you.

OK, that's it. From your output, the kernel has been compiled using clang. So install a clang compiler as near as possible to clang version 6.0.2. Command line should be similar to the one I have been using for the Android modules: https://www.mygnu.de/2020/02/exfat-support-...o-communicator/

First I also have tried with gcc and got the same exec format error on Android.

Another aproach would be to compile kernel and modules with gcc. For the Gemini this involved a mkbootimg step ( @see: https://github.com/gemian/gemini-keyboard-a...rnelCompilation ) to get a bootable image. I don't know if this also  applies to the Cosmo and how to do it, yet.

OK. Thank you so much again.

I've compiled  with clang. But when loading the module I've got the same error.
Maybe in the future I will try to compile the kernel and modules with gcc.
Thank you so much again.
« Last Edit: February 19, 2020, 12:04:35 pm by cam1965 »

mithrandir

  • Full Member
  • ***
  • Posts: 187
    • View Profile
    • http://www.mygnu.de
compiling modules
« Reply #6 on: February 19, 2020, 04:23:30 pm »
Quote from: cam1965
I've compiled  with clang. But when loading the module I've got the same error.
Maybe in the future I will try to compile the kernel and modules with gcc.
Thank you so much again.
Have you tried to read the running kernels configuration (cat /proc|config.gz|gunzip>.config) and use this as a base for your kernel configuration? Another possible cause could be compiling from git head. Maybe there have been commits relevant for the module layout after the kernel has been built.

cam1965

  • Sr. Member
  • ****
  • Posts: 331
    • View Profile
    • http://
compiling modules
« Reply #7 on: February 19, 2020, 06:47:12 pm »
Quote from: mithrandir
Quote from: cam1965
I've compiled  with clang. But when loading the module I've got the same error.
Maybe in the future I will try to compile the kernel and modules with gcc.
Thank you so much again.
Have you tried to read the running kernels configuration (cat /proc|config.gz|gunzip>.config) and use this as a base for your kernel configuration? Another possible cause could be compiling from git head. Maybe there have been commits relevant for the module layout after the kernel has been built.

Yes, I am using this config from /proc/config.gz. And I ´ve tried all branches available ( master, native and packaging ).
Note : This config file  has only 2 modules after the compiling  process. This is good for test purposes. It takes a very litle time to compile.

Thank you so much again.

shuntcap

  • Jr. Member
  • **
  • Posts: 79
    • View Profile
compiling modules
« Reply #8 on: March 12, 2020, 05:30:09 am »
Quote from: cam1965
Quote from: mithrandir
Quote from: cam1965
I've compiled  with clang. But when loading the module I've got the same error.
Maybe in the future I will try to compile the kernel and modules with gcc.
Thank you so much again.
Have you tried to read the running kernels configuration (cat /proc|config.gz|gunzip>.config) and use this as a base for your kernel configuration? Another possible cause could be compiling from git head. Maybe there have been commits relevant for the module layout after the kernel has been built.

Yes, I am using this config from /proc/config.gz. And I ´ve tried all branches available ( master, native and packaging ).
Note : This config file  has only 2 modules after the compiling  process. This is good for test purposes. It takes a very litle time to compile.

Thank you so much again.
See my post [a href=\'index.php?act=findpost&pid=295271\']here[/a] regarding reconfiguring the kernel to allow force-loading of modules, then force-loading the wifi module.

cam1965

  • Sr. Member
  • ****
  • Posts: 331
    • View Profile
    • http://
compiling modules
« Reply #9 on: March 12, 2020, 12:02:42 pm »
Quote from: shuntcap
Quote from: cam1965
Quote from: mithrandir
Quote from: cam1965
I've compiled  with clang. But when loading the module I've got the same error.
Maybe in the future I will try to compile the kernel and modules with gcc.
Thank you so much again.
Have you tried to read the running kernels configuration (cat /proc|config.gz|gunzip>.config) and use this as a base for your kernel configuration? Another possible cause could be compiling from git head. Maybe there have been commits relevant for the module layout after the kernel has been built.

Yes, I am using this config from /proc/config.gz. And I ´ve tried all branches available ( master, native and packaging ).
Note : This config file  has only 2 modules after the compiling  process. This is good for test purposes. It takes a very litle time to compile.

Thank you so much again.
See my post [a href=\'index.php?act=findpost&pid=295271\']here[/a] regarding reconfiguring the kernel to allow force-loading of modules, then force-loading the wifi module.

Thank you so much again.
I've just answered you there. Worked like a charm !
Thank you again !