How to do it...

We will use the Yocto Project's SDK already installed in your host:

  1. Prepare the environment as follows:
$ source /opt/poky/2.4/environment-setup-cortexa9hf-neon-poky-linux-gnueabi  
  1. Configure the kernel with the default machine configuration:
$ cd /opt/yocto/linux-wandboard
$ cp /opt/yocto/fsl-community-bsp/sources/meta-bsp-custom/recipes-kernel/linux/linux-wandboard-4.1-2.0.x/wandboard-custom/defconfig arch/arm/configs/wandboard_defconfig
$ make wandboard_defconfig  
  1. Compile the kernel image, modules, and the device tree file with the following:
$ make -jN  
You can optionally pass a -jN argument to make to build multithreaded.

This will build the kernel's zImage, modules, and device tree files.

Older Yocto environment setup scripts set the LD variable to use gcc, but the Linux kernel uses LD instead. If your compilation is failing, try the following before running make:

$ unset LDFLAGS

  1. To only build modules, you can run the following:
$ make modules
  1. And to only build device tree files, you can run the following:
$ make dtbs    
  1. Copy the kernel image and device tree file to the TFTP root to test using network booting:
$ cp arch/arm/boot/zImage arch/arm/boot/dts/imx6qp- 
wandboard-revd1.dtb /var/lib/tftpboot

Refer to the Configuring network booting for a development setup recipe in Chapter 1, The Build System for detailed network booting instructions.

Some other embedded Linux targets might need to compile a uImage if the U-Boot bootloader is not compiled with zImage booting support:

$ make LOADADDR=0x10800000 uImage  

A kernel uImage is a kernel image that contains a header that is used by U-Boot when launching the kernel image that includes the kernel load address. It is generated by the kernel make system by invoking the mkimage tool. A zImage is a compressed self-extracting image that does not contain the kernel load address.

The mkimage tool is part of the Yocto toolchain when built with the FSL community BSP. We will see how to build and install an SDK in the Preparing and using an SDK recipe in Chapter 4, Application Development.
If it is not included in your toolchain, you can install the tool in your host using the following command:
$ sudo apt-get install u-boot-tools

LOADADDR is the U-Boot entry point, the address where U-Boot will place the kernel in memory. It is defined in the meta-freescale/conf/machine/include/imx-base.inc file:

UBOOT_ENTRYPOINT_mx6  = "0x10008000"  
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset