I want to try linux driver development on a PYNQ-Z1 and on precompiled PYNQ images.
If you need an example project, I have tried this simple tutorial:
However, it appears that the precompiled PYNQ images do not come with Linux Kernel headers or only with incomplete Kernel headers.
I have tried different PYNQ image versions (1.4, 2.0, 2.1 and the newest 3.0.1) from
but get always a different error (i.e. missing file or compile error), depending on the actual PYNQ image.
Thus, my question is: How do I get the kernel headers for different PYNQ releases (and this includes also older PYNQ images like PYNQ 1.4)?
After booting the PYNQ v3.0.1 release, I used ssh to connect to the board and executed the following commands:
git clone https://github.com/Johannes4Linux/Linux_Driver_Tutorial.git
cd 01_hello
make
The make command returns the error that asm/bitsperlong.h is missing:
make -C /lib/modules/5.15.19-xilinx-v2022.1/build M=/home/xilinx/Linux_Driver_Tutorial/01_hello modules
make[1]: Entering directory ‘/usr/lib/modules/5.15.19-xilinx-v2022.1/build’
warning: the compiler differs from the one used to build the kernel
The kernel was built by: arm-xilinx-linux-gnueabi-gcc (GCC) 11.2.0
You are using: gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0
CC [M] /home/xilinx/Linux_Driver_Tutorial/01_hello/hello.o
In file included from ./include/asm-generic/int-ll64.h:11,
from ./arch/arm/include/uapi/asm/types.h:5,
from ./include/uapi/linux/types.h:5,
from ./include/linux/types.h:6,
from ./include/linux/list.h:5,
from ./include/linux/module.h:12,
from /home/xilinx/Linux_Driver_Tutorial/01_hello/hello.c:1:
./include/uapi/asm-generic/int-ll64.h:12:10: fatal error: asm/bitsperlong.h: No such file or directory
12 | #include <asm/bitsperlong.h>
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [scripts/Makefile.build:277: /home/xilinx/Linux_Driver_Tutorial/01_hello/hello.o] Error 1
make[1]: *** [Makefile:1868: /home/xilinx/Linux_Driver_Tutorial/01_hello] Error 2
make[1]: Leaving directory ‘/usr/lib/modules/5.15.19-xilinx-v2022.1/build’
make: *** [Makefile:4: all] Error 2
Can someone tell me, where I can get the missing header files from?