dkms icon indicating copy to clipboard operation
dkms copied to clipboard

'dkms' option "--kernelsourcedir" usage

Open Divinemonk opened this issue 1 year ago • 1 comments

I'm installing wifi adaptor drivers (rtl8821au/rtl8812au) in kali-nethunter! (resource used: airmon-ng, github.com/nlkguy/archer-t2u-plus-linux)

And then I get this error!

mkdir: created directory '/usr/src/8812au-5.6.4.2_35491.20191025'
cp -r * /usr/src/8812au-5.6.4.2_35491.20191025
dkms add -m 8812au -v 5.6.4.2_35491.20191025
Creating symlink /var/lib/dkms/8812au/5.6.4.2_35491.20191025/source -> /usr/src/8812au-5.6.4.2_35491.20191025
dkms build -m 8812au -v 5.6.4.2_35491.20191025
Sign command: /lib/modules/4.19.157-perf-g85e27949fb09/build/scripts/sign-file
Binary /lib/modules/4.19.157-perf-g85e27949fb09/build/scripts/sign-file not found, modules won't be signed
Error! Your kernel headers for kernel 4.19.157-perf-g85e27949fb09 cannot be found at /lib/modules/4.19.157-perf-g85e27949fb09/build or /lib/modules/4.19.157-perf-g85e27949fb09/source.
Please install the linux-headers-4.19.157-perf-g85e27949fb09 package or use the --kernelsourcedir option to tell DKMS where it's located.
make: *** [Makefile:1790: dkms_install] Error 1

Quick note: here is the dkms.conf

PACKAGE_NAME="realtek-rtl88xxau"
PACKAGE_VERSION="5.6.4.2~20221105"
CLEAN="'make' clean"
BUILT_MODULE_NAME[0]=88XXau
PROCS_NUM=`nproc`
[ $PROCS_NUM -gt 16 ] && PROCS_NUM=16
DEST_MODULE_LOCATION[0]="/updates"
MAKE="ARCH=arm ARCH=arm 'make' -j$PROCS_NUM KVER=${kernelver} KSRC=/lib/modules/${kernelver}/build"
AUTOINSTALL="yes"

I have tried everything: wireless-nethunter drivers, drivers from apt (apt search realtek) but nothing is working! lsusb command shows the device is there, but cannot see in ifconfig.

So how do I (came to an conclusions after trying many other options) set the /lib/modules/ & *-kali*-arm64 (side note: 4.19.157-perf-g85e27949fb09, in the error is the original android's kernel when you type uname -r) using dkms --kernelsourcedir (pls note: I have tried dkms --kernelsourcedir=path/to/source/location but it does not work). I searched for docs-demos-&-online-forums but couldn't get an answer that satisfied/solved my problem!

Divinemonk avatar Apr 13 '23 16:04 Divinemonk

So how do I (came to an conclusions after trying many other options) set the /lib/modules/ & -kali-arm64 (side note: 4.19.157-perf-g85e27949fb09, in the error is the original android's kernel when you type uname -r)

I'm not sure, I understand this part ... which I suspect is the crux of your issues. Are you cross-compiling? What are the build and target machine? What CPU and kernel are they running? How/where did you install the respective headers, compilers, etc?

As seen in man dkms, the tool accepts optional kernel/arch arguments. When omitted, dkms will try to auto-detect them. So a simple dkms build -m 8812au -v 5.6.4.2_35491.20191025 -k 4.19.157-perf-g85e27949fb09/arm64 might suffice (note: this is a blind suggestion)

In addition to that, I suggest replacing the PROCS_NUM variable and related code in favour of the number you'd like to use. As-is it's abusing the fact that dkms is a shell script and we've (partially) neutered that.

evelikov avatar Apr 19 '23 13:04 evelikov