uboot compile sources - karo-electronics/karo-tx-uboot GitHub Wiki

Building U-Boot for TX6

Important:

Examples in this chapter while being generalized because of the variety of TX COM available are actual examples specific to TX6 COM.

With the following commands U‑Boot can be build successfully with the same settings used for the respective release. For further information on building U‑Boot please also see:

[U‑Boot_src/]README
[U‑Boot_src/]doc/README.KARO
[U‑Boot_src/]doc/README.KARO-TX##

Note: Where TX## is the name of the TX COM, e.g.: TX6.

The sources can be obtained via either of the following:

Unpack and compile the source

mkdir u-boot
mkdir build_u‑boot_tx6
cd u-boot
tar -xjf u-boot-src.tar.bz2

The commands following allow the user to compile U‑Boot (incl. optional object directory):

export ARCH=arm
export CROSS_COMPILE=arm‑cortexa9‑linux‑gnueabi‑
make tx6?-????_config O=../build_u‑boot_tx6
make

Where:

tx6?-????_config

becomes a value of "U-Boot def-config name":

MACHINE TX Number U-Boot def-config name
tx6s-8034 TX6S-8034 tx6s-8034_defconfig
tx6s-8035 TX6S-8035 tx6s-8035_defconfig
tx6s-8134 TX6S-8134 tx6s-8135_defconfig
tx6s-8135 TX6S-8135 tx6s-8135_defconfig
tx6u-8030 TX6U-8030 tx6u-80x0_defconfig
TX6U-8010 legacy
tx6u-8033 TX6U-8033 tx6u-8033_defconfig
tx6u-8130 TX6U-8130 tx6u-81x0_defconfig
TX6U-8110 legacy
tx6u-8133 TX6U-8133 tx6u-8133_defconfig
tx6q-1030 TX6Q-1030 tx6q-10x0_defconfig
TX6Q-1010 legacy
tx6q-1036 TX6Q-1036 tx6q-1036_defconfig
tx6q-8037 TX6Q-8037 tx6qp-8037_defconfig
tx6q-1130 TX6Q-1130 tx6q-11x0_defconfig
TX6Q-1110 legacy
txul-5010 TXUL-5010 tx6ul-0010_defconfig
TXUL-0010 legacy
txul-5011 TXUL-5011 tx6ul-0011_defconfig
TXUL-0011 legacy

The commands above, invoked correctly, will then create the U‑Boot binaries in the given object directory, defined by the option "O=..." (see Ch. 6.5), an exemplary listing of the files created for the TX6 CoM include following:

u-boot
u-boot.bin (the actual U-Boot binary)
u-boot.lds
u-boot.map
u-boot.srec

Note: For the Ka‑Ro TX28 COM the 'u-boot.bin' image file is named 'u-boot.sb'

Note: The Ka‑Ro provided image files differ only by name, if compiled from unchanged source, i.e. u‑boot.bin => u‑boot-tx6q-1010.bin

The TX6 specific file 'u-boot.bin' can then be started via 'sbloader' or installed in flash for NAND-boot as described in Chapters 2.2 ff.

Building U-Boot

With the following commands U-Boot can be build successfully with the same settings used by Ka-Ro for the respective release.

For further information about building U-Boot please also see:

[U-Boot_src/]doc/README.KARO
[U-Boot_src/]doc/README.KARO-TX##

or direct links:

in the 'u-boot-src.tar.bz2' or the general README file in 'U-Boot' directory on the CD and above given Chapter 5 - Building U-Boot for TX6.

It is recommend to use a separate object directory (Ch. 6.5) when building, allowing for differentiation be it either for the purpose of testing or to compile for multiple target TX modules. This is done with the parameter for 'object directory' "O=/path/to/directory" to the 'make' command (Example: Ch. 6.3). The value can either be a relative (as in examples) or absolute path.

Requirements

To compile U-Boot the user will need to have a Linux capable of cross compiling. For this purpose Ka-Ro offers a Virtual Appliance, called ARMSDK VM. This Virtual Appliance offers the comprehensive capabilities to use the tool-chain supplied by Ka-Ro either in it's pre-compiled version or from the source. Allowing the user to compile all packages offered by Ka-Ro, including but not limited to U-Boot.

Although it is possible to use all Linux distributions, because of diversity and versatility of Linux distributions the offered ARMSDK VM Virtual Appliance is the only means supported by Ka-Ro for cross compilation. For further information concerning the ARMSDK VM please refer to the there enclosed documentation.

The ARMSDK VM Virtual Appliance is available on the Ka-Ro electronics' website public download area:

ARMSDK Download Site

Note: Because of legacy support there are multiple versions of the ARMSDK VM. Please only use the most current version for your TX COM.

http://www.karo-electronics.de/arm-sdk

Unpacking the source

After setting up and preparing the Virtual Appliance, the user has to extract the U‑Boot sources into the appropriate directories, as explained in detail by the package's respective README.

without object directory (default):

mkdir u‑boot
cd u‑boot
tar ‑xjf u‑boot‑src.tar.bz2

with object directory (Ch. 6.5) :

mkdir u‑boot
mkdir build_u‑boot_tx##
cd u‑boot
tar ‑xjf u‑boot‑src.tar.bz2

Get the source from a git repo

with object directory (Ch. 6.5) :

  • From github

      mkdir u‑boot
      mkdir build_u‑boot_tx##
      cd u‑boot
      git clone https://github.com/karo-electronics/karo-tx-uboot.git .
    
  • From Ka-ro electronics

      mkdir u‑boot
      mkdir build_u‑boot_tx##
      cd u‑boot
      git clone git://git.karo-electronics.de/karo-tx-uboot.git .
    

Compiling U-Boot

The commands following show generalized example to compile U‑Boot (incl. optional object directory):

export ARCH=arm
export CROSS_COMPILE=arm‑[cpu_family]‑linux‑gnueabi‑
make tx##_config [O=../build_u‑boot_tx##]
make [O=../build_u‑boot_tx##]

For the specific commands please refer to the U‑Boot 'README' as supplied in the source, specific to the various TX COM. The ARMSDK VM offers some simplifications, for more please consult the documentation there.

These commands above, invoked correctly, will create, either in the U‑Boot source directory or in the given object directory, if defined by the option "O=...", the relevant files; dependent on the TX COM set as target. A listing of the significant files created for a TX COM would look and include like following:

MLO
u‑boot.img
u‑boot.bin
[...]
u‑boot‑spl.bin (see "spl/" sub directory)

Note: The Ka‑Ro provided image files differ only by name, if compiled from unchanged source, i.e. u‑boot.bin => u‑boot_tx53.bin

The resulting files can be started or installed into NAND as described in Ch. 2 (Update and Recovery).


Cleaning the Sources

It might be necessary, in case of e.g. a mishap compile, to clean up the source. This can be done by one of the following commands:

make distclean [O=../build_u‑boot_tx##]

or:

make mrproper [O=../build_u‑boot_tx##]

Object Directory

An object directory, a.k.a. "build dir", allows the user to compile from one source multiple targets without contamination of the source itself. The object directory can be inside the source directory, but it's recommended to keep it outside as it keeps things easy and clean.

Further it can be specified either by parameter "O=..." or exporting the environment variable "BUILD_DIR" beforehand, similar to "ARCH". Note that the command line "O=..." setting overrides the "BUILD_DIR" environment variable.

Example:

  • via environment:

      export BUILD_DIR=../build_u‑boot_tx##
      export ARCH=arm
      export CROSS_COMPILE=arm‑[family]‑linux‑gnueabi‑
      make tx##_config
      make
    
  • via command option:

      export ARCH=arm
      export CROSS_COMPILE=arm‑*[family]*‑linux‑gnueabi‑
      make tx##_config O=../build_u‑boot_tx##
      make O=../build_u‑boot_tx##