about summary refs log tree commit diff
path: root/pkgs/os-specific/linux/minimal-bootstrap
diff options
context:
space:
mode:
authorJohn Ericson <git@JohnEricson.me>2023-10-08 13:26:31 -0400
committerGitHub <noreply@github.com>2023-10-08 13:26:31 -0400
commitf5245f70208a95071d926be9fda1e4ca7bb6d0f6 (patch)
tree1368af7efbcf1cd5515fcb0ee2697d129971f8dd /pkgs/os-specific/linux/minimal-bootstrap
parenta7e95a4f752bf0a541fdf0819870149188bba26a (diff)
parentcc2be64b0b92e9d53ddd2e2082bc27cc8b601c87 (diff)
Merge pull request #259723 from emilytrau/stage0-posix-aarch64
minimal-bootstrap.stage0-posix: support aarch64-linux
Diffstat (limited to 'pkgs/os-specific/linux/minimal-bootstrap')
-rw-r--r--pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/bootstrap-sources.nix2
-rw-r--r--pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/hex0.nix5
-rw-r--r--pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/make-bootstrap-sources.nix8
-rw-r--r--pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools-boot.nix6
-rw-r--r--pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/platforms.nix11
5 files changed, 24 insertions, 8 deletions
diff --git a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/bootstrap-sources.nix b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/bootstrap-sources.nix
index 203b480326e94..a0663c9dbe4f9 100644
--- a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/bootstrap-sources.nix
+++ b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/bootstrap-sources.nix
@@ -7,7 +7,7 @@ rec {
   version = "unstable-2023-05-02";
   rev = "3189b5f325b7ef8b88e3edec7c1cde4fce73c76c";
   outputHashAlgo = "sha256";
-  outputHash = "sha256-FpMp7z+B3cR3LkQ+PooH/b1/NlxH8NHVJNWifaPWt4U=";
+  outputHash = "sha256-7Y9+csTwZIQp0WGbagX+Q4f2zavN7AUk1TSBp/H5Xks=";
 
   /*
   Since `make-minimal-bootstrap-sources` requires nixpkgs and nix it
diff --git a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/hex0.nix b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/hex0.nix
index 996f2f33ea350..9808e25711c15 100644
--- a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/hex0.nix
+++ b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/hex0.nix
@@ -9,8 +9,9 @@
 
 let
   hash = {
-    "x86"   = "sha256-QU3RPGy51W7M2xnfFY1IqruKzusrSLU+L190ztN6JW8=";
-    "AMD64" = "sha256-RCgK9oZRDQUiWLVkcIBSR2HeoB+Bh0czthrpjFEkCaY=";
+    "AArch64" = "sha256-XTPsoKeI6wTZAF0UwEJPzuHelWOJe//wXg4HYO0dEJo=";
+    "AMD64"   = "sha256-RCgK9oZRDQUiWLVkcIBSR2HeoB+Bh0czthrpjFEkCaY=";
+    "x86"     = "sha256-QU3RPGy51W7M2xnfFY1IqruKzusrSLU+L190ztN6JW8=";
   }.${stage0Arch} or (throw "Unsupported system: ${hostPlatform.system}");
 
   # Pinned from https://github.com/oriansj/stage0-posix/commit/3189b5f325b7ef8b88e3edec7c1cde4fce73c76c
diff --git a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/make-bootstrap-sources.nix b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/make-bootstrap-sources.nix
index 2675d055aec63..381902cd2c129 100644
--- a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/make-bootstrap-sources.nix
+++ b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/make-bootstrap-sources.nix
@@ -13,6 +13,7 @@
 
 { lib
 , fetchFromGitHub
+, fetchpatch
 }:
 
 let
@@ -37,6 +38,13 @@ fetchFromGitHub {
       $out/M2-Planet/M2libc \
       $out/mescc-tools/M2libc \
       $out/mescc-tools-extra/M2libc
+
+    # aarch64: syscall: mkdir -> mkdirat
+    # https://github.com/oriansj/M2libc/pull/17
+    patch -Np1 -d $out/M2libc -i ${(fetchpatch {
+      url = "https://github.com/oriansj/M2libc/commit/ff7c3023b3ab6cfcffc5364620b25f8d0279e96b.patch";
+      hash = "sha256-QAKddv4TixIQHpFa9SVu9fAkeKbzhQaxjaWzW2yJy7A=";
+    })}
   '';
 
   meta = with lib; {
diff --git a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools-boot.nix b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools-boot.nix
index 65f0fb4c2ff1e..2114ffc707b18 100644
--- a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools-boot.nix
+++ b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools-boot.nix
@@ -83,7 +83,11 @@ rec {
   # Phase-2b Build catm from hex2 #
   #################################
 
-  catm = run "catm" hex2-0 ["${src}/${stage0Arch}/catm_${stage0Arch}.hex2" out];
+  catm =
+    if hostPlatform.isAarch64 then
+      run "catm" hex1 ["${src}/${stage0Arch}/catm_${stage0Arch}.hex1" out]
+    else
+      run "catm" hex2-0 ["${src}/${stage0Arch}/catm_${stage0Arch}.hex2" out];
 
   # catm removes the need for cat or shell support for redirection by providing
   # equivalent functionality via catm output_file input1 input2 ... inputN
diff --git a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/platforms.nix b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/platforms.nix
index c68f7630f3dba..53147df334441 100644
--- a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/platforms.nix
+++ b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/platforms.nix
@@ -6,14 +6,16 @@
 rec {
   # meta.platforms
   platforms = [
+    "aarch64-linux"
     "i686-linux"
     "x86_64-linux"
   ];
 
   # system arch as used within the stage0 project
   stage0Arch = {
-    "i686-linux"   = "x86";
-    "x86_64-linux" = "AMD64";
+    "aarch64-linux" = "AArch64";
+    "i686-linux"    = "x86";
+    "x86_64-linux"  = "AMD64";
   }.${hostPlatform.system} or (throw "Unsupported system: ${hostPlatform.system}");
 
   # lower-case form is widely used by m2libc
@@ -23,7 +25,8 @@ rec {
   m2libcOS = if hostPlatform.isLinux then "linux" else throw "Unsupported system: ${hostPlatform.system}";
 
   baseAddress = {
-    "i686-linux"   = "0x08048000";
-    "x86_64-linux" = "0x00600000";
+    "aarch64-linux" = "0x00600000";
+    "i686-linux"    = "0x08048000";
+    "x86_64-linux"  = "0x00600000";
   }.${hostPlatform.system} or (throw "Unsupported system: ${hostPlatform.system}");
 }