4

Preface

I've checked this and this and STFW before I ask. Because of ROM's Difference , I want to cross compile an ADB server(N+) running on my aarch64 device from the [adb source code].

You can see here for the difference changes of android.mk in the following lines:

Latest Android 7.+ version , Lollipop Android 5.+ version This Version contains adb for device-on-target feature.

Question

I can't find a proper MakeFile and it's just a Android.mk in the folder.How should I convert it to makefile in order to using make to build a adb for device-on-target. I've already built a cross compiling environment and installed the ndk-build,repo,build-essential on my ubuntu 16.04 lts.

Or on the other hand, can I only build ADB for device-on-target without compiling the whole rom?Which argument should I use with ndk-build?Please give me more detailed info and caution.

Community
  • 1
  • 1
PotatoChips
  • 189
  • 2
  • 12

2 Answers2

0

Instructions on setting up a platform build environment are on the AOSP website: http://source.android.com/source/requirements.html

The ADB client program is not configured to be built for the device. We only support that for hosts. If you want to build it for the device, you'll need to add that build configuration (see system/core/adb/Android.mk) and then most likely do some porting work to get it functioning.

Dan Albert
  • 10,079
  • 2
  • 36
  • 79
  • I just want to compile an unusual adb, because of soe reason,google removed adb for device-on-target and i need to run a adb on my phone(equals to device-on-target).so how can i bring it back? – PotatoChips Feb 27 '17 at 22:30
  • You asked how to convert it to a makefile that can be invoked with just make. You don't. Follow the build instructions on the AOSP site. You can run `make` at the top level of the tree or you can run `mma` in a specific project. – Dan Albert Feb 28 '17 at 20:35
  • if I use `make adb` at the top level of the tree, It will the the x86_64 platform's gcc.How can I let it use the `aarch64-linux-android-` ? – PotatoChips Mar 02 '17 at 15:05
  • Extended my answer to cover the bit about adb on the device. – Dan Albert Mar 02 '17 at 17:33
  • If the hosts is an ARM device,what should I do?e.g. Raspberry Pi – PotatoChips Mar 03 '17 at 15:45
  • You'll have to port adb, including the build system. This isn't something the AOSP build system supports at all. – Dan Albert Mar 03 '17 at 18:03
0

You can look at my commits but I had to make quite a few changes.

https://github.com/Surge1223/android_system_core/blob/android-7.1/adb/Android.mk

builds statically for both arm and arm64

Surge1223
  • 91
  • 6
  • I'll have a try.Could you please give me a guide to build using your source code?can I just 'make adb' ? – PotatoChips Mar 14 '17 at 09:40
  • after syncing aosp you'll have to cherry-pick a few of the commits I made in /system/core and then when you type make adb it will make adb for both host and target by default – Surge1223 Mar 16 '17 at 21:47
  • Thx a lot.Can I just clone your repo and replace the original file?I entered the code review for AOSP but didn't see the pull request you added.However,Which commits should I cherry-pick if I can replace the original files? – PotatoChips Mar 18 '17 at 11:29