简体   繁体   中英

Meaning of some commands when cross-compiling kernel for Raspberry Pi

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?

-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.

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 ie 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM