Lightweight C TCP telemetry, IPC, LLEXT, mixer, and audio debug daemon (sof_remote_server, default TCP port 9998) and CLI client (sof-remote) for Linux and Android SOF targets.
# From top-level sof-utils/
make remote-server
# Or directly in sof-remote-server/
make -C sof-remote-serverInstall dependencies on Debian/Ubuntu if building with ALSA/TinyALSA/TinyCompress:
sudo apt install libasound2-devcmake -B sof-remote-server/build -S sof-remote-server
cmake --build sof-remote-server/build -j$(nproc)sof-remote-server supports three Android build workflows using Bionic + NO_ALSA + TinyALSA + TinyCompress (<tinyalsa/asoundlib.h> or <tinyalsa/pcm.h>/mixer.h).
export ANDROID_NDK_HOME=/path/to/android-ndk
# Default (x86_64, API 34)
make android
# ARM64
make android ANDROID_ABI=arm64-v8a ANDROID_API=34When AOSP_DIR is set (and ANDROID_NDK_HOME is unset), the Makefile automatically discovers the prebuilt Clang toolchain, Soong NDK sysroot (out/soong/ndk/sysroot), Soong Bionic CRT objects (crtbegin_dynamic.o / crtend_android.o mapped via ANDROID_SOONG_ARCH: arm64, arm, x86, x86_64), and external/tinyalsa + external/tinycompress:
make android AOSP_DIR=/path/to/aosp ANDROID_ABI=x86_64 ANDROID_API=34
make android AOSP_DIR=/path/to/aosp ANDROID_ABI=arm64-v8a ANDROID_API=34Output binaries are written to sof-remote-server/build-android-<ANDROID_ABI>/ (sof_remote_server and sof-remote).
make android-push ANDROID_ABI=arm64-v8a
adb shell /data/local/tmp/sof_remote_server -p 9998android-push pushes both binaries to /data/local/tmp/ and runs adb forward tcp:9998 tcp:9998.
cmake -B sof-remote-server/build-android-cmake \
-S sof-remote-server \
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake \
-DANDROID_ABI=arm64-v8a \
-DANDROID_PLATFORM=android-34
cmake --build sof-remote-server/build-android-cmake -j$(nproc)Optional TinyALSA / TinyCompress CMake variables:
-DTINYALSA_INC=/path/to/tinyalsa/includeand-DTINYALSA_LIB=/path/to/libtinyalsa.so-DTINYCOMPRESS_INC=/path/to/tinycompress/includeand-DTINYCOMPRESS_LIB=/path/to/libtinycompress.so
(On ANDROID, CMake automatically omits -lpthread since pthreads are integrated into Bionic libc.)
Place or vendor-map sof-remote-server/ inside the AOSP source tree and build directly with Soong:
m sof_remote_server sof-remoteAndroid.bp builds vendor-proprietary targets linking libtinyalsa, libtinycompress, and liblog.
sof_remote_server [-b <bind_ip>] [-d /dev/sof-dsp0] [-p 9998] [-D] [-E|-S]
| Flag | Default (Linux) | Default (Android) | Description |
|---|---|---|---|
-b <addr> |
0.0.0.0 |
127.0.0.1 |
IPv4 bind address. Android defaults to loopback for use with adb forward tcp:9998 tcp:9998. |
-d <dev> |
/dev/sof-dsp0 |
/dev/sof-dsp0 |
SOF character device path (falls back to DebugFS/SysFS + TinyALSA when absent). |
-p <port> |
9998 |
9998 |
TCP listening port. |
-D |
off | off | Daemonize (fork to background). |
-E / -S |
-E (enabled) |
-S (disabled) |
Enable (-E) or disable (-S) host: shell command execution (SOF_NET_OP_SHELL_EXEC via popen()). |
sof_remote_server.rc defines vendor.sof_remote_server (disabled by default), binding 127.0.0.1:9998 without host: shell execution, and starts only when both ro.debuggable=1 and the explicit opt-in property are set:
adb shell setprop persist.vendor.sof.remote_server.enable 1 # start
adb shell setprop persist.vendor.sof.remote_server.enable 0 # stop
adb forward tcp:9998 tcp:9998A reference vendor policy for userdebug / eng builds is provided in sepolicy/:
sepolicy/file_contexts(/vendor/bin/sof_remote_server)sepolicy/property.te&sepolicy/property_contexts(persist.vendor.sof.remote_server.enable)sepolicy/sof_remote_server.te(wrapped inuserdebug_or_eng(...))
Include it in a device BoardConfig.mk:
BOARD_VENDOR_SEPOLICY_DIRS += <path-to-sof-utils>/sof-remote-server/sepolicyIf your kernel/product exposes a dedicated /dev/sof-dsp0 character device node under SELinux enforcing mode, add a product file_contexts device label and corresponding rw_file_perms allow rule for sof_remote_server.