public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kbuild: add resolve_btfids to pacman PKGBUILD
@ 2024-11-02 12:05 Peter Jung
  2024-11-03  4:39 ` Thomas Weißschuh
  2024-11-03  9:47 ` Masahiro Yamada
  0 siblings, 2 replies; 4+ messages in thread
From: Peter Jung @ 2024-11-02 12:05 UTC (permalink / raw)
  Cc: jose.fernandez, Peter Jung, Thomas Weißschuh,
	Christian Heusel, Nathan Chancellor, Masahiro Yamada,
	Nicolas Schier, linux-kbuild, linux-kernel, bpf

If the config is using DEBUG_INFO_BTF, it is required to,
package resolve_btfids with.
Compiling dkms modules will fail otherwise.

Add a check, if resolve_btfids is present and then package it, if required.

Signed-off-by: Peter Jung <admin@ptr1337.dev>
---
 scripts/package/PKGBUILD | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/scripts/package/PKGBUILD b/scripts/package/PKGBUILD
index f83493838cf9..4010899652b8 100644
--- a/scripts/package/PKGBUILD
+++ b/scripts/package/PKGBUILD
@@ -91,6 +91,11 @@ _package-headers() {
 		"${srctree}/scripts/package/install-extmod-build" "${builddir}"
 	fi
 
+	# required when DEBUG_INFO_BTF_MODULES is enabled
+	if [ -f tools/bpf/resolve_btfids/resolve_btfids ]; then
+		install -Dt "$builddir/tools/bpf/resolve_btfids" tools/bpf/resolve_btfids/resolve_btfids
+	fi
+
 	echo "Installing System.map and config..."
 	mkdir -p "${builddir}"
 	cp System.map "${builddir}/System.map"
-- 
2.47.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] kbuild: add resolve_btfids to pacman PKGBUILD
  2024-11-02 12:05 [PATCH] kbuild: add resolve_btfids to pacman PKGBUILD Peter Jung
@ 2024-11-03  4:39 ` Thomas Weißschuh
  2024-11-03  9:47 ` Masahiro Yamada
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Weißschuh @ 2024-11-03  4:39 UTC (permalink / raw)
  To: Peter Jung
  Cc: jose.fernandez, Christian Heusel, Nathan Chancellor,
	Masahiro Yamada, Nicolas Schier, linux-kbuild, linux-kernel, bpf

On 2024-11-02 13:05:26+0100, Peter Jung wrote:
> If the config is using DEBUG_INFO_BTF, it is required to,
> package resolve_btfids with.

This sentence sounds weird.

> Compiling dkms modules will fail otherwise.

Maybe we should add it to scripts/package/install-extmod-build so it
also works for all the other package types?

> Add a check, if resolve_btfids is present and then package it, if required.
> 
> Signed-off-by: Peter Jung <admin@ptr1337.dev>
> ---
>  scripts/package/PKGBUILD | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/scripts/package/PKGBUILD b/scripts/package/PKGBUILD
> index f83493838cf9..4010899652b8 100644
> --- a/scripts/package/PKGBUILD
> +++ b/scripts/package/PKGBUILD
> @@ -91,6 +91,11 @@ _package-headers() {
>  		"${srctree}/scripts/package/install-extmod-build" "${builddir}"
>  	fi
>  
> +	# required when DEBUG_INFO_BTF_MODULES is enabled
> +	if [ -f tools/bpf/resolve_btfids/resolve_btfids ]; then

I would prefer to actually test for DEBUG_INFO_BTF_MODULES instead of
file existence. This file may be stale when the option got disabled.

> +		install -Dt "$builddir/tools/bpf/resolve_btfids" tools/bpf/resolve_btfids/resolve_btfids
> +	fi
> +
>  	echo "Installing System.map and config..."
>  	mkdir -p "${builddir}"
>  	cp System.map "${builddir}/System.map"
> -- 
> 2.47.0
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] kbuild: add resolve_btfids to pacman PKGBUILD
  2024-11-02 12:05 [PATCH] kbuild: add resolve_btfids to pacman PKGBUILD Peter Jung
  2024-11-03  4:39 ` Thomas Weißschuh
@ 2024-11-03  9:47 ` Masahiro Yamada
  2024-11-04 14:44   ` Peter Jung
  1 sibling, 1 reply; 4+ messages in thread
From: Masahiro Yamada @ 2024-11-03  9:47 UTC (permalink / raw)
  To: Peter Jung
  Cc: jose.fernandez, Thomas Weißschuh, Christian Heusel,
	Nathan Chancellor, Nicolas Schier, linux-kbuild, linux-kernel,
	bpf

On Sat, Nov 2, 2024 at 9:06 PM Peter Jung <admin@ptr1337.dev> wrote:
>
> If the config is using DEBUG_INFO_BTF, it is required to,
> package resolve_btfids with.
> Compiling dkms modules will fail otherwise.
>
> Add a check, if resolve_btfids is present and then package it, if required.
>
> Signed-off-by: Peter Jung <admin@ptr1337.dev>
> ---
>  scripts/package/PKGBUILD | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/scripts/package/PKGBUILD b/scripts/package/PKGBUILD
> index f83493838cf9..4010899652b8 100644
> --- a/scripts/package/PKGBUILD
> +++ b/scripts/package/PKGBUILD
> @@ -91,6 +91,11 @@ _package-headers() {
>                 "${srctree}/scripts/package/install-extmod-build" "${builddir}"
>         fi
>
> +       # required when DEBUG_INFO_BTF_MODULES is enabled
> +       if [ -f tools/bpf/resolve_btfids/resolve_btfids ]; then
> +               install -Dt "$builddir/tools/bpf/resolve_btfids" tools/bpf/resolve_btfids/resolve_btfids
> +       fi
> +


This is not the right place.

scripts/package/install-extmod-build is a script to set up
the build environment to build external modules.
It is shared by rpm-pkg, deb-pkg, and pacman-pkg.


https://github.com/torvalds/linux/blob/v6.12-rc5/scripts/package/install-extmod-build#L34

You will see how objtool is copied.




(Anyway, it depends on your urgency.
My hope is to support objtool and resolve_btfids in more generic ways.)






-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] kbuild: add resolve_btfids to pacman PKGBUILD
  2024-11-03  9:47 ` Masahiro Yamada
@ 2024-11-04 14:44   ` Peter Jung
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Jung @ 2024-11-04 14:44 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: jose.fernandez, Thomas Weißschuh, Christian Heusel,
	Nathan Chancellor, Nicolas Schier, linux-kbuild, linux-kernel,
	bpf


On 03.11.24 10:47, Masahiro Yamada wrote:
> On Sat, Nov 2, 2024 at 9:06 PM Peter Jung<admin@ptr1337.dev> wrote:
>> If the config is using DEBUG_INFO_BTF, it is required to,
>> package resolve_btfids with.
>> Compiling dkms modules will fail otherwise.
>>
>> Add a check, if resolve_btfids is present and then package it, if required.
>>
>> Signed-off-by: Peter Jung<admin@ptr1337.dev>
>> ---
>>   scripts/package/PKGBUILD | 5 +++++
>>   1 file changed, 5 insertions(+)
>>
>> diff --git a/scripts/package/PKGBUILD b/scripts/package/PKGBUILD
>> index f83493838cf9..4010899652b8 100644
>> --- a/scripts/package/PKGBUILD
>> +++ b/scripts/package/PKGBUILD
>> @@ -91,6 +91,11 @@ _package-headers() {
>>                  "${srctree}/scripts/package/install-extmod-build" "${builddir}"
>>          fi
>>
>> +       # required when DEBUG_INFO_BTF_MODULES is enabled
>> +       if [ -f tools/bpf/resolve_btfids/resolve_btfids ]; then
>> +               install -Dt "$builddir/tools/bpf/resolve_btfids" tools/bpf/resolve_btfids/resolve_btfids
>> +       fi
>> +
> This is not the right place.
>
> scripts/package/install-extmod-build is a script to set up
> the build environment to build external modules.
> It is shared by rpm-pkg, deb-pkg, and pacman-pkg.
>
>
> https://github.com/torvalds/linux/blob/v6.12-rc5/scripts/package/install-extmod-build#L34
>
> You will see how objtool is copied.
>
>
>
>
> (Anyway, it depends on your urgency.
> My hope is to support objtool and resolve_btfids in more generic ways.)
>

Thanks Masahiro for the suggestion. I will look into and likely bring a v2.
I did not know about other distribution/package managers, if this is 
also a problem at them.

At archlinux we have included this since a while already in the 
PKGBUILD, see here:
https://gitlab.archlinux.org/archlinux/packaging/packages/linux/-/blob/main/PKGBUILD?ref_type=heads#L151-152

I will also make the change to grep for DEBUG_INFO_BTF in the config 
with the is_enabled function, instead of checking the path


Regards,

Peter


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-11-04 14:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-02 12:05 [PATCH] kbuild: add resolve_btfids to pacman PKGBUILD Peter Jung
2024-11-03  4:39 ` Thomas Weißschuh
2024-11-03  9:47 ` Masahiro Yamada
2024-11-04 14:44   ` Peter Jung

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox