add tint, nvramcui, coreinfo

wip/yesman
Milan Pässler 4 years ago
parent cff03704dd
commit 8c5f8519ba
  1. 2
      README.md
  2. 57
      flake.nix
  3. 19
      pkgs/coreboot-payload-coreinfo/default.nix
  4. 9
      pkgs/coreboot-payload-nvramcui/default.nix
  5. 21
      pkgs/coreboot-payload-tint/default.nix
  6. 15
      pkgs/coreboot/default.nix
  7. 3
      pkgs/overlay.nix

@ -15,4 +15,4 @@
*Limitations*
- currently only `x86_64-linux` host and target systems are supported
- Only GRUB2 and TianoCore payloads are supported for now
- Only GRUB2 and TianoCore primary payloads are supported for now

@ -7,33 +7,40 @@
};
description = "A collections of derivations for coreboot and payloads";
outputs = { self, nixpkgs }: {
packages.x86_64-linux = let
nixpkgsOptions = {
system = "x86_64-linux";
overlays = [
(import ./pkgs/overlay.nix)
];
};
pkgs = import nixpkgs nixpkgsOptions;
inherit (pkgs) lib;
outputs = { self, nixpkgs }: let
nixpkgsOptions = {
system = "x86_64-linux";
overlays = [
(import ./pkgs/overlay.nix)
];
};
pkgs = import nixpkgs nixpkgsOptions;
inherit (pkgs) lib;
makeDevice = configFile:
with lib.evalModules {
modules = [
({ ... }: {
nixpkgs = nixpkgsOptions;
})
("${nixpkgs}/nixos/modules/misc/assertions.nix")
("${nixpkgs}/nixos/modules/misc/nixpkgs.nix")
./modules
configFile
];
};
config.corenix.rom;
in {
inherit (pkgs) coreboot-payload-grub2 coreboot-payload-tianocore coreboot;
makeDevice = configFile: (lib.evalModules {
modules = [
({ ... }: {
nixpkgs = nixpkgsOptions;
})
("${nixpkgs}/nixos/modules/misc/assertions.nix")
("${nixpkgs}/nixos/modules/misc/nixpkgs.nix")
./modules
configFile
];
}).config.corenix.rom;
in {
lib = {
inherit makeDevice;
};
packages.x86_64-linux = {
inherit (pkgs)
coreboot
coreboot-payload-grub2
coreboot-payload-tianocore
coreboot-payload-tint
coreboot-payload-nvramcui
coreboot-payload-coreinfo;
milan-x1c = makeDevice ./configs/milan-x1c.nix;
milan-x230t = makeDevice ./configs/milan-x230t.nix;

@ -0,0 +1,19 @@
{ coreboot, lib, stdenv, writeText, coreinfoConfig ? {}, ... }:
let
filteredConfig = lib.filterAttrs (n: v: v != null) coreinfoConfig;
lines = lib.mapAttrsToList (name: value: "${name}=${value}") filteredConfig;
configFile = writeText "config" (lib.concatStringsSep "\n" lines);
in stdenv.mkDerivation rec {
pname = "coreboot-payload-coreinfo";
inherit (coreboot.drvAttrs) version src postPatch;
preConfigure = "cd payloads/coreinfo";
configurePhase = ''
runHook preConfigure
cp ${configFile} .config
make olddefconfig
runHook postConfigure
'';
installPhase = "install -D build/coreinfo.elf -t $out";
}

@ -0,0 +1,9 @@
{ coreboot, stdenv, ... }:
stdenv.mkDerivation rec {
pname = "coreboot-payload-nvramcui";
inherit (coreboot.drvAttrs) version src postPatch;
preConfigure = "cd payloads/nvramcui";
installPhase = "install -D nvramcui.elf -t $out";
}

@ -0,0 +1,21 @@
{ coreboot, stdenv, fetchurl, ... }:
# the original tint does not support building as a coreboot payload
# the patches from the coreboot repo require building tint in-tree
# this makes everything a bit more complicated here
stdenv.mkDerivation rec {
pname = "coreboot-payload-tint";
version = "0.04+nmu1";
inherit (coreboot.drvAttrs) src postPatch;
preConfigure = "cd payloads/external/tint";
preBuild = ''
tar -xf ${fetchurl {
url = "https://mirror.fsf.org/trisquel/pool/main/t/tint/tint_${version}.tar.gz";
sha256 = "17gbga1lha9yp5hpyr5vn1sc93fx413cksxmpyl8zv3b5rjvzsy1";
}}
mv tint{-${version},}
'';
installPhase = "install -D tint/tint.elf -t $out";
}

@ -52,17 +52,18 @@ in stdenv.mkDerivation rec {
pname = "coreboot";
inherit version src;
configurePhase = ''
cp ${configFile} .config
make olddefconfig
'';
buildPhase = ''
postPatch = ''
rm -rf util/crossgcc
cp -r ${toolchain} util/crossgcc
chmod u+rwX -R util/crossgcc
patchShebangs util/xcompile/xcompile
make
'';
configurePhase = ''
runHook preConfigure
cp ${configFile} .config
make olddefconfig
runHook postConfigure
'';
installPhase = ''

@ -4,4 +4,7 @@ in {
coreboot = callPackage ./coreboot {};
coreboot-payload-grub2 = callPackage ./coreboot-payload-grub2 {};
coreboot-payload-tianocore = callPackage ./coreboot-payload-tianocore {};
coreboot-payload-nvramcui = callPackage ./coreboot-payload-nvramcui {};
coreboot-payload-tint = callPackage ./coreboot-payload-tint {};
coreboot-payload-coreinfo = callPackage ./coreboot-payload-coreinfo {};
}

Loading…
Cancel
Save