Currently working on Rpi-zero-w.
I tried to compile driver code, and I'm missing some files:
#include <linux/clk.h>
#include <linux/completion.h>
#include <linux/err.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
All those are missing from /usr/include/linux
I googled it and I'm lost, do I need to recompile the kernel headers to get them ? if yes here is the error when I try to recompile kernel headers:
how to reproduce, create test.c containing previous headers and use following makefile:
# obj-m is a list of what kernel modules to build. The .o and other
# objects will be automatically built from the corresponding .c file -
# no need to list the source files explicitly.
obj-m := test.o
# KDIR is the location of the kernel source. The current standard is
# to link to the associated source tree from the directory containing
# the compiled modules.
KDIR := /lib/modules/$(shell uname -r)/build
# PWD is the current working directory and the location of our module
# source files.
PWD := $(shell pwd)
# default is the default make target. The rule here says to run make
# with a working directory of the directory containing the kernel
# source and compile only the modules in the PWD (local) directory.
default:
$(MAKE) -C $(KDIR) M=$(PWD) modules
raspberrypi-kernel-headers
but I'm not sure?