Skip to content

Commit

Permalink
Merge pull request #2 from kborling/feature/bootloader
Browse files Browse the repository at this point in the history
U-Boot Bootloader
  • Loading branch information
kborling authored Jan 1, 2023
2 parents 17a3d9c + bb137ad commit 459c0f1
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 23 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Experiment to have Guix System run on Apple Silicon hardware with the help of As
- [x] Create package for Asahi Linux kernel.
- [x] Create package that contains base OS installer.
- [x] Add script to generate `.iso` files from installer.
- [ ] Create u-boot bootloader package that builds https://github.com/AsahiLinux/u-boot
- [ ] Add necessary firmware, packages, and configurations.
- [ ] Generate `.iso` containing Base OS + Asahi Linux kernel.
- [ ] Install `.iso` after installing Asahi: 'UEFI environment only (m1n1 + U-Boot + ESP)'.
Expand Down
109 changes: 86 additions & 23 deletions asahi64.scm
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#:use-module (guix licenses)
#:use-module (guix build-system gnu)
#:use-module (gnu bootloader)
#:use-module (gnu bootloader grub)
#:use-module (gnu bootloader u-boot)
#:use-module (gnu image)
#:use-module (gnu packages certs)
Expand All @@ -12,6 +13,7 @@
#:use-module (gnu packages curl)
#:use-module (gnu packages emacs)
#:use-module (gnu packages linux)
#:use-module (gnu packages bootloaders)
#:use-module (gnu packages package-management)
#:use-module (guix platforms arm)
#:use-module (gnu services)
Expand All @@ -28,32 +30,93 @@

(define-public asahi-linux
(package
(inherit linux-libre-arm64-generic)
(name "asahi-linux")
(version "asahi-6.1-2")
(source (origin
(method url-fetch)
(uri (string-append
"https://github.com/AsahiLinux/linux/archive/refs/tags/"
version ".tar.gz"))
(sha256
(base32
"03n6l5grlxmkl3nznhz14846pqpq9z9ql1d1011192fx2d55c253"))))
(license gpl2)
(home-page "https://github.com/AsahiLinux/kernel")
(synopsis "The Asahi Linux kernel")
(description "The Asahi Linux kernel is a Linux kernel distribution based on the upstream Linux kernel, with additional patches and modifications for better support on certain devices.")))
(inherit linux-libre-arm64-generic)
(name "asahi-linux")
(version "asahi-6.1-2")
(source (origin
(method url-fetch)
(uri (string-append
"https://github.com/AsahiLinux/linux/archive/refs/tags/"
version ".tar.gz"))
(sha256
(base32
"03n6l5grlxmkl3nznhz14846pqpq9z9ql1d1011192fx2d55c253"))))
(license gpl2)
(home-page "https://github.com/AsahiLinux/kernel")
(synopsis "The Asahi Linux kernel")
(description "The Asahi Linux kernel is a Linux kernel distribution based on the upstream Linux kernel, with additional patches and modifications for better support on certain devices.")))

(define-public u-boot-asahi
(let ((base (make-u-boot-package "Asahi_Linux"
"aarch64-linux"
#:append-description "This version is for
Asahi Linux.")))
(package
(inherit base)
(version "asahi-v2022.10-1")
(source (origin
(method url-fetch)
(uri (string-append
"https://github.com/AsahiLinux/u-boot/archive/refs/tags/"
version ".tar.gz"))
(sha256
(base32
"02x90h89p1kv3d29mdhq22a88m68w4m1cwb45gj0rr85i2z8mqjq"))))
(build-system gnu-build-system)
(arguments
`(#:phases
(modify-phases %standard-phases
(replace 'build
(lambda* (#:key (make-flags '()) #:allow-other-keys)
(invoke "make" "apple_m1_defconfig")
(invoke "make" "-j$(nproc)")))))))))

;; Bootloader definition
(define-public u-boot-asahi-bootloader
(bootloader
(inherit u-boot-bootloader)
(package u-boot-asahi)))

(define asahi64-barebones-os
(operating-system
(inherit installation-os)
(kernel asahi-linux)
(services
(cons*
(operating-system-user-services installation-os)))
(packages
(append (list git curl nano emacs)
(operating-system-packages installation-os)))))
;; (inherit installation-os)
(host-name "asahi")
(timezone "America/New_York")
(locale "en_US.utf8")

(kernel asahi-linux)
(initrd-modules '())
;; TODO: Add firmware
(bootloader (bootloader-configuration
(bootloader u-boot-asahi-bootloader)
(targets '("/boot/efi"))
(terminal-outputs '(console))))
;; (bootloader (bootloader-configuration
;; (bootloader u-boot-test)
;; (targets '("/dev/sda"))))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
(mount-point "/")
(type "ext4"))
%base-file-systems))

;; (services
;; (cons*
;; (operating-system-user-services installation-os)))
(services (cons*
(service agetty-service-type
(agetty-configuration
(extra-options '("-L")) ; no carrier detect
(baud-rate "115200")
(term "vt100")
(tty "ttyS0")))
(service dhcp-client-service-type)
(service ntp-service-type)
%base-services))
(packages
(append (list git curl nano emacs nss-certs)
%base-packages))))
;; (operating-system-packages installation-os)))))

(define asahi64-image-type
(image-type
Expand Down
Empty file modified build-iso.sh
100644 → 100755
Empty file.

0 comments on commit 459c0f1

Please sign in to comment.