hc
2024-02-19 1c055e55a242a33e574e48be530e06770a210dcd
kernel/samples/bpf/README.rst
....@@ -14,6 +14,20 @@
1414 Note that LLVM's tool 'llc' must support target 'bpf', list version
1515 and supported targets with command: ``llc --version``
1616
17
+Clean and configuration
18
+-----------------------
19
+
20
+It can be needed to clean tools, samples or kernel before trying new arch or
21
+after some changes (on demand)::
22
+
23
+ make -C tools clean
24
+ make -C samples/bpf clean
25
+ make clean
26
+
27
+Configure kernel, defconfig for instance::
28
+
29
+ make defconfig
30
+
1731 Kernel headers
1832 --------------
1933
....@@ -32,12 +46,10 @@
3246 For building the BPF samples, issue the below command from the kernel
3347 top level directory::
3448
35
- make samples/bpf/
36
-
37
-Do notice the "/" slash after the directory name.
49
+ make M=samples/bpf
3850
3951 It is also possible to call make from this directory. This will just
40
-hide the the invocation of make as above with the appended "/".
52
+hide the invocation of make as above.
4153
4254 Manually compiling LLVM with 'bpf' support
4355 ------------------------------------------
....@@ -63,14 +75,31 @@
6375 It is also possible to point make to the newly compiled 'llc' or
6476 'clang' command via redefining LLC or CLANG on the make command line::
6577
66
- make samples/bpf/ LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang
78
+ make M=samples/bpf LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang
6779
6880 Cross compiling samples
6981 -----------------------
7082 In order to cross-compile, say for arm64 targets, export CROSS_COMPILE and ARCH
71
-environment variables before calling make. This will direct make to build
72
-samples for the cross target.
83
+environment variables before calling make. But do this before clean,
84
+cofiguration and header install steps described above. This will direct make to
85
+build samples for the cross target::
7386
74
-export ARCH=arm64
75
-export CROSS_COMPILE="aarch64-linux-gnu-"
76
-make samples/bpf/ LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang
87
+ export ARCH=arm64
88
+ export CROSS_COMPILE="aarch64-linux-gnu-"
89
+
90
+Headers can be also installed on RFS of target board if need to keep them in
91
+sync (not necessarily and it creates a local "usr/include" directory also)::
92
+
93
+ make INSTALL_HDR_PATH=~/some_sysroot/usr headers_install
94
+
95
+Pointing LLC and CLANG is not necessarily if it's installed on HOST and have
96
+in its targets appropriate arm64 arch (usually it has several arches).
97
+Build samples::
98
+
99
+ make M=samples/bpf
100
+
101
+Or build samples with SYSROOT if some header or library is absent in toolchain,
102
+say libelf, providing address to file system containing headers and libs,
103
+can be RFS of target board::
104
+
105
+ make M=samples/bpf SYSROOT=~/some_sysroot