diff options
-rw-r--r-- | gnu-system.am | 1 | ||||
-rw-r--r-- | gnu/packages/admin.scm | 47 | ||||
-rw-r--r-- | gnu/packages/patches/flashrom-use-libftdi1.patch | 70 |
3 files changed, 118 insertions, 0 deletions
diff --git a/gnu-system.am b/gnu-system.am index 6e1e8afec0..ea2a4b3f51 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -300,6 +300,7 @@ dist_patch_DATA = \ gnu/packages/patches/doxygen-tmake.patch \ gnu/packages/patches/emacs-configure-sh.patch \ gnu/packages/patches/findutils-absolute-paths.patch \ + gnu/packages/patches/flashrom-use-libftdi1.patch \ gnu/packages/patches/flex-bison-tests.patch \ gnu/packages/patches/gawk-shell.patch \ gnu/packages/patches/gcc-cross-environment-variables.patch \ diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm index 4a88fdd76a..8abc6677ac 100644 --- a/gnu/packages/admin.scm +++ b/gnu/packages/admin.scm @@ -48,6 +48,9 @@ #:use-module (gnu packages pkg-config) #:use-module (gnu packages texinfo) #:use-module (gnu packages groff) + #:use-module (gnu packages pciutils) + #:use-module (gnu packages libusb) + #:use-module (gnu packages libftdi) #:use-module (gnu packages xorg)) (define-public dmd @@ -803,3 +806,47 @@ reliability depending on the manufacturer. This will often include usage status for the CPU sockets, expansion slots (e.g. AGP, PCI, ISA) and memory module slots, and the list of I/O ports (e.g. serial, parallel, USB).") (license gpl2+))) + +(define-public flashrom + (package + (name "flashrom") + (version "0.9.7") + (source (origin + (method url-fetch) + (uri (string-append + "http://download.flashrom.org/releases/flashrom-" + version ".tar.bz2")) + (sha256 + (base32 + "1s9pc4yls2s1gcg2ar4q75nym2z5v6lxq36bl6lq26br00nj2mas")) + (patches (list (search-patch "flashrom-use-libftdi1.patch"))))) + (build-system gnu-build-system) + (inputs `(("dmidecode" ,dmidecode) + ("pciutils" ,pciutils) + ("libusb" ,libusb) + ("libftdi" ,libftdi))) + (native-inputs `(("pkg-config" ,pkg-config))) + (arguments + '(#:make-flags (list "CC=gcc" (string-append "PREFIX=" %output)) + #:tests? #f ; no 'check' target + #:phases + (alist-delete + 'configure + (alist-cons-before + 'build 'patch-exec-paths + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "dmi.c" + (("\"dmidecode\"") + (format #f "~S" + (string-append (assoc-ref inputs "dmidecode") + "/sbin/dmidecode"))))) + %standard-phases)))) + (home-page "http://flashrom.org/") + (synopsis "Identify, read, write, erase, and verify ROM/flash chips") + (description + "flashrom is a utility for identifying, reading, writing, +verifying and erasing flash chips. It is designed to flash +BIOS/EFI/coreboot/firmware/optionROM images on mainboards, +network/graphics/storage controller cards, and various other +programmer devices.") + (license gpl2))) diff --git a/gnu/packages/patches/flashrom-use-libftdi1.patch b/gnu/packages/patches/flashrom-use-libftdi1.patch new file mode 100644 index 0000000000..a6051df30a --- /dev/null +++ b/gnu/packages/patches/flashrom-use-libftdi1.patch @@ -0,0 +1,70 @@ +Update to libftdi-1.0 is advertised as a drop-in replacement for libftdi, +running on top of libusb-1.0. This also removes indirect dependency to +libusb-0.1. + +Patch by Kyösti Mälkki <kyosti.malkki@gmail.com>. +See <http://patchwork.coreboot.org/patch/3904/>. + +--- flashrom/Makefile.orig 2013-08-13 18:00:00.000000000 -0400 ++++ flashrom/Makefile 2014-08-05 03:10:40.217145375 -0400 +@@ -492,19 +492,21 @@ + ifeq ($(CONFIG_FT2232_SPI), yes) + # This is a totally ugly hack. + FEATURE_CFLAGS += $(shell LC_ALL=C grep -q "FTDISUPPORT := yes" .features && printf "%s" "-D'CONFIG_FT2232_SPI=1'") +-NEED_FTDI := yes ++NEED_FTDI1 := yes + PROGRAMMER_OBJS += ft2232_spi.o + endif + + ifeq ($(CONFIG_USBBLASTER_SPI), yes) + # This is a totally ugly hack. + FEATURE_CFLAGS += $(shell LC_ALL=C grep -q "FTDISUPPORT := yes" .features && printf "%s" "-D'CONFIG_USBBLASTER_SPI=1'") +-NEED_FTDI := yes ++NEED_LIBUSB1 := yes ++NEED_FTDI1 := yes + PROGRAMMER_OBJS += usbblaster_spi.o + endif + +-ifeq ($(NEED_FTDI), yes) +-FTDILIBS := $(shell pkg-config --libs libftdi 2>/dev/null || printf "%s" "-lftdi -lusb") ++ifeq ($(NEED_FTDI1), yes) ++FTDILIBS := $(shell pkg-config --libs libftdi1 2>/dev/null || printf "%s" "-lftdi1 -lusb-1.0") ++FEATURE_CFLAGS += $(shell pkg-config --cflags libftdi1 2>/dev/null) + FEATURE_CFLAGS += $(shell LC_ALL=C grep -q "FT232H := yes" .features && printf "%s" "-D'HAVE_FT232H=1'") + FEATURE_LIBS += $(shell LC_ALL=C grep -q "FTDISUPPORT := yes" .features && printf "%s" "$(FTDILIBS)") + # We can't set NEED_USB here because that would transform libftdi auto-enabling +@@ -781,6 +783,7 @@ + endif + + define FTDI_TEST ++#include <stddef.h> + #include <ftdi.h> + struct ftdi_context *ftdic = NULL; + int main(int argc, char **argv) +@@ -793,6 +796,7 @@ + export FTDI_TEST + + define FTDI_232H_TEST ++#include <stddef.h> + #include <ftdi.h> + enum ftdi_chip_type type = TYPE_232H; + endef +@@ -826,15 +830,15 @@ + + features: compiler + @echo "FEATURES := yes" > .features.tmp +-ifeq ($(NEED_FTDI), yes) ++ifeq ($(NEED_FTDI1), yes) + @printf "Checking for FTDI support... " + @echo "$$FTDI_TEST" > .featuretest.c +- @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) $(FTDILIBS) $(LIBS) >/dev/null 2>&1 && \ ++ @$(CC) $(CPPFLAGS) $(CFLAGS) $(FEATURE_CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) $(FTDILIBS) $(LIBS) >/dev/null 2>&1 && \ + ( echo "found."; echo "FTDISUPPORT := yes" >> .features.tmp ) || \ + ( echo "not found."; echo "FTDISUPPORT := no" >> .features.tmp ) + @printf "Checking for FT232H support in libftdi... " + @echo "$$FTDI_232H_TEST" >> .featuretest.c +- @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) $(FTDILIBS) $(LIBS) >/dev/null 2>&1 && \ ++ @$(CC) $(CPPFLAGS) $(CFLAGS) $(FEATURE_CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) $(FTDILIBS) $(LIBS) >/dev/null 2>&1 && \ + ( echo "found."; echo "FT232H := yes" >> .features.tmp ) || \ + ( echo "not found."; echo "FT232H := no" >> .features.tmp ) + endif |