Problems cross compiling kernel modules for btusb

Seems like the stock kernel that comes the rock pi s does not come with btusb modules.

I’ve tried cross compiling on my buster-x86_64 linux machine but got this after make menuconfig,

I’ve already setup the CROSS_COMPILE and even added PATH in, but it seems its using the system ld ?

anyone got any hints on an easier way to get btusb modules ?

~/git/kernel-stable-4.4-rockpis$ make clean
  CLEAN   .
  CLEAN   arch/arm64/kernel/vdso
  CLEAN   .tmp_versions
alf@julia:~/git/kernel-stable-4.4-rockpis$ make
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/basic/bin2c
  CC      kernel/bounds.s
  CHK     include/generated/bounds.h
  CHK     include/generated/timeconst.h
  CC      arch/arm64/kernel/asm-offsets.s
  CHK     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  LDS     arch/arm64/kernel/vdso/vdso.lds
  VDSOA   arch/arm64/kernel/vdso/gettimeofday.o
  VDSOA   arch/arm64/kernel/vdso/note.o
  VDSOA   arch/arm64/kernel/vdso/sigreturn.o
  VDSOL   arch/arm64/kernel/vdso/vdso.so.dbg
  VDSOSYM include/generated/vdso-offsets.h
  HOSTCC  scripts/dtc/dtc.o
  HOSTCC  scripts/dtc/flattree.o
  HOSTCC  scripts/dtc/fstree.o
  HOSTCC  scripts/dtc/data.o
  HOSTCC  scripts/dtc/livetree.o
  HOSTCC  scripts/dtc/treesource.o
  HOSTCC  scripts/dtc/srcpos.o
  HOSTCC  scripts/dtc/checks.o
  HOSTCC  scripts/dtc/util.o
  HOSTCC  scripts/dtc/dtc-lexer.lex.o
  HOSTCC  scripts/dtc/dtc-parser.tab.o
  HOSTLD  scripts/dtc/dtc
/usr/bin/ld: scripts/dtc/dtc-parser.tab.o:(.bss+0x10): multiple definition of `yylloc'; scripts/dtc/dtc-lexer.lex.o:(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [scripts/Makefile.host:100: scripts/dtc/dtc] Error 1
make[1]: *** [scripts/Makefile.build:484: scripts/dtc] Error 2
make: *** [Makefile:582: scripts] Error 2Preformatted text

Make sure you set ARCH=arm64 when running make menuconfig and when compiling.

This might be what you are looking for, compiling a single kernel module.

I ended up spinning up a docker debian:stretch and it built fine (i was using debian:buster earlier)

Thanks for that single kernel module link ! Saved me a ton of time !

I had to ensure this was in my .config for the module to load too

CONFIG_LOCALVERSION="-55-rockchip-g6b7accbc999b"

Else you get the following in dmesg when you modprobe the new module

btusb: version magic '4.4.143 SMP preempt mod_unload aarch64' should be '4.4.143-55-rockchip-g6b7accbc999b SMP preempt mod_unload aarch64'

I documented my steps here - https://github.com/visago/docker-rockpis-kernel