Looking for kernel headers

(Heinz-Juergen Oertel) #1

I like to compile the CANbus driver can4linux for the M2 Berry. Installed is kernel 3.10.107 $ hostnamectl Static hostname: bpi-berry Icon name: computer Machine ID: 1fcd796fe1b54aac8fc08afb8692d294 Boot ID: 1102721d51af4f1b974339ba8dd12f0c Operating System: Raspbian GNU/Linux 9 (stretch) Kernel: Linux 3.10.107-BPI-M2U-Kernel Architecture: arm

How do i get the kernel headers for this version in order to compile a loadable kernel module. Searched for hours this and other forums. Hope someone can help. Also another kernel image is possible, as long I can develop a kernel module. Thanks

(Igor) #2

Use Armbian where you can install headers (from armbian-config menu)

(Heinz-Juergen Oertel) #3

Thanks Igor just try to compile the kernel using BPI-M2U-bsp (it still compiles, let’s see if will run as well)

With armbian, you mean the images at https://www.armbian.com/bananapi-m2u/ which should I use: Stretch or Bionic?

(Heinz-Juergen Oertel) #4

Thanks Igor installed Armbian, looks great. On Monday I can test kernel module compilation.

(Igor) #5

OK. There is one small issue which I am not sure its fixed yet: https://forum.armbian.com/topic/9602-linux-headers-41920-cubox-make-scripts-fails/

(Heinz-Juergen Oertel) #6

The problem is still there

root@bpi-berry:/usr/src/linux-headers-4.20.7-sunxi# make scripts scripts/kconfig/conf --syncconfig Kconfig net/Kconfig:89: can't open file "net/wireguard/Kconfig" scripts/kconfig/Makefile:69: recipe for target 'syncconfig' failed


#source "net/wirguard/Kconfig"

works than and I can compile the module.

(Heinz-Juergen Oertel) #7

Still some problems

#include <mach/includes.h>

is missing. I need to configure GPIO pins to be used as alternative pin, in my case CAN-TX and CAN-RX. I found some drivers using calls like sw_gpio_setcfg(GPIOA(16), 3); But I#m not able to find headers containing the prototype of sw_gpio_setcfg();

(Igor) #8

We don’t officially support any R40 board since its a rear chip and you will need to explore on your own from here. CAN is known to work on A10, A20, H3, H5 … but here I don’t know how far things are. forum.armbian.com will be a good source of info, or https://www.google.com/search?q=allwinner+can+bus

(Heinz-Juergen Oertel) #9

OK , for now i will use writel() to configure the appropriate port pins. By the way, the V40 has a CANbus module, the R40 does not.