Building kernel (kernel.tgz)


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:

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: