Re: headers_install builds break on a lot of targets?

From: Arnd Bergmann
Date: Wed Jun 03 2020 - 10:05:47 EST


On Wed, Jun 3, 2020 at 3:49 PM Rob Landley <rob@xxxxxxxxxxx> wrote:
>
> The headers_install_all target got removed last year (commit f3c8d4c7a728 and
> would someone like to update Documentation/kbuild/headers_install.txt which
> still describes it?)
>
> The musl-libc maintainer is using a forked hand-hacked kernel header package in
> his toolchain build project (https://github.com/richfelker/musl-cross-make), and
> he said the reason for it is:
>
> http://lists.landley.net/pipermail/toybox-landley.net/2020-March/011536.html
>
> Because downloading 100 MB of kernel source and extracting it to a far
> larger tree just to get the headers isn't really fun.
>
> And I thought "that's why headers_install_all existed", and noticed the target
> being removed, so I tried my hand at a small shell script vesion:
>
> for i in $(echo arch/*/ | sed 's@arch/\([^/]*\)/@\1@g')
> do
> echo $i
> X="$PWD/fruitbasket/$i"
> mkdir -p "$X"
> make ARCH=$i distclean defconfig headers_install \
> INSTALL_HDR_PATH="$PWD/fruitbasket/$i" > /dev/null
> done
>
> On the bright side, the resulting fruitbasket.tar.xz is 1.5 megabytes. The
> downside is I have no idea how broken the resulting header files are after this
> error-fest:

I think the problem is that you can no longer run 'make defconfig ARCH=foo'
without passing a CROSS_COMPILE=${ARCH}-linux-gnu- argument pointing
to a valid toolchain target triple.

You can use the cross-compilers from
https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/10.1.0/
to do this if you need kernel headers for an architecture that you have no
cross-compilers for, but they are build against glibc and won't run on
a musl based host, or anything other than x86-64, arm64 or ppc64le
that I built for.

I don't know if you can just run 'make headers_install' without configuring
first, or if that is something that can be easily changed if it doesn't already
work.

Arnd