flashrom: add option for google chromebook fork

master
Adam Joseph 2 years ago
parent 6243fa9245
commit 576e50fc85

@ -1,34 +1,53 @@
{ stdenv { stdenv
, lib , lib
, fetchgit
, fetchFromGitHub , fetchFromGitHub
, installShellFiles , installShellFiles
, libftdi1 , libftdi1
, libusb1 , libusb1
, pciutils , pciutils
, pkg-config , pkg-config
# use google's out-of-tree flashrom which can manipulate the
# write-protection registers of the chromebooks' on-board flash
# chips
, forChromebook ? false
}: }:
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "flashrom"; pname = "flashrom";
version = "1.2+wp"; version = if !forChromebook then "1.2+wp" else "0.9.9+d2da98-google";
src = fetchFromGitHub { src =
owner = "flashrom"; if !forChromebook
repo = "flashrom"; then fetchFromGitHub {
rev = "cd9b7b427d19e591c1091cb783a51951ef3aeffc"; owner = "flashrom";
sha256 = "sha256-gK/z+WkEHFmT/dYnNLMn4Cb2ESBfqipc19ZVxmaZabQ="; repo = "flashrom";
}; rev = "cd9b7b427d19e591c1091cb783a51951ef3aeffc";
sha256 = "sha256-gK/z+WkEHFmT/dYnNLMn4Cb2ESBfqipc19ZVxmaZabQ=";
} else fetchgit {
url = "https://chromium.googlesource.com/chromiumos/third_party/flashrom";
rev = "d2da987986cf2b7f048174ba339907cc760b1c3d";
hash = "sha256-nB8B0MXjVpAsg4+0VvO5jqRBsmEHdllgIMkTmaBJ6gE=";
};
nativeBuildInputs = [ pkg-config installShellFiles ]; nativeBuildInputs = [ pkg-config installShellFiles ];
buildInputs = lib.optional (!stdenv.hostPlatform.isStatic) libftdi1 buildInputs = lib.optional (!stdenv.hostPlatform.isStatic) libftdi1
++ [ libusb1 pciutils ]; ++ [ libusb1 pciutils ];
patches = [ patches =
./0001-implement-wp-enable-disable-for-gigadevice-flash-chi.patch if !forChromebook then [
./0002-layout.c-allow-nested-regions.patch ./0001-implement-wp-enable-disable-for-gigadevice-flash-chi.patch
]; ./0002-layout.c-allow-nested-regions.patch
] else [
../platform/kevin/chromebook-flashrom-kludges.patch
];
makeFlags = [ "PREFIX=$(out)" "libinstall" ]; makeFlags = if !forChromebook then [
"PREFIX=$(out)" "libinstall"
] else [
"PREFIX=$(out)" "install"
];
meta = with lib; { meta = with lib; {
homepage = "https://www.flashrom.org"; homepage = "https://www.flashrom.org";

Loading…
Cancel
Save