Skip to content

Commit 0c6d37d

Browse files
theihoranakryiko
authored andcommitted
Add scripts that enable vmlinux.h generation from scratch
* download-latest-linux-release.sh finds and fetches latest linux release from kernel.org * install-bpftool.sh builds and installs bpftool from source in the provided Linux tree * install-pahole.sh downloads and builds pahole from source * install-dependencies.sh assumes a clean ubuntu/debian environment and set ups packages necessary to build the kernel All these can be used to run vmlinux.h gen on Github Actions. Signed-off-by: Ihor Solodrai <[email protected]>
1 parent 891d0ca commit 0c6d37d

File tree

4 files changed

+64
-0
lines changed

4 files changed

+64
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
set -eux
4+
5+
sudo apt install -y curl jq tar xz-utils
6+
7+
url=$(curl -s https://www.kernel.org/releases.json \
8+
| jq -r '.releases[] | select(.moniker == "mainline") | .source')
9+
10+
curl -LO "$url"
11+
tar -xf $(basename "$url")
12+
13+
dir=$(basename "$url" | sed 's/\.tar\.[gx]z$//')
14+
mv $dir linux
15+
16+
rm $(basename "$url")

scripts/install-bpftool.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
set -eux
4+
5+
LINUX_REPO=${1:-"./linux"}
6+
7+
if [ ! -d "${LINUX_REPO}" ]; then
8+
echo "Error: Linux repo path is not found, LINUX_REPO=$LINUX_REPO"
9+
exit 1
10+
fi
11+
12+
sudo apt install -y llvm libcap-dev libbfd-dev zlib1g-dev
13+
14+
cd "$LINUX_REPO/tools/bpf/bpftool"
15+
make -j$(nproc)
16+
sudo make install

scripts/install-dependencies.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
set -eu
4+
5+
# Assume Ubuntu/Debian x86_64
6+
7+
sudo apt update -y
8+
DEBIAN_FRONTEND=noninteractive sudo -E apt install -y tzdata
9+
sudo apt install -y bc bison build-essential elfutils flex libdw-dev libelf-dev make ncurses-dev python3-docutils zstd
10+

scripts/install-pahole.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
set -eux
4+
5+
PAHOLE_ORIGIN=${PAHOLE_ORIGIN:-https://git.kernel.org/pub/scm/devel/pahole/pahole.git}
6+
PAHOLE_REVISION=${PAHOLE_REVISION:-next}
7+
8+
sudo apt -y install cmake git libdw-dev libelf-dev
9+
10+
WORKSPACE=$(mktemp -d -t pahole.XXXXXX)
11+
pushd "$WORKSPACE"
12+
git clone ${PAHOLE_ORIGIN} \
13+
--branch "${PAHOLE_REVISION}" \
14+
--depth=1 \
15+
--single-branch
16+
cd pahole
17+
mkdir -p build
18+
cmake -B=build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
19+
make -C build -j$(nproc)
20+
sudo make -C build install
21+
popd
22+
rm -rf "$WORKSPACE"

0 commit comments

Comments
 (0)