Merge pull request #259723 from emilytrau/stage0-posix-aarch64

minimal-bootstrap.stage0-posix: support aarch64-linux
This commit is contained in:
John Ericson
2023-10-08 13:26:31 -04:00
committed by GitHub
5 changed files with 24 additions and 8 deletions
@@ -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
@@ -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
@@ -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; {
@@ -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
@@ -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}");
}