fix(bt): 蓝牙P2 mipsel libasound链接 — 改glibc-dynamic(设备实为glibc2.22硬浮点,pcm.bluealsa=独立glibc插件需dlopen,musl-static死路)直链设备libasound.so.2,BT层脱离dlopen(内联9个libasound原型);qemu装载动态库验证+宿主67pass/0warning;audiod改glibc-dynamic(57KB)M6.30后需重验DAC出声
This commit is contained in:
1 parent
71b2dafecc
commit
4ecddb5ea3
2 files changed
+74
-76
No files matched your search
@@ -1,29 +1,41 @@
|
||||
#!/bin/bash
|
||||
# build_audiod.sh — meow_audiod 交叉编译(mipsel 静态)+ 宿主多目标可选。
|
||||
# build_audiod.sh — meow_audiod 交叉编译(mipsel glibc-dynamic)+ 宿主多目标可选。
|
||||
#
|
||||
# 目标:R3 Pro II / MeowOS(mipsel-linux-muslsf,静态)。audiod 复用 meow_ipc.h(共享协议头,
|
||||
# 目标:R3 Pro II / MeowOS(MIPS32 o32,真实 ABI)。audiod 复用 meow_ipc.h(共享协议头,
|
||||
# -I../meow_launcherd)。audiod 为 svcd 托管的独立守护;meow_audio 为用户侧 CLI。
|
||||
#
|
||||
# 【P2 蓝牙链接定案 2026-09-03】设备为 glibc-2.22(ld-2.22.so / libc-2.22.so,非 musl),且
|
||||
# libasound 会在运行时 dlopen 单独的 bluealsa pcm 插件(/usr/lib/alsa-lib/libasound_module_pcm_bluealsa.so)
|
||||
# ——故 audiod 必须以**动态 glibc** 形态链接设备现有 libasound.so.2:
|
||||
# - 用 zig --target=mipsel-linux-gnueabihf.2.22(硬浮点 o32,glibc-2.22 版本引用,设备 libs 齐);
|
||||
# libasound 原型在 meow_audiod.c 内联声明(不依赖 asoundlib.h)。
|
||||
# - 删 -static:musl-static 无 dlopen(实测 "Dynamic loading not supported",无法加载 bluealsa 插件);
|
||||
# musl-dynamic 需设备不存在的 musl ld.so。libasound 链接库来自 libbt/(设备 libasound.so.2 副本)。
|
||||
# - meow_audio CLI 无 libasound 依赖,保持 musl-static(zig-mipsel-cc)。
|
||||
#
|
||||
# 用法:
|
||||
# ./build_audiod.sh # 交叉编译 → meow_audiod(mipsel 静态)
|
||||
# ./build_audiod.sh cli # 交叉编译 meow_audio CLI → meow_audio(mipsel 静态)
|
||||
# ./build_audiod.sh host # 宿主编译 meow_audiod_host + meow_audio_host(集成测试)
|
||||
# ./build_audiod.sh # 交叉编译 → meow_audiod(mipsel glibc-dynamic,BT 直链 libasound)
|
||||
# ./build_audiod.sh cli # 交叉编译 meow_audio CLI → meow_audio(mipsel musl-static)
|
||||
# ./build_audiod.sh host # 宿主编译 *_host 并跑 test_audiod_host 回归(FILE sink)
|
||||
set -e
|
||||
cd "$(dirname "$0")"
|
||||
ROOT="$HOME/Project/R3ProII"
|
||||
CC="$ROOT/.tools/zig-mipsel-cc"
|
||||
ZIG="$ROOT/.tools/zig-env/bin/zig"
|
||||
INC="-I$ROOT/patch_v2/meow_launcherd"
|
||||
|
||||
if [ "$1" = "host" ]; then
|
||||
HOST_CC="${CC_HOST:-cc}"
|
||||
# -ldl:BT 输出目标用 dlopen 运行时解析 libasound(pcm.bluealsa 是 alsa-lib 插件,非内核节点;
|
||||
# 主机/交叉工具链无 asoundlib.h/libasound,故不静态链接)。mipsel 静态 musl 不支持 dlopen,见
|
||||
# meow_audiod.c bt 段注释(真机 mipsel 需主会话提供 musl-libasound 或改动态,本任务以源码+宿主为准)。
|
||||
"$HOST_CC" $INC -Os -Wall -Wextra meow_audiod.c -o meow_audiod_host -lpthread -ldl
|
||||
# BT 目标直链宿主 libasound.so.2(无 asoundlib.h,原型内联于 meow_audiod.c;-l: 精确到版本,
|
||||
# 不依赖 unversioned dev 链接)。删 -ldl:BT 不再用 dlopen。
|
||||
"$HOST_CC" $INC -Os -Wall -Wextra meow_audiod.c -o meow_audiod_host -lpthread -l:libasound.so.2
|
||||
"$HOST_CC" $INC -Os -Wall -Wextra meow_audio.c -o meow_audio_host -lm
|
||||
"$HOST_CC" $INC -Os -Wall -Wextra test_audiod_host.c -o test_audiod_host -lm
|
||||
echo "== host builds =="
|
||||
ls -la meow_audiod_host meow_audio_host
|
||||
file meow_audiod_host meow_audio_host
|
||||
ls -la meow_audiod_host meow_audio_host test_audiod_host
|
||||
file meow_audiod_host meow_audio_host test_audiod_host
|
||||
echo "== host regression (test_audiod_host) =="
|
||||
./test_audiod_host || { echo "!! host regression FAILED"; exit 1; }
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@@ -36,8 +48,21 @@ if [ "$1" = "cli" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
"$CC" $INC -Os -Wall -Wextra -static meow_audiod.c -o meow_audiod -lpthread
|
||||
echo "== meow_audiod (mipsel static) =="
|
||||
# meow_audiod:mipsel glibc-dynamic,BT 直链 libasound(-Llibbt -lasound)。-lpthread 供播放线程。
|
||||
# 链接源 libbt/libasound.so.2.0.0(设备固件 libasound.so.2 副本);缺失时从固件镜像自拷贝(idempotent)。
|
||||
LIBBT="libbt"
|
||||
ASOUND_SRC="$ROOT/hiby_os_crack/r3proii/squashfs-root-example/usr/lib/libasound.so.2.0.0"
|
||||
mkdir -p "$LIBBT"
|
||||
if [ ! -f "$LIBBT/libasound.so.2.0.0" ]; then cp "$ASOUND_SRC" "$LIBBT/libasound.so.2.0.0"; fi
|
||||
ln -sf libasound.so.2.0.0 "$LIBBT/libasound.so"
|
||||
ln -sf libasound.so.2.0.0 "$LIBBT/libasound.so.2"
|
||||
"$ZIG" cc --target=mipsel-linux-gnueabihf.2.22 $INC -Os -Wall -Wextra meow_audiod.c -o meow_audiod \
|
||||
-lpthread -Llibbt -lasound
|
||||
echo "== meow_audiod (mipsel glibc-dynamic, BT links libasound.so.2) =="
|
||||
ls -la meow_audiod
|
||||
md5sum meow_audiod
|
||||
file meow_audiod
|
||||
echo "-- dynamic NEEDED --"
|
||||
readelf -d meow_audiod 2>/dev/null | grep -iE "needed" || true
|
||||
echo "-- glibc version refs (max must be <= 2.22) --"
|
||||
readelf --version-info meow_audiod 2>/dev/null | grep -oE "GLIBC_2\.[0-9]+" | sort -uV | tail -3 || true
|
||||
Reference in new issue
Block a user