So, download that via GitHub or git clone on the build machine.
Get the Kernel Configuration
Now we compile the kernel with a configuration that is close to what was used on our target board. To do that, we need to extract configuration from the target board by reading the config.gz.
On the target board, do the following command:
We will use the .config file to configure and compile the kernel source that we have downloaded before.
Go to the following folder and get the Module.symvers file for later use when compiling the kernel.
So, we have two files .config and Module.symvres that are required when we compile the kernel.
Compile the Kernel
On your build machine, extract the kernel source file that we have downloaded, linux-xlnx-xlnx_rebase_v5.15_LTS_2022.1_update.zip.
Copy the following files to the main location of extracted folder:
.config
Module.symvers
We first need to set the ARCH and CROSS_COMPILE variables.
For 32-bit system:
For 64-bit system:
Run this command to read the existing .config file that was used for an old kernel. Then, it sets every option (that are not found in the file) to their default value without asking interactively.
Run this command to build the kernel for 32-bit system:
Or for 64-bit system:
You will find the kernel image file in this location for 32-bit system:
Or for 64-bit system:
Use zImage for 32-bit and Image for 64-bit.
Convert Image File
PYNQ uses an image.ub file, so we need to convert the image file and devicetree to image.ub.
Install the required tools:
Dump Image
Copy the original image.ub file from the target board to build the machine.
Use this command to list the content of image.ub:
The contents are the kernel (parition 0) and devicetree (parition 1).
To dump the kernel we can use the following command:
To dump the devicetree we can use the following command:
Modify Devicetree
To convert the devicetree from .dtb to .dts, we can use the following command:
Open the devicetree source (.dts) using a text editor, modify the setting that you need, and compile it back to binary (.dtb).
To convert the devicetree from .dts back to .dtb, we can use the following command: