forked from iovisor/bcc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bpf_demo.ks.erb
127 lines (102 loc) · 2.93 KB
/
bpf_demo.ks.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# Minimal Kickstart file
install
text
reboot
lang en_US.UTF-8
# repo to install the OS
url --url=<%= @mirror %>/Everything/x86_64/os/
keyboard us
network --bootproto dhcp
rootpw <%= @password %>
authconfig --enableshadow --passalgo=sha512 --enablefingerprint
firewall --enabled --ssh
selinux --enforcing
timezone --utc America/Los_Angeles
#firstboot --disable
bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH crashkernel=auto"
zerombr
clearpart --all --initlabel
autopart --type=lvm
repo --name=everything --baseurl=<%= @mirror %>/Everything/x86_64/os/
#Just core packages
%packages --nobase
@core
ntp
@c-development
@development-tools
@rpm-development-tools
ncurses-devel
vim
bc
kexec-tools
cmake
libstdc++-static
python-netaddr
python-cachetools
python-futures
%end
%post --log=/root/anaconda-post.log
echo Kickstart post
chkconfig NetworkManager off
chkconfig network on
chkconfig ntpd on
dnf config-manager --add-repo=http://alt.fedoraproject.org/pub/alt/rawhide-kernel-nodebug/fedora-rawhide-kernel-nodebug.repo
yum -y clean metadata
yum -y update
hostname <%= @name %>.<%= @domain %>
echo "<%= @name %>.<%= @domain %>" > /etc/hostname
cat > /usr/local/bin/bpf-kernel-setup <<'DELIM__'
#!/bin/bash
set -e -x
numcpu=$(grep -c ^processor /proc/cpuinfo)
git clone https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git
cd net-next/
cp /boot/config-$(uname -r) ./
cp ./config-$(uname -r) .config
make -j$numcpu mrproper
make -j$numcpu nconfig
make -j$numcpu bzImage
make -j$numcpu modules
sudo make modules_install
sudo make install
sudo make INSTALL_HDR_PATH=/usr/local headers_install
release=$(<include/config/kernel.release)
echo "kexec -l /boot/vmlinuz-$release --initrd=/boot/initramfs-$release.img --reuse-cmdline; reboot" > /usr/local/bin/kexec-$release
chmod +x /usr/local/bin/kexec-$release
ln -fs kexec-$release /usr/local/bin/kexec-latest
DELIM__
chmod +x /usr/local/bin/bpf-kernel-setup
cat > /usr/local/bin/bpf-llvm-setup <<'DELIM__'
#!/bin/bash
set -e -x
numcpu=$(grep -c ^processor /proc/cpuinfo)
git clone https://github.com/llvm-mirror/llvm.git
git clone https://github.com/llvm-mirror/clang.git llvm/tools/clang
mkdir llvm/build/
cd llvm/build/
cmake .. \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_TERMINFO=OFF \
-DLLVM_TARGETS_TO_BUILD="ARM;CppBackend;X86;BPF" \
-DCMAKE_INSTALL_PREFIX=/opt/local/llvm
make -j$numcpu
sudo make install
grep -q llvm $HOME/.bashrc || echo 'PATH=/opt/local/llvm/bin:$PATH' >> $HOME/.bashrc
DELIM__
chmod +x /usr/local/bin/bpf-llvm-setup
cat > /usr/local/bin/bcc-setup <<'DELIM__'
#!/bin/bash
set -e -x
git clone https://github.com/svinota/pyroute2.git
(cd pyroute2; make install)
numcpu=$(grep -c ^processor /proc/cpuinfo)
git clone https://github.com/iovisor/bcc.git
mkdir bcc/build/
cd bcc/build/
export PATH=/opt/local/llvm/bin:$PATH
cmake .. -DCMAKE_INSTALL_PREFIX=/usr
make -j$numcpu
DELIM__
chmod +x /usr/local/bin/bcc-setup
%end