linux-initrd: Adjust VM code and doc to new 'base-initrd' signature.

This fixes regressions introduced in de1c158 ("system: Add support for
boot-time mapped devices.").

* doc/guix.texi (Initial RAM Disk): Adjust example with custom use of
  'base-initrd'.  Document #:mapped-devices parameter of 'base-initrd'.
* gnu/system/vm.scm (system-disk-image, system-qemu-image,
  virtualized-operating-system): Adjust call to 'base-initrd' to new
  signature.
This commit is contained in:
Ludovic Courtès 2014-09-22 21:29:41 +02:00
parent 8591fae4cf
commit 52ac153e2a
2 changed files with 26 additions and 19 deletions

View File

@ -3649,23 +3649,24 @@ at boot time, you can define the @code{initrd} field of the operating
system declaration like this: system declaration like this:
@example @example
(initrd (cut base-initrd <> (initrd (lambda (file-systems . rest)
#:extra-modules '("my.ko" "modules.ko"))) (apply base-initrd file-systems
#:extra-modules '("my.ko" "modules.ko")
rest)))
@end example @end example
@noindent The @code{base-initrd} procedure also handles common use cases that
Note that for the example above, the SRFI-26 module needs to be imported involves using the system as a QEMU guest, or as a ``live'' system whose
(@pxref{SRFI-26,,, guile, GNU Guile Reference Manual}). root file system is volatile.
It also handles common use cases that involves using the system as a
QEMU guest, or as a ``live'' system whose root file system is volatile.
@deffn {Monadic Procedure} base-initrd @var{file-systems} @ @deffn {Monadic Procedure} base-initrd @var{file-systems} @
[#:qemu-networking? #f] [#:virtio? #f] [#:volatile-root? #f] @ [#:qemu-networking? #f] [#:virtio? #f] [#:volatile-root? #f] @
[#:extra-modules '()] [#:extra-modules '()] [#:mapped-devices '()]
Return a monadic derivation that builds a generic initrd. @var{file-systems} is Return a monadic derivation that builds a generic initrd. @var{file-systems} is
a list of file-systems to be mounted by the initrd, possibly in addition to a list of file-systems to be mounted by the initrd, possibly in addition to
the root file system specified on the kernel command line via @code{--root}. the root file system specified on the kernel command line via @code{--root}.
@var{mapped-devices} is a list of device mappings to realize before
@var{file-systems} are mounted (@pxref{Mapped Devices}).
When @var{qemu-networking?} is true, set up networking with the standard QEMU When @var{qemu-networking?} is true, set up networking with the standard QEMU
parameters. When @var{virtio?} is true, load additional modules so the initrd can parameters. When @var{virtio?} is true, load additional modules so the initrd can

View File

@ -289,9 +289,11 @@ to USB sticks meant to be read-only."
;; Since this is meant to be used on real hardware, don't ;; Since this is meant to be used on real hardware, don't
;; install QEMU networking or anything like that, but make sure ;; install QEMU networking or anything like that, but make sure
;; USB mass storage devices are available. ;; USB mass storage devices are available.
(initrd (cut base-initrd <> (initrd (lambda (file-systems . rest)
#:volatile-root? #t (apply base-initrd file-systems
#:extra-modules '("usb-storage.ko"))) #:volatile-root? #t
#:extra-modules '("usb-storage.ko")
rest)))
;; Force our own root file system. ;; Force our own root file system.
(file-systems (cons (file-system (file-systems (cons (file-system
@ -333,9 +335,11 @@ of the GNU system as described by OS."
(let ((os (operating-system (inherit os) (let ((os (operating-system (inherit os)
;; Use an initrd with the whole QEMU shebang. ;; Use an initrd with the whole QEMU shebang.
(initrd (cut base-initrd <> (initrd (lambda (file-systems . rest)
#:virtio? #t (apply base-initrd file-systems
#:qemu-networking? #t)) #:virtio? #t
#:qemu-networking? #t
rest)))
;; Force our own root file system. ;; Force our own root file system.
(file-systems (cons (file-system (file-systems (cons (file-system
@ -358,10 +362,12 @@ of the GNU system as described by OS."
"Return an operating system based on OS suitable for use in a virtualized "Return an operating system based on OS suitable for use in a virtualized
environment with the store shared with the host." environment with the store shared with the host."
(operating-system (inherit os) (operating-system (inherit os)
(initrd (cut base-initrd <> (initrd (lambda (file-systems . rest)
#:volatile-root? #t (apply base-initrd file-systems
#:virtio? #t #:volatile-root? #t
#:qemu-networking? #t)) #:virtio? #t
#:qemu-networking? #t
rest)))
(file-systems (cons* (file-system (file-systems (cons* (file-system
(mount-point "/") (mount-point "/")
(device "/dev/vda1") (device "/dev/vda1")