2013-08-28 22:04:04 +00:00
|
|
|
|
;;; GNU Guix --- Functional package management for GNU
|
2020-04-06 14:19:05 +00:00
|
|
|
|
;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
|
2021-05-20 18:45:00 +00:00
|
|
|
|
;;; Copyright © 2016, 2017, 2019–2021 Tobias Geerinckx-Rice <me@tobias.gr>
|
2017-04-10 17:18:14 +00:00
|
|
|
|
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
|
2019-11-17 13:15:21 +00:00
|
|
|
|
;;; Copyright © 2019 Guillaume Le Vaillant <glv@posteo.net>
|
2022-02-18 04:28:07 +00:00
|
|
|
|
;;; Copyright © 2020, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
|
2013-08-28 22:04:04 +00:00
|
|
|
|
;;;
|
|
|
|
|
;;; This file is part of GNU Guix.
|
|
|
|
|
;;;
|
|
|
|
|
;;; GNU Guix is free software; you can redistribute it and/or modify it
|
|
|
|
|
;;; under the terms of the GNU General Public License as published by
|
|
|
|
|
;;; the Free Software Foundation; either version 3 of the License, or (at
|
|
|
|
|
;;; your option) any later version.
|
|
|
|
|
;;;
|
|
|
|
|
;;; GNU Guix is distributed in the hope that it will be useful, but
|
|
|
|
|
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;;; GNU General Public License for more details.
|
|
|
|
|
;;;
|
|
|
|
|
;;; You should have received a copy of the GNU General Public License
|
|
|
|
|
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
2014-09-03 09:14:12 +00:00
|
|
|
|
(define-module (gnu build linux-boot)
|
2013-08-28 22:04:04 +00:00
|
|
|
|
#:use-module (rnrs io ports)
|
2014-07-03 20:44:14 +00:00
|
|
|
|
#:use-module (system repl error-handling)
|
2014-01-29 20:57:56 +00:00
|
|
|
|
#:autoload (system repl repl) (start-repl)
|
|
|
|
|
#:use-module (srfi srfi-1)
|
2017-12-15 23:16:40 +00:00
|
|
|
|
#:use-module (srfi srfi-9)
|
2021-09-12 16:07:54 +00:00
|
|
|
|
#:use-module (srfi srfi-11)
|
2014-01-29 20:57:56 +00:00
|
|
|
|
#:use-module (srfi srfi-26)
|
|
|
|
|
#:use-module (ice-9 match)
|
2017-12-15 23:16:40 +00:00
|
|
|
|
#:use-module (ice-9 rdelim)
|
|
|
|
|
#:use-module (ice-9 regex)
|
2014-01-31 13:26:30 +00:00
|
|
|
|
#:use-module (ice-9 ftw)
|
2014-01-29 20:57:56 +00:00
|
|
|
|
#:use-module (guix build utils)
|
2017-10-03 21:25:38 +00:00
|
|
|
|
#:use-module ((guix build syscalls)
|
|
|
|
|
#:hide (file-system-type))
|
2014-11-27 22:59:26 +00:00
|
|
|
|
#:use-module (gnu build linux-modules)
|
Move part of (gnu build linux-boot) to (gnu build file-systems).
* gnu/build/linux-boot.scm (%ext2-endianness, %ext2-sblock-magic,
%ext2-sblock-creator-os, %ext2-sblock-uuid, %ext2-sblock-volume-name,
read-ext2-superblock, ext2-superblock-uuid,
ext2-superblock-volume-name, disk-partitions,
partition-label-predicate, find-partition-by-label,
canonicalize-device-spec, MS_RDONLY, MS_NOSUID, MS_NODEV, MS_NOEXEC,
MS_BIND, MS_MOVE, bind-mount, check-file-system,
mount-flags->bit-mask, mount-file-system): Move to...
* gnu/build/file-systems.scm: ... here. New file.
* gnu-system.am (GNU_SYSTEM_MODULES): Add it.
* gnu/services/base.scm: Use (gnu build file-systems).
* gnu/services/dmd.scm (dmd-configuration-file): Likewise.
* gnu/system.scm (operating-system-activation-script): Likewise.
* gnu/system/linux-initrd.scm (base-initrd): Likewise.
* gnu/system/vm.scm (expression->derivation-in-linux-vm): Likewise.
2014-09-03 12:19:51 +00:00
|
|
|
|
#:use-module (gnu build file-systems)
|
2017-10-03 21:25:38 +00:00
|
|
|
|
#:use-module (gnu system file-systems)
|
2013-08-28 22:04:04 +00:00
|
|
|
|
#:export (mount-essential-file-systems
|
|
|
|
|
linux-command-line
|
2014-05-16 21:31:48 +00:00
|
|
|
|
find-long-option
|
2018-01-31 12:28:21 +00:00
|
|
|
|
find-long-options
|
2013-09-01 21:13:56 +00:00
|
|
|
|
make-essential-device-nodes
|
2017-12-15 23:16:40 +00:00
|
|
|
|
make-static-device-nodes
|
2013-08-28 22:04:04 +00:00
|
|
|
|
configure-qemu-networking
|
linux-initrd: Allow use of volume labels in 'file-system' declarations.
* guix/build/linux-initrd.scm (%ext2-endianness, %ext2-sblock-magic,
%ext2-sblock-creator-os, %ext2-sblock-uuid, %ext2-sblock-volume-name):
New macros.
(read-ext2-superblock, ext2-superblock-uuid,
ext2-superblock-volume-name, disk-partitions,
partition-label-predicate, find-partition-by-label,
canonicalize-device-spec): New procedures.
(mount-file-system): Use 'canonicalize-device-spec' on SOURCE.
(boot-system): Likewise for ROOT.
* doc/guix.texi (Using the Configuration System): Adjust 'file-system'
declaration accordingly.
2014-05-30 21:44:28 +00:00
|
|
|
|
|
2014-01-29 20:57:56 +00:00
|
|
|
|
boot-system))
|
2013-08-28 22:04:04 +00:00
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
;;;
|
|
|
|
|
;;; Utility procedures useful in a Linux initial RAM disk (initrd). Note that
|
|
|
|
|
;;; many of these use procedures not yet available in vanilla Guile (`mount',
|
|
|
|
|
;;; `load-linux-module', etc.); these are provided by a Guile patch used in
|
|
|
|
|
;;; the GNU distribution.
|
|
|
|
|
;;;
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
|
|
(define* (mount-essential-file-systems #:key (root "/"))
|
2015-09-20 19:44:39 +00:00
|
|
|
|
"Mount /dev, /proc, and /sys under ROOT."
|
2013-08-28 22:04:04 +00:00
|
|
|
|
(define (scope dir)
|
|
|
|
|
(string-append root
|
|
|
|
|
(if (string-suffix? "/" root)
|
|
|
|
|
""
|
|
|
|
|
"/")
|
|
|
|
|
dir))
|
|
|
|
|
|
|
|
|
|
(unless (file-exists? (scope "proc"))
|
|
|
|
|
(mkdir (scope "proc")))
|
|
|
|
|
(mount "none" (scope "proc") "proc")
|
|
|
|
|
|
2015-09-20 19:44:39 +00:00
|
|
|
|
(unless (file-exists? (scope "dev"))
|
|
|
|
|
(mkdir (scope "dev")))
|
|
|
|
|
(mount "none" (scope "dev") "devtmpfs")
|
|
|
|
|
|
2013-08-28 22:04:04 +00:00
|
|
|
|
(unless (file-exists? (scope "sys"))
|
|
|
|
|
(mkdir (scope "sys")))
|
|
|
|
|
(mount "none" (scope "sys") "sysfs"))
|
|
|
|
|
|
2014-05-04 20:24:47 +00:00
|
|
|
|
(define (move-essential-file-systems root)
|
|
|
|
|
"Move currently mounted essential file systems to ROOT."
|
|
|
|
|
(for-each (lambda (dir)
|
|
|
|
|
(let ((target (string-append root dir)))
|
|
|
|
|
(unless (file-exists? target)
|
|
|
|
|
(mkdir target))
|
|
|
|
|
(mount dir target "" MS_MOVE)))
|
2015-09-20 19:44:39 +00:00
|
|
|
|
'("/dev" "/proc" "/sys")))
|
2014-05-04 20:24:47 +00:00
|
|
|
|
|
2013-08-28 22:04:04 +00:00
|
|
|
|
(define (linux-command-line)
|
|
|
|
|
"Return the Linux kernel command line as a list of strings."
|
|
|
|
|
(string-tokenize
|
|
|
|
|
(call-with-input-file "/proc/cmdline"
|
|
|
|
|
get-string-all)))
|
|
|
|
|
|
2014-05-16 21:31:48 +00:00
|
|
|
|
(define (find-long-option option arguments)
|
2022-02-18 04:28:07 +00:00
|
|
|
|
"Find OPTION among ARGUMENTS, where OPTION is something like \"gnu.load\".
|
2014-05-16 21:31:48 +00:00
|
|
|
|
Return the value associated with OPTION, or #f on failure."
|
|
|
|
|
(let ((opt (string-append option "=")))
|
|
|
|
|
(and=> (find (cut string-prefix? opt <>)
|
|
|
|
|
arguments)
|
|
|
|
|
(lambda (arg)
|
|
|
|
|
(substring arg (+ 1 (string-index arg #\=)))))))
|
|
|
|
|
|
2018-01-31 12:28:21 +00:00
|
|
|
|
(define (find-long-options option arguments)
|
|
|
|
|
"Find OPTIONs among ARGUMENTS, where OPTION is something like \"console\".
|
|
|
|
|
Return the values associated with OPTIONs as a list, or the empty list if
|
|
|
|
|
OPTION doesn't appear in ARGUMENTS."
|
|
|
|
|
(let ((opt (string-append option "=")))
|
|
|
|
|
(filter-map (lambda (arg)
|
|
|
|
|
(and (string-prefix? opt arg)
|
|
|
|
|
(substring arg (+ 1 (string-index arg #\=)))))
|
|
|
|
|
arguments)))
|
|
|
|
|
|
2020-11-05 10:03:21 +00:00
|
|
|
|
(define (resume-if-hibernated device)
|
|
|
|
|
"Resume from hibernation if possible. This is safe ONLY if no on-disk file
|
|
|
|
|
systems have been mounted; calling it later risks severe file system corruption!
|
|
|
|
|
See <Documentation/swsusp.txt> in the kernel source directory. This is the
|
|
|
|
|
caller's responsibility, as is catching exceptions if resumption was supposed to
|
|
|
|
|
happen but didn't.
|
|
|
|
|
|
|
|
|
|
Resume only from DEVICE if it's a string. If it's #f, use the kernel's default
|
|
|
|
|
hibernation device (CONFIG_PM_STD_PARTITION). Never return if resumption
|
|
|
|
|
succeeds. Return nothing otherwise. The kernel logs any details to dmesg."
|
|
|
|
|
|
|
|
|
|
(define (string->major:minor string)
|
|
|
|
|
"Return a string with MAJOR:MINOR numbers of the device specified by STRING"
|
|
|
|
|
|
|
|
|
|
;; The "resume=" kernel command-line option always provides a string, which
|
|
|
|
|
;; can represent a device, a UUID, or a label. Check for all three.
|
|
|
|
|
(let* ((spec (cond ((string-prefix? "/" string) string)
|
|
|
|
|
((uuid string) => identity)
|
|
|
|
|
(else (file-system-label string))))
|
|
|
|
|
;; XXX The kernel's swsusp_resume_can_resume() waits if ‘resumewait’
|
|
|
|
|
;; is found on the command line; our canonicalize-device-spec gives
|
|
|
|
|
;; up after 20 seconds. We could emulate the former by looping…
|
|
|
|
|
(device (canonicalize-device-spec spec))
|
2021-09-12 16:07:54 +00:00
|
|
|
|
(rdev (stat:rdev (stat device))))
|
|
|
|
|
(let-values (((major minor) (device-number->major+minor rdev)))
|
|
|
|
|
(format #f "~a:~a" major minor))))
|
2020-11-05 10:03:21 +00:00
|
|
|
|
|
|
|
|
|
;; Write the resume DEVICE to this magic file, using the MAJOR:MINOR device
|
|
|
|
|
;; numbers if possible. The kernel will immediately try to resume from it.
|
|
|
|
|
(let ((resume "/sys/power/resume"))
|
|
|
|
|
(when (file-exists? resume) ; this kernel supports hibernation
|
|
|
|
|
;; Honour the kernel's default device (only) if none other was given.
|
|
|
|
|
(let ((major:minor (if device
|
|
|
|
|
(or (false-if-exception (string->major:minor
|
|
|
|
|
device))
|
|
|
|
|
;; We can't parse it. Maybe the kernel can.
|
|
|
|
|
device)
|
|
|
|
|
(let ((default (call-with-input-file resume
|
|
|
|
|
read-line)))
|
|
|
|
|
;; Don't waste time echoing 0:0 to /sys.
|
|
|
|
|
(if (string=? "0:0" default)
|
|
|
|
|
#f
|
|
|
|
|
default)))))
|
|
|
|
|
(when major:minor
|
|
|
|
|
(call-with-output-file resume ; may throw an ‘Invalid argument’
|
|
|
|
|
(cut display major:minor <>))))))) ; may never return
|
|
|
|
|
|
2014-06-01 19:48:57 +00:00
|
|
|
|
(define* (make-disk-device-nodes base major #:optional (minor 0))
|
|
|
|
|
"Make the block device nodes around BASE (something like \"/root/dev/sda\")
|
|
|
|
|
with the given MAJOR number, starting with MINOR."
|
|
|
|
|
(mknod base 'block-special #o644 (device-number major minor))
|
|
|
|
|
(let loop ((i 1))
|
2014-11-13 12:34:31 +00:00
|
|
|
|
(when (< i 16)
|
2014-06-01 19:48:57 +00:00
|
|
|
|
(mknod (string-append base (number->string i))
|
|
|
|
|
'block-special #o644 (device-number major (+ minor i)))
|
|
|
|
|
(loop (+ i 1)))))
|
|
|
|
|
|
2017-12-15 23:16:40 +00:00
|
|
|
|
;; Representation of a /dev node.
|
|
|
|
|
(define-record-type <device-node>
|
|
|
|
|
(device-node name type major minor module)
|
|
|
|
|
device-node?
|
|
|
|
|
(name device-node-name)
|
|
|
|
|
(type device-node-type)
|
|
|
|
|
(major device-node-major)
|
|
|
|
|
(minor device-node-minor)
|
|
|
|
|
(module device-node-module))
|
|
|
|
|
|
|
|
|
|
(define (read-static-device-nodes port)
|
|
|
|
|
"Read from PORT a list of <device-node> written in the format used by
|
|
|
|
|
/lib/modules/*/*.devname files."
|
|
|
|
|
(let loop ((line (read-line port)))
|
|
|
|
|
(if (eof-object? line)
|
|
|
|
|
'()
|
|
|
|
|
(match (string-split line #\space)
|
|
|
|
|
(((? (cut string-prefix? "#" <>)) _ ...)
|
|
|
|
|
(loop (read-line port)))
|
|
|
|
|
((module-name device-name device-spec)
|
|
|
|
|
(let* ((device-parts
|
|
|
|
|
(string-match "([bc])([0-9][0-9]*):([0-9][0-9]*)"
|
|
|
|
|
device-spec))
|
|
|
|
|
(type-string (match:substring device-parts 1))
|
|
|
|
|
(type (match type-string
|
|
|
|
|
("c" 'char-special)
|
|
|
|
|
("b" 'block-special)))
|
|
|
|
|
(major-string (match:substring device-parts 2))
|
|
|
|
|
(major (string->number major-string 10))
|
|
|
|
|
(minor-string (match:substring device-parts 3))
|
|
|
|
|
(minor (string->number minor-string 10)))
|
|
|
|
|
(cons (device-node device-name type major minor module-name)
|
|
|
|
|
(loop (read-line port)))))
|
|
|
|
|
(_
|
|
|
|
|
(begin
|
|
|
|
|
(format (current-error-port)
|
|
|
|
|
"read-static-device-nodes: ignored devname line '~a'~%" line)
|
|
|
|
|
(loop (read-line port))))))))
|
|
|
|
|
|
|
|
|
|
(define* (mkdir-p* dir #:optional (mode #o755))
|
|
|
|
|
"This is a variant of 'mkdir-p' that works around
|
|
|
|
|
<http://bugs.gnu.org/24659> by passing MODE explicitly in each 'mkdir' call."
|
|
|
|
|
(define absolute?
|
|
|
|
|
(string-prefix? "/" dir))
|
|
|
|
|
|
|
|
|
|
(define not-slash
|
|
|
|
|
(char-set-complement (char-set #\/)))
|
|
|
|
|
|
|
|
|
|
(let loop ((components (string-tokenize dir not-slash))
|
|
|
|
|
(root (if absolute?
|
|
|
|
|
""
|
|
|
|
|
".")))
|
|
|
|
|
(match components
|
|
|
|
|
((head tail ...)
|
|
|
|
|
(let ((path (string-append root "/" head)))
|
|
|
|
|
(catch 'system-error
|
|
|
|
|
(lambda ()
|
|
|
|
|
(mkdir path mode)
|
|
|
|
|
(loop tail path))
|
|
|
|
|
(lambda args
|
|
|
|
|
(if (= EEXIST (system-error-errno args))
|
|
|
|
|
(loop tail path)
|
|
|
|
|
(apply throw args))))))
|
|
|
|
|
(() #t))))
|
|
|
|
|
|
|
|
|
|
(define (report-system-error name . args)
|
|
|
|
|
"Report a system error for the file NAME."
|
|
|
|
|
(let ((errno (system-error-errno args)))
|
|
|
|
|
(format (current-error-port) "could not create '~a': ~a~%" name
|
|
|
|
|
(strerror errno))))
|
|
|
|
|
|
|
|
|
|
;; Catch a system-error, log it and don't die from it.
|
|
|
|
|
(define-syntax-rule (catch-system-error name exp)
|
|
|
|
|
(catch 'system-error
|
|
|
|
|
(lambda ()
|
|
|
|
|
exp)
|
|
|
|
|
(lambda args
|
|
|
|
|
(apply report-system-error name args))))
|
|
|
|
|
|
2018-01-19 15:25:13 +00:00
|
|
|
|
;; Create a device node like the <device-node> passed here on the file system.
|
2017-12-15 23:16:40 +00:00
|
|
|
|
(define create-device-node
|
|
|
|
|
(match-lambda
|
|
|
|
|
(($ <device-node> xname type major minor module)
|
|
|
|
|
(let ((name (string-append "/dev/" xname)))
|
|
|
|
|
(mkdir-p* (dirname name))
|
|
|
|
|
(catch-system-error name
|
|
|
|
|
(mknod name type #o600 (device-number major minor)))))))
|
|
|
|
|
|
|
|
|
|
(define* (make-static-device-nodes linux-release-module-directory)
|
|
|
|
|
"Create static device nodes required by the given Linux release.
|
|
|
|
|
This is required in order to solve a chicken-or-egg problem:
|
|
|
|
|
The Linux kernel has a feature to autoload modules when a device is first
|
|
|
|
|
accessed.
|
|
|
|
|
And udev has a feature to set the permissions of static nodes correctly
|
|
|
|
|
when it is starting up and also to automatically create nodes when hardware
|
|
|
|
|
is hotplugged. That leaves universal device files which are not linked to
|
|
|
|
|
one specific hardware device. These we have to create."
|
|
|
|
|
(let ((devname-name (string-append linux-release-module-directory "/"
|
|
|
|
|
"modules.devname")))
|
|
|
|
|
(for-each create-device-node
|
|
|
|
|
(call-with-input-file devname-name
|
|
|
|
|
read-static-device-nodes))))
|
|
|
|
|
|
2020-04-06 14:19:05 +00:00
|
|
|
|
(define* (make-essential-device-nodes #:optional (root "/"))
|
2013-09-01 21:13:56 +00:00
|
|
|
|
"Make essential device nodes under ROOT/dev."
|
2015-09-20 19:44:39 +00:00
|
|
|
|
;; The hand-made devtmpfs/udev!
|
2013-09-01 21:13:56 +00:00
|
|
|
|
|
|
|
|
|
(define (scope dir)
|
|
|
|
|
(string-append root
|
|
|
|
|
(if (string-suffix? "/" root)
|
|
|
|
|
""
|
|
|
|
|
"/")
|
|
|
|
|
dir))
|
|
|
|
|
|
|
|
|
|
(unless (file-exists? (scope "dev"))
|
|
|
|
|
(mkdir (scope "dev")))
|
|
|
|
|
|
2014-01-31 00:43:16 +00:00
|
|
|
|
;; Make the device nodes for SCSI disks.
|
2014-06-01 19:48:57 +00:00
|
|
|
|
(make-disk-device-nodes (scope "dev/sda") 8)
|
|
|
|
|
(make-disk-device-nodes (scope "dev/sdb") 8 16)
|
|
|
|
|
(make-disk-device-nodes (scope "dev/sdc") 8 32)
|
|
|
|
|
(make-disk-device-nodes (scope "dev/sdd") 8 48)
|
|
|
|
|
|
|
|
|
|
;; SCSI CD-ROM devices (aka. "/dev/sr0" etc.).
|
|
|
|
|
(mknod (scope "dev/scd0") 'block-special #o644 (device-number 11 0))
|
|
|
|
|
(mknod (scope "dev/scd1") 'block-special #o644 (device-number 11 1))
|
2014-01-31 00:43:16 +00:00
|
|
|
|
|
|
|
|
|
;; The virtio (para-virtualized) block devices, as supported by QEMU/KVM.
|
2014-06-01 19:48:57 +00:00
|
|
|
|
(make-disk-device-nodes (scope "dev/vda") 252)
|
2013-09-01 21:13:56 +00:00
|
|
|
|
|
2014-02-01 00:07:14 +00:00
|
|
|
|
;; Memory (used by Xorg's VESA driver.)
|
|
|
|
|
(mknod (scope "dev/mem") 'char-special #o640 (device-number 1 1))
|
|
|
|
|
(mknod (scope "dev/kmem") 'char-special #o640 (device-number 1 2))
|
|
|
|
|
|
2014-02-01 01:22:23 +00:00
|
|
|
|
;; Inputs (used by Xorg.)
|
|
|
|
|
(unless (file-exists? (scope "dev/input"))
|
|
|
|
|
(mkdir (scope "dev/input")))
|
|
|
|
|
(mknod (scope "dev/input/mice") 'char-special #o640 (device-number 13 63))
|
|
|
|
|
(mknod (scope "dev/input/mouse0") 'char-special #o640 (device-number 13 32))
|
|
|
|
|
(mknod (scope "dev/input/event0") 'char-special #o640 (device-number 13 64))
|
|
|
|
|
|
2014-06-01 21:51:12 +00:00
|
|
|
|
;; System console. This node is magically created by the kernel on the
|
|
|
|
|
;; initrd's root, so don't try to create it in that case.
|
|
|
|
|
(unless (string=? root "/")
|
|
|
|
|
(mknod (scope "dev/console") 'char-special #o600
|
|
|
|
|
(device-number 5 1)))
|
|
|
|
|
|
2013-09-01 21:13:56 +00:00
|
|
|
|
;; TTYs.
|
2013-09-04 21:22:34 +00:00
|
|
|
|
(mknod (scope "dev/tty") 'char-special #o600
|
|
|
|
|
(device-number 5 0))
|
2014-04-09 15:50:37 +00:00
|
|
|
|
(chmod (scope "dev/tty") #o666)
|
2013-09-01 21:13:56 +00:00
|
|
|
|
(let loop ((n 0))
|
|
|
|
|
(and (< n 50)
|
|
|
|
|
(let ((name (format #f "dev/tty~a" n)))
|
2013-09-04 21:22:34 +00:00
|
|
|
|
(mknod (scope name) 'char-special #o600
|
2013-09-01 21:13:56 +00:00
|
|
|
|
(device-number 4 n))
|
|
|
|
|
(loop (+ 1 n)))))
|
|
|
|
|
|
2014-05-14 14:38:47 +00:00
|
|
|
|
;; Serial line.
|
|
|
|
|
(mknod (scope "dev/ttyS0") 'char-special #o660
|
|
|
|
|
(device-number 4 64))
|
|
|
|
|
|
2014-03-10 22:16:02 +00:00
|
|
|
|
;; Pseudo ttys.
|
|
|
|
|
(mknod (scope "dev/ptmx") 'char-special #o666
|
|
|
|
|
(device-number 5 2))
|
2014-04-09 15:50:37 +00:00
|
|
|
|
(chmod (scope "dev/ptmx") #o666)
|
2014-03-10 22:16:02 +00:00
|
|
|
|
|
2014-04-09 17:10:07 +00:00
|
|
|
|
;; Create /dev/pts; it will be mounted later, at boot time.
|
2014-03-10 22:16:02 +00:00
|
|
|
|
(unless (file-exists? (scope "dev/pts"))
|
|
|
|
|
(mkdir (scope "dev/pts")))
|
|
|
|
|
|
2013-09-10 22:52:36 +00:00
|
|
|
|
;; Rendez-vous point for syslogd.
|
|
|
|
|
(mknod (scope "dev/log") 'socket #o666 0)
|
|
|
|
|
(mknod (scope "dev/kmsg") 'char-special #o600 (device-number 1 11))
|
|
|
|
|
|
2014-04-09 15:50:37 +00:00
|
|
|
|
;; Other useful nodes, notably relied on by guix-daemon.
|
|
|
|
|
(for-each (match-lambda
|
|
|
|
|
((file major minor)
|
|
|
|
|
(mknod (scope file) 'char-special #o666
|
|
|
|
|
(device-number major minor))
|
|
|
|
|
(chmod (scope file) #o666)))
|
|
|
|
|
'(("dev/null" 1 3)
|
|
|
|
|
("dev/zero" 1 5)
|
|
|
|
|
("dev/full" 1 7)
|
|
|
|
|
("dev/random" 1 8)
|
|
|
|
|
("dev/urandom" 1 9)))
|
|
|
|
|
|
|
|
|
|
(symlink "/proc/self/fd" (scope "dev/fd"))
|
|
|
|
|
(symlink "/proc/self/fd/0" (scope "dev/stdin"))
|
|
|
|
|
(symlink "/proc/self/fd/1" (scope "dev/stdout"))
|
2014-04-14 21:59:08 +00:00
|
|
|
|
(symlink "/proc/self/fd/2" (scope "dev/stderr"))
|
|
|
|
|
|
2014-05-22 19:57:39 +00:00
|
|
|
|
;; Loopback devices.
|
|
|
|
|
(let loop ((i 0))
|
|
|
|
|
(when (< i 8)
|
|
|
|
|
(mknod (scope (string-append "dev/loop" (number->string i)))
|
|
|
|
|
'block-special #o660
|
|
|
|
|
(device-number 7 i))
|
|
|
|
|
(loop (+ 1 i))))
|
|
|
|
|
|
2014-04-14 21:59:08 +00:00
|
|
|
|
;; File systems in user space (FUSE).
|
|
|
|
|
(mknod (scope "dev/fuse") 'char-special #o666 (device-number 10 229)))
|
2013-09-01 21:13:56 +00:00
|
|
|
|
|
2013-08-28 22:04:04 +00:00
|
|
|
|
(define %host-qemu-ipv4-address
|
|
|
|
|
(inet-pton AF_INET "10.0.2.10"))
|
|
|
|
|
|
|
|
|
|
(define* (configure-qemu-networking #:optional (interface "eth0"))
|
|
|
|
|
"Setup the INTERFACE network interface and /etc/resolv.conf according to
|
|
|
|
|
QEMU's default networking settings (see net/slirp.c in QEMU for default
|
|
|
|
|
networking values.) Return #t if INTERFACE is up, #f otherwise."
|
|
|
|
|
(display "configuring QEMU networking...\n")
|
|
|
|
|
(let* ((sock (socket AF_INET SOCK_STREAM 0))
|
|
|
|
|
(address (make-socket-address AF_INET %host-qemu-ipv4-address 0))
|
|
|
|
|
(flags (network-interface-flags sock interface)))
|
|
|
|
|
(set-network-interface-address sock interface address)
|
|
|
|
|
(set-network-interface-flags sock interface (logior flags IFF_UP))
|
|
|
|
|
|
|
|
|
|
(logand (network-interface-flags sock interface) IFF_UP)))
|
|
|
|
|
|
2014-05-14 14:38:21 +00:00
|
|
|
|
(define (pidof program)
|
|
|
|
|
"Return the PID of the first presumed instance of PROGRAM."
|
|
|
|
|
(let ((program (basename program)))
|
|
|
|
|
(find (lambda (pid)
|
|
|
|
|
(let ((exe (format #f "/proc/~a/exe" pid)))
|
|
|
|
|
(and=> (false-if-exception (readlink exe))
|
|
|
|
|
(compose (cut string=? program <>) basename))))
|
|
|
|
|
(filter-map string->number (scandir "/proc")))))
|
|
|
|
|
|
2014-05-02 22:26:07 +00:00
|
|
|
|
(define* (mount-root-file-system root type
|
2021-05-20 18:45:00 +00:00
|
|
|
|
#:key volatile-root? (flags 0) options
|
2021-05-15 13:29:40 +00:00
|
|
|
|
check? skip-check-if-clean? repair)
|
2019-12-02 20:15:50 +00:00
|
|
|
|
"Mount the root file system of type TYPE at device ROOT. If VOLATILE-ROOT? is
|
|
|
|
|
true, mount ROOT read-only and make it an overlay with a writable tmpfs using
|
|
|
|
|
the kernel built-in overlayfs. FLAGS and OPTIONS indicates the options to use
|
2021-05-20 18:45:00 +00:00
|
|
|
|
to mount ROOT, and behave the same as for the `mount' procedure.
|
2021-05-15 13:29:40 +00:00
|
|
|
|
|
|
|
|
|
If CHECK? is true, first run ROOT's fsck tool (if any) non-interactively.
|
|
|
|
|
If SKIP-CHECK-IF-CLEAN? is true, ask fsck to return immediately if ROOT is
|
|
|
|
|
marked as clean. If REPAIR is true, fsck may write to ROOT to perform repairs.
|
|
|
|
|
If REPAIR is also 'PREEN, ask fsck to perform only those repairs that it
|
|
|
|
|
considers safe."
|
2019-07-17 22:23:48 +00:00
|
|
|
|
|
2014-11-20 21:43:47 +00:00
|
|
|
|
(if volatile-root?
|
|
|
|
|
(begin
|
|
|
|
|
(mkdir-p "/real-root")
|
2020-02-11 17:57:29 +00:00
|
|
|
|
(mount root "/real-root" type (logior MS_RDONLY flags) options)
|
2014-11-20 21:43:47 +00:00
|
|
|
|
(mkdir-p "/rw-root")
|
|
|
|
|
(mount "none" "/rw-root" "tmpfs")
|
|
|
|
|
|
2017-10-25 16:13:15 +00:00
|
|
|
|
;; Create the upperdir and the workdir of the overlayfs
|
|
|
|
|
(mkdir-p "/rw-root/upper")
|
|
|
|
|
(mkdir-p "/rw-root/work")
|
|
|
|
|
|
2014-11-20 21:43:47 +00:00
|
|
|
|
;; We want read-write /dev nodes.
|
2017-10-25 16:13:15 +00:00
|
|
|
|
(mkdir-p "/rw-root/upper/dev")
|
|
|
|
|
(mount "none" "/rw-root/upper/dev" "devtmpfs")
|
|
|
|
|
|
|
|
|
|
;; Make /root an overlay of the tmpfs and the actual root.
|
|
|
|
|
(mount "none" "/root" "overlay" 0
|
|
|
|
|
"lowerdir=/real-root,upperdir=/rw-root/upper,workdir=/rw-root/work"))
|
2014-11-20 21:43:47 +00:00
|
|
|
|
(begin
|
2021-05-20 18:45:00 +00:00
|
|
|
|
(when check?
|
2021-05-15 13:29:40 +00:00
|
|
|
|
(check-file-system root type (not skip-check-if-clean?) repair))
|
2019-12-02 20:15:50 +00:00
|
|
|
|
(mount root "/root" type flags options)))
|
2014-05-07 22:22:26 +00:00
|
|
|
|
|
2015-01-05 14:07:03 +00:00
|
|
|
|
;; Make sure /root/etc/mtab is a symlink to /proc/self/mounts.
|
2015-01-28 20:07:42 +00:00
|
|
|
|
(false-if-exception
|
2015-01-05 14:07:03 +00:00
|
|
|
|
(delete-file "/root/etc/mtab"))
|
2017-11-29 10:31:56 +00:00
|
|
|
|
(mkdir-p "/root/etc")
|
2015-01-05 14:07:03 +00:00
|
|
|
|
(symlink "/proc/self/mounts" "/root/etc/mtab"))
|
2014-05-02 22:26:07 +00:00
|
|
|
|
|
2014-05-04 20:24:47 +00:00
|
|
|
|
(define (switch-root root)
|
|
|
|
|
"Switch to ROOT as the root file system, in a way similar to what
|
|
|
|
|
util-linux' switch_root(8) does."
|
|
|
|
|
(move-essential-file-systems root)
|
|
|
|
|
(chdir root)
|
2014-05-06 16:09:25 +00:00
|
|
|
|
|
|
|
|
|
;; Since we're about to 'rm -rf /', try to make sure we're on an initrd.
|
|
|
|
|
;; TODO: Use 'statfs' to check the fs type, like klibc does.
|
|
|
|
|
(when (or (not (file-exists? "/init")) (directory-exists? "/home"))
|
|
|
|
|
(format (current-error-port)
|
|
|
|
|
"The root file system is probably not an initrd; \
|
|
|
|
|
bailing out.~%root contents: ~s~%" (scandir "/"))
|
|
|
|
|
(force-output (current-error-port))
|
|
|
|
|
(exit 1))
|
|
|
|
|
|
|
|
|
|
;; Delete files from the old root, without crossing mount points (assuming
|
|
|
|
|
;; there are no mount points in sub-directories.) That means we're leaving
|
|
|
|
|
;; the empty ROOT directory behind us, but that's OK.
|
|
|
|
|
(let ((root-device (stat:dev (stat "/"))))
|
|
|
|
|
(for-each (lambda (file)
|
|
|
|
|
(unless (member file '("." ".."))
|
|
|
|
|
(let* ((file (string-append "/" file))
|
|
|
|
|
(device (stat:dev (lstat file))))
|
|
|
|
|
(when (= device root-device)
|
|
|
|
|
(delete-file-recursively file)))))
|
|
|
|
|
(scandir "/")))
|
|
|
|
|
|
|
|
|
|
;; Make ROOT the new root.
|
2014-05-04 20:24:47 +00:00
|
|
|
|
(mount root "/" "" MS_MOVE)
|
2014-05-06 16:09:25 +00:00
|
|
|
|
(chroot ".")
|
|
|
|
|
(chdir "/")
|
|
|
|
|
|
|
|
|
|
(when (file-exists? "/dev/console")
|
|
|
|
|
;; Close the standard file descriptors since they refer to the old
|
2014-05-08 21:21:45 +00:00
|
|
|
|
;; /dev/console, and reopen them.
|
|
|
|
|
(let ((console (open-file "/dev/console" "r+b0")))
|
|
|
|
|
(for-each close-fdes '(0 1 2))
|
|
|
|
|
|
|
|
|
|
(dup2 (fileno console) 0)
|
|
|
|
|
(dup2 (fileno console) 1)
|
|
|
|
|
(dup2 (fileno console) 2)
|
|
|
|
|
|
|
|
|
|
(close-port console))))
|
2014-05-04 20:24:47 +00:00
|
|
|
|
|
linux-initrd: Allow use of volume labels in 'file-system' declarations.
* guix/build/linux-initrd.scm (%ext2-endianness, %ext2-sblock-magic,
%ext2-sblock-creator-os, %ext2-sblock-uuid, %ext2-sblock-volume-name):
New macros.
(read-ext2-superblock, ext2-superblock-uuid,
ext2-superblock-volume-name, disk-partitions,
partition-label-predicate, find-partition-by-label,
canonicalize-device-spec): New procedures.
(mount-file-system): Use 'canonicalize-device-spec' on SOURCE.
(boot-system): Likewise for ROOT.
* doc/guix.texi (Using the Configuration System): Adjust 'file-system'
declaration accordingly.
2014-05-30 21:44:28 +00:00
|
|
|
|
|
2014-01-29 20:57:56 +00:00
|
|
|
|
(define* (boot-system #:key
|
|
|
|
|
(linux-modules '())
|
2014-11-27 22:59:26 +00:00
|
|
|
|
linux-module-directory
|
2019-03-20 11:19:14 +00:00
|
|
|
|
keymap-file
|
2014-01-29 20:57:56 +00:00
|
|
|
|
qemu-guest-networking?
|
2014-05-03 22:30:39 +00:00
|
|
|
|
volatile-root?
|
2014-09-22 09:06:42 +00:00
|
|
|
|
pre-mount
|
2018-01-08 22:10:21 +00:00
|
|
|
|
(mounts '())
|
|
|
|
|
(on-error 'debug))
|
2014-01-29 20:57:56 +00:00
|
|
|
|
"This procedure is meant to be called from an initrd. Boot a system by
|
2014-11-27 22:59:26 +00:00
|
|
|
|
first loading LINUX-MODULES (a list of module names) from
|
2019-03-20 11:19:14 +00:00
|
|
|
|
LINUX-MODULE-DIRECTORY, then installing KEYMAP-FILE with 'loadkeys' (if
|
|
|
|
|
KEYMAP-FILE is true), then setting up QEMU guest networking if
|
2014-11-27 22:59:26 +00:00
|
|
|
|
QEMU-GUEST-NETWORKING? is true, calling PRE-MOUNT, mounting the file systems
|
|
|
|
|
specified in MOUNTS, and finally booting into the new root if any. The initrd
|
2022-02-18 05:09:05 +00:00
|
|
|
|
supports the kernel command-line options 'gnu.load' and 'gnu.repl'. It also
|
2022-02-18 04:28:07 +00:00
|
|
|
|
honors a subset of the Linux kernel command-line parameters such as
|
2022-02-18 05:09:05 +00:00
|
|
|
|
'fsck.mode', 'resume', 'rootdelay', rootflags and rootfstype.
|
2014-01-29 20:57:56 +00:00
|
|
|
|
|
2022-02-18 04:28:07 +00:00
|
|
|
|
Mount the root file system, specified by the 'root' command-line argument, if
|
|
|
|
|
any.
|
2014-05-03 10:16:10 +00:00
|
|
|
|
|
2017-10-03 21:25:38 +00:00
|
|
|
|
MOUNTS must be a list of <file-system> objects.
|
2014-01-29 20:57:56 +00:00
|
|
|
|
|
2014-01-31 13:26:30 +00:00
|
|
|
|
When VOLATILE-ROOT? is true, the root file system is writable but any changes
|
2018-01-08 22:10:21 +00:00
|
|
|
|
to it are lost.
|
|
|
|
|
|
|
|
|
|
ON-ERROR is passed to 'call-with-error-handling'; it determines what happens
|
|
|
|
|
upon error."
|
2017-10-03 21:25:38 +00:00
|
|
|
|
(define (root-mount-point? fs)
|
|
|
|
|
(string=? (file-system-mount-point fs) "/"))
|
2014-05-03 22:30:39 +00:00
|
|
|
|
|
2020-02-11 19:00:06 +00:00
|
|
|
|
(define (device-string->file-system-device device-string)
|
2022-02-18 04:28:07 +00:00
|
|
|
|
;; The "root=SPEC" kernel command-line option always provides a string,
|
|
|
|
|
;; but the string can represent a device, an nfs-root, a UUID, or a label.
|
|
|
|
|
;; So check for all four.
|
2020-02-11 19:00:06 +00:00
|
|
|
|
(cond ((string-prefix? "/" device-string) device-string)
|
2020-09-07 08:04:19 +00:00
|
|
|
|
((string-contains device-string ":/") device-string) ; nfs-root
|
2020-02-11 19:00:06 +00:00
|
|
|
|
((uuid device-string) => identity)
|
|
|
|
|
(else (file-system-label device-string))))
|
2019-11-17 13:15:21 +00:00
|
|
|
|
|
2014-01-29 20:57:56 +00:00
|
|
|
|
(display "Welcome, this is GNU's early boot Guile.\n")
|
2022-02-18 04:28:07 +00:00
|
|
|
|
(display "Use 'gnu.repl' for an initrd REPL.\n\n")
|
2014-01-29 20:57:56 +00:00
|
|
|
|
|
2014-07-03 20:44:14 +00:00
|
|
|
|
(call-with-error-handling
|
2019-11-04 23:50:08 +00:00
|
|
|
|
(lambda ()
|
|
|
|
|
(mount-essential-file-systems)
|
|
|
|
|
(let* ((args (linux-command-line))
|
2022-02-18 04:28:07 +00:00
|
|
|
|
(to-load (find-long-option "gnu.load" args))
|
|
|
|
|
;; If present, ‘root’ on the kernel command line takes precedence
|
2021-05-23 15:02:29 +00:00
|
|
|
|
;; over the ‘device’ field of the root <file-system> record.
|
2022-02-18 04:28:07 +00:00
|
|
|
|
(root-device (and=> (find-long-option "root" args)
|
2021-05-23 15:02:29 +00:00
|
|
|
|
device-string->file-system-device))
|
2022-02-18 05:09:05 +00:00
|
|
|
|
(rootfstype (find-long-option "rootfstype" args))
|
|
|
|
|
(rootflags (find-long-option "rootflags" args))
|
|
|
|
|
(root-fs* (find root-mount-point? mounts))
|
2021-05-23 15:02:29 +00:00
|
|
|
|
(fsck.mode (find-long-option "fsck.mode" args)))
|
|
|
|
|
|
2022-02-18 05:09:05 +00:00
|
|
|
|
(unless (or root-fs* (and root-device rootfstype))
|
|
|
|
|
(error "no root file system or 'root' and 'rootfstype' parameters"))
|
|
|
|
|
|
|
|
|
|
;; If present, ‘root’ on the kernel command line takes precedence over
|
|
|
|
|
;; the ‘device’ field of the root <file-system> record; likewise for
|
|
|
|
|
;; the 'rootfstype' and 'rootflags' arguments.
|
|
|
|
|
(define root-fs
|
|
|
|
|
(if root-fs*
|
|
|
|
|
(file-system
|
|
|
|
|
(inherit root-fs*)
|
|
|
|
|
(device (or root-device (file-system-device root-fs*)))
|
|
|
|
|
(type (or rootfstype (file-system-type root-fs*)))
|
|
|
|
|
(options (or rootflags (file-system-options root-fs*))))
|
|
|
|
|
(file-system
|
|
|
|
|
(device root-device)
|
|
|
|
|
(mount-point "/")
|
|
|
|
|
(type rootfstype)
|
|
|
|
|
(options rootflags))))
|
|
|
|
|
|
2021-05-23 15:02:29 +00:00
|
|
|
|
(define (check? fs)
|
|
|
|
|
(match fsck.mode
|
|
|
|
|
("skip" #f)
|
|
|
|
|
("force" #t)
|
|
|
|
|
(_ (file-system-check? fs)))) ; assume "auto"
|
|
|
|
|
|
|
|
|
|
(define (skip-check-if-clean? fs)
|
|
|
|
|
(match fsck.mode
|
|
|
|
|
("force" #f)
|
|
|
|
|
(_ (file-system-skip-check-if-clean? fs))))
|
|
|
|
|
|
|
|
|
|
(define (repair fs)
|
|
|
|
|
(let ((arg (find-long-option "fsck.repair" args)))
|
|
|
|
|
(if arg
|
|
|
|
|
(match arg
|
|
|
|
|
("no" #f)
|
|
|
|
|
("yes" #t)
|
|
|
|
|
(_ 'preen))
|
|
|
|
|
(file-system-repair fs))))
|
2019-11-04 23:50:08 +00:00
|
|
|
|
|
2022-02-18 04:28:07 +00:00
|
|
|
|
(when (member "gnu.repl" args)
|
2019-11-04 23:50:08 +00:00
|
|
|
|
(start-repl))
|
|
|
|
|
|
|
|
|
|
(display "loading kernel modules...\n")
|
|
|
|
|
(load-linux-modules-from-directory linux-modules
|
|
|
|
|
linux-module-directory)
|
|
|
|
|
|
|
|
|
|
(when keymap-file
|
|
|
|
|
(let ((status (system* "loadkeys" keymap-file)))
|
|
|
|
|
(unless (zero? status)
|
|
|
|
|
;; Emit a warning rather than abort when we cannot load
|
|
|
|
|
;; KEYMAP-FILE.
|
|
|
|
|
(format (current-error-port)
|
|
|
|
|
"warning: 'loadkeys' exited with status ~a~%"
|
|
|
|
|
status))))
|
|
|
|
|
|
|
|
|
|
(when qemu-guest-networking?
|
|
|
|
|
(unless (configure-qemu-networking)
|
|
|
|
|
(display "network interface is DOWN\n")))
|
|
|
|
|
|
2021-06-05 18:09:49 +00:00
|
|
|
|
;; A big ugly hammer, to be used only for debugging and in desperate
|
|
|
|
|
;; situations where no proper device synchonisation is possible.
|
|
|
|
|
(let ((root-delay (and=> (find-long-option "rootdelay" args)
|
|
|
|
|
string->number)))
|
|
|
|
|
(when root-delay
|
2022-02-17 18:33:19 +00:00
|
|
|
|
(format #t "Pausing for rootdelay=~a seconds before mounting \
|
|
|
|
|
the root file system...\n" root-delay)
|
2021-06-05 18:09:49 +00:00
|
|
|
|
(sleep root-delay)))
|
|
|
|
|
|
2019-11-04 23:50:08 +00:00
|
|
|
|
;; Prepare the real root file system under /root.
|
|
|
|
|
(unless (file-exists? "/root")
|
|
|
|
|
(mkdir "/root"))
|
|
|
|
|
|
|
|
|
|
(when (procedure? pre-mount)
|
|
|
|
|
;; Do whatever actions are needed before mounting the root file
|
|
|
|
|
;; system--e.g., installing device mappings. Error out when the
|
|
|
|
|
;; return value is false.
|
|
|
|
|
(unless (pre-mount)
|
|
|
|
|
(error "pre-mount actions failed")))
|
|
|
|
|
|
2021-07-09 02:48:53 +00:00
|
|
|
|
(unless (or (member "hibernate=noresume" args)
|
|
|
|
|
;; Also handle the equivalent old-style argument.
|
|
|
|
|
;; See Documentation/admin-guide/kernel-parameters.txt.
|
|
|
|
|
(member "noresume" args))
|
|
|
|
|
;; Try to resume immediately after loading (storage) modules
|
|
|
|
|
;; but before any on-disk file systems have been mounted.
|
|
|
|
|
(false-if-exception ; failure is not fatal
|
|
|
|
|
(resume-if-hibernated (find-long-option "resume" args))))
|
|
|
|
|
|
2019-11-04 23:50:08 +00:00
|
|
|
|
(setenv "EXT2FS_NO_MTAB_OK" "1")
|
|
|
|
|
|
2022-02-18 05:09:05 +00:00
|
|
|
|
;; Mount the root file system.
|
|
|
|
|
(mount-root-file-system (canonicalize-device-spec
|
|
|
|
|
(file-system-device root-fs))
|
|
|
|
|
(file-system-type root-fs)
|
|
|
|
|
#:volatile-root? volatile-root?
|
|
|
|
|
#:flags (mount-flags->bit-mask
|
|
|
|
|
(file-system-flags root-fs))
|
|
|
|
|
#:options (file-system-options root-fs)
|
|
|
|
|
#:check? (check? root-fs)
|
|
|
|
|
#:skip-check-if-clean?
|
|
|
|
|
(skip-check-if-clean? root-fs)
|
|
|
|
|
#:repair (repair root-fs))
|
2019-11-04 23:50:08 +00:00
|
|
|
|
|
2021-05-23 15:02:29 +00:00
|
|
|
|
;; Mount the specified non-root file systems.
|
|
|
|
|
(for-each (lambda (fs)
|
|
|
|
|
(mount-file-system fs
|
|
|
|
|
#:check? (check? fs)
|
|
|
|
|
#:skip-check-if-clean?
|
|
|
|
|
(skip-check-if-clean? fs)
|
|
|
|
|
#:repair (repair fs)))
|
2019-11-04 23:50:08 +00:00
|
|
|
|
(remove root-mount-point? mounts))
|
|
|
|
|
|
|
|
|
|
(setenv "EXT2FS_NO_MTAB_OK" #f)
|
|
|
|
|
|
|
|
|
|
(if to-load
|
|
|
|
|
(begin
|
|
|
|
|
(switch-root "/root")
|
|
|
|
|
(format #t "loading '~a'...\n" to-load)
|
|
|
|
|
|
|
|
|
|
(primitive-load to-load)
|
|
|
|
|
|
|
|
|
|
(format (current-error-port)
|
|
|
|
|
"boot program '~a' terminated, rebooting~%"
|
|
|
|
|
to-load)
|
|
|
|
|
(sleep 2)
|
|
|
|
|
(reboot))
|
|
|
|
|
(begin
|
2022-02-18 04:28:07 +00:00
|
|
|
|
(display "no boot file passed via 'gnu.load'\n")
|
2019-11-04 23:50:08 +00:00
|
|
|
|
(display "entering a warm and cozy REPL\n")
|
|
|
|
|
(start-repl)))))
|
|
|
|
|
#:on-error on-error))
|
2014-01-29 20:57:56 +00:00
|
|
|
|
|
2020-06-01 07:46:39 +00:00
|
|
|
|
;;; linux-boot.scm ends here
|