summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Othacehe <othacehe@gnu.org>2020-05-23 19:10:44 +0200
committerJan Nieuwenhuizen <janneke@gnu.org>2020-06-08 13:51:18 +0200
commitc77b92859fdad2b85f0f32d920048d476a347ff0 (patch)
treeab0e9c7b878882f8643fd1e1f3bf2e481f362126
parent6cea61f2fab26716cd8c2394fc83eac9985f9d97 (diff)
image: Add Hurd support.
* gnu/system/image.scm (hurd-disk-image): New exported variable, (root-offset, root-label): new variables, (esp-partition, root-partition): adapt accordingly, (find-image): add Hurd support.
-rw-r--r--gnu/build/image.scm5
-rw-r--r--gnu/system/image.scm40
2 files changed, 40 insertions, 5 deletions
diff --git a/gnu/build/image.scm b/gnu/build/image.scm
index 14503b02ba9..fb85bd4bb85 100644
--- a/gnu/build/image.scm
+++ b/gnu/build/image.scm
@@ -161,6 +161,8 @@ deduplicates files common to CLOSURE and the rest of PREFIX."
161 references-graphs 161 references-graphs
162 (register-closures? #t) 162 (register-closures? #t)
163 system-directory 163 system-directory
164 (make-device-nodes
165 make-essential-device-nodes)
164 #:allow-other-keys) 166 #:allow-other-keys)
165 "Initialize the given ROOT directory. Use BOOTCFG and BOOTCFG-LOCATION to 167 "Initialize the given ROOT directory. Use BOOTCFG and BOOTCFG-LOCATION to
166install the bootloader configuration. 168install the bootloader configuration.
@@ -172,6 +174,9 @@ of the directory of the 'system' derivation."
172 (populate-root-file-system system-directory root) 174 (populate-root-file-system system-directory root)
173 (populate-store references-graphs root) 175 (populate-store references-graphs root)
174 176
177 ;; Populate /dev.
178 (make-device-nodes root)
179
175 (when register-closures? 180 (when register-closures?
176 (for-each (lambda (closure) 181 (for-each (lambda (closure)
177 (register-closure root 182 (register-closure root
diff --git a/gnu/system/image.scm b/gnu/system/image.scm
index f44886c137c..15dac8af579 100644
--- a/gnu/system/image.scm
+++ b/gnu/system/image.scm
@@ -43,6 +43,7 @@
43 #:use-module (gnu packages genimage) 43 #:use-module (gnu packages genimage)
44 #:use-module (gnu packages guile) 44 #:use-module (gnu packages guile)
45 #:autoload (gnu packages gnupg) (guile-gcrypt) 45 #:autoload (gnu packages gnupg) (guile-gcrypt)
46 #:use-module (gnu packages hurd)
46 #:use-module (gnu packages linux) 47 #:use-module (gnu packages linux)
47 #:use-module (gnu packages mtools) 48 #:use-module (gnu packages mtools)
48 #:use-module ((srfi srfi-1) #:prefix srfi-1:) 49 #:use-module ((srfi srfi-1) #:prefix srfi-1:)
@@ -54,6 +55,7 @@
54 #:export (esp-partition 55 #:export (esp-partition
55 root-partition 56 root-partition
56 57
58 hurd-disk-image
57 efi-disk-image 59 efi-disk-image
58 iso9660-image 60 iso9660-image
59 61
@@ -91,6 +93,26 @@
91 (flags '(boot)) 93 (flags '(boot))
92 (initializer (gexp initialize-root-partition)))) 94 (initializer (gexp initialize-root-partition))))
93 95
96(define hurd-initialize-root-partition
97 #~(lambda* (#:rest args)
98 (apply initialize-root-partition
99 (append args
100 (list #:make-device-nodes
101 make-hurd-device-nodes)))))
102
103(define hurd-disk-image
104 (image
105 (format 'disk-image)
106 (partitions
107 (list (partition
108 (size 'guess)
109 (offset root-offset)
110 (label root-label)
111 (file-system "ext2")
112 (file-system-options '("-o" "hurd" "-O" "ext_attr"))
113 (flags '(boot))
114 (initializer hurd-initialize-root-partition))))))
115
94(define efi-disk-image 116(define efi-disk-image
95 (image 117 (image
96 (format 'disk-image) 118 (format 'disk-image)
@@ -145,12 +167,14 @@
145 (with-imported-modules `(,@(source-module-closure 167 (with-imported-modules `(,@(source-module-closure
146 '((gnu build vm) 168 '((gnu build vm)
147 (gnu build image) 169 (gnu build image)
170 (gnu build linux-boot)
148 (guix store database)) 171 (guix store database))
149 #:select? not-config?) 172 #:select? not-config?)
150 ((guix config) => ,(make-config.scm))) 173 ((guix config) => ,(make-config.scm)))
151 #~(begin 174 #~(begin
152 (use-modules (gnu build vm) 175 (use-modules (gnu build vm)
153 (gnu build image) 176 (gnu build image)
177 (gnu build linux-boot)
154 (guix store database) 178 (guix store database)
155 (guix build utils)) 179 (guix build utils))
156 gexp* ...)))) 180 gexp* ...))))
@@ -525,10 +549,16 @@ image, depending on IMAGE format."
525 "Find and return an image that could match the given FILE-SYSTEM-TYPE. This 549 "Find and return an image that could match the given FILE-SYSTEM-TYPE. This
526is useful to adapt to interfaces written before the addition of the <image> 550is useful to adapt to interfaces written before the addition of the <image>
527record." 551record."
528 (mbegin %store-monad 552 (mlet %store-monad ((target (current-target-system)))
529 (return 553 (mbegin %store-monad
530 (match file-system-type 554 (return
531 ("iso9660" iso9660-image) 555 (match file-system-type
532 (_ efi-disk-image))))) 556 ("iso9660" iso9660-image)
557 (_ (cond
558 ((and target
559 (hurd-triplet? target))
560 hurd-disk-image)
561 (else
562 efi-disk-image))))))))
533 563
534;;; image.scm ends here 564;;; image.scm ends here