diff --git a/utils/flashrom/Config.in b/utils/flashrom/Config.in deleted file mode 100644 index 552001afc..000000000 --- a/utils/flashrom/Config.in +++ /dev/null @@ -1,279 +0,0 @@ -menu "Flashrom configuration" - depends on PACKAGE_flashrom - - choice - prompt "Default Programmer" - default DEFPROG_INTERNAL if FLASHROM_PCI - default DEFPROG_LINUX_SPI - - config DEFPROG_INTERNAL - depends on FRPROG_INTERNAL - bool "Internal" - - config DEFPROG_LINUX_SPI - depends on FRPROG_LINUX_SPI - bool "Linux SPI" - - config DEFPROG_SERPROG - depends on FRPROG_SERPROG - bool "Serial" - - config DEFPROG_RAYER_SPI - depends on FRPROG_RAYER_SPI - bool "Rayer SPI" - - config DEFPROG_PONY_SPI - depends on FRPROG_PONY_SPI - bool "Pony SPI" - - config DEFPROG_NIC3COM - depends on FRPROG_NIC3COM - bool "NIC3Com" - - config DEFPROG_GFXNVIDIA - depends on FRPROG_GFXNVIDIA - bool "GFX Nvidia" - - config DEFPROG_SATASII - depends on FRPROG_SATASII - bool "SATASII" - -# config DEFPROG_ATAHPT -# depends on FRPROG_ATAHPT -# bool "Highpoint (HPT) ATA/RAID" - - config DEFPROG_ATAVIA - depends on FRPROG_ATAVIA - bool "ATAVIA" - - config DEFPROG_FT2232_SPI - depends on FRPROG_FT2232_SPI - bool "FT2232 SPI" - - config DEFPROG_USBBLASTER_SPI - depends on FRPROG_USBBLASTER_SPI - bool "USBBlaster SPI" - -# config DEFPROG_MSTARDDC_SPI -# depends on FRPROG_MSTARDDC_SPI -# bool "MSTAR DDC SPI" - - config DEFPROG_PICKIT2_SPI - depends on FRPROG_PICKIT2_SPI - bool "PICkit2 SPI" - - config DEFPROG_DUMMY - depends on FRPROG_DUMMY - bool "Dummy" - - config DEFPROG_DRKAISER - depends on FRPROG_DRKAISER - bool "Dr. Kaiser" - - config DEFPROG_NICREALTEK - depends on FRPROG_NICREALTEK - bool "Realtek NICs" - -# config DEFPROG_NICNATSEMI -# depends on FRPROG_NICNATSEMI -# bool "National Semiconductor NICs" - - config DEFPROG_NICINTEL - depends on FRPROG_NICINTEL - bool "Intel NICs" - - config DEFPROG_NICINTEL_SPI - depends on FRPROG_NICINTEL_SPI - bool "Intel NICs SPI" - - config DEFPROG_NICINTEL_EEPROM - depends on FRPROG_NICINTEL_EEPROM - bool "Intel NICs EEPROM" - - config DEFPROG_OGP_SPI - depends on FRPROG_OGP_SPI - bool "OGP SPI" - - config DEFPROG_BUSPIRATE_SPI - depends on FRPROG_BUSPIRATE_SPI - bool "SPI BUS Pirate" - -# config DEFPROG_DEDIPROG -# depends on FRPROG_DEDIPROG -# bool "Dediprog SF100" - - config DEFPROG_SATAMV - depends on FRPROG_SATAMV - bool "Marvell SATA" - - config DEFPROG_IT8212 - depends on FRPROG_IT8212 - bool "ITE IT8212F PATA" - endchoice - - - menu "Misc Programmers" - config FRPROG_LINUX_SPI - bool "Linux SPI" - default y - -# config FRPROG_MSTARDDC_SPI -# bool "MSTAR DDC" -# default n - - config FRPROG_DUMMY - bool "Dummy" - default y - endmenu - - - config FLASHROM_FTDI - bool "FTDI Support" - default y - - menu "FTDI Programmers" - depends on FLASHROM_FTDI - - config FRPROG_FT2232_SPI - depends on FLASHROM_FTDI - bool "FT2232 SPI" - default y - - config FRPROG_USBBLASTER_SPI - depends on FLASHROM_FTDI - bool "USBBlaster SPI" - default y - endmenu - - - config FLASHROM_PCI - bool "PCI Support" - default y if (TARGET_x86||TARGET_x86_64) - - menu "PCI Programmers" - depends on FLASHROM_PCI - - config FRPROG_INTERNAL - depends on FLASHROM_PCI - bool "Internal" - default y - - config FRPROG_RAYER_SPI - depends on FLASHROM_PCI - bool "Rayer SPI" - default y - - config FRPROG_NIC3COM - depends on FLASHROM_PCI - bool "NIC3Com" - default y - - config FRPROG_GFXNVIDIA - depends on FLASHROM_PCI - bool "GFX Nvidia" - default y - - config FRPROG_SATASII - depends on FLASHROM_PCI - bool "SATASII" - default y - -# config FRPROG_ATAHPT -# depends on FLASHROM_PCI -# bool "Highpoint (HPT) ATA/RAID" -# default n - - config FRPROG_ATAVIA - depends on FLASHROM_PCI - bool "ATAVIA" - default y - - config FRPROG_IT8212 - depends on FLASHROM_PCI - bool "ITE IT8212F PATA" - default y - - config FRPROG_DRKAISER - depends on FLASHROM_PCI - bool "Dr. Kaiser" - default y - - config FRPROG_NICREALTEK - depends on FLASHROM_PCI - bool "Realtek NICs" - default y - -# config FRPROG_NICNATSEMI -# depends on FLASHROM_PCI -# bool "National Semiconductor NICs" -# default n - - config FRPROG_NICINTEL - depends on FLASHROM_PCI - bool "Intel NICs" - default y - - config FRPROG_NICINTEL_SPI - depends on FLASHROM_PCI - bool "Intel NICs SPI" - default y - - config FRPROG_NICINTEL_EEPROM - depends on FLASHROM_PCI - bool "Intel NICs EEPROM" - default y - - config FRPROG_OGP_SPI - depends on FLASHROM_PCI - bool "OGP SPI" - default y - - config FRPROG_SATAMV - depends on FLASHROM_PCI - bool "Marvell SATA" - default y - endmenu - - - config FLASHROM_SERIAL - bool "Serial Support" - default y - - menu "Serial Programmers" - depends on FLASHROM_SERIAL - - config FRPROG_SERPROG - depends on FLASHROM_SERIAL - bool "Serial" - default y - - config FRPROG_PONY_SPI - depends on FLASHROM_SERIAL - bool "Pony SPI" - default y - - config FRPROG_BUSPIRATE_SPI - depends on FLASHROM_SERIAL - bool "SPI BUS Pirate" - default y - endmenu - - - config FLASHROM_USB - bool "USB Support" - default y - - menu "USB Programmers" - depends on FLASHROM_USB - - config FRPROG_PICKIT2_SPI - depends on FLASHROM_USB - bool "PICkit2 SPI" - default y - -# config FRPROG_DEDIPROG -# depends on FLASHROM_USB -# bool "Dediprog SF100" -# default n - endmenu -endmenu diff --git a/utils/flashrom/Makefile b/utils/flashrom/Makefile index 6d3c573a4..5e4407e24 100644 --- a/utils/flashrom/Makefile +++ b/utils/flashrom/Makefile @@ -9,13 +9,16 @@ include $(TOPDIR)/rules.mk PKG_NAME:=flashrom PKG_VERSION:=0.9.8 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=http://download.flashrom.org/releases +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) PKG_MD5SUM:=ac513076b63ab7eb411a7694bb8f6fda PKG_MAINTAINER:=Álvaro Fernández Rojas +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_SOURCE_SUBDIR) + PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=COPYING @@ -24,36 +27,83 @@ PKG_INSTALL:=1 include $(INCLUDE_DIR)/package.mk include flashrom.mk -define Package/flashrom +TARGET_CFLAGS+= \ + -std=gnu89 + +MAKE_FLAGS+= \ + PREFIX="/usr" + +define Package/flashrom/default SECTION:=utils CATEGORY:=Utilities TITLE:=FlashROM Utility URL:=http://www.flashrom.org/ - DEPENDS:=\ - +(TARGET_x86||TARGET_x86_64):dmidecode \ - +FLASHROM_FTDI:libftdi \ - +FLASHROM_PCI:pciutils \ - +FLASHROM_USB:libusb-compat + DEPENDS:= endef -define Package/flashrom/config - source "$(SOURCE)/Config.in" +define Package/flashrom + $(Package/flashrom/default) + TITLE+= (full) + DEPENDS+= \ + +(PACKAGE_flashrom&&(TARGET_x86||TARGET_x86_64)):dmidecode \ + +PACKAGE_flashrom:libftdi \ + +PACKAGE_flashrom:libusb-compat \ + +PACKAGE_flashrom:pciutils + VARIANT:=full endef -define Package/flashrom/description +define Package/flashrom-pci + $(Package/flashrom/default) + TITLE+= (pci) + DEPENDS+= \ + +(PACKAGE_flashrom-pci&&(TARGET_x86||TARGET_x86_64)):dmidecode \ + +PACKAGE_flashrom-pci:pciutils + VARIANT:=pci +endef + +define Package/flashrom-spi + $(Package/flashrom/default) + TITLE+= (spi) + VARIANT:=spi +endef + +define Package/flashrom-usb + $(Package/flashrom/default) + TITLE+= (usb) + DEPENDS+= \ + +PACKAGE_flashrom-usb:libftdi \ + +PACKAGE_flashrom-usb:libusb-compat + VARIANT:=usb +endef + +define Package/flashrom/default/description flashrom is an utility for identifying, reading, writing, verifying and erasing flash chips. It's often used to flash BIOS/EFI/coreboot /firmware images. endef - -TARGET_CFLAGS+=-std=gnu89 - -MAKE_FLAGS += \ - PREFIX="/usr" +Package/flashrom/description = $(Package/flashrom/default/description) +Package/flashrom-pci/description = $(Package/flashrom/default/description) +Package/flashrom-spi/description = $(Package/flashrom/default/description) +Package/flashrom-usb/description = $(Package/flashrom/default/description) define Package/flashrom/install $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/flashrom $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/flashrom $(1)/usr/sbin/flashrom +endef +define Package/flashrom-pci/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/flashrom $(1)/usr/sbin/flashrom-pci +endef +define Package/flashrom-spi/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/flashrom $(1)/usr/sbin/flashrom-spi +endef +define Package/flashrom-usb/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/flashrom $(1)/usr/sbin/flashrom-usb endef $(eval $(call BuildPackage,flashrom)) +$(eval $(call BuildPackage,flashrom-pci)) +$(eval $(call BuildPackage,flashrom-spi)) +$(eval $(call BuildPackage,flashrom-usb)) diff --git a/utils/flashrom/flashrom.mk b/utils/flashrom/flashrom.mk index 14fc5d88d..0ca82b6d0 100644 --- a/utils/flashrom/flashrom.mk +++ b/utils/flashrom/flashrom.mk @@ -1,54 +1,88 @@ -# Flashrom configuration +# Flashrom variants + +define DefaultProgrammer + MAKE_FLAGS += CONFIG_DEFAULT_PROGRAMMER=PROGRAMMER_$(1) +endef define DefineConfig - ifeq ($(CONFIG_FLASHROM_$(1)),) - MAKE_FLAGS += NEED_$(1)=0 - endif + MAKE_FLAGS += NEED_$(1)=$(2) endef define DefineProgrammer - ifeq ($(CONFIG_FRPROG_$(1)),) - MAKE_FLAGS += CONFIG_$(1)=0 - endif - ifneq ($(CONFIG_DEFPROG_$(1)),) - MAKE_FLAGS += CONFIG_DEFAULT_PROGRAMMER=CONFIG_$(1) + # Selecting invalid programmers will fail + # Only disable unwanted programmers and keep the default ones + ifeq ($(2),no) + MAKE_FLAGS += CONFIG_$(1)=$(2) endif endef +ifeq ($(BUILD_VARIANT),full) + $(eval $(call DefaultProgrammer,LINUX_SPI)) + FLASHROM_BASIC := yes + FLASHROM_FTDI := yes + FLASHROM_PCI := yes + FLASHROM_SERIAL := yes + FLASHROM_USB := yes +endif +ifeq ($(BUILD_VARIANT),pci) + $(eval $(call DefaultProgrammer,INTERNAL)) + FLASHROM_BASIC := yes + FLASHROM_FTDI := no + FLASHROM_PCI := yes + FLASHROM_SERIAL := no + FLASHROM_USB := no +endif +ifeq ($(BUILD_VARIANT),spi) + $(eval $(call DefaultProgrammer,LINUX_SPI)) + FLASHROM_BASIC := yes + FLASHROM_FTDI := no + FLASHROM_PCI := no + FLASHROM_SERIAL := no + FLASHROM_USB := no +endif +ifeq ($(BUILD_VARIANT),usb) + $(eval $(call DefaultProgrammer,SERPROG)) + FLASHROM_BASIC := yes + FLASHROM_FTDI := yes + FLASHROM_PCI := no + FLASHROM_SERIAL := yes + FLASHROM_USB := yes +endif + # Misc -$(eval $(call DefineProgrammer,LINUX_SPI)) -#$(eval $(call DefineProgrammer,MSTARDDC_SPI)) -$(eval $(call DefineProgrammer,DUMMY)) +$(eval $(call DefineProgrammer,LINUX_SPI,$(FLASHROM_BASIC))) +#$(eval $(call DefineProgrammer,MSTARDDC_SPI,$(FLASHROM_BASIC))) +$(eval $(call DefineProgrammer,DUMMY,$(FLASHROM_BASIC))) # FTDI -$(eval $(call DefineConfig,FTDI)) -$(eval $(call DefineProgrammer,FT2232_SPI)) -$(eval $(call DefineProgrammer,USBBLASTER_SPI)) +$(eval $(call DefineConfig,FTDI,$(FLASHROM_FTDI))) +$(eval $(call DefineProgrammer,FT2232_SPI,$(FLASHROM_FTDI))) +$(eval $(call DefineProgrammer,USBBLASTER_SPI,$(FLASHROM_FTDI))) # PCI -$(eval $(call DefineConfig,PCI)) -$(eval $(call DefineProgrammer,INTERNAL)) -$(eval $(call DefineProgrammer,RAYER_SPI)) -$(eval $(call DefineProgrammer,NIC3COM)) -$(eval $(call DefineProgrammer,GFXNVIDIA)) -$(eval $(call DefineProgrammer,SATASII)) -#$(eval $(call DefineProgrammer,ATAHPT)) -$(eval $(call DefineProgrammer,ATAVIA)) -$(eval $(call DefineProgrammer,IT8212)) -$(eval $(call DefineProgrammer,DRKAISER)) -$(eval $(call DefineProgrammer,NICREALTEK)) -#$(eval $(call DefineProgrammer,NICNATSEMI)) -$(eval $(call DefineProgrammer,NICINTEL)) -$(eval $(call DefineProgrammer,NICINTEL_SPI)) -$(eval $(call DefineProgrammer,NICINTEL_EEPROM)) -$(eval $(call DefineProgrammer,OGP_SPI)) -$(eval $(call DefineProgrammer,SATAMV)) +$(eval $(call DefineConfig,PCI,$(FLASHROM_PCI))) +$(eval $(call DefineProgrammer,INTERNAL,$(FLASHROM_PCI))) +$(eval $(call DefineProgrammer,RAYER_SPI,$(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,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,NICINTEL,$(FLASHROM_PCI))) +$(eval $(call DefineProgrammer,NICINTEL_SPI,$(FLASHROM_PCI))) +$(eval $(call DefineProgrammer,NICINTEL_EEPROM,$(FLASHROM_PCI))) +$(eval $(call DefineProgrammer,OGP_SPI,$(FLASHROM_PCI))) +$(eval $(call DefineProgrammer,SATAMV,$(FLASHROM_PCI))) # Serial -$(eval $(call DefineConfig,SERIAL)) -$(eval $(call DefineProgrammer,SERPROG)) -$(eval $(call DefineProgrammer,PONY_SPI)) -$(eval $(call DefineProgrammer,BUSPIRATE_SPI)) +$(eval $(call DefineConfig,SERIAL,$(FLASHROM_SERIAL))) +$(eval $(call DefineProgrammer,SERPROG,$(FLASHROM_SERIAL))) +$(eval $(call DefineProgrammer,PONY_SPI,$(FLASHROM_SERIAL))) +$(eval $(call DefineProgrammer,BUSPIRATE_SPI,$(FLASHROM_SERIAL))) # USB -$(eval $(call DefineConfig,USB)) -$(eval $(call DefineProgrammer,PICKIT2_SPI)) -#$(eval $(call DefineProgrammer,DEDIPROG)) +$(eval $(call DefineConfig,USB,$(FLASHROM_USB))) +$(eval $(call DefineProgrammer,PICKIT2_SPI,$(FLASHROM_USB))) +#$(eval $(call DefineProgrammer,DEDIPROG,$(FLASHROM_USB)))