asm/bitsperlong.h: No such file or directory when building kernel module


I’m trying to build the drivers for the USB-AC56 wifi adapter, following the directions in the last post of this thread:

That thread is a little outdated (and for the tk1), but I think the changes that were made are still relevant. I did tweak the change such that it would include the “-tegra” in the path to the headers, but that was all that seemed to be required to get the build to start.

I’m having an issue though where I get the following error during the build:

nvidia@hub:~/chris/rtl8812au_asus-master$ make
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -C /usr/src/linux-headers-4.4.38-tegra/ M=/home/nvidia/chris/rtl8812au_asus-master  modules
make[1]: Entering directory '/usr/src/linux-headers-4.4.38-tegra'
  CC [M]  /home/nvidia/chris/rtl8812au_asus-master/core/rtw_cmd.o
In file included from include/asm-generic/int-ll64.h:10:0,
                 from ./arch/arm/include/asm/types.h:4,
                 from include/uapi/linux/types.h:4,
                 from include/linux/types.h:5,
                 from /home/nvidia/chris/rtl8812au_asus-master/include/basic_types.h:80,
                 from /home/nvidia/chris/rtl8812au_asus-master/include/drv_types.h:31,
                 from /home/nvidia/chris/rtl8812au_asus-master/core/rtw_cmd.c:22:
include/uapi/asm-generic/int-ll64.h:11:29: fatal error: asm/bitsperlong.h: No such file or directory

Any ideas about how to resolve this?

This is unlikely to be enough to fix anything, but this part is wrong:

ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-

“arm” is the older ARMv7 32-bit. You need “arm64/aarch64” 64-bit (I don’t know which of those two your software will use…both arm64 and aarch64 names are used in different software for the same thing…the kernel uses notation “arm64” so this is your best bet). The “arm-linux-gnueabihf-” is a tool chain used for ARMv7 32-bit hard float calling convention.

Typically those toolchains use a prefix something like “aarch64-linux-gnu” or “aarch64-unknown-linux-gnu” on the TX1 or TX2 (the former is for user space because it says it supports GNU linux linking…the latter is for bare metal under Linux…typically a kernel or driver…the user space version does work though for kernel builds).