This information is WAY out of date and is kept for historical purposes only.
Go to https://github.com/raspberrypi/linux and download the tarball of the kernel source to your home folder.
Run the following after it has downloaded:
tar -zxvf your_filename.tar.gz
Now update the sytem as follows:
apt-get update apt-get -y dist-upgrade apt-get -y install gcc make bc screen ncurses-dev watchdog
Clean the build folder by running:
make mrproper
To get the correct config for the PI2/3:
KERNEL=kernel7 make bcm2709_defconfig
In the build folder, run the following to set the configs and then generate a menu:
make menuconfig
This where we have to check that the OSS modules are installed. (By using the .config it should). But it also gives us a chance to unload any crap we do not need from the kernel to streamline it.
We also need to disable the frequency scaling and power saving. Both of these affect the audio on the dongle. Find the option Disable watchdog shutdown on close. This will mean on a reboot and there is a hang, it will force a reboot.
After this is complete, make the modules and headers required to compile other software:
make -j4 zImage modules dtbs make scripts
So both the Kernel and the source is the same, we have to install the new kernel. If you are upgrading Kernels, you will need to update the firmware too.
Install the Kernel modules and overwrite the lib folder as required:
make modules_install make headers_install sudo cp arch/arm/boot/dts/*.dtb /boot/ sudo cp arch/arm/boot/dts/overlays/*.dtb* /boot/overlays/ sudo cp arch/arm/boot/dts/overlays/README /boot/overlays/ sudo scripts/mkknlimg arch/arm/boot/zImage /boot/$KERNEL.img
Edit the /etc/modules file
nano /etc/modules
Enter the following in the last line of the file:
bcm2709_wdog
Save that file. Now we need to edit the /etc/watchdog.conf. Uncomment the lines:
#max-load-1 = 24 #watchdog-device = /dev/watchdog
Finally we need to make sure it starts on boot:
update-rc.d watchdog enable
Save this file and Reboot the pi.