Files
chromebox_10th_audio_driver/scripts/collect-kaisa-sof-trace.sh
2026-04-04 07:45:01 +00:00

46 lines
1.6 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# Kaisa辅助开启 SOF IPC 观测并采集 dmesg需在真机以 root 运行)
# 详见 docs/OPERATION_Kaisa_SOF_HDMI_Trace.md
set -euo pipefail
if [[ "${EUID:-}" -ne 0 ]]; then
echo "请使用 root 或 sudo 运行本脚本。" >&2
exit 1
fi
DD_CTRL=/sys/kernel/debug/dynamic_debug/control
if ! mountpoint -q /sys/kernel/debug 2>/dev/null; then
mount -t debugfs none /sys/kernel/debug || {
echo "无法挂载 debugfs请检查内核 CONFIG_DEBUG_FS。" >&2
exit 1
}
fi
if [[ ! -w "$DD_CTRL" ]]; then
echo "无法写入 $DD_CTRL" >&2
exit 1
fi
# 与 6.17 树路径一致;若 Unknown请 grep dynamic_debug/control 中实际 file 名
for f in \
sound/soc/sof/ipc3.c \
sound/soc/sof/ipc3-pcm.c \
sound/soc/sof/intel/hda-pcm.c \
sound/soc/sof/intel/hda-dai.c; do
echo "file $f +p" >> "$DD_CTRL" || echo "警告: 未启用 $f(可能路径不同)" >&2
done
echo "已写入 dynamic_debug+p。"
echo ""
if [[ -r /sys/module/snd_sof/parameters/sof_debug ]]; then
echo "当前 snd_sof sof_debug=$(cat /sys/module/snd_sof/parameters/sof_debug)"
echo "若需 IPC 载荷十六进制,/etc/modprobe.d 中设置 options snd_sof sof_debug=0x800 并重启(见文档)。"
else
echo "未加载 snd_sof 模块;加载后再 cat /sys/module/snd_sof/parameters/sof_debug"
fi
echo ""
echo "下一步speaker-test 或播放 HDMI然后"
echo " TS=\$(date +%Y%m%d_%H%M%S); KR=\$(uname -r); dmesg -T > /tmp/dmesg_sof_TRACE_jack-Kaisa_\${KR}_\${TS}.txt"
echo "将 /tmp 下文件复制到仓库 audio_topology/collected/"