Message ID | 20210810064547.2579380-1-james.hilliard1@gmail.com |
---|---|
State | Changes Requested |
Headers | show |
Series | [1/2] package/linux-headers: enable host build | expand |
Hello James, On Tue, 10 Aug 2021 00:45:46 -0600 James Hilliard <james.hilliard1@gmail.com> wrote: > This will be used for building tools that are included with the kernel, > such as host-bpftool. > > Signed-off-by: James Hilliard <james.hilliard1@gmail.com> I'm sorry, but I fail to see how this can make sense, for a number of reasons: * For external toolchains, package/linux-headers/Config.in.host is not even included, which means that no version of kernel headers are defined. * Even for internal toolchains, the kernel headers version selected for the target, which you re-use here for the host kernel headers, has no correlation with the actual kernel running on the build machine. If you are running an oldish 3.10 kernel on your build machine, install host-linux-headers 5.15, and build host-bpftool based on that, you'll run into issue. So, perhaps the first thing is to figure out why the host variant of bpftool needs kernel headers. What are these tool doing on the host? What is the use case? Then if we really want to build them for the host, I guess the only solution is to ask the user to install the kernel headers matching their build machine (so with some hidden option BR2_NEEDS_HOST_KERNEL_HEADERS, which is selected by your package, and then with logic in support/dependencies/ to check that). Thanks! Thomas
On Tue, Dec 28, 2021 at 3:33 PM Thomas Petazzoni <thomas.petazzoni@bootlin.com> wrote: > > Hello James, > > On Tue, 10 Aug 2021 00:45:46 -0600 > James Hilliard <james.hilliard1@gmail.com> wrote: > > > This will be used for building tools that are included with the kernel, > > such as host-bpftool. > > > > Signed-off-by: James Hilliard <james.hilliard1@gmail.com> > > I'm sorry, but I fail to see how this can make sense, for a number of > reasons: > > * For external toolchains, package/linux-headers/Config.in.host is not > even included, which means that no version of kernel headers are > defined. > > * Even for internal toolchains, the kernel headers version selected > for the target, which you re-use here for the host kernel headers, > has no correlation with the actual kernel running on the build > machine. If you are running an oldish 3.10 kernel on your build > machine, install host-linux-headers 5.15, and build host-bpftool > based on that, you'll run into issue. Yeah, I wasn't sure if this would work, previously this tool was only available integrated with the kernel, but it has now been separated like libbpf so we can use that version instead which shouldn't require building from the kernel tree anymore. > > So, perhaps the first thing is to figure out why the host variant of > bpftool needs kernel headers. What are these tool doing on the host? > What is the use case? This tool is needed to generate bpf skeleton files, systemd needs this for example to enable bpf-framework support. > > Then if we really want to build them for the host, I guess the only > solution is to ask the user to install the kernel headers matching their > build machine (so with some hidden option > BR2_NEEDS_HOST_KERNEL_HEADERS, which is selected by your package, and > then with logic in support/dependencies/ to check that). I've made a patch to use the new stand-alone bpftool package instead: https://patchwork.ozlabs.org/project/buildroot/patch/20220131021609.4117295-1-james.hilliard1@gmail.com/ > > Thanks! > > Thomas > -- > Thomas Petazzoni, co-owner and CEO, Bootlin > Embedded Linux and Kernel engineering and training > https://bootlin.com
diff --git a/package/linux-headers/linux-headers.mk b/package/linux-headers/linux-headers.mk index a8d1c2ccaf..d171879bc9 100644 --- a/package/linux-headers/linux-headers.mk +++ b/package/linux-headers/linux-headers.mk @@ -135,6 +135,15 @@ define LINUX_HEADERS_CONFIGURE_CMDS headers_install) endef +define HOST_LINUX_HEADERS_CONFIGURE_CMDS + (cd $(@D); \ + $(HOST_MAKE_ENV) $(MAKE) \ + HOSTCC="$(HOSTCC)" \ + HOSTCFLAGS="$(HOSTCFLAGS)" \ + HOSTCXX="$(HOSTCXX)" \ + defconfig) +endef + define LINUX_HEADERS_INSTALL_STAGING_CMDS (cd $(@D); \ $(TARGET_MAKE_ENV) $(MAKE) \ @@ -160,3 +169,4 @@ LINUX_HEADERS_POST_INSTALL_STAGING_HOOKS += LINUX_HEADERS_CHECK_VERSION endif $(eval $(generic-package)) +$(eval $(host-generic-package))
This will be used for building tools that are included with the kernel, such as host-bpftool. Signed-off-by: James Hilliard <james.hilliard1@gmail.com> --- package/linux-headers/linux-headers.mk | 10 ++++++++++ 1 file changed, 10 insertions(+)