Your build enviromnent and dependences will depend on the linux distro you are using. In gnereal, you will need:
- build-essentials or the equivalent, which is a C compiler and associated support tools
- kernel headers for the specific version of the linux kernel you are using
- kernel tools usually kmod or an equivalent package, for loading, querying and unloading kernel modules.
For convenience, you can use your package manager in your distro to install as follows:
apt install build-essential linux-headers-$(uname -r) kmod
dnf groupinstall "Development Tools"
dnf install kernel-devel kmod
apk add build-base linux-headers alpine-sdk linux-lts-dev kmod lsblk e2fsprogs
apt install build-essential raspberrypi-kernel-headers kmod
yum install -y dkms gcc kernel-devel-$(uname -r) kernel-headers-$(uname -r) make