Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save masnagam/cd7f1892336a503e81c4c64a7bacc880 to your computer and use it in GitHub Desktop.
Save masnagam/cd7f1892336a503e81c4c64a7bacc880 to your computer and use it in GitHub Desktop.
Build missing files required for building drivers (Armbian linux-headers-rockchip64 has been broken)
#!/bin/bash
# Armbian linux-headers-rockchip64 for 4.4.xxx-rockchip64 has been broken.
# Several files required for building drivers are missing.
#
# * https://forum.armbian.com/topic/9540-linux-headers-rk3399-is-broken-for-building-out-of-tree-modules-with-fix/
# * https://forum.armbian.com/topic/9602-linux-headers-41920-cubox-make-scripts-fails/
# * https://forum.armbian.com/topic/873-solved-compiling-drivers-error-no-header-files-found/
# Reboot before running this script if you have been just upgraded kernel.
KREL=$(uname -r)
# Assumed that linux-headers-rockchip64 has already been installed.
# https://github.com/armbian/build/commit/40557aebb30fd98c4fa9af74e9d277d93d9be226
sudo mkdir -p /usr/src/linux-headers-$KREL/net/wireguard
sudo touch /usr/src/linux-headers-$KREL/net/wireguard/{Kconfig,Makefile}
# https://forum.armbian.com/topic/4849-missing-recordmcount-looks-like-solved/
(cd /usr/src/linux-headers-$KREL/scripts; sudo make recordmcount)
# `make scripts` fails due to the following error:
#
# scripts/selinux/genheaders/genheaders.c:13:22: fatal error: classmap.h: No such file or directory
# #include "classmap.h"
# ^
# But it's OK because we can build required files before the error occurs.
(cd /usr/src/linux-headers-$KREL; sudo make scripts || true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment