Commit a056c7dd authored by Emily Trau's avatar Emily Trau
Browse files

minimal-bootstrap.stage0-posix: support x86_64-linux

parent 597ed0c5
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -9,14 +9,6 @@ rec {
  outputHashAlgo = "sha256";
  outputHash = "sha256-FpMp7z+B3cR3LkQ+PooH/b1/NlxH8NHVJNWifaPWt4U=";

  # This 256 byte seed is the only pre-compiled binary in the bootstrap chain.
  hex0-seed = import <nix/fetchurl.nix> {
    name = "hex0-seed-${version}";
    url = "https://github.com/oriansj/bootstrap-seeds/raw/b1263ff14a17835f4d12539226208c426ced4fba/POSIX/x86/hex0-seed";
    hash = "sha256-QU3RPGy51W7M2xnfFY1IqruKzusrSLU+L190ztN6JW8=";
    executable = true;
  };

  /*
  Since `make-minimal-bootstrap-sources` requires nixpkgs and nix it
  will create a circular dependency if it is used in place of the
+6 −4
Original line number Diff line number Diff line
@@ -3,21 +3,23 @@
}:

lib.makeScope newScope (self: with self; {
  inherit (self.callPackage ./bootstrap-sources.nix {})
    version hex0-seed minimal-bootstrap-sources;
  inherit (callPackage ./platforms.nix { }) platforms stage0Arch m2libcArch m2libcOS baseAddress;

  inherit (self.callPackage ./bootstrap-sources.nix {}) version minimal-bootstrap-sources;

  src = minimal-bootstrap-sources;

  m2libc = src + "/M2libc";

  hex0 = callPackage ./hex0.nix { };
  inherit (self.hex0) hex0-seed;

  kaem = callPackage ./kaem { };
  kaem-minimal = callPackage ./kaem/minimal.nix { };

  stage0-posix-x86 = callPackage ./stage0-posix-x86.nix { };
  mescc-tools-boot = callPackage ./mescc-tools-boot.nix { };

  inherit (self.stage0-posix-x86) blood-elf-0 hex2 kaem-unwrapped M1 M2;
  inherit (self.mescc-tools-boot) blood-elf-0 hex2 kaem-unwrapped M1 M2;

  mescc-tools = callPackage ./mescc-tools { };

+24 −4
Original line number Diff line number Diff line
{ lib
, derivationWithMeta
, hex0-seed
, hostPlatform
, src
, version
, platforms
, stage0Arch
}:

let
  hash = {
    "x86"   = "sha256-QU3RPGy51W7M2xnfFY1IqruKzusrSLU+L190ztN6JW8=";
    "AMD64" = "sha256-RCgK9oZRDQUiWLVkcIBSR2HeoB+Bh0czthrpjFEkCaY=";
  }.${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.
  hex0-seed = import <nix/fetchurl.nix> {
    name = "hex0-seed";
    url = "https://github.com/oriansj/bootstrap-seeds/raw/b1263ff14a17835f4d12539226208c426ced4fba/POSIX/${stage0Arch}/hex0-seed";
    executable = true;
    inherit hash;
  };
in
derivationWithMeta {
  inherit version;
  pname = "hex0";
  builder = hex0-seed;
  args = [
    "${src}/x86/hex0_x86.hex0"
    "${src}/${stage0Arch}/hex0_${stage0Arch}.hex0"
    (placeholder "out")
  ];

@@ -18,11 +36,13 @@ derivationWithMeta {
    homepage = "https://github.com/oriansj/stage0-posix";
    license = licenses.gpl3Plus;
    maintainers = teams.minimal-bootstrap.members;
    platforms = [ "i686-linux" ];
    inherit platforms;
  };

  passthru = { inherit hex0-seed; };

  # Ensure the untrusted hex0-seed binary produces a known-good hex0
  outputHashMode = "recursive";
  outputHashAlgo = "sha256";
  outputHash = "sha256-QU3RPGy51W7M2xnfFY1IqruKzusrSLU+L190ztN6JW8=";
  outputHash = hash;
}
+2 −1
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
, mescc-tools
, mescc-tools-extra
, version
, platforms
}:

# Once mescc-tools-extra is available we can install kaem at /bin/kaem
@@ -46,6 +47,6 @@ derivationWithMeta {
    homepage = "https://github.com/oriansj/mescc-tools";
    license = licenses.gpl3Plus;
    maintainers = teams.minimal-bootstrap.members;
    platforms = [ "i686-linux" ];
    inherit platforms;
  };
}
+4 −2
Original line number Diff line number Diff line
@@ -3,13 +3,15 @@
, src
, hex0
, version
, platforms
, stage0Arch
}:
derivationWithMeta {
  inherit version;
  pname = "kaem-minimal";
  builder = hex0;
  args = [
    "${src}/x86/kaem-minimal.hex0"
    "${src}/${stage0Arch}/kaem-minimal.hex0"
    (placeholder "out")
  ];

@@ -18,7 +20,7 @@ derivationWithMeta {
    homepage = "https://github.com/oriansj/stage0-posix";
    license = licenses.gpl3Plus;
    maintainers = teams.minimal-bootstrap.members;
    platforms = [ "i686-linux" ];
    inherit platforms;
  };
}
Loading