Giter Club home page Giter Club logo

btfhubforandroid's Introduction

BTFHubForAndroid

We need BTFHub for Android too.

Build Android Common Kernel

build common-android12-5.10 kernel with BTF example

sync kernel source code

git clone https://gerrit.googlesource.com/git-repo
mkdir android-kernel && cd android-kernel
../git-repo/repo init --depth=1 -u https://android.googlesource.com/kernel/manifest -b common-android12-5.10
../git-repo/repo sync -j$(nproc --all)

enable CONFIG_DEBUG_INFO_BTF

cd common
make ARCH=arm64 gki_defconfig
make ARCH=arm64 menuconfig
# plz enable CONFIG_DEBUG_INFO_BTF on GUI
make ARCH=arm64 savedefconfig
cp defconfig arch/arm64/configs/gki_defconfig
rm .config
cd ..

perpare toolchains

mkdir gcc-aosp
wget https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/+archive/refs/tags/android-12.1.0_r27.tar.gz
tar -C gcc-aosp/ -zxvf android-12.1.0_r27.tar.gz

setup env and build, note: clang version can be found at build.config.common

export PATH=/home/kali/Downloads/android-kernel/prebuilts-master/clang/host/linux-x86/clang-r416183b/bin:$PATH
make -j$(nproc --all) O=out ARCH=arm64 CLANG_TRIPLE=aarch64-linux-gnu- CROSS_COMPILE=/home/kali/Downloads/gcc-aosp/bin/aarch64-linux-android- CC=clang LD=ld.lld gki_defconfig
make -j$(nproc --all) O=out ARCH=arm64 CLANG_TRIPLE=aarch64-linux-gnu- CROSS_COMPILE=/home/kali/Downloads/gcc-aosp/bin/aarch64-linux-android- CC=clang LD=ld.lld

vmlinux is out here => ./out/vmlinux


build common-android13-5.10 kernel with BTF example

CONFIG_DEBUG_INFO_BTF enabled default, just directly build

git clone https://gerrit.googlesource.com/git-repo
mkdir android-kernel && cd android-kernel
../git-repo/repo init --depth=1 -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/kernel/manifest -b common-android13-5.10
../git-repo/repo sync -j$(nproc --all)

CCACHE="/usr/bin/ccache" LTO=thin BUILD_CONFIG=common/build.config.gki.aarch64 build/build.sh

vmlinux is out here => ./out/android13-5.10/dist/vmlinux

Build Pahole

sudo apt install libdwarf-dev
sudo apt install libdw-dev
git clone https://github.com/acmel/dwarves --depth=1
cd dwarves
mkdir build
cd build
cmake -D__LIB=lib -DBUILD_SHARED_LIBS=OFF ..
sudo make install

Pack vmlinux

pahole --btf_encode_detached a12-5.10-arm64.btf ./out/vmlinux
tar cvfJ "./a12-5.10-arm64.btf.tar.xz" a12-5.10-arm64.btf

Links

btfhubforandroid's People

Contributors

seeflowerx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.