xref: /aosp_15_r20/external/bcc/scripts/README.md (revision 387f9dfdfa2baef462e92476d413c7bc2470293e)
1*387f9dfdSAndroid Build Coastguard Worker
2*387f9dfdSAndroid Build Coastguard Worker## Fedora Demo VM
3*387f9dfdSAndroid Build Coastguard Worker
4*387f9dfdSAndroid Build Coastguard WorkerBefore running the script, ensure that virt-install is available on the system.
5*387f9dfdSAndroid Build Coastguard Worker
6*387f9dfdSAndroid Build Coastguard Worker`./build_bpf_demo.sh -n bpf-demo -k bpf_demo.ks.erb`
7*387f9dfdSAndroid Build Coastguard Worker
8*387f9dfdSAndroid Build Coastguard WorkerAfter setting up the initial VM, log in (the default password is 'iovisor')
9*387f9dfdSAndroid Build Coastguard Workerand determine the DHCP IP. SSH to this IP as root.
10*387f9dfdSAndroid Build Coastguard Worker
11*387f9dfdSAndroid Build Coastguard WorkerTo set up a kernel with the right options, run `bpf-kernel-setup`.
12*387f9dfdSAndroid Build Coastguard Worker
13*387f9dfdSAndroid Build Coastguard Worker```
14*387f9dfdSAndroid Build Coastguard Worker[root@bpf-demo ~]# bpf-kernel-setup
15*387f9dfdSAndroid Build Coastguard WorkerCloning into 'net-next'...
16*387f9dfdSAndroid Build Coastguard Worker```
17*387f9dfdSAndroid Build Coastguard WorkerAfter pulling the net-next branch, the kernel config menu should pop up. Ensure
18*387f9dfdSAndroid Build Coastguard Workerthat the below settings are proper.
19*387f9dfdSAndroid Build Coastguard Worker```
20*387f9dfdSAndroid Build Coastguard WorkerGeneral setup --->
21*387f9dfdSAndroid Build Coastguard Worker  [*] Enable bpf() system call
22*387f9dfdSAndroid Build Coastguard WorkerNetworking support --->
23*387f9dfdSAndroid Build Coastguard Worker  Networking options --->
24*387f9dfdSAndroid Build Coastguard Worker    QoS and/or fair queueing --->
25*387f9dfdSAndroid Build Coastguard Worker      <M> BPF-based classifier
26*387f9dfdSAndroid Build Coastguard Worker      <M> BPF based action
27*387f9dfdSAndroid Build Coastguard Worker    [*] enable BPF Just In Time compiler
28*387f9dfdSAndroid Build Coastguard Worker```
29*387f9dfdSAndroid Build Coastguard WorkerOnce the .config is saved, the build will proceed and install the resulting
30*387f9dfdSAndroid Build Coastguard Workerkernel. This kernel has updated userspace headers (e.g. the bpf() syscall) which
31*387f9dfdSAndroid Build Coastguard Workerinstall into /usr/local/include...proper packaging for this will be
32*387f9dfdSAndroid Build Coastguard Workerdistro-dependent.
33*387f9dfdSAndroid Build Coastguard Worker
34*387f9dfdSAndroid Build Coastguard WorkerNext, run `bpf-llvm-setup` to pull and compile LLVM with BPF support enabled.
35*387f9dfdSAndroid Build Coastguard Worker```
36*387f9dfdSAndroid Build Coastguard Worker[root@bpf-demo ~]# bpf-llvm-setup
37*387f9dfdSAndroid Build Coastguard WorkerCloning into 'llvm'...
38*387f9dfdSAndroid Build Coastguard Worker```
39*387f9dfdSAndroid Build Coastguard WorkerThe resulting libraries will be installed into /opt/local/llvm.
40*387f9dfdSAndroid Build Coastguard Worker
41*387f9dfdSAndroid Build Coastguard WorkerNext, reboot into the new kernel, either manually or by using the kexec helper.
42*387f9dfdSAndroid Build Coastguard Worker```
43*387f9dfdSAndroid Build Coastguard Worker[root@bpf-demo ~]# kexec-4.1.0-rc1+
44*387f9dfdSAndroid Build Coastguard WorkerConnection to 192.168.122.247 closed by remote host.
45*387f9dfdSAndroid Build Coastguard WorkerConnection to 192.168.122.247 closed.
46*387f9dfdSAndroid Build Coastguard Worker```
47*387f9dfdSAndroid Build Coastguard Worker
48*387f9dfdSAndroid Build Coastguard WorkerReconnect and run the final step, building and testing bcc.
49*387f9dfdSAndroid Build Coastguard Worker```
50*387f9dfdSAndroid Build Coastguard Worker[root@bpf-demo ~]# bcc-setup
51*387f9dfdSAndroid Build Coastguard WorkerCloning into 'bcc'...
52*387f9dfdSAndroid Build Coastguard Worker...
53*387f9dfdSAndroid Build Coastguard WorkerLinking CXX shared library libcc.so
54*387f9dfdSAndroid Build Coastguard Worker[100%] Built target bcc
55*387f9dfdSAndroid Build Coastguard Worker...
56*387f9dfdSAndroid Build Coastguard WorkerRunning tests...
57*387f9dfdSAndroid Build Coastguard WorkerTest project /root/bcc/build
58*387f9dfdSAndroid Build Coastguard Worker    Start 1: py_test1
59*387f9dfdSAndroid Build Coastguard Worker1/4 Test #1: py_test1 .........................   Passed    0.24 sec
60*387f9dfdSAndroid Build Coastguard Worker    Start 2: py_test2
61*387f9dfdSAndroid Build Coastguard Worker2/4 Test #2: py_test2 .........................   Passed    0.53 sec
62*387f9dfdSAndroid Build Coastguard Worker    Start 3: py_trace1
63*387f9dfdSAndroid Build Coastguard Worker3/4 Test #3: py_trace1 ........................   Passed    0.09 sec
64*387f9dfdSAndroid Build Coastguard Worker    Start 4: py_trace2
65*387f9dfdSAndroid Build Coastguard Worker4/4 Test #4: py_trace2 ........................   Passed    1.06 sec
66*387f9dfdSAndroid Build Coastguard Worker
67*387f9dfdSAndroid Build Coastguard Worker100% tests passed, 0 tests failed out of 4
68*387f9dfdSAndroid Build Coastguard Worker```
69