2
votes

This Raspberry Pi's official document details the procedures of how to cross-compile new Linux Kernel for Raspberry Pi. Some commands in this document which are shown below, however, I can hardly understand.

For Pi 2:

$ cd linux
$ KERNEL=kernel7
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig

  1. What dose KERNEL env stand for?
  2. Why we need to set KERNEL to kernel7?
  3. Also, what doese make bcm2709_defconfig do?
2

2 Answers

1
votes

KERNEL - It is the environment variable. We use that environment variable later when we copy the new compiled image to boot folder.

Usage: sudo scripts/mkknlimg arch/arm/boot/zImage mnt/fat32/$KERNEL.img

You can change environment variable to any desired but then you have to add a line in config.txt in boot folder i.e. kernel=changed_name.img

KERNEL=kernel7 - Open the boot folder. You will see two .img. One is kernel.img and other would be kernel7.img . By default Raspi 2/3 uses kernel7.img when it boots up. And Raspi 1 uses kernel.img by default. As you are using Raspi 2/3 you are setting that environment variable to kernel7.

bcm2709_defconfig - This the configuration file made for Raspberry Pi 2 architecture. For example, Raspberry Pi 1 compilation uses bcmrpi_defconfig.

0
votes

-bcm2709_defconfig choose the config file to used. They are stored in paths like this: arch/arm/configs/ For the KERNEL env, I have never seen this before... It is not the mainline kernel, may be a special RPi's feature.