liminix-fork/pkgs/kernel
Daniel Barlow b9c0d93670 build modules at same time as main kernel vmlinux
This changes the practice for building kernel modules: now we expect
that the appropriate Kconfig symbols are set to =m in
config.kernel.config, and then use pkgs.kmodloader to create
a service that loads and unloads all the modules depended on by
a particular requirement.

Note that modules won't be installed on the target device just by
virue of having been built: only the modules that are referenced by a
kmodloader package will be in the closure.

An example may make this clearer: see modules/firewall/default.nix
in this commit.

Why?

If you have a compiled Linux kernel source tree and you change some
symbol from "is not set" to m and then run make modules, you cannot in
general expect that newly compiled module to work. This is because
there are places in the build of the main kernel where it looks to see
which modules _may_ be defined and uses that information to
accommodate them.

For example in an in-kernel build of

  https://github.com/torvalds/linux/blob/master/net/netfilter/core.c#L689

some symbols are defined only if CONFIG_NF_CONNTRACK is set, meaning
this code won't work if we have it unset initially then try later to
enable it and build modules only. Or see

  https://github.com/torvalds/linux/blob/master/include/linux/netdevice.h#L160
2024-02-11 23:47:11 +00:00
..
cmdline-cookie.patch unify kernel command line handling 2023-03-23 22:24:44 +00:00
default.nix build modules at same time as main kernel vmlinux 2024-02-11 23:47:11 +00:00
dtb.nix detect arch in kernel and uimage 2023-09-20 18:26:33 +01:00
kernel_fdt.its in uimage FIT, honour ${arch} 2023-11-05 11:31:28 +00:00
mips-malta-fdt-from-bootloader.patch tidy up kernel patch 2023-12-21 21:12:55 +00:00
phram-allow-cached-mappings.patch aarch64: make tftpboot work 2023-10-09 19:47:57 +01:00
uimage.nix convert flash params to int 2023-11-12 20:39:06 +00:00
write-kconfig.nix extract writeKconfig to its own file 2023-06-26 20:49:43 +01:00