Kernel Build Instructions
Note: For a more complete example showing how to build a complete toolchain, root file system, and kernel, see Buildroot_Build_Instructions.
Building a kernel for Xtensa is not different from any other architecture. It is a two-step process that requires to configure the kernel first before it can be built. The configuration step is initiated with make config|menuconfig|xconfig
and allows to choose from various device drivers, file systems, and network and other kernel options. This results in the .config
file describing the selected options. A simple make
will then build the kernel image.
In case of cross-compilation, the Linux make
scripts require two additional arguments:
ARCH=xtensa
CROSS_COMPILE=<prefix>
The ARCH
argument instructs the make
scripts to compile for a different architecture than the host system. CROSS_COMPILE
defines the prefix for the compilation tools, for example xtensa-unknown-linux-gnu-
.
The kernel makefile scripts allow additional optional arguments. This is just a short list of the more interesting ones:
O=<build directory>
- Build the kernel in the <build directory> instead of the current kernel source directory.V=1
- Increase verbosity level to show the commands executed by themake
scripts.
Configure the Kernel
The first step requires to configure the kernel for the particular architecture and platform. Run make ARCH=xtensa CROSS_COMPILE=<prefix>
with one of the following arguments. This will create the configuration file .config
that is later used during the build process.
config
- Queries all available options (nobody should really use this way to configure the kernel, though).menuconfig
- Presents the kernel options in an ASCII/vt100 compatible menu structure.xconfig
- Similar tomenuconfig
, but uses tcl/tk to display the menu structure.
Alternatively, you can choose to start with the default configuration for the targeted platform. The configuration files are located in arch/xtensa/kernel/configs
. The name for the configuration file is usually the platform name followed by _defconfig, for example iss_defconfig. Simply issue make
with the following options to create the .config
file from the default configuration. You can then make modifications to select additional drivers or modify other options with one of the commands above.
make ARCH=xtensa KBUILD_DEFCONFIG=name_defconfig defconfig
Building the Kernel
After configuring the kernel, you can build the kernel image running make
. The final kernel image is generated in arch/xtensa/boot
. Depending on the platform and configuration options, one or more of the following images has been created:
Image.elf
- The build scripts always create this elf image. It contains a reset vector and doesn't require a boot loader.
Image.RedBoot
- This binary image is created for targets that support RedBoot as the boot loader.