Commit 32326203 authored by Brenden Blanco's avatar Brenden Blanco

Updates to README and INSTALL documents

* Some changes to python API examples
* Reflect non-rc kernel availability in install doc
* Add binary rpm section to install doc
* Remove docker build instructions
Signed-off-by: default avatarBrenden Blanco <bblanco@plumgrid.com>
parent 3df1288d
......@@ -4,9 +4,9 @@ Install a 4.2+ kernel from http://kernel.ubuntu.com/~kernel-ppa/mainline,
for example:
```bash
VER=4.2.0-040200rc5
REL=201508030228
PREFIX=http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.2-rc5-unstable
VER=4.2.0-040200
REL=201508301530
PREFIX=http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.2-unstable
wget ${PREFIX}/linux-headers-${VER}-generic_${VER}.${REL}_amd64.deb
wget ${PREFIX}/linux-headers-${VER}_${VER}.${REL}_all.deb
wget ${PREFIX}/linux-image-${VER}-generic_${VER}.${REL}_amd64.deb
......@@ -22,7 +22,7 @@ To install:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D4284CDD
echo "deb http://52.8.15.63/apt trusty main" | sudo tee /etc/apt/sources.list.d/iovisor.list
sudo apt-get update
sudo apt-get install libbcc
sudo apt-get install libbcc libbcc-examples python-bcc
```
Test it:
......@@ -36,24 +36,24 @@ cd pyroute2; sudo make install
sudo python /usr/share/bcc/examples/simple_tc.py
```
# Fedora - Docker edition
The build dependencies are captured in a [Dockerfile](Dockerfile.fedora), the
output of which is a .rpm for easy installation. This version takes longer since
LLVM needs to be compiled from source.
* Start with a recent Fedora install (tested with F22)
* Install a [>= 4.2 kernel](http://alt.fedoraproject.org/pub/alt/rawhide-kernel-nodebug/x86_64/)
with headers
* Reboot
* Install [docker](https://docs.docker.com/installation/fedora/)
* Run the Dockerfile for Fedora - results in an installable .rpm
* `git clone https://github.com/iovisor/bcc; cd bcc`
* `docker build -t bcc -f Dockerfile.fedora .`
* `docker run --rm -v /tmp:/mnt bcc sh -c "cp /root/bcc/build/*.rpm /mnt"`
* `sudo rpm -ivh /tmp/libbcc*.rpm`
* Run the example
* `sudo python /usr/share/bcc/examples/hello_world.py`
# Fedora - Binary
Install a 4.2+ kernel from
http://alt.fedoraproject.org/pub/alt/rawhide-kernel-nodebug, for example:
```bash
sudo wget http://alt.fedoraproject.org/pub/alt/rawhide-kernel-nodebug/fedora-rawhide-kernel-nodebug.repo -O /etc/yum.repos.d/fedora-rawhide-kernel-nodebug.repo
sudo dnf install -y kernel-core-4.2.0-1.fc24.x86_64 kernel-4.2.0-1.fc24.x86_64 kernel-devel-4.2.0-1.fc24.x86_64 kernel-modules-4.2.0-1.fc24.x86_64 kernel-headers-4.2.0-1.fc24.x86_64
# reboot
```
Tagged binary packages are built for Fedora 22 and hosted at http://52.8.15.63/yum/.
To install:
```bash
wget http://52.8.15.63/yum/main/f22/iovisor.repo -O /etc/yum.repos.d/iovisor.repo
dnf install -y libbcc libbcc-examples python-bcc
```
# Ubuntu - From source
......@@ -79,3 +79,19 @@ To build the toolchain from source, one needs:
* `make`
* `sudo make install`
# Fedora - From source
* Install build dependencies
* `sudo dnf install -y cmake ethtool git iperf libstdc++-static python-netaddr python-pip gcc gcc-c++ make zlib-devel`
* `sudo dnf install -y http://pkgs.repoforge.org/netperf/netperf-2.6.0-1.el6.rf.x86_64.rpm`
* `sudo pip install pyroute2`
* Install binary clang
* `wget http://llvm.org/releases/3.7.0/clang+llvm-3.7.0-x86_64-fedora22.tar.xz`
* `sudo tar xf clang+llvm-3.7.0-x86_64-fedora22.tar.xz -C /usr/local --strip 1`
* Install and compile BCC
* `git clone https://github.com/iovisor/bcc.git`
* `mkdir bcc/build; cd bcc/build`
* [optional] `export CC=/usr/local/bin/clang CXX=/usr/local/bin/clang++`
* `cmake .. -DCMAKE_INSTALL_PREFIX=/usr`
* `make`
* `sudo make install`
......@@ -41,6 +41,7 @@ The features of this toolkit include:
tc actions, and kprobes
* Bindings for Python
* Examples for socket filters, tc classifiers, and kprobes
* Self-contained tools for tracing a running system
In the future, more bindings besides python will likely be supported. Feel free
to add support for the language of your choice and send a pull request!
......@@ -77,19 +78,14 @@ For this example, we will call the program every time `fork()` is called by a
userspace process. Underneath the hood, fork translates to the `clone` syscall,
so we will attach our program to the kernel symbol `sys_clone`.
```python
fn = b.load_func("hello", BPF.KPROBE)
BPF.attach_kprobe(fn, "sys_clone")
b.attach_kprobe(event="sys_clone", fn_name="hello")
```
The python process will then print the trace printk circular buffer until ctrl-c
is pressed. The BPF program is removed from the kernel when the userspace
process that loaded it closes the fd (or exits).
```python
from subprocess import call
try:
call(["cat", "/sys/kernel/debug/tracing/trace_pipe"])
except KeyboardInterrupt:
pass
b.trace_print()
```
Output:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment