eCos Reference Manual
Prev |  | Next

# Chapter 3. Rebuilding RedBoot

# Introduction

RedBoot is built as an application on top of eCos. The makefile rules for building RedBoot are part of the eCos CDL package, so it's possible to build eCos from the Configuration Tool, as well as from the command line using ecosconfig.

Building RedBoot requires only a few steps: selecting the platform and the RedBoot template, importing a platform specific configuration file, and finally starting the build.

The platform specific configuration file makes sure the settings are correct for building RedBoot on the given platform. Each platform should provide at least two of these configuration files: `redboot_RAM.ecm` for a RAM mode RedBoot configuration and `redboot_ROM.ecm` or `redboot_ROMRAM.ecm` for a ROM or ROMRAM mode RedBoot configuration. There may be additional configuration files according to the requirements of the particular platform.

The RedBoot build process results in a number of files in the install `bin` directory. The ELF file `redboot.elf` is the pricipal result. Depending on the platform CDL, there will also be generated versions of RedBoot in other file formats, such as `redboot.bin` (binary format, good when doing an update of a primary RedBoot image, see the Section called Update the primary RedBoot flash image in Chapter 4), `redboot.srec` (Motorola S-record format, good when downloading a RAM mode image for execution), and `redboot.img` (stripped ELF format, good when downloading a RAM mode image for execution, smaller than the .srec file). Some platforms may provide additional file formats and also relocate some of these files to a particular address making them more suitable for downloading using a different boot monitor or flash programming tools.

The platform specific information in Chapter 5 should be consulted, as there may be other special instructions required to build RedBoot for particular platforms.

## Rebuilding RedBoot using ecosconfig

To rebuild RedBoot using the ecosconfig tool, create a temporary directory for building RedBoot, name it according to the desired configuration of RedBoot, here RAM:

    $ mkdir /tmp/redboot_RAM
    $ cd /tmp/redboot_RAM

Create the build tree according to the chosen platform, here using the Hitachi Solution Engine 7751 board as an example:

> Note: It is assumed that the environment variable ECOS_REPOSITORY points to the eCos/RedBoot source tree.

    $ ecosconfig new se7751 redboot
    U CYGPKG_HAL_SH_7750, new inferred value 0
    U CYGPKG_HAL_SH_7751, new inferred value 1
    U CYGHWR_HAL_SH_IRQ_USE_IRQLVL, new inferred value 1
    U CYGSEM_HAL_USE_ROM_MONITOR, new inferred value 0
    U CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM, new inferred value 0
    U CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS, new inferred value 1
    U CYGFUN_LIBC_STRING_BSD_FUNCS, new inferred value 0
    U CYGPKG_NS_DNS_BUILD, new inferred value 0

Replace the platform name ("se7751") with the appropriate name for the chosen platform.

Then import the appropriate platform RedBoot configuration file, here for RAM configuration:

    $ ecosconfig import ${ECOS_REPOSITORY}/hal/sh/se7751/VERSION/misc/redboot_RAM.ecm
    $ ecosconfig tree

Replace architecture ("sh"), platform ("se7751") and version ("`VERSION`") with those appropriate for the chosen platform and the version number of its HAL package. Also replace the configuration name ("redboot_RAM.ecm") with that of the appropriate configuration file.

RedBoot can now be built:

    $ make

The resulting RedBoot files will be in the associated install directory, in this example, `./install/bin`.

In Chapter 5 each platform's details are described in the form of shell variables. Using those, the steps to build RedBoot are:

    export REDBOOT_CFG=redboot_ROM
    export VERSION=VERSION
    mkdir /tmp/${REDBOOT_CFG}
    cd /tmp/${REDBOOT_CFG}
    ecosconfig new ${TARGET} redboot
    ecosconfig import ${ECOS_REPOSITORY}/hal/${ARCH_DIR}/${PLATFORM_DIR}/${VERSION}/misc/${REDBOOT_CFG}.ecm
    ecosconfig tree
    make

To build for another configuration, simply change the `REDBOOT_CFG` definition accordingly. Also make sure the `VERSION` variable matches the version of the platform package.

## Rebuilding RedBoot from the Configuration Tool

To rebuild RedBoot from the Configuration Tool, open the template window (Build->Templates) and select the appropriate Hardware target and in Packages select "redboot". Then press OK. Depending on the platform, a number of conflicts may need to be resolved before the build can be started; select "Continue".

Import the desired RedBoot configuration file from the platform HAL (File->Import...). Depending on the platform, a number of conflicts may need to be resolved before the build can be started; select "Continue". For example, if the platform selected is Hitachi SE7751 board and the RAM configuration RedBoot should be built, import the file `hal/sh/se7751/`VERSION`/misc/redboot_RAM.ecm`.

Save the configuration somewhere suitable with enough disk space for building RedBoot (File->Save...). Choose the name according to the RedBoot configuration, for example `redboot_RAM.ecc`.

Then start the build (Build->Library) and wait for it to complete. The resulting RedBoot files will be in the associated install directory, for the example this would be `redboot_RAM_install/bin`.

As noted above, each platform's details are described in Chapter 5. Use the information provided in the shell variables to find the configuration file - the path to it is `${ECOS_REPOSITORY}/hal/${ARCH_DIR}/${PLATFORM_DIR}/${VERSION}/misc/${REDBOOT_CFG}.ecm`, where `ECOS_REPOSITORY` points to the eCos/RedBoot sources, `VERSION` is the version of the package (usually "current") and `REDBOOT_CFG` is the desired configuration, e.g. redboot_RAM.

Prev | Home | Next
exec | Up | Updating RedBoot