ChorusOS 4.0 Porting Guide

The Top Level BSP Directory

For this example, the new directory will be called MYBSP_SRC_DIR. This top level directory must contain the following four files:


Example A-5 New BSP: Makefile.bin

COMPONENT += BSP

BSP.all::

BSP_XML = target.xml target_action.xml

xml:: DEVTOOLS.all
        @sh $(DEVTOOLS_DIR)/cpxml $(BUILD_DIR)/conf/mkimage $(BSP) $(BSP_XML)

XML3 += mkimage/mkimage.xml

The COMPONENT macro defines a list of components that will be processed in the build phase. The BSP source component is added to this list.


Caution - Caution -

Only the name BSP is required.


The xml target is used to copy the target.xml and target_action.xml file to the $(BUILD_DIR)/conf/mkimage directory. The mkimage/mkimage.xml is added to the XML macro. This XML file will be used at the end of the build to generate the image.


Example A-6 New BSP: Makefile.src

BSP_SRC = $(BSP)/src

all:: BSP.all 

BSP.all:: $(BSP_DIR)/DONE

$(BSP_DIR)/DONE: $(BSP_DIR)/Makefile 
        sh $(DEVTOOLS_DIR)/resync BSP -f $(BSP) -s $(BSP_DIR)
        cd $(BSP_DIR); $(MAKE)
        touch $(BSP_DIR)/DONE

$(BSP_DIR)/Makefile: $(BSP_SRC)/Imakefile
        sh $(DEVTOOLS_DIR)/ChorusOSMkMf $(BUILD_DIR) -s \
           $(BSP_SRC) -b $(BSP_DIR) -d $(BSP_DIR)
        cd $(BSP_DIR); $(MAKE) Makefiles

This makefile defines the BSP.all target used to compile and link the BSP source files.

The ChorusOSMkMf tool is used to create Makefiles from Imakefiles (see ChorusOSMkMf(1CC)for more details).

The BSP_DIR variable is defined as $BUILD_DIR)/build-BSP. This directory will be used as the build directory and the binary delivery directory.


Example A-7 New BSP: target.xml

<!DOCTYPE folder PUBLIC "-//Sun Microsystems//DTD ChorusOS//EN" "ChorusOS.dtd">

<fold      </description>
      <type name='Area' ref-only='yes' />
      <ref name='ram_area' />
    </definition>

    <definition name='user_context_area_ref'>
      <de      <value field='bank'><ref name='sys_bank' /></value>
      <value field='binary'><ref name='microkernel_model' /></value>
    </definition>
  </folder>

  <folder name='System image'>
    <description>ChorusOS system image configuration</description>

    <folder name='Files'>
      <description>system image files</description>

      <definition name='BSP_files'>
        <description>system image BSP files</description>

        <type name='FileList' />
        <value index='size'><ref name='debug_driver' /></value>
        <value index='size'><ref name='bootstrap' /></value>
        <value index='size'><ref name='microkernel' /></value>
      </definition>

      <folder name='Auto-generated files'>
        <description>
          system image files automatically generated by 'mkimage' tool
        </description>

        <definition name='bootconf'>
          <description>bootconf program</description>
          <type name='File' />
          <value field='path'>
            <vstring>${IMAGE_DIR}/bconf/${SYSTEM}_bconf.r</vstring>
          </value>
          <value field='bank'><ref name='sys_bank' /></value>
          <value field='binary'><ref name='bootconf_model' /></value>
        </definition>

        <definition name='symb'>
          <description>kernel debuger (kdb) symbols</description>
          <type name='File' />
          <value field='path'>
            <vstring>${IMAGE_DIR}/symb/${SYSTEM}_symb.r</vstring>
          </value>
          <value field='bank'><ref name='sys_bank' /></value>
          <value field='binary'><ref name='debug_agent_model' /></value>
        </definition>

        <definition name='env_file'>
          <description>
            initial state of system environment variables
          </description>
          <type name='File' />
          <value field='path'>
            <vstring>${IMAGE_DIR}/environ</vstring>
          </value>
          <value field='bank'><ref name='sys_bank' /></value>
        </definition>
      </folder>

    </folder>

    <folder name='Misc'>
      <description>Misc configuration variables</description>
        
      <definition name='banks'>
        <description>list of system image banks</description>
        <type name='BankList'/>
        <value index='size'><ref name='sys_bank' /></value>
      </definition>

      <definition name='heap_size'>
        <description>bootconf heap size</description>
        <int/>
        <const>0x00002000</const>
      </definition>

    </folder>

  </folder>

</folder>

The example target.xml file, above, specifies the basic routines needed to produce a kernonly archive. It is important to note that this file has to be adapted for your particular board.

The pathname ${BSP_DIR}/bin/mybsp is used to reference a number of BSP binaries. The mybsp name can be replaced by an explicit reference to your board. In this case, remember to change this path in the Project.tmpl file, detailed below.


Example A-8 New BSP: target_action.xml

<!DOCTYPE folder PUBLIC "-//Sun Microsystems//DTD ChorusOS//EN" "ChorusOS.dtd">

<folder name='MYBSP specific actions' visible='no'>
  <description>MYBSP system image action</description>

  <action name='Archive renaming'>
    <application>shellCommand</application>
    <definition name='shellCommand_cp'>
      <type name='ShellCommand' />
      <value field='command'>
        <vstring>cp</vstring>
      </value>
      <value field='argument'>
        <value index='size'>
          <vstring>${IMAGE_DIR}/bank/sys_bank</vstring>
        </value>
        <value index='size'>
          <vstring>${RESULT}</vstring>
        </value>
      </value>
    </definition>
  </action>

</folder>

The target_action.xml file, detailed above, copies the sys_bank file into a file defined by the RESULT variable. This variable is defined as ${BUILD_DIR}/${SYSTEM}, where ${SYSTEM} is the name of the image to be produced. Note that multiple banks can be combined, and specific binary format headers can be included, to produce a more complex system image.