summary refs log tree commit diff
path: root/gnu/system.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-06-25 22:48:25 +0200
committerLudovic Courtès <ludo@gnu.org>2014-06-25 23:53:27 +0200
commit64e40dbb692d537e67d1dccd727dd5c36e39a10e (patch)
treeeebad4f29a0723908826d8307b670b2db714acff /gnu/system.scm
parent2d23e6f0515bc2e3a8a388cbe881ac372b162f9e (diff)
downloadguix-64e40dbb692d537e67d1dccd727dd5c36e39a10e.tar.gz
system: Store boot parameters in the system derivation.
* gnu/system.scm (operating-system-parameters-file): New procedure.
  (operating-system-derivation): Use it to produce a 'parameters' files.
Diffstat (limited to 'gnu/system.scm')
-rw-r--r--gnu/system.scm18
1 files changed, 17 insertions, 1 deletions
diff --git a/gnu/system.scm b/gnu/system.scm
index e1337da749..12d9f5fe02 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -511,6 +511,20 @@ we're running in the final root."
                            (initrd #~(string-append #$system "/initrd"))))))
     (grub-configuration-file (operating-system-bootloader os) entries)))
 
+(define (operating-system-parameters-file os)
+  "Return a file that describes the boot parameters of OS.  The primary use of
+this file is the reconstruction of GRUB menu entries for old configurations."
+  (mlet %store-monad ((initrd   (operating-system-initrd-file os))
+                      (root ->  (operating-system-root-file-system os))
+                      (label -> (kernel->grub-label
+                                 (operating-system-kernel os))))
+    (gexp->file "parameters"
+                #~(boot-parameters (version 0)
+                                   (label #$label)
+                                   (root-device #$(file-system-device root))
+                                   (kernel #$(operating-system-kernel os))
+                                   (initrd #$initrd)))))
+
 (define (operating-system-derivation os)
   "Return a derivation that builds OS."
   (mlet* %store-monad
@@ -518,10 +532,12 @@ we're running in the final root."
        (etc         (operating-system-etc-directory os))
        (boot        (operating-system-boot-script os))
        (kernel  ->  (operating-system-kernel os))
-       (initrd      (operating-system-initrd-file os)))
+       (initrd      (operating-system-initrd-file os))
+       (params      (operating-system-parameters-file os)))
     (file-union "system"
                 `(("boot" ,#~#$boot)
                   ("kernel" ,#~#$kernel)
+                  ("parameters" ,#~#$params)
                   ("initrd" ,initrd)
                   ("profile" ,#~#$profile)
                   ("etc" ,#~#$etc)))))