From dc27e80fadaa203be57538e0bc6aed18085c6f4f Mon Sep 17 00:00:00 2001 From: Michael Raskin <7c6f434c@mail.ru> Date: Mon, 24 Mar 2008 19:37:32 +0000 Subject: [PATCH] Changes to support swsusp and custom kernels. svn path=/nixos/trunk/; revision=11272 --- boot/boot-stage-1-init.sh | 2 +- boot/boot-stage-1.nix | 5 ++++- system/options.nix | 18 ++++++++++++++++++ system/system.nix | 2 ++ 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/boot/boot-stage-1-init.sh b/boot/boot-stage-1-init.sh index 92407d09743..8ed3887cc35 100644 --- a/boot/boot-stage-1-init.sh +++ b/boot/boot-stage-1-init.sh @@ -74,7 +74,7 @@ if test -e /sys/power/tuxonice/resume; then fi fi -echo 1 > /sys/power/resume || echo "Failed to resume..." +echo "@resumeDevice@" > /sys/power/resume || echo "Failed to resume..." echo shutdown > /sys/power/disk diff --git a/boot/boot-stage-1.nix b/boot/boot-stage-1.nix index a53b9d6c86b..6cd0e7f6a2a 100644 --- a/boot/boot-stage-1.nix +++ b/boot/boot-stage-1.nix @@ -30,6 +30,9 @@ , # The path of the stage 2 init to call once we've mounted the root # device. stage2Init ? "/init" + +, # Resume device. [major]:[minor] + resumeDevice ? "ignore-this" }: let @@ -48,7 +51,7 @@ substituteAll { src = ./boot-stage-1-init.sh; isExecutable = true; inherit staticShell modules modulesDir; - inherit autoDetectRootDevice isLiveCD mountPoints devices fsTypes optionss; + inherit autoDetectRootDevice isLiveCD mountPoints devices fsTypes optionss resumeDevice; rootLabel = if autoDetectRootDevice then rootLabel else ""; path = [ staticTools diff --git a/system/options.nix b/system/options.nix index 0d4d9e01257..3f5605862fb 100644 --- a/system/options.nix +++ b/system/options.nix @@ -66,6 +66,15 @@ "; }; + resumeDevice = mkOption { + default = ""; + example = "0:0"; + description = " + Device for manual resume attempt during boot. Looks like + major:minor . + "; + }; + kernel = mkOption { default = pkgs: pkgs.kernel; description = " @@ -198,6 +207,15 @@ "; }; + allowMissing = mkOption { + default = false; + description = '' + Allow some initrd components to be missing. Useful for + custom kernel that are changed too often to track needed + kernelModules. + ''; + }; + lvm = mkOption { default = false; description = " diff --git a/system/system.nix b/system/system.nix index 6f3ed231671..45175ff5701 100644 --- a/system/system.nix +++ b/system/system.nix @@ -44,6 +44,7 @@ rec { modulesClosure = pkgs.makeModulesClosure { inherit rootModules; kernel = modulesTree; + allowMissing = config.boot.initrd.allowMissing; }; @@ -89,6 +90,7 @@ rec { modules = rootModules; staticShell = stdenvLinuxStuff.bootstrapTools.bash; staticTools = stdenvLinuxStuff.staticTools; + resumeDevice = config.boot.resumeDevice; };