Grammar

The contents of the diskimage configuration file must conform to the following grammar, which is defined using a BNF-like notation.

# Configuration file
config_file : disk_cfg* partn_def*

# Disk configuration
disk_cfg : '[' disk_attr+ ']'

# Disk attributes
disk_attr : 'cylinders' '=' uint
          | 'heads' '=' uint
          | 'sectors_per_track' '=' uint
          | 'sector_size' '=' uint
          | 'num_sectors' '=' uint
          | 'align' '=' uint
          | 'start_at_cylinder' '=' uint
            
# Partition definition            
partn_def : primary_partn_def
          | extended_partn_def
          | logical_partn_def
            
# Primary partition definition            
primary_partn_def : 
      '[' 'partition' '=' partn_idx ppartn_attr* ']'  [partn_file]

# Extended partition definition  
extended_partn_def : 
     '[' 'extended' '=' partn_idx epartn_attr* ']'

# Logical partition definition  
logical_partn_def : 
     '[' 'logical' lpartn_attr* ']'  [partn_file]
  
# Partition index  
partn_idx : uint

# The primary partition attributes  
ppartn_attr : boot_attr
            | type_attr
            | type_guid_attr
            | nsec_attr
            | name_attr
            | required_attr
            | noblock_attr

# The extended partition attributes  
epartn_attr : nsec_attr

# The logical partition attributes  
lpartn_attr : boot_attr
            | type_attr
            | nsec_attr
            | esec_attr

# The boot attribute
boot_attr : 'boot' '=' bool

# The type attribute
type_attr : 'type' '=' uint

# The type_guid attribute
type_guid_attr : 'type_guid' '=' type_guid_name
               | 'type_guid' '=' type_guid_guid

# The num_sectors attribute
nsec_attr : 'num_sectors' '=' uint

# The ebr_sectors attribute
esec_attr : 'ebr_sectors' '=' uint

# The name attribute
name_attr : 'name' '=' gpt_partn_name

# The 'required' attribute
required_attr : 'required' '=' bool

# The noblock attribute
noblock_attr : 'noblock' '=' bool

# Partition file
partn_file : string

# GUID name
type_guid_name : string

# GUID
type_guid_guid : guid

# The boolean definition
bool : 'true'
     | 'false'

# Unsigned integer 
uint : '0' odigit* sfx?
     | '0x' xdigit+ sfx?
     | [1-9] ddigit* sfx?

# Octal digits
odigit : [0-7]

# Decimal digits
ddigit : [0-9]

# Hexadecimal digits
xdigit : [0-9a-fA-F]

# Factors that can be used with integers 
sfx : [kKmMgGtTpP]

# String values must be enclosed within double quotes ("")            
string : '"' [^"]* '"'

# A GUID
guid : 
'{' xdigit{8} '-' xdigit{4} '-' xdigit{4} '-' xdigit{4} '-' xdigit{12} '}'