Building kernel (kernel.tgz)

Hello,

After decompressing kernel.tgz into /usr/src/kernel, I am having trouble to make it. I followed some suggestions online, but I’m getting errors such as:

root@pynq:/usr/src/kernel# make
CHK include/generated/compile.h
make[1]: *** No rule to make target ‘init/main.o’, needed by ‘init/built-in.a’. Stop.
Makefile:1052: recipe for target ‘init’ failed
make: *** [init] Error 2

and others. Do I have to fix these errors one-by-one manually or am I missing any steps that is supposed to be executed before make?

Some examples on how we build kernel modules on the board:
https://github.com/Xilinx/DPU-PYNQ/blob/master/upgrade/xrt/install.sh#L14

I followed the steps and got this error:

BUILD: Doing ‘make -j2’ parallel build
Makefile.perf:6: …/scripts/utilities.mak: No such file or directory
make[1]: *** No rule to make target ‘…/scripts/utilities.mak’. Stop.
Makefile:69: recipe for target ‘all’ failed
make: *** [all] Error 2

I was trying to build perf for PYNQ. Here is how I got it to work:

  • apt-get install linux-source
  • cd /usr/src
  • tar xvfj linux-source-4.15.0.tar.bz2
  • cd linux-source-4.15.0/tools/perf
  • make
  • cp ./perf /usr/bin/perf

Image v2.5 should be kernel 4.19.0, where you used 4.15.0. So I am not sure if the binary works well. Your flow should be good, but you need to download 4.19.0 tarball I guess. I think I did install perf in the past similar as you did.

Thank you for mentioning that. The 4.15.0 version worked fine, but to be safe, I compiled the correct version. Here are the instructions for 4.19.0 version:

Where can I find kernel.tgz for pynq 2.7, I do not find it back in the filesystem/image of a pynq 2.7 build with a prebuilt Ubuntu image for aarch64 (and using a make, not the shorter scripted approach with a bsp only). That being said the build completed with an error, but seemed to contain all things needed to run. I’d like to build a kernel module.

Using a plain vanilla xilinx petalinux kernel does not succeed due to a different kernel version number:
version magic ‘5.4.0 SMP mod_unload modversions aarch64’ should be ‘5.4.0-xilinx-v2020.2 SMP mod_unload aarch64’ (output of dmesg)
With ‘5.4.0 SMP mod_unload modversions aarch64’ the version of the module, compiled with petalinux kernel 2020.2 and ‘5.4.0-xilinx-v2020.2 SMP mod_unload aarch64’ the expected version for pynq2.7

Is kernel.tgz for pynq 2.7 available somewhere for download? Or is there another way to solve this module version conflict.