#!/usr/bin/env bash # Write unified diffs for ipc3.c, pcm.c, hda-dai.c (ChromeOS 5.15 vs Ubuntu HWE 6.17) to OUT dir. set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" CH="${CH:-$REPO_ROOT/chromiumos_kernel/v5.15}" UB="${UB:-$REPO_ROOT/kernel-src/linux-hwe-6.17-6.17.0}" OUT="${OUT:-$REPO_ROOT/patches/ubuntu-hwe-6.17/reference}" FILES=( sound/soc/sof/ipc3.c sound/soc/sof/pcm.c sound/soc/sof/intel/hda-dai.c ) mkdir -p "$OUT" missing=0 for f in "${FILES[@]}"; do if [[ ! -f "$CH/$f" || ! -f "$UB/$f" ]]; then echo "WARN: skip (missing): $f" >&2 missing=1 continue fi safe="${f//\//_}" dest="$OUT/diff-u_${safe}.txt" ( diff -u "$CH/$f" "$UB/$f" || true ) > "$dest" echo "Wrote $dest ($(wc -l < "$dest") lines)" done if [[ "$missing" -eq 1 ]]; then echo "Ensure CH and UB trees exist. CH=$CH UB=$UB" >&2 exit 1 fi echo "Done. Directory $OUT is gitignored by default."