Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Loading custom kernel module

Featured Replies

Hi,

 

I am trying to write my own kernel module/drive for the NanoPi air, running a self-compiled version of armbian 5.83. Actually I only added the PREEMTION option to get real-time behavior when reading/writing from IO pins. I started using the "hello world" template from here. To get the module compiled I had to build the headers for my kernel as well using the option INSTALL_HEADERS in the armbian-build config file. The build debian-package called "linux-headers-next-sunxi_5.83_armhf.deb" was copied and installed on the NanoPi.

 

OK, so now compiling (on the NanoPi - so no cross-compilation) works like a charm:

> make
make -C /lib/modules/4.19.36-sunxi/build M=/home/gresy/Examples modules
make[1]: Entering directory '/usr/src/linux-headers-4.19.36-sunxi'
  CC [M]  /home/gresy/Examples/hello.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/gresy/Examples/hello.mod.o
  LD [M]  /home/gresy/Examples/hello.ko
make[1]: Leaving directory '/usr/src/linux-headers-4.19.36-sunxi'

But when I try to load the hello-world module it's rejected:

> sudo insmod hello.ko
insmod: ERROR: could not insert module hello.ko: Invalid module format

The following message shows up in the kernel buffer, which implies to me the module is not "preemtion compatible" ... if that's possible at all. Or at least the version magic is wrong.

> dmesg
...
[  710.970775] hello: version magic '4.19.36-sunxi SMP mod_unload ARMv7 thumb2 p2v8 ' should be '4.19.36-sunxi SMP preempt mod_unload ARMv7 thumb2 p2v8 '

Here some other information which might be useful:

> sudo modinfo hello.ko
filename:       /home/gresy/Examples/hello.ko
version:        0.1
description:    A simple Hello world LKM!
author:         Akshat Sinha
license:        GPL
srcversion:     B7B3CF8B5A8284B3911C7AF
depends:        
name:           hello
vermagic:       4.19.36-sunxi SMP mod_unload ARMv7 thumb2 p2v8

> uname -a
Linux nanopiair 4.19.36-sunxi #5.83 SMP PREEMPT Tue Apr 30 11:04:15 CEST 2019 armv7l GNU/Linux

So, does anyone know why the module will not get loaded?

 

Thanks for your help,

Markus

  • Author

I installed the kernel-source package (created when compiling armbian in Ubuntu VM) and compiled my module against this directory. Now the "preemt" tag appeared in the vmagic string but the tag "sunxi" got lost.

Currently the vermagic string of my module is "4.19.36+ SMP preempt mod_unload ARMv7 thumb2 p2v8" but it should be "4.19.36-sunxi SMP preempt mod_unload ARMv7 thumb2 p2v8"

 

Any Idea?

On 5/2/2019 at 11:26 AM, mmax said:

I installed the kernel-source package (created when compiling armbian in Ubuntu VM) and compiled my module against this directory. Now the "preemt" tag appeared in the vmagic string but the tag "sunxi" got lost.

Currently the vermagic string of my module is "4.19.36+ SMP preempt mod_unload ARMv7 thumb2 p2v8" but it should be "4.19.36-sunxi SMP preempt mod_unload ARMv7 thumb2 p2v8"

 

Any Idea?

The same problem. Did you find any solutions?

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.