summaryrefslogtreecommitdiff
path: root/sys-apps/flashrom
diff options
context:
space:
mode:
Diffstat (limited to 'sys-apps/flashrom')
-rw-r--r--sys-apps/flashrom/Manifest2
-rw-r--r--sys-apps/flashrom/files/flashrom-1.3.0_spi-master.patch285
-rw-r--r--sys-apps/flashrom/flashrom-1.3.0-r1.ebuild132
3 files changed, 419 insertions, 0 deletions
diff --git a/sys-apps/flashrom/Manifest b/sys-apps/flashrom/Manifest
index e0c6c4987b36..5f81e8b911b7 100644
--- a/sys-apps/flashrom/Manifest
+++ b/sys-apps/flashrom/Manifest
@@ -1,7 +1,9 @@
AUX flashrom-1.2_meson-fixes.patch 7977 BLAKE2B 5ac9e09c6fbcf08f36da1fc874511f7023338b0bffe775c61be9f7c253d6d8343833ec64ff86dc3b4733e90e67435e3cc0d52e6ae11c8d368fe2f21b6a85bc59 SHA512 a0e30c2a87775342302fabfd594c91015b6ea9fba71a7d1b294c399a8336167f85b07fdcc2ff80174cc43362ef5ca28965571ca52e1a76922ef59dcb15991664
AUX flashrom-1.2_meson-install-manpage.patch 1208 BLAKE2B a4290c046d82a7c8b8dbfba0d58abed2384506d761272929ca7972c68a92a314de2ad17af5bd49cb86af5fea119d36fb126c45febdd5ac99210949158d33fc75 SHA512 1345bc880317e37d028bc3d40c98e5b5b4b17c7cde18d3b17762c9792cf0e4ac19613702ae1d367937f86dd3dbb02732851774d91ef1372e5bbb8f998346526d
+AUX flashrom-1.3.0_spi-master.patch 9106 BLAKE2B 594a921aa48ceb67a6370080a0b51665efde24844e3523eaa84d69d49a1384272553bd5dae0642dd8540e13ba67e6d8feb2ac6edfc95949bd0edd8a2eaa164c8 SHA512 78d08c853d9dbe75610b5b0ec14df753a0780bf19309c0d9be34ebfdc4c364b8875a183307da6394456becd19b22f8987569feb9c718ca123764539ef0e52444
DIST flashrom-v1.2.tar.bz2 366995 BLAKE2B 091e01a91e12b486154ace334a5e74bccbb5f5311ad76e37f43a28167080757873d8c78b8f549d2e77eb984922c830895ba955b23eb6ee4fc24f1ffed259954b SHA512 8e01395a54d0d1344bc55e7e4975f43bb8e59ebe83fb5f2766d14f76756d718b487254ce9a19ef4093aed04fb9d40fff5fe8f709b18c512f6e6fad894f83d7b8
DIST flashrom-v1.3.0.tar.bz2 489782 BLAKE2B e6d2284d83171b003b434251f060fa44edf32ecfd3d397bd4ba39b74c6a0b5c9d1659b703dd6b632b63aa4bf27d08c8aeece72920199712c6a4ae160b2eb3a8a SHA512 73b6e00bd3bc66c98d4ad53966a65b19d3d92f07d7b210d69e041d6f5788605b9791a9bf7aec0a52e13d19fcb62c4bdaf4bab9f805fc31468393ca313129a77b
EBUILD flashrom-1.2-r4.ebuild 3883 BLAKE2B d6db324e8c8aabb66dc112f537817e921a349a19c614abeaa554c6cd0c1cef307a866406a154df36905a97a4323b18cd10735bdabf884c8c25a1721391285a6a SHA512 2d46f9be773ce539b49ea729ba09257395a69f0d259d434032d88e24db1b0ac7ccd16c6e6ecb00c950f8e2e2cc4400eb9f40593c33534aeb06fd80da0c1fc625
+EBUILD flashrom-1.3.0-r1.ebuild 3313 BLAKE2B 4769fb1943e6d33769cf3a4c6cbf3967e314ae2ba01b338cc939bcfde5a9a1760ac7e16acce68a4122ff74c9610bf0780888b3f39bc10d9e9eec801e22a5af8b SHA512 e4d8d475be6e81ab416bc74bf2a2b5cc61e8ad62009d033a88cc57ba72f2dcfc4ecf964ab75d908689d6ac257fe7027504ba8aa88ef8d382a896a51babc098b9
EBUILD flashrom-1.3.0.ebuild 3251 BLAKE2B c16d96aa5e090f965af567dbb0315d7d1b605129bbea1ae418a58ea7f2800bd4e29cbccfab5052375ef6d853c14e16623bb72ddeea5248c47f9329d4c1e6976a SHA512 70a977760e9b6de32c6da7c484b6f68d56b21a41cccb8e6d9c28ad9970303fba54762f0e73fbf3338b04efde56866732a7fceed73bc516a830c5dbd5d9ff9fdb
MISC metadata.xml 5072 BLAKE2B 5e11d250b2d59b71281ef50bf9cc79c30b2b2000002fae9725f75c73f89d02e297714d23d63dcaa55fb980162e54395b5ec5a528d15ada6c0fe8b6d020e1e3e9 SHA512 bec32f9d6d997e487f2560c89e68c041ae4162a2cc7b80dc38f20e610c300e76e8fa35144c371055f6a4594653c5af4865ba23634be87bd3e36cc8d66069ebc3
diff --git a/sys-apps/flashrom/files/flashrom-1.3.0_spi-master.patch b/sys-apps/flashrom/files/flashrom-1.3.0_spi-master.patch
new file mode 100644
index 000000000000..72298f8cfca3
--- /dev/null
+++ b/sys-apps/flashrom/files/flashrom-1.3.0_spi-master.patch
@@ -0,0 +1,285 @@
+Backported upstream commit
+https://github.com/flashrom/flashrom/commit/e1f30bbce7a603d518ecec9d7e6885719f396719
+
+--- a/bitbang_spi.c
++++ b/bitbang_spi.c
+@@ -148,7 +148,6 @@
+ .write_256 = default_spi_write_256,
+ .write_aai = default_spi_write_aai,
+ .shutdown = bitbang_spi_shutdown,
+- .probe_opcode = default_spi_probe_opcode,
+ };
+
+ int register_spi_bitbang_master(const struct bitbang_spi_master *master, void *spi_data)
+--- a/buspirate_spi.c
++++ b/buspirate_spi.c
+@@ -183,7 +183,6 @@
+ .write_256 = default_spi_write_256,
+ .write_aai = default_spi_write_aai,
+ .shutdown = buspirate_spi_shutdown,
+- .probe_opcode = default_spi_probe_opcode,
+ };
+
+ static const struct buspirate_speeds spispeeds[] = {
+--- a/ch341a_spi.c
++++ b/ch341a_spi.c
+@@ -418,7 +418,6 @@
+ .write_256 = default_spi_write_256,
+ .write_aai = default_spi_write_aai,
+ .shutdown = ch341a_spi_shutdown,
+- .probe_opcode = default_spi_probe_opcode,
+ };
+
+ static int ch341a_spi_init(const struct programmer_cfg *cfg)
+--- a/dediprog.c
++++ b/dediprog.c
+@@ -1038,7 +1038,6 @@
+ .write_256 = dediprog_spi_write_256,
+ .write_aai = dediprog_spi_write_aai,
+ .shutdown = dediprog_shutdown,
+- .probe_opcode = default_spi_probe_opcode,
+ };
+
+ /*
+--- a/digilent_spi.c
++++ b/digilent_spi.c
+@@ -338,7 +338,6 @@
+ .write_256 = default_spi_write_256,
+ .write_aai = default_spi_write_aai,
+ .shutdown = digilent_spi_shutdown,
+- .probe_opcode = default_spi_probe_opcode,
+ };
+
+ static bool default_reset(struct libusb_device_handle *handle)
+--- a/dirtyjtag_spi.c
++++ b/dirtyjtag_spi.c
+@@ -198,7 +198,6 @@
+ .write_256 = default_spi_write_256,
+ .write_aai = default_spi_write_aai,
+ .shutdown = dirtyjtag_spi_shutdown,
+- .probe_opcode = default_spi_probe_opcode,
+ };
+
+ static int dirtyjtag_spi_init(const struct programmer_cfg *cfg)
+--- a/ft2232_spi.c
++++ b/ft2232_spi.c
+@@ -301,7 +301,6 @@
+ .write_256 = default_spi_write_256,
+ .write_aai = default_spi_write_aai,
+ .shutdown = ft2232_shutdown,
+- .probe_opcode = default_spi_probe_opcode,
+ };
+
+ /* Returns 0 upon success, a negative number upon errors. */
+--- a/include/chipdrivers.h
++++ b/include/chipdrivers.h
+@@ -26,6 +26,7 @@
+ int spi_aai_write(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
+ int spi_chip_write_256(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
+ int spi_chip_read(struct flashctx *flash, uint8_t *buf, unsigned int start, int unsigned len);
++bool spi_probe_opcode(const struct flashctx *flash, uint8_t opcode);
+
+ /* spi25.c */
+ int probe_spi_rdid(struct flashctx *flash);
+--- a/include/programmer.h
++++ b/include/programmer.h
+@@ -312,7 +312,7 @@
+ int (*write_256)(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
+ int (*write_aai)(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
+ int (*shutdown)(void *data);
+- bool (*probe_opcode)(struct flashctx *flash, uint8_t opcode);
++ bool (*probe_opcode)(const struct flashctx *flash, uint8_t opcode); /* NULL func implies true. */
+ void *data;
+ };
+
+@@ -322,7 +322,6 @@
+ int default_spi_read(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
+ int default_spi_write_256(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
+ int default_spi_write_aai(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
+-bool default_spi_probe_opcode(struct flashctx *flash, uint8_t opcode);
+ int register_spi_master(const struct spi_master *mst, void *data);
+
+ /* The following enum is needed by ich_descriptor_tool and ich* code as well as in chipset_enable.c. */
+--- a/it87spi.c
++++ b/it87spi.c
+@@ -320,7 +320,6 @@
+ .write_256 = it8716f_spi_chip_write_256,
+ .write_aai = spi_chip_write_1,
+ .shutdown = it8716f_shutdown,
+- .probe_opcode = default_spi_probe_opcode,
+ };
+
+ static uint16_t it87spi_probe(const struct programmer_cfg *cfg, uint16_t port)
+--- a/jlink_spi.c
++++ b/jlink_spi.c
+@@ -190,7 +190,6 @@
+ .write_aai = default_spi_write_aai,
+ .features = SPI_MASTER_4BA,
+ .shutdown = jlink_spi_shutdown,
+- .probe_opcode = default_spi_probe_opcode,
+ };
+
+ static int jlink_spi_init(const struct programmer_cfg *cfg)
+--- a/linux_spi.c
++++ b/linux_spi.c
+@@ -121,7 +121,6 @@
+ .write_256 = linux_spi_write_256,
+ .write_aai = default_spi_write_aai,
+ .shutdown = linux_spi_shutdown,
+- .probe_opcode = default_spi_probe_opcode,
+ };
+
+ /* Read max buffer size from sysfs, or use page size as fallback. */
+--- a/mediatek_i2c_spi.c
++++ b/mediatek_i2c_spi.c
+@@ -461,7 +461,6 @@
+ .write_256 = default_spi_write_256,
+ .write_aai = default_spi_write_aai,
+ .shutdown = mediatek_shutdown,
+- .probe_opcode = default_spi_probe_opcode,
+ };
+
+ static int get_params(const struct programmer_cfg *cfg, bool *allow_brick)
+--- a/mstarddc_spi.c
++++ b/mstarddc_spi.c
+@@ -147,7 +147,6 @@
+ .write_256 = default_spi_write_256,
+ .write_aai = default_spi_write_aai,
+ .shutdown = mstarddc_spi_shutdown,
+- .probe_opcode = default_spi_probe_opcode,
+ };
+
+ /* Returns 0 upon success, a negative number upon errors. */
+--- a/ni845x_spi.c
++++ b/ni845x_spi.c
+@@ -537,7 +537,6 @@
+ .write_256 = default_spi_write_256,
+ .write_aai = default_spi_write_aai,
+ .shutdown = ni845x_spi_shutdown,
+- .probe_opcode = default_spi_probe_opcode,
+ };
+
+ static int ni845x_spi_init(const struct programmer_cfg *cfg)
+--- a/parade_lspcon.c
++++ b/parade_lspcon.c
+@@ -435,7 +435,6 @@
+ .write_256 = parade_lspcon_write_256,
+ .write_aai = parade_lspcon_write_aai,
+ .shutdown = parade_lspcon_shutdown,
+- .probe_opcode = default_spi_probe_opcode,
+ };
+
+ static int get_params(const struct programmer_cfg *cfg, bool *allow_brick)
+--- a/pickit2_spi.c
++++ b/pickit2_spi.c
+@@ -385,7 +385,6 @@
+ .write_256 = default_spi_write_256,
+ .write_aai = default_spi_write_aai,
+ .shutdown = pickit2_shutdown,
+- .probe_opcode = default_spi_probe_opcode,
+ };
+
+ static int pickit2_spi_init(const struct programmer_cfg *cfg)
+--- a/raiden_debug_spi.c
++++ b/raiden_debug_spi.c
+@@ -1325,7 +1325,6 @@
+ .write_256 = default_spi_write_256,
+ .write_aai = default_spi_write_aai,
+ .shutdown = raiden_debug_spi_shutdown,
+- .probe_opcode = default_spi_probe_opcode,
+ };
+
+ static int match_endpoint(struct libusb_endpoint_descriptor const *descriptor,
+--- a/realtek_mst_i2c_spi.c
++++ b/realtek_mst_i2c_spi.c
+@@ -440,7 +440,6 @@
+ .write_256 = realtek_mst_i2c_spi_write_256,
+ .write_aai = realtek_mst_i2c_spi_write_aai,
+ .shutdown = realtek_mst_i2c_spi_shutdown,
+- .probe_opcode = default_spi_probe_opcode,
+ };
+
+ static int get_params(const struct programmer_cfg *cfg, bool *reset, bool *enter_isp, bool *allow_brick)
+--- a/sb600spi.c
++++ b/sb600spi.c
+@@ -581,7 +581,6 @@
+ .write_256 = default_spi_write_256,
+ .write_aai = default_spi_write_aai,
+ .shutdown = sb600spi_shutdown,
+- .probe_opcode = default_spi_probe_opcode,
+ };
+
+ static const struct spi_master spi_master_yangtze = {
+@@ -595,7 +594,6 @@
+ .write_256 = default_spi_write_256,
+ .write_aai = default_spi_write_aai,
+ .shutdown = sb600spi_shutdown,
+- .probe_opcode = default_spi_probe_opcode,
+ };
+
+ int sb600_probe_spi(const struct programmer_cfg *cfg, struct pci_dev *dev)
+--- a/serprog.c
++++ b/serprog.c
+@@ -463,7 +463,6 @@
+ .read = default_spi_read,
+ .write_256 = default_spi_write_256,
+ .write_aai = default_spi_write_aai,
+- .probe_opcode = default_spi_probe_opcode,
+ };
+
+ static int sp_check_opbuf_usage(int bytes_to_be_added)
+--- a/spi.c
++++ b/spi.c
+@@ -131,9 +131,11 @@
+ return flash->mst->spi.write_aai(flash, buf, start, len);
+ }
+
+-bool default_spi_probe_opcode(struct flashctx *flash, uint8_t opcode)
++bool spi_probe_opcode(const struct flashctx *flash, uint8_t opcode)
+ {
+- return true;
++ if (!flash->mst->spi.probe_opcode)
++ return true; /* no probe_opcode implies default of supported. */
++ return flash->mst->spi.probe_opcode(flash, opcode);
+ }
+
+ int register_spi_master(const struct spi_master *mst, void *data)
+@@ -148,7 +150,7 @@
+ }
+
+ if (!mst->write_aai || !mst->write_256 || !mst->read || !mst->command ||
+- !mst->multicommand || !mst->probe_opcode ||
++ !mst->multicommand ||
+ ((mst->command == default_spi_send_command) &&
+ (mst->multicommand == default_spi_send_multicommand))) {
+ msg_perr("%s called with incomplete master definition. "
+--- a/stlinkv3_spi.c
++++ b/stlinkv3_spi.c
+@@ -471,7 +471,6 @@
+ .write_256 = default_spi_write_256,
+ .write_aai = default_spi_write_aai,
+ .shutdown = stlinkv3_spi_shutdown,
+- .probe_opcode = default_spi_probe_opcode,
+ };
+
+ static int stlinkv3_spi_init(const struct programmer_cfg *cfg)
+--- a/usbblaster_spi.c
++++ b/usbblaster_spi.c
+@@ -173,7 +173,6 @@
+ .write_256 = default_spi_write_256,
+ .write_aai = default_spi_write_aai,
+ .shutdown = usbblaster_shutdown,
+- .probe_opcode = default_spi_probe_opcode,
+ };
+
+ /* Returns 0 upon success, a negative number upon errors. */
+--- a/wbsio_spi.c
++++ b/wbsio_spi.c
+@@ -193,7 +193,6 @@
+ .write_256 = spi_chip_write_1,
+ .write_aai = spi_chip_write_1,
+ .shutdown = wbsio_spi_shutdown,
+- .probe_opcode = default_spi_probe_opcode,
+ };
+
+ int wbsio_check_for_spi(void)
diff --git a/sys-apps/flashrom/flashrom-1.3.0-r1.ebuild b/sys-apps/flashrom/flashrom-1.3.0-r1.ebuild
new file mode 100644
index 000000000000..3e8afdbc98d6
--- /dev/null
+++ b/sys-apps/flashrom/flashrom-1.3.0-r1.ebuild
@@ -0,0 +1,132 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit meson
+
+MY_P="${PN}-v${PV}"
+SRC_URI="https://download.flashrom.org/releases/${MY_P}.tar.bz2"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~x86"
+S="${WORKDIR}/${MY_P}"
+
+DESCRIPTION="Utility for reading, writing, erasing and verifying flash ROM chips"
+HOMEPAGE="https://flashrom.org/Flashrom"
+
+LICENSE="GPL-2"
+SLOT="0"
+
+# The defaults should match the upstream "default" flags in meson.build
+IUSE_PROGRAMMERS="
+ atahpt
+ atapromise
+ +atavia
+ +buspirate-spi
+ +ch341a-spi
+ +dediprog
+ +developerbox-spi
+ +digilent-spi
+ +dirtyjtag-spi
+ +drkaiser
+ +dummy
+ +ft2232-spi
+ +gfxnvidia
+ +internal
+ +it8212
+ jlink-spi
+ +linux-mtd
+ +linux-spi
+ mediatek-i2c-spi
+ mstarddc-spi
+ +nic3com
+ +nicintel
+ +nicintel-eeprom
+ +nicintel-spi
+ nicnatsemi
+ +nicrealtek
+ +ogp-spi
+ parade-lspcon
+ +pickit2-spi
+ +pony-spi
+ +raiden-debug-spi
+ +rayer-spi
+ realtek-mst-i2c-spi
+ +satamv
+ +satasii
+ +serprog
+ +stlinkv3-spi
+ +usbblaster-spi"
+IUSE="${IUSE_PROGRAMMERS} +internal-dmi test tools"
+
+RESTRICT="!test? ( test )"
+
+COMMON="atahpt? ( sys-apps/pciutils )
+ atapromise? ( sys-apps/pciutils )
+ atavia? ( sys-apps/pciutils )
+ ch341a-spi? ( virtual/libusb:1 )
+ dediprog? ( virtual/libusb:1 )
+ developerbox-spi? ( virtual/libusb:1 )
+ digilent-spi? ( virtual/libusb:1 )
+ dirtyjtag-spi? ( virtual/libusb:1 )
+ drkaiser? ( sys-apps/pciutils )
+ ft2232-spi? ( dev-embedded/libftdi:1= )
+ gfxnvidia? ( sys-apps/pciutils )
+ internal? ( sys-apps/pciutils )
+ it8212? ( sys-apps/pciutils )
+ jlink-spi? ( dev-embedded/libjaylink )
+ nic3com? ( sys-apps/pciutils )
+ nicintel? ( sys-apps/pciutils )
+ nicintel-eeprom? ( sys-apps/pciutils )
+ nicintel-spi? ( sys-apps/pciutils )
+ nicnatsemi? ( sys-apps/pciutils )
+ nicrealtek? ( sys-apps/pciutils )
+ ogp-spi? ( sys-apps/pciutils )
+ pickit2-spi? ( virtual/libusb:1 )
+ raiden-debug-spi? ( virtual/libusb:1 )
+ satamv? ( sys-apps/pciutils )
+ satasii? ( sys-apps/pciutils )
+ stlinkv3-spi? ( virtual/libusb:1 )
+ usbblaster-spi? ( dev-embedded/libftdi:1= )"
+RDEPEND="${COMMON}
+ !internal-dmi? ( sys-apps/dmidecode )"
+DEPEND="${COMMON}
+ sys-apps/diffutils
+ linux-mtd? ( sys-kernel/linux-headers )
+ linux-spi? ( sys-kernel/linux-headers )
+ mediatek-i2c-spi? ( sys-kernel/linux-headers )
+ mstarddc-spi? ( sys-kernel/linux-headers )
+ parade-lspcon? ( sys-kernel/linux-headers )
+ realtek-mst-i2c-spi? ( sys-kernel/linux-headers )"
+BDEPEND="test? ( dev-util/cmocka )"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-1.3.0_spi-master.patch
+)
+
+DOCS=( README Documentation/ )
+
+src_configure() {
+ local programmers="$(printf '%s,' $(for flag in ${IUSE_PROGRAMMERS//+/}; do usev ${flag}; done))"
+ programmers="${programmers%,}"
+ programmers="${programmers//-/_}"
+ local emesonargs=(
+ -Dclassic_cli="enabled"
+ -Dprogrammer="${programmers}"
+ $(meson_feature test tests)
+ $(meson_feature tools ich_descriptors_tool)
+ )
+ meson_src_configure
+}
+
+src_install() {
+ meson_src_install
+
+ # Upstream requires libflashrom.a to be present at build time because the classic CLI
+ # executable uses internal symbols from that library. Therefore, we let it be built
+ # but keep it out of the installed tree.
+ find "${ED}" -name '*.a' -delete || die
+
+ if use tools; then
+ dosbin "${BUILD_DIR}"/util/ich_descriptors_tool/ich_descriptors_tool
+ fi
+}