From 1f813a22f276c61cd03f2104b3a71eae90d8b1dc Mon Sep 17 00:00:00 2001 From: Colin Lundholm <265166644+gitColinX@users.noreply.github.com> Date: Thu, 12 Nov 2026 00:23:54 -0700 Subject: [PATCH] extract-vendor-firmware: the Pixel 8 Pro's Bluetooth patch and haptics files `-d husky` staged the four Wi-Fi files only, with Bluetooth and the rest left "for drivers". Kernel #199 (Bluetooth) and #200 (haptics) are on `omamobile` now, so an installed Pixel 8 Pro had the drivers and not the files: cs40l26-vibra stopped at "No cs40l26.wmfw" and btbcm at "firmware Patch file not found" (a scan found nothing). husky's map gains stock's `BCM.hcd` as `brcm/BCM.google,zuma-husky.hcd` and the five CS40L26 files the 7 Pro and the 9a take. This `BCM.hcd` names the module and board ("G5SN_V17_HK3 REL ..."), not the chip, so husky's Bluetooth check looks for that; the haptics checks run for husky too. The test's husky fixture has the new files and a case refuses another chip's patch. Co-Authored-By: Claude Fable 5.2 --- packages/omamobile-device-husky/README.md | 2 +- tests/extract-vendor-firmware | 15 +++++++-- tools/extract-vendor-firmware | 41 ++++++++++++++++------- 3 files changed, 42 insertions(+), 16 deletions(-) diff --git a/packages/omamobile-device-husky/README.md b/packages/omamobile-device-husky/README.md index ecad16c32..dc8829212 100644 --- a/packages/omamobile-device-husky/README.md +++ b/packages/omamobile-device-husky/README.md @@ -27,7 +27,7 @@ Not in this package: the boot-success marker, the charger, cameras, and the slot ## Firmware the phone needs -Nothing here is in the package. Wi-Fi needs four files from Google's firmware for the BCM4398 D0, which `tools/extract-vendor-firmware -d husky -s SKU` takes from the owner's own factory image or OTA `vendor.img`. They're installed under `/usr/lib/firmware/updates/brcm`, with the board-suffixed names brcmfmac loads first: +Nothing here is in the package. `tools/extract-vendor-firmware -d husky -s SKU` also stages the Bluetooth patch (`brcm/BCM.google,zuma-husky.hcd`, stock's `BCM.hcd`) and the five CS40L26 haptics files (`cs40l26.wmfw`, `cs40l26.bin` and the three tuning files) from the same image. Wi-Fi needs four files from Google's firmware for the BCM4398 D0, which `tools/extract-vendor-firmware -d husky -s SKU` takes from the owner's own factory image or OTA `vendor.img`. They're installed under `/usr/lib/firmware/updates/brcm`, with the board-suffixed names brcmfmac loads first: - `brcmfmac4398d0-pcie.google,zuma-husky.bin`: the firmware; - `.txt`: the NVRAM for the phone's region, which `-s` picks from the hardware SKU (`grep hardware.sku /proc/bootconfig`); diff --git a/tests/extract-vendor-firmware b/tests/extract-vendor-firmware index 1c7d3a703..663515042 100755 --- a/tests/extract-vendor-firmware +++ b/tests/extract-vendor-firmware @@ -98,6 +98,10 @@ make_vendor() { printf 'NVRAMRev=%s\n' "$g" > "$v/firmware/bcmdhd.cal_USI_G5SN_9957_V17" echo "clm $g" > "$v/firmware/bcmdhd_clm.blob_4398_d0" echo "txcap $g" > "$v/firmware/bcmdhd_txcap.blob_4398_d0" + echo "fictional G5SN_V17_HK3 REL $g" > "$v/firmware/brcm/BCM.hcd" + halo "FIRMWARE_CS40L26 BUZZ_EFFECTS2_BUZZ_LEVEL $g" > "$v/firmware/cs40l26.wmfw" + halo "calib $g" > "$v/firmware/cs40l26-calib.wmfw" + for f in cs40l26.bin cs40l26-svc.bin cs40l26-dvl.bin; do echo "WMDR $f $g" > "$v/firmware/$f"; done return fi printf 'fictional 4389c1-roml Version=1.0.1 (%s)\n' "$g" > "$v/firmware/fw_bcmdhd.bin" @@ -204,15 +208,20 @@ o=$t/husky-reuse n=$failed seed "$o" if run "$t/husky" "$t/ext4.img" -d husky -o "$o"; then [[ ! -e $o/usr/share/omamobile/sensors ]] || fail "husky: an earlier device's sensor registry is dropped" - [[ $(listed "$o" | tr '\n' ' ') == "brcm/brcmfmac4398d0-pcie.google,zuma-husky.bin brcm/brcmfmac4398d0-pcie.google,zuma-husky.clm_blob brcm/brcmfmac4398d0-pcie.google,zuma-husky.txcap_blob brcm/brcmfmac4398d0-pcie.google,zuma-husky.txt " ]] || - fail "husky: the checksum list names husky's four files only" - [[ $(find "$o/$FW" -type f | wc -l) == 4 ]] || fail "husky: no cheetah firmware stays" + [[ $(listed "$o" | tr '\n' ' ') == "brcm/BCM.google,zuma-husky.hcd brcm/brcmfmac4398d0-pcie.google,zuma-husky.bin brcm/brcmfmac4398d0-pcie.google,zuma-husky.clm_blob brcm/brcmfmac4398d0-pcie.google,zuma-husky.txcap_blob brcm/brcmfmac4398d0-pcie.google,zuma-husky.txt cs40l26-calib.wmfw cs40l26-dvl.bin cs40l26-svc.bin cs40l26.bin cs40l26.wmfw " ]] || + fail "husky: the checksum list names husky's ten files only" + [[ $(find "$o/$FW" -type f | wc -l) == 10 ]] || fail "husky: no cheetah firmware stays" + grep -qF 'Bluetooth patch: G5SN_V17_HK3 REL gen3' "$t/log" || fail "husky: the Bluetooth patch's release is reported" pass_since "$n" "husky: a run over a cheetah generation leaves only husky's files" else cat "$t/log"; fail "husky: a run over a cheetah generation succeeds" fi # --- Failed runs leave the previous generation ---------------------------------- +# husky's BCM.hcd names the module and board, not the chip: another phone's +# patch (here the 7 Pro's) is refused +rm -rf "$t/husky-otherbt"; cp -r "$t/husky" "$t/husky-otherbt"; echo "BCM4389C1 fictional" > "$t/husky-otherbt/firmware/brcm/BCM.hcd" +refuses "husky: another chip's Bluetooth patch" "BCM.hcd is not a" "$t/husky-otherbt" "$t/ext4.img" -d husky rm -rf "$t/v2-missing"; cp -r "$t/v2" "$t/v2-missing"; rm "$t/v2-missing/firmware/aoc.bin" refuses "a missing ext4 file with an older copy in OUT" "/vendor/firmware/aoc.bin is missing" "$t/v2-missing" "$t/ext4.img" refuses "a missing EROFS file with an older copy in OUT" "/vendor/firmware/aoc.bin is missing" "$t/v2-missing" "$t/erofs.img" diff --git a/tools/extract-vendor-firmware b/tools/extract-vendor-firmware index cba119d5b..c13c1664d 100755 --- a/tools/extract-vendor-firmware +++ b/tools/extract-vendor-firmware @@ -3,8 +3,8 @@ # extract-vendor-firmware: copy the Wi-Fi, Bluetooth, haptics and speaker # amplifier firmware the Pixel 7 Pro (cheetah) needs out of a Google factory # image, on the user's own machine. The Pixel 7 (panther), the Pixel 6 Pro -# (raven), the Pixel 9a (tegu) and the Pixel 8 Pro (husky, Wi-Fi only) are -# options (-d). +# (raven), the Pixel 9a (tegu) and the Pixel 8 Pro (husky: Wi-Fi, Bluetooth +# and haptics) are options (-d). # # Google's firmware is not ours to redistribute, so Omarchy Mobile never ships it. # Like LineageOS's extract-files, this pulls it from an image the user already @@ -66,12 +66,15 @@ # is in another format, device/tegu/AUDIO-PLAN.md). The modem's and GNSS's # files are tools/extract-vendor-chroot's. # -# The Pixel 8 Pro (-d husky; is "google,zuma-husky"), Wi-Fi only: +# The Pixel 8 Pro (-d husky; is "google,zuma-husky"): Wi-Fi, Bluetooth +# and haptics: # # vendor/firmware/fw_bcmdhd.bin_4398_d0 -> brcm/brcmfmac4398d0-pcie..bin (brcmfmac) # vendor/firmware/bcmdhd.cal_ -> brcm/brcmfmac4398d0-pcie..txt (NVRAM) # vendor/firmware/bcmdhd_clm.blob_4398_d0 -> brcm/brcmfmac4398d0-pcie..clm_blob (regulatory) # vendor/firmware/bcmdhd_txcap.blob_4398_d0 -> brcm/brcmfmac4398d0-pcie..txcap_blob (TX capabilities) +# vendor/firmware/brcm/BCM.hcd -> brcm/BCM..hcd (btbcm) +# vendor/firmware/cs40l26*.{wmfw,bin} -> the same five files as cheetah's # # The radio is a BCM4398 D0. Stock picks the CLM and TX capability files by # chip revision (_4398_d0), but the NVRAM by the phone's hardware SKU @@ -81,8 +84,15 @@ # (bcmdhd.cal_USI_G5SN_9957_V17, the same bytes as _ROW). The regions differ # only in their energy-detect thresholds. Read the SKU with # `grep hardware.sku /proc/bootconfig` on the phone, or -# `adb shell getprop ro.boot.hardware.sku` on Android. Bluetooth and the -# other files wait for drivers (device/husky/ROADMAP.md). An OTA's vendor.img +# `adb shell getprop ro.boot.hardware.sku` on Android. The Bluetooth patch +# is stock's BCM.hcd, the file btbcm asks for under the board name (kernel +# #199 was tested with it); the vendor partition's BCM_174.hcd (a BCM4398 B0 +# patch), BCM_181.hcd and BTFW_B.hcd are not copied. This BCM.hcd names the +# module and the board ("G5SN_V17_HK3 REL ..."), not the chip, so that is +# what the sanity check looks for. The haptics chip is a CS40L26, as on the +# 7 Pro and the 9a (kernel #200); stock's cs40l26-dbc.bin has no user in +# cs40l26-vibra and is not copied. The AoC's and the speaker amplifiers' +# files wait for their drivers (device/husky/ROADMAP.md). An OTA's vendor.img # (from its payload.bin) works as SOURCE as well as a factory image. # # Output is a tree rooted at /, under usr/lib/firmware/updates (searched before @@ -227,13 +237,14 @@ case $DEVICE_OPT in "firmware/cs40l26-calib.wmfw|cs40l26-calib.wmfw" ) ;; husky) - # Pixel 8 Pro: Wi-Fi (BCM4398 D0) only, with the NVRAM for the SKU's - # region (the header). + # Pixel 8 Pro: Wi-Fi (BCM4398 D0) with the NVRAM for the SKU's region, + # Bluetooth and the haptics files (the header). BT_CHIP is the module and + # board string husky's BCM.hcd carries in place of a chip name. BOARD="google,zuma-husky" DEVICE="husky" FW_BASE="brcmfmac4398d0-pcie" WIFI_CHIP="4398d0" - BT_CHIP="" + BT_CHIP="G5SN_V[0-9]*_HK3" # Google's SKU table (dhd_custom_google.c); husky's vendor has NVRAMs for # MMW, ROW and NA only, so the others take the module's default, as on stock case $SKU in @@ -247,6 +258,12 @@ case $DEVICE_OPT in "firmware/$nvram|brcm/$FW_BASE.$BOARD.txt" "firmware/bcmdhd_clm.blob_4398_d0|brcm/$FW_BASE.$BOARD.clm_blob" "firmware/bcmdhd_txcap.blob_4398_d0|brcm/$FW_BASE.$BOARD.txcap_blob" + "firmware/brcm/BCM.hcd|brcm/BCM.$BOARD.hcd" + "firmware/cs40l26.wmfw|cs40l26.wmfw" + "firmware/cs40l26.bin|cs40l26.bin" + "firmware/cs40l26-svc.bin|cs40l26-svc.bin" + "firmware/cs40l26-dvl.bin|cs40l26-dvl.bin" + "firmware/cs40l26-calib.wmfw|cs40l26-calib.wmfw" ) ;; *) die "unknown device $DEVICE_OPT (cheetah, panther, raven, tegu or husky)" ;; esac @@ -457,8 +474,8 @@ if [[ $DEVICE == cheetah || $DEVICE == panther || $DEVICE == raven ]]; then die "the $f speaker tuning is not a WMDR coefficient file" done fi -# The CS40L26 haptics (the gs201 phones and tegu) -if [[ $DEVICE == cheetah || $DEVICE == panther || $DEVICE == tegu ]]; then +# The CS40L26 haptics (the gs201 phones, tegu and husky) +if [[ $DEVICE == cheetah || $DEVICE == panther || $DEVICE == tegu || $DEVICE == husky ]]; then for f in cs40l26.wmfw cs40l26-calib.wmfw; do wmfw_halo "$f"; done grep -aq 'FIRMWARE_CS40L26' "$dest/cs40l26.wmfw" || die "cs40l26.wmfw is not a CS40L26 firmware" @@ -474,7 +491,7 @@ if [[ $DEVICE == cheetah || $DEVICE == panther ]]; then "$dest/cirrus/cs35l41-$DEVICE-$f-media-delta.txt" || die "the $f media delta is not a word list" done fi -if [[ $DEVICE == cheetah || $DEVICE == panther || $DEVICE == tegu ]]; then +if [[ $DEVICE == cheetah || $DEVICE == panther || $DEVICE == tegu || $DEVICE == husky ]]; then for f in cs40l26.bin cs40l26-svc.bin cs40l26-dvl.bin; do [[ "$(head -c4 "$dest/$f")" == WMDR ]] || die "$f is not a WMDR coefficient file" done @@ -495,7 +512,7 @@ if [[ $DEVICE == husky ]]; then [[ -n $SKU ]] || say "No -s SKU: stock's default NVRAM; pass the phone's SKU for its region's" fi [[ -z $BT_CHIP ]] || say "Bluetooth patch: ${bt:-unknown version}" -[[ $DEVICE == cheetah || $DEVICE == panther || $DEVICE == tegu ]] && +[[ $DEVICE == cheetah || $DEVICE == panther || $DEVICE == tegu || $DEVICE == husky ]] && say "Haptics firmware: cs40l26.wmfw ($(stat -c %s "$dest/cs40l26.wmfw") bytes) and its wavetable" [[ $DEVICE == tegu ]] && say "AoC firmware: aoc-tegu.bin ($(stat -c %s "$dest/aoc-tegu.bin") bytes)"