aboutsummaryrefslogtreecommitdiff
path: root/pkgs/coreboot/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/coreboot/default.nix')
-rw-r--r--pkgs/coreboot/default.nix86
1 files changed, 44 insertions, 42 deletions
diff --git a/pkgs/coreboot/default.nix b/pkgs/coreboot/default.nix
index 91793f148086..cadd0a48d86a 100644
--- a/pkgs/coreboot/default.nix
+++ b/pkgs/coreboot/default.nix
@@ -2,18 +2,12 @@
, 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"
@@ -21,42 +15,50 @@ let
(callPackage ./files.nix { })}
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.12";
+
+ src = fetchgit {
+ url = "https://review.coreboot.org/coreboot.git";
+ rev = version;
+ sha256 = "sha256-35gmd1Jmf0KhLqS+jvyFNTJPSYTV01JyXvMau9cHJNA=";
+ 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