aboutsummaryrefslogtreecommitdiff
path: root/infra/corenix/pkgs/coreboot/default.nix
diff options
context:
space:
mode:
authorMx Kookie <kookie@spacekookie.de>2021-01-03 17:15:41 +0100
committerMx Kookie <kookie@spacekookie.de>2021-01-03 17:15:41 +0100
commit5a380913988033c25c7240ab677dcc549327357f (patch)
tree1de1c5febb2700095bacd3a2a2f3b6a8168115d9 /infra/corenix/pkgs/coreboot/default.nix
parent01ebfa7aac8c18965df1a089c50bffcf0052e967 (diff)
parentaeac2f8adcd683ade3be74a4680d4e96f39aef49 (diff)
Merge commit 'aeac2f8adcd683ade3be74a4680d4e96f39aef49' into main
Diffstat (limited to 'infra/corenix/pkgs/coreboot/default.nix')
-rw-r--r--infra/corenix/pkgs/coreboot/default.nix88
1 files changed, 45 insertions, 43 deletions
diff --git a/infra/corenix/pkgs/coreboot/default.nix b/infra/corenix/pkgs/coreboot/default.nix
index cc0c2f39b209..d5dc4919d683 100644
--- a/infra/corenix/pkgs/coreboot/default.nix
+++ b/infra/corenix/pkgs/coreboot/default.nix
@@ -2,61 +2,63 @@
, callPackage, lib, corebootConfig ? { CONFIG_PAYLOAD_NONE = "y"; } }:
let
- version = "4.12";
- src = fetchgit {
- url = "https://review.coreboot.org/coreboot.git";
- rev = "${version}";
- fetchSubmodules = true;
- sha256 = "1l140zbvn6pkbrr55lymhi4lycimhpy8xgm45shl4zv6a9vjd66z";
- };
-
toolchain = stdenv.mkDerivation rec {
pname = "coreboot-toolchain";
- inherit version src;
+ inherit (coreboot) version src;
+
nativeBuildInputs = [ curl stdenv m4 flex bison zlib gnat ];
+
buildPhase = ''
mkdir -p util/crossgcc/tarballs
${lib.concatMapStringsSep "\n"
(file: "ln -s ${file.archive} util/crossgcc/tarballs/${file.name}")
(callPackage ./files.nix { })}
- NIX_HARDENING_ENABLE="$\{NIX_HARDENING_ENABLE/ format/\}" make crossgcc-i386 CPUS=$NIX_BUILD_CORES
+ make crossgcc-i386 CPUS=$NIX_BUILD_CORES
'';
+
installPhase = ''
cp -r util/crossgcc $out
'';
};
- writeConfig = config:
- let
- filteredConfig = lib.filterAttrs (n: v: v != null) config;
- lines =
- lib.mapAttrsToList (name: value: "${name}=${value}") filteredConfig;
+ writeConfig = config: let
+ filteredConfig = lib.filterAttrs (n: v: v != null) config;
+ lines =
+ lib.mapAttrsToList (name: value: "${name}=${value}") filteredConfig;
configFile = writeText "config" (lib.concatStringsSep "\n" lines);
- in configFile;
-
-in stdenv.mkDerivation rec {
-
- pname = "coreboot";
- inherit version src;
-
- postPatch = ''
- rm -rf util/crossgcc
- cp -r ${toolchain} util/crossgcc
- chmod u+rwX -R util/crossgcc
- patchShebangs util/xcompile/xcompile
- '';
-
- configurePhase = ''
- runHook preConfigure
- cp ${writeConfig corebootConfig} .config
- make olddefconfig
- runHook postConfigure
- '';
-
- installPhase = ''
- mkdir -p $out
- cp build/coreboot.rom $out
- '';
-
- passthru = { inherit toolchain writeConfig corebootConfig; };
-}
+ in configFile;
+
+ coreboot = stdenv.mkDerivation rec {
+ pname = "coreboot";
+ version = "4.13";
+
+ src = fetchgit {
+ url = "https://review.coreboot.org/coreboot.git";
+ rev = version;
+ sha256 = "sha256-O5udH6RAfs5IPqzvluXAApU7TDow39aOEewL5+nln3c=";
+ fetchSubmodules = true;
+ };
+
+ postPatch = ''
+ rm -rf util/crossgcc
+ cp -r ${toolchain} util/crossgcc
+ chmod u+rwX -R util/crossgcc
+ patchShebangs util/xcompile/xcompile
+ '';
+
+ configurePhase = ''
+ runHook preConfigure
+ cp ${writeConfig corebootConfig} .config
+ make olddefconfig
+ runHook postConfigure
+ '';
+
+ installPhase = ''
+ mkdir -p $out
+ cp build/coreboot.rom $out
+ '';
+
+ passthru = { inherit toolchain writeConfig corebootConfig; };
+ };
+
+in coreboot