Skip to content

Commit 910d412

Browse files
committed
scripts: install pahole and download linux
Add scripts that enable vmlinux.h generation from scratch: * install-pahole.sh downloads and builds pahole from source * download-latest-linux-release.sh finds and fetches latest linux release from kernel.org Signed-off-by: Ihor Solodrai <[email protected]>
1 parent 915107d commit 910d412

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
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 -O "$url"
11+
tar -xf $(basename "$url")
12+
13+
dir=$(basename "$url" | sed 's/\.tar\.xz$//')
14+
mv $dir linux
15+
16+
rm $(basename "$url")

scripts/install-dependencies.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export GCC_VERSION=${GCC_VERSION:-"13"}
99

1010
sudo apt update -y
1111
DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata
12-
sudo apt install -y bc bison build-essential elfutils flex make ncurses-dev pahole python3-docutils zstd
12+
sudo apt install -y bc bison build-essential elfutils flex make ncurses-dev python3-docutils zstd
1313
sudo apt install -y libelf-dev libdw-dev
1414

1515
# Install cross-compilers
@@ -26,3 +26,5 @@ for arch in aarch64 s390x ppc64le riscv64 arm loongarch64; do
2626
${compiler_id}-gcc \
2727
/usr/bin/${compiler_id}-gcc-${GCC_VERSION}
2828
done
29+
30+
$(dirname "$0")/install-pahole.sh

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:-v1.29}
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
20+
sudo make -C build install
21+
popd
22+
rm -rf "$WORKSPACE"

0 commit comments

Comments
 (0)