[Crash-utility] [PATCH v2 1/1] Support cross-compilation

Bhupesh Sharma bhsharma at redhat.com
Thu Nov 5 18:45:35 UTC 2020


On Wed, Oct 28, 2020 at 11:56 PM Alexander Egorenkov
<egorenar at posteo.net> wrote:
>
> Bhupesh Sharma <bhsharma at redhat.com> writes:
>
> >
> > ifneq ($(CROSS_COMPILE),)
> > SUBARCH := $(shell echo $(CROSS_COMPILE) | cut -d- -f1 | sed 's:^.*/::g')
> > else
> > SUBARCH := $(shell uname -m)
> > endif
> > SUBARCH := $(shell echo $(SUBARCH) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
> >                      -e s/arm.*/arm/ -e s/sa110/arm/ \
> >                      -e s/s390x/s390/ -e s/parisc64/parisc/ \
> >                      -e s/ppc.*/powerpc/ -e s/mips.*/mips/ )
> >
> > ARCH ?= $(SUBARCH)
>
> Hmm,
>
> but the Makefile needs to differentiate between 64 and 32bit archs, e.g. in
>
> if [ "${ARCH}" = "ppc64le" ]
>
> So "-e s/ppc.*/powerpc/" won't cut it, i think.

Sure, that was just an example, not a complete code blob :)

> Furthermore, we have to convert ARCH to TARGET to pass it to configure.c which also
> differentiates between 32 and 64 bit archs.
>
> Need to think about it more.

Sure, but I think we don't need to reinvent the wheel there.
CROSS_COMPILING user-space tools
and kernel bits have been standardized since some time and in the
respective Makefiles (you can refer to the Busybox and Linux kernel
Makefile) you can find helpful logic already existing for the same.

Thanks,
Bhupesh




More information about the Crash-utility mailing list