-
Notifications
You must be signed in to change notification settings - Fork 8
Add Debian packaging (DKMS) for Linux kernel drivers #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| #!/bin/bash | ||
| # Build script for qcom-usb-drivers-dkms debian package | ||
| # Usage: ./build-deb.sh | ||
| # | ||
| # Prerequisites: sudo apt-get install debhelper dkms dpkg-dev dh-dkms | ||
| set -e | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| cd "$SCRIPT_DIR" | ||
|
|
||
| PKG_VERSION=$(grep '#define DRIVER_VERSION' src/linux/version.h | awk '{print $3}' | tr -d '"') | ||
| echo "Building qcom-usb-drivers-dkms version $PKG_VERSION" | ||
|
|
||
| # Update version in dkms.conf if needed | ||
| sed -i "s/^PACKAGE_VERSION=.*/PACKAGE_VERSION=\"${PKG_VERSION}\"/" dkms.conf | ||
|
|
||
| # Update version in debian/changelog if needed | ||
| CHANGELOG_VER=$(head -1 debian/changelog | grep -oP '\(\K[^)]+') | ||
| if [ "$CHANGELOG_VER" != "$PKG_VERSION" ]; then | ||
| sed -i "1s/([^)]*)/($PKG_VERSION)/" debian/changelog | ||
| fi | ||
|
|
||
| # Update version in postinst and preinst if needed | ||
| sed -i "s/^PKG_VERSION=.*/PKG_VERSION=\"${PKG_VERSION}\"/" debian/qcom-usb-drivers-dkms.postinst | ||
| sed -i "s/^PKG_VERSION=.*/PKG_VERSION=\"${PKG_VERSION}\"/" debian/qcom-usb-drivers-dkms.preinst | ||
|
|
||
| # Update version in debian/rules if needed | ||
| sed -i "s/^PKG_VERSION := .*/PKG_VERSION := ${PKG_VERSION}/" debian/rules | ||
|
|
||
| # Check for required build tools | ||
| for tool in dpkg-buildpackage debhelper dkms; do | ||
| if [ "$tool" = "debhelper" ]; then | ||
| dpkg -l debhelper >/dev/null 2>&1 || { echo "Error: $tool not installed. Run: sudo apt-get install $tool"; exit 1; } | ||
| elif [ "$tool" = "dkms" ]; then | ||
| dpkg -l dkms >/dev/null 2>&1 || { echo "Error: $tool not installed. Run: sudo apt-get install $tool"; exit 1; } | ||
| else | ||
| command -v $tool >/dev/null 2>&1 || { echo "Error: $tool not found. Run: sudo apt-get install dpkg-dev"; exit 1; } | ||
| fi | ||
| done | ||
|
|
||
| # Check for dh-dkms (provides dh_dkms helper) | ||
| dpkg -l dh-dkms >/dev/null 2>&1 || { echo "Error: dh-dkms not installed. Run: sudo apt-get install dh-dkms"; exit 1; } | ||
|
|
||
| # Ensure debian/rules is executable | ||
| chmod +x debian/rules | ||
|
|
||
| # Clean previous build artifacts | ||
| rm -f ../qcom-usb-drivers-dkms_*.deb | ||
| rm -f ../qcom-usb-drivers-dkms_*.buildinfo | ||
| rm -f ../qcom-usb-drivers-dkms_*.changes | ||
| rm -rf debian/qcom-usb-drivers-dkms | ||
| rm -rf debian/.debhelper | ||
|
|
||
| # Build the package (unsigned) | ||
| dpkg-buildpackage -us -uc -b | ||
|
|
||
| echo "" | ||
| echo "========================================" | ||
| echo "Build complete! Package files:" | ||
| ls -la ../qcom-usb-drivers-dkms_${PKG_VERSION}*.deb 2>/dev/null || echo "(deb file in parent directory)" | ||
| echo "" | ||
| echo "Install with: sudo dpkg -i ../qcom-usb-drivers-dkms_${PKG_VERSION}_all.deb" | ||
| echo "Uninstall with: sudo dpkg -r qcom-usb-drivers-dkms" | ||
| echo "Check status: dpkg -s qcom-usb-drivers-dkms" | ||
| echo "========================================" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # Build artifacts generated by dpkg-buildpackage | ||
| .debhelper/ | ||
| debhelper-build-stamp | ||
| files | ||
| *.substvars | ||
| *.debhelper | ||
| qcom-usb-drivers-dkms/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # Qualcomm USB device udev rules | ||
| # GobiNet network device | ||
| SUBSYSTEM=="net", DRIVERS=="GobiNet", MODE="0660", GROUP="plugdev" | ||
|
|
||
| # GobiSerial serial ports | ||
| SUBSYSTEM=="tty", DRIVERS=="GobiSerial", MODE="0660", GROUP="dialout" | ||
|
|
||
| # QDSS diagnostic devices | ||
| SUBSYSTEM=="usb", DRIVERS=="QdssDiag", MODE="0660", GROUP="plugdev" | ||
| SUBSYSTEM=="usb", DRIVERS=="QdssMdm", MODE="0660", GROUP="plugdev" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| qcom-usb-drivers-dkms (1.0.6.1) unstable; urgency=medium | ||
|
|
||
| * Initial DKMS debian package for Qualcomm USB kernel drivers | ||
| * Includes qtiDevInf, qcom_usb, qcom_usbnet, qcom-serial modules | ||
| * Blacklists conflicting in-tree modules (qcserial, qmi_wwan, option, usb_wwan) | ||
| * Installs udev rules for Qualcomm USB device permissions | ||
|
|
||
| -- Qualcomm Technologies, Inc. <qcom-usb-drivers@qualcomm.com> Tue, 08 Apr 2025 10:00:00 -0700 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| Source: qcom-usb-drivers-dkms | ||
| Section: kernel | ||
| Priority: optional | ||
| Maintainer: Qualcomm Technologies, Inc. <qcom-usb-drivers@qualcomm.com> | ||
| Build-Depends: debhelper-compat (= 13), dkms | ||
| Standards-Version: 4.6.0 | ||
| Rules-Requires-Root: no | ||
|
|
||
| Package: qcom-usb-drivers-dkms | ||
| Architecture: all | ||
| Depends: ${misc:Depends}, dkms, linux-headers-generic | linux-headers-amd64 | linux-headers-arm64 | ||
| Conflicts: qcom-usb-userspace-driver | ||
| Replaces: qcom-usb-userspace-driver | ||
| Description: Qualcomm USB kernel drivers (DKMS) | ||
| DKMS package for Qualcomm USB kernel drivers including: | ||
| * qtiDevInf - INF file parser for device enumeration | ||
| * qcom_usb - USB diagnostic and QDSS driver | ||
| * qcom_usbnet - USB network (WWAN) adapter driver | ||
| * qcom-serial - USB serial/modem port driver | ||
| . | ||
| These drivers are automatically built for the running kernel using DKMS | ||
| and will be rebuilt when the kernel is updated. Conflicting in-tree | ||
| modules (qcserial, qmi_wwan, option, usb_wwan) are blacklisted. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ | ||
| Upstream-Name: qcom-usb-drivers | ||
| Upstream-Contact: Qualcomm Technologies <qcom-usb-drivers@qualcomm.com> | ||
|
|
||
| Files: * | ||
| Copyright: 2025-2026 Qualcomm Technologies, Inc. and/or its subsidiaries. | ||
| License: BSD-3-Clause | ||
| Redistribution and use in source and binary forms, with or without | ||
| modification, are permitted provided that the following conditions are met: | ||
| . | ||
| 1. Redistributions of source code must retain the above copyright notice, | ||
| this list of conditions and the following disclaimer. | ||
| 2. Redistributions in binary form must reproduce the above copyright notice, | ||
| this list of conditions and the following disclaimer in the documentation | ||
| and/or other materials provided with the distribution. | ||
| 3. Neither the name of the copyright holder nor the names of its contributors | ||
| may be used to endorse or promote products derived from this software | ||
| without specific prior written permission. | ||
| . | ||
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
| AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| ARE DISCLAIMED. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| dkms.conf |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # Qualcomm USB kernel drivers - module configuration | ||
| # Installed by qcom-usb-drivers-dkms package | ||
|
|
||
| # Blacklist conflicting in-tree modules so that Qualcomm drivers are used | ||
| blacklist qcserial | ||
| install qcserial /bin/false | ||
| blacklist qmi_wwan | ||
| install qmi_wwan /bin/false | ||
| blacklist option | ||
| install option /bin/false | ||
| blacklist usb_wwan | ||
| install usb_wwan /bin/false | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we do not need modprobe file here. this content is already taken care by our qcom_driver.sh script. |
||
| # Load Qualcomm USB drivers at boot (qtiDevInf must load first) | ||
| softdep qcom_usb pre: qtiDevInf | ||
| softdep qcom_usbnet pre: qtiDevInf | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| #!/bin/bash | ||
| # Post-installation script for qcom-usb-drivers-dkms | ||
| set -e | ||
|
|
||
| PKG_NAME="qcom-usb-drivers" | ||
| PKG_VERSION="1.0.6.1" | ||
|
|
||
| # DEBHELPER runs dkms add/build/install here | ||
| #DEBHELPER# | ||
|
|
||
| case "$1" in | ||
| configure) | ||
| # Reload udev rules | ||
| udevadm control --reload-rules 2>/dev/null || true | ||
| udevadm trigger 2>/dev/null || true | ||
|
|
||
| # Update module dependencies | ||
| depmod -a 2>/dev/null || true | ||
|
|
||
| # Unload conflicting in-tree modules if loaded | ||
| for mod in qcserial qmi_wwan cdc_wdm option usb_wwan; do | ||
| if lsmod | grep -qw "$mod"; then | ||
| echo " Unloading conflicting module: $mod" | ||
| rmmod "$mod" 2>/dev/null || true | ||
| fi | ||
| done | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is already handled by the qcom_driver.sh script. |
||
| # Load the Qualcomm drivers (order matters: qtiDevInf first) | ||
| for mod in qtiDevInf qcom_usb qcom_usbnet qcom-serial; do | ||
| modprobe "$mod" 2>/dev/null || true | ||
| done | ||
|
|
||
| echo "qcom-usb-drivers $PKG_VERSION: modules installed and loaded successfully." | ||
| ;; | ||
|
|
||
| abort-upgrade|abort-remove|abort-deconfigure) | ||
| ;; | ||
|
|
||
| *) | ||
| ;; | ||
| esac | ||
|
|
||
| exit 0 | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QdssMdm is not a driver.
Gobiserial is not in used. User can build it for internal use-case. we are not building it via QcDevDriver.sh script.
and currently we are not using QcDevDriver.sh script as well.