system: Add 'kernel-arguments' field.

* gnu/system.scm (<operating-system>)[kernel-arguments]: New field.
  (operating-system-grub.cfg): Honor it.
  (operating-system-parameters-file): Add 'kernel-arguments' to the parameters
  file.
* guix/scripts/system.scm (previous-grub-entries)[system->grub-entry]: Read
  the 'kernel-arguments' field of the parameters file, when available.
* gnu/system/vm.scm (system-qemu-image/shared-store-script):
  Use (operating-system-kernel-arguments os) in '-append'.
* doc/guix.texi (operating-system Reference): Document it.
This commit is contained in:
Ludovic Courtès 2015-07-17 01:07:50 +02:00
parent 2378df558a
commit ee2a6304f3
4 changed files with 24 additions and 10 deletions

View File

@ -4825,6 +4825,10 @@ The package object of the operating system kernel to use@footnote{Currently
only the Linux-libre kernel is supported. In the future, it will be only the Linux-libre kernel is supported. In the future, it will be
possible to use the GNU@tie{}Hurd.}. possible to use the GNU@tie{}Hurd.}.
@item @code{kernel-arguments} (default: @code{'()})
List of strings or gexps representing additional arguments to pass on
the kernel's command-line---e.g., @code{("console=ttyS0")}.
@item @code{bootloader} @item @code{bootloader}
The system bootloader configuration object. @xref{GRUB Configuration}. The system bootloader configuration object. @xref{GRUB Configuration}.

View File

@ -68,6 +68,7 @@
operating-system-host-name operating-system-host-name
operating-system-hosts-file operating-system-hosts-file
operating-system-kernel operating-system-kernel
operating-system-kernel-arguments
operating-system-initrd operating-system-initrd
operating-system-users operating-system-users
operating-system-groups operating-system-groups
@ -103,6 +104,8 @@
operating-system? operating-system?
(kernel operating-system-kernel ; package (kernel operating-system-kernel ; package
(default linux-libre)) (default linux-libre))
(kernel-arguments operating-system-kernel-arguments
(default '())) ; list of gexps/strings
(bootloader operating-system-bootloader) ; <grub-configuration> (bootloader operating-system-bootloader) ; <grub-configuration>
(initrd operating-system-initrd ; (list fs) -> M derivation (initrd operating-system-initrd ; (list fs) -> M derivation
@ -866,11 +869,12 @@ listed in OS. The C library expects to find it under
(label (kernel->grub-label kernel)) (label (kernel->grub-label kernel))
(linux kernel) (linux kernel)
(linux-arguments (linux-arguments
(list (string-append "--root=" (cons* (string-append "--root="
(file-system-device root-fs)) (file-system-device root-fs))
#~(string-append "--system=" #$system) #~(string-append "--system=" #$system)
#~(string-append "--load=" #$system #~(string-append "--load=" #$system
"/boot"))) "/boot")
(operating-system-kernel-arguments os)))
(initrd #~(string-append #$system "/initrd")))))) (initrd #~(string-append #$system "/initrd"))))))
(grub-configuration-file (operating-system-bootloader os) entries (grub-configuration-file (operating-system-bootloader os) entries
#:old-entries old-entries))) #:old-entries old-entries)))
@ -887,6 +891,8 @@ this file is the reconstruction of GRUB menu entries for old configurations."
(label #$label) (label #$label)
(root-device #$(file-system-device root)) (root-device #$(file-system-device root))
(kernel #$(operating-system-kernel os)) (kernel #$(operating-system-kernel os))
(kernel-arguments
#$(operating-system-kernel-arguments os))
(initrd #$initrd))))) (initrd #$initrd)))))
(define (operating-system-derivation os) (define (operating-system-derivation os)

View File

@ -493,7 +493,8 @@ exec " #$qemu "/bin/" #$(qemu-command (%current-system))
#~(" -kernel " #$(operating-system-kernel os) "/bzImage \ #~(" -kernel " #$(operating-system-kernel os) "/bzImage \
-initrd " #$os-drv "/initrd \ -initrd " #$os-drv "/initrd \
-append \"" #$(if graphic? "" "console=ttyS0 ") -append \"" #$(if graphic? "" "console=ttyS0 ")
"--system=" #$os-drv " --load=" #$os-drv "/boot --root=/dev/vda1\" ")) "--system=" #$os-drv " --load=" #$os-drv "/boot --root=/dev/vda1 "
(string-join (list #+@(operating-system-kernel-arguments os))) "\" "))
#$(common-qemu-options image #$(common-qemu-options image
(map file-system-mapping-source (map file-system-mapping-source
(cons %store-mapping mappings))) (cons %store-mapping mappings)))

View File

@ -249,16 +249,19 @@ it atomically, and then run OS's activation script."
(('boot-parameters ('version 0) (('boot-parameters ('version 0)
('label label) ('root-device root) ('label label) ('root-device root)
('kernel linux) ('kernel linux)
_ ...) rest ...)
(menu-entry (menu-entry
(label (string-append label " (#" (label (string-append label " (#"
(number->string number) ", " (number->string number) ", "
(seconds->string time) ")")) (seconds->string time) ")"))
(linux linux) (linux linux)
(linux-arguments (linux-arguments
(list (string-append "--root=" root) (cons* (string-append "--root=" root)
#~(string-append "--system=" #$system) #~(string-append "--system=" #$system)
#~(string-append "--load=" #$system "/boot"))) #~(string-append "--load=" #$system "/boot")
(match (assq 'kernel-arguments rest)
((_ args) args)
(#f '())))) ;old format
(initrd #~(string-append #$system "/initrd")))) (initrd #~(string-append #$system "/initrd"))))
(_ ;unsupported format (_ ;unsupported format
(warning (_ "unrecognized boot parameters for '~a'~%") (warning (_ "unrecognized boot parameters for '~a'~%")