Difference between revisions of "CM-FX6: U-Boot: Building Images"

From Compulab Mediawiki
Jump to: navigation, search
(Snapshot download)
 
Line 22: Line 22:
  
 
==== Snapshot download ====
 
==== Snapshot download ====
* Download [http://git.denx.de/?p=u-boot.git;a=snapshot;h=c43fd23cf619856b0763a64a6a3bcf3663058c49 v2014.10] snapshot with your web browser.
+
* Download [http://git.denx.de/?p=u-boot.git;a=snapshot;h=33711bdd4a4dce942fb5ae85a68899a8357bdd94 v2015.07] snapshot with your web browser.
* Extract the downloaded archive {{filename|u-boot-c43fd23cf619856b0763a64a6a3bcf3663058c49.tar.gz}}
+
* Extract the downloaded archive {{filename|u-boot-33711bd.tar.gz}}
 
<pre>
 
<pre>
 
cd /home/development/cm-fx6/u-boot
 
cd /home/development/cm-fx6/u-boot
tar xvf /path/to/downloaded/u-boot-c43fd23cf619856b0763a64a6a3bcf3663058c49.tar.bz2
+
tar xvf /path/to/downloaded/u-boot-33711bd.tar.gz
 
mv u-boot u-boot-cm-fx6
 
mv u-boot u-boot-cm-fx6
 
</pre>
 
</pre>
Line 33: Line 33:
 
<pre>
 
<pre>
 
cd /home/development/cm-fx6/u-boot/u-boot-cm-fx6
 
cd /home/development/cm-fx6/u-boot/u-boot-cm-fx6
patch -p1 < /path/to/cm-fx6-u-boot-package/u-boot/u-boot-v2014.10-cm-fx6-2.2.patch
+
patch -p1 < /path/to/cm-fx6-u-boot-package/u-boot/u-boot-v2015.07-cm-fx6-3.patch
 
</pre>
 
</pre>
  
Line 44: Line 44:
 
cd /home/development/cm-fx6/u-boot/u-boot-cm-fx6
 
cd /home/development/cm-fx6/u-boot/u-boot-cm-fx6
 
</pre>
 
</pre>
* Create a branch for CM-FX6 development. The CM-FX6 patches are generated vs. v2014.10 tag (c43fd23cf619856b0763a64a6a3bcf3663058c49 commit) in the U-Boot tree. It is recommended to use exactly the same baseline to avoid merge conflicts.
+
* Create a branch for CM-FX6 development. The CM-FX6 patches are generated vs. v2015.07 tag (33711bdd4a4dce942fb5ae85a68899a8357bdd94 commit) in the U-Boot tree. It is recommended to use exactly the same baseline to avoid merge conflicts.
 
<pre>
 
<pre>
git checkout -b cm-fx6-dev v2014.10
+
git checkout -b cm-fx6-dev v2015.07
 
</pre>
 
</pre>
 
* Apply the CM-FX6 patch
 
* Apply the CM-FX6 patch
 
<pre>
 
<pre>
git apply /path/to/cm-fx6-u-boot-package/u-boot/u-boot-v2014.10-cm-fx6-2.2.patch
+
git apply /path/to/cm-fx6-u-boot-package/u-boot/u-boot-v2015.07-cm-fx6-3.patch
 
</pre>
 
</pre>
  
Line 63: Line 63:
 
* Invoke mkimage on the SPL binary to attach the IVT header required by the i.MX6 boot ROM code to the SPL binary. This generates a new image file {{filename|spl.img}}.
 
* Invoke mkimage on the SPL binary to attach the IVT header required by the i.MX6 boot ROM code to the SPL binary. This generates a new image file {{filename|spl.img}}.
 
<pre>
 
<pre>
./tools/mkimage -n board/compulab/cm_fx6/imximage.cfg.cfgtmp -T imximage -e 0x00908000 -d spl/u-boot-spl.bin spl.img
+
./tools/mkimage -n arch/arm/imx-common/spl_sd.cfg.cfgtmp -T imximage -e 0x00908000 -d spl/u-boot-spl.bin spl.img
 
</pre>
 
</pre>
 
* Create the combined image by creating a 0xFF initialized 512KB {{filename|cm-fx6-firmware}} file, and writing the {{filename|spl.img}} and {{filename|u-boot.img}} data to the appropriate offsets within the {{filename|firmware}} file.
 
* Create the combined image by creating a 0xFF initialized 512KB {{filename|cm-fx6-firmware}} file, and writing the {{filename|spl.img}} and {{filename|u-boot.img}} data to the appropriate offsets within the {{filename|firmware}} file.

Latest revision as of 15:26, 18 October 2015

Overview

CM-FX6 firmware consists of two components: Secondary Program Loader (SPL) and U-Boot. Both components are based on U-Boot source code. SPL is the bootstrap utility invoked by the CPU internal boot ROM code of the i.MX6 SoC. SPL performs minimal hardware initialization and loads U-Boot from the same boot device. U-Boot initializes hardware modules necessary for system boot and loads the operating system.

Building Firmware images for CM-FX6

Cross-Compiler

There are several options for cross-compilation toolchain setup. You can either compile your cross-compiler or use an already built cross-compiler. The cross-compiler should support the ARM embedded-application binary interface (EABI)

  • Pre-built toolchain (recommended):
  • Tools for creating cross-compilers:
    • Crosstool-ng: Builds a cross-compiler from source. Non-distribution specific.
    • Crossdev: Gentoo's cross-compiler builder. Needs Gentoo.

Getting U-Boot sources

There are two ways to get U-Boot sources that can be used as a baseline for CM-FX6 SPL and U-Boot. You can create a copy of "Das U-Boot" source tree or download a snapshot and extract it. We assume that you have created /home/development/cm-fx6/u-boot directory for CM-FX6 u-boot development.

Snapshot download

  • Download v2015.07 snapshot with your web browser.
  • Extract the downloaded archive u-boot-33711bd.tar.gz
cd /home/development/cm-fx6/u-boot
tar xvf /path/to/downloaded/u-boot-33711bd.tar.gz
mv u-boot u-boot-cm-fx6
This will create /home/development/cm-fx6/u-boot/u-boot-cm-fx6 directory containing U-Boot source code tree.
  • Apply the CM-FX6 patch
cd /home/development/cm-fx6/u-boot/u-boot-cm-fx6
patch -p1 < /path/to/cm-fx6-u-boot-package/u-boot/u-boot-v2015.07-cm-fx6-3.patch

Git clone

  • Install git version control system.
  • Create a clone of U-Boot tree
cd /home/development/cm-fx6/u-boot
git clone git://git.denx.de/u-boot.git u-boot-cm-fx6
cd /home/development/cm-fx6/u-boot/u-boot-cm-fx6
  • Create a branch for CM-FX6 development. The CM-FX6 patches are generated vs. v2015.07 tag (33711bdd4a4dce942fb5ae85a68899a8357bdd94 commit) in the U-Boot tree. It is recommended to use exactly the same baseline to avoid merge conflicts.
git checkout -b cm-fx6-dev v2015.07
  • Apply the CM-FX6 patch
git apply /path/to/cm-fx6-u-boot-package/u-boot/u-boot-v2015.07-cm-fx6-3.patch

Building the firmware images

  • First, compile both SPL and U-Boot. The following commands create the spl/u-boot-spl.bin and u-boot.img binaries (along with other image types):
export ARCH=arm
export CROSS_COMPILE=arm-none-linux-eabi-
make mrproper
make cm_fx6_config && make
  • Invoke mkimage on the SPL binary to attach the IVT header required by the i.MX6 boot ROM code to the SPL binary. This generates a new image file spl.img.
./tools/mkimage -n arch/arm/imx-common/spl_sd.cfg.cfgtmp -T imximage -e 0x00908000 -d spl/u-boot-spl.bin spl.img
  • Create the combined image by creating a 0xFF initialized 512KB cm-fx6-firmware file, and writing the spl.img and u-boot.img data to the appropriate offsets within the firmware file.
dd if=/dev/zero count=500 bs=1K | tr '\000' '\377' > cm-fx6-firmware
dd if=spl.img of=cm-fx6-firmware bs=1K seek=1 conv=notrunc && dd if=u-boot.img of=cm-fx6-firmware bs=1K seek=64 conv=notrunc
  • You can now install the cm-fx6-firmware file into an SD card or CM-FX6 SPI flash.

See also