Amazing work, thanks for your time on this project for all open source developers.
I am trying to build in-tree kernel module (SPI LCD). I see there are Pynq bsp recipies, that contains patch example for kernel config file. I’ve spent many hours of trying to figure things out, maybe somebody could give some clues.
Question: What is recommended general way of building in-tree kernel module? Is it possible to build it without rebuilding whole system image?
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.
Get the linux-xlnx-xlnx_rebase_v5.15_LTS_2022.1_update2.tar.gz (or appropriate for your version) from the github repo and untar it into your desk/laptop. I am assuming you are cross-compiling.
cd into ./linux-xlnx-xlnx_rebase_v5.15_LTS_2022.1_update2
You can use make kernelversion to verify version base number.
The -xilinx-v2022.1 is a .config variable CONFIG_LOCAL_VERSION
Copy the .config from xilinx-board /lib/modules/uname -r/build to .config in this directory.
Then run:
ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- make modules
You may need to install the cross compiler and build essentials… If you hit an error from that Google is your friend.
Then to make your own module, update your module’s Makefile:
KERNEL_DIR=/path/to/linux-xlnx-xlnx_rebase_v5.15_LTS_2022.1_update2
all:
ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- make -C $(KERNEL_DIR) M=$(shell pwd) modules
Hope this helps. I can’t promise you can rebuild the whole kernel this way because there may be patches for the modules.
Hi, sorry for missing this question for such a long time. You have to make sure when you build any kernel module that you are using the same headers and #defines that the pynq build process sets up.