[PATCH v1 1/3] [makedumpfile] Support for cross building

Suzuki K. Poulose suzuki at in.ibm.com
Wed Jan 18 05:09:14 EST 2012


Support cross building of makedumpfile. This would be useful for building
the makedumpfile for embedded PPC boards. Support for PPC32 would be added
in the later patches.

Use TARGET variable to set the arch to build for. Also honour the value of
CC if set.

Signed-off-by: Suzuki K. Poulose <suzuki at in.ibm.com>
---

 Makefile |   12 +++++++++++-
 README   |    5 +++++
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index 9afbe1c..174a0d9 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,11 @@
 VERSION=1.4.1
 DATE=6 January 2012
 
+# Honour the environment variable CC
+ifeq ($(strip $CC),)
 CC	= gcc
+endif
+
 CFLAGS = -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
 	  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \
 	  -DVERSION='"$(VERSION)"' -DRELEASE_DATE='"$(DATE)"'
@@ -11,7 +15,13 @@ CFLAGS_ARCH	= -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
 		    -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
 # LDFLAGS = -L/usr/local/lib -I/usr/local/include
 
-ARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/sun4u/sparc64/ \
+# Use TARGET as the target architecture if specified.
+# Defaults to uname -m
+ifeq ($(strip($TARGET)),)
+TARGET := $(shell uname -m)
+endif
+
+ARCH := $(shell echo ${TARGET}  | sed -e s/i.86/x86/ -e s/sun4u/sparc64/ \
 			       -e s/arm.*/arm/ -e s/sa110/arm/ \
 			       -e s/s390x/s390/ -e s/parisc64/parisc/ \
 			       -e s/ppc64/powerpc/ )
diff --git a/README b/README
index 8aa4ab3..595b446 100644
--- a/README
+++ b/README
@@ -37,6 +37,11 @@
     # cd makedumpfile-x.y.z
   4.Build, and install:
     # make; make install
+  5.Build for a different architecture than the host :
+    # make TARGET=<arch> ; make install
+    where <arch> is the 'uname -m' of the target architecture. 
+    The user has to set the environment variable CC to appropriate
+    compiler for the target architecture.
 
 * SUPPORTED KERNELS
   This makedumpfile supports the following kernels.




More information about the kexec mailing list