Subject: [bug#61959] [PATCH v3 1/7] gnu: Add m1n1.

From: Roman Scherer <[email-masked]>
Date: Sun, 5 Mar 2023 17:13:57 +0100

* gnu/packages/bootloaders.scm (m1n1): New variable.
---
 gnu/packages/bootloaders.scm | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index ee47a9fad7..aa2fcc03dd 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -623,6 +623,42 @@ (define-public dtc
 tree binary files.  These are board description files used by Linux and BSD.")
     (license license:gpl2+)))
 
+(define-public m1n1
+  (let ((commit "46f2811351806aafb3d56e02c107f95ac2ea85e3"))
+    (package
+      (name "m1n1")
+      (version (git-version "1.2.4" "0" commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/AsahiLinux/m1n1")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "14chrqbs57v6i5vmf643svbi3s7h4fxrxly0bby7brf3w114nmpk"))))
+      (build-system gnu-build-system)
+      (supported-systems (list "aarch64-linux"))
+      (arguments
+       (list
+        #:phases
+        #~(modify-phases %standard-phases
+            (replace 'configure
+              (lambda _
+                (setenv "RELEASE" "1")))
+            (replace 'install
+              (lambda* (#:key outputs #:allow-other-keys)
+                (let ((dir (string-append (assoc-ref outputs "out") "/libexec/")))
+                  (mkdir-p dir)
+                  (copy-file "build/m1n1.bin" (string-append dir "m1n1.bin")))))
+            ;; There are no tests
+            (delete 'check))))
+      (home-page "https://github.com/AsahiLinux/m1n1")
+      (synopsis "Boot loader and experimentation playground for Apple Silicon")
+      (description "m1n1 is the bootloader developed by the Asahi Linux project to bridge
+the Apple (XNU) boot ecosystem to the Linux boot ecosystem.")
+      (license license:expat))))
+
 (define %u-boot-rockchip-inno-usb-patch
   ;; Fix regression in 2020.10 causing freezes on boot with USB boot enabled.
   ;; See https://gitlab.manjaro.org/manjaro-arm/packages/core/uboot-rockpro64/-/issues/4
-- 
2.39.1