Hi Alex, Bhupesh,
-----Original Message-----
In order to support cross-compilation of crash-utilty,
the configure tool compiled from configure.c must be built
for the host architecture where the cross-compilation will run
instead of the target architecture where the crash-utility shall run.
Therefore, we need to support two C compilers in Maklefile,
one for the host and one for the target. The old CC makefile variable
shall represent the compiler for the target architecture and
the new HOSTCC makefile variable shall represent the host compiler.
Both variables differ only when a cross-compilation is performed.
Furthermore, there must be a way to override the target architecture
which is deduced from the preprocessor macros defined by the compiler
used for the compilation of configure.c, because otherwise the configure
tool will deduce host's architecture instead of the desired target.
With the new preprocessor define CONF_DEFAULT_TARGET, it is possible to
set the desired target architecture for the compiled crash-utility.
When cross-compiling, set the makefile variable CROSS_COMPILE
to the prefix of the cross-compiler and the default target
architecture will be deduced from it, e.g. like this:
make CROSS_COMPILE=s390x-linux-
and the default target architecture shall be S390X.
Signed-off-by: Alexander Egorenkov <egorenar-dev(a)posteo.net>
This patch looks good to me, but I don't have a cross-compilation
environment and cannot test it. Bhupesh, can you review and test this?
(I had a try for arm64 build on an x86_64 machine, but I couldn't make it.
Probably my environment would be something wrong. I had studied some
about cross-compilation but seems still not enough..)
diff --git a/README b/README
index bfbaef6..f5bd476 100644
--- a/README
+++ b/README
@@ -100,6 +100,11 @@
o On an x86_64 host, an x86_64 binary that can be used to analyze
ppc64le dumpfiles may be built by typing "make target=PPC64".
+ To cross-compile the crash utility, set the makefile variable CROSS_COMPILE to
+ the prefix of the cross-compiler, e.g. like this:
+
+ $ make CROSS_COMPILE=s390x-linux-
+
I found that the help.c also needs this change. We can add it when
merging, but if you need to respin this patch for other comments,
please fix it as well.
Thanks,
Kazu