Buildfile syntax

Updated: April 19, 2023

The buildfile text may include blank lines and comments. All sections are optional, but not all combinations are permitted.

The general format for a buildfile is:

attribute filename contents
attribute filename contents

For example, the line [virtual=armle-v7,raw] .boot = { has an attribute of [virtual=armle-v7,raw] and a filename of .boot. The contents part of the line is what we call an inline file.

Note:

Attributes

Two types of attributes can be present in a buildfile:

Boolean ([+attribute] | [-attribute])
Turn on or off a specific attribute. For example, [+script] turns on the script attribute, and [-optional] turns off the optional attribute.
Value ([attribute=value])
Assign a value to an attribute (e.g., [uid=0]). Note that there are no spaces around the equals sign.

When combining attributes, put all attributes together inside the square brackets. For example:

In other words, use this syntax: [uid=0 gid=0] file_owned_by_root. The following is incorrect:

# Wrong!
[uid=0] [gid=0] [perms=0666] file1

The above attributes should be combined as follows:

# Correct!
[uid=0 gid=0 perms=0666] file1

Attributes can apply to a single file or to all files listed after the attribute. For example:

Modifiers

Buildfile modifiers use the same syntax as buildfile attributes (e.g., [some_modifier]), but apply to commands in script files.

Inline files

Inline files are a convenient way to place a file in the image without actually having a separate file. Instead of getting the file contents from the filesystem on the host machine, mkifs gets them from the text enclosed in braces in the buildfile itself.

The following rules apply to inline files: