Linux kernel: Difference between revisions

imported>SuperSamus
(Extracting Module.symvers)
imported>SuperSamus
(Don't repeat example)
Line 308: Line 308:
</syntaxHighlight>
</syntaxHighlight>


If wishing to develop out-of-tree kernel modules for kernels aside from the default variant shipped under <code>pkgs.linuxPackages</code>, a flow similar to the example below will be used.
If wishing to develop out-of-tree kernel modules for kernels aside from the default variant shipped under <code>pkgs.linuxPackages</code>, you can replace <code>linux.dev</code> with (for instance) <code>linuxPackages_latest.kernel.dev</code>.
The example below illustrates a flow for building kernel modules for <code>pkgs.linuxPackages_latest</code>.
 
<syntaxHighlight lang="console>
$ nix-shell '<nixpkgs>' -A linuxPackages_latest.kernel.dev
$ make -C $(nix-build -E '(import <nixpkgs> {}).linuxPackages_latest.kernel.dev' --no-out-link)/lib/modules/*/build M=$(pwd) modules
$ insmod ./hello.ko
$ dmesg | grep hello
[  82.027229] hello world!
</syntaxHighlight>


If you want a local development environment and are only interested in Module.symvers, then you can do instead:
If you want a local development environment and are only interested in Module.symvers, then you can do instead: