Added build-deb.sh to create debian package for QUD kernel driver#31
Open
Added build-deb.sh to create debian package for QUD kernel driver#31
Conversation
Signed-off-by: shasaror <shasaror@qti.qualcomm.com>
Previously, our QUD Debian kernel installer attempted to remove the qualcomm-userspace-driver package using dpkg purge as part of its installation flow. However, this approach led to failures and installer hangs. When the QUD kernel installer is executed,dpkg already holds an exclusive frontend lock on: /var/lib/dpkg/lock-frontend As a result, any nested attempt within the same installer script to invoke package management commands—such as: dpkg -r / dpkg --purge apt remove / apt purge will fail and may cause the installer process to hang with the following error: "dpkg: error: dpkg frontend lock was locked by another process" This behavior is by design according to Debian policy: A package must not attempt to manipulate other packages during its own installation lifecycle. Solution: Now, 'qualcomm-userspace-driver' is removed by dpkg itself before postinst runs, via the Conflicts/Replaces/Breaks fields declared in DEBIAN/control. Signed-off-by: shasaror <shasaror@qti.qualcomm.com>
Signed-off-by: shasaror <shasaror@qti.qualcomm.com>
Signed-off-by: shasaror <shasaror@qti.qualcomm.com>
Contributor
Author
|
changes looks good. I have tested throughly mutiple times along with userspace debian installer. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This change introduces a Debian-package (
.deb) build and install flow for the Qualcomm USB kernel driver (qud). The packager producesbuild/qud_<version>_all.deb, whose maintainer scripts handle dependency removal, kernel-header provisioning, and module build/load through the existingqcom_drivers.sh. The package is mutually exclusive withqualcomm-userspace-driverand lets dpkg perform an atomic swap between the two drivers.Features
1. Resolves the dpkg
lock-frontendconflict during userspace-driver removalEarlier attempts had
postinstcalldpkg -r/--purge(orapt remove/purge) onqualcomm-userspace-driverfrom inside its own install script. This always failed withdpkg: error: dpkg frontend lock was locked by another process, because dpkg holds an exclusive lock on/var/lib/dpkg/lock-frontendfor the full duration of any maintainer script — Debian Policy explicitly forbids a package from manipulating other packages during its own install. The 2nd commit is to delegate the removal to dpkg itself viaConflicts: qualcomm-userspace-driver / Replaces: qualcomm-userspace-driver / Breaks: qualcomm-userspace-driverinDEBIAN/control(with the symmetric declarations added to the userspace packager so both directions work). dpkg now removes the conflicting package automatically before our postinst runs, in the same transaction, with no nested package-manager calls.2. Comprehensive install logging —
/opt/qcom/QUD/qcom_kernel_install.logEvery step of the install flow - from script-permission setup to the final
qcom_drivers.shoutput — is captured in/opt/qcom/QUD/qcom_kernel_install.log. The log is reset bypreinston each install, and stages are framed by clearly-titled===banner blocks so a non-developer can read it top-to-bottom and tell exactly what happened, in what order, with what result. Uninstall events are written to a parallel file/opt/qcom/QUD/qcom_kernel_uninstall.log.3. Handles cleanup of prior QUD installations and services
postinstruns a structured cleanup sequence before installing the new driver:qud.internal,qud, orqud.sltpackages that were installed viaqpm-cli.legacy/installer/QcDevDriver.sh uninstallif present, removing artifacts from older QUD layouts.QUDService.serviceand the currentqcom-qud.servicesystemd units if present.4. Ensures kernel headers for the running kernel
postinstchecks for/lib/modules/$(uname -r)/build; if missing, it auto-installslinux-headers-$(uname -r)viaapt-get install -yso the modules can be built against the running kernel. This currently lives in the postinst because it is Debian-specific. Future work will move this responsibility intoqcom_drivers.shitself so it is shared across all platforms (rpm-based, source-tarball installs, etc.).5. Installs the latest QUD driver via
qcom_drivers.shThe unchanged, canonical install pipeline is reused: postinst's final step is
(cd /opt/qcom/QUD/build && ./qcom_drivers.sh install). This builds the kernel modules with the headers from step 4, signs them when MOK keys are available, copies them under/lib/modules/$(uname -r)/, lays down udev rules, refreshes blacklists, and loadsqtiDevInf,qcom_usb, andqcom_usbnet.prermmirrors this withqcom_drivers.sh uninstall. Keeping the build/load logic in one shell script means the Debian flow stays a thin wrapper rather than a parallel implementation.6. Picks the package version from
version.hbuild-deb.shparsesDRIVER_VERSIONout ofqcom-usb-kernel-drivers/src/linux/version.hat build time and stamps it into both the.debfilename (qud_<version>_all.deb) and theVersion:field ofDEBIAN/control. There are no hardcoded version strings in the packager - bumpingversion.his the single source of truth, anddpkg -s qud | grep ^Versionwill always report the same value.7. Packages only the essential payload
build-deb.shpacks theqcom-usb-kernel-drivers/src/linux/tree (kernel sources,Makefile,qcom_drivers.sh, signing helpers,version.h, RELEASES.md, README.md, plus the bundled legacy installer) into the.deb, while explicitly excluding thebuild/output directory and the packager script itself. Local kernel build artifacts (*.o,*.ko,*.mod*,*.cmd,Module.symvers,modules.order,.tmp_versions) are stripped from the payload, so a developer-machinemakedoesn't pollute releases. The full payload is unpacked under/opt/qcom/QUD/build/on the target.