QCOM-FIRMWARE-EXTRACT(8)

NAME
qcom-firmware-extract - extract Qualcomm Snapdragon X firmware from a local Windows install and package it for Debian/Ubuntu

SYNOPSIS
qcom-firmware-extract [-d PATH]

DESCRIPTION
qcom-firmware-extract mounts a Windows system partition (BitLocker or plain NTFS), locates Qualcomm DSP firmware files under Windows/System32/DriverStore/FileRepository and builds a Debian package that installs those files into /lib/firmware/updates/qcom/<device> . It then installs the package and updates the initramfs so the firmware is available on next boot.

Device selection is automatic: the script reads /proc/device-tree/model and maps known device models to the appropriate firmware directory.

Unless -d is supplied, the script searches NVMe devices, decrypts a BitLocker volume (read-only) via dislocker when needed, or mounts the first plain NTFS partition it finds, also read-only.

The generated package is named:

    qcom-x1e-firmware-extracted-<device>_<YYYYMMDD>_arm64.deb

and declares Breaks/Replaces/Conflicts against qcom-x1e-firmware-extracted to avoid file collisions.

Upon successful creation, the script installs the package with apt-get and runs:

    update-initramfs -kall -u

Finally, it prints a message reminding you to reboot.

OPTIONS

-d PATH
    Use an explicit search path instead of mounting a Windows partition. This should point at the Windows DriverStore FileRepository directory that contains the firmware files, e.g.: /mnt/Windows/System32/DriverStore/FileRepository

SUPPORTED DEVICES
The following models are recognized (by exact or prefix match of /proc/device-tree/model as shown):

    Acer Swift 14 AI (SF14-11) -- x1e80100/ACER/SF14-11

    ASUS Vivobook S 15 -- x1e80100/ASUSTeK/vivobook-s15

    ASUS Zenbook A14 (UX3407QA[, LCD|, OLED]) -- x1p42100/ASUSTeK/zenbook-a14

    ASUS Zenbook A14 (UX3407RA) -- x1e80100/ASUSTeK/zenbook-a14

    Dell Inspiron 14 Plus 7441 -- x1e80100/dell/inspiron-14-plus-7441

    Dell Latitude 7455 -- x1e80100/dell/latitude-7455

    Dell XPS 13 9345 -- x1e80100/dell/xps13-9345

    HP EliteBook 6 G1q* -- x1p42100/hp/elitebook-6-g1q

    HP EliteBook Ultra G1q -- x1e80100/hp/elitebook-ultra-g1q

    HP Omnibook X 14 -- x1e80100/hp/omnibook-x14

    Lenovo ThinkPad T14s Gen 6 -- x1e80100/LENOVO/21N1

    Lenovo Yoga Slim 7x -- x1e80100/LENOVO/83ED

    Microsoft Surface Laptop 7 (13.8 inch | 15 inch) -- x1e80100/microsoft/Romulus

    Samsung Galaxy Book4 Edge -- x1e80100/SAMSUNG/galaxy-book4-edge

If your device is not listed, the script aborts with an error. Extend the case statement to add support.

RUNTIME BEHAVIOUR

•   Creates a temporary workspace under /tmp/fwfetch.* and ensures cleanup on exit.

•   Mounts BitLocker volumes read-only using dislocker(1) to a loopback file, then mounts via ntfs-3g read-only; plain NTFS partitions are mounted read-only directly.

•   Copies the newest matching firmware files among:
    adsp_dtbs.elf, adspr.jsn, adsps.jsn, adspua.jsn, battmgr.jsn, cdsp_dtbs.elf, cdspr.jsn, qcadsp8380.mbn, qccdsp8380.mbn, qcdxkmsuc8380.mbn, qcdxkmsucpurwa.mbn

•   Installs to /lib/firmware/updates/qcom/<device_path> with mode 0644.

•   Builds a Debian package using dpkg-deb and installs it with apt-get (noninteractive, reinstall, fix dependencies).

•   Runs update-initramfs -kall -u to include firmware in all installed kernels.

REQUIREMENTS
The following tools must be available (typically from Debian/Ubuntu repositories):
    dislocker (for BitLocker volumes), ntfs-3g (for NTFS), dpkg-deb , apt-get , coreutils , findutils , mount , update-initramfs (from initramfs-tools).
Root privileges are required for mounting, package installation, and updating initramfs.

EXIT STATUS
Returns 0 on success. Non-zero on error. Because the script uses set -e , unexpected command failures cause immediate exit; on failure it prints the log from its temporary directory.

FILES

/proc/device-tree/model
    Used to detect the current device model.

Windows/System32/DriverStore/FileRepository
    Default search root on the Windows partition for firmware files.

/lib/firmware/updates/qcom/<device>
    Destination for installed firmware files.

/tmp/fwfetch.XXXXXXX/LOG
    Build and install log captured during execution.

EXAMPLES
Extract and package firmware by automatically locating and mounting the Windows partition:

    sudo qcom-firmware-extract

Use a pre-mounted or copied DriverStore directory:

    sudo qcom-firmware-extract -d /mnt/Windows/System32/DriverStore/FileRepository

SECURITY
The script mounts any discovered Windows partition read-only and decrypts BitLocker volumes via dislocker in read-only mode. Verify you are extracting firmware from a trusted Windows installation.

LIMITATIONS

•   Only searches NVMe devices (e.g. nvme0n1). Systems using SATA/eMMC are not scanned automatically; use -d.

•   Only the listed devices are supported out of the box.

•   Assumes an arm64 Debian/Ubuntu target with initramfs-tools present.

SEE ALSO
dislocker(1), mount.ntfs(8), dpkg-deb(1), update-initramfs(8)

AUTHORS
Script: Tobias Heider and contributors. Manpage: generated for operational use by administrators.

COPYRIGHT
This script packages firmware extracted from a local Windows installation. Respect the firmware's license terms and your local laws/policies before redistribution.