On Tue, Jun 28, 2011 at 7:26 PM, Carl-Daniel Hailfinger < [email protected]> 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 <[email protected]> > > 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" 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 '^\#')) # 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__ -- David Hendricks (dhendrix) Systems Software Engineer, Google Inc.
_______________________________________________ flashrom mailing list [email protected] http://www.flashrom.org/mailman/listinfo/flashrom
