Skip to content

Focusrite-Scarlett-on-Linux/sound-usb-kernel-module

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DKMS modules for sound/usb from the latest Linux Kernel development

Initially, this enables the usage of bleeding-edge driver code for USB sound devices against a mainline kernel (5.2.x). By "bleeding-edge", I mean pre-Linus, destined for the 5.4 merge window, a few months in the future.

Work has continued to backport v5.10.x-rcX to v5.9.x, at this time of writing (Nov 2020).

This is assembled from the Linux Kernel's sound sub-system maintainer, Takashi Iwai's tree (git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git). Initially, it was mainly for trying out the work of Geoffrey D. Bennett (git://github.com/geoffreybennett/scarlett-gen2.git) final V7 post regarding the Focusrite Scarlett 18i20 Gen 2. However, it is likely useful for other USB sound devices too.

Installation

Ubuntu

For those who merely wants to try it out, from mainline 5.2.8, mainline 5.2.9, mainline 5.2.11, grab at least the image-unsigned and modules Ubuntu packages, plus the corresponding binary packages in release. e.g.

dpkg -i linux-image-unsigned-5.2.8-050208-generic_5.2.8-050208.201908091630_amd64.deb
dpkg -i linux-modules-5.2.8-050208-generic_5.2.8-050208.201908091630_amd64.deb
dpkg -i sound-usb-modules-5.2.8-050208-generic_5.3.0rc7.14312_amd64.deb

For those who actually may like to modify the driver code, grab the headers-…-all and headers-…-amd64 packages, too, of one of the mainline 5.2.x series. You also need to install the dkms package from Ubuntu, and the sound-usb-dkms package from release :

apt install dkms
dpkg -i sound-usb-dkms_5.3.0rc7.14312-1ubuntu1_all.deb

This combination will try to build the USB sound modules, from source code, for every compatible kernel image you have installed.

Fedora

dnf install -y dkms
dnf install -y sound-usb-5.3.0rc7.14312-1dkms.noarch.rpm

Manual Installation on Non-Ubuntu/Debian Systems

For Non-Ubuntu/Debian Systems,

  • You could just copy the whole of the sound-usb sub-directory to /usr/src/sound-usb-<module-version>/ e.g. <module-version> = 5.3.0rc7.14312 in the above is auto-generated by Ubuntu's dpkg-buildpackage.

  • Then modify debian/sound-usb-dkms.dkms slightly by replacing #MODULE_VERSION# near the top by the same number (5.3.0rc7.14312), and copy to /usr/src/sound-usb-<module-version>/dkms.conf.

  • execute dkms add sound-usb/5.3.0rc7.14312 to register the module.

Then most dkms commands should work, such as:

dkms status
dkms build --verbose sound-usb/5.3.0rc7.14312
dkms install --verbose sound-usb/5.3.0rc7.14312

The above build and install against your running kernel. Using modprobe -r ... to unload the old modules, and modprobe -v ... to reload. Reboot is probably simpler.

Manual Fedora Installation Example

As an example, the noarch.rpm was built in a Fedora 30 docker instance (docker pull fedora:30) with:

dnf install dkms kernel-devel kernel-modules make rpm-build
cd ... # where
cp -ipr sound-usb /usr/src/sound-usb-5.3.0rc7.14312

# copy debian/sound-usb-dkms.dkms to dkms.conf and s/#MODULE_VERSION#/5.3.0rc7.14312/
cp -p dkms.conf /usr/src/sound-usb-5.3.0rc7.14312

dkms add sound-usb/5.3.0rc7.14312
dkms status

dkms build --verbose sound-usb/5.3.0rc7.14312 -k 5.2.9-200.fc30.x86_64
dkms mkrpm --verbose --source-only sound-usb/5.3.0rc7.14312 -k 5.2.9-200.fc30.x86_64

Development

To actually try modifying the driver source code, and build your modification against your current running kernel, do this (don't worry - the outcome stays in this directory):

make -C /lib/modules/`uname -r`/build M=`pwd`/sound/usb clean
make -C /lib/modules/`uname -r`/build M=`pwd`/sound/usb modules

Untested Something like this would install the newly built modules in your system against your current kernel. You might want to do make -n to see where the command put the modules:

make -C /lib/modules/`uname -r`/build M=`pwd`/sound/usb modules_install

The linux kernel prefers to load modules under /lib/modules/*/updates and /lib/modules/*/extra over elsewhere under /lib/modules/*, so it is safer to manually copy new *.ko into those directories, and run depmod -a to let the kernel rescan them, rather than doing make ... modules_install.

If your kernel has CONFIG_MMODULE_SIG_FORCE=y (most secure-boot distribution kernels are), you will need to have a pair of certs/signing_key.pem and certs/signing_key.x509, acceptable to your current BIOS, to sign the kernel modules.

However, you are advised to do dpkg-buildpackage (on Ubuntu/Debian), or follow the "Manual installation..." sections above, to build the DKMS deb/rpm package. After install that instead, the DKMS system will then build and install the kernel modules at the next reboot, for any old or new compatible kernel you installed or will install in the near future. The DKMS system puts the newly built modules in a separate directory (to be loaded with a higher priority) from your distribution as-shipped modules. The separate module directory can be removed and changes reverted. This is a much safer way of trying out new driver code, than overwriting your as-shipped modules.