From 5d6cff8d64affc17f5f20f26479a3daa98cf734f Mon Sep 17 00:00:00 2001 From: dish Date: Fri, 29 Aug 2025 20:51:37 -0400 Subject: [PATCH] minimal-bootstrap.stage0-posix: 1.6.0 -> 1.9.1 Gives us smaller bootstrap tarballs, better M2-Planet, and more. --- .../stage0-posix/bootstrap-sources.nix | 4 +-- .../minimal-bootstrap/stage0-posix/hex0.nix | 10 +++---- .../stage0-posix/make-bootstrap-sources.nix | 9 ------- .../stage0-posix/mescc-tools-boot.nix | 27 ++++++++++++++++++- .../stage0-posix/mescc-tools-extra/build.kaem | 4 ++- .../stage0-posix/mescc-tools/build.kaem | 15 ++++++++++- .../stage0-posix/mescc-tools/default.nix | 3 +++ .../stage0-posix/platforms.nix | 2 +- 8 files changed, 54 insertions(+), 20 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 dcf9b50da37d..87f4cced81e3 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 @@ -4,10 +4,10 @@ rec { name = "stage0-posix-${version}-source"; - version = "1.6.0"; + version = "1.9.1"; rev = "Release_${version}"; outputHashAlgo = "sha256"; - outputHash = "sha256-epUaShjKiAd749ICvc6rS6WhUkS8R4heKuPdwUjEtsQ="; + outputHash = "sha256-UNoyb2teqH26VM7YoOcazyqZ0AlDae045aWc31ZHFdw="; /* 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 661b375b8d9a..d6d509851d4d 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/hex0.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/hex0.nix @@ -12,16 +12,16 @@ let hash = { "AArch64" = "sha256-XTPsoKeI6wTZAF0UwEJPzuHelWOJe//wXg4HYO0dEJo="; - "AMD64" = "sha256-RCgK9oZRDQUiWLVkcIBSR2HeoB+Bh0czthrpjFEkCaY="; - "x86" = "sha256-QU3RPGy51W7M2xnfFY1IqruKzusrSLU+L190ztN6JW8="; + "AMD64" = "sha256-DCzZduYrix9yOeJoem/Jhz/WDzAss7UWwjZbkXJq6Ms="; + "x86" = "sha256-DFmSpy4EYoKBSuPQRqtTsUfIUjlg794PnMrEg5stOFY="; } .${stage0Arch} or (throw "Unsupported system: ${hostPlatform.system}"); - # Pinned from https://github.com/oriansj/stage0-posix/commit/3189b5f325b7ef8b88e3edec7c1cde4fce73c76c - # This 256 byte seed is the only pre-compiled binary in the bootstrap chain. + # Pinned from https://github.com/oriansj/stage0-posix/commit/45d90f5955b6907dc6cdea9ebafce558359edcd3 + # This 181 byte seed is the only pre-compiled binary in the bootstrap chain. hex0-seed = import { name = "hex0-seed"; - url = "https://github.com/oriansj/bootstrap-seeds/raw/b1263ff14a17835f4d12539226208c426ced4fba/POSIX/${stage0Arch}/hex0-seed"; + url = "https://github.com/oriansj/bootstrap-seeds/raw/cedec6b8066d1db229b6c77d42d120a23c6980ed/POSIX/${stage0Arch}/hex0-seed"; executable = true; inherit hash; }; 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 02d128fa1258..89c6ca17e3f3 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 @@ -40,15 +40,6 @@ 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 = { 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 2c968c465cc1..1c4360d67025 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 @@ -159,6 +159,7 @@ rec { "${src}/M2-Planet/cc_reader.c" "${src}/M2-Planet/cc_strings.c" "${src}/M2-Planet/cc_types.c" + "${src}/M2-Planet/cc_emit.c" "${src}/M2-Planet/cc_core.c" "${src}/M2-Planet/cc_macro.c" "${src}/M2-Planet/cc.c" @@ -298,6 +299,8 @@ rec { "-f" "${m2libc}/stddef.h" "-f" + "${m2libc}/sys/utsname.h" + "-f" "${m2libc}/${m2libcArch}/linux/unistd.c" "-f" "${m2libc}/${m2libcArch}/linux/fcntl.c" @@ -306,8 +309,12 @@ rec { "-f" "${m2libc}/${m2libcArch}/linux/sys/stat.c" "-f" + "${m2libc}/ctype.c" + "-f" "${m2libc}/stdlib.c" "-f" + "${m2libc}/stdarg.h" + "-f" "${m2libc}/stdio.h" "-f" "${m2libc}/stdio.c" @@ -379,14 +386,20 @@ rec { "-f" "${m2libc}/stddef.h" "-f" + "${m2libc}/sys/utsname.h" + "-f" "${m2libc}/${m2libcArch}/linux/fcntl.c" "-f" "${m2libc}/fcntl.c" "-f" "${m2libc}/${m2libcArch}/linux/unistd.c" "-f" + "${m2libc}/stdarg.h" + "-f" "${m2libc}/string.c" "-f" + "${m2libc}/ctype.c" + "-f" "${m2libc}/stdlib.c" "-f" "${m2libc}/stdio.h" @@ -456,6 +469,8 @@ rec { "-f" "${m2libc}/stddef.h" "-f" + "${m2libc}/sys/utsname.h" + "-f" "${m2libc}/${m2libcArch}/linux/unistd.c" "-f" "${m2libc}/${m2libcArch}/linux/fcntl.c" @@ -464,8 +479,12 @@ rec { "-f" "${m2libc}/${m2libcArch}/linux/sys/stat.c" "-f" + "${m2libc}/ctype.c" + "-f" "${m2libc}/stdlib.c" "-f" + "${m2libc}/stdarg.h" + "-f" "${m2libc}/stdio.h" "-f" "${m2libc}/stdio.c" @@ -537,7 +556,7 @@ rec { "-f" "${m2libc}/stddef.h" "-f" - "${m2libc}/string.c" + "${m2libc}/sys/utsname.h" "-f" "${m2libc}/${m2libcArch}/linux/unistd.c" "-f" @@ -545,8 +564,14 @@ rec { "-f" "${m2libc}/fcntl.c" "-f" + "${m2libc}/ctype.c" + "-f" "${m2libc}/stdlib.c" "-f" + "${m2libc}/string.c" + "-f" + "${m2libc}/stdarg.h" + "-f" "${m2libc}/stdio.h" "-f" "${m2libc}/stdio.c" diff --git a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools-extra/build.kaem b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools-extra/build.kaem index fb27eccab830..42d43dff9486 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools-extra/build.kaem +++ b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools-extra/build.kaem @@ -1,5 +1,5 @@ # This is a modified version of mescc-tools-extra/mescc-tools-extra.kaem -# https://github.com/oriansj/mescc-tools-extra/blob/ec53af69d6d2119b47b369cd0ec37ac806e7ad60/mescc-tools-extra.kaem +# https://github.com/oriansj/mescc-tools-extra/blob/56e6b8df3e95f4bc04f8b420a4cd8c82c70b9efa/mescc-tools-extra.kaem # - Paths to build inputs have been changed for nix # - Added additional step to create $out directory @@ -32,8 +32,10 @@ CC mkdir.c -o ${out}/bin/mkdir CC untar.c -o ${out}/bin/untar CC ungz.c -o ${out}/bin/ungz CC unbz2.c -o ${out}/bin/unbz2 +CC unxz.c -o ${out}/bin/unxz CC catm.c -o ${out}/bin/catm CC cp.c -o ${out}/bin/cp CC chmod.c -o ${out}/bin/chmod CC rm.c -o ${out}/bin/rm CC replace.c -o ${out}/bin/replace +CC wrap.c -o ${out}/bin/wrap diff --git a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools/build.kaem b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools/build.kaem index 128ff360fd2c..0a374c1a0674 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools/build.kaem +++ b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools/build.kaem @@ -1,5 +1,5 @@ # This is a modified version of stage0-posix/x86/mescc-tools-full-kaem.kaem -# https://github.com/oriansj/stage0-posix-x86/blob/56e6b8df3e95f4bc04f8b420a4cd8c82c70b9efa/mescc-tools-full-kaem.kaem +# https://github.com/oriansj/stage0-posix-x86/blob/3b9c2bb6d4155e4f2e5f642b5e0f59255dfc5934/mescc-tools-full-kaem.kaem # - Paths to build inputs have been changed for nix # Mes --- Maxwell Equations of Software @@ -51,9 +51,12 @@ ${M2} --architecture ${m2libcArch} \ -f ${m2libc}/stddef.h \ -f ${m2libc}/${m2libcArch}/linux/fcntl.c \ -f ${m2libc}/fcntl.c \ + -f ${m2libc}/sys/utsname.h \ -f ${m2libc}/${m2libcArch}/linux/unistd.c \ -f ${m2libc}/${m2libcArch}/linux/sys/stat.c \ + -f ${m2libc}/ctype.c \ -f ${m2libc}/stdlib.c \ + -f ${m2libc}/stdarg.h \ -f ${m2libc}/stdio.h \ -f ${m2libc}/stdio.c \ -f ${m2libc}/string.c \ @@ -95,8 +98,11 @@ ${M2} --architecture ${m2libcArch} \ -f ${m2libc}/stddef.h \ -f ${m2libc}/${m2libcArch}/linux/fcntl.c \ -f ${m2libc}/fcntl.c \ + -f ${m2libc}/sys/utsname.h \ -f ${m2libc}/${m2libcArch}/linux/unistd.c \ + -f ${m2libc}/ctype.c \ -f ${m2libc}/stdlib.c \ + -f ${m2libc}/stdarg.h \ -f ${m2libc}/stdio.h \ -f ${m2libc}/stdio.c \ -f ${m2libc}/bootstrappable.c \ @@ -133,10 +139,13 @@ ${hex2} --architecture ${m2libcArch} \ ${M2} --architecture ${m2libcArch} \ -f ${m2libc}/sys/types.h \ -f ${m2libc}/stddef.h \ + -f ${m2libc}/sys/utsname.h \ -f ${m2libc}/${m2libcArch}/linux/unistd.c \ -f ${m2libc}/${m2libcArch}/linux/fcntl.c \ -f ${m2libc}/fcntl.c \ + -f ${m2libc}/ctype.c \ -f ${m2libc}/stdlib.c \ + -f ${m2libc}/stdarg.h \ -f ${m2libc}/stdio.h \ -f ${m2libc}/stdio.c \ -f ${m2libc}/bootstrappable.c \ @@ -168,10 +177,13 @@ ${hex2} --architecture ${m2libcArch} \ ${M2} --architecture ${m2libcArch} \ -f ${m2libc}/sys/types.h \ -f ${m2libc}/stddef.h \ + -f ${m2libc}/sys/utsname.h \ -f ${m2libc}/${m2libcArch}/linux/unistd.c \ -f ${m2libc}/${m2libcArch}/linux/fcntl.c \ -f ${m2libc}/fcntl.c \ + -f ${m2libc}/ctype.c \ -f ${m2libc}/stdlib.c \ + -f ${m2libc}/stdarg.h \ -f ${m2libc}/stdio.h \ -f ${m2libc}/stdio.c \ -f ${m2libc}/bootstrappable.c \ @@ -180,6 +192,7 @@ ${M2} --architecture ${m2libcArch} \ -f ${src}/M2-Planet/cc_reader.c \ -f ${src}/M2-Planet/cc_strings.c \ -f ${src}/M2-Planet/cc_types.c \ + -f ${src}/M2-Planet/cc_emit.c \ -f ${src}/M2-Planet/cc_core.c \ -f ${src}/M2-Planet/cc_macro.c \ -f ${src}/M2-Planet/cc.c \ diff --git a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools/default.nix index b1027a29a5a4..3ba72657cdb0 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools/default.nix @@ -33,11 +33,14 @@ let ''${M2} --architecture ${m2libcArch} \ -f ''${m2libc}/sys/types.h \ -f ''${m2libc}/stddef.h \ + -f ''${m2libc}/sys/utsname.h \ -f ''${m2libc}/${m2libcArch}/linux/fcntl.c \ -f ''${m2libc}/fcntl.c \ -f ''${m2libc}/${m2libcArch}/linux/unistd.c \ -f ''${m2libc}/${m2libcArch}/linux/sys/stat.c \ + -f ''${m2libc}/ctype.c \ -f ''${m2libc}/stdlib.c \ + -f ''${m2libc}/stdarg.h \ -f ''${m2libc}/stdio.h \ -f ''${m2libc}/stdio.c \ -f ''${m2libc}/string.c \ 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 fb96f91fa917..15a84ad5d568 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/platforms.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/platforms.nix @@ -26,7 +26,7 @@ rec { # Passed to M2-Mesoplanet as --operating-system m2libcOS = - if hostPlatform.isLinux then "linux" else throw "Unsupported system: ${hostPlatform.system}"; + if hostPlatform.isLinux then "Linux" else throw "Unsupported system: ${hostPlatform.system}"; baseAddress = {