ChorusOS 4.0 Production Guide

Adding a Feature

A module is source code which implements a feature. Create a file test.c as shown for the creation of bye.c in the mkmk tutorial in Chapter 5, Creating a ChorusOS Component. The module may be created so that it will (or will not) be present in the IOM component. This depends on the value of the feature MY_TEST. By default, the module will not be included in the IOM component, as explained below.

To create the test module, carry out the following steps:

  1. Create the test.df production file for the test module:

    host% cd <src_dir>/iom/src/os/iom/sys/test
    
  2. Create a test.df file containing:

       MODULES=module_test

    The module named module_test will contain any object files present in the directory and subdirectories. The module is a collection of object files, in this example, it will only contain test.o.

  3. To add the feature in the XML source configuration file for the IOM component, go to the directory containing the IOM configuration files:

    host% cd <src_dir>/iom/conf/mkconfig
    
  4. In order to add the MY_TEST feature, modify both of the iom_rule.xml and iom_action.xml files. Include the definition of the feature in XML in the iom_rule.xml file:

     <feature name="MY_TEST">
    
               <description> My Feature </description>
               <bool>
               <false>
             </feature>

    The definition includes the name of the feature, a description field and a value. Both the description field and the value will be accessible through the ews configuration tool. In this example, the value is a boolean value, false by default. As the default value is false, the module will not appear in the IOM component. Include the standard rule used for the management of the IOM features in the iom_action.xml file:

    <setting name="iom.modules">
    
             <description>module_test</description>
             <condition>
    
               <var name="MY_TEST">
             </condition>
             <value index="size">
    
               <const>module_test</const>
             </value>
             </setting>

    Note -

    MY_TEST is the external name of the feature, module_test is the corresponding module managed by the mkmk tool.


  5. Rebuild the IOM component:

    host% make mkmk
    host% make depend
    host% make 
    
  6. Update the configuration in the build directory and build the new system image:

    host% cd <work_dir>
    host% rm conf/mkconfig/iom_rule.xml conf/mkconfig/iom_action.xml
    host% make xml
    host% make build
    

    As the newly created test module is set to FALSE by default, you will not find the definition of my_tunable by running:

    host% powerpc-elf-nm image/RAM/chorus/bin/N_iom | grep my_
    

    In order to configure the MY_TEST feature, type:

    host% configurator -set MY_TEST=true
    

    and the test module will be integrated.