I noticed that if I have an image recipe that says IMAGE_INSTALL += "kernel-module-foo"
it fails as expected when the kernel hasn't been built with CONFIG_FOO=m. However, if at the same time some other package which happens to get installed in the same image says RRECOMMENDS_${PN} += "kernel-module-foo" the image build silently succeeds, obviously without any foo.ko included. This doesn't seem right. [I'm well aware that the RRECOMMENDS line alone works as expected, this is about the case where both the above lines are in play.] ===== So I discovered this while trying to figure out how to be able to say IMAGE_INSTALL += "kernel-module-ext4" , and have that succeed whenever ext4 is builtin or modular, and have it be a build time error if the kernel was built with EXT4=n - so the recommends approach is out. It obviously doesn't work out-of-the-box for the EXT4=y case. So now I'm contemplating doing python kernel_base_provide_builtin () { kname = d.getVar("KERNEL_PACKAGE_NAME") or "kernel" builtin = os.path.join(d.getVar("PKGD"), "lib/modules", d.getVar("KERNEL_VERSION"), "modules.builtin") if not os.path.exists(builtin): return builtin_mods = [] with open(builtin) as f: for mod in f: mod = mod.strip() mod = os.path.basename(mod) if not mod.endswith(".ko"): continue mod = mod[:-3] mod = mod.lower().replace("_", "-") builtin_mods.append("%s-module-%s" % (kname, mod)) basepkg = kname + "-base" rprovides = (d.getVar("RPROVIDES_" + basepkg) or "").split() rprovides += builtin_mods d.setVar("RPROVIDES_" + basepkg, " ".join(rprovides)) } PACKAGESPLITFUNCS += "kernel_base_provide_builtin" i.e., make sure that the kernel-base package is an rprovider of kernel-module-ext4 for the EXT4=y case [*]. That seems to work as expected in the cases I've tried (provided nobody rrecommends ext4, per above). Does anybody see anything wrong with that approach? EXT4 is just an example, I'm gonna use it for other modules/subsystems with more complicated dependencies that might not be satisfied in a base .config, so a fragment saying CONFIG_FOO=m might have been ignored due to that, and I'd prefer catching that no later than at image build time. I'm not necessarily suggesting the above for oe-core, I can live with it in my own kernel recipes. [*] kernel-base and not the package containing the actual kernel binary, because kernel-base contains the modules.builtin file which is what modprobe consults first to see if it actually has to do anything, so it makes sense to have kernel-module-ext4 pull in that file and the other /lib/modules/ metadata when EXT4=y. The kernel binary is as often as not not actually in the rootfs image, and wouldn't be useful to modprobe anyway. Rasmus
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#153266): https://lists.openembedded.org/g/openembedded-core/message/153266 Mute This Topic: https://lists.openembedded.org/mt/83779506/21656 Group Owner: openembedded-core+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-