[Buildroot] [PATCH] external-toolchain: Detect linux/version.h via cross compiler

Khem Raj raj.khem at gmail.com
Thu Jan 13 17:02:17 UTC 2022


Hi Thomas

On Sat, Jan 8, 2022 at 3:03 PM Thomas Petazzoni
<thomas.petazzoni at bootlin.com> wrote:
>
> Hello Khem,
>
> On Fri, 23 Oct 2020 02:36:41 -0700
> Khem Raj <raj.khem at gmail.com> wrote:
>
> > Using linux/version.h is assumed to be hardcoded inside sysroot but this
> > does not consider the case where toolchains might be built with
> > --with-native-system-header-dir which means the header directories will
> > not be under <sysroot>/usr/include but customized, archlinux, debian
> > built cross toolchains use these install settings ( due to multiarch )
> > they have the headers installed like /usr/aarch64-linux-gnu/include and
> > not /usr/aarch64-linux-gnu/usr/include
> >
> > This patch adds logic to use cross compiler to compute the path to
> > linux/version.h on the fly, it means we do not really need to assume the
> > install structure
> >
> > Fixes built when using external toolchains provided by archlinux e.g.
> >
> > Signed-off-by: Khem Raj <raj.khem at gmail.com>
> > Cc: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
> > ---
> >  support/scripts/check-kernel-headers.sh           | 15 ++++++++++++++-
> >  toolchain/helpers.mk                              |  2 +-
> >  .../toolchain-external/pkg-toolchain-external.mk  |  3 ++-
> >  3 files changed, 17 insertions(+), 3 deletions(-)
>
> We finally took some time to review and discuss this patch. As you can
> probably imagine due to the delay, we are (at least in its current
> form) not going to apply it.
>
> While it would be nice to not hardcode /usr/include/linux/version.h, we
> would need:
>
>  - To account for CFLAGS, as they can affect which sysroot is used by
>    the toolchain in case of multilib toolchains.
>
>  - A solution that also uses the cross-compiler to detect where
>    <linux/version.h> is in the case of the internal toolchain backend.
>
> However, overall, the motivation of using distribution toolchains is
> dubious. We still believe that it cannot work, because distribution
> toolchains can contain any number of random libraries. The sysroot of
> those toolchains (including the random set of libraries that have been
> installed) will be copied to Buildroot STAGING_DIR, causing confusion
> with the packages that Buildroot will build.
>
> So overall, we feel that the benefit of the patch is not sufficient
> compared to the extra effort to fix the remaining comments that we have
> on it. If you're still interested in pursuing this, we would welcome a
> new patch that addresses the above two issues.
>

 I think its fine to drop this patch. I was trying to prove that how
easy and fast it
could be to build buildroot but this is not a real world usecase.

> Thanks a lot!
>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com



More information about the buildroot mailing list