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