Lines Matching +full:linux +full:- +full:kernel
2 …<source media="(prefers-color-scheme: dark)" srcset="assets/libbpf-logo-sideways-darkbg.png" width…
3 <img src="assets/libbpf-logo-sideways.png" width="40%">
9 Libbpf *authoritative source code* is developed as part of [bpf-next Linux source
10 tree](https://kernel.googlesource.com/pub/scm/linux/kernel/git/bpf/bpf-next) under
13 Most of the mundane mechanical things like bpf and bpf-next tree merge, Git
14 history transformation, cherry-picking relevant commits, re-generating
15 auto-generated headers, etc. are taken care by
16 [sync-kernel.sh script](https://github.com/libbpf/libbpf/blob/master/scripts/sync-kernel.sh).
20 This document goes over the process of syncing libbpf sources from Linux repo
25 ------------------
27 Sync script has particular expectation of upstream Linux repo setup. It
28 expects that current HEAD of that repo points to bpf-next's master branch and
33 Below, we assume that Linux repo is located at `~/linux`, it's current head is
34 at latest `bpf-next/master`, and libbpf's Github repo is located at
36 from where to run `sync-kernel.sh` script, but we'll be running it from inside
40 $ cd ~/linux && git remote -v | grep -E '^(bpf|bpf-next)'
41 bpf https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git (fetch)
42 bpf ssh://git@gitolite.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git
44 bpf-next
45 https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git (fetch)
46 bpf-next
47 ssh://git@gitolite.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git (push)
48 $ git branch -vv | grep -E '^? (master|bpf-master)'
49 * bpf-master 2d311f480b52 [bpf/master] riscv, bpf: Fix patch_text imp…
50 …master c8ee37bde402 [bpf-next/master] libbpf: Fix bpf_xdp_query(…
51 $ git checkout bpf-master && git pull && git checkout master && git pull
53 $ git log --oneline -n1
54 c8ee37bde402 (HEAD -> master, bpf-next/master) libbpf: Fix bpf_xdp_query() in old kernels
61 --------------------
63 First step is to always run `sync-kernel.sh` script. It expects three arguments:
66 $ scripts/sync-kernel.sh <libbpf-repo> <kernel-repo> <bpf-branch>
69 Note, that we'll store script's entire output in `/tmp/libbpf-sync.txt` and
74 $ scripts/sync-kernel.sh ~/libbpf ~/linux bpf-master | tee /tmp/libbpf-sync.txt
77 LINUX REPO: /home/andriin/linux
85 will show you a diff between expected state as of latest bpf-next and synced
93 --- /home/andriin/linux/include/uapi/linux/netdev.h 2023-02-27 16:54:42.270583372 -0800
94 +++ /home/andriin/libbpf/include/uapi/linux/netdev.h 2023-02-27 16:54:34.615530796 -0800
95 @@ -19,7 +19,7 @@
99 - * oflloading.
101 * @NETDEV_XDP_ACT_RX_SG: This feature informs if netdev implements non-linear
104 /home/andriin/linux/include/uapi/linux/netdev.h and /home/andriin/libbpf/include/uapi/linux/netdev.…
111 If sync is successful, your `~/linux` repo will be left in original state on
113 `libbpf-sync-<timestamp>` (e.g., `libbpf-sync-2023-02-28T00-53-40.072Z`).
118 $ git push --set-upstream origin libbpf-sync-2023-02-28T00-53-40.072Z
124 Total 32 (delta 21), reused 0 (delta 0), pack-reused 0
127 remote: Create a pull request for 'libbpf-sync-2023-02-28T00-53-40.072Z' on GitHub by visiting:
128 remote: https://github.com/anakryiko/libbpf/pull/new/libbpf-sync-2023-02-28T00-53-40.072Z
131 …* [new branch] libbpf-sync-2023-02-28T00-53-40.072Z -> libbpf-sync-2023-02-28T00-53…
132 Branch 'libbpf-sync-2023-02-28T00-53-40.072Z' set up to track remote branch 'libbpf-sync-2023-02-28…
140 "Libbpf sync 2023-02-28T00:53:40.072Z". Thank you!
142 **Please don't forget to paste contents of /tmp/libbpf-sync.txt into PR
149 **Please, keep naming and style consistent.** Prefix CI-related fixes with `ci: `
151 sure that each such commit has `Signed-off-by: Your Full Name <your@email.com>`,
152 just like you'd do that for Linux upstream patch. Libbpf closely follows kernel
156 ---------------------
159 kernel repository, it may be necessary to add these to the build system
170 -------------------------
172 Libbpf CI intentionally runs a subset of latest BPF selftests on old kernel
175 reliance on some freshly added kernel feature. It might look something like this in [CI logs](https…
190 $ find . -name '*LIST*'
191 ./ci/vmtest/configs/ALLOWLIST-4.9.0
192 ./ci/vmtest/configs/DENYLIST-5.5.0
193 ./ci/vmtest/configs/DENYLIST-latest.s390x
194 ./ci/vmtest/configs/DENYLIST-latest
195 ./ci/vmtest/configs/ALLOWLIST-5.5.0
204 -----------------------------
206 To compile latest BPF selftests against old kernels, we check in pre-generated
207 [vmlinux.h](https://github.com/libbpf/libbpf/blob/master/.github/actions/build-selftests/vmlinux.h)
208 header file, located at `.github/actions/build-selftests/vmlinux.h`, which
209 contains type definitions from latest upstream kernel. When after libbpf sync
210 upstream BPF selftests require new kernel types, we'd need to regenerate
217 …kernel/tools/testing/selftests/bpf/bpf_experimental.h:73:53: error: declaration of 'struct bpf_rb_…
220 …kernel/tools/testing/selftests/bpf/bpf_experimental.h:81:35: error: declaration of 'struct bpf_rb_…
223 …kernel/tools/testing/selftests/bpf/bpf_experimental.h:90:52: error: declaration of 'struct bpf_rb_…
227 …make: *** [Makefile:572: /home/runner/work/libbpf/libbpf/.kernel/tools/testing/selftests/bpf/test_…
232 You'll need to build latest upstream kernel from `bpf-next` tree, using BPF
233 selftest configs. Concat arch-agnostic and arch-specific configs, build kernel,
237 $ cd ~/linux
240 $ make -j$(nproc) olddefconfig all
242 $ bpftool btf dump file ~/linux/vmlinux format c > ~/libbpf/.github/actions/build-selftests/vmlinux…
243 $ cd ~/libbpf && git add . && git commit -s
252 ---------------
255 user, you might end up with `~/linux` repo on temporary sync-related branch.
257 "copy-on-write" philosophy and creates new branches where necessary. So it's
262 $ git branch | grep -E 'libbpf-.*Z'
263 libbpf-baseline-2023-02-28T00-43-35.146Z
264 libbpf-bpf-baseline-2023-02-28T00-43-35.146Z
265 libbpf-bpf-tip-2023-02-28T00-43-35.146Z
266 libbpf-squash-base-2023-02-28T00-43-35.146Z
267 * libbpf-squash-tip-2023-02-28T00-43-35.146Z
268 $ git cherry-pick --abort
269 $ git checkout master && git branch | grep -E 'libbpf-.*Z' | xargs git br -D
271 Your branch is up to date with 'bpf-next/master'.
272 Deleted branch libbpf-baseline-2023-02-28T00-43-35.146Z (was 951bce29c898).
273 Deleted branch libbpf-bpf-baseline-2023-02-28T00-43-35.146Z (was 3a70e0d4c9d7).
274 Deleted branch libbpf-bpf-tip-2023-02-28T00-43-35.146Z (was 2d311f480b52).
275 Deleted branch libbpf-squash-base-2023-02-28T00-43-35.146Z (was 957f109ef883).
276 Deleted branch libbpf-squash-tip-2023-02-28T00-43-35.146Z (was be66130d2339).
277 Deleted branch libbpf-tip-2023-02-28T00-43-35.146Z (was 2d311f480b52).