Wifi driver compilation Rpi 4B - kernel headers error: "no such file or directory"

Hi, thank you. It was realy solution. So for those, who have the same problem.

At first, I installed aarch64-toolchain:

apt install aarch64-toolchain-osmc

This thread helped me too: Trying to install build-essential:arm64 on pi4 - #3 by dwardor

chROOT="/opt/osmc-tc/aarch64-toolchain-osmc"

mkdir -p $chROOT/home
mount --bind /home $chROOT/home #module source is in /home/osmc
mkdir -p $chROOT/usr/src #kernel source
mount --bind /usr/src $chROOT/usr/src
mkdir -p $chROOT/lib/modules #module makefiles refer to /lib/modules/$KVER/build
mount --bind /lib/modules $chROOT/lib/modules

chroot /opt/osmc-tc/aarch64-toolchain-osmc/

After the last command, I was in chrooted environment and I could find source drivers and compile them by tiping “make”.

cd /home/osmc/src/
make -j 4

So compilation was successfull and I could install driver.

Thank you for you tip, problem is solved.