You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.3 KiB
Nix

{ lib
, stdenv
, pkg-config
, fetchFromGitHub
, boardName ? "kevin"
}:
let makeTarget = "build/${boardName}/util/ectool";
in stdenv.mkDerivation {
pname = "ectool";
version = "1d2c13";
src = fetchFromGitHub {
owner = "coreboot";
repo = "chrome-ec";
rev = "1d2c13a1630a1a6222411e1c03186cb9b1f576e0";
hash = "sha256-xcZQeCEp0q3Wf5XYCY5EtnoIRziu7IA5AYv0ZyXShGk=";
};
postPatch = ''
patchShebangs .
'';
enableParallelBuilding = true;
makeFlags = [
"BOARD=${boardName}"
# ectool's Makefile gets confused when nixpkgs sets $out
"out=build/${boardName}"
# ectool's terminology is crazy; they call the buildPlatform
# HOST and they call the hostPlatform BOARD:
"HOSTCC=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"
"HOSTCPP=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++"
# they also use CROSS_COMPILE for the targetPrefix of the
# platform on which `ectool` runs:
"CROSS_COMPILE=${stdenv.cc.targetPrefix}"
# crusty old codebase, new compiler
"EXTRA_CFLAGS=-w -Wno-error -Wno-address-of-packed-member"
#"V=1"
makeTarget
];
installPhase = ''
mkdir -p $out/bin
mv ${makeTarget} $out/bin/
'';
meta = with lib; {
description = "Communicate with Chromebooks' Embedded Controller (EC)";
};
}