Usage:
CONFIG_DISABLE_LIBUSB0_PROGRAMMERS=yes
CONFIG_DISABLE_LIBUSB1_PROGRAMMERS=yes
CONFIG_DISABLE_LIBPCI_PROGRAMMERS=yes
Side note: This patch includes the patch to separate out raw access
requirements from libpci requirements. If acked, I will commit
separately. See
[PATCH] Do not require PCI code for RayeR SPI driver
for a changelog of that feature.
Caveat: The following command line explodes based on moon phase and I
have no idea why:
make -j CONFIG_EVERYTHING=yes CONFIG_DISABLE_LIBUSB0_PROGRAMMERS=yes
CONFIG_DISABLE_LIBUSB1_PROGRAMMERS=yes CONFIG_DISABLE_LIBPCI_PROGRAMMERS=yes
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006(a)gmx.net>
Index: flashrom-libpci_libusb_global_disable/Makefile
===================================================================
--- flashrom-libpci_libusb_global_disable/Makefile (Revision 1926)
+++ flashrom-libpci_libusb_global_disable/Makefile (Arbeitskopie)
@@ -528,6 +528,34 @@
$(eval $(var)=yes)))
endif
+# Disable feature groups
+ifeq ($(CONFIG_DISABLE_LIBUSB0_PROGRAMMERS), yes)
+override CONFIG_PICKIT2_SPI = no
+override CONFIG_DEDIPROG = no
+endif
+ifeq ($(CONFIG_DISABLE_LIBUSB1_PROGRAMMERS), yes)
+override CONFIG_CH341A_SPI = no
+override CONFIG_DEDIPROG = no
+endif
+ifeq ($(CONFIG_DISABLE_LIBPCI_PROGRAMMERS), yes)
+override CONFIG_INTERNAL = no
+override CONFIG_NIC3COM = no
+override CONFIG_GFXNVIDIA = no
+override CONFIG_SATASII = no
+override CONFIG_ATAHPT = no
+override CONFIG_ATAVIA = no
+override CONFIG_ATAPROMISE = no
+override CONFIG_IT8212 = no
+override CONFIG_DRKAISER = no
+override CONFIG_NICREALTEK = no
+override CONFIG_NICNATSEMI = no
+override CONFIG_NICINTEL = no
+override CONFIG_NICINTEL_SPI = no
+override CONFIG_NICINTEL_EEPROM = no
+override CONFIG_OGP_SPI = no
+override CONFIG_SATAMV = no
+endif
+
# Bitbanging SPI infrastructure, default off unless needed.
ifeq ($(CONFIG_RAYER_SPI), yes)
override CONFIG_BITBANG_SPI = yes
@@ -599,8 +627,7 @@
ifeq ($(CONFIG_RAYER_SPI), yes)
FEATURE_CFLAGS += -D'CONFIG_RAYER_SPI=1'
PROGRAMMER_OBJS += rayer_spi.o
-# Actually, NEED_LIBPCI is wrong. NEED_IOPORT_ACCESS would be more correct.
-NEED_LIBPCI += CONFIG_RAYER_SPI
+NEED_RAW_ACCESS += CONFIG_RAYER_SPI
endif
ifeq ($(CONFIG_PONY_SPI), yes)
@@ -782,10 +809,14 @@
ifneq ($(NEED_LIBPCI), )
CHECK_LIBPCI = yes
+# This is a dirty hack, but it saves us from checking all PCI drivers and all platforms manually.
+# libpci may need raw memory, MSR or PCI port I/O on some platforms.
+# Individual drivers might have the same needs as well.
+NEED_RAW_ACCESS += $(NEED_LIBPCI)
FEATURE_CFLAGS += -D'NEED_PCI=1'
FEATURE_CFLAGS += $(call debug_shell,grep -q "OLD_PCI_GET_DEV := yes" .libdeps && printf "%s" "-D'OLD_PCI_GET_DEV=1'")
-PROGRAMMER_OBJS += pcidev.o physmap.o hwaccess.o
+PROGRAMMER_OBJS += pcidev.o
ifeq ($(TARGET_OS), NetBSD)
# The libpci we want is called libpciutils on NetBSD and needs NetBSD libpci.
PCILIBS += -lpciutils -lpci
@@ -807,6 +838,11 @@
endif
endif
+ifneq ($(NEED_RAW_ACCESS), )
+FEATURE_CFLAGS += -D'NEED_RAW_ACCESS=1'
+PROGRAMMER_OBJS += physmap.o hwaccess.o
+endif
+
ifneq ($(NEED_LIBUSB0), )
CHECK_LIBUSB0 = yes
FEATURE_CFLAGS += -D'NEED_LIBUSB0=1'
@@ -992,7 +1028,8 @@
@{ { { { { $(CC) -c $(CPPFLAGS) $(CFLAGS) .test.c -o .test.o >&2 && \
echo "found." || { echo "not found."; echo; \
echo "The following features require libpci: $(NEED_LIBPCI)."; \
- echo "Please install libpci headers."; \
+ echo "Please install libpci headers or disable all features"; \
+ echo "mentioned above by specifying make CONFIG_DISABLE_LIBPCI_PROGRAMMERS=no"; \
echo "See README for more information."; echo; \
rm -f .test.c .test.o; exit 1; }; } 2>>$(BUILD_DETAILS_FILE); echo $? >&3 ; } | tee -a $(BUILD_DETAILS_FILE) >&4; } 3>&1;} | { read rc ; exit ${rc}; } } 4>&1
@printf "Checking version of pci_get_dev... " | tee -a $(BUILD_DETAILS_FILE)
@@ -1010,7 +1047,8 @@
$(CC) $(LDFLAGS) .test.o -o .test$(EXEC_SUFFIX) $(LIBS) $(PCILIBS) -lz >&2 && \
echo "yes." && echo "NEEDLIBZ := yes" > .libdeps } || { echo "no."; echo; \
echo "The following features require libpci: $(NEED_LIBPCI)."; \
- echo "Please install libpci (package pciutils) and/or libz."; \
+ echo "Please install libpci (package pciutils) and/or libz or disable all features"; \
+ echo "mentioned above by specifying make CONFIG_DISABLE_LIBPCI_PROGRAMMERS=no"; \
echo "See README for more information."; echo; \
rm -f .test.c .test.o .test$(EXEC_SUFFIX); exit 1; }; }; } 2>>$(BUILD_DETAILS_FILE); echo $? >&3 ; } | tee -a $(BUILD_DETAILS_FILE) >&4; } 3>&1;} | { read rc ; exit ${rc}; } } 4>&1
@rm -f .test.c .test.o .test$(EXEC_SUFFIX)
@@ -1022,7 +1060,8 @@
@{ { { { { $(CC) -c $(CPPFLAGS) $(CFLAGS) .test.c -o .test.o >&2 && \
echo "found." || { echo "not found."; echo; \
echo "The following features require libusb-0.1/libusb-compat: $(NEED_LIBUSB0)."; \
- echo "Please install libusb-0.1 headers or libusb-compat headers."; \
+ echo "Please install libusb-0.1 headers or libusb-compat headers or disable all features"; \
+ echo "mentioned above by specifying make CONFIG_DISABLE_LIBUSB0_PROGRAMMERS=no"; \
echo "See README for more information."; echo; \
rm -f .test.c .test.o; exit 1; }; } 2>>$(BUILD_DETAILS_FILE); echo $? >&3 ; } | tee -a $(BUILD_DETAILS_FILE) >&4; } 3>&1;} | { read rc ; exit ${rc}; } } 4>&1
@printf "Checking if libusb-0.1 is usable... " | tee -a $(BUILD_DETAILS_FILE)
@@ -1030,7 +1069,8 @@
@{ { { { { $(CC) $(LDFLAGS) .test.o -o .test$(EXEC_SUFFIX) $(LIBS) $(USBLIBS) >&2 && \
echo "yes." || { echo "no."; \
echo "The following features require libusb-0.1/libusb-compat: $(NEED_LIBUSB0)."; \
- echo "Please install libusb-0.1 or libusb-compat."; \
+ echo "Please install libusb-0.1 or libusb-compat or disable all features"; \
+ echo "mentioned above by specifying make CONFIG_DISABLE_LIBUSB0_PROGRAMMERS=no"; \
echo "See README for more information."; echo; \
rm -f .test.c .test.o .test$(EXEC_SUFFIX); exit 1; }; } 2>>$(BUILD_DETAILS_FILE); echo $? >&3 ; } | tee -a $(BUILD_DETAILS_FILE) >&4; } 3>&1;} | { read rc ; exit ${rc}; } } 4>&1
@rm -f .test.c .test.o .test$(EXEC_SUFFIX)
@@ -1042,7 +1082,8 @@
@{ { { { { $(CC) -c $(CPPFLAGS) $(CFLAGS) .test.c -o .test.o >&2 && \
echo "found." || { echo "not found."; echo; \
echo "The following features require libusb-1.0: $(NEED_LIBUSB1)."; \
- echo "Please install libusb-1.0 headers."; \
+ echo "Please install libusb-1.0 headers or disable all features"; \
+ echo "mentioned above by specifying make CONFIG_DISABLE_LIBUSB1_PROGRAMMERS=no"; \
echo "See README for more information."; echo; \
rm -f .test.c .test.o; exit 1; }; } 2>>$(BUILD_DETAILS_FILE); echo $? >&3 ; } | tee -a $(BUILD_DETAILS_FILE) >&4; } 3>&1;} | { read rc ; exit ${rc}; } } 4>&1
@printf "Checking if libusb-1.0 is usable... " | tee -a $(BUILD_DETAILS_FILE)
@@ -1050,7 +1091,8 @@
@{ { { { { $(CC) $(LDFLAGS) .test.o -o .test$(EXEC_SUFFIX) $(LIBS) $(USB1LIBS) >&2 && \
echo "yes." || { echo "no."; \
echo "The following features require libusb-1.0: $(NEED_LIBUSB1)."; \
- echo "Please install libusb-1.0."; \
+ echo "Please install libusb-1.0 or disable all features"; \
+ echo "mentioned above by specifying make CONFIG_DISABLE_LIBUSB1_PROGRAMMERS=no"; \
echo "See README for more information."; echo; \
rm -f .test.c .test.o .test$(EXEC_SUFFIX); exit 1; }; } 2>>$(BUILD_DETAILS_FILE); echo $? >&3 ; } | tee -a $(BUILD_DETAILS_FILE) >&4; } 3>&1;} | { read rc ; exit ${rc}; } } 4>&1
@rm -f .test.c .test.o .test$(EXEC_SUFFIX)
Index: flashrom-libpci_libusb_global_disable/hwaccess.h
===================================================================
--- flashrom-libpci_libusb_global_disable/hwaccess.h (Revision 1926)
+++ flashrom-libpci_libusb_global_disable/hwaccess.h (Arbeitskopie)
@@ -196,7 +196,7 @@
#define le_to_cpu32 cpu_to_le32
#define le_to_cpu64 cpu_to_le64
-#if NEED_PCI == 1
+#if NEED_RAW_ACCESS == 1
#if IS_X86
/* sys/io.h provides iopl(2) and x86 I/O port access functions (inb, outb etc).
@@ -376,6 +376,6 @@
#error Unknown architecture, please check if it supports PCI port IO.
#endif /* IS_* */
-#endif /* NEED_PCI == 1 */
+#endif /* NEED_RAW_ACCESS == 1 */
#endif /* !__HWACCESS_H__ */