BCOS Home » ... » ... » BCOS File Format Specifications » BCOS System File Format Specifications

BCOS Boot Script File Format Specification

Version 1.0

Project Map

Contents:

Tables:

Chapter 1: Overview

This specification defines the file format used for the Boot Script (which is used during boot, and possibly after boot).

1.1. General File Structure

The basic structure of the file is described in Figure 1-1. File Structure.

Figure 1-1. File Structure
  End of file 
(Optional) Metadata
Script Data 0x00000030
Generic Header 0x00000000
Note: Not to scale.

Chapter 2: Specification Change Policy

Any changes made in future versions of this specification are guaranteed to be backward and forward compatible. However, the variables and their meanings (rather than how they're stored) depend on the boot code and kernel being used and are not covered by this specification.

Chapter 3: File Format

3.1. Generic File Header

This is the native file format header defined in BCOS Native File Format Specification. For this specification, the "file type" field in the generic header (at offset 0x00000028) must be set to the value 0xFFFF0020.

3.2. Script Data

Because the boot script needs to be parsed by (often limited) boot code, it uses a very simple format where variables are assigned values. Note: More advanced scripting (things like "if" and loops) is unnecessary, and would require implementing a complex interpreter in the boot code.

Each variable is stored as an entry, and entries are simply concatenated.

There are only 4 types of variables:

Every type of entry begins with a byte indicating the size of the entry, followed by another byte indicating the size of the variable name, followed by a byte indicating the type of entry, followed by the variable's name. Depending on the type of entry, additional data may (or may not) be present after the variable's name.

Table 3-1. General Entry Format
OffsetSizeDescription
0x000000001 byteSize of entry
0x000000011 byteSize of variable name
0x000000021 byteType of entry
0x00000003VariesVariable name string (see Subsection 3.2.1. Variable Names
VariesVariesNone or more bytes of variable data

3.2.1. Variable Names

Variable names are ASCII (and not UTF-8) and must begin with a letter and only contain letters and numbers. They do not have a zero terminator, instead the length of the variable name is determined by the "Size of variable name" field.

Variables of a specific type must have unique names. If the same variable name is used for multiple entries of the same type, then only the first entry with that name is valid and all other entries with that name will be ignored/discarded. The same variable name can be used for variables of different types (for example, you can have a boolean variable called "Foo" and a string called "Foo"), however this is strongly discouraged for obvious reasons.

3.2.2. End of Variables

The end of the list of variables is marked with a zero byte instead of the "size of entry" field.

3.2.3. Boolean Variables

Boolean variables are used to store a 1-bit integer. The format for a boolean entry is show in Table 3-2. Boolean Entry Format.

Table 3-2. Boolean Entry Format
OffsetSizeDescription
0x000000001 byteSize of entry
0x000000011 byteSize of variable name
0x000000021 byteType of entry (must be 0x01)
0x00000003VariesVariable name string (see Subsection 3.2.1. Variable Names)
Varies1 byteBoolean data

The format for the "boolean data" byte is shown in Table 3-3. Boolean Data.

Table 3-3. Boolean Data
Bit/sMeaning
0The state of the boolean variable (0 = no or disabled, 1 = yes or enabled)
1Display type (0 = display as "Yes" or "No", 1 = display as "Enabled" or "Disabled")
2 to 7Reserved (must be zero)

3.2.4. Integer Variables

Integer variables are used to store an unsigned 64-bit integer. The format for an integer entry is show in Table 3-4. Integer Entry Format.

Table 3-4. Integer Entry Format
OffsetSizeDescription
0x000000001 byteSize of entry
0x000000011 byteSize of variable name
0x000000021 byteType of entry (must be 0x02)
0x00000003VariesVariable name string (see Subsection 3.2.1. Variable Names)
Varies8 bytesInteger data

Integers are always displayed in decimal.

3.2.5. String Variables

Strings are ASCII (and not UTF-8) and must not include any control characters or whitespace except for the space character, and do not have a zero terminator. The length of the string is determined by the size of the entry.

The format for a string entry is show in Table 3-5. String Entry Format.

Table 3-5. String Entry Format
OffsetSizeDescription
0x000000001 byteSize of entry
0x000000011 byteSize of variable name
0x000000021 byteType of entry (must be 0x03)
0x00000003VariesVariable name string (see Subsection 3.2.1. Variable Names)
VariesVariesString data

3.2.6. File Name Variables

File names are ASCII (and not UTF-8) and must not include any control characters or any other characters that would be invalid for file names, and do not have a zero terminator. The length of the file name is determined by the size of the entry.

The format for a string entry is show in Table 3-6. File Name Entry Format.

Table 3-6. File Name Entry Format
OffsetSizeDescription
0x000000001 byteSize of entry
0x000000011 byteSize of variable name
0x000000021 byteType of entry (must be 0x04)
0x00000003VariesVariable name string (see Subsection 3.2.1. Variable Names)
VariesVariesFile name data
Generated at 07:11:26 on the 9th of April, 2017 (UTC)