/MC7710_driver_builder

Automating the driver build process for the MC7710 QMI USB drivers for Linux

Primary LanguageCOtherNOASSERTION

MC7710 linux driver builder

I have an MC7710 running on an x230. Whenever apt upgrades the kernel, I have to rebuild the bloody driver manually, as there isn't a DKMS module for the Linux QMI USB Drivers for the Sierra AirPrime series.

This is the preliminary framework I wrote up to atleast automate the process of building and installing the modules. Future TODO is to do Full DKMS-ization of the build.

Before Anything Else

The Sierra sources require the kernel include file linux/memcontrol.h to be edited in different ways depending on the kernel version the module is being built against. This framework edits the code expecting that the kernel version being used is 5.0.0 or greater.

Starting from version S2.42N2.62, the Seirra source package now contains a dkms/ folder (which is included here) somewhat inspired by this repo, but very limited in what it can do (only builds against running kernel version, still requires manual kernel includes editing). If you decide to use that instead, please read everything in the DKMS conf and Makefiles, and examine dkms build logs carefully for any issues and errors.

Licensing

  • All driver code is copyright of their respective owners under their licensing
  • My code is licensed under a modified BSD license as detailed in the LICENSE file

Requirements

  • Recent modern Bash
  • Recent version of DKMS
  • All the other requirements as listed on the driver package page on the Sierra Wireless website.

Last Few Tested Build Environments

  • Lenovo Thinkpad x230 running Xubuntu "18.04.4 LTS (Bionic Beaver)" with dkms version 2.3-3ubuntu9.7 and running linux kernel version 5.3.0 (version 5.3.0-59-generic) to build Sierra Linux QMI Drivers version S2.42N2.62 for package linux-image-5.3.0-61-generic (version 5.3.0-61.55~18.04.1) on arch amd64 via updates apt repo (apt upgrade).

  • Lenovo Thinkpad x230 running Xubuntu "20.04.1 LTS (Focal Fossa)" with dkms version 2.8.1-5ubuntu1 and linux kernel version 5.4.0 via updates apt repo (package linux-image-5.4.0-52-generic version 5.4.0-52.57 for arch amd64) to build Sierra Linux QMI Drivers version S2.42N2.63.

Build Instructions

  • (First time install only) Clone this repo into /usr/src/SierraLinuxQMIdrivers:

    sudo git clone https://github.com/samveen/MC7710_driver_builder /usr/src/SierraLinuxQMIdrivers
    
  • Create a link to the source dir with a version number(easier versioned driver updates):

    sudo ln -s /usr/src/SierraLinuxQMIdrivers SierraLinuxQMIdrivers-S2.42N2.63
    
  • Register the module with DKMS:

    sudo dkms add --verbose -m SierraLinuxQMIdrivers -v S2.42N2.63
    
  • Build and install the module:

    sudo dkms build --verbose -m SierraLinuxQMIdrivers -v S2.42N2.63
    sudo dkms install --verbose -m SierraLinuxQMIdrivers -v S2.42N2.63
    
  • Check status:

    sudo dkms status --verbose -m SierraLinuxQMIdrivers -v S2.42N2.63
    
  • Get rid of the DKMS setup in case it's a pain:

    sudo dkms uninstall --verbose -m SierraLinuxQMIdrivers -v S2.42N2.63
    sudo dkms remove --verbose -m SierraLinuxQMIdrivers -v S2.42N2.63 --all
    sudo rm -fR /usr/src/SierraLinuxQMIdrivers\*
    
  • Update older versions of modules(remixes install and cleanup instructions above):

    # Remove old versions of drivers from all kernels
    sudo dkms remove SierraLinuxQMIdrivers/S2.42N2.62 --all
    # Update source
    cd /usr/src/SierraLinuxQMIdrivers && sudo git pull & cd ..
    # Move old driver version link to correct version number
    sudo mv SierraLinuxQMIdrivers-S2.42N2.62 SierraLinuxQMIdrivers-S2.42N2.63
    # Alternative syntax for dkms commands
    sudo dkms add --verbose SierraLinuxQMIdrivers/S2.42N2.63
    sudo dkms build SierraLinuxQMIdrivers/S2.42N2.63
    sudo dkms install SierraLinuxQMIdrivers/S2.42N2.63
    sudo dkms status --verbose SierraLinuxQMIdrivers/S2.42N2.63
    

TODO

  • Add kernel module signing for secure boot (Needs some research in Machine owner keys, via mokutil maybe).

Notes

  • The driver version in this repo is S2.42N2.62 (latest as of June 25, 2020).
  • List of versions of the Linux QMI USB drivers is available here.
  • My Makefile improvements submitted to Sierra) are now included.
  • I've had to submit a second patch to Sierra for a similar problem as previously.
  • IMPORTANT The Sierra build installs the modules into /lib/modules/${kversion}/kernel/drivers/net/usb, but dkms ignores the corresponding DEST_MODULE_LOCATION in the dkms.conf for Ubuntu, as per design, putting the modules into /lib/modules/${kversion}/updates/dkms instead . More details at the Ubuntu dkms manpage