From a468f897437acfc1c70987a6df252c4735e3bf2d Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Fri, 22 Dec 2017 08:46:56 +0100 Subject: system: examples: Add missing initrd to beaglebone-black.tmpl. * gnu/system/examples/beaglebone-black.tmpl (operating-system): Add the initrd with "omap_hsmmc" as an extra-module. --- gnu/system/examples/beaglebone-black.tmpl | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gnu/system') diff --git a/gnu/system/examples/beaglebone-black.tmpl b/gnu/system/examples/beaglebone-black.tmpl index 609b801cab..4b090e0fb7 100644 --- a/gnu/system/examples/beaglebone-black.tmpl +++ b/gnu/system/examples/beaglebone-black.tmpl @@ -15,6 +15,11 @@ (bootloader (bootloader-configuration (bootloader u-boot-beaglebone-black-bootloader) (target "/dev/mmcblk1"))) + (initrd (lambda (fs . rest) + (apply base-initrd fs + ;; This module is required to mount the sd card. + #:extra-modules (list "omap_hsmmc") + rest))) (file-systems (cons (file-system (device "my-root") (title 'label) -- cgit v1.2.3 From 4ca90ff5976434a2b6e758df38df54387ae70c1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Mon, 18 Dec 2017 14:57:20 +0100 Subject: mapped-devices: Add 'location' and 'check' fields. * gnu/system/mapped-devices.scm ()[location]: New field. ()[check]: New field. --- gnu/system/mapped-devices.scm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/mapped-devices.scm b/gnu/system/mapped-devices.scm index 17cf6b7163..06178ad321 100644 --- a/gnu/system/mapped-devices.scm +++ b/gnu/system/mapped-devices.scm @@ -34,11 +34,13 @@ mapped-device-source mapped-device-target mapped-device-type + mapped-device-location mapped-device-kind mapped-device-kind? mapped-device-kind-open mapped-device-kind-close + mapped-device-kind-check device-mapping-service-type device-mapping-service @@ -58,14 +60,18 @@ mapped-device? (source mapped-device-source) ;string | list of strings (target mapped-device-target) ;string - (type mapped-device-type)) ; + (type mapped-device-type) ; + (location mapped-device-location + (default (current-source-location)) (innate))) (define-record-type* mapped-device-kind make-mapped-device-kind mapped-device-kind? (open mapped-device-kind-open) ;source target -> gexp (close mapped-device-kind-close ;source target -> gexp - (default (const #~(const #f))))) + (default (const #~(const #f)))) + (check mapped-device-kind-check ;source -> Boolean + (default (const #t)))) ;;; -- cgit v1.2.3 From 42ff7d3be642d66ba567f64882a1f2301b1a7bd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Mon, 18 Dec 2017 14:58:46 +0100 Subject: mapped-devices: 'luks-device-mapping' checks its source device. * gnu/system/mapped-devices.scm (check-luks-device): New procedure. (luks-device-mapping)[check]: New field. --- gnu/system/mapped-devices.scm | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'gnu/system') diff --git a/gnu/system/mapped-devices.scm b/gnu/system/mapped-devices.scm index 06178ad321..dbeb0d3436 100644 --- a/gnu/system/mapped-devices.scm +++ b/gnu/system/mapped-devices.scm @@ -22,12 +22,19 @@ #:use-module (guix gexp) #:use-module (guix records) #:use-module (guix modules) + #:use-module (guix i18n) + #:use-module ((guix utils) + #:select (source-properties->location + &error-location)) #:use-module (gnu services) #:use-module (gnu services shepherd) #:use-module (gnu system uuid) + #:autoload (gnu build file-systems) (find-partition-by-luks-uuid) #:autoload (gnu packages cryptsetup) (cryptsetup-static) #:autoload (gnu packages linux) (mdadm-static) #:use-module (srfi srfi-1) + #:use-module (srfi srfi-34) + #:use-module (srfi srfi-35) #:use-module (ice-9 match) #:export (mapped-device mapped-device? @@ -144,11 +151,26 @@ #~(zero? (system* #$(file-append cryptsetup-static "/sbin/cryptsetup") "close" #$target))) +(define (check-luks-device md) + "Ensure the source of MD is valid." + (let ((source (mapped-device-source md))) + (or (not (uuid? source)) + (not (zero? (getuid))) + (find-partition-by-luks-uuid (uuid-bytevector source)) + (raise (condition + (&message + (message (format #f (G_ "no LUKS partition with UUID '~a'") + (uuid->string source)))) + (&error-location + (location (source-properties->location + (mapped-device-location md))))))))) + (define luks-device-mapping ;; The type of LUKS mapped devices. (mapped-device-kind (open open-luks-device) - (close close-luks-device))) + (close close-luks-device) + (check check-luks-device))) (define (open-raid-device sources target) "Return a gexp that assembles SOURCES (a list of devices) to the RAID device -- cgit v1.2.3 From c729225b0f4fd3d7cbbc7bdbc152cf6ee228a77a Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Fri, 22 Dec 2017 08:42:29 +0100 Subject: file-systems: Do not mount hugetlb cgroup filesystem. On ARM32 without LPAE support, hugetlb control group is not supported. As it is not needed by elogind, remove it for all platforms. * gnu/system/file-systems.scm (%control-groups): Remove hugetlb from control groups platforms. --- gnu/system/file-systems.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gnu/system') diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm index 27734e892a..9de465167d 100644 --- a/gnu/system/file-systems.scm +++ b/gnu/system/file-systems.scm @@ -279,7 +279,7 @@ TARGET in the other system." ;; parent directory. (dependencies (list parent)))) '("cpuset" "cpu" "cpuacct" "memory" "devices" "freezer" - "blkio" "perf_event" "hugetlb"))))) + "blkio" "perf_event"))))) (define %elogind-file-systems ;; We don't use systemd, but these file systems are needed for elogind, -- cgit v1.2.3 From 2cf5f4c144556dd2edd45d9bc4316cf6a9a5b7b3 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Fri, 22 Dec 2017 08:43:24 +0100 Subject: file-systems: Move %control-groups from %base-file-systems to %elogind-file-systems. * gnu/system/file-systems.scm (%base-file-systems): Move %control-groups from here, to ... (%elogind-file-systems): ... here. --- gnu/system/file-systems.scm | 63 +++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 31 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm index 9de465167d..7f5afb00fe 100644 --- a/gnu/system/file-systems.scm +++ b/gnu/system/file-systems.scm @@ -284,41 +284,42 @@ TARGET in the other system." (define %elogind-file-systems ;; We don't use systemd, but these file systems are needed for elogind, ;; which was extracted from systemd. - (list (file-system - (device "none") - (mount-point "/run/systemd") - (type "tmpfs") - (check? #f) - (flags '(no-suid no-dev no-exec)) - (options "mode=0755") - (create-mount-point? #t)) - (file-system - (device "none") - (mount-point "/run/user") - (type "tmpfs") - (check? #f) - (flags '(no-suid no-dev no-exec)) - (options "mode=0755") - (create-mount-point? #t)) - ;; Elogind uses cgroups to organize processes, allowing it to map PIDs - ;; to sessions. Elogind's cgroup hierarchy isn't associated with any - ;; resource controller ("subsystem"). - (file-system - (device "cgroup") - (mount-point "/sys/fs/cgroup/elogind") - (type "cgroup") - (check? #f) - (options "none,name=elogind") - (create-mount-point? #t) - (dependencies (list (car %control-groups)))))) + (append + (list (file-system + (device "none") + (mount-point "/run/systemd") + (type "tmpfs") + (check? #f) + (flags '(no-suid no-dev no-exec)) + (options "mode=0755") + (create-mount-point? #t)) + (file-system + (device "none") + (mount-point "/run/user") + (type "tmpfs") + (check? #f) + (flags '(no-suid no-dev no-exec)) + (options "mode=0755") + (create-mount-point? #t)) + ;; Elogind uses cgroups to organize processes, allowing it to map PIDs + ;; to sessions. Elogind's cgroup hierarchy isn't associated with any + ;; resource controller ("subsystem"). + (file-system + (device "cgroup") + (mount-point "/sys/fs/cgroup/elogind") + (type "cgroup") + (check? #f) + (options "none,name=elogind") + (create-mount-point? #t) + (dependencies (list (car %control-groups))))) + %control-groups)) (define %base-file-systems ;; List of basic file systems to be mounted. Note that /proc and /sys are ;; currently mounted by the initrd. - (append (list %pseudo-terminal-file-system - %shared-memory-file-system - %immutable-store) - %control-groups)) + (list %pseudo-terminal-file-system + %shared-memory-file-system + %immutable-store)) ;; File systems for Linux containers differ from %base-file-systems in that ;; they impose additional restrictions such as no-exec or need different -- cgit v1.2.3