Building Linux Kernel

Document created by rogeriopimentel Employee on May 14, 2014Last modified by rogeriopimentel Employee on Oct 31, 2016
Version 27Show Document
  • View in full screen mode

Building using Yocto


1 - Baking (building) the kernel


When an image is built using Yocto (for more details about how to build an image, check the Yocto training home: the kernel is automatically built and the kernel image is located at /fsl-community-bsp/build/tmp/deploy/images/<your_target>/uImage


If you want to build only the kernel, the following command can be used:

$ bitbake linux-imx




2 - Configuring the kernel


To call the kernel menuconfig, run the command:

$ bitbake -c menuconfig linux-imx



A new terminal window will open with the kernel menuconfig. Make changes if needed, exit the configmenu and copy the .config generated file to defconfig as following:

$ cp tmp/work/imx6qsabresd-poky-linux-gnueabi/linux-imx/3.0.35-r33.10/git/.config




Note that the kernel version, in this case "3.0.35-r33.10" may change.



3 - Cleaning and building again with the new configuration

With the new defconfig saved on the correct folder (step 2), it's time to clear all previous kernel and build it again:

$ bitbake -c cleansstate linux-imx

$ bitbake <your_image>       or         $ bitbake linux-imx



The uImage will be under tmp/deploy/image



Building without a BSP



1- Downloading the kernel source code


Choose what kernel you will build. Usually, the Freescale kernel or mainline ( kernel:


For Freescale kernel (more details on ) use:

$ git clone git://



For Mainline kernel (more details on ) use:

$ git clone git://




2 - Choose which branch will you use


Once downloaded, check the available branches by using:

$ git branch -a

  remotes/origin/HEAD -> origin/master


Make a local branch, based on a branch you choose from the list:

$ git checkout -b local_branch origin/imx_3.10.17_1.0.0_ga


*NOTES:      On command above my local branch name is "local_branch". You can choose this name as you prefer

                    The branch I chose was origin/imx_3.10.17_1.0.0_ga. You can choose another one, always starting by origin/.......


3 - Setting the environment variables


If you're using the Yocto SDK (Check the Yocto training at Freescale community: ), just execute the script to export the needed environment variables, e.g.:

$ source /opt/poky/1.6+snapshot/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi


If you're using another toolchain, the common environment variables to set are the following:

$ export PATH=$PATH:/opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/
$ export TOOLCHAIN=/opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/
$ export CROSS_COMPILE=arm-none-linux-gnueabi-

$ export ARCH=arm


IMPORTANT: Change the variables above according your installed toolchain.



4 - Configuring the kernel


If you're building for i.MX6 and i.MX5, configure the kernel options based on file imx_v6_v7_defconfig:

$ make imx_v6_v7_defconfig


If some change on configure is required, you can use:

$ make menuconfig




5 - Building the kernel


To build the kernel, use the make command and the load address of processor being used:

$ make uImage LOADADDR=0x10008000


The load address is the start address of DDR (Found on memory map chapter of reference manual) plus 0x8000 offset.


For i.MX53, LOADADDR = 0x70008000

For i.MX6Quad and Dual, LOADADDR = 0x10008000



6 - Building the modules


After step 5, only the kernel (uImage file) was generated. The kernel modules must be built and installed in a known path. First, build the modules:

$ make modules


And install them:

$ make modules_install INSTALL_MOD_PATH=/path_where_you_want_to_install

11 people found this helpful