Kernel Version mismatch on cross-compiling kernel modules (using onion/omega2-source docker)



  • Hello,
    I'm new here and I'm working on a project using omega2.

    I'm trying to build some kernel module (kmod-batman-adv, kmod-i2c-algo-bit, ...) using the cross-compiling docker prepared from onion (https://hub.docker.com/r/onion/omega2-source/). I've followed the tutorial (https://onion.io/2bt-cross-compiling-c-programs-part-1/) and other useful links but the result is that the modules compiled inside the docker are compiled for kernel 4.4.74-1, while the omega 0.2.0 b194 has kernel 4.4.74.

    When I try to install the compiled ipk on my omega, this is what I get:

    root@Omega-D339:/tmp# opkg install ./kmod-i2c-algo-bit_4.4.74-1_mipsel_24kc.ipk
    Installing kmod-i2c-algo-bit (4.4.74-1) to root...
    Collected errors:

    • satisfy_dependencies_for: Cannot satisfy the following dependencies for kmod-i2c-algo-bit:
    • kernel (= 4.4.74-1-8274f1be988bfc7fa195bc75194d9e87) *
    • opkg_install_cmd: Cannot install package kmod-i2c-algo-bit.

    If I run uname -a, what I see is:

    root@Omega-D339:/tmp# uname -a
    Linux Omega-D339 4.4.74 #0 Tue Jul 31 16:32:08 2018 mips GNU/Linux

    So, my question is: How can I cross compile kernel modules for omega2 official firmware?

    Thank you for your help,
    Paolo



  • Update:
    I've found that the compiling process inside my docker has created a kernel_4.4.74-1-8274f1be988bfc7fa195bc75194d9e87_mipsel_24kc.ipk

    So, I installed this package on my onion2, rebooted (no dmesg errors) and now I can correctly install my kernel modules without errors.

    The question remain, because I don't want to use a custom kernel. I want to use the official omega2 firmware and then install my kernel module for the official kernel.

    How can I obtain this?

    Thanks again,
    Paolo



  • Update 2:

    I've found this topic from @Maximilian-Gerhardt (Thank you for your excellent guide), explaining how to build kernel module for Omega2. I've found this in his topic:

    ...
    It conveniently compiled the hello-world.ko file and even created an ipk package.
    Unfortunetly, trying to installing that package will give you a kernel mismatch error
    because the kernel hashes differ (see this link). Loading the .ko file directly will still work though.
    ...

    So, I'm able to compile the kernel modules I need (copying the .ko files in /lib/modules/4.4.74/, but the ipk still does not match.

    Any suggestions to compile ipk kernel modules for official firmware?



Looks like your connection to Community was lost, please wait while we try to reconnect.