unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH 1/2] system: Rename grub to bootloader.
@ 2017-01-10 18:42 David Craven
  2017-01-10 18:42 ` [PATCH 2/2] scripts: system: Rename --no-grub option to --no-bootloader David Craven
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: David Craven @ 2017-01-10 18:42 UTC (permalink / raw)
  To: guix-devel

* gnu/system.scm (operating-system-bootloader-configuration-file,
  kernel->bootloader-label, bootloader-device): Rename variables.
* guix/scripts/system.scm (install-bootloader*,
  profile-bootloader-entries, system->bootloader-entry): Rename
  variables.
  (install, perform-action, %default-options): Adjust accordingly.
* gnu/system/vm.scm (qemu-image, system-disk-image, system-qemu-image,
  system-qemu-image/shared-store): Rename variables and update
  docstrings to be bootloader agnostic.
---
 gnu/system.scm          |  40 ++++++-------
 gnu/system/vm.scm       |  30 +++++-----
 guix/scripts/system.scm | 156 ++++++++++++++++++++++++------------------------
 3 files changed, 115 insertions(+), 111 deletions(-)

diff --git a/gnu/system.scm b/gnu/system.scm
index 4e57f975e..9c1239e0b 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -92,7 +92,7 @@
 
             operating-system-derivation
             operating-system-profile
-            operating-system-grub.cfg
+            operating-system-bootcfg
             operating-system-etc-directory
             operating-system-locale-directory
             operating-system-boot-script
@@ -698,8 +698,8 @@ listed in OS.  The C library expects to find it under
   (locale-directory definitions
                     #:libcs (operating-system-locale-libcs os)))
 
-(define (kernel->grub-label kernel)
-  "Return a label for the GRUB menu entry that boots KERNEL."
+(define (kernel->bootloader-label kernel)
+  "Return a label for a bootloader menu entry that boots KERNEL."
   (string-append "GNU with "
                  (string-titlecase (package-name kernel)) " "
                  (package-version kernel)
@@ -726,14 +726,14 @@ listed in OS.  The C library expects to find it under
   "Return the file system that contains the store of OS."
   (store-file-system (operating-system-file-systems os)))
 
-(define* (operating-system-grub.cfg os #:optional (old-entries '()))
-  "Return the GRUB configuration file for OS.  Use OLD-ENTRIES to populate the
-\"old entries\" menu."
+(define* (operating-system-bootcfg os #:optional (old-entries '()))
+  "Return the bootloader configuration file for OS.  Use OLD-ENTRIES to populate
+the \"old entries\" menu."
   (mlet* %store-monad
       ((system      (operating-system-derivation os))
        (root-fs ->  (operating-system-root-file-system os))
        (store-fs -> (operating-system-store-file-system os))
-       (label ->    (kernel->grub-label (operating-system-kernel os)))
+       (label ->    (kernel->bootloader-label (operating-system-kernel os)))
        (kernel ->   (operating-system-kernel-file os))
        (initrd      (operating-system-initrd-file os))
        (root-device -> (if (eq? 'uuid (file-system-title root-fs))
@@ -743,7 +743,7 @@ listed in OS.  The C library expects to find it under
                            (label label)
 
                            ;; The device where the kernel and initrd live.
-                           (device (grub-device store-fs))
+                           (device (bootloader-device store-fs))
                            (device-mount-point
                             (file-system-mount-point store-fs))
 
@@ -758,7 +758,7 @@ listed in OS.  The C library expects to find it under
     (grub-configuration-file (operating-system-bootloader os) entries
                              #:old-entries old-entries)))
 
-(define (grub-device fs)
+(define (bootloader-device fs)
   "Given FS, a <file-system> object, return a value suitable for use as the
 device in a <menu-entry>."
   (case (file-system-title fs)
@@ -768,11 +768,11 @@ device in a <menu-entry>."
 
 (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."
+this file is the reconstruction of bootloader 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
+                      (label -> (kernel->bootloader-label
                                  (operating-system-kernel os))))
     (gexp->file "parameters"
                 #~(boot-parameters
@@ -784,7 +784,7 @@ this file is the reconstruction of GRUB menu entries for old configurations."
                     #$(operating-system-kernel-arguments os))
                    (initrd #$initrd)
                    (store
-                    (device #$(grub-device store))
+                    (device #$(bootloader-device store))
                     (mount-point #$(file-system-mount-point store))))
                 #:set-load-path? #f)))
 
@@ -796,13 +796,13 @@ 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".
+  ;; Because the bootloader needs to use the 'store-device' it 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 a bootloader 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-mount-point boot-parameters-store-mount-point)
@@ -847,7 +847,7 @@ this file is the reconstruction of GRUB menu entries for old configurations."
           device)
          (_                                       ;the old format
           ;; Root might be a device path like "/dev/sda1", which is not a
-          ;; suitable GRUB device identifier.
+          ;; suitable bootloader device identifier.
           (if (string-prefix? "/" root)
               #f
               root))))
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index 1e680b85a..dbc3a5649 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -175,7 +175,7 @@ made available under the /xchg CIFS share."
                      (file-system-type "ext4")
                      file-system-label
                      os-derivation
-                     grub-configuration
+                     bootloader-configuration
                      (register-closures? #t)
                      (inputs '())
                      copy-inputs?)
@@ -183,8 +183,9 @@ made available under the /xchg CIFS share."
 'qcow2' or 'raw'), with a root partition of type FILE-SYSTEM-TYPE.
 Optionally, FILE-SYSTEM-LABEL can be specified as the volume name for the root
 partition.  The returned image is a full disk image that runs OS-DERIVATION,
-with a GRUB installation that uses GRUB-CONFIGURATION as its configuration
-file (GRUB-CONFIGURATION must be the name of a file in the VM.)
+with a bootloader installation that uses BOOTLOADER-CONFIGURATION as its
+configuration file (BOOTLOADER-CONFIGURATION must be the name of a file in the
+VM.)
 
 INPUTS is a list of inputs (as for packages).  When COPY-INPUTS? is true, copy
 all of INPUTS into the image being built.  When REGISTER-CLOSURES? is true,
@@ -231,7 +232,8 @@ the image."
                                      (initializer initialize)))))
              (initialize-hard-disk "/dev/vda"
                                    #:partitions partitions
-                                   #:grub.cfg #$grub-configuration)
+                                   #:bootloader-configuration
+                                   #$bootloader-configuration)
              (reboot)))))
    #:system system
    #:make-disk-image? #t
@@ -283,10 +285,10 @@ to USB sticks meant to be read-only."
                                   file-systems-to-keep)))))
 
     (mlet* %store-monad ((os-drv   (operating-system-derivation os))
-                         (grub.cfg (operating-system-grub.cfg os)))
+                         (bootcfg (operating-system-bootcfg os)))
       (qemu-image #:name name
                   #:os-derivation os-drv
-                  #:grub-configuration grub.cfg
+                  #:bootloader-configuration bootcfg
                   #:disk-image-size disk-image-size
                   #:disk-image-format "raw"
                   #:file-system-type file-system-type
@@ -294,7 +296,7 @@ to USB sticks meant to be read-only."
                   #:copy-inputs? #t
                   #:register-closures? #t
                   #:inputs `(("system" ,os-drv)
-                             ("grub.cfg" ,grub.cfg))))))
+                             ("bootcfg" ,bootcfg))))))
 
 (define* (system-qemu-image os
                             #:key
@@ -327,13 +329,13 @@ of the GNU system as described by OS."
                                   file-systems-to-keep)))))
     (mlet* %store-monad
         ((os-drv      (operating-system-derivation os))
-         (grub.cfg    (operating-system-grub.cfg os)))
+         (bootcfg     (operating-system-bootcfg os)))
       (qemu-image  #:os-derivation os-drv
-                   #:grub-configuration grub.cfg
+                   #:bootloader-configuration bootcfg
                    #:disk-image-size disk-image-size
                    #:file-system-type file-system-type
                    #:inputs `(("system" ,os-drv)
-                              ("grub.cfg" ,grub.cfg))
+                              ("bootcfg" ,bootcfg))
                    #:copy-inputs? #t))))
 
 \f
@@ -414,16 +416,16 @@ When FULL-BOOT? is true, return an image that does a complete boot sequence,
 bootloaded included; thus, make a disk image that contains everything the
 bootloader refers to: OS kernel, initrd, bootloader data, etc."
   (mlet* %store-monad ((os-drv   (operating-system-derivation os))
-                       (grub.cfg (operating-system-grub.cfg os)))
+                       (bootcfg  (operating-system-bootcfg os)))
     ;; XXX: When FULL-BOOT? is true, we end up creating an image that contains
-    ;; GRUB.CFG and all its dependencies, including the output of OS-DRV.
+    ;; BOOTCFG and all its dependencies, including the output of OS-DRV.
     ;; This is more than needed (we only need the kernel, initrd, GRUB for its
     ;; font, and the background image), but it's hard to filter that.
     (qemu-image #:os-derivation os-drv
-                #:grub-configuration grub.cfg
+                #:bootloader-configuration bootcfg
                 #:disk-image-size disk-image-size
                 #:inputs (if full-boot?
-                             `(("grub.cfg" ,grub.cfg))
+                             `(("bootcfg" ,bootcfg))
                              '())
 
                 ;; XXX: Passing #t here is too slow, so let it off by default.
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 144a7fd37..274325ab3 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -123,7 +123,7 @@ TARGET, and register them."
               (map (cut copy-item <> target #:log-port log-port)
                    to-copy))))
 
-(define (install-grub* grub.cfg device target)
+(define (install-bootloader* bootcfg device target)
   "This is a variant of 'install-grub' with error handling, lifted in
 %STORE-MONAD"
   (let* ((gc-root      (string-append target %gc-roots-directory
@@ -133,26 +133,27 @@ TARGET, and register them."
          (make-symlink (lift2 switch-symlinks %store-monad))
          (rename       (lift2 rename-file %store-monad)))
     (mbegin %store-monad
-      ;; Prepare the symlink to GRUB.CFG to make sure that it's a GC root when
-      ;; 'install-grub' completes (being a bit paranoid.)
-      (make-symlink temp-gc-root grub.cfg)
+      ;; Prepare the symlink to BOOTCFG to make sure that
+      ;; it's a GC root when 'install-grub' completes (being a bit paranoid.)
+      (make-symlink temp-gc-root bootcfg)
 
-      (munless (false-if-exception (install-grub grub.cfg device target))
+      (munless (false-if-exception (install-grub bootcfg
+                                                 device target))
         (delete-file temp-gc-root)
-        (leave (_ "failed to install GRUB on device '~a'~%") device))
+        (leave (_ "failed to install bootloader on device '~a'~%") device))
 
-      ;; Register GRUB.CFG as a GC root so that its dependencies (background
+      ;; Register BOOTCFG as a GC root so that its dependencies (background
       ;; image, font, etc.) are not reclaimed.
       (rename temp-gc-root gc-root))))
 
 (define* (install os-drv target
                   #:key (log-port (current-output-port))
-                  grub? grub.cfg device)
-  "Copy the closure of GRUB.CFG, which includes the output of OS-DRV, to
-directory TARGET.  TARGET must be an absolute directory name since that's what
-'guix-register' expects.
+                  bootloader? bootcfg device)
+  "Copy the closure of BOOTCFG, which includes the output
+of OS-DRV, to directory TARGET.  TARGET must be an absolute directory name since
+that's what 'guix-register' expects.
 
-When GRUB? is true, install GRUB on DEVICE, using GRUB.CFG."
+When BOOTLOADER? is true, install bootloader on DEVICE, using BOOTCFG."
   (define (maybe-copy to-copy)
     (with-monad %store-monad
       (if (string=? target "/")
@@ -181,16 +182,16 @@ the ownership of '~a' may be incorrect!~%")
         (populate (lift2 populate-root-file-system %store-monad)))
 
     (mbegin %store-monad
-      ;; Copy the closure of GRUB.CFG, which includes OS-DIR, GRUB's
-      ;; background image and so on.
-      (maybe-copy grub.cfg)
+      ;; Copy the closure of BOOTCFG, which includes OS-DIR, and the
+      ;; bootloader's background image and so on.
+      (maybe-copy bootcfg)
 
       ;; Create a bunch of additional files.
       (format log-port "populating '~a'...~%" target)
       (populate os-dir target)
 
-      (mwhen grub?
-        (install-grub* grub.cfg device target)))))
+      (mwhen bootloader?
+        (install-bootloader* bootcfg device target)))))
 
 \f
 ;;;
@@ -362,11 +363,11 @@ it atomically, and then run OS's activation script."
     (date->string (time-utc->date time)
                   "~Y-~m-~d ~H:~M")))
 
-(define* (profile-grub-entries #:optional (profile %system-profile)
+(define* (profile-bootloader-entries #:optional (profile %system-profile)
                                   (numbers (generation-numbers profile)))
   "Return a list of 'menu-entry' for the generations of PROFILE specified by
 NUMBERS, which is a list of generation numbers."
-  (define (system->grub-entry system number time)
+  (define (system->bootloader-entry system number time)
     (unless-file-not-found
      (let* ((file             (string-append system "/parameters"))
             (params           (call-with-input-file file
@@ -399,7 +400,7 @@ NUMBERS, which is a list of generation numbers."
                          (unless-file-not-found
                           (stat:mtime (lstat system))))
                        systems)))
-    (filter-map system->grub-entry systems numbers times)))
+    (filter-map system->bootloader-entry systems numbers times)))
 
 \f
 ;;;
@@ -415,18 +416,19 @@ connection to the store."
 ;;;
 (define (switch-to-system-generation store spec)
   "Switch the system profile to the generation specified by SPEC, and
-re-install grub with a grub configuration file that uses the specified system
-generation as its default entry.  STORE is an open connection to the store."
+re-install bootloader with a bootloader configuration file that uses the
+specified system generation as its default entry.  STORE is an open connection
+to the store."
   (let ((number (relative-generation-spec->number %system-profile spec)))
     (if number
         (begin
-          (reinstall-grub store number)
+          (reinstall-bootloader store number)
           (switch-to-generation* %system-profile number))
         (leave (_ "cannot switch to system generation '~a'~%") spec))))
 
-(define (reinstall-grub store number)
-  "Re-install grub for existing system profile generation NUMBER.  STORE is an
-open connection to the store."
+(define (reinstall-bootloader store number)
+  "Re-install bootloader for existing system profile generation NUMBER.  STORE
+is an open connection to the store."
   (let* ((generation (generation-file-name %system-profile number))
          (file (string-append generation "/parameters"))
          (params (unless-file-not-found
@@ -435,29 +437,29 @@ open connection to the store."
          ;; We don't currently keep track of past menu entries' details.  The
          ;; default values will allow the system to boot, even if they differ
          ;; from the actual past values for this generation's entry.
-         (grub-config (grub-configuration (device root-device)))
+         (bootloader-config (grub-configuration (device root-device)))
          ;; Make the specified system generation the default entry.
-         (entries (profile-grub-entries %system-profile (list number)))
+         (entries (profile-bootloader-entries %system-profile (list number)))
          (old-generations (delv number (generation-numbers %system-profile)))
-         (old-entries (profile-grub-entries %system-profile old-generations))
-         (grub.cfg (run-with-store store
-                     (grub-configuration-file grub-config
-                                              entries
-                                              #:old-entries old-entries))))
-    (show-what-to-build store (list grub.cfg))
-    (build-derivations store (list grub.cfg))
+         (old-entries (profile-bootloader-entries %system-profile old-generations))
+         (bootcfg (run-with-store store
+                    (grub-configuration-file bootloader-config
+                                             entries
+                                             #:old-entries old-entries))))
+    (show-what-to-build store (list bootcfg))
+    (build-derivations store (list bootcfg))
     ;; This is basically the same as install-grub*, but for now we avoid
-    ;; re-installing the GRUB boot loader itself onto a device, mainly because
-    ;; we don't in general have access to the same version of the GRUB package
-    ;; which was used when installing this other system generation.
-    (let* ((grub.cfg-path (derivation->output-path grub.cfg))
+    ;; re-installing the boot loader itself onto a device, mainly because we
+    ;; don't in general have access to the same version of the bootloader
+    ;; package which was used when installing this other system generation.
+    (let* ((bootcfg-path (derivation->output-path bootcfg))
            (gc-root (string-append %gc-roots-directory "/grub.cfg"))
            (temp-gc-root (string-append gc-root ".new")))
-      (switch-symlinks temp-gc-root grub.cfg-path)
-      (unless (false-if-exception (install-grub-config grub.cfg-path "/"))
+      (switch-symlinks temp-gc-root bootcfg-path)
+      (unless (false-if-exception (install-grub-config bootcfg-path "/"))
         (delete-file temp-gc-root)
-        (leave (_ "failed to re-install GRUB configuration file: '~a'~%")
-               grub.cfg-path))
+        (leave (_ "failed to re-install bootloader configuration file: '~a'~%")
+               bootcfg-path))
       (rename-file temp-gc-root gc-root))))
 
 \f
@@ -590,15 +592,15 @@ PATTERN, a string.  When PATTERN is #f, display all the system generations."
     (warning (_ "Failing to do that may downgrade your system!~%"))))
 
 (define* (perform-action action os
-                         #:key grub? dry-run? derivations-only?
+                         #:key bootloader? dry-run? derivations-only?
                          use-substitutes? device target
                          image-size full-boot?
                          (mappings '()))
-  "Perform ACTION for OS.  GRUB? specifies whether to install GRUB; DEVICE is
-the target devices for GRUB; TARGET is the target root directory; IMAGE-SIZE
-is the size of the image to be built, for the 'vm-image' and 'disk-image'
-actions.  FULL-BOOT? is used for the 'vm' action; it determines whether to
-boot directly to the kernel or to the bootloader.
+  "Perform ACTION for OS.  BOOTLOADER? specifies whether to install a
+bootloader; DEVICE is the target device the bootloader is installed on; TARGET
+is the target root directory; IMAGE-SIZE is the size of the image to be built,
+for the 'vm-image' and 'disk-image' actions.  FULL-BOOT? is used for the 'vm'
+action; it determines whether to boot directly to the kernel or to the bootloader.
 
 When DERIVATIONS-ONLY? is true, print the derivation file name(s) without
 building anything."
@@ -613,22 +615,22 @@ building anything."
                                                 #:image-size image-size
                                                 #:full-boot? full-boot?
                                                 #:mappings mappings))
-       (grub      (package->derivation (grub-configuration-grub
-                                        (operating-system-bootloader os))))
-       (grub.cfg  (if (eq? 'container action)
-                      (return #f)
-                      (operating-system-grub.cfg os
-                                                 (if (eq? 'init action)
-                                                     '()
-                                                     (profile-grub-entries)))))
-
-       ;; For 'init' and 'reconfigure', always build GRUB.CFG, even if
-       ;; --no-grub is passed, because GRUB.CFG because we then use it as a GC
-       ;; root.  See <http://bugs.gnu.org/21068>.
+       (bootloader (package->derivation (grub-configuration-grub
+                                         (operating-system-bootloader os))))
+       (bootcfg (if (eq? 'container action)
+                    (return #f)
+                    (operating-system-bootcfg os
+                                              (if (eq? 'init action)
+                                                  '()
+                                                  (profile-bootloader-entries)))))
+
+       ;; For 'init' and 'reconfigure', always build BOOTCFG,
+       ;; even if --no-bootloader is passed, because we use it as a GC root.
+       ;; See <http://bugs.gnu.org/21068>.
        (drvs   -> (if (memq action '(init reconfigure))
-                      (if grub?
-                          (list sys grub.cfg grub)
-                          (list sys grub.cfg))
+                      (if bootloader?
+                          (list sys bootcfg bootloader)
+                          (list sys bootcfg))
                       (list sys)))
        (%         (if derivations-only?
                       (return (for-each (compose println derivation-file-name)
@@ -642,9 +644,9 @@ building anything."
           (for-each (compose println derivation->output-path)
                     drvs)
 
-          ;; Make sure GRUB is accessible.
-          (when grub?
-            (let ((prefix (derivation->output-path grub)))
+          ;; Make sure BOOTLOADER is accessible.
+          (when bootloader?
+            (let ((prefix (derivation->output-path bootloader)))
               (setenv "PATH"
                       (string-append  prefix "/bin:" prefix "/sbin:"
                                       (getenv "PATH")))))
@@ -653,16 +655,16 @@ building anything."
             ((reconfigure)
              (mbegin %store-monad
                (switch-to-system os)
-               (mwhen grub?
-                 (install-grub* (derivation->output-path grub.cfg)
-                                device "/"))))
+               (mwhen bootloader?
+                 (install-bootloader* (derivation->output-path bootcfg)
+                                      device "/"))))
             ((init)
              (newline)
              (format #t (_ "initializing operating system under '~a'...~%")
                      target)
              (install sys (canonicalize-path target)
-                      #:grub? grub?
-                      #:grub.cfg (derivation->output-path grub.cfg)
+                      #:bootloader? bootloader?
+                      #:bootcfg (derivation->output-path bootcfg)
                       #:device device))
             (else
              ;; All we had to do was to build SYS.
@@ -774,7 +776,7 @@ Some ACTIONS support additional ARGS.\n"))
                                result)))
          (option '("no-grub") #f #f
                  (lambda (opt name arg result)
-                   (alist-cons 'install-grub? #f result)))
+                   (alist-cons 'install-bootloader? #f result)))
          (option '("full-boot") #f #f
                  (lambda (opt name arg result)
                    (alist-cons 'full-boot? #t result)))
@@ -808,7 +810,7 @@ Some ACTIONS support additional ARGS.\n"))
     (max-silent-time . 3600)
     (verbosity . 0)
     (image-size . ,(* 900 (expt 2 20)))
-    (install-grub? . #t)))
+    (install-bootloader? . #t)))
 
 \f
 ;;;
@@ -830,11 +832,11 @@ resulting from command-line parsing."
                        (leave (_ "no configuration file specified~%"))))
 
          (dry?     (assoc-ref opts 'dry-run?))
-         (grub?    (assoc-ref opts 'install-grub?))
+         (bootloader? (assoc-ref opts 'install-bootloader?))
          (target   (match args
                      ((first second) second)
                      (_ #f)))
-         (device   (and grub?
+         (device   (and bootloader?
                         (grub-configuration-device
                          (operating-system-bootloader os)))))
 
@@ -862,7 +864,7 @@ resulting from command-line parsing."
                                                        m)
                                                       (_ #f))
                                                     opts)
-                             #:grub? grub?
+                             #:bootloader? bootloader?
                              #:target target #:device device))))
         #:system system))))
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/2] scripts: system: Rename --no-grub option to --no-bootloader.
  2017-01-10 18:42 [PATCH 1/2] system: Rename grub to bootloader David Craven
@ 2017-01-10 18:42 ` David Craven
  2017-01-10 23:10   ` Danny Milosavljevic
  2017-01-10 18:51 ` [PATCH 1/2] system: Rename grub to bootloader David Craven
  2017-01-10 23:01 ` Danny Milosavljevic
  2 siblings, 1 reply; 10+ messages in thread
From: David Craven @ 2017-01-10 18:42 UTC (permalink / raw)
  To: guix-devel

* guix/scripts/system.scm (%options, show-help): Adjust accordingly.
---
 guix/scripts/system.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 274325ab3..bb9e478d6 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -739,7 +739,7 @@ Some ACTIONS support additional ARGS.\n"))
   (display (_ "
       --image-size=SIZE  for 'vm-image', produce an image of SIZE"))
   (display (_ "
-      --no-grub          for 'init', do not install GRUB"))
+      --no-bootloader    for 'init', do not install a bootloader"))
   (display (_ "
       --share=SPEC       for 'vm', share host file system according to SPEC"))
   (display (_ "
@@ -774,7 +774,7 @@ Some ACTIONS support additional ARGS.\n"))
                  (lambda (opt name arg result)
                    (alist-cons 'image-size (size->number arg)
                                result)))
-         (option '("no-grub") #f #f
+         (option '("no-bootloader") #f #f
                  (lambda (opt name arg result)
                    (alist-cons 'install-bootloader? #f result)))
          (option '("full-boot") #f #f
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] system: Rename grub to bootloader.
  2017-01-10 18:42 [PATCH 1/2] system: Rename grub to bootloader David Craven
  2017-01-10 18:42 ` [PATCH 2/2] scripts: system: Rename --no-grub option to --no-bootloader David Craven
@ 2017-01-10 18:51 ` David Craven
  2017-01-12 14:14   ` Ludovic Courtès
  2017-01-10 23:01 ` Danny Milosavljevic
  2 siblings, 1 reply; 10+ messages in thread
From: David Craven @ 2017-01-10 18:51 UTC (permalink / raw)
  To: guix-devel

These three files should be bootloader agnostic. This doesn't make
them that yet, but it is a first step in that direction.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] system: Rename grub to bootloader.
  2017-01-10 18:42 [PATCH 1/2] system: Rename grub to bootloader David Craven
  2017-01-10 18:42 ` [PATCH 2/2] scripts: system: Rename --no-grub option to --no-bootloader David Craven
  2017-01-10 18:51 ` [PATCH 1/2] system: Rename grub to bootloader David Craven
@ 2017-01-10 23:01 ` Danny Milosavljevic
  2 siblings, 0 replies; 10+ messages in thread
From: Danny Milosavljevic @ 2017-01-10 23:01 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel

Hi David,

LTGM!

Thanks for taking care of this.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] scripts: system: Rename --no-grub option to --no-bootloader.
  2017-01-10 18:42 ` [PATCH 2/2] scripts: system: Rename --no-grub option to --no-bootloader David Craven
@ 2017-01-10 23:10   ` Danny Milosavljevic
  2017-01-11  8:23     ` David Craven
  0 siblings, 1 reply; 10+ messages in thread
From: Danny Milosavljevic @ 2017-01-10 23:10 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel

LGTM.

P.S.

I think it would be nice if we extended it to install a bootloader iff there is a package specified in the operating-system configuration:

This wouldn't install a bootloader:

  (operating-system ...
    (bootloader (grub-configuration (device "/dev/sda")))

But this would install a bootloader:

  (operating-system ...
    (bootloader (grub-configuration (device "/dev/sda")
                                    (package grub)))

The advantages are:
- If the user doesn't specify to overwrite the bootloader it doesn't overwrite the bootloader (ever - no more forgetting to pass --no-grub)
- The user has to specify either grub, grub-efi or u-boot - and if he doesn't, it doesn't install a random one - it installs none (and keeps the installed one - it would update for example the grub config file, though).

The disadvantages are:
- Config file not backwards compatible
- Installing from scratch without any bootloader is harder - docs should mention it

What do you think?

That said, your patch series is OK as is!

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] scripts: system: Rename --no-grub option to --no-bootloader.
  2017-01-10 23:10   ` Danny Milosavljevic
@ 2017-01-11  8:23     ` David Craven
  0 siblings, 0 replies; 10+ messages in thread
From: David Craven @ 2017-01-11  8:23 UTC (permalink / raw)
  To: Danny Milosavljevic, Ludovic Courtès; +Cc: guix-devel

> What do you think?

I want to clearly separate the bootloader configuration file stuff
from the bootloader stuff. I think that we shouldn't have to even
specify a bootloader tag at all (it defaults to #f).

We can have a default bootloader entry printer that just prints all
the important information for making it a gc root and that would be
the default for qemu when we are not using full-boot?

Then we can have a bootloader entry printer for grub.cfg and
extlinux.conf and a default that does the absolute minimum.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] system: Rename grub to bootloader.
  2017-01-10 18:51 ` [PATCH 1/2] system: Rename grub to bootloader David Craven
@ 2017-01-12 14:14   ` Ludovic Courtès
  2017-01-12 14:45     ` David Craven
  2017-01-13  6:06     ` Chris Marusich
  0 siblings, 2 replies; 10+ messages in thread
From: Ludovic Courtès @ 2017-01-12 14:14 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel

Hi!

David Craven <david@craven.ch> skribis:

> These three files should be bootloader agnostic. This doesn't make
> them that yet, but it is a first step in that direction.

I’d rather consider these patches it as part of a series that actually
adds support for another bootloader (especially since it changes the
API).

How does that sound?

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] system: Rename grub to bootloader.
  2017-01-12 14:14   ` Ludovic Courtès
@ 2017-01-12 14:45     ` David Craven
  2017-01-14 17:40       ` Ludovic Courtès
  2017-01-13  6:06     ` Chris Marusich
  1 sibling, 1 reply; 10+ messages in thread
From: David Craven @ 2017-01-12 14:45 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

I agree on this patch. The renaming is not very good and breaks
things. It needs to be done in smaller steps. The one that renames the
flag could be done dough, since that doesn't break anything and
changes the cli interface. The sooner we can do that the better IMO,
because it is a user facing change.

I need to study for my exams the next week or two, but my current
thinking on the next steps to accomplish the goal of being bootloader
agnostic are:

1. discard <menu-entry> in gnu/system/grub in favor of
<boot-parameters> from gnu/system - small api changes

2. focus on the code in gnu/system/vm.scm and gnu/build/vm.scm. A lot
of decisions are being made about the qemu package, the qemu flags,
the file-system, the bootloader, the architecture and the kernel etc.
that should be moved elsewhere. - will affect guix/scripts/system and
probably the system tests infrastructure, the existing api should be
kept to avoid breakage in those parts.

Currently using a different bootloader affects far to many parts of
the codebase.

Do you think that (in general) adding new code to gnu/build is still a
valid design choice or do you consider it a better idea to turn most
of the code from gnu/build incrementally into gexps in gnu/system?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] system: Rename grub to bootloader.
  2017-01-12 14:14   ` Ludovic Courtès
  2017-01-12 14:45     ` David Craven
@ 2017-01-13  6:06     ` Chris Marusich
  1 sibling, 0 replies; 10+ messages in thread
From: Chris Marusich @ 2017-01-13  6:06 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 783 bytes --]

ludo@gnu.org (Ludovic Courtès) writes:

> Hi!
>
> David Craven <david@craven.ch> skribis:
>
>> These three files should be bootloader agnostic. This doesn't make
>> them that yet, but it is a first step in that direction.
>
> I’d rather consider these patches it as part of a series that actually
> adds support for another bootloader (especially since it changes the
> API).
>
> How does that sound?
>
> Thanks,
> Ludo’.

Just wanted to chime in here.  Modifying/refactoring code is sometimes
easier when you do it with a specific goal in mind, so I like Ludo's
suggestion to do this as part of a series that actually adds support for
another bootloader.  Doing it that way will probably make it easier to
see what needs to change and how.

-- 
Chris

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] system: Rename grub to bootloader.
  2017-01-12 14:45     ` David Craven
@ 2017-01-14 17:40       ` Ludovic Courtès
  0 siblings, 0 replies; 10+ messages in thread
From: Ludovic Courtès @ 2017-01-14 17:40 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel

David Craven <david@craven.ch> skribis:

> I need to study for my exams the next week or two, but my current
> thinking on the next steps to accomplish the goal of being bootloader
> agnostic are:
>
> 1. discard <menu-entry> in gnu/system/grub in favor of
> <boot-parameters> from gnu/system - small api changes

Not sure what you mean.  <boot-parameters> is an internal things,
whereas <menu-entry> is what users manipulate.

> 2. focus on the code in gnu/system/vm.scm and gnu/build/vm.scm. A lot
> of decisions are being made about the qemu package, the qemu flags,
> the file-system, the bootloader, the architecture and the kernel etc.
> that should be moved elsewhere. - will affect guix/scripts/system and
> probably the system tests infrastructure, the existing api should be
> kept to avoid breakage in those parts.

Agreed.

Ludo’.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-01-14 17:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-10 18:42 [PATCH 1/2] system: Rename grub to bootloader David Craven
2017-01-10 18:42 ` [PATCH 2/2] scripts: system: Rename --no-grub option to --no-bootloader David Craven
2017-01-10 23:10   ` Danny Milosavljevic
2017-01-11  8:23     ` David Craven
2017-01-10 18:51 ` [PATCH 1/2] system: Rename grub to bootloader David Craven
2017-01-12 14:14   ` Ludovic Courtès
2017-01-12 14:45     ` David Craven
2017-01-14 17:40       ` Ludovic Courtès
2017-01-13  6:06     ` Chris Marusich
2017-01-10 23:01 ` Danny Milosavljevic

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).