V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
ChainLock
V2EX  ›  C++

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

  •  
  •   ChainLock · 18 小时 35 分钟前 · 376 次点击

    目标:交叉编译 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  一直是离线状态,导致不可用
    
    3 条回复    2025-09-05 19:43:37 +08:00
    CFM880
        1
    CFM880  
       17 小时 6 分钟前
    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
    ChainLock  
    OP
       14 小时 45 分钟前
    @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
        3
    CFM880  
       8 小时 48 分钟前
    那下载这个吧

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

    下载下来解压就有了

    我试了这个可以
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   900 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 19ms · UTC 20:31 · PVG 04:31 · LAX 13:31 · JFK 16:31
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.