flashrom: 1.3.0 -> 1.5.1
I cherry-picked the commits from https://github.com/NixOS/nixpkgs/pull/330581 and then added the 1.5.1 update on top. We can drop the darwin patch since the affected code is only present in the tests and those don't work on darwin anyway, so we can better just don't compile them at all on that platform. On Linux we do compile and now also run the tests.
This commit is contained in:
@@ -1,50 +0,0 @@
|
||||
From ba84c4aba56420315973026288e7b336006336a9 Mon Sep 17 00:00:00 2001
|
||||
From: edef <edef@edef.eu>
|
||||
Date: Tue, 30 Jul 2024 03:14:37 +0000
|
||||
Subject: [PATCH] tests/erase: parenthesize braced initializer
|
||||
|
||||
memcpy is a macro on Darwin, and thus requires braced initializer lists
|
||||
to be parenthesized.
|
||||
---
|
||||
tests/erase_func_algo.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/tests/erase_func_algo.c b/tests/erase_func_algo.c
|
||||
index 576923f8..b13ee70c 100644
|
||||
--- a/tests/erase_func_algo.c
|
||||
+++ b/tests/erase_func_algo.c
|
||||
@@ -1233,13 +1233,13 @@ static void erase_unwritable_regions_skipflag_on_test_success(void **state)
|
||||
|
||||
// This test needs special block erase to emulate protected regions.
|
||||
memcpy(g_test_erase_injector,
|
||||
- (erasefunc_t *const[]){
|
||||
+ ((erasefunc_t *const[]){
|
||||
block_erase_chip_with_protected_region_1,
|
||||
block_erase_chip_with_protected_region_2,
|
||||
block_erase_chip_with_protected_region_3,
|
||||
block_erase_chip_with_protected_region_4,
|
||||
block_erase_chip_with_protected_region_5,
|
||||
- },
|
||||
+ }),
|
||||
sizeof(g_test_erase_injector)
|
||||
);
|
||||
|
||||
@@ -1322,13 +1322,13 @@ static void write_unwritable_regions_skipflag_on_test_success(void **state) {
|
||||
|
||||
// This test needs special block erase to emulate protected regions.
|
||||
memcpy(g_test_erase_injector,
|
||||
- (erasefunc_t *const[]){
|
||||
+ ((erasefunc_t *const[]){
|
||||
block_erase_chip_with_protected_region_1,
|
||||
block_erase_chip_with_protected_region_2,
|
||||
block_erase_chip_with_protected_region_3,
|
||||
block_erase_chip_with_protected_region_4,
|
||||
block_erase_chip_with_protected_region_5,
|
||||
- },
|
||||
+ }),
|
||||
sizeof(g_test_erase_injector)
|
||||
);
|
||||
|
||||
--
|
||||
2.45.2
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
libftdi1,
|
||||
libjaylink,
|
||||
libusb1,
|
||||
openssl,
|
||||
meson,
|
||||
ninja,
|
||||
pciutils,
|
||||
@@ -17,24 +18,21 @@
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "flashrom";
|
||||
version = "1.4.0";
|
||||
version = "1.5.1";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://download.flashrom.org/releases/flashrom-${version}.tar.xz";
|
||||
hash = "sha256-rX7htJI5xvtPj1XjZwb81zFDXbGkvS+rPYDx9yUIzO4=";
|
||||
url = "https://download.flashrom.org/releases/flashrom-v${version}.tar.xz";
|
||||
hash = "sha256-H5NLB27UnqziA2Vewkn8eGGmuOh/5K73MuR7bkhbYpM=";
|
||||
};
|
||||
|
||||
patches =
|
||||
[
|
||||
# Release notes for 1.4.0 state that Promontory chipsets are unsupported, and that attempting to read flash on those systems may crash the system.
|
||||
# The patch that removes this (broken) support only made it into the 1.3.0 release, seemingly by mistake, and the relevant code has been essentially untouched since.
|
||||
# We cherry-pick the upstream patch from 1.3.0, though amended to reference the relevant bug in the error message, rather than requesting the user email upstream.
|
||||
# https://ticket.coreboot.org/issues/370
|
||||
# https://review.coreboot.org/c/flashrom/+/68824
|
||||
./0001-sb600spi.c-Drop-Promontory-support.patch
|
||||
]
|
||||
# Darwin's memcpy is a macro, and requires braced initializer lists to be parenthesized
|
||||
++ lib.optional stdenv.isDarwin ./0002-tests-erase-parenthesize-braced-initializer.patch;
|
||||
patches = [
|
||||
# Release notes for 1.4.0 state that Promontory chipsets are unsupported, and that attempting to read flash on those systems may crash the system.
|
||||
# The patch that removes this (broken) support only made it into the 1.3.0 release, seemingly by mistake, and the relevant code has been essentially untouched since.
|
||||
# We cherry-pick the upstream patch from 1.3.0, though amended to reference the relevant bug in the error message, rather than requesting the user email upstream.
|
||||
# https://ticket.coreboot.org/issues/370
|
||||
# https://review.coreboot.org/c/flashrom/+/68824
|
||||
./0001-sb600spi.c-Drop-Promontory-support.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
meson
|
||||
@@ -45,11 +43,12 @@ stdenv.mkDerivation rec {
|
||||
];
|
||||
buildInputs =
|
||||
[
|
||||
openssl
|
||||
cmocka
|
||||
libftdi1
|
||||
libusb1
|
||||
]
|
||||
++ lib.optionals (!stdenv.isDarwin) [ pciutils ]
|
||||
++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ pciutils ]
|
||||
++ lib.optional jlinkSupport libjaylink;
|
||||
|
||||
postPatch = ''
|
||||
@@ -57,6 +56,14 @@ stdenv.mkDerivation rec {
|
||||
--replace 'GROUP="plugdev"' 'TAG+="uaccess", TAG+="udev-acl"'
|
||||
'';
|
||||
|
||||
mesonFlags = [
|
||||
(lib.mesonOption "programmer" "auto")
|
||||
(lib.mesonEnable "man-pages" true)
|
||||
(lib.mesonEnable "tests" (!stdenv.buildPlatform.isDarwin))
|
||||
];
|
||||
|
||||
doCheck = !stdenv.hostPlatform.isDarwin;
|
||||
|
||||
postInstall = ''
|
||||
install -Dm644 $NIX_BUILD_TOP/$sourceRoot/util/flashrom_udev.rules $out/lib/udev/rules.d/flashrom.rules
|
||||
'';
|
||||
|
||||
Reference in New Issue
Block a user