Compile busybox (Magisk) for Android with ndk


All the credits to topjohnwu and osm0sis.


I’m working on Ubuntu 21.10, so

$ apt install git google-android-ndk-installer


Clone the repository

git clone

Follow the instruction, as today are

git clone
git clone jni/selinux
git clone jni/pcre

Choose the supported busybox version

cd busybox
git checkout 1_34_1
cd ..


/usr/lib/android-ndk/ndk-build all

Push on a device and test

adb push ./obj/local/armeabi-v7a/busybox /data/local/tmp
adb shell chmod 775 /data/local/tmp/busybox
adb shell /data/local/tmp/busybox date
Mon Nov 21 21:08:47 CET 2021

Install as you want, for example

adb shell
cd /data/local/tmp/
mkdir xbin
cd xbin
../busybox --install .
export PATH="$(pwd):$PATH"