Chapter 3. Rebuilding RedBoot

Introduction

In normal circumstances it is only necessary to rebuild RedBoot if it has been modified, for example if you have extended the command set or applied patches. See the Getting Started with eCos document, which provides information about the portability and extendability of RedBoot in an eCos environment.

Most platform HALs provide configuration export files. Before proceding with the following procedures, check “Configuration export files”, the Section called Configuration export files first, which may simplify the process for your platform.

RedBoot is configured and built using configuration technology based on Configuration Description Language (CDL). The detailed instructions for building the command-line tool ecosconfig on Linux can be found in host/README. For example:

mkdir $TEMP/redboot-build
cd $TEMP/redboot-build
$ECOSDIR/host/configure --prefix=$TEMP/redboot-build --with-tcl=/usr
make

The simplest version of RedBoot can be built by setting the environment variable ECOS_REPOSITORY to point at the eCos/RedBoot source tree, and then typing:

ecosconfig new TARGET redboot
ecosconfig tree
make
where TARGET is the eCos name for the desired platform, for example assabet. You will need to have set the environment variable ECOS_REPOSITORY to point at the eCos/RedBoot source tree. Values of TARGET for each board are given in the specific installation details for each board in Chapter 5.

The above command sequence would build a very simple version of RedBoot, and would not include, for example, networking, FLASH or Compact Flash Ethernet support on targets that supported those. Such features could be included with the following commands:

ecosconfig new TARGET redboot
ecosconfig add flash
ecosconfig add pcmcia net_drivers cf_eth_drivers
ecosconfig tree
make

In practice, most platform HALs include configuration export files, described in the Section called Configuration export files, to ensure that the correct configuration of RedBoot has been chosen to avoid needing to worry about which extra packages to add.

The above commands would build a version of RedBoot suitable for testing. In particular, the result will run from RAM. Since RedBoot normally needs to be installed in ROM/flash, type the following:

cat >RedBoot_ROM.ecm <<EOF
cdl_component CYG_HAL_STARTUP {
       user_value ROM
};
EOF
ecosconfig import RedBoot_ROM.ecm
ecosconfig tree
make

This set of commands will adjust the configuration to be ROM oriented.

Each of these command sequences creates multiple versions of RedBoot in different file formats. The choice of which file to use will depend upon the actual target hardware and the tools available for programming ROM/flash. The files produced (typically) are:

install/bin/redboot.elf This is the complete version of RedBoot, represented in ELF format. It is most useful for testing with tools such as embedded ICE, or other debug tools.

install/bin/redboot.srec This version has been converted to Motorola S-record format.

install/bin/redboot.bin This version has been flattened; that is, all formatting information removed and just the raw image which needs to be placed in ROM/flash remains.

The details of putting the RedBoot code into ROM/flash are target specific. Once complete, the system should come up with the RedBoot prompt. For example, the version built using the commands above looks like:

RedBoot(tm) debug environment [ROM]
Red Hat certified release, version R1.xx - built 07:54:25, Oct 16 2000
Platform: Assabet development system (StrongARM 1110)
Copyright (C) 2000, Red Hat, Inc.
RAM: 0x00000000-0x02000000
flash: 0x50000000 - 0x50400000, 32 blocks of 0x00020000 bytes ea.
Socket Communications, Inc: Low Power Ethernet CF Revision C
5V/3.3V 08/27/98
IP: 192.168.1.29, Default server: 192.168.1.101
RedBoot> 

Configuration export files

To help with rebuilding RedBoot from source, some platforms HALs provide configuration export files. First locate the configuration export files for your platform in the eCos source repository. The RAM and ROM startup configuration exports can usually be found in a directory named "misc" in the platform HAL in the eCos source repository, named:

1432 Feb  1 13:27 misc/redboot_RAM.ecm
1487 Feb  1 14:38 misc/redboot_ROM.ecm
All dates and sizes are just examples.

Making RedBoot for RAM startup

Throughout the following instructions, several environmental variables are referred to:

$REDBOOTDIR

Full path to the toplevel RedBoot source release.

$BUILDDIR

Full path to where RedBoot will be built, e.g. redboot.RAM.

$ECOS_REPOSITORY

Full path to the RedBoot package source. Typically, this should be $REDBOOTDIR/packages.

$TARGET

e.g.atlas_mips32_4kc.

$ARCH_DIR

The directory for the architecture, e.g. mips.

$PLATFORM_DIR

The directory for the platform, e.g. atlas.

$VERSION

The version of the release, e.g. current.

You must make sure these variables are correctly set in your environment before proceeding, or the build will fail. The values for $TARGET, $ARCH_DIR and $PLATFORM_DIR for each board are given in the specific installation details for each board in Chapter 5. The value for $VERSION is the name of the package subdirectories - usually 'current' for sources checked out of CVS, or something like 'vX_Y' for a regular X.Y release.

With the environment variables set, use the following sequence of commands to build a RedBoot image suitable for loading into RAM:

mkdir $BUILDDIR
cd $BUILDDIR
ecosconfig new $TARGET redboot
ecosconfig import \
  ${ECOS_REPOSITORY}/hal/${ARCH_DIR}/${PLATFORM_DIR}/${VERSION}/misc/redboot_RAM.ecm
ecosconfig tree
make 

To build a ROM or ROMRAM version, in a different build/config directory, just use the configuration export file redboot_ROM.ecm or redboot_ROMRAM.ecm instead.

The resulting files will be, in each of the ROM, ROMRAM and RAM startup build places:

    $BUILDDIR/install/bin/redboot.bin
    $BUILDDIR/install/bin/redboot.elf
    $BUILDDIR/install/bin/redboot.img
    $BUILDDIR/install/bin/redboot.srec

Some targets may have variations, or extra files generated in addition.

Platform specific instructions

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