* [Buildroot] [RFC PATCH v1 0/2] Use host-libbpf for host-pahole.
@ 2022-04-22 18:16 Francis Laniel
2022-04-22 18:16 ` [Buildroot] [RFC PATCH v1 1/2] package/libbpf: build for host Francis Laniel
2022-04-22 18:16 ` [Buildroot] [RFC PATCH v1 2/2] package/pahole: use commit 73383b3a39af Francis Laniel
0 siblings, 2 replies; 4+ messages in thread
From: Francis Laniel @ 2022-04-22 18:16 UTC (permalink / raw)
To: buildroot; +Cc: Francis Laniel, Romain Naour, Thomas Petazzoni
Hi.
Following a failed build involving libbpf, Thomas Pettazzoni suggested me to
remove git submodule from host-pahole to build it the "buildroot way".
So, in this contribution, I first added host recipe to libbpf.
Then, I removed git submobule used by host-pahole to get libbpf to instead use
host-libbpf.
I was able to build and run a qemu image:
Welcome to Buildroot
buildroot login: root
# zcat /proc/config.gz | grep BTF
CONFIG_DEBUG_INFO_BTF=y
CONFIG_PAHOLE_HAS_SPLIT_BTF=y
CONFIG_DEBUG_INFO_BTF_MODULES=y
Nonetheless, I am not really happy with this contribution as I had to add a bad
tweak removing a header file installed by host-libbpf to avoid a kernel build
error:
So, I marked this contribution as RFC to get your opinions about it.
Francis Laniel (2):
package/libbpf: build for host
package/pahole: use commit 73383b3a39af
linux/linux.mk | 11 +++++++++++
package/libbpf/libbpf.mk | 7 +++++++
package/pahole/pahole.hash | 2 +-
package/pahole/pahole.mk | 14 +++++++-------
4 files changed, 26 insertions(+), 8 deletions(-)
Best regards and thank you in advance.
--
2.25.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Buildroot] [RFC PATCH v1 1/2] package/libbpf: build for host
2022-04-22 18:16 [Buildroot] [RFC PATCH v1 0/2] Use host-libbpf for host-pahole Francis Laniel
@ 2022-04-22 18:16 ` Francis Laniel
2022-04-30 15:46 ` Arnout Vandecappelle
2022-04-22 18:16 ` [Buildroot] [RFC PATCH v1 2/2] package/pahole: use commit 73383b3a39af Francis Laniel
1 sibling, 1 reply; 4+ messages in thread
From: Francis Laniel @ 2022-04-22 18:16 UTC (permalink / raw)
To: buildroot; +Cc: Francis Laniel, Romain Naour, Thomas Petazzoni
Signed-off-by: Francis Laniel <flaniel@linux.microsoft.com>
---
package/libbpf/libbpf.mk | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/package/libbpf/libbpf.mk b/package/libbpf/libbpf.mk
index d6914757d7..709277fac4 100644
--- a/package/libbpf/libbpf.mk
+++ b/package/libbpf/libbpf.mk
@@ -10,6 +10,7 @@ LIBBPF_LICENSE = GPL-2.0, LGPL-2.1, BSD-2-Clause
LIBBPF_LICENSE_FILES = LICENSE LICENSE.BSD-2-Clause LICENSE.LGPL-2.1
LIBBPF_CPE_ID_VENDOR = libbpf_project
LIBBPF_DEPENDENCIES = host-bison host-flex host-pkgconf elfutils zlib
+HOST_LIBBPF_DEPENDENCIES = host-bison host-flex host-pkgconf host-elfutils host-zlib
LIBBPF_INSTALL_STAGING = YES
define LIBBPF_BUILD_CMDS
@@ -38,4 +39,28 @@ define LIBBPF_INSTALL_TARGET_CMDS
-C $(@D)/src install DESTDIR=$(TARGET_DIR)
endef
+define HOST_LIBBPF_INSTALL_CMDS
+ $(HOST_MAKE_ENV) $(HOST_CONFIGURE_OPTS) $(MAKE) \
+ -C $(@D)/src install install_uapi_headers DESTDIR=$(HOST_DIR)
+
+ # We need to install_uapi_headers so we have btf.h to compile
+ # host-pahole.
+ # Nonetheless, this target adds bpf.h which generates a conflict when
+ # building the kernel:
+ # In file included from libbpf_internal.h:17:0, from strset.c:9:
+ # relo_core.h:10:6: error: nested redefinition of ‘enum bpf_core_relo_kind’
+ # enum bpf_core_relo_kind {
+ # ^~~~~~~~~~~~~~~~~~
+ # relo_core.h:10:6: error: redeclaration of ‘enum bpf_core_relo_kind’
+ # In file included from libbpf_legacy.h:13:0,
+ # from libbpf_internal.h:16,
+ # from strset.c:9:
+ # /home/francis/buildroot/output/host/include/linux/bpf.h:6497:6: note: originally defined here
+ # enum bpf_core_relo_kind {
+ # So, better to remove remove it now since we do not need it to build
+ # host-pahole.
+ rm $(HOST_DIR)/include/linux/bpf.h
+endef
+
$(eval $(generic-package))
+$(eval $(host-generic-package))
--
2.25.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Buildroot] [RFC PATCH v1 2/2] package/pahole: use commit 73383b3a39af
2022-04-22 18:16 [Buildroot] [RFC PATCH v1 0/2] Use host-libbpf for host-pahole Francis Laniel
2022-04-22 18:16 ` [Buildroot] [RFC PATCH v1 1/2] package/libbpf: build for host Francis Laniel
@ 2022-04-22 18:16 ` Francis Laniel
1 sibling, 0 replies; 4+ messages in thread
From: Francis Laniel @ 2022-04-22 18:16 UTC (permalink / raw)
To: buildroot; +Cc: Francis Laniel, Romain Naour, Thomas Petazzoni
This modification uses buildroot host-libbpf instead of pahole libbpf git
submodule.
Also, it nows uses commit:
73383b3a39af ("libbpf: Update libbpf to the latest git HEAD")
To avoid compile errors due to use of depecrated APIs (like btf__get_nr_types).
A build pre hook was also added to Linux to avoid conflicts regarding bpf.h
which added to HOST_DIR by host-libbpf.
Signed-off-by: Francis Laniel <flaniel@linux.microsoft.com>
---
package/pahole/pahole.hash | 2 +-
package/pahole/pahole.mk | 14 +++++++-------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/package/pahole/pahole.hash b/package/pahole/pahole.hash
index 420db15e75..8e5560b5e7 100644
--- a/package/pahole/pahole.hash
+++ b/package/pahole/pahole.hash
@@ -1,3 +1,3 @@
# Locally computed
-sha256 cde85af68b368f50a913be387f94f6b43612a04af6c92387b4dcabb712a668fe pahole-v1.23-br1.tar.gz
+sha256 3531396c0568793ef8ca1a2fbb44ef2e1e81bdd55496a4487b83ba4d95df9d99 pahole-73383b3a39afe86b22e098773e47b8546c48a649.tar.gz
sha256 ab15fd526bd8dd18a9e77ebc139656bf4d33e97fc7238cd11bf60e2b9b8666c6 COPYING
diff --git a/package/pahole/pahole.mk b/package/pahole/pahole.mk
index da6d67e6a2..199fa8cc11 100644
--- a/package/pahole/pahole.mk
+++ b/package/pahole/pahole.mk
@@ -4,14 +4,14 @@
#
################################################################################
-PAHOLE_VERSION = v1.23
-PAHOLE_SITE = https://git.kernel.org/pub/scm/devel/pahole/pahole.git
-PAHOLE_SITE_METHOD = git
-# pahole contains git submodule and relies on them to be built.
-PAHOLE_GIT_SUBMODULES = YES
-HOST_PAHOLE_DEPENDENCIES = host-elfutils
+PAHOLE_VERSION = 73383b3a39afe86b22e098773e47b8546c48a649
+PAHOLE_SITE = https://git.kernel.org/pub/scm/devel/pahole/pahole.git/snapshot
+HOST_PAHOLE_DEPENDENCIES = \
+ host-elfutils \
+ host-libbpf
# Defining __LIB is needed to build pahole.
-HOST_PAHOLE_CONF_OPTS = -D__LIB=lib
+# Set LIBBPF_EMBEDDED to OFF to use host-libbpf.
+HOST_PAHOLE_CONF_OPTS = -D__LIB=lib -DLIBBPF_EMBEDDED=OFF
PAHOLE_LICENSE = GPL-2.0
PAHOLE_LICENSE_FILES = COPYING
--
2.25.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Buildroot] [RFC PATCH v1 1/2] package/libbpf: build for host
2022-04-22 18:16 ` [Buildroot] [RFC PATCH v1 1/2] package/libbpf: build for host Francis Laniel
@ 2022-04-30 15:46 ` Arnout Vandecappelle
0 siblings, 0 replies; 4+ messages in thread
From: Arnout Vandecappelle @ 2022-04-30 15:46 UTC (permalink / raw)
To: Francis Laniel, buildroot; +Cc: Romain Naour, Thomas Petazzoni
On 22/04/2022 20:16, Francis Laniel wrote:
> Signed-off-by: Francis Laniel <flaniel@linux.microsoft.com>
> ---
> package/libbpf/libbpf.mk | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/package/libbpf/libbpf.mk b/package/libbpf/libbpf.mk
> index d6914757d7..709277fac4 100644
> --- a/package/libbpf/libbpf.mk
> +++ b/package/libbpf/libbpf.mk
> @@ -10,6 +10,7 @@ LIBBPF_LICENSE = GPL-2.0, LGPL-2.1, BSD-2-Clause
> LIBBPF_LICENSE_FILES = LICENSE LICENSE.BSD-2-Clause LICENSE.LGPL-2.1
> LIBBPF_CPE_ID_VENDOR = libbpf_project
> LIBBPF_DEPENDENCIES = host-bison host-flex host-pkgconf elfutils zlib
> +HOST_LIBBPF_DEPENDENCIES = host-bison host-flex host-pkgconf host-elfutils host-zlib
> LIBBPF_INSTALL_STAGING = YES
>
> define LIBBPF_BUILD_CMDS
> @@ -38,4 +39,28 @@ define LIBBPF_INSTALL_TARGET_CMDS
> -C $(@D)/src install DESTDIR=$(TARGET_DIR)
> endef
>
> +define HOST_LIBBPF_INSTALL_CMDS
> + $(HOST_MAKE_ENV) $(HOST_CONFIGURE_OPTS) $(MAKE) \
> + -C $(@D)/src install install_uapi_headers DESTDIR=$(HOST_DIR)
> +
> + # We need to install_uapi_headers so we have btf.h to compile
> + # host-pahole.
> + # Nonetheless, this target adds bpf.h which generates a conflict when
> + # building the kernel:
> + # In file included from libbpf_internal.h:17:0, from strset.c:9:
> + # relo_core.h:10:6: error: nested redefinition of ‘enum bpf_core_relo_kind’
> + # enum bpf_core_relo_kind {
> + # ^~~~~~~~~~~~~~~~~~
> + # relo_core.h:10:6: error: redeclaration of ‘enum bpf_core_relo_kind’
> + # In file included from libbpf_legacy.h:13:0,
> + # from libbpf_internal.h:16,
> + # from strset.c:9:
> + # /home/francis/buildroot/output/host/include/linux/bpf.h:6497:6: note: originally defined here
> + # enum bpf_core_relo_kind {
> + # So, better to remove remove it now since we do not need it to build
> + # host-pahole.
This entire comment shows up in the build log because make echoes commands and
these are commands. So I moved it outside of the define.
Applied both to master, thanks. In the second commit, I also reworded the
commit message a bit.
Regards,
Arnout
> + rm $(HOST_DIR)/include/linux/bpf.h
> +endef
> +
> $(eval $(generic-package))
> +$(eval $(host-generic-package))
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-04-30 15:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-22 18:16 [Buildroot] [RFC PATCH v1 0/2] Use host-libbpf for host-pahole Francis Laniel
2022-04-22 18:16 ` [Buildroot] [RFC PATCH v1 1/2] package/libbpf: build for host Francis Laniel
2022-04-30 15:46 ` Arnout Vandecappelle
2022-04-22 18:16 ` [Buildroot] [RFC PATCH v1 2/2] package/pahole: use commit 73383b3a39af Francis Laniel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox