From 4cc18fa0a06b407d2c8ab6482271c26e49e203b1 Mon Sep 17 00:00:00 2001 From: James Calligeros Date: Mon, 24 Jun 2024 17:20:19 +1000 Subject: [PATCH 01/10] releases: specs: arm64: installcd-stage1: add Asahi specifics Signed-off-by: James Calligeros --- releases/specs/arm64/installcd-stage1.spec | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/releases/specs/arm64/installcd-stage1.spec b/releases/specs/arm64/installcd-stage1.spec index cfc31d12..978034e3 100644 --- a/releases/specs/arm64/installcd-stage1.spec +++ b/releases/specs/arm64/installcd-stage1.spec @@ -7,6 +7,7 @@ snapshot_treeish: @TREEISH@ source_subpath: 23.0-default/stage3-arm64-openrc-@TIMESTAMP@.tar.xz compression_mode: pixz portage_confdir: @REPO_DIR@/releases/portage/isos +repos: @ASAHIOVERLAY@ # Clone chadmed/asahi-overlay (GitHub) and point this to it livecd/use: alsa @@ -102,3 +103,15 @@ livecd/packages: sys-libs/gpm sys-power/acpid www-client/links + # Asahi packages from ::gentoo + sys-fs/squashfs-tools + dev-util/bindgen + dev-lang/rust-bin + virtual/rust + app-portage/gentoolkit + # Asahi packages from ::asahi + sys-apps/asahi-configs + sys-apps/asahi-scripts + sys-firmware/asahi-firmware + sys-boot/m1n1 + sys-boot/u-boot From b418dbf6dbecf2b3d318aa714a459bc187c6330e Mon Sep 17 00:00:00 2001 From: James Calligeros Date: Mon, 24 Jun 2024 17:24:51 +1000 Subject: [PATCH 02/10] releases: specs: arm64: installcd-stage2-minimal: add Asahi specifics Signed-off-by: James Calligeros --- .../specs/arm64/installcd-stage2-minimal.spec | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/releases/specs/arm64/installcd-stage2-minimal.spec b/releases/specs/arm64/installcd-stage2-minimal.spec index 9f295859..1bbe3801 100644 --- a/releases/specs/arm64/installcd-stage2-minimal.spec +++ b/releases/specs/arm64/installcd-stage2-minimal.spec @@ -6,19 +6,19 @@ profile: default/linux/arm64/23.0 snapshot_treeish: @TREEISH@ source_subpath: 23.0-default/livecd-stage1-arm64-@TIMESTAMP@.tar.xz portage_confdir: @REPO_DIR@/releases/portage/isos +repos: @ASAHIOVERLAY@ # Clone chadmed/asahi-overlay (GitHub) and point this to it livecd/bootargs: dokeymap livecd/fstype: squashfs -livecd/gk_mainargs: --all-ramdisk-modules --firmware -livecd/iso: install-arm64-minimal-@TIMESTAMP@.iso +livecd/iso: install-arm64-asahi-@TIMESTAMP@.iso livecd/type: gentoo-release-minimal -livecd/volid: Gentoo arm64 @TIMESTAMP@ +livecd/volid: Gentoo Asahi arm64 @TIMESTAMP@ -boot/kernel: gentoo +boot/kernel: asahi -boot/kernel/gentoo/sources: sys-kernel/gentoo-sources -boot/kernel/gentoo/config: @REPO_DIR@/releases/kconfig/arm64/arm64-5.15.12.config -boot/kernel/gentoo/packages: --usepkg n zfs zfs-kmod +boot/kernel/asahi/distkernel: yes +boot/kernel/asahi/sources: sys-kernel/asahi-kernel +boot/kernel/asahi/dracut_args: --xz --no-hostonly -a dmsquash-live -o btrfs -o i18n -o usrmount -o lunmask -o multipath -i /lib/keymaps /lib/keymaps -I busybox livecd/unmerge: app-admin/eselect @@ -63,6 +63,9 @@ livecd/unmerge: sys-libs/gdbm sys-kernel/genkernel sys-kernel/linux-headers + dev-util/bindgen + dev-lang/rust-bin + virtual/rust livecd/empty: /boot From 4d3c167a2705f3b0b23bc91697a7ceada5188670 Mon Sep 17 00:00:00 2001 From: James Calligeros Date: Mon, 24 Jun 2024 17:36:55 +1000 Subject: [PATCH 03/10] README: document kernel version quirk Signed-off-by: James Calligeros --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 11e03aac..3c33df1c 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,7 @@ Semi-official Gentoo Asahi Releng files Use this repo to build bootable installation media for Apple Silicon Macs. To use these builds, you need Gentoo's Catalyst tool. + +## Quirks +* The dist-kernel version string doesn't match what equery returns. You will need to move the `/lib/modules/${WHATEVER}` folder + and resume during the stage2 build until this is fixed in asahi-overlay. From aa8fff35cf81f61987d7b1956f343ce68324d153 Mon Sep 17 00:00:00 2001 From: James Calligeros Date: Tue, 25 Jun 2024 19:09:32 +1000 Subject: [PATCH 04/10] releases: specs: arm64: change stage3 path placeholder This makes it slightly easier to get stage3 automatically Signed-off-by: James Calligeros --- releases/portage/isos/package.accept_keywords/asahi | 1 + releases/specs/arm64/installcd-stage1.spec | 2 +- releases/specs/arm64/installcd-stage2-minimal.spec | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/releases/portage/isos/package.accept_keywords/asahi b/releases/portage/isos/package.accept_keywords/asahi index bf628dad..08b5cb7e 100644 --- a/releases/portage/isos/package.accept_keywords/asahi +++ b/releases/portage/isos/package.accept_keywords/asahi @@ -1,2 +1,3 @@ dev-util/bindgen ~arm64 sys-kernel/asahi-kernel ~arm64 +virtual/dist-kernel ~arm64 diff --git a/releases/specs/arm64/installcd-stage1.spec b/releases/specs/arm64/installcd-stage1.spec index 978034e3..92590a25 100644 --- a/releases/specs/arm64/installcd-stage1.spec +++ b/releases/specs/arm64/installcd-stage1.spec @@ -4,7 +4,7 @@ version_stamp: @TIMESTAMP@ rel_type: 23.0-default profile: default/linux/arm64/23.0 snapshot_treeish: @TREEISH@ -source_subpath: 23.0-default/stage3-arm64-openrc-@TIMESTAMP@.tar.xz +source_subpath: @STAGE3_PATH@ compression_mode: pixz portage_confdir: @REPO_DIR@/releases/portage/isos repos: @ASAHIOVERLAY@ # Clone chadmed/asahi-overlay (GitHub) and point this to it diff --git a/releases/specs/arm64/installcd-stage2-minimal.spec b/releases/specs/arm64/installcd-stage2-minimal.spec index 1bbe3801..e99305e7 100644 --- a/releases/specs/arm64/installcd-stage2-minimal.spec +++ b/releases/specs/arm64/installcd-stage2-minimal.spec @@ -4,7 +4,7 @@ target: livecd-stage2 rel_type: 23.0-default profile: default/linux/arm64/23.0 snapshot_treeish: @TREEISH@ -source_subpath: 23.0-default/livecd-stage1-arm64-@TIMESTAMP@.tar.xz +source_subpath: @STAGE3_PATH@ portage_confdir: @REPO_DIR@/releases/portage/isos repos: @ASAHIOVERLAY@ # Clone chadmed/asahi-overlay (GitHub) and point this to it From b2f7a4c346ee8c68d582f2a737cb810ece511fe2 Mon Sep 17 00:00:00 2001 From: James Calligeros Date: Tue, 25 Jun 2024 19:21:21 +1000 Subject: [PATCH 05/10] releases: specs: arm64: give the livecd a valid volid Signed-off-by: James Calligeros --- releases/specs/arm64/installcd-stage2-minimal.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/releases/specs/arm64/installcd-stage2-minimal.spec b/releases/specs/arm64/installcd-stage2-minimal.spec index e99305e7..950aef64 100644 --- a/releases/specs/arm64/installcd-stage2-minimal.spec +++ b/releases/specs/arm64/installcd-stage2-minimal.spec @@ -12,7 +12,7 @@ livecd/bootargs: dokeymap livecd/fstype: squashfs livecd/iso: install-arm64-asahi-@TIMESTAMP@.iso livecd/type: gentoo-release-minimal -livecd/volid: Gentoo Asahi arm64 @TIMESTAMP@ +livecd/volid: Gentoo_Asahi_arm64_@TIMESTAMP@ boot/kernel: asahi From e421133300457bca0fc10d20c84820ef786384f9 Mon Sep 17 00:00:00 2001 From: James Calligeros Date: Tue, 25 Jun 2024 19:25:50 +1000 Subject: [PATCH 06/10] releases: specs: arm64: don't install u-boot or m1n1 Signed-off-by: James Calligeros --- releases/specs/arm64/installcd-stage1.spec | 2 -- 1 file changed, 2 deletions(-) diff --git a/releases/specs/arm64/installcd-stage1.spec b/releases/specs/arm64/installcd-stage1.spec index 92590a25..1d4fcb00 100644 --- a/releases/specs/arm64/installcd-stage1.spec +++ b/releases/specs/arm64/installcd-stage1.spec @@ -113,5 +113,3 @@ livecd/packages: sys-apps/asahi-configs sys-apps/asahi-scripts sys-firmware/asahi-firmware - sys-boot/m1n1 - sys-boot/u-boot From a5e8de1eb2117b0697faf874f24e52264d5ec328 Mon Sep 17 00:00:00 2001 From: James Calligeros Date: Wed, 26 Jun 2024 20:35:03 +1000 Subject: [PATCH 07/10] releases: specs: arm64: use stage1 to bootstrap stage2 Signed-off-by: James Calligeros --- releases/specs/arm64/installcd-stage2-minimal.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/releases/specs/arm64/installcd-stage2-minimal.spec b/releases/specs/arm64/installcd-stage2-minimal.spec index 950aef64..27607685 100644 --- a/releases/specs/arm64/installcd-stage2-minimal.spec +++ b/releases/specs/arm64/installcd-stage2-minimal.spec @@ -4,7 +4,7 @@ target: livecd-stage2 rel_type: 23.0-default profile: default/linux/arm64/23.0 snapshot_treeish: @TREEISH@ -source_subpath: @STAGE3_PATH@ +source_subpath: 23.0-default/livecd-stage1-arm64-@TIMESTAMP@.tar.xz portage_confdir: @REPO_DIR@/releases/portage/isos repos: @ASAHIOVERLAY@ # Clone chadmed/asahi-overlay (GitHub) and point this to it From b21726335e9597440cb70b4575516e1f030b6000 Mon Sep 17 00:00:00 2001 From: James Calligeros Date: Wed, 26 Jun 2024 20:35:25 +1000 Subject: [PATCH 08/10] builder: add builder script Signed-off-by: James Calligeros --- builder.sh | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 builder.sh diff --git a/builder.sh b/builder.sh new file mode 100644 index 00000000..1f243fd9 --- /dev/null +++ b/builder.sh @@ -0,0 +1,67 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0-only +# Gentoo Asahi release builder + +: ${BASEDIR:="/var/tmp/catalyst"} +: ${BUILDDIR:="${BASEDIR}/builds"} +: ${VER:=$(date +'%Y%m%d')} +: ${GENTOO_MIRROR:="https://mirror.aarnet.edu.au/pub/gentoo/"} + +echo "Trying to enter ${BASEDIR}..." +cd "${BASEDIR}" + +echo "Cleaning out ${BASEDIR}..." +#rm -rf "${BASEDIR}"/* + +echo "Cloning Gentoo Asahi releng files..." +git clone https://github.com/chadmed/gentoo-asahi-releng \ + --branch=asahi \ + --depth=1 \ + --quiet \ + "${BASEDIR}/releng" + +echo "Setting up ::gentoo repo" +mkdir "${BASEDIR}"/repos +git clone https://github.com/gentoo/gentoo.git \ + --depth=1 \ + --bare \ + -c gc.reflogExpire=0 \ + -c gc.reflogExpireUnreachable=0 \ + -c gc.rerereresolved=0 \ + -c gc.rerereunresolved=0 \ + -c gc.pruneExpire=now \ + --branch=master \ + --quiet \ + "${BASEDIR}/repos/gentoo.git" +catalyst --snapshot master + +echo "Cloning ::asahi overlay" +git clone https://github.com/chadmed/asahi-overlay \ + --quiet \ + "${BASEDIR}/asahi-overlay" + +echo "Getting latest stage3 from Gentoo Mirror..." +mkdir "${BASEDIR}"/builds +stage3_line=$(curl -L "${GENTOO_MIRROR}/releases/arm64/autobuilds/current-stage3-arm64-openrc/latest-stage3-arm64-openrc.txt" | grep "stage3") +stage3_path="${BASEDIR}/builds/${stage3_line% *}" +curl -L "${GENTOO_MIRROR}/releases/arm64/autobuilds/current-stage3-arm64-openrc/${stage3_line% *}" \ + -o "${stage3_path}" -q + +echo "Setting up spec files for build..." +cp "${BASEDIR}/releng/releases/specs/arm64/"*.spec "${BASEDIR}/." +echo " Setting version timestamp to ${VER}" +sed -i "s/@TIMESTAMP@/${VER}/g" "${BASEDIR}"/*.spec +echo " Setting ::gentoo snapshot to master" +sed -i "s/@TREEISH@/master/g" "${BASEDIR}"/*.spec +echo " Setting stage3 path" +sed -i "s+@STAGE3_PATH@+${stage3_line% *}+g" "${BASEDIR}"/*.spec +echo " Setting releng repo directory" +sed -i "s+@REPO_DIR@+${BASEDIR}/releng+g" "${BASEDIR}"/*.spec +echo " Setting asahi-overlay directory" +sed -i "s+@ASAHIOVERLAY@+${BASEDIR}/asahi-overlay+g" "${BASEDIR}"/*.spec + +echo "Building stage1..." +catalyst -f installcd-stage1.spec + +echo "Building stage2 ISO..." +catalyst -f installcd-stage2-minimal.spec From 02f24d3453afd6fca26a4a2a8f10df0ce52201b4 Mon Sep 17 00:00:00 2001 From: James Calligeros Date: Sat, 29 Jun 2024 14:44:05 +1000 Subject: [PATCH 09/10] releases: specs: arm64: unmerge llvm and clang Signed-off-by: James Calligeros --- releases/specs/arm64/installcd-stage2-minimal.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/releases/specs/arm64/installcd-stage2-minimal.spec b/releases/specs/arm64/installcd-stage2-minimal.spec index 27607685..e7ee0d06 100644 --- a/releases/specs/arm64/installcd-stage2-minimal.spec +++ b/releases/specs/arm64/installcd-stage2-minimal.spec @@ -66,6 +66,8 @@ livecd/unmerge: dev-util/bindgen dev-lang/rust-bin virtual/rust + sys-devel/llvm + sys-devel/clang livecd/empty: /boot From 428f2e4e2ba55f00f45d6995baa13dd9da349b14 Mon Sep 17 00:00:00 2001 From: James Calligeros Date: Mon, 8 Jul 2024 00:13:57 +0000 Subject: [PATCH 10/10] README: remove quirk kernel-build.eclass and kernel-install.eclass changes will be merged eventually which makes this obsolete Signed-off-by: James Calligeros --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index 3c33df1c..11e03aac 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,3 @@ Semi-official Gentoo Asahi Releng files Use this repo to build bootable installation media for Apple Silicon Macs. To use these builds, you need Gentoo's Catalyst tool. - -## Quirks -* The dist-kernel version string doesn't match what equery returns. You will need to move the `/lib/modules/${WHATEVER}` folder - and resume during the stage2 build until this is fixed in asahi-overlay.