about summary refs log tree commit diff
path: root/nixos/modules/apple-silicon-support/packages/uboot-asahi/default.nix
diff options
context:
space:
mode:
authorsefidel <contact@sefidel.net>2023-02-14 23:36:38 +0900
committersefidel <contact@sefidel.net>2023-02-14 23:38:29 +0900
commit748adbac7ca3452d0a1250c37ff4168d6ccf5ae0 (patch)
tree7be36fd9da46399b3a98bc1b3e9309bd3ce64fb3 /nixos/modules/apple-silicon-support/packages/uboot-asahi/default.nix
parentadf6baa00e038e49cf477160eeddc886efced2b4 (diff)
downloadnixrc-748adbac7ca3452d0a1250c37ff4168d6ccf5ae0.tar.gz
nixrc-748adbac7ca3452d0a1250c37ff4168d6ccf5ae0.zip
feat(nixos): init kompakt
Diffstat (limited to 'nixos/modules/apple-silicon-support/packages/uboot-asahi/default.nix')
-rw-r--r--nixos/modules/apple-silicon-support/packages/uboot-asahi/default.nix54
1 files changed, 54 insertions, 0 deletions
diff --git a/nixos/modules/apple-silicon-support/packages/uboot-asahi/default.nix b/nixos/modules/apple-silicon-support/packages/uboot-asahi/default.nix
new file mode 100644
index 0000000..d912631
--- /dev/null
+++ b/nixos/modules/apple-silicon-support/packages/uboot-asahi/default.nix
@@ -0,0 +1,54 @@
+{ lib
+, fetchFromGitHub
+, fetchpatch
+, buildUBoot
+, m1n1
+}:
+
+(buildUBoot rec {
+  src = fetchFromGitHub {
+    # tracking: https://github.com/AsahiLinux/PKGBUILDs/blob/stable/uboot-asahi/PKGBUILD
+    owner = "AsahiLinux";
+    repo = "u-boot";
+    rev = "asahi-v2022.10-1";
+    hash = "sha256-/dtTJ+GxC2GFlqduAa2WWPGwktLjM7tUKus6/aUyPNQ=";
+  };
+  version = "2022.10.asahi1-1";
+
+  defconfig = "apple_m1_defconfig";
+  extraMeta.platforms = [ "aarch64-linux" ];
+  filesToInstall = [
+    "u-boot-nodtb.bin.gz"
+    "m1n1-u-boot.bin"
+  ];
+  extraConfig = ''
+    CONFIG_IDENT_STRING=" ${version}"
+    CONFIG_VIDEO_FONT_4X6=n
+    CONFIG_VIDEO_FONT_8X16=n
+    CONFIG_VIDEO_FONT_SUN12X22=n
+    CONFIG_VIDEO_FONT_TER12X24=n
+    CONFIG_VIDEO_FONT_TER16X32=y
+  '';
+}).overrideAttrs (o: {
+  # nixos's downstream patches are not applicable
+  # however, we add in bigger u-boot fonts because the mac laptop screens are high-res
+  patches = [ 
+    (fetchpatch {
+      url = "https://git.alpinelinux.org/aports/plain/testing/u-boot-asahi/apritzel-first5-video.patch?id=990110f35b50b74bdb4e902d94fa15b07a8eac9e";
+      sha256 = "sha256-QPvJYxIcQBHbwsj7l96qGUZSipk1sB3ZyniD1Io18dY=";
+      revert = false;
+    })
+
+    (fetchpatch {
+      url = "https://git.alpinelinux.org/aports/plain/testing/u-boot-asahi/mps-u-boot-ter12x24.patch?id=990110f35b50b74bdb4e902d94fa15b07a8eac9e";
+      sha256 = "sha256-wrQpIYiuNRi/p2p290KCGPmuRxFEOPlbICoFvd+E8p0=";
+      revert = false;
+    })
+  ];
+
+  preInstall = ''
+    # compress so that m1n1 knows U-Boot's size and can find things after it
+    gzip -n u-boot-nodtb.bin
+    cat ${m1n1}/build/m1n1.bin arch/arm/dts/t[68]*.dtb u-boot-nodtb.bin.gz > m1n1-u-boot.bin
+  '';
+})