2021-10-07 21:43:16 +00:00
|
|
|
{ fetchurl
|
2021-11-12 17:35:25 +00:00
|
|
|
, fetchpatch
|
2021-12-04 00:09:50 +00:00
|
|
|
, stdenv
|
2021-10-07 21:43:16 +00:00
|
|
|
, installShellFiles
|
|
|
|
, lib
|
2020-02-16 20:14:13 +00:00
|
|
|
, libftdi1
|
2021-10-07 21:43:16 +00:00
|
|
|
, libjaylink
|
2020-02-16 20:14:13 +00:00
|
|
|
, libusb1
|
|
|
|
, pciutils
|
2021-10-07 21:43:16 +00:00
|
|
|
, pkg-config
|
|
|
|
, jlinkSupport ? false
|
2020-02-16 20:14:13 +00:00
|
|
|
}:
|
2014-08-28 21:27:28 +00:00
|
|
|
|
2021-12-04 00:09:50 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "flashrom";
|
2020-02-12 08:37:44 +00:00
|
|
|
version = "1.2";
|
2014-08-28 21:27:28 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2019-04-02 06:04:37 +00:00
|
|
|
url = "https://download.flashrom.org/releases/flashrom-v${version}.tar.bz2";
|
2020-02-12 08:37:44 +00:00
|
|
|
sha256 = "0ax4kqnh7kd3z120ypgp73qy1knz47l6qxsqzrfkd97mh5cdky71";
|
2014-08-28 21:27:28 +00:00
|
|
|
};
|
|
|
|
|
2021-10-07 21:43:16 +00:00
|
|
|
nativeBuildInputs = [ pkg-config installShellFiles ];
|
2021-11-12 17:35:25 +00:00
|
|
|
buildInputs = [ libftdi1 libusb1 pciutils ]
|
2021-10-07 21:43:16 +00:00
|
|
|
++ lib.optional jlinkSupport libjaylink;
|
|
|
|
|
2021-11-12 17:35:25 +00:00
|
|
|
patches = [
|
|
|
|
# remove when updating from 1.2
|
|
|
|
(fetchpatch {
|
|
|
|
name = "fix-aarch64-build.patch";
|
|
|
|
url = "https://github.com/flashrom/flashrom/commit/da6b3b70cb852dd8e9f9e21aef95fa83e7f7ab0d.patch";
|
|
|
|
sha256 = "sha256-fXYDXgT/ik+qtxxFEyJ7/axtycbwLkEg0UD+hzsYEwg=";
|
|
|
|
})
|
2021-12-04 00:09:50 +00:00
|
|
|
# fix build with gcc 10
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/flashrom/flashrom/commit/3a0c1966e4c66f91e6e8551e906b6db38002acb4.patch";
|
|
|
|
sha256 = "sha256-UfXLefMS20VUc7hk4IXECFbDWEbBnHMGSzOYemTfvjI=";
|
|
|
|
})
|
2021-11-12 17:35:25 +00:00
|
|
|
];
|
|
|
|
|
2021-06-26 01:37:52 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace util/z60_flashrom.rules \
|
|
|
|
--replace "plugdev" "flashrom"
|
|
|
|
'';
|
|
|
|
|
2021-10-07 21:43:16 +00:00
|
|
|
makeFlags = [ "PREFIX=$(out)" "libinstall" ]
|
|
|
|
++ lib.optional jlinkSupport "CONFIG_JLINK_SPI=yes";
|
2021-10-07 23:28:49 +00:00
|
|
|
|
2021-06-08 22:27:09 +00:00
|
|
|
postInstall = ''
|
2021-10-07 23:28:49 +00:00
|
|
|
install -Dm644 util/z60_flashrom.rules $out/lib/udev/rules.d/flashrom.rules
|
2021-06-08 22:27:09 +00:00
|
|
|
'';
|
|
|
|
|
2018-01-28 03:04:14 +00:00
|
|
|
meta = with lib; {
|
2021-10-07 21:43:16 +00:00
|
|
|
homepage = "https://www.flashrom.org";
|
2014-08-28 21:27:28 +00:00
|
|
|
description = "Utility for reading, writing, erasing and verifying flash ROM chips";
|
2018-01-28 03:04:14 +00:00
|
|
|
license = licenses.gpl2;
|
2021-07-01 02:54:38 +00:00
|
|
|
maintainers = with maintainers; [ funfunctor fpletz felixsinger ];
|
2020-02-16 20:14:13 +00:00
|
|
|
platforms = platforms.all;
|
2021-12-04 00:09:50 +00:00
|
|
|
broken = stdenv.isDarwin; # requires DirectHW
|
2014-08-28 21:27:28 +00:00
|
|
|
};
|
|
|
|
}
|