How To Build U-Boot in Factory with External Sources


This HOWTO covers the process for configuring Factory to build U-Boot from external source files.

Typically U-Boot sources are fetched from the Timesys Source Repository, configured, and built during the Factory BSP/SDK process automatically. In certain cases, it may be necessary to use existing (possibly customized) sources. Factory provides a method for user-management of the U-Boot sources in the form of Building an External U-Boot. This allows for user-supplied (patched) U-Boot source code to be utilized during the BSP/SDK build process. The steps to configure Desktop Factory to build External U-Boot are covered in this HOWTO.

  1. Obtain and Patch U-Boot Source Code
  2. Configure Factory for External U-Boot
  3. Build External U-Boot

Obtain and Patch U-Boot Source Code

In order to use the External U-Boot functionality with Desktop Factory, the U-Boot patched source code must be present on the development machine in an accessible location (one not requiring elevated privileges). The source files are commonly obtained from the Semi or board manufacturer, and then patched as necessary from Semi/board manufacturer or community provided patchwork. These sources are often further modified to suit custom board/project needs by the end user. For purposes of this HOWTO, it is assumed the U-Boot source code is already obtained and patched (some initial modifications may already be completed as well). In this example, the patched U-Boot Source code is located in the user-created src/local/ directory within the top-level Factory directory.

factory$ ls src/local/u-boot-2014.07/
api   board       common     CREDITS  doc      dts       fs       Kbuild  Licenses  makeem    mkconfig  post    scripts          test
arch  boards.cfg  disk     drivers  examples  include  lib     MAKEALL   Makefile  net       README  snapshot.commit  tools

Now that the U-Boot source code is patched and ready to be built, Factory needs to know where to find the external U-Boot sources.

Configure Factory for External U-Boot

Desktop Factory can be set to build External U-Boot with the setting of a few tokens in the workorder. This can be done through the menuconfig interface as follows:

  1. Run make menuconfig from the top-level Factory directory.
  2. Navigate to Target Software > Bootloader > u-boot > Build an internal u-boot or use an external u-boot? Set this to "external".
  3. Navigate to Target Software > Bootloader > u-boot > u-boot Source Path. Set this path to the top-level of the external U-Boot source tree — in this example $(BASE_DIR)/src/local/u-boot-2014.07.
  4. Exit menuconfig and save the workorder.

Note: If a custom U-Boot configuration target was added, be sure to change from the default U-Boot configuration target in the Factory workorder (Target Software > Bootloader > u-boot > u-boot Configuration Target).

Build External U-Boot

The building of External U-Boot sources is no different from building with the Internal (the default, Factory-provided) U-Boot sources. Once properly configured in the workorder, as listed above, a simple make command, run from the top-level Factory directory will kick off the BSP/SDK build process. When it comes time to build U-Boot, Factory will change to the directory indicated as "u-boot Source Path" in the workorder and build the sources as they sit in that directory. The resulting BSP (files found under build_[arch]-timesys-linux-[libc]/images/) and SDK Installer (found at build_[arch]-timesys-linux-[libc]/[board] will contain U-Boot components compiled from the External U-Boot sources specified in the workorder.

If U-Boot has already been built, it will need to be reset to the unbuilt stage. To do this, and then re-build U-Boot, run the following from the top-level Factory directory:

make u-boot-restage && make u-boot

At this point the updated U-Boot images are included in the BSP at build_[arch]-timesys-linux-[libc]/images/bootloader/, but the SDK has yet to be rebuilt and will not reflect any changes made to U-Boot sources. To rebuild the SDK Installer, run the following from the top-level Factory directory:

make installers