| Summary: | Several modules declare dependency on non-existent 'g_flashmap' kmod | ||
|---|---|---|---|
| Product: | Base System | Reporter: | Colin Gordon <csgordon> |
| Component: | kern | Assignee: | freebsd-bugs (Nobody) <bugs> |
| Status: | Open --- | ||
| Severity: | Affects Only Me | CC: | freebsd, grahamperrin, markj |
| Priority: | --- | ||
| Version: | CURRENT | ||
| Hardware: | riscv | ||
| OS: | Any | ||
| URL: | https://github.com/csgordon/freebsd-starfive2/commit/95e24f536ddd4bde5f3b441c5e3a45a5a0acc49d | ||
|
Description
Colin Gordon
2023-10-10 00:32:41 UTC
Sorry,
> platform-independent.
how did the code in geom_flashmap even compile? I'm relatively new to working in the FreeBSD kernel, so it's quite possible there's a subtlety in missing or some kind of module validation check in not aware of that has broken. But the C code itself doesn't care about the dependency declaration, so geom_flashmap itself is fine, but does declare a module name that's not tied to the *filename* of the final kld, and kld loading assumes the declared dependency name matches the filename, which is what fails. That's why my local fix is to change the module declarations to match the filename. On amd64 it appears that both geom_flashmap and mmcsd are linked directly into the kernel, so the kld loading code doesn't encounter the name mismatch. I suspect the problem is that you don't have a /boot/kernel/linker.hints file. So when the kernel loads a module which depends on g_flashmap, it doesn't know that that corresponds to geom_flashmap.ko. Your patch changes the module name to geom_flashmap, and linker_hints_lookup() will always try to load <module name>.ko, so it works. Note that in FreeBSD, kernel modules and linker files (.ko files) are not exactly the same. A linker file may contain multiple modules. Assuming my guess is right, your patch just works around one specific consequence of not having a linker.hints. OTOH, almost all of the GEOM modules are named geom_*, so maybe the patch should be committed anyway... |