# Linux Kernel Headers for different PYNQ Versions

**URL:** <https://discuss.pynq.io/t/linux-kernel-headers-for-different-pynq-versions/8523>\
**Category:** Support\
**Created:** [June 8, 2025, 8:55pm UTC](https://discuss.pynq.io/t/linux-kernel-headers-for-different-pynq-versions/8523 "2025-06-08T20:55:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![xilin](https://avatars.discourse-cdn.com/v4/letter/x/c89c15/32.png) [@xilin](https://discuss.pynq.io/u/xilin)\
**Post date:** [June 8, 2025, 8:55pm UTC](https://discuss.pynq.io/t/linux-kernel-headers-for-different-pynq-versions/8523/1 "2025-06-08T20:55:09Z")

</div>

Hello PYNQ-Community,

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:

> **[Linux\_Driver\_Tutorial/01\_hello at main · Johannes4Linux/Linux\_Driver\_Tutorial](https://github.com/Johannes4Linux/Linux_Driver_Tutorial/tree/main/01_hello)**
>
> My new Tutorial how to get started with Linux Kernel Modules and Linux Drivers. Started in 2024 - Johannes4Linux/Linux\_Driver\_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

> **[Releases · Xilinx/PYNQ](https://github.com/Xilinx/PYNQ/releases)**
>
> Python Productivity for ZYNQ. Contribute to Xilinx/PYNQ development by creating an account on GitHub.

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)?

Thank you for your time

---

<div class="post-metadata">

**Author:** ![xilin](https://avatars.discourse-cdn.com/v4/letter/x/c89c15/32.png) [@xilin](https://discuss.pynq.io/u/xilin)\
**Post date:** [June 15, 2025, 6:54pm UTC](https://discuss.pynq.io/t/linux-kernel-headers-for-different-pynq-versions/8523/2 "2025-06-15T18:54:21Z")

</div>

I figured that my question might be too generic to be easily answered.  
That is why I am now posting concrete steps to reproduce my problem:

As written before, I have a PYNQ-Z1 and used it with the official PYNQ SD Card Image [v3.0.1](https://bit.ly/pynqz1_v3_0_1) from [http://www.pynq.io/boards.html](http://www.pynq.io/boards.html).

After booting the PYNQ v3.0.1 release, I used ssh to connect to the board and executed the following commands:

```auto
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?

---

<div class="post-metadata">

**Author:** ![marioruiz](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/marioruiz/32/2177_2.png) [@marioruiz](https://discuss.pynq.io/u/marioruiz)\
**Post date:** [June 16, 2025, 9:17am UTC](https://discuss.pynq.io/t/linux-kernel-headers-for-different-pynq-versions/8523/3 "2025-06-16T09:17:41Z")

</div>

Hi @xilin,

You may find this useful:

> [@Building a Kernel Module for a ZYNQ PL peripheral](https://discuss.pynq.io/t/building-a-kernel-module-for-a-zynq-pl-peripheral/8545):
>
> Hi Folks- A few months ago I put together a webpage for developing a simple Linux Kernel Module for a Zynq PS/PL. In my case I used my TUL-2 and built a peripheral to mimic an RPN calculator. It’s too big to put here but feel free to look at my webpage: Comments Appreciated

> [@How to compile kernel module for Pynq v3](https://discuss.pynq.io/t/how-to-compile-kernel-module-for-pynq-v3/5870/2):
>
> Realize this question is 18 months old but I was having the same issue and didn’t see a reply. I tried to compile natively on the Xilinx board and got the asm/bitsperlong.h error. Also tried the sd card rebuild and chewed up my month’s ISP data allowance. Xilinx publishes the linux distros at [GitHub - Xilinx/linux-xlnx: The official Linux kernel from Xilinx](https://github.com/Xilinx/linux-xlnx/) After a few educated guesses I was able to find the version that matched uname -r from my Pynq Z2 (v3.0.1 in my case). Get the linux-xlnx…

Mario
