Difference between revisions of "CM-FX6: U-Boot: Building Images"
(→See also) |
(→Git clone) |
||
Line 8: | Line 8: | ||
== Building Firmware images for CM-FX6 == | == Building Firmware images for CM-FX6 == | ||
=== Cross-Compiler === | === 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 ( | + | 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 ([http://en.wikipedia.org/wiki/Application_binary_interface#EABI EABI]) | ||
* Pre-built toolchain (recommended): | * Pre-built toolchain (recommended): | ||
** [http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/ Sourcery CodeBench Lite] | ** [http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/ Sourcery CodeBench Lite] | ||
Line 32: | 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/u-boot/u-boot-v2014.04-cm-fx6-1.patch | + | patch -p1 < /path/to/cm-fx6-u-boot-package/u-boot/u-boot-v2014.04-cm-fx6-1.2.patch |
</pre> | </pre> | ||
Line 41: | Line 42: | ||
cd /home/development/cm-fx6/u-boot | cd /home/development/cm-fx6/u-boot | ||
git clone git://git.denx.de/u-boot.git u-boot-cm-fx6 | git clone git://git.denx.de/u-boot.git 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.04 tag (dda0dbfc69f3d560c87f5be85f127ed862ea6721 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. v2014.04 tag (dda0dbfc69f3d560c87f5be85f127ed862ea6721 commit) in the U-Boot tree. It is recommended to use exactly the same baseline to avoid merge conflicts. | ||
Line 48: | Line 50: | ||
* 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.04-cm-fx6-1.2.patch | |
− | git apply /path/to/cm-fx6-u-boot/u-boot/u-boot-v2014.04-cm-fx6-1.patch | ||
</pre> | </pre> | ||
Revision as of 11:18, 7 September 2014
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.04 snapshot with your web browser.
- Extract the downloaded archive u-boot-dda0dbfc69f3d560c87f5be85f127ed862ea6721.tar.bz2
cd /home/development/cm-fx6/u-boot tar xvf /path/to/downloaded/u-boot-dda0dbfc69f3d560c87f5be85f127ed862ea6721.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.04-cm-fx6-1.2.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.04 tag (dda0dbfc69f3d560c87f5be85f127ed862ea6721 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.04
- Apply the CM-FX6 patch
git apply /path/to/cm-fx6-u-boot-package/u-boot/u-boot-v2014.04-cm-fx6-1.2.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.
./tools/mkimage -n board/compulab/cm_fx6/imximage.cfg -T imximage -e 0x00908000 -d spl/u-boot-spl.bin spl
- Create the combined image by creating a 0xFF initialized 512KB cm-fx6-firmware file, and writing the spl 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 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.