summaryrefslogtreecommitdiff
path: root/gnu/system
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/system')
-rw-r--r--gnu/system/hurd.scm2
-rw-r--r--gnu/system/image.scm13
-rw-r--r--gnu/system/images/unmatched.scm102
-rw-r--r--gnu/system/linux-container.scm21
-rw-r--r--gnu/system/shadow.scm4
-rw-r--r--gnu/system/uuid.scm2
6 files changed, 130 insertions, 14 deletions
diff --git a/gnu/system/hurd.scm b/gnu/system/hurd.scm
index 558d1ee9e3..387605ec4f 100644
--- a/gnu/system/hurd.scm
+++ b/gnu/system/hurd.scm
@@ -57,7 +57,7 @@
;;; Code:
(define %hurd-default-operating-system-kernel
- (if (hurd-system?)
+ (if (system-hurd?)
gnumach
;; A cross-built GNUmach does not work
(with-parameters ((%current-system "i686-linux")
diff --git a/gnu/system/image.scm b/gnu/system/image.scm
index afef79185f..81346495c2 100644
--- a/gnu/system/image.scm
+++ b/gnu/system/image.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2022 Pavel Shlyak <p.shlyak@pantherx.org>
;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
;;; Copyright © 2022 Alex Griffin <a@ajgrf.com>
+;;; Copyright © 2023 Efraim Flashner <efraim@flashner.co.il>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -390,6 +391,9 @@ used in the image."
((or (string=? file-system "vfat")
(string=? file-system "fat16")
(string=? file-system "fat32")) "F")
+ ((and (string=? file-system "unformatted")
+ (partition-uuid partition))
+ (uuid->string (partition-uuid partition)))
(else
(raise (condition
(&message
@@ -414,7 +418,14 @@ used in the image."
(with-imported-modules*
(let ((initializer (or #$(partition-initializer partition)
initialize-root-partition))
- (inputs '#+(list e2fsprogs fakeroot dosfstools mtools))
+ (inputs '#+(cond
+ ((string-prefix? "ext" type)
+ (list e2fsprogs fakeroot))
+ ((or (string=? type "vfat")
+ (string-prefix? "fat" type))
+ (list dosfstools fakeroot mtools))
+ (else
+ '())))
(image-root "tmp-root"))
(sql-schema #$schema)
diff --git a/gnu/system/images/unmatched.scm b/gnu/system/images/unmatched.scm
new file mode 100644
index 0000000000..d40a32f184
--- /dev/null
+++ b/gnu/system/images/unmatched.scm
@@ -0,0 +1,102 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Efraim Flashner <efraim@flashner.co.il>
+;;;
+;;; 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/>.
+
+(define-module (gnu system images unmatched)
+ #:use-module (gnu bootloader)
+ #:use-module (gnu bootloader u-boot)
+ #:use-module (gnu image)
+ #:use-module (gnu packages linux)
+ #:use-module (gnu services)
+ #:use-module (gnu services base)
+ #:use-module (gnu services networking)
+ #:use-module (gnu system)
+ #:use-module (gnu system file-systems)
+ #:use-module (gnu system image)
+ #:use-module (guix platforms riscv)
+ #:use-module (srfi srfi-26)
+ #:export (unmatched-barebones-os
+ unmatched-image-type
+ unmatched-barebones-raw-image))
+
+(define unmatched-barebones-os
+ (operating-system
+ (host-name "unmatched")
+ (timezone "Asia/Jerusalem")
+ (locale "en_US.utf8")
+ (bootloader (bootloader-configuration
+ (bootloader u-boot-sifive-unmatched-bootloader)
+ (targets '("/dev/vda"))))
+ (initrd-modules '())
+ (kernel linux-libre-riscv64-generic)
+ (file-systems (cons (file-system
+ (device (file-system-label "my-root"))
+ (mount-point "/")
+ (type "ext4"))
+ %base-file-systems))
+ (services
+ (append (list (service agetty-service-type
+ (agetty-configuration
+ (extra-options '("-L")) ; no carrier detect
+ (baud-rate "115200")
+ (term "vt100")
+ (tty "ttySIF0")))
+ (service dhcp-client-service-type))
+ %base-services))))
+
+(define unmatched-disk-image
+ (image-without-os
+ (format 'disk-image)
+ (partition-table-type 'gpt)
+ ;; https://source.denx.de/u-boot/u-boot/-/blob/master/doc/board/sifive/unmatched.rst
+ ;; The boot process goes:
+ ;; * zero-stage bootloader (ZSBL) in ROM and first-stage bootloader (FSBL)
+ ;; together perform the SoC initialization and hand off to the next stage.
+ ;; * BBL (Berkeley bootloader) takes the device-tree and brings up the rest
+ ;; of the board, then boots the desired operating system.
+ (partitions (list
+ (partition
+ ;; Special UUID for HiFive first-stage bootloader (FSBL).
+ (size (* 1 (expt 2 20)))
+ (label "spl")
+ (offset (* 34 512))
+ (file-system "unformatted")
+ (uuid (uuid "5b193300-fc78-40cd-8002-e86c45580b47")))
+ (partition
+ ;; Specific offset for compatibility with the defaults for
+ ;; u-boot SPL. Special UUID for HiFive BBL (Berkeley bootloader).
+ (size (* 4 (expt 2 20)))
+ (label "uboot")
+ (offset (* 2082 512))
+ (file-system "unformatted")
+ (uuid (uuid "2e54b353-1271-4842-806f-e436d6af6985")))
+ root-partition))))
+
+(define unmatched-image-type
+ (image-type
+ (name 'unmatched-raw)
+ (constructor (cut image-with-os unmatched-disk-image <>))))
+
+(define unmatched-barebones-raw-image
+ (image
+ (inherit
+ (os+platform->image unmatched-barebones-os riscv64-linux
+ #:type unmatched-image-type))
+ (name 'unmatched-barebones-raw-image)))
+
+;; Return the default image.
+unmatched-barebones-raw-image
diff --git a/gnu/system/linux-container.scm b/gnu/system/linux-container.scm
index 409386a84f..7c45dbccaf 100644
--- a/gnu/system/linux-container.scm
+++ b/gnu/system/linux-container.scm
@@ -150,15 +150,18 @@ containerized OS. EXTRA-FILE-SYSTEMS is a list of file systems to add to OS."
(essential-services (container-essential-services
this-operating-system
#:shared-network? shared-network?))
- (services (append (remove (lambda (service)
- (memq (service-kind service)
- services-to-drop))
- (modify-services (operating-system-user-services os)
- (nscd-service-type
- config => (nscd-configuration
- (inherit config)
- (caches %nscd-container-caches)))))
- services-to-add))
+ (services
+ (append services-to-add
+ (filter-map (lambda (s)
+ (cond ((memq (service-kind s) services-to-drop)
+ #f)
+ ((eq? nscd-service-type (service-kind s))
+ (service nscd-service-type
+ (nscd-configuration
+ (inherit (service-value s))
+ (caches %nscd-container-caches))))
+ (else s)))
+ (operating-system-user-services os))))
(file-systems (append (map mapping->fs
(if shared-network?
(append %network-file-mappings mappings)
diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm
index 4a8cc87f0f..9ca1895ded 100644
--- a/gnu/system/shadow.scm
+++ b/gnu/system/shadow.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013-2020, 2022 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013-2020, 2022, 2023 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016 Alex Griffin <a@ajgrf.com>
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2020, 2023 Efraim Flashner <efraim@flashner.co.il>
@@ -458,7 +458,7 @@ the /etc/skel directory for those."
(const '(user-homes)))
(service-extension etc-service-type
etc-files)))
- (default-value #f)
+ (default-value '())
(description
"Ensure the specified user accounts and groups exist, as well
as each account home directory.")))
diff --git a/gnu/system/uuid.scm b/gnu/system/uuid.scm
index a95dc1b7d1..8f967387ad 100644
--- a/gnu/system/uuid.scm
+++ b/gnu/system/uuid.scm
@@ -209,7 +209,7 @@ ISO9660 UUID representation."
(define (ntfs-uuid->string uuid)
"Convert NTFS UUID, a 8-byte bytevector, to its string representation."
- (format #f "~{~:@(~x~)~}" (reverse (bytevector->u8-list uuid))))
+ (format #f "~{~:@(~2,'0x~)~}" (reverse (bytevector->u8-list uuid))))
(define %ntfs-uuid-rx
(make-regexp "^([[:xdigit:]]{16})$"))