Since I moved to source-based linux distro with musl (Dragora GNU/Linux & LFS Musl), I always wondering about how to run android platform tools on musl. Android platform tools seems built againts glibc so running it on musl is almost impossible. Not until I discovered about patchelf. Turns out, we can use patchelf to make android platform tools binary tool (adb, fastboot, etc) to run on musl, with a bit of trick of course.
We will need some stuffs like :
- Android platform tools, grab it here.
- patchelf, install it using your package manager or just build it yourself !
- Some glibc's related libraries, you can take it from common distros. The libraries
are :
- ld-linux-x86-64.so.2
- libc.so.6
- libdl.so.2
- libm.so.6
- libpthread.so.0
- librt.so.1
We need to do some steps, but don't be worry, it's easy !
-
Extract the android platform tools archive !
$ unzip platform-tools-latest-linux.zip && cd platform-tools
-
Copy needed libraries to lib64 directory !
-
Change / set the interpreter of each tools to
lib64/ld-linux-x86-64.so.2
!$ for tools in adb \ etc1tool \ fastboot \ hprof-conv \ make_f2fs \ make_f2fs_casefold \ mke2fs \ sqlite3; do sudo patchelf --set-interpreter lib64/ld-linux-x86-64.so.2 ${tools[*]}; done
-
Test / run each tools ! Check if there are no complaints about missing symbol !