Configuring Version Information

To implement software management, you are advised to configure information such as the software package version before compiling a software package so that the system can obtain the software version information during installation or upgrade.

The file path involved in the example is {project_dir}/src/app/add_customized_config. The file directory structure is as follows:
├── module_type.py                     // Configuration file of the OM SDK software type
├── replace_module_type.sh             // Script for replacing the software configuration file

Procedure

  1. Edit the software configuration file module_type.py to obtain the software package version information.
    # -*- coding: UTF-8 -*-
    from enum import Enum
    from typing import Set
    
    
    class ModuleType(Enum):
    
        # OMSDK upgrade is supported by default.
        FIRMWARE = "MindXOM"
    
        #This file is an important configuration file of the OM SDK. To prevent parsing errors, do not modify other code.
        # Register and add other firmware types to be upgraded.
        # The firmware type must be the same as the value of the Module field in the version.xml file in the custom upgrade package.
        SDK_UPGRADE = "SDK-Upgrade"
    
        @classmethod
        def values(cls) -> Set[str]:
            return {elem.value for elem in cls}

    The configuration file depends on the requisite OM SDK library files. You are allowed to add only the information in bold in the preceding example. The added firmware type must be the same as the value of Module in the version.xml file in the custom upgrade package.

  2. Replace the signature tool ({omsdk root directory}/software/ibma/lib/Linux/upgrade/module_type.py) contained in the om-sdk.tar.gz software package with the signature tool (module_type.py) generated by you, for example, replace_module_type.sh.
    #!/bin/bash
    CUR_DIR=$(dirname "$(readlink -f "$0")")
    OMSDK_TAR_PATH="${CUR_DIR}/../../../platform/omsdk"  # Directory where the OM SDK software package is decompressed
    function replace_cms_verify() {
        cp -f "${CUR_DIR}/module_type.py" "${OMSDK_TAR_PATH}/software/ibma/lib/Linux/upgrade/module_type.py"
    }
    replace_cms_verify
  3. Implement the compilation script for calling the custom signature in project_dir/build/build.sh.
    # Add the custom OM SDK software configuration.
    # PRODUCT_SCRIPT_PATH={project_dir}/src/app
    bash "${PRODUCT_SCRIPT_PATH}/add_customized_config/replace_module_type.sh"