From: cmmarusich@gmail.com
To: guix-devel@gnu.org
Subject: [PATCH 01/10] * gnu/system.scm (<boot-parameters>): Add 'store-device' and 'store-fs-mount-point'.
Date: Fri, 28 Oct 2016 03:07:18 -0700 [thread overview]
Message-ID: <20161028100727.1182-2-cmmarusich@gmail.com> (raw)
In-Reply-To: <20161028100727.1182-1-cmmarusich@gmail.com>
From: Chris Marusich <cmmarusich@gmail.com>
In a future commit, we will restructure the grub.cfg generation logic to use
this information, to enable the implementation of 'guix system
switch-generation' and 'guix system roll-back'.
---
gnu/system.scm | 58 +++++++++++++++++++++++++++++++++++++++++++++++++---------
1 file changed, 49 insertions(+), 9 deletions(-)
diff --git a/gnu/system.scm b/gnu/system.scm
index 38ae8f1..ff84b63 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2015, 2016 Alex Kost <alezost@gmail.com>
+;;; Copyright © 2016 Chris Marusich <cmmarusich@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -99,6 +100,8 @@
boot-parameters?
boot-parameters-label
boot-parameters-root-device
+ boot-parameters-store-device
+ boot-parameters-store-fs-mount-point
boot-parameters-kernel
boot-parameters-kernel-arguments
boot-parameters-initrd
@@ -750,17 +753,25 @@ listed in OS. The C library expects to find it under
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))
+ (store -> (operating-system-store-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-file os))
- (kernel-arguments
- #$(operating-system-kernel-arguments os))
- (initrd #$initrd))
- #:set-load-path? #f)))
+ (gexp->file
+ "parameters"
+ #~(boot-parameters (version 1)
+ (label #$label)
+ (root-device #$(file-system-device root))
+ (store-device
+ #$(case (file-system-title store)
+ ((uuid) (file-system-device store))
+ ((label) (file-system-device store))
+ (else #f)))
+ (store-fs-mount-point #$(file-system-mount-point store))
+ (kernel #$(operating-system-kernel-file os))
+ (kernel-arguments
+ #$(operating-system-kernel-arguments os))
+ (initrd #$initrd))
+ #:set-load-path? #f)))
\f
;;;
@@ -770,7 +781,16 @@ this file is the reconstruction of GRUB menu entries for old configurations."
(define-record-type* <boot-parameters>
boot-parameters make-boot-parameters boot-parameters?
(label boot-parameters-label)
+ ;; Because we will use the 'store-device' to create the GRUB search command,
+ ;; the 'store-device' has slightly different semantics than 'root-device'.
+ ;; The 'store-device' can be a file system uuid, a file system label, or #f,
+ ;; but it cannot be a device path such as "/dev/sda3", since GRUB would not
+ ;; understand that. The 'root-device', on the other hand, corresponds
+ ;; exactly to the device field of the <file-system> object representing the
+ ;; OS's root file system, so it might be a device path like "/dev/sda3".
(root-device boot-parameters-root-device)
+ (store-device boot-parameters-store-device)
+ (store-fs-mount-point boot-parameters-store-fs-mount-point)
(kernel boot-parameters-kernel)
(kernel-arguments boot-parameters-kernel-arguments)
(initrd boot-parameters-initrd))
@@ -786,6 +806,10 @@ this file is the reconstruction of GRUB menu entries for old configurations."
(boot-parameters
(label label)
(root-device root)
+ ;; For backwards compatibility, we assume the store device and the
+ ;; root device are the same.
+ (store-device root)
+ (store-fs-mount-point "/")
;; In the past, we would store the directory name of the kernel instead
;; of the absolute file name of its image. Detect that and correct it.
@@ -805,6 +829,22 @@ this file is the reconstruction of GRUB menu entries for old configurations."
(string-append directory file))
(('initrd (? string? file))
file)))))
+ (('boot-parameters ('version 1)
+ ('label label)
+ ('root-device root)
+ ('store-device store)
+ ('store-fs-mount-point store-fs-mount-point)
+ ('kernel linux)
+ ('kernel-arguments arguments)
+ ('initrd initrd))
+ (boot-parameters
+ (label label)
+ (root-device root)
+ (store-device store)
+ (store-fs-mount-point store-fs-mount-point)
+ (kernel linux)
+ (kernel-arguments arguments)
+ (initrd initrd)))
(x ;unsupported format
(warning (_ "unrecognized boot parameters for '~a'~%")
system)
--
2.9.2
next prev parent reply other threads:[~2016-10-28 10:07 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-28 10:07 Add system roll-back and switch-generation commands cmmarusich
2016-10-28 10:07 ` cmmarusich [this message]
2016-10-30 0:12 ` [PATCH 01/10] * gnu/system.scm (<boot-parameters>): Add 'store-device' and 'store-fs-mount-point' Ludovic Courtès
2016-10-30 9:41 ` Chris Marusich
2016-10-30 22:19 ` Ludovic Courtès
2016-11-02 5:48 ` Follow-up: Add system roll-back and switch-generation commands cmmarusich
2016-11-02 5:48 ` [PATCH 1/5] profiles: Extract a procedure for getting relative generation numbers cmmarusich
2016-11-06 16:56 ` Ludovic Courtès
2016-11-02 5:48 ` [PATCH 2/5] system: Rename previous-grub-entries to profile-grub-entries cmmarusich
2016-11-06 16:56 ` Ludovic Courtès
2016-11-02 5:48 ` [PATCH 3/5] system: Optionally limit the entries returned by profile-grub-entries cmmarusich
2016-11-06 16:57 ` Ludovic Courtès
2016-11-02 5:48 ` [PATCH 4/5] install: Extract procedure: install-grub-config cmmarusich
2016-11-06 16:59 ` Ludovic Courtès
2016-11-06 21:00 ` Danny Milosavljevic
2016-11-07 1:25 ` Chris Marusich
2016-11-07 10:32 ` Danny Milosavljevic
2016-11-02 5:48 ` [PATCH 5/5] system: Add 'guix system' actions: switch-generation and roll-back cmmarusich
2016-11-03 4:51 ` One more patch: doc: Add details to the 'guix system switch-generation' section Chris Marusich
2016-11-06 17:13 ` [PATCH 5/5] system: Add 'guix system' actions: switch-generation and roll-back Ludovic Courtès
2016-11-07 3:17 ` Chris Marusich
2016-11-03 0:19 ` [PATCH 01/10] * gnu/system.scm (<boot-parameters>): Add 'store-device' and 'store-fs-mount-point' Leo Famulari
2016-11-03 4:36 ` Chris Marusich
2016-11-03 10:35 ` Chris Marusich
2016-11-03 22:34 ` Danny Milosavljevic
2016-11-04 3:34 ` Chris Marusich
2016-11-04 3:55 ` Chris Marusich
2016-11-03 13:10 ` Fix a boot problem reported by ng0 cmmarusich
2016-11-03 13:10 ` [PATCH] system: Avoid using device paths in <menu-entry> device field cmmarusich
2016-11-04 15:49 ` Leo Famulari
2016-11-06 16:51 ` Ludovic Courtès
2016-10-28 10:07 ` [PATCH 02/10] Add 'device' field to <menu-entry> cmmarusich
2016-10-28 10:07 ` [PATCH 03/10] Refactor grub.cfg generation logic cmmarusich
2016-10-28 10:07 ` [PATCH 04/10] Extract procedure: relative-generation-spec->number cmmarusich
2016-10-28 10:07 ` [PATCH 05/10] Rename previous-grub-entries to grub-entries cmmarusich
2016-10-28 10:07 ` [PATCH 06/10] grub-entries: take a list of numbers on input cmmarusich
2016-10-28 10:07 ` [PATCH 07/10] Factor out procedure: install-grub-config cmmarusich
2016-10-28 10:07 ` [PATCH 08/10] Implement switch-generation and roll-back cmmarusich
2016-10-28 10:07 ` [PATCH 09/10] Rename grub-entries to profile-grub-entries cmmarusich
2016-10-28 10:07 ` [PATCH 10/10] Mention new 'guix system' features in the manual cmmarusich
2016-10-29 21:13 ` Add system roll-back and switch-generation commands Ludovic Courtès
2016-10-29 21:22 ` Chris Marusich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161028100727.1182-2-cmmarusich@gmail.com \
--to=cmmarusich@gmail.com \
--cc=guix-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.