Filesets

The mksysimage.py script uses fileset files, which group files into sets that can be easily included in or excluded from an image.

Filesets let you specify the files, directories, and symbolic links that you want to include in an image, as well and their permissions. If you want to modify the contents of your image, you must ensure that all files you want to include in an image are added to the appropriate filesets, and that files you no longer want are removed from the filesets.

To be used by the image generation process, filesets must be listed in a profile file (see Profiles).

Adding and modifying filesets

To add a new fileset to an image:

  1. Determine to which partition the fileset should belong (e.g., /base or /root).
  2. In the directory with your filesets (e.g., infra/filesets/ or infra/boards/board/), create an XML file and give it an appropriate name, such as basefs.denmark.elsinor.xml or rootfs.denmark.elsinor.xml.
  3. Open the new file, and add a line with the XML declaration, then the name of the fileset. For example:

    <?xml version="1.0" encoding="UTF-8"?>
    <fileset name="basefs.denmark.elsinor">

    The name of the fileset isn't significant, but the install_path specified in the profile file <package> element is (see Profiles).

  4. Add any files or symbolic links (symlinks) that you require. For example, the following element adds a new “horatio” configuration file:

    <!-- horatio config files -->
    <file name="etc/system/config/file_horatio.conf" uid="root" gid="nto" mode="0755"/>
  5. Make sure that you close your fileset element with </fileset>.
  6. Add the new fileset to a profile file, such as os.xml or dos-variant.xml. For example:

    <include-fileset name="basefs.denmark.elsinor"/>
Note:

Before you can reference a user (uid) or group (gid) in a fileset, you must define them in the appropriate user and group configuration files. If the user or group is referenced, but isn't appropriately defined in these files, the image generation process will fail.

Making a file optional

By default, if the mksysimage.py script can't find a file listed in a fileset it will fail and exit. To prevent mksysimage.py from exiting when it can't find a file listed in a fileset, you can do one of the following: