From f033cd1aedd04de0030cb2c41d905bade37f79d1 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Thu, 16 Apr 2020 20:30:55 +0300 Subject: [PATCH] flashrom: bump to 1.2 Add new PCI and USB drivers to flashrom.mk to disable them in other build variant.s Fix DefineConfig calls to use new config symbols, and have it only append NEED_FEATURE=yes to MAKE_FLAGS. Appending NEED_FEATURE=no would still enable the feature because upstream compares against an empty string instead of comparing to yes. Drop libusb-compat dependency as all drivers use libusb-1 now. Remove upstreamed patch 010-add-arc.patch. Rework 0001-fix_internal_bitbang.patch, give it a correct prefix and more descriptive name. Signed-off-by: Stijn Tintel --- utils/flashrom/Makefile | 13 +++-- utils/flashrom/flashrom.mk | 23 ++++---- .../patches/0001-fix_internal_bitbang.patch | 11 ---- ...pi-avoid-deprecated-libusb-functions.patch | 40 -------------- utils/flashrom/patches/010-add-arc.patch | 54 ------------------- ...-build_internal_programmer_all_archs.patch | 18 +++++++ 6 files changed, 37 insertions(+), 122 deletions(-) delete mode 100644 utils/flashrom/patches/0001-fix_internal_bitbang.patch delete mode 100644 utils/flashrom/patches/0003-ch341a_spi-avoid-deprecated-libusb-functions.patch delete mode 100644 utils/flashrom/patches/010-add-arc.patch create mode 100644 utils/flashrom/patches/900-build_internal_programmer_all_archs.patch diff --git a/utils/flashrom/Makefile b/utils/flashrom/Makefile index 937b48035..204a2413b 100644 --- a/utils/flashrom/Makefile +++ b/utils/flashrom/Makefile @@ -8,13 +8,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=flashrom -PKG_VERSION:=1.0 -PKG_RELEASE:=2 +PKG_VERSION:=1.2 +PKG_RELEASE:=1 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE:=$(PKG_NAME)-v$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://download.flashrom.org/releases PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_HASH:=3702fa215ba5fb5af8e54c852d239899cfa1389194c1e51cb2a170c4dc9dee64 +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-v$(PKG_VERSION) +PKG_HASH:=e1f8d95881f5a4365dfe58776ce821dfcee0f138f75d0f44f8a3cd032d9ea42b PKG_MAINTAINER:=Álvaro Fernández Rojas PKG_LICENSE:=GPL-2.0-or-later @@ -46,7 +47,6 @@ define Package/flashrom +(TARGET_x86||TARGET_x86_64):dmidecode \ +libftdi1 \ +libusb-1.0 \ - +libusb-compat \ +pciutils VARIANT:=full DEFAULT_VARIANT:=1 @@ -72,8 +72,7 @@ define Package/flashrom-usb TITLE+= (usb) DEPENDS+= \ +libftdi1 \ - +libusb-1.0 \ - +libusb-compat + +libusb-1.0 VARIANT:=usb endef diff --git a/utils/flashrom/flashrom.mk b/utils/flashrom/flashrom.mk index f910758a4..0efb2eab0 100644 --- a/utils/flashrom/flashrom.mk +++ b/utils/flashrom/flashrom.mk @@ -4,7 +4,9 @@ define DefaultProgrammer MAKE_FLAGS += CONFIG_DEFAULT_PROGRAMMER=PROGRAMMER_$(1) endef define DefineConfig - MAKE_FLAGS += NEED_$(1)=$(2) + ifeq ($(2),yes) + MAKE_FLAGS += NEED_$(1)=$(2) + endif endef define DefineProgrammer # Selecting invalid programmers will fail @@ -57,7 +59,7 @@ $(eval $(call DefineProgrammer,LINUX_SPI,$(FLASHROM_BASIC))) $(eval $(call DefineProgrammer,DUMMY,$(FLASHROM_BASIC))) # FTDI -$(eval $(call DefineConfig,FTDI,$(FLASHROM_FTDI))) +$(eval $(call DefineConfig,LIBFTDI,$(FLASHROM_FTDI))) $(eval $(call DefineProgrammer,FT2232_SPI,$(FLASHROM_FTDI))) $(eval $(call DefineProgrammer,USBBLASTER_SPI,$(FLASHROM_FTDI))) @@ -66,17 +68,18 @@ $(eval $(call DefineConfig,RAW_ACCESS,$(FLASHROM_RAW))) $(eval $(call DefineProgrammer,RAYER_SPI,$(FLASHROM_RAW))) # PCI -$(eval $(call DefineConfig,PCI,$(FLASHROM_PCI))) +$(eval $(call DefineConfig,LIBPCI,$(FLASHROM_PCI))) $(eval $(call DefineProgrammer,INTERNAL,$(FLASHROM_PCI))) $(eval $(call DefineProgrammer,NIC3COM,$(FLASHROM_PCI))) $(eval $(call DefineProgrammer,GFXNVIDIA,$(FLASHROM_PCI))) $(eval $(call DefineProgrammer,SATASII,$(FLASHROM_PCI))) -#$(eval $(call DefineProgrammer,ATAHPT,$(FLASHROM_PCI))) +$(eval $(call DefineProgrammer,ATAHPT,$(FLASHROM_PCI))) +$(eval $(call DefineProgrammer,ATAPROMISE,$(FLASHROM_PCI))) $(eval $(call DefineProgrammer,ATAVIA,$(FLASHROM_PCI))) $(eval $(call DefineProgrammer,IT8212,$(FLASHROM_PCI))) $(eval $(call DefineProgrammer,DRKAISER,$(FLASHROM_PCI))) $(eval $(call DefineProgrammer,NICREALTEK,$(FLASHROM_PCI))) -#$(eval $(call DefineProgrammer,NICNATSEMI,$(FLASHROM_PCI))) +$(eval $(call DefineProgrammer,NICNATSEMI,$(FLASHROM_PCI))) $(eval $(call DefineProgrammer,NICINTEL,$(FLASHROM_PCI))) $(eval $(call DefineProgrammer,NICINTEL_SPI,$(FLASHROM_PCI))) $(eval $(call DefineProgrammer,NICINTEL_EEPROM,$(FLASHROM_PCI))) @@ -89,11 +92,11 @@ $(eval $(call DefineProgrammer,SERPROG,$(FLASHROM_SERIAL))) $(eval $(call DefineProgrammer,PONY_SPI,$(FLASHROM_SERIAL))) $(eval $(call DefineProgrammer,BUSPIRATE_SPI,$(FLASHROM_SERIAL))) -# USB0 -$(eval $(call DefineConfig,USB0,$(FLASHROM_USB))) -$(eval $(call DefineProgrammer,PICKIT2_SPI,$(FLASHROM_USB))) - # USB1 -$(eval $(call DefineConfig,USB1,$(FLASHROM_USB))) +$(eval $(call DefineConfig,LIBUSB1,$(FLASHROM_USB))) $(eval $(call DefineProgrammer,CH341A_SPI,$(FLASHROM_USB))) $(eval $(call DefineProgrammer,DEDIPROG,$(FLASHROM_USB))) +$(eval $(call DefineProgrammer,DEVELOPERBOX_SPI,$(FLASHROM_USB))) +$(eval $(call DefineProgrammer,DIGILENT_SPI,$(FLASHROM_USB))) +$(eval $(call DefineProgrammer,PICKIT2_SPI,$(FLASHROM_USB))) +$(eval $(call DefineProgrammer,STLINKV3_SPI,$(FLASHROM_USB))) diff --git a/utils/flashrom/patches/0001-fix_internal_bitbang.patch b/utils/flashrom/patches/0001-fix_internal_bitbang.patch deleted file mode 100644 index 581e0704a..000000000 --- a/utils/flashrom/patches/0001-fix_internal_bitbang.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/programmer.h -+++ b/programmer.h -@@ -584,7 +584,7 @@ enum spi_controller { - #if CONFIG_DEDIPROG == 1 - SPI_CONTROLLER_DEDIPROG, - #endif --#if CONFIG_OGP_SPI == 1 || CONFIG_NICINTEL_SPI == 1 || CONFIG_RAYER_SPI == 1 || CONFIG_PONY_SPI == 1 || (CONFIG_INTERNAL == 1 && (defined(__i386__) || defined(__x86_64__))) -+#if CONFIG_OGP_SPI == 1 || CONFIG_NICINTEL_SPI == 1 || CONFIG_RAYER_SPI == 1 || CONFIG_PONY_SPI == 1 || CONFIG_INTERNAL == 1 - SPI_CONTROLLER_BITBANG, - #endif - #if CONFIG_LINUX_SPI == 1 diff --git a/utils/flashrom/patches/0003-ch341a_spi-avoid-deprecated-libusb-functions.patch b/utils/flashrom/patches/0003-ch341a_spi-avoid-deprecated-libusb-functions.patch deleted file mode 100644 index fa941e42d..000000000 --- a/utils/flashrom/patches/0003-ch341a_spi-avoid-deprecated-libusb-functions.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 291764a70e6d8b212680e311bfb0825abf2b9a2f Mon Sep 17 00:00:00 2001 -From: Alex James -Date: Sat, 14 Apr 2018 22:59:57 -0500 -Subject: ch341a_spi: Avoid deprecated libusb functions - -libusb 1.0.22 marked libusb_set_debug as deprecated. For such versions -of libusb, use libusb_set_option instead. - -Change-Id: Ib71ebe812316eaf49136979a942a946ef9e4d487 -Signed-off-by: Alex James -Reviewed-on: https://review.coreboot.org/25681 -Tested-by: Nico Huber -Reviewed-by: David Hendricks ---- - ch341a_spi.c | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -(limited to 'ch341a_spi.c') - -diff --git a/ch341a_spi.c b/ch341a_spi.c -index 95e9c95..ee18624 100644 ---- a/ch341a_spi.c -+++ b/ch341a_spi.c -@@ -444,7 +444,12 @@ int ch341a_spi_init(void) - return -1; - } - -- libusb_set_debug(NULL, 3); // Enable information, warning and error messages (only). -+ /* Enable information, warning, and error messages (only). */ -+#if LIBUSB_API_VERSION < 0x01000106 -+ libusb_set_debug(NULL, 3); -+#else -+ libusb_set_option(NULL, LIBUSB_OPTION_LOG_LEVEL, LIBUSB_LOG_LEVEL_INFO); -+#endif - - uint16_t vid = devs_ch341a_spi[0].vendor_id; - uint16_t pid = devs_ch341a_spi[0].device_id; --- -cgit v1.1 - diff --git a/utils/flashrom/patches/010-add-arc.patch b/utils/flashrom/patches/010-add-arc.patch deleted file mode 100644 index c2ccbe883..000000000 --- a/utils/flashrom/patches/010-add-arc.patch +++ /dev/null @@ -1,54 +0,0 @@ ---- a/Makefile -+++ b/Makefile -@@ -420,7 +420,7 @@ endif - # Disable all drivers needing raw access (memory, PCI, port I/O) on - # architectures with unknown raw access properties. - # Right now those architectures are alpha hppa m68k sh s390 --ifneq ($(ARCH),$(filter $(ARCH),x86 mips ppc arm sparc)) -+ifneq ($(ARCH),$(filter $(ARCH),x86 mips ppc arm sparc arc)) - ifeq ($(CONFIG_INTERNAL), yes) - UNSUPPORTED_FEATURES += CONFIG_INTERNAL=yes - else ---- a/hwaccess.h -+++ b/hwaccess.h -@@ -87,6 +87,13 @@ - /* SPARC is big endian in general (but allows to access data in little endian too). */ - #define __FLASHROM_BIG_ENDIAN__ 1 - -+#elif IS_ARC -+#ifdef __arceb__ -+#define __FLASHROM_BIG_ENDIAN__ 1 -+#else -+#define __FLASHROM_LITTLE_ENDIAN__ 1 -+#endif -+ - #endif /* IS_? */ - - #if !defined (__FLASHROM_BIG_ENDIAN__) && !defined (__FLASHROM_LITTLE_ENDIAN__) -@@ -378,6 +385,8 @@ int libpayload_wrmsr(int addr, msr_t msr); - - /* Non memory mapped I/O is not supported on ARM. */ - -+#elif IS_ARC -+ - #else - - #error Unknown architecture, please check if it supports PCI port IO. -diff --git a/platform.h b/platform.h -index b2fdcd0..2e68e71 100644 ---- a/platform.h -+++ b/platform.h -@@ -75,9 +75,12 @@ - #elif defined(__s390__) || defined(__s390x__) || defined(__zarch__) - #define __FLASHROM_ARCH__ "s390" - #define IS_S390 1 -+#elif defined (__arc__) -+ #define __FLASHROM_ARCH__ "arc" -+ #define IS_ARC 1 - #endif - --#if !(IS_X86 || IS_MIPS || IS_PPC || IS_ARM || IS_SPARC || IS_ALPHA || IS_HPPA || IS_M68K || IS_SH || IS_S390) -+#if !(IS_X86 || IS_MIPS || IS_PPC || IS_ARM || IS_SPARC || IS_ALPHA || IS_HPPA || IS_M68K || IS_SH || IS_S390 || IS_ARC) - #error Unknown architecture - #endif - diff --git a/utils/flashrom/patches/900-build_internal_programmer_all_archs.patch b/utils/flashrom/patches/900-build_internal_programmer_all_archs.patch new file mode 100644 index 000000000..4dd58a4ae --- /dev/null +++ b/utils/flashrom/patches/900-build_internal_programmer_all_archs.patch @@ -0,0 +1,18 @@ +--- a/Makefile ++++ b/Makefile +@@ -424,15 +424,6 @@ endif + override ARCH := $(strip $(call debug_shell,$(CC) $(CPPFLAGS) -E archtest.c 2>/dev/null | grep -v '^\#' | grep '"' | cut -f 2 -d'"')) + override ENDIAN := $(strip $(call debug_shell,$(CC) $(CPPFLAGS) -E endiantest.c 2>/dev/null | grep -v '^\#')) + +-# Disable the internal programmer on unsupported architectures (everything but x86 and mipsel) +-ifneq ($(ARCH)-little, $(filter $(ARCH),x86 mips)-$(ENDIAN)) +-ifeq ($(CONFIG_INTERNAL), yes) +-UNSUPPORTED_FEATURES += CONFIG_INTERNAL=yes +-else +-override CONFIG_INTERNAL = no +-endif +-endif +- + # PCI port I/O support is unimplemented on PPC/MIPS/SPARC and unavailable on ARM. + # Right now this means the drivers below only work on x86. + ifneq ($(ARCH), x86)