summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/guix.texi8
-rw-r--r--gnu/build/linux-boot.scm13
-rw-r--r--gnu/build/linux-initrd.scm7
-rw-r--r--gnu/system/linux-initrd.scm65
4 files changed, 41 insertions, 52 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 1e8a55e9a5..e3b0cf61f0 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -3616,16 +3616,14 @@ program to run in that initrd.
@deffn {Monadic Procedure} expression->initrd @var{exp} @
[#:guile %guile-static-stripped] [#:name "guile-initrd"] @
- [#:modules '()] [#:linux #f] @
- [#:linux-modules '()]
+ [#:modules '()]
Return a derivation that builds a Linux initrd (a gzipped cpio archive)
containing @var{guile} and that evaluates @var{exp}, a G-expression,
upon booting. All the derivations referenced by @var{exp} are
automatically copied to the initrd.
-@var{linux-modules} is a list of @file{.ko} file names to be copied from
-@var{linux} into the initrd. @var{modules} is a list of Guile module
-names to be embedded in the initrd.
+@var{modules} is a list of Guile module names to be embedded in the
+initrd.
@end deffn
@node Invoking guix system
diff --git a/gnu/build/linux-boot.scm b/gnu/build/linux-boot.scm
index 1312da6bbd..fbc683c798 100644
--- a/gnu/build/linux-boot.scm
+++ b/gnu/build/linux-boot.scm
@@ -343,10 +343,11 @@ bailing out.~%root contents: ~s~%" (scandir "/"))
volatile-root?
(mounts '()))
"This procedure is meant to be called from an initrd. Boot a system by
-first loading LINUX-MODULES, then setting up QEMU guest networking if
-QEMU-GUEST-NETWORKING? is true, mounting the file systems specified in MOUNTS,
-and finally booting into the new root if any. The initrd supports kernel
-command-line options '--load', '--root', and '--repl'.
+first loading LINUX-MODULES (a list of absolute file names of '.ko' files),
+then setting up QEMU guest networking if QEMU-GUEST-NETWORKING? is true,
+mounting the file systems specified in MOUNTS, and finally booting into the
+new root if any. The initrd supports kernel command-line options '--load',
+'--root', and '--repl'.
Mount the root file system, specified by the '--root' command-line argument,
if any.
@@ -384,9 +385,7 @@ to it are lost."
(start-repl))
(display "loading kernel modules...\n")
- (for-each (compose load-linux-module*
- (cut string-append "/modules/" <>))
- linux-modules)
+ (for-each load-linux-module* linux-modules)
(when qemu-guest-networking?
(unless (configure-qemu-networking)
diff --git a/gnu/build/linux-initrd.scm b/gnu/build/linux-initrd.scm
index 2c0acb200e..54639bd319 100644
--- a/gnu/build/linux-initrd.scm
+++ b/gnu/build/linux-initrd.scm
@@ -104,23 +104,18 @@ This is similar to what 'compiled-file-name' in (system base compile) does."
(define* (build-initrd output
#:key
guile init
- linux-module-directory
(references-graphs '())
(cpio "cpio")
(gzip "gzip"))
"Write an initial RAM disk (initrd) to OUTPUT. The initrd starts the script
at INIT, running GUILE. It contains all the items referred to by
-REFERENCES-GRAPHS, plus the Linux modules from LINUX-MODULE-DIRECTORY."
+REFERENCES-GRAPHS."
(mkdir "contents")
;; Copy the closures of all the items referenced in REFERENCES-GRAPHS.
(populate-store references-graphs "contents")
(with-directory-excursion "contents"
- ;; Copy Linux modules.
- (mkdir "modules")
- (copy-recursively linux-module-directory "modules")
-
;; Make '/init'.
(symlink init "init")
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index 03ac24d450..e83a9a5b23 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -34,6 +34,7 @@
#:use-module (ice-9 match)
#:use-module (ice-9 regex)
#:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26)
#:export (expression->initrd
base-initrd))
@@ -53,25 +54,19 @@
(gzip gzip)
(name "guile-initrd")
(system (%current-system))
- (modules '())
- (linux #f)
- (linux-modules '()))
+ (modules '()))
"Return a derivation that builds a Linux initrd (a gzipped cpio archive)
containing GUILE and that evaluates EXP, a G-expression, upon booting. All
the derivations referenced by EXP are automatically copied to the initrd.
-LINUX-MODULES is a list of '.ko' file names to be copied from LINUX into the
-initrd. MODULES is a list of Guile module names to be embedded in the
-initrd."
+MODULES is a list of Guile module names to be embedded in the initrd."
;; General Linux overview in `Documentation/early-userspace/README' and
;; `Documentation/filesystems/ramfs-rootfs-initramfs.txt'.
- (mlet* %store-monad ((init (gexp->script "init" exp
- #:modules modules
- #:guile guile))
- (module-dir (flat-linux-module-directory linux
- linux-modules)))
+ (mlet %store-monad ((init (gexp->script "init" exp
+ #:modules modules
+ #:guile guile)))
(define builder
#~(begin
(use-modules (gnu build linux-initrd))
@@ -80,8 +75,8 @@ initrd."
(build-initrd (string-append #$output "/initrd")
#:guile #$guile
#:init #$init
+ ;; Copy everything INIT refers to into the initrd.
#:references-graphs '("closure")
- #:linux-module-directory #$module-dir
#:cpio (string-append #$cpio "/bin/cpio")
#:gzip (string-append #$gzip "/bin/gzip"))))
@@ -201,27 +196,29 @@ exception and backtrace!)."
(list unionfs-fuse/static)
'())))
- (expression->initrd
- #~(begin
- (use-modules (gnu build linux-boot)
- (guix build utils)
- (srfi srfi-26))
-
- (with-output-to-port (%make-void-port "w")
- (lambda ()
- (set-path-environment-variable "PATH" '("bin" "sbin")
- '#$helper-packages)))
-
- (boot-system #:mounts '#$(map file-system->spec file-systems)
- #:linux-modules '#$linux-modules
- #:qemu-guest-networking? #$qemu-networking?
- #:guile-modules-in-chroot? '#$guile-modules-in-chroot?
- #:volatile-root? '#$volatile-root?))
- #:name "base-initrd"
- #:modules '((guix build utils)
- (gnu build linux-boot)
- (gnu build file-systems))
- #:linux linux-libre
- #:linux-modules linux-modules))
+ (mlet %store-monad ((kodir (flat-linux-module-directory linux-libre
+ linux-modules)))
+ (expression->initrd
+ #~(begin
+ (use-modules (gnu build linux-boot)
+ (guix build utils)
+ (srfi srfi-26))
+
+ (with-output-to-port (%make-void-port "w")
+ (lambda ()
+ (set-path-environment-variable "PATH" '("bin" "sbin")
+ '#$helper-packages)))
+
+ (boot-system #:mounts '#$(map file-system->spec file-systems)
+ #:linux-modules (map (lambda (file)
+ (string-append #$kodir "/" file))
+ '#$linux-modules)
+ #:qemu-guest-networking? #$qemu-networking?
+ #:guile-modules-in-chroot? '#$guile-modules-in-chroot?
+ #:volatile-root? '#$volatile-root?))
+ #:name "base-initrd"
+ #:modules '((guix build utils)
+ (gnu build linux-boot)
+ (gnu build file-systems)))))
;;; linux-initrd.scm ends here