交叉编译 asop android adb 最新版的问题

2 天前
 ChainLock

目标:交叉编译 android adb,放到嵌入式板子上面执行

android 源码已经下载好

mkdir -p ~/.bin
PATH="${HOME}/.bin:${PATH}"
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/.bin/repo
chmod a+rx ~/.bin/repo

repo init --partial-clone -b android-latest-release -u https://android.googlesource.com/platform/manifest

repo sync -c -j8

packages/modules/adb 目录下面新版的 asop 已经没有 Android.mk,只有 Android.bp

已经跟 chatgpt 对线了 3 天,依旧没有搞出来,望搞过来的大佬指点一下,必须得用新版来编译,我在 csdn 参考了这编文章 aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2Rpc2FwcGVhcnNfbmljay9hcnRpY2xlL2RldGFpbHMvMTE3MDMxNzQz

可以交叉编译成功,版本是 1.0.31,最新版本已经是 1.0.41,将编译好 adb 放到板子上面运行时

adb connect 128.0.12.109:5555
connected to 128.0.12.109:5555

adb devices
List of devices attached
128.0.12.109:5555  offline  一直是离线状态,导致不可用
668 次点击
所在节点    C++
4 条回复
CFM880
2 天前
https://github.com/lzhiyong/android-sdk-tools

这个试试看看,这个里面的 release 正好是 1.0.41 的,先用用看

其实 google 搜索 android tools aarch64 应该就有


```shell
[cfm880@alarm ~]$ cd Downloads/android-sdk-tools-static-aarch64
[cfm880@alarm android-sdk-tools-static-aarch64]$ ls
build-tools others platform-tools
[cfm880@alarm android-sdk-tools-static-aarch64]$ cd platform-tools/
[cfm880@alarm platform-tools]$ file adb
adb: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, for Android 30, built by NDK r27b (0), not stripped
[cfm880@alarm platform-tools]$ ./adb
Android Debug Bridge version 1.0.41
Version 35.0.2-
Installed as /home/cfm880/Downloads/android-sdk-tools-static-aarch64/platform-tools/adb
Running on Linux 6.14.0-1-nabu-gdefb39db31e6-dirty (aarch64)

```
ChainLock
2 天前
@CFM880 我试了一下,将可执行程序上传到板子上面,运行不了

adb start-server
* daemon not running; starting now at tcp:5037
ADB server didn't ACK
Full server startup log: /tmp/adb.0.log
Server had pid: 21740
--- adb starting (pid 21740) ---
01-02 20:03:58.717 21740 21740 I adb : main.cpp:63 Android Debug Bridge version 1.0.41
01-02 20:03:58.717 21740 21740 I adb : main.cpp:63 Version 35.0.2-
01-02 20:03:58.717 21740 21740 I adb : main.cpp:63 Installed as /home/input/adb
01-02 20:03:58.717 21740 21740 I adb : main.cpp:63 Running on Linux 5.10.0 (aarch64)
01-02 20:03:58.717 21740 21740 I adb : main.cpp:63
01-02 20:03:58.719 21740 21740 I adb : auth.cpp:416 adb_auth_init...
01-02 20:03:58.720 21740 21740 I adb : auth.cpp:220 User key '/root/.android/adbkey' does not exist...
01-02 20:03:58.720 21740 21740 I adb : auth.cpp:64 generate_key(/root/.android/adbkey)...
01-02 20:03:59.108 21740 21740 I adb : auth.cpp:152 loaded new key from '/root/.android/adbkey' with fingerprint B9D47D55AB7EC3441039C376A8805FF3170D1A212B7DB9DE36680EF93CA5D7AC
01-02 20:03:59.108 21740 21740 I adb : auth.cpp:391 adb_auth_inotify_init...
fdsan: failed to exchange ownership of file descriptor: fd 11 is owned by unique_fd 0x7e4e407e78, was expected to be unowned
libc: fdsan: failed to exchange ownership of file descriptor: fd 11 is owned by unique_fd 0x7e4e407e78, was expected to be unowned

* failed to start daemon
error: cannot connect to daemon
/home/input # cat /tmp/adb.0.log
--- adb starting (pid 13449) ---
01-02 19:59:30.372 13449 13449 I adb : main.cpp:63 Android Debug Bridge version 1.0.41
01-02 19:59:30.372 13449 13449 I adb : main.cpp:63 Version 35.0.2-
01-02 19:59:30.372 13449 13449 I adb : main.cpp:63 Installed as /home/input/adb
01-02 19:59:30.372 13449 13449 I adb : main.cpp:63 Running on Linux 5.10.0 (aarch64)
01-02 19:59:30.372 13449 13449 I adb : main.cpp:63
01-02 19:59:30.374 13449 13449 I adb : auth.cpp:416 adb_auth_init...
01-02 19:59:30.375 13449 13449 I adb : auth.cpp:152 loaded new key from '/root/.android/adbkey' with fingerprint 92B5D8B6EA2917C3776C2AFDE0BF27B4DE42B88990FE0E5B10C74497111E43ED
01-02 19:59:30.375 13449 13449 I adb : auth.cpp:391 adb_auth_inotify_init...
fdsan: failed to exchange ownership of file descriptor: fd 11 is owned by unique_fd 0x7f161cf158, was expected to be unowned
libc: fdsan: failed to exchange ownership of file descriptor: fd 11 is owned by unique_fd 0x7f161cf158, was expected to be unowned
--- adb starting (pid 1247) ---
01-02 20:00:21.829 1247 1247 I adb : main.cpp:63 Android Debug Bridge version 1.0.41
01-02 20:00:21.829 1247 1247 I adb : main.cpp:63 Version 35.0.2-
01-02 20:00:21.829 1247 1247 I adb : main.cpp:63 Installed as /home/input/adb
01-02 20:00:21.829 1247 1247 I adb : main.cpp:63 Running on Linux 5.10.0 (aarch64)
01-02 20:00:21.829 1247 1247 I adb : main.cpp:63
01-02 20:00:21.831 1247 1247 I adb : auth.cpp:416 adb_auth_init...
01-02 20:00:21.832 1247 1247 I adb : auth.cpp:152 loaded new key from '/root/.android/adbkey' with fingerprint 92B5D8B6EA2917C3776C2AFDE0BF27B4DE42B88990FE0E5B10C74497111E43ED
01-02 20:00:21.832 1247 1247 I adb : auth.cpp:391 adb_auth_inotify_init...
fdsan: failed to exchange ownership of file descriptor: fd 11 is owned by unique_fd 0x7f63825398, was expected to be unowned
libc: fdsan: failed to exchange ownership of file descriptor: fd 11 is owned by unique_fd 0x7f63825398, was expected to be unowned
--- adb starting (pid 21740) ---
01-02 20:03:58.717 21740 21740 I adb : main.cpp:63 Android Debug Bridge version 1.0.41
01-02 20:03:58.717 21740 21740 I adb : main.cpp:63 Version 35.0.2-
01-02 20:03:58.717 21740 21740 I adb : main.cpp:63 Installed as /home/input/adb
01-02 20:03:58.717 21740 21740 I adb : main.cpp:63 Running on Linux 5.10.0 (aarch64)
01-02 20:03:58.717 21740 21740 I adb : main.cpp:63
01-02 20:03:58.719 21740 21740 I adb : auth.cpp:416 adb_auth_init...
01-02 20:03:58.720 21740 21740 I adb : auth.cpp:220 User key '/root/.android/adbkey' does not exist...
01-02 20:03:58.720 21740 21740 I adb : auth.cpp:64 generate_key(/root/.android/adbkey)...
01-02 20:03:59.108 21740 21740 I adb : auth.cpp:152 loaded new key from '/root/.android/adbkey' with fingerprint B9D47D55AB7EC3441039C376A8805FF3170D1A212B7DB9DE36680EF93CA5D7AC
01-02 20:03:59.108 21740 21740 I adb : auth.cpp:391 adb_auth_inotify_init...
fdsan: failed to exchange ownership of file descriptor: fd 11 is owned by unique_fd 0x7e4e407e78, was expected to be unowned
libc: fdsan: failed to exchange ownership of file descriptor: fd 11 is owned by unique_fd 0x7e4e407e78, was expected to be unowned
CFM880
2 天前
那下载这个吧

https://archlinuxarm.org/packages/aarch64/android-tools

下载下来解压就有了

我试了这个可以
ChainLock
1 天前
@CFM880 #3 佬,你是用什么板卡去做测试的

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1157237

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX