Name

CYGPKG_RBINIT — provide extra RedBoot initialization

Description

The RedBoot Extra Initialisation (RBINIT) package provides extra default initialization for RedBoot. This may be used to execute a set of initial commands, or to perform any additional platform or system specific initialization. The RBINIT package is aimed primarily at field deployment of production systems rather than at application development.

Building RedBoot

The first step in building RedBoot with RBINIT support is to create a RedBoot configuration appropriate for the target platform. This is somewhat target specific so the appropriate platform HAL or RedBoot documentation should be consulted for further details. Typically RedBoot should be configured for ROM startup.

Given this initial configuration the RBINIT package CYGPKG_RBINIT should now be added to the configuration, using one of the eCos configuration tools. For example with the command line tool this involves using ecosconfig add rbinit.

There are a number of other configuration options which may be changed at this point:

CYGGLO_RBINIT_STDIO_DISABLE
This option causes all output generated during the extra initialization to be discarded. Turn this option off to get output for debugging purposes.
CYGPKG_RBINIT_PRI
This option selects the priority of the extra initialization routine. The value of this option may either be RedBoot_INIT_BEFORE_NET or RedBoot_INIT_AFTER_NET which, as the names imply, cause the extra initialization to occur either before or after any network device is initialized.

Once RedBoot has been appropriately configured it can be built and installed as usual for the target platform.

Extra Initialization Function

The purpose of the extra initialization package is to execute the rbinit_exec() function. A default version of this function is contained in the rbinit_exec.c file within this package in the source repository.

The default content of this function provides support for loading and executing primary or secondary applications from a filesystem. The default function will first attempt to mount a JFFS2 filesystem named “jffs2” in the RedBoot FIS table. If that fails it will attempt to mount the first partition of an IDE hard disk using a FAT filesystem. Finally if that fails it will attempt to mount a RAM filesystem, although it will be empty. If a filesystem has been successfully mounted, it will attempt to load into RAM and run a program named “app.primary” from the root of the filesystem, and if that fails, a program named “app.secondary”.

A customized version of this function may be provided instead by using one of the following methods:

  • Editing the file directly in the source repository.
  • Adding an equivalent function in your application build and ensure its object file is linked into your application. This will cause the default implementation of rbinit_exec() provided in this package to be overridden. You may wish to use the version in this package as a template to start with.
  • By copying the rbinit_exec.c file into the configuration's build tree and editing it there.