diff options
author | 2024-03-13 04:37:48 +0000 | |
---|---|---|
committer | 2024-03-13 04:37:48 +0000 | |
commit | 40a676f1eaff2df0d3c2d95a7694f0696ed19b00 (patch) | |
tree | 677eca0804c36fe49b596bc14eb1607cec5daac3 /sys-apps | |
parent | app-misc/ddccontrol: drop 0.6.0 (diff) | |
download | gentoo-40a676f1eaff2df0d3c2d95a7694f0696ed19b00.tar.gz gentoo-40a676f1eaff2df0d3c2d95a7694f0696ed19b00.tar.bz2 gentoo-40a676f1eaff2df0d3c2d95a7694f0696ed19b00.zip |
sys-apps/flashrom: fix modern C issue
Closes: https://bugs.gentoo.org/919266
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'sys-apps')
-rw-r--r-- | sys-apps/flashrom/files/flashrom-1.3.0-c99.patch | 59 | ||||
-rw-r--r-- | sys-apps/flashrom/flashrom-1.3.0-r2.ebuild | 133 |
2 files changed, 192 insertions, 0 deletions
diff --git a/sys-apps/flashrom/files/flashrom-1.3.0-c99.patch b/sys-apps/flashrom/files/flashrom-1.3.0-c99.patch new file mode 100644 index 000000000000..5fdb8ff87e61 --- /dev/null +++ b/sys-apps/flashrom/files/flashrom-1.3.0-c99.patch @@ -0,0 +1,59 @@ +https://bugs.gentoo.org/919266 +https://github.com/flashrom/flashrom/commit/e31d721469a37bd5784b86ffcd2318108a796616 + +From e31d721469a37bd5784b86ffcd2318108a796616 Mon Sep 17 00:00:00 2001 +From: Nikolai Artemiev <nartemiev@google.com> +Date: Mon, 28 Nov 2022 17:40:56 +1100 +Subject: [PATCH] tree/: Make probe_opcode() flashctx argument const + +Probing an opcode generally shouldn't involve mutating the flashctx +state and currently no probe_opcode functions do that. + +Make the flashctx arg const so that call sites don't need to have a +non-const pointer. + +BUG=b:253715389,b:253713774 +BRANCH=none +TEST=ninja test + +Change-Id: I19e98be50d682de2d2715417f8b7b8c62b871617 +Signed-off-by: Nikolai Artemiev <nartemiev@google.com> +Reviewed-on: https://review.coreboot.org/c/flashrom/+/70030 +Reviewed-by: Angel Pons <th3fanbus@gmail.com> +Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> +Tested-by: build bot (Jenkins) <no-reply@coreboot.org> +--- + dummyflasher.c | 4 ++-- + ichspi.c | 2 +- + 4 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/dummyflasher.c b/dummyflasher.c +index 35cdfef0b..da4efc79f 100644 +--- a/dummyflasher.c ++++ b/dummyflasher.c +@@ -122,10 +122,10 @@ static int dummy_spi_write_256(struct flashctx *flash, const uint8_t *buf, unsig + emu_data->spi_write_256_chunksize); + } + +-static bool dummy_spi_probe_opcode(struct flashctx *flash, uint8_t opcode) ++static bool dummy_spi_probe_opcode(const struct flashctx *flash, uint8_t opcode) + { + size_t i; +- struct emu_data *emu_data = flash->mst->spi.data; ++ const struct emu_data *emu_data = flash->mst->spi.data; + for (i = 0; i < emu_data->spi_blacklist_size; i++) { + if (emu_data->spi_blacklist[i] == opcode) + return false; +diff --git a/ichspi.c b/ichspi.c +index 62d1799b6..4588502a6 100644 +--- a/ichspi.c ++++ b/ichspi.c +@@ -1661,7 +1661,7 @@ static int ich_spi_send_multicommand(const struct flashctx *flash, + return ret; + } + +-static bool ich_spi_probe_opcode(struct flashctx *flash, uint8_t opcode) ++static bool ich_spi_probe_opcode(const struct flashctx *flash, uint8_t opcode) + { + return find_opcode(curopcodes, opcode) >= 0; + } diff --git a/sys-apps/flashrom/flashrom-1.3.0-r2.ebuild b/sys-apps/flashrom/flashrom-1.3.0-r2.ebuild new file mode 100644 index 000000000000..1249ff4ee1a1 --- /dev/null +++ b/sys-apps/flashrom/flashrom-1.3.0-r2.ebuild @@ -0,0 +1,133 @@ +# Copyright 1999-2024 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 ~loong ~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 + "${FILESDIR}"/${PN}-1.3.0-c99.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 +} |