You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.7 KiB
65 lines
1.7 KiB
4 years ago
|
{ fetchgit, fetchurl, stdenv, m4, flex, bison, zlib, gnat, curl, writeText
|
||
|
, callPackage, lib, corebootConfig ? { CONFIG_PAYLOAD_NONE = "y"; } }:
|
||
4 years ago
|
|
||
4 years ago
|
let
|
||
|
toolchain = stdenv.mkDerivation rec {
|
||
|
pname = "coreboot-toolchain";
|
||
3 years ago
|
inherit (coreboot) version src;
|
||
|
|
||
4 years ago
|
nativeBuildInputs = [ curl stdenv m4 flex bison zlib gnat ];
|
||
3 years ago
|
|
||
4 years ago
|
buildPhase = ''
|
||
|
mkdir -p util/crossgcc/tarballs
|
||
4 years ago
|
${lib.concatMapStringsSep "\n"
|
||
|
(file: "ln -s ${file.archive} util/crossgcc/tarballs/${file.name}")
|
||
|
(callPackage ./files.nix { })}
|
||
3 years ago
|
make crossgcc-i386 CPUS=$NIX_BUILD_CORES
|
||
4 years ago
|
'';
|
||
3 years ago
|
|
||
4 years ago
|
installPhase = ''
|
||
|
cp -r util/crossgcc $out
|
||
|
'';
|
||
|
};
|
||
|
|
||
3 years ago
|
writeConfig = config: let
|
||
|
filteredConfig = lib.filterAttrs (n: v: v != null) config;
|
||
|
lines =
|
||
|
lib.mapAttrsToList (name: value: "${name}=${value}") filteredConfig;
|
||
4 years ago
|
configFile = writeText "config" (lib.concatStringsSep "\n" lines);
|
||
3 years ago
|
in configFile;
|
||
|
|
||
|
coreboot = stdenv.mkDerivation rec {
|
||
|
pname = "coreboot";
|
||
3 years ago
|
version = "4.13";
|
||
3 years ago
|
|
||
|
src = fetchgit {
|
||
|
url = "https://review.coreboot.org/coreboot.git";
|
||
|
rev = version;
|
||
3 years ago
|
sha256 = "sha256-O5udH6RAfs5IPqzvluXAApU7TDow39aOEewL5+nln3c=";
|
||
3 years ago
|
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
|