diff options
author | Masahiro Yamada <masahiroy@kernel.org> | 2020-04-29 12:45:14 +0900 |
---|---|---|
committer | Masahiro Yamada <masahiroy@kernel.org> | 2020-05-17 18:52:01 +0900 |
commit | 7f3a59db274c3e3d884c785e363a054110f1c266 (patch) | |
tree | 1fa677287ef851e18ba143a8a943d93a74e16585 /Documentation/leds/leds-lp5523.rst | |
parent | b1183b6dca3e0d59ce8fa81767def6ea6188e8ec (diff) | |
download | linux-7f3a59db274c3e3d884c785e363a054110f1c266.tar.bz2 |
kbuild: add infrastructure to build userspace programs
Kbuild supports the infrastructure to build host programs, but there
was no support to build userspace programs for the target architecture
(i.e. the same architecture as the kernel).
Sam Ravnborg worked on this in 2014 (https://lkml.org/lkml/2014/7/13/154),
but it was not merged. One problem at that time was, there was no good way
to know whether $(CC) can link standalone programs. In fact, pre-built
kernel.org toolchains [1] are often used for building the kernel, but they
do not provide libc.
Now, we can handle this cleanly because the compiler capability is
evaluated at the Kconfig time. If $(CC) cannot link standalone programs,
the relevant options are hidden by 'depends on CC_CAN_LINK'.
The implementation just mimics scripts/Makefile.host
The userspace programs are compiled with the same flags as the host
programs. In addition, it uses -m32 or -m64 if it is found in
$(KBUILD_CFLAGS).
This new syntax has two usecases.
- Sample programs
Several userspace programs under samples/ include UAPI headers
installed in usr/include. Most of them were previously built for
the host architecture just to use the 'hostprogs' syntax.
However, 'make headers' always works for the target architecture.
This caused the arch mismatch in cross-compiling. To fix this
distortion, sample code should be built for the target architecture.
- Bpfilter
net/bpfilter/Makefile compiles bpfilter_umh as the user mode helper,
and embeds it into the kernel. Currently, it overrides HOSTCC with
CC to use the 'hostprogs' syntax. This hack should go away.
[1]: https://mirrors.edge.kernel.org/pub/tools/crosstool/
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'Documentation/leds/leds-lp5523.rst')
0 files changed, 0 insertions, 0 deletions