Skip to content

REASY/android-ebpf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eBPF for Android x86-64

Build ISO image with eBPF support

Building the builder image

To make the development environment reproducible there is docker/android_builder.dockerfile that has everything you need to build BlissOS 15.x.

sudo docker build -f docker/android_builder.dockerfile  -t android_builder:24.04 docker

Initializing BlissOS repo

All the commands are run inside docker container that was run with the command below. The folder /media/android_dev_disk/arcadia-x86 is an empty one that will be initialized inside container.

sudo docker run -v /media/android_dev_disk/arcadia-x86:/aosp -w /aosp -i -t android_builder:0.1

Repo initialization

aosp@29b675cef2f2:/aosp$ repo init -u https://github.com/BlissRoms-x86/manifest.git -b arcadia-x86 --git-lfs

Sync repo

aosp@29b675cef2f2:/aosp$ repo sync -c --force-sync --no-tags --no-clone-bundle -j$(nproc --all) --optimized-fetch --prune
Fetching: 100% (1196/1196), done in 5.763s
Checking out:  98% (1176/1196), done in 2.610s
Checking out:   1% (20/1196), done in 0.021s
repo sync has finished successfully.

Initialize Intel libhoudini

libhoudini is a proprietary ARM translation layer for x86-powered Android devices. It allows an app that has NDK binaries for ARM, but not x86, to still run on x86 hardware, albeit not as quickly as it would with native x86 binaries.

aosp@29b675cef2f2:/aosp$ git clone --single-branch --branch wsa-12.1 https://github.com/supremegamers/vendor_intel_proprietary_houdini vendor/intel/proprietary/houdini
Cloning into 'vendor/intel/proprietary/houdini'...
remote: Enumerating objects: 1636, done.
remote: Counting objects: 100% (274/274), done.
remote: Compressing objects: 100% (160/160), done.
remote: Total 1636 (delta 144), reused 114 (delta 114), pack-reused 1362 (from 1)
Receiving objects: 100% (1636/1636), 149.00 MiB | 13.47 MiB/s, done.
Resolving deltas: 100% (702/702), done.
07:56:26

Setup FOSS apps for x86/x86_64

aosp@fda9edb5454c:/aosp$ cd vendor/foss
aosp@fda9edb5454c:/aosp/vendor/foss$ ./update.sh
(default is 'ABI:x86_64 & ABI2:x86')
Timeout in 10 sec.
1) ABI:x86_64 & ABI2:x86
2) ABI:arm64-v8a & ABI2:armeabi-v7a
3) ABI:x86
Which device type do you plan on building?: 1
you chose choice 1 which is ABI:x86_64 & ABI2:x86

Build BlissOS 15.x

Apply patches to enable eBFP

aosp@fda9edb5454c:/aosp$ /patches/apply.sh
Patching /aosp/device/generic/common ...
Done
Patching /aosp/kernel/x86/common ...
Done

Build it

export BLISS_BUILD_VARIANT=foss
export ANDROID_USE_INTEL_HOUDINI=true
source build/envsetup.sh
lunch bliss_x86_64-userdebug
make blissify iso_img -j$(nproc --all)

Debian-base system for eBPF experiments

Install required dependencies

sudo apt install apt-cacher-ng debootstrap

Prepare tmpfs without nodev flag

sudo ./dev/prepare-tmpfs.sh

Build the base system and install LLVM 18

sudo ./dev/create-base.sh /mnt/build-tmpfs/debian &&
  sudo cp dev/compile-ebpf.sh /mnt/build-tmpfs/debian &&
  sudo cp dev/install-llvm-18.sh /mnt/build-tmpfs/debian && 
  sudo cp assets/bashrc /mnt/build-tmpfs/debian/.bashrc && 
  sudo cp assets/get_kvers.sh /mnt/build-tmpfs/debian &&
  sudo chroot /mnt/build-tmpfs/debian /install-llvm-18.sh && 
  sudo chroot /mnt/build-tmpfs/debian rm /bin/sh &&
  sudo chroot /mnt/build-tmpfs/debian ln -s /bin/bash /bin/sh &&
  sudo ./dev/cleanup.sh /mnt/build-tmpfs/debian

Build eBPF tooling on running Android

sudo chroot /mnt/build-tmpfs/debian /compile-ebpf.sh

Prepare a tar archive and push it to the device

sudo tar cvf /home/user/debian.tar.gz -C /mnt/build-tmpfs/ .
adb -s vsock:3:5555 push assets /data/local/tmp/assets
adb -s vsock:3:5555 push ~/debian.tar.gz /data/local/tmp/deb.tar.gz

mkdir -p /data/eadb && mv /data/local/tmp/assets/* /data/eadb && mv /data/local/tmp/deb.tar.gz /data/eadb/deb.tar.gz && rm -r /data/local/tmp/assets && chmod +x /data/eadb/device-*



### BlissOS params

DEBUG_VSOCK=1 androidboot.insecure_adb=1


### When build of OS fails for recoverable reasons
Remove out/target/product/
```console
rm -rf out/target/product/*

termux su path is /system/bin/su

https://discord.com/channels/795625509575720980/795702378753818643/1294952224321044590

About

eBPF for Android

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published