GithubHelp home page GithubHelp logo

jackkingchen / adb Goto Github PK

View Code? Open in Web Editor NEW

This project forked from prife/adb

0.0 0.0 0.0 10.55 MB

Android's adb standalone build with cmake, support Linux(x86-64、arm64), Windows(32bit) and macOS!

License: GNU General Public License v3.0

Shell 0.54% C++ 71.78% Python 3.36% C 19.89% Java 1.10% Assembly 2.50% Makefile 0.32% CMake 0.51%

adb's Introduction

adb

Android's adb standalone build with cmake, support Linux(x86-64、arm64)], Windows(32bit) and macOS!

It's recommend to develop adb with clion/vscode which's remote development is so usefull!

build adb target for Linux(X64、arm64)

step1: install toolchain

Please prepare an linux environment.

for arm/arm64, please install toolchain, for example you can download from

git clone this project.

$ cd <this-project>
$ cd lib
$ git clone https://salsa.debian.org/android-tools-team/android-platform-external-boringssl.git boringssl
$ cd boringssl
$ git checkout debian/8.1.0+r23-3

step2: build boringssl

Please choose a platform as following.

  1. on intel pc with ubuntu Linux, please follow X64(AMD64)
  2. on Raspberry Pi or RK3399 or RK3328 with ubuntu Linux, please follow ARM64(AARCH64)

X86-64(AMD64)

$ cd boringssl
$ rm -rf debian/out
$ make CFLAGS=-fPIC DEB_HOST_ARCH=amd64 -f debian/libcrypto.mk
$ make CXXFLAGS=-fPIC DEB_HOST_ARCH=amd64 -f debian/libssl.mk

ARM64(AARCH64)

$ cd boringssl
$ rm -rf debian/out
$ make CFLAGS=-fPIC CC=aarch64-linux-gnu-gcc DEB_HOST_ARCH=arm64 -f debian/libcrypto.mk
$ make CXXFLAGS=-fPIC CXX=aarch64-linux-gnu-g++ DEB_HOST_ARCH=arm64 -f debian/libssl.mk

build adb for linux x86-64

build on command line

$ mkdir build && cd build
$ cmake ..
$ make -j8

build with clion/vscode on windows

you need an remote linux pc, then config clion/vscode with it's remote development feature, it is so easy!

build adb target for linux aarch64

NOTE: please install a cmake with the newest version and lld !

sudo apt-get install -y lld

first, install toolchain

$ cd cmake/toolchain/linux-aarch64
$ wget 'https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz\?revision\=61c3be5d-5175-4db6-9030-b565aae9f766\&la\=en\&hash\=0A37024B42028A9616F56A51C2D20755C5EBBCD7' -O gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz
$ tar xvf gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz --strip-components=1
$ cd -

build with cmake

$ CC=clang CXX=clang++ cmake . -Bbuild-arm64 -DCMAKE_TOOLCHAIN_FILE=cmake/linux/toolchain-aarch64.cmake
$ cmake --build build-arm64 --config Release

ref: https://clickhouse.tech/docs/en/development/build-cross-arm/

build adb target for windows(only 32-bit supported!)

  1. install msys2

config repo with https://mirror.tuna.tsinghua.edu.cn/help/msys2/

$ pacman -S mingw-w64-i686-gcc
$ pacman -S mingw-w64-i686-cmake
$ pacman -S make
  1. download source
$ cd lib
$ git clone https://salsa.debian.org/android-tools-team/android-platform-external-boringssl.git boringssl
$ cd ..
  1. build boringssl

It's not necessary to build boringssl, because I've already prebuilt on prebuilt/windows/32/libcrypto.a

If you really want build by yourself. Please

$ cd lib/boringssl
$ cp ../prebuilt/CMakeLists_boringssl.txt CMakeLists.txt
$ mkdir build32 && cd build32
$ cmake -G"Unix Makefiles" ..
$ make -j8

If there is nothing wrong. the libcrypto.a will be built out.

cp it to n-adb/prebuilt/windows/32/

  1. build adb

switch to the n-adb source direcoty, and run following commands

$ mkdir build32
$ cd build32
$ cmake -G"Unix Makefiles" ..
$ make -j8

build adb target for macOS

  1. download source
$ cd lib
$ git clone https://salsa.debian.org/android-tools-team/android-platform-external-boringssl.git boringssl
$ cd ..
  1. build boringssl

It's not necessary to build boringssl, because I've already prebuilt on prebuilt/osx/libcrypto.a

If you really want build by yourself. Please

$ cd lib/boringssl
$ cp ../prebuilt/CMakeLists_boringssl.txt CMakeLists.txt
$ mkdir build32 && cd build32
$ cmake ..
$ make -j8

If there is nothing wrong. the libcrypto.a will be built out.

cp it to n-adb/prebuilt/osx/

  1. build adb
$ mkdir build && cd build
$ cmake ..
$ make -j8

Troubleshooting

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.