From ea94f6b89327d96f0c23b61be473f020a7e73ab6 Mon Sep 17 00:00:00 2001 From: Valentin Gagarin Date: Mon, 8 Jan 2024 12:10:41 +0100 Subject: [PATCH] doc: update the kernel config documentation to use `nix-shell` (#265057) this also slightly improves the instructions after working through them to check that they do what one would expect. Co-authored-by: alex --- pkgs/os-specific/linux/kernel/README.md | 36 +++++++++++++++++-------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/pkgs/os-specific/linux/kernel/README.md b/pkgs/os-specific/linux/kernel/README.md index 92d5308e1c05..84fb05fc07a2 100644 --- a/pkgs/os-specific/linux/kernel/README.md +++ b/pkgs/os-specific/linux/kernel/README.md @@ -4,23 +4,37 @@ 2. Add the new kernel to the `kernels` attribute set in [`linux-kernels.nix`](./linux-kernels.nix) (e.g., create an attribute `kernel_2_6_22`). -3. Update the kernel configuration. First unpack the kernel. Then for each supported platform (`i686`, `x86_64`, `uml`) do the following: +3. Update the kernel configuration: - 1. Make a 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`). + 1. While in the Nixpkgs repository, enter the development shell for that kernel: - 2. Copy the config file for this platform (e.g., `config-2.6.22-i686-smp`) to `.config` in the kernel source tree. + ```console + $ nix-shell -A linuxKernel.kernels.linux_2_6_22 + ``` - 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`). + 2. Unpack the kernel: - 4. If needed, you can also run `make menuconfig`: + ```console + [nix-shell]$ pushd $(mktemp -d) + [nix-shell]$ unpackPhase + ``` - ```ShellSession - $ nix-env -f "" -iA ncurses - $ export NIX_CFLAGS_LINK=-lncurses - $ make menuconfig ARCH=arch - ``` + 3. For each supported platform (`i686`, `x86_64`, `uml`) do the following: - 5. Copy `.config` over the new config file (e.g., `config-2.6.22-i686-smp`). + 1. Make a 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`). + + 2. Copy the config file for this platform (e.g., `config-2.6.22-i686-smp`) to `.config` in the unpacked kernel source tree. + + 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`). + + 4. If needed, you can also run `make menuconfig`: + + ```ShellSession + $ nix-shell -p ncurses pkg-config + $ make menuconfig ARCH=arch + ``` + + 5. Copy `.config` over the new config file (e.g., `config-2.6.22-i686-smp`). 4. Test building the kernel: