How to Fix DKMS error: "/bin/sh: 1: scripts/basic/fixdep: Exec format error"
The kernel headers are cross compiled and there's a bug in deb-pkg that packs the build host executables rather than the target executables. Thankfully, the sources are also included with the headers so you just have to recompile the header scripts.
There are 4 steps needed to do this:
1) Change to the Linux header directory:
cd /usr/src/linux-headers-`uname -r`
1) Install the necessary dependencies:
sudo apt-get install -y build-essential bc bison flex libssl-dev
2) Apply the byteshift patch to the headers:
wget https://raw.githubusercontent.com/armbian/build/master/patch/misc/headers-debian-byteshift.patch -O - | sudo patch -p1
3) Compile the scripts:
sudo make scripts
Now DKMS should work like normal. This is useful for adding Realtek wireless devices and other drivers.