2021-01-15 09:19:50 +00:00
|
|
|
{ lib, stdenv, fetchurl, zlib, pciutils, coreutils, acpica-tools, iasl, makeWrapper, gnugrep, gnused, file, buildEnv }:
|
2019-08-31 15:22:49 +00:00
|
|
|
|
|
|
|
let
|
2021-06-10 18:23:21 +00:00
|
|
|
version = "4.14";
|
2019-08-31 15:22:49 +00:00
|
|
|
|
2021-01-15 09:19:50 +00:00
|
|
|
commonMeta = with lib; {
|
2019-08-31 15:22:49 +00:00
|
|
|
description = "Various coreboot-related tools";
|
|
|
|
homepage = "https://www.coreboot.org";
|
|
|
|
license = licenses.gpl2;
|
2021-03-03 17:25:12 +00:00
|
|
|
maintainers = with maintainers; [ petabyteboy felixsinger ];
|
2019-08-31 15:22:49 +00:00
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
|
|
|
|
generic = { pname, path ? "util/${pname}", ... }@args: stdenv.mkDerivation (rec {
|
2020-07-18 21:56:29 +00:00
|
|
|
inherit pname version;
|
2019-08-31 15:22:49 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://coreboot.org/releases/coreboot-${version}.tar.xz";
|
2021-06-10 18:23:21 +00:00
|
|
|
sha256 = "0viw2x4ckjwiylb92w85k06b0g9pmamjy2yqs7fxfqbmfadkf1yr";
|
2019-08-31 15:22:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
cd ${path}
|
2021-06-10 18:23:21 +00:00
|
|
|
patchShebangs .
|
2019-08-31 15:22:49 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
makeFlags = [
|
|
|
|
"INSTALL=install"
|
|
|
|
"PREFIX=${placeholder "out"}"
|
|
|
|
];
|
2020-07-18 21:56:29 +00:00
|
|
|
|
|
|
|
meta = commonMeta // args.meta;
|
|
|
|
} // (removeAttrs args ["meta"]));
|
2019-08-31 15:22:49 +00:00
|
|
|
|
|
|
|
utils = {
|
|
|
|
msrtool = generic {
|
|
|
|
pname = "msrtool";
|
|
|
|
meta.description = "Dump chipset-specific MSR registers";
|
|
|
|
buildInputs = [ pciutils zlib ];
|
|
|
|
preConfigure = "export INSTALL=install";
|
|
|
|
};
|
|
|
|
cbmem = generic {
|
|
|
|
pname = "cbmem";
|
|
|
|
meta.description = "Coreboot console log reader";
|
|
|
|
};
|
|
|
|
ifdtool = generic {
|
|
|
|
pname = "ifdtool";
|
|
|
|
meta.description = "Extract and dump Intel Firmware Descriptor information";
|
|
|
|
};
|
|
|
|
intelmetool = generic {
|
|
|
|
pname = "intelmetool";
|
|
|
|
meta.description = "Dump interesting things about Management Engine";
|
|
|
|
buildInputs = [ pciutils zlib ];
|
|
|
|
};
|
|
|
|
cbfstool = generic {
|
|
|
|
pname = "cbfstool";
|
|
|
|
meta.description = "Management utility for CBFS formatted ROM images";
|
|
|
|
};
|
|
|
|
nvramtool = generic {
|
|
|
|
pname = "nvramtool";
|
|
|
|
meta.description = "Read and write coreboot parameters and display information from the coreboot table in CMOS/NVRAM";
|
|
|
|
};
|
|
|
|
superiotool = generic {
|
|
|
|
pname = "superiotool";
|
|
|
|
meta.description = "User-space utility to detect Super I/O of a mainboard and provide detailed information about the register contents of the Super I/O";
|
|
|
|
buildInputs = [ pciutils zlib ];
|
|
|
|
};
|
|
|
|
ectool = generic {
|
|
|
|
pname = "ectool";
|
|
|
|
meta.description = "Dump the RAM of a laptop's Embedded/Environmental Controller (EC)";
|
|
|
|
meta.platforms = [ "x86_64-linux" "i686-linux" ];
|
|
|
|
preInstall = "mkdir -p $out/sbin";
|
|
|
|
};
|
|
|
|
inteltool = generic {
|
|
|
|
pname = "inteltool";
|
|
|
|
meta.description = "Provides information about Intel CPU/chipset hardware configuration (register contents, MSRs, etc)";
|
|
|
|
buildInputs = [ pciutils zlib ];
|
|
|
|
};
|
|
|
|
amdfwtool = generic {
|
|
|
|
pname = "amdfwtool";
|
|
|
|
meta.description = "Create AMD firmware combination";
|
|
|
|
installPhase = "install -Dm755 amdfwtool $out/bin/amdfwtool";
|
|
|
|
};
|
|
|
|
acpidump-all = generic {
|
|
|
|
pname = "acpidump-all";
|
|
|
|
path = "util/acpi";
|
|
|
|
meta.description = "Walk through all ACPI tables with their addresses";
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
dontBuild = true;
|
|
|
|
installPhase = "install -Dm755 acpidump-all $out/bin/acpidump-all";
|
2021-01-02 23:27:49 +00:00
|
|
|
postFixup = let
|
2019-08-31 15:22:49 +00:00
|
|
|
binPath = [ coreutils acpica-tools iasl gnugrep gnused file ];
|
2021-01-15 09:19:50 +00:00
|
|
|
in "wrapProgram $out/bin/acpidump-all --set PATH ${lib.makeBinPath binPath}";
|
2019-08-31 15:22:49 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
in utils // {
|
|
|
|
coreboot-utils = (buildEnv {
|
|
|
|
name = "coreboot-utils-${version}";
|
2021-01-15 09:19:50 +00:00
|
|
|
paths = lib.attrValues utils;
|
2019-08-31 15:22:49 +00:00
|
|
|
postBuild = "rm -rf $out/sbin";
|
|
|
|
}) // {
|
2020-07-18 21:56:29 +00:00
|
|
|
inherit version;
|
|
|
|
meta = commonMeta;
|
2019-08-31 15:22:49 +00:00
|
|
|
};
|
|
|
|
}
|