Cannot install self built kernel modules as ipk packages

Hi,

I have my own image build using git and make menuconfig from git tag v23.05.5. I don't want to reflash whole device to use a package that is not available in feeds from commit hardcoded in v23.05.5. So I created a custom feed with only this one package (lpac) and successfully installed the ipk from it on my router. However the package needs optionali uqmi which depends on kmod-usb-net-qmi-wwan. So I included both as module ("M") with menuconfig and built them. Now I have *.ipk files for both of them. When I try to install the kmod I keep getting dependency error:

root@blue /tmp# opkg --force-depends --force-checksum install /tmp/kmod-usb-net-qmi-wwan_5.15.167-1_mipsel_24kc.ipk
Unknown package 'kmod-usb-net-qmi-wwan'.
Collected errors:
 * pkg_hash_check_unresolved: cannot find dependency kernel (= 5.15.167-1-02cf59ceb6f335374a482a691ea5fd62) for kmod-usb-net-qmi-wwan
 * pkg_hash_fetch_best_installation_candidate: Packages for kmod-usb-net-qmi-wwan found, but incompatible with the architectures configured
 * opkg_install_cmd: Cannot install package kmod-usb-net-qmi-wwan.

Note that I used --force-depends and --force-checksum. How do I work around that? My kernel is 5.15.167.

How come the architecture is incompatible?

provide your own kmods, or try playing around with vermagic (search the forum for it).

https://openwrt.org/faq/cannot_satisfy_dependencies

you could also use * instead to M, then the kmod will be inserted into the kernel.

Isn't kmod-usb-net-qmi-wwan_5.15.167-1_mipsel_24kc.ipk my own built kernel module? I set it to be a module in menuconfig and after compilation grabbed the ipk file from bin/ directory.

I want to test and debug 'build as a module' flow for some small experiments so I don't reflash whole device if I want to check a tiny package :slight_smile:

opkg seem to disagree ... ?

Indeed - that is why I'm struggling to debug this. Any idea what did I do wrong? :slight_smile: I used find . -name kmod-net-qmi-wwan* to find the ipk for the module in my build dir :slight_smile:

like I said, try putting a * instead of the M in .config, then it shouldn't happen.

Just to clarify: afaik this will not build the ipk package and I will have to reflash whole image, won't it? I don't want to reflash whole image - I want to practice this "build an ipk" flow so I can test small changes without waiting for a reboot, fixing extroot uuid etc. :slight_smile:

For some reason despite including the module as * the build still produces the ipk - exactly same md5 checksum and it still does not work. I'm not building a single package - each time I'm buidling world, so I guess the ipk is not empty because of this?

Ah I see - because I included uqmi as a module the kmod-usb-net-qmi-wwan is also built as module {*} kmod-usb-net-qmi-wwan. - note the curly braces around asterisk.

The packages are built just the same, whether or not they are included (*) in the image. If you select them in any manner ( M or * ) the package will be built, using using the * just installs the packages into the firmware after building them.

you can always uninstall the package, then reinstall.

This is just silly ... you do not need to build the entire firmware to build a single package, doing so has no affect on the package. You should absolutely being using the ...

make package/<the pkg>/compile V=99

doing a full build for a single package is absolute waste of time and electricity !!

1 Like

That is about the vermagic checksum, calculated as hash from all kernel options & selection at the compile time. If you add/remove aany knod, the hash changes.

Thus, you can only install kmods that have been compiled at the same build run as the firmware & kernel itself. (or use the SDK from that build run).

(But, you should be able to use the --force-depends to overcome that check. That is the curious part in your error message: Unknown package 'kmod-usb-net-qmi-wwan')

Thanks for bringing this up :slight_smile: I did build the package in isolation at first, but I've read here that for kernel modules I need to build the whole kernel with make target/linux/compile and make package/kernel/linux/compile. Initially I went with that, but resorted to murdering mother nature to be sure it's not related to building it in isolation :smiley: just like the oil companies :smiley:

Ah, this makes sense :slight_smile:

Yeah, the Unknown package seems to come from fetching best installation candidate (I'm thinking aloud so to speak :wink: )? Something went terribly wrong and opkg looks up for kmod-usb-net-qmi-wwan in a wrong place?

you don't need to rebuild the kernel to rebuild kmod pkgs ... mother nature aside, time is the most valuable thing in life, i prefer not to waste mine ... on purpose anyway :crazy_face:

2 Likes

Agreed 100% :100: :slight_smile:

To the problem you're having, it seems that you are trying to install a kmod package built against a different kernel the the one in your firmware.

what does the following cmd output

uname -a

are you using sdk to build the pkgs ? I've ran into this issue many times with snapshot firmware's and the sdk.

Output:

Linux blue 5.15.167 #0 Mon Sep 23 12:34:46 2024 mips GNU/Linux

Yes, I cloned the openwrt repo to my debian VM and worked with this :slight_smile:

check the md5 of the installed kernel

opkg list-installed | grep kernel

Oh nice! Didn't know how to do that :slight_smile: Here it is:

kernel - 5.15.167-1-1b5fdf3528b70b8ef40779adea45cc57

It's different due to the fact that I added my own package and uqmi + kmod-usb-net-qmi-wwan to my build config, right?

its different because its from a different snapshot build I would assume.

check what snapshot you are running

ubus call system board

If you plan on doing this type of testing, I'd recommend building the complete image and install it fresh. Then use the same build system to build your test kmod packages. You could try to force it with the --force --nodeps flags but it's not recommended if the purpose is for testing. You could also try and hunt down the proper sdk for the snapshot you're running, but this can be hellish depending on where it came from.

Generally, its best to eliminate all unnecessary variables before starting any type of test (aka baseline). Setting up a full build system or a new feature branch is usually among the first steps. If possible, you may want to update the kernel at the same time as 5.15 isn't relevant anymore, in regards to development