Linux kernel: Difference between revisions
extraConfig in boot.kernelPatches and pkgs.buildLinux is deprecated |
m prefix shell comments with $ to get "comment" highlighting instead of "root shell" |
||
| (7 intermediate revisions by 6 users not shown) | |||
| Line 24: | Line 24: | ||
</syntaxHighlight> | </syntaxHighlight> | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
nix-repl> | nix-repl> pkgs = import <nixpkgs> {} | ||
Added 12607 variables. | Added 12607 variables. | ||
nix-repl> pkgs. | nix-repl> pkgs.linuxKernel.packages | ||
pkgs.linuxPackages pkgs.linuxPackages_custom | pkgs.linuxPackages pkgs.linuxPackages_custom | ||
pkgs.linuxPackages-libre pkgs.linuxPackages_custom_tinyconfig_kernel | pkgs.linuxPackages-libre pkgs.linuxPackages_custom_tinyconfig_kernel | ||
| Line 241: | Line 241: | ||
Please provide a comparison with other distributions' kernel: | Please provide a comparison with other distributions' kernel: | ||
* Arch: https://gitlab.archlinux.org/archlinux/packaging/packages/linux/-/blob/main/config | |||
* Debian: https://salsa.debian.org/kernel-team/linux/blob/master/debian/config/config and the ARCH specific ones | |||
== Booting a kernel from a custom source == | == Booting a kernel from a custom source == | ||
| Line 291: | Line 292: | ||
owner = "aramg"; | owner = "aramg"; | ||
repo = "droidcam"; | repo = "droidcam"; | ||
tag = "v${version}"; | |||
hash = "1d9qpnmqa3pfwsrpjnxdz76ipk4w37bbxyrazchh4vslnfc886fx"; | hash = "1d9qpnmqa3pfwsrpjnxdz76ipk4w37bbxyrazchh4vslnfc886fx"; | ||
}; | }; | ||
| Line 445: | Line 446: | ||
<syntaxHighlight lang=console> | <syntaxHighlight lang=console> | ||
$ nix-shell | $ nix-shell | ||
# to configure | $ # to configure | ||
$ nix-shell> make $makeFlags defconfig -j $(nproc) | $ nix-shell> make $makeFlags defconfig -j $(nproc) | ||
# to build | $ # to build | ||
$ nix-shell> make $makeFlags -j $(nproc) | $ nix-shell> make $makeFlags -j $(nproc) | ||
</syntaxHighlight> | </syntaxHighlight> | ||
| Line 466: | Line 467: | ||
<syntaxHighlight lang=console> | <syntaxHighlight lang=console> | ||
$ nix-shell | $ nix-shell | ||
# to configure | $ # to configure | ||
$ nix-shell> make $makeFlags defconfig -j $(nproc) | $ nix-shell> make $makeFlags defconfig -j $(nproc) | ||
# to build | $ # to build | ||
$ nix-shell> make $makeFlags -j $(nproc) | $ nix-shell> make $makeFlags -j $(nproc) | ||
</syntaxHighlight> | </syntaxHighlight> | ||
| Line 474: | Line 475: | ||
=== Overriding kernel packages === | === Overriding kernel packages === | ||
In order to override <code>linuxPackages</code>, use the <code>extend</code> attribute. Example: | In order to override <code>linuxPackages</code>, an alias of <code>linuxKernel.packages</code>, use the <code>extend</code> attribute. Example: | ||
<syntaxHighlight lang=nix> | <syntaxHighlight lang=nix> | ||
| Line 498: | Line 499: | ||
}) | }) | ||
]; | ]; | ||
</syntaxHighlight> | |||
You can also use <code>kernelPackagesExtensions</code> in a similar fashion to override <code>linuxKernel.packages</code>: | |||
<syntaxHighlight lang=nix> | |||
nixpkgs.overlays = [ | |||
(_: prev: { | |||
kernelPackagesExtensions = prev.kernelPackagesExtensions ++ [ | |||
(_: linuxPrev: { | |||
digimend = linuxPrev.digimend.overrideAttrs (prevAttrs: { | |||
postPatch = prevAttrs.postPatch or "" + '' | |||
substituteInPlace "hid-uclogic-core.c" \ | |||
--replace-fail "del_timer_sync" "timer_shutdown_sync" | |||
''; | |||
}); | |||
}) | |||
]; | |||
}) | |||
]; | |||
</syntaxHighlight> | </syntaxHighlight> | ||
| Line 594: | Line 614: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== See also == | == See also == | ||