git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #105752 from ryantm/docbook2commonmark-packages-linux

docs: convert packages/linux docbook -> commonmark

commit3a2e9d2ac7e826eacc1dd99f07f9b06242b04e14 authorRyan Mulligan <ryan@ryantm.com> dateWed 2 Dec 2020, 21:19 (6 years ago) parent543f084cb912fe
3 files changed+42−86
doc/builders/packages/index.xml+1−1 doc/builders/packages/linux.section.md+41 doc/builders/packages/linux.xml−85
doc/builders/packages/index.xml+1−1
@@ -12,7 +12,7 @@
1212 <xi:include href="emacs.section.xml" />
1313 <xi:include href="ibus.xml" />
1414 <xi:include href="kakoune.section.xml" />
15− <xi:include href="linux.xml" />
15+ <xi:include href="linux.section.xml" />
1616 <xi:include href="locales.xml" />
1717 <xi:include href="nginx.section.xml" />
1818 <xi:include href="opengl.section.xml" />
doc/builders/packages/linux.section.mdnew file+41
@@ -0,0 +1,41 @@
1+# Linux kernel {#sec-linux-kernel}
2+
3+The Nix expressions to build the Linux kernel are in [`pkgs/os-specific/linux/kernel`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/os-specific/linux/kernel).
4+
5+The function that builds the kernel has an argument `kernelPatches` which should be a list of `{name, patch, extraConfig}` attribute sets, where `name` is the name of the patch (which is included in the kernel’s `meta.description` attribute), `patch` is the patch itself (possibly compressed), and `extraConfig` (optional) is a string specifying extra options to be concatenated to the kernel configuration file (`.config`).
6+
7+The kernel derivation exports an attribute `features` specifying whether optional functionality is or isn’t enabled. This is used in NixOS to implement kernel-specific behaviour. For instance, if the kernel has the `iwlwifi` feature (i.e. has built-in support for Intel wireless chipsets), then NixOS doesn’t have to build the external `iwlwifi` package:
8+
9+```nix
10+modulesTree = [kernel]
11+ ++ pkgs.lib.optional (!kernel.features ? iwlwifi) kernelPackages.iwlwifi
12+ ++ ...;
13+```
14+
15+How to add a new (major) version of the Linux kernel to Nixpkgs:
16+
17+1. Copy the old Nix expression (e.g. `linux-2.6.21.nix`) to the new one (e.g. `linux-2.6.22.nix`) and update it.
18+
19+2. Add the new kernel to `all-packages.nix` (e.g., create an attribute `kernel_2_6_22`).
20+
21+3. Now we’re going to update the kernel configuration. First unpack the kernel. Then for each supported platform (`i686`, `x86_64`, `uml`) do the following:
22+
23+ 1. Make an copy from the old config (e.g. `config-2.6.21-i686-smp`) to the new one (e.g. `config-2.6.22-i686-smp`).
24+
25+ 2. Copy the config file for this platform (e.g. `config-2.6.22-i686-smp`) to `.config` in the kernel source tree.
26+
27+ 3. Run `make oldconfig ARCH={i386,x86_64,um}` and answer all questions. (For the uml configuration, also add `SHELL=bash`.) Make sure to keep the configuration consistent between platforms (i.e. don’t enable some feature on `i686` and disable it on `x86_64`).
28+
29+ 4. If needed you can also run `make menuconfig`:
30+
31+ ```ShellSession
32+ $ nix-env -i ncurses
33+ $ export NIX_CFLAGS_LINK=-lncurses
34+ $ make menuconfig ARCH=arch
35+ ```
36+
37+ 5. Copy `.config` over the new config file (e.g. `config-2.6.22-i686-smp`).
38+
39+4. Test building the kernel: `nix-build -A kernel_2_6_22`. If it compiles, ship it! For extra credit, try booting NixOS with it.
40+
41+5. It may be that the new kernel requires updating the external kernel modules and kernel-dependent packages listed in the `linuxPackagesFor` function in `all-packages.nix` (such as the NVIDIA drivers, AUFS, etc.). If the updated packages aren’t backwards compatible with older kernels, you may need to keep the older versions around.
doc/builders/packages/linux.xmldeleted−85
@@ -1,85 +0,0 @@
1−<section xmlns="http://docbook.org/ns/docbook"
2− xmlns:xlink="http://www.w3.org/1999/xlink"
3− xml:id="sec-linux-kernel">
4− <title>Linux kernel</title>
5−
6− <para>
7− The Nix expressions to build the Linux kernel are in <link
8−xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/os-specific/linux/kernel"><filename>pkgs/os-specific/linux/kernel</filename></link>.
9− </para>
10−
11− <para>
12− The function that builds the kernel has an argument <varname>kernelPatches</varname> which should be a list of <literal>{name, patch, extraConfig}</literal> attribute sets, where <varname>name</varname> is the name of the patch (which is included in the kernel’s <varname>meta.description</varname> attribute), <varname>patch</varname> is the patch itself (possibly compressed), and <varname>extraConfig</varname> (optional) is a string specifying extra options to be concatenated to the kernel configuration file (<filename>.config</filename>).
13− </para>
14−
15− <para>
16− The kernel derivation exports an attribute <varname>features</varname> specifying whether optional functionality is or isn’t enabled. This is used in NixOS to implement kernel-specific behaviour. For instance, if the kernel has the <varname>iwlwifi</varname> feature (i.e. has built-in support for Intel wireless chipsets), then NixOS doesn’t have to build the external <varname>iwlwifi</varname> package:
17−<programlisting>
18−modulesTree = [kernel]
19− ++ pkgs.lib.optional (!kernel.features ? iwlwifi) kernelPackages.iwlwifi
20− ++ ...;
21−</programlisting>
22− </para>
23−
24− <para>
25− How to add a new (major) version of the Linux kernel to Nixpkgs:
26− <orderedlist>
27− <listitem>
28− <para>
29− Copy the old Nix expression (e.g. <filename>linux-2.6.21.nix</filename>) to the new one (e.g. <filename>linux-2.6.22.nix</filename>) and update it.
30− </para>
31− </listitem>
32− <listitem>
33− <para>
34− Add the new kernel to <filename>all-packages.nix</filename> (e.g., create an attribute <varname>kernel_2_6_22</varname>).
35− </para>
36− </listitem>
37− <listitem>
38− <para>
39− Now we’re going to update the kernel configuration. First unpack the kernel. Then for each supported platform (<literal>i686</literal>, <literal>x86_64</literal>, <literal>uml</literal>) do the following:
40− <orderedlist>
41− <listitem>
42− <para>
43− Make an copy from the old config (e.g. <filename>config-2.6.21-i686-smp</filename>) to the new one (e.g. <filename>config-2.6.22-i686-smp</filename>).
44− </para>
45− </listitem>
46− <listitem>
47− <para>
48− Copy the config file for this platform (e.g. <filename>config-2.6.22-i686-smp</filename>) to <filename>.config</filename> in the kernel source tree.
49− </para>
50− </listitem>
51− <listitem>
52− <para>
53− Run <literal>make oldconfig ARCH=<replaceable>{i386,x86_64,um}</replaceable></literal> and answer all questions. (For the uml configuration, also add <literal>SHELL=bash</literal>.) Make sure to keep the configuration consistent between platforms (i.e. don’t enable some feature on <literal>i686</literal> and disable it on <literal>x86_64</literal>).
54− </para>
55− </listitem>
56− <listitem>
57− <para>
58− If needed you can also run <literal>make menuconfig</literal>:
59−<screen>
60−<prompt>$ </prompt>nix-env -i ncurses
61−<prompt>$ </prompt>export NIX_CFLAGS_LINK=-lncurses
62−<prompt>$ </prompt>make menuconfig ARCH=<replaceable>arch</replaceable></screen>
63− </para>
64− </listitem>
65− <listitem>
66− <para>
67− Copy <filename>.config</filename> over the new config file (e.g. <filename>config-2.6.22-i686-smp</filename>).
68− </para>
69− </listitem>
70− </orderedlist>
71− </para>
72− </listitem>
73− <listitem>
74− <para>
75− Test building the kernel: <literal>nix-build -A kernel_2_6_22</literal>. If it compiles, ship it! For extra credit, try booting NixOS with it.
76− </para>
77− </listitem>
78− <listitem>
79− <para>
80− It may be that the new kernel requires updating the external kernel modules and kernel-dependent packages listed in the <varname>linuxPackagesFor</varname> function in <filename>all-packages.nix</filename> (such as the NVIDIA drivers, AUFS, etc.). If the updated packages aren’t backwards compatible with older kernels, you may need to keep the older versions around.
81− </para>
82− </listitem>
83− </orderedlist>
84− </para>
85−</section>