Am 01.07.2011 04:45 schrieb David Hendricks:
On Tue, Jun 28, 2011 at 7:26 PM, Carl-Daniel Hailfinger < c-d.hailfinger.devel.2006@gmx.net> wrote:
Autodetect target processor architecture. Enable architecture dependent compilation of individual sub-drivers for the internal programmer.
With this patch, you no longer have to edit the Makefile to compile the internal driver on MIPS/ARM/...
TODO: arch.h is not suitable for inclusion in a .c/.h file because of its last line. Any ideas how to change that (move arch.h as "here document" into the Makefile, use other trickery like more #ifdefs)?
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Index: flashrom-target_arch/Makefile
--- flashrom-target_arch/Makefile (Revision 1357) +++ flashrom-target_arch/Makefile (Arbeitskopie) @@ -37,7 +37,10 @@ CFLAGS += -Werror endif
-# FIXME We have to differentiate between host and target arch. +# Determine the destination processor architecture +ARCH = $(strip $(shell LC_ALL=C gcc -E arch.h|grep -v '^#'))
Use $(CC) instead of "gcc" so stuff like "armv7a-cros-linux-gnueabi-gcc"
Ouch, yes! This was a cut-n-paste error. Thanks for spotting it.
gets handled properly. I still think assigning ARCH conditionally is wise since package managers should set it when cross-compiling, though using $(CC) should yield the same result.
Aside from that, I was able to cross-compile successfully for ARM (using the same CONFIG_* settings as before) after adding this minor patch on top of yours:
diff -Nru a/Makefile b/Makefile --- a/Makefile 2011-06-30 19:35:53.410049173 -0700 +++ b/Makefile 2011-06-30 19:35:39.140049283 -0700 @@ -38,7 +38,7 @@ endif
# Determine the destination processor architecture -ARCH = $(strip $(shell LC_ALL=C gcc -E arch.h|grep -v '^#')) +ARCH = $(strip $(shell LC_ALL=C $(CC) -E arch.h|grep -v '^#'))
Right.
# FIXME We have to differentiate between host and target OS architecture. OS_ARCH ?= $(shell uname) @@ -228,6 +228,10 @@ ifeq ($(ARCH),"x86") PROGRAMMER_OBJS += it87spi.o it85spi.o ichspi.o sb600spi.o wbsio_spi.o mcp6x_spi.o else +ifeq ($(ARCH),"arm") +PROGRAMMER_OBJS += tegra2_spi.o +else +endif endif NEED_PCI := yes endif diff -Nru a/arch.h b/arch.h --- a/arch.h 2011-06-30 19:35:50.190944388 -0700 +++ b/arch.h 2011-06-30 19:35:35.280103884 -0700 @@ -27,5 +27,7 @@ #define __FLASHROM_ARCH__ "mips" #elif defined(__powerpc__) || defined(__powerpc64__) || defined(__ppc__) || defined(__ppc64__) #define __FLASHROM_ARCH__ "ppc" +#elif defined(__arm__) +#define __FLASHROM_ARCH__ "arm" #endif __FLASHROM_ARCH__
Should I extend my patch to cover ARM as well, or should we perform all AR related changes in your big ARM suppport patch?
Regards, Carl-Daniel