Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

Creating persistent files

Persistent files are compiled into the device build and cannot be deleted. This provides a way to protect the file contents from being deleted or modified maliciously.

To add a persistent file to a device build

The AMSS build system has rules to facilitate adding persistent files to the Brew device build. To add a persistent file to the device build, perform the following steps:

  1. Add a line to the CONSTFILE_FILES make variable for the file to be added. CONSTFILE_FILES is defined is the .min files in the AMSS build system.

    For example, the following lines from platform\brewmp\system\brewcore\src\oem\ishellbased\msm\oem.min add the brewsettings.ini file to the persistent file system at the path fs:/mod/aee1/brewsettings.ini:

    CONSTFILE_FILES+= \
         brewsettings.ini|fs:/mod/aee1/brewsettings.ini
    

    The format of the CONSTFILE_FILES variable is:

    |
  2. Add a vpath directive to the .min file for the source file that is to be added to the persistent file system.

    For example, the following line from platform\brewmp\system\brewcore\src\oem\ishellbased\msm\oem.min allows the make system to locate the brewsettings.ini file:

     vpath %.ini $(BREW_SRC_DIR)/src/OEM
    $(BREW_SRC_DIR)/src/OEM/ishellbased/msm

The AMSS make system performs the following steps, which result in the desired persistent files being added to the build:

  1. Runs bin2src.exe for each of the files specified in the CONSTFILE_FILES variable to convert each file into a compilable C source file. For example, bin2src.exe would be run on brewsettings.ini to produce a brewsettings.ini.c file.
  2. Compiles each of the C source files generated from step 1.
  3. Generates a file named OEMConstFiles_Dynamic.c that references the data from each of the C source files created from step 1.
  4. Compiles OEMConstFiles_Dynamic.c into the device build.