[Buildroot] [PATCH 1/1] Fix config.mak.uname to allow cross-compilation

Mauro Condarelli mc5686 at mclink.it
Sun May 22 20:24:02 UTC 2016


This patch is part of a patchset for BuildRoot (https://buildroot.org/)
needed to correctly cross-compile GIT.

Git compilation relies on "uname" program to determine several system
charcteristics, but that does not work well in a cross-compilation
environment because "uname" will run on host, while we are interested
in information concerning target.

The file "config.mak.uname" unconditionally assigns variables using
":=", this prevents changing their value from the command line.
This minimal patch changes the flavor of the variable and assigns it
only if not already assigned, opening the road to spcify target-consistent
values on the command line (which is done in the other patches for
BuildRoot, but are not relevant here).

We are sending this patch upstream because we feel this might be
useful in other cross-compilation contexts.

Note this patch also changes variable "flavor" thus incurring in a
computational overhead; Makefile perusal doesn't seem to indicate
this as a problem, but it is possible to overcome this problem,
if deemed relevant, by using the construct:

  ifeq ($(origin uname_X), undefined)
    uname_X := $(shell sh -c 'uname -x 2>/dev/null || echo not')
  endif

If required I will submit another patch to this effect.

Regards
Mauro


More information about the buildroot mailing list