From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, "Toke Høiland-Jørgensen" <toke@redhat.com>
Subject: Re: [PATCH bpf] samples: bpf: Fix vmlinux.h generation for XDP samples
Date: Mon, 27 Sep 2021 21:36:09 -0700 [thread overview]
Message-ID: <CAEf4BzaCyCZoUGjY8_-+WUV6DMxHvcJLGLb+gYxZrA5YDwbU=w@mail.gmail.com> (raw)
In-Reply-To: <20210928041329.1735524-1-memxor@gmail.com>
On Mon, Sep 27, 2021 at 9:16 PM Kumar Kartikeya Dwivedi
<memxor@gmail.com> wrote:
>
> Generate vmlinux.h only from the in-tree vmlinux, and remove enum
> declarations that would cause a build failure in case of version
> mismatches.
>
> There are now two options when building the samples:
> 1. Compile the kernel to use in-tree vmlinux for vmlinux.h
> 2. Override VMLINUX_BTF for samples using something like this:
> make VMLINUX_BTF=/sys/kernel/btf/vmlinux -C samples/bpf
>
> This change was tested with relative builds, e.g. cases like:
> * make O=build -C samples/bpf
> * make KBUILD_OUTPUT=build -C samples/bpf
> * make -C samples/bpf
> * cd samples/bpf && make
>
> When a suitable VMLINUX_BTF is not found, the following message is
> printed:
> /home/kkd/src/linux/samples/bpf/Makefile:333: *** Cannot find a vmlinux
> for VMLINUX_BTF at any of " ./vmlinux", build the kernel or set
> VMLINUX_BTF variable. Stop.
>
> Cc: Toke Høiland-Jørgensen <toke@redhat.com>
> Fixes: 384b6b3bbf0d (samples: bpf: Add vmlinux.h generation support)
> Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
> ---
> samples/bpf/Makefile | 13 ++++++-------
> samples/bpf/xdp_redirect_map_multi.bpf.c | 5 -----
> 2 files changed, 6 insertions(+), 12 deletions(-)
>
> diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
> index 4dc20be5fb96..a05130e91403 100644
> --- a/samples/bpf/Makefile
> +++ b/samples/bpf/Makefile
> @@ -324,15 +324,9 @@ $(obj)/hbm_edt_kern.o: $(src)/hbm.h $(src)/hbm_kern.h
>
> VMLINUX_BTF_PATHS ?= $(if $(O),$(O)/vmlinux) \
> $(if $(KBUILD_OUTPUT),$(KBUILD_OUTPUT)/vmlinux) \
> - ../../../../vmlinux \
> - /sys/kernel/btf/vmlinux \
> - /boot/vmlinux-$(shell uname -r)
> + ./vmlinux
isn't this relative to samples/bpf subdirectory, so shouldn't it be
../../vmlinux?
> VMLINUX_BTF ?= $(abspath $(firstword $(wildcard $(VMLINUX_BTF_PATHS))))
>
> -ifeq ($(VMLINUX_BTF),)
> -$(error Cannot find a vmlinux for VMLINUX_BTF at any of "$(VMLINUX_BTF_PATHS)")
> -endif
> -
[...]
next prev parent reply other threads:[~2021-09-28 4:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-28 4:13 [PATCH bpf] samples: bpf: Fix vmlinux.h generation for XDP samples Kumar Kartikeya Dwivedi
2021-09-28 4:36 ` Andrii Nakryiko [this message]
2021-09-28 4:51 ` Kumar Kartikeya Dwivedi
2021-09-28 5:28 ` Andrii Nakryiko
2021-09-28 5:44 ` Kumar Kartikeya Dwivedi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAEf4BzaCyCZoUGjY8_-+WUV6DMxHvcJLGLb+gYxZrA5YDwbU=w@mail.gmail.com' \
--to=andrii.nakryiko@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=memxor@gmail.com \
--cc=toke@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).