Linux kernel: Difference between revisions
imported>Tobias.bora |
imported>Tobias.bora |
||
Line 239: | Line 239: | ||
5. Lastly it is required to give the kernel build system the right location where to install the kernel module. This is done by setting <code>INSTALL_MOD_PATH</code> to <code>$out</code> Otherwise an error like <code>mkdir: cannot create directory '/lib': Permission denied</code> is generated. | 5. Lastly it is required to give the kernel build system the right location where to install the kernel module. This is done by setting <code>INSTALL_MOD_PATH</code> to <code>$out</code> Otherwise an error like <code>mkdir: cannot create directory '/lib': Permission denied</code> is generated. | ||
You can then call your program using something like <code>let yourprogram = config.boot.kernelPackages.callPackage ./your-derivation.nix {}; in …</code> and install the module in the kernel using <code>boot.extraModulePackages = [ yourprogram ];</code>. | You can then call your program using something like <code>let yourprogram = config.boot.kernelPackages.callPackage ./your-derivation.nix {}; in …</code> (or if you want to compile it for the default kernel used by nix you can use <code>pkgs.linuxPackages.callPackage</code> but be aware that if you install it on a system running another kernel it will not work) and install the module in the kernel using <code>boot.extraModulePackages = [ yourprogram ];</code>. | ||
=== Developing out-of-tree kernel modules === | === Developing out-of-tree kernel modules === |