guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

10/10: image: Add Hurd support.


From: guix-commits
Subject: 10/10: image: Add Hurd support.
Date: Sat, 23 May 2020 13:37:23 -0400 (EDT)

mothacehe pushed a commit to branch wip-hurd-vm
in repository guix.

commit 7c919d129b20c7f08b68010e961f9a77c5317bcc
Author: Mathieu Othacehe <address@hidden>
AuthorDate: Sat May 23 19:10:44 2020 +0200

    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.
---
 gnu/system/image.scm | 36 ++++++++++++++++++++++++++++++------
 1 file changed, 30 insertions(+), 6 deletions(-)

diff --git a/gnu/system/image.scm b/gnu/system/image.scm
index d121ef0..03588f7 100644
--- a/gnu/system/image.scm
+++ b/gnu/system/image.scm
@@ -43,6 +43,7 @@
   #:use-module (gnu packages genimage)
   #:use-module (gnu packages guile)
   #:autoload   (gnu packages gnupg) (guile-gcrypt)
+  #:use-module (gnu packages hurd)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages mtools)
   #:use-module ((srfi srfi-1) #:prefix srfi-1:)
@@ -54,6 +55,7 @@
   #:export (esp-partition
             root-partition
 
+            hurd-disk-image
             efi-disk-image
             iso9660-image
 
@@ -65,9 +67,13 @@
 ;;; Images definitions.
 ;;;
 
+(define root-offset (* 512 2048))
+(define root-label "Guix_image")
+
 (define esp-partition
   (partition
    (size (* 40 (expt 2 20)))
+   (offset root-offset)
    (label "GNU-ESP") ;cosmetic only
    ;; Use "vfat" here since this property is used when mounting.  The actual
    ;; FAT-ness is based on file system size (16 in this case).
@@ -78,11 +84,23 @@
 (define root-partition
   (partition
    (size 'guess)
-   (label "Guix_image")
+   (label root-label)
    (file-system "ext4")
    (flags '(boot))
    (initializer (gexp initialize-root-partition))))
 
+(define hurd-disk-image
+  (image
+   (format 'disk-image)
+   (partitions
+    (list (partition
+           (size 'guess)
+           (offset root-offset)
+           (label root-label)
+           (file-system "ext2")
+           (flags '(boot))
+           (initializer (gexp initialize-root-partition)))))))
+
 (define efi-disk-image
   (image
    (format 'disk-image)
@@ -520,10 +538,16 @@ image, depending on IMAGE format."
   "Find and return an image that could match the given FILE-SYSTEM-TYPE.  This
 is useful to adapt to interfaces written before the addition of the <image>
 record."
-  (mbegin %store-monad
-    (return
-     (match file-system-type
-       ("iso9660" iso9660-image)
-       (_ efi-disk-image)))))
+  (mlet %store-monad ((target (current-target-system)))
+    (mbegin %store-monad
+      (return
+       (match file-system-type
+         ("iso9660" iso9660-image)
+         (_ (cond
+             ((and target
+                   (hurd-triplet? target))
+              hurd-disk-image)
+             (else
+              efi-disk-image))))))))
 
 ;;; image.scm ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]