0

I am trying to cross compile a raspberry Pi kernel with RT Preempt patch. I am following this tutorial.

I have downloaded the latest kernel sources rpi-4.9.13 and the corresponding rt patch patch-4.9.13-rt11.patch.gz

After doing the menuconfig step, when I do

sudo make zImage 

I recieved the error:

No rule to make target

I read somewhere about bzImage so I tried:

sudo make bzImage

It then starts compilation but after some time it gives the following error:

drivers/of/configfs.c: In function ‘create_overlay’:
drivers/of/configfs.c:48:2: error: implicit declaration of function
‘of_fdt_unflatten_tree’ [-Werror=implicit-function-declaration]  
of_fdt_unflatten_tree(blob, NULL, &overlay->overlay);   ^ cc1: some
warnings being treated as errors scripts/Makefile.build:293: recipe
for target 'drivers/of/configfs.o' failed make[2]: ***
[drivers/of/configfs.o] Error 1 scripts/Makefile.build:544: recipe for
target 'drivers/of' failed make[1]: *** [drivers/of] Error 2
Makefile:988: recipe for target 'drivers' failed make: *** [drivers]
Error 2

I don't know what I am doing wrong. I have been stuck at this for some time now and would really appreciate any help.

1

If you are compiling the kernel code in PC you should use a cross compiler: raspberrypi/tools. So, after install and configure the cross compiler you can build kernel with these commands:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage dtbs -j4
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules -j4

You can configure the cross compiler adding it to your user PATH inside .bashrc file:

export PATH=$PATH:/home/user/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin

After exit and save the modifications in .bashrc, type: 'source .bashrc' to update PATH. A nice tutorial I made: Compiling kernel to Raspberry. This tutorial was made to Raspberry B1, so you have to change defconfig as the version of Raspberry. Use bcmrpi_defconfig for PI 1, and bcm2709_defconfig for PI 2 and PI 3.

  • This is not exactly an answer to the question, which is about compiling the kernel on the Pi itself, but it is a nice alternative, and I'll upvote it anyway. – Bex Jul 9 '17 at 8:45
  • @Bex. I didn't see where he said is compiling on the PI itself. :D Anyway, compiling on the PI would not give this error. – ViniCoder Jul 9 '17 at 12:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.