Linux kernel: Difference between revisions
imported>Artturin m fix formatting |
imported>Mic92 replace some maybe's with things you always will have to do. |
||
Line 244: | Line 244: | ||
sourceRoot = "source/linux/v4l2loopback"; | sourceRoot = "source/linux/v4l2loopback"; | ||
hardeningDisable = [ "pic" ]; # 1 | hardeningDisable = [ "pic" "format" ]; # 1 | ||
nativeBuildInputs = kernel.moduleBuildDependencies; # 2 | nativeBuildInputs = kernel.moduleBuildDependencies; # 2 | ||
Line 263: | Line 263: | ||
</syntaxHighlight> | </syntaxHighlight> | ||
1. | 1. For kernel modules it is necessary to disable <code>pic</code> in compiler hardenings as the kernel need different compiler flags. | ||
2. | 2. In addition to other dependencies in <code>nativeBuildInputs</code> you should include <code>kernel.moduleBuildDependencies</code> as this propagates additional libraries required during the build. | ||
3. this kernel | 3. Some kernel modules try guess the kernel version based on the running kernel via <code>uname</code>. Usually they save this information in a makefile variable like <code>KERNELRELEASE</code>. If this is the case you can override the kernel version via <code>makeFlags</code>. The right kernel version string can be found in <code>kernel.modDirVersion</code>. | ||
4. You need to find out how the build environment (Makefile in general) finds the kernel tree. This is sometimes <code>KDIR</code> and sometimes <code>KERNEL_DIR</code>. | 4. You need to find out how the build environment (Makefile in general) finds the kernel tree. This is sometimes <code>KDIR</code> and sometimes <code>KERNEL_DIR</code>. | ||
5. | 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. | ||
== See also == | == See also == |