From f0d157037792a8f695b173be7f3cfeb60f0a8e66 Mon Sep 17 00:00:00 2001 From: Michael Raskin <7c6f434c@mail.ru> Date: Sat, 23 Jun 2007 15:48:09 +0000 Subject: [PATCH] Added kernel selection parameter, boot.useKernel svn path=/nixos/trunk/; revision=8914 --- system/options.nix | 10 ++++++++++ system/system.nix | 14 +++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/system/options.nix b/system/options.nix index 5bbc1e99707..8c276ae24cf 100644 --- a/system/options.nix +++ b/system/options.nix @@ -55,6 +55,16 @@ "; } + { + name = ["boot" "useKernel"]; + default = pkgs :(pkgs.kernel); + description = " + Function that takes package collection and returns kernel + package. Do not collect old generations after changing it + until you get to boot successfully. In principle, you can + specify a kernel that will build, but not boot. + "; + } { name = ["boot" "kernelParams"]; diff --git a/system/system.nix b/system/system.nix index e1371d68f4a..75630e44777 100644 --- a/system/system.nix +++ b/system/system.nix @@ -29,6 +29,7 @@ rec { nix = pkgs.nixUnstable; # we need the exportReferencesGraph feature + useKernel = (config.get ["boot" "useKernel"]) pkgs; rootModules = (config.get ["boot" "initrd" "extraKernelModules"]) ++ @@ -37,7 +38,8 @@ rec { # Determine the set of modules that we need to mount the root FS. modulesClosure = import ../helpers/modules-closure.nix { - inherit (pkgs) stdenv kernel module_init_tools; + inherit (pkgs) stdenv module_init_tools; + kernel = useKernel; inherit rootModules; }; @@ -136,7 +138,8 @@ rec { dir = "sbin"; src = ./modprobe; isExecutable = true; - inherit (pkgs) kernel module_init_tools; + inherit (pkgs) module_init_tools; + kernel = useKernel; }; @@ -242,7 +245,7 @@ rec { isExecutable = true; inherit etc wrapperDir systemPath modprobe defaultShell; - inherit (pkgs) kernel; + kernel = useKernel; readOnlyRoot = config.get ["boot" "readOnlyRoot"]; hostName = config.get ["networking" "hostName"]; setuidPrograms = @@ -267,7 +270,8 @@ rec { # everything else to bring up the system. bootStage2 = import ../boot/boot-stage-2.nix { inherit (pkgs) substituteAll writeText coreutils - utillinux kernel udev upstart; + utillinux udev upstart; + kernel = useKernel; inherit activateConfiguration; readOnlyRoot = config.get ["boot" "readOnlyRoot"]; upstartPath = [ @@ -312,7 +316,7 @@ rec { inherit grubMenuBuilder; inherit etc; inherit systemPath; - kernel = pkgs.kernel + "/vmlinuz"; + kernel = useKernel + "/vmlinuz"; initrd = initialRamdisk + "/initrd"; # Most of these are needed by grub-install. path = [