Difference between revisions of "CM-FX6: U-Boot: Building Images"
(→Building the firmware images) |
|||
Line 22: | Line 22: | ||
==== Snapshot download ==== | ==== Snapshot download ==== | ||
− | * Download [http://git.denx.de/?p=u-boot.git;a=snapshot;h= | + | * Download [http://git.denx.de/?p=u-boot.git;a=snapshot;h=c43fd23cf619856b0763a64a6a3bcf3663058c49 v2014.10] snapshot with your web browser. |
− | * Extract the downloaded archive {{filename|u-boot- | + | * Extract the downloaded archive {{filename|u-boot-c43fd23cf619856b0763a64a6a3bcf3663058c49.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- | + | tar xvf /path/to/downloaded/u-boot-c43fd23cf619856b0763a64a6a3bcf3663058c49.tar.bz2 |
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. | + | patch -p1 < /path/to/cm-fx6-u-boot-package/u-boot/u-boot-v2014.10-cm-fx6-2.1.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. | + | * 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. |
<pre> | <pre> | ||
− | git checkout -b cm-fx6-dev v2014. | + | git checkout -b cm-fx6-dev v2014.10 |
</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. | + | git apply /path/to/cm-fx6-u-boot-package/u-boot/u-boot-v2014.10-cm-fx6-2.1.patch |
</pre> | </pre> | ||
Line 61: | Line 61: | ||
make cm_fx6_config && make | make cm_fx6_config && make | ||
</pre> | </pre> | ||
− | * 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}}. | + | * 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 -T imximage -e 0x00908000 -d spl/u-boot-spl.bin spl | + | ./tools/mkimage -n board/compulab/cm_fx6/imximage.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}} 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. |
<pre> | <pre> | ||
dd if=/dev/zero count=500 bs=1K | tr '\000' '\377' > cm-fx6-firmware | dd if=/dev/zero count=500 bs=1K | tr '\000' '\377' > cm-fx6-firmware | ||
− | dd if=spl 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 | + | 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 |
</pre> | </pre> | ||
* You can now install the {{filename|cm-fx6-firmware}} file into an SD card or CM-FX6 SPI flash. | * You can now install the {{filename|cm-fx6-firmware}} file into an SD card or CM-FX6 SPI flash. |
Revision as of 16:18, 20 January 2015
Contents
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 v2014.10 snapshot with your web browser.
- Extract the downloaded archive u-boot-c43fd23cf619856b0763a64a6a3bcf3663058c49.tar.gz
cd /home/development/cm-fx6/u-boot tar xvf /path/to/downloaded/u-boot-c43fd23cf619856b0763a64a6a3bcf3663058c49.tar.bz2 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-v2014.10-cm-fx6-2.1.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. v2014.10 tag (c43fd23cf619856b0763a64a6a3bcf3663058c49 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 v2014.10
- Apply the CM-FX6 patch
git apply /path/to/cm-fx6-u-boot-package/u-boot/u-boot-v2014.10-cm-fx6-2.1.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 board/compulab/cm_fx6/imximage.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.