Upon further investigation, I have located the issue.
dkms checks for installed kernels using the presence of files in /boot directory, including config-* files
As you can see on a normal x64 debian:
akots@xps:~$ ls -l /boot/config-*
-rw-r--r-- 1 root root 235827 Nov 12 10:46 /boot/config-5.3.0-23-generic
-rw-r--r-- 1 root root 235885 Nov 14 00:41 /boot/config-5.3.0-24-generic
On raspbian, package unipi-common installs two scripts
root@basementplc:# dpkg -S /etc/initramfs-tools/scripts/init-bottom/setbootconfig.sh
unipi-common: /etc/initramfs-tools/scripts/init-bottom/setbootconfig.sh
root@basementplc:~# dpkg -S /etc/kernel/postinst.d/initrd-config
unipi-common: /etc/kernel/postinst.d/initrd-config
These two scripts create two files in /boot matching the config-* expression
root@basementplc:/etc# ls -l /boot/config-*
-rwxr-xr-x 1 root root 212 Nov 10 11:01 /boot/config-initrd.inc
-rwxr-xr-x 1 root root 108 Sep 29 05:38 /boot/config-unipi.inc
These are the culpit. Renaming these to config_initrd.inc and config_unipi.inc, and changing the relevant includes in /boot/config.txt fixes the issue.
So, you need to patch unipi-common in order to create files that don't match files that dkms mistakes for kernel configs.
Attached patches for both files.
--- initrd-config.orig 2019-12-18 16:18:34.483277993 +0200
+++ initrd-config 2019-12-18 16:19:31.032380354 +0200
@@ -1,10 +1,15 @@
#!/bin/bash
CONFIGTXT=/boot/config.txt
-CONFIGINC=config-initrd.inc
+CONFIGINC=config_initrd.inc
PATHINC="/boot/${CONFIGINC}"
-# check or insert include directive into config.txt
+# Remove old file using '-' instead of '_'
+rm -f "/boot/config-initrd.inc"
+# Change include using '-' instead of '_'
+sed -i "s/include config-initrd\.inc/include config_initrd.inc/" "${CONFIGTXT}"
+
+# check or insert include directive into config.txt
INCLUDE="include ${CONFIGINC}"
grep -q -e "^[[:blank:]]*${INCLUDE}" "${CONFIGTXT}" || sed "1 i${INCLUDE}" -i "${CONFIGTXT}"
--- setbootconfig.sh.orig 2019-09-20 12:43:10.000000000 +0300
+++ setbootconfig.sh 2019-12-18 16:34:06.618599153 +0200
@@ -54,10 +54,15 @@
echo "dtoverlay=i2c-rtc,mcp7941x"
echo "dtoverlay=unipiee"
[ "$IS_UNIPI1" = "1" ] || echo "dtoverlay=neuron-spi-new"
-) >"${MNTDIR}/config-unipi.inc"
+) >"${MNTDIR}/config_unipi.inc"
+
+# Remove old file using '-' instead of '_'
+rm -f "${MNTDIR}/config-unipi.inc"
+# Change include using '-' instead of '_'
+sed -i "s/include config-unipi\.inc/include config_unipi.inc/" "${MNTDIR}/config.txt"
# check or insert include into config.txt
-INCLUDE="include config-unipi.inc"
+INCLUDE="include config_unipi.inc"
grep -q -e "^[[:blank:]]*${INCLUDE}" "${MNTDIR}/config.txt" || sed "1 i${INCLUDE}" -i "${MNTDIR}/config.txt"
if [ "${DO_MOUNT}" = "1" ]; then