export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabi-
ARCH defines the architecture we're building for.
CROSS_COMPILE defines the prefix of the gnu tools to use. Full path must be set if the ARM cross-compiling tools' path is not set in environment.
Multi-threaded build
If you have a multi-core CPU, you may want to enjoy a quicker build. To do so, define the number of threads used to build your linux
alias make='make -j2'
Usually, the specified number is obtained by multiplying the number of your cpu's cores by 2.
Configuration
The configuration of the kernel is saved in a file named .config
The most common way of configuring your kernel for an embedded platform is to use the default configuration for your board / CPU. These files, if they exist, are stored in /arch/<arch>/configs/. To check their availability, run :
make help
An exemple of default configuration usage :
make myboard_defconfigThis operation overwrites the .config file.
If you don't have a default configuration file, you will either find a configuration file that fits your needs on the web or customize the kernel on your own (experts only). To do so, run :
make menuconfig
Build
The final step :
make
Go grab a coffee, it may take a while...
Once built, the kernel is image is in /arch/<arch>/boot/. Several output format exists (bzImage, uImage, zImage,...) so be careful when copying the kernel to your target storage. The wrong image format will simply not boot...
Clean
Clean-up generated files
make clean
Clean-up generated files + .config file deletion
make mrproper
To get the number of cpu cores of your system, type this command:
ReplyDeletecat /proc/cpuinfo | grep cores
Get your Rasperry Pi configuration file bcmrpi_defconfig for 3.8 kernel at:
ReplyDeletehttps://github.com/raspberrypi/linux/tree/rpi-3.8.y/arch/arm/configs