Files
chromebox_10th_audio_driver/scripts/verify-ubuntu-hwe617-0001-patch.sh
2026-04-04 18:13:40 +08:00

41 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
# Dry-run 验证 patches/ubuntu-hwe-6.17/0001 能否打在 HWE 6.17 源码树上(无需完整 debian/)。
# 完整 deb 构建仍须按 kernel-src/README.md apt source 后使用 ubuntu-hwe-617-build.sh。
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
SRC="${SRC:-$REPO_ROOT/kernel-src/linux-hwe-6.17-6.17.0}"
PATCH="${PATCH:-$REPO_ROOT/patches/ubuntu-hwe-6.17/0001-ASoC-SOF-ipc3-pcm-await-DSP-reply-for-FREE-and-trigger.patch}"
if [[ ! -f "$SRC/sound/soc/sof/ipc3-pcm.c" ]]; then
echo "ERROR: 未找到 $SRC/sound/soc/sof/ipc3-pcm.c请设置 SRC= 或按 kernel-src/README.md 准备源码树)" >&2
exit 1
fi
if [[ ! -f "$PATCH" ]]; then
echo "ERROR: 补丁不存在: $PATCH" >&2
exit 1
fi
echo "SRC=$SRC"
echo "PATCH=$PATCH"
if [[ -f "$SRC/debian/rules" ]]; then
echo "OK: 检测到 debian/rules可进行 fakeroot debian/rules binary-generic"
else
echo "注意: 当前树无 debian/(常见于仅检出部分内核目录);补丁校验仍可进行,完整包需 apt source linux-hwe-6.17"
fi
cd "$SRC"
set +e
out="$(patch -p1 --dry-run --forward < "$PATCH" 2>&1)"
st=$?
set -e
if [[ "$st" -eq 0 ]]; then
echo "OK: patch --dry-run 通过(干净树可执行 ubuntu-hwe-617-build.sh apply"
elif echo "$out" | grep -qiE 'previously applied|Reversed \(or previously applied\) patch detected'; then
echo "OK: 当前 ipc3-pcm.c 已包含该补丁内容(无需重复 apply"
else
echo "$out" >&2
echo "ERROR: dry-run 失败,请核对内核版本是否与补丁目标一致" >&2
exit 1
fi