Package build problems, kernel oops even without changing the source

Hello,

I am new to OpenWrt and I have a package building problems.
It is either some weird cross compiling problem or something I do not understand.

I have tried to follow the build instructions as carefully as I can.
I do not know are the package build instructions still valid though ?
I have used feed update, feed install, or even feed install a single kmod package.
But no direct packages are in:
pacakge/ folder

ls
base-files boot devel feeds firmware kernel libs Makefile network system utils

So none of the
make package/example/download and etc. examples work.

OK, in make menuconfig I can select the kmod packages as "M" what I want.
I can build, selecting correct target.
They appear in the bin folder.

I can install those in my router.
The vermagic is the same as in the original:
vermagic: 5.4.87 SMP mod_unload MIPS32_R2 32BIT

But still, every time I use my own built package, without even changing anything from the source I get:

CPU 0 Unable to handle kernel paging request at virtual address 00000000, epc == 8d95ac10, ra == 8d95ac10
4,343,62191038,-;Oops[#1]:

Build machine
Linux debian* 4.19.0-13-amd64 #1 SMP Debian 4.19.160-2 (2020-11-28) x86_64 GNU/Linux

Used snapshot:
OpenWrt SNAPSHOT, r15498-fa02225ee6

Target is asus ac85p

I have updated all build essentials and everything I can come up to, starting to get out of idea.
Also upgraded my debian from stretch to buster.
I would just want to make a single little change in one kernel object.

Br,
Roisto

I am a bit confused.
There seems to be some kernel update also going on?

Oh well, after reflashing factory image I seem to be having some problems with some kenel modules.
Notice the version numbers 5.4.87 and 5.4.89

root@OpenWrt:~# opkg install kmod-usb-net-rndis
Installing kmod-usb-net-rndis (5.4.87-1) to root...
Downloading https://downloads.openwrt.org/snapshots/targets/ramips/mt7621/kmods/5.4.87-1-99f4c51d40413e39dd69df99c379e890/kmod-usb-net-rndis_5.4.87-1_mipsel_24kc.ipk
Collected errors:

  • satisfy_dependencies_for: Cannot satisfy the following dependencies for kmod-usb-net-rndis:
  •  kernel (= 5.4.89-1-6b0e6ccfc1a63ac8682d721effce8201)
    
  • opkg_install_cmd: Cannot install package kmod-usb-net-rndis.

root@OpenWrt:~# uname -a
Linux OpenWrt 5.4.87 #0 SMP Thu Jan 14 02:54:06 2021 mips GNU/Linux

Oh well, I can download the 5.4.87 version of the module and install it manually.

Back to basics,

I can crosscompile hello world to mips usign SDK:
root@OpenWrt:~# /tmp/helloworld.mips

Hello, world!

And "file" gives same information to an original kernel object:
~/temp/temp$ file lib/modules/5.4.87/rndis_host.ko
lib/modules/5.4.87/rndis_host.ko: ELF 32-bit LSB relocatable, MIPS, MIPS32 rel2 version 1 (SYSV), not stripped

And my re-compiled:
~/temp/temp$ file temp/lib/modules/5.4.87/rndis_host.ko
temp/lib/modules/5.4.87/rndis_host.ko: ELF 32-bit LSB relocatable, MIPS, MIPS32 rel2 version 1 (SYSV), not stripped

Still, my compiled one gives the kernell oops.

1,341,74968683,-;CPU 0 Unable to handle kernel paging request at virtual address 00000000, epc == 8da5ac10, ra == 8da5ac10
4,342,74989916,-;Oops[#1]:

Obviously, I am doing something wrong, or my build environment is not ok.
It should not be this hard :slight_smile:

Hello,

Well maybe I reply to myself, I have atleast thought I tried to git reset to same head.
openwrt$ git reset --hard fa02225ee6
HEAD is now at fa02225ee6 hostapd: fix key_mgmt typo

But still the control in the kmods are different:
Original:
Depends: kernel (=5.4.87-1-99f4c51d40413e39dd69df99c379e890), .....
My compiled:
Depends: kernel (=5.4.87-1-c3a8eb927802bd4eea3a3bf5d1497130), .....

So, the kernel is not the same after all, perhaps this explains it.

Br,
Roisto

Hello,

Yes, it seems that even though the git head would be correct the makefile would need to exaclty the same for the kernel to match. I guess the kernel memory map could be totally different.

I can now have also own compiled kernel modules working but it needed to have the kernel, or in my case I flashed the factory image completely to match.

But by default none of the wireless drivers were included so had to compile everything once again...and this is an endless loop :slight_smile:

Neverheless good to understand it.

Yeah, the kernel version vermagic hash is not the simple version (like you wrote above), but a hash of all kernel modules compiled and all kernel options available. So, in practice you need the kernel kmods from the same build run as the kernel itself.