Setup
You need an arm64 phone, and a Linux machine with a west workspace, Podman and adb. Commands here run from the top of the workspace. From zephyr/, leave out the zephyr/ in sample paths.
-
Add this project to the workspace, in
zephyr/submanifests/android.yaml:manifest: projects: - name: android-native-sim url: https://github.com/walidbadar/android-native-sim revision: main path: android-native-sim west-commands: scripts/west-commands.yml -
Fetch it and send
west buildthrough it:west update android-native-sim west config alias.build android-buildOther boards build as before. To undo this:
west config -d alias.build.The alias is set for the whole workspace, but the command comes from the submanifest, so
west buildfails withunknown command "android-build"on a Zephyr branch that doesn’t havesubmanifests/android.yaml. Either keep the file on the branches you build from, or skip the alias and typewest android-buildinstead ofwest buildfor this board. -
Turn on USB debugging on the phone, connect it, and accept the prompt. It should appear in:
adb devices
The first build creates the Podman image, which takes several minutes.
Set the phone’s address
Usually you don’t need to: with CONFIG_ANDROID_PHONE_IP empty, -t run uses the phone adb already sees, and gets its Wi-Fi address from adb when it needs one.
Set it when the phone isn’t connected to adb, so -t run can reach it over Wi-Fi. Put it in your prj.conf, or give it once on the command line, which the build directory remembers:
west build -b native_sim/native/aarch64 -t run <application> -- -DCONFIG_ANDROID_PHONE_IP=\"<phone-ip>\"
For adb to connect by address, run this with the phone on USB, once per boot:
adb tcpip 5555