summary refs log tree commit diff
path: root/gnu/build/vm.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/build/vm.scm')
-rw-r--r--gnu/build/vm.scm9
1 files changed, 9 insertions, 0 deletions
diff --git a/gnu/build/vm.scm b/gnu/build/vm.scm
index 03db1cd5f9..2c53cf5dd9 100644
--- a/gnu/build/vm.scm
+++ b/gnu/build/vm.scm
@@ -178,6 +178,12 @@ volume name."
   (display "populating...\n")
   (populate-root-file-system system-directory target-directory))
 
+(define (register-grub.cfg-root target grub.cfg)
+  "On file system TARGET, register GRUB.CFG as a GC root."
+  (let ((directory (string-append target "/var/guix/gcroots")))
+    (mkdir-p directory)
+    (symlink grub.cfg (string-append directory "/grub.cfg"))))
+
 (define* (initialize-hard-disk device
                                #:key
                                system-directory
@@ -222,6 +228,9 @@ SYSTEM-DIRECTORY is the name of the directory of the 'system' derivation."
 
   (install-grub grub.cfg device target-directory)
 
+  ;; Register GRUB.CFG as a GC root.
+  (register-grub.cfg-root target-directory grub.cfg)
+
   ;; 'guix-register' resets timestamps and everything, so no need to do it
   ;; once more in that case.
   (unless register-closures?