1 New config language for LinuxBIOS
4 We describe the new configuration language for LinuxBIOS.
8 This
document defines the new configuration language for LinuxBIOS.
11 The goals of the new language are these:
13 \item Simplified Makefiles so people can see what is set
14 \item Move from the regular-expression-based language to something
15 a bit more comprehensible and flexible
16 \item make the specification easier for people to use and understand
17 \item allow unique register-set-specifiers for each chip
18 \item allow generic register-set-specifiers for each chip
19 \item generate static initialization code, as needed, for the
24 Here is the new language. It is very similar to the old one, differing
25 in only a few respects. It borrows heavily from Greg Watson's suggestions.
27 I am presenting it in a pseudo-BNF in the hopes it will be easier. Things
28 in '' are keywords; things in ``'' are strings in the actual text.
30 #exprs are composed of factor or factor + factor etc.
31 expr ::= factor ( ``+'' factor | ``-'' factor | )*
32 #factors are term or term * term or term / term or ...
33 factor ::= term ( ``*'' term | ``/'' term | ... )*
36 # term is a number, hexnumber, ID, unary-op, or a full-blown expression
37 term ::= NUM | XNUM | ID | unary-op | ``(`` expr ``)''
39 # Option command. Can be an expression or quote-string.
40 # Options are used in the config tool itself (in expressions and 'if')
41 # and are also passed to the C compiler when building linuxbios.
42 # It is an error to have two option commands in a file.
43 # It is an error to have an option command after the ID has been used
44 # in an expression (i.e. 'set after used' is an error)
45 option ::= 'option' ID '=' (``value'' | term)
47 # Default command. The ID is set to this value if no option command
49 # Multiple defaults for an ID will produce warning, but not errors.
50 # It is OK to scan a default command after use of an ID.
51 # Options always over-ride defaults.
52 default ::= 'default' ID '=' (``value'' | term)
54 # the mainboard, southbridge, northbridge commands
55 # cause sourcing of Config.lb files as in the old config tool
56 # as parts are sourced, a device tree is built. The structure
57 # of the tree is determined by the structure of the components
58 # as they are specified. To attach a superio to a southbridge, for
59 # example, one would do this:
60 # southbridge acer/
5432
64 # the tool generates static initializers for this hierarchy.
66 # add C code to the current component (motherboard, etc. )
67 # to initialise the component-INDEPENDENT structure members
68 init ::= 'init' ``CODE''
70 # add C code to the current component (motherboard, etc. )
71 # to initialise the component-DEPENDENT structure members
72 register ::= 'register' ``CODE''
76 # statements in this block will set variables controlling the mainboard,
77 # and will also place components (northbridge etc.) in the device tree
78 # under this mainboard
79 mainboard ::= 'mainboard' PATH (statements)* 'end'
81 # standard linuxbios commands
82 southbridge ::= 'southbridge' PATH (statemnts)* 'end'
83 northbridge ::= 'northbridge' PATH (statemnts)* 'end'
84 superio ::= 'superio PATH (statemnts)* 'end'
85 cpu ::= 'cpu' PATH (statemnts)* 'end'
86 arch ::= 'arch' PATH (statemnts)* 'end'
88 # files for building linuxbios
89 # include a file in crt0.S
90 mainboardinit ::= 'mainboardinit' PATH
93 object ::= 'object' PATH
94 # driver objects are just built into the image in a different way
95 driver ::= 'driver' PATH
97 # Use the Config.lb file in the PATH
100 # add a file to the set of ldscript files
101 ldscript ::= 'ldscript' PATH
103 # dependencies or actions for the makerule command
104 dep ::= 'dep' ``dependency-string''
105 act ::= 'act' ``actions''
106 depsacts ::= (dep | act)*
109 makerule ::= 'makerule' PATH depsacts
111 #defines for use in makefiles only
112 # note usable in the config tool, not passed to cc
113 makedefine ::= 'makedefine' ``RAWTEXT''
115 # add an action to an existing make rule
116 addaction ::= 'addaction' PATH ``ACTION''
139 statements ::= (statement)*
141 # target directory specification
142 target ::= 'target' PATH
144 # and the whole thing
145 board ::= target (option)* mainboard
149 \subsubsection{Command definitions
}
150 \subsubsubsection{option
}
151 \subsubsubsection{default
}
152 \subsubsubsection{cpu
}
153 \subsubsubsection{arch
}
154 \subsubsubsection{northbridge
}
155 \subsubsubsection{southbridge
}
156 \subsubsubsection{superio
}
157 \subsubsubsection{object
}
158 \subsubsubsection{driver
}
159 \subsubsubsection{mainboardinit
}
160 \subsubsubsection{makerule
}
161 \subsubsubsection{makedefine
}
162 \subsubsubsection{addaction
}
163 \subsubsubsection{init
}
164 \subsubsubsection{register
}
165 \subsubsubsection{iif
}
166 \subsubsubsection{dir
}
167 \subsubsubsection{ldscript
}
175 # over-ride the default ROM size in the mainboard file
176 option CONFIG_ROM_SIZE=
1024*
1024
182 Sample mainboard file
186 ### Set all of the defaults for an x86 architecture
191 option CONFIG_DEBUG=
1
192 default CONFIG_USE_FALLBACK_IMAGE=
1
197 ### Build our
16 bit and
32 bit linuxBIOS entry code
199 mainboardinit cpu/i386/entry16.inc
200 mainboardinit cpu/i386/entry32.inc
201 ldscript cpu/i386/entry16.lds
202 ldscript cpu/i386/entry32.lds
205 ### Build our reset vector (This is where linuxBIOS is entered)
207 if CONFIG_USE_FALLBACK_IMAGE
208 mainboardinit cpu/i386/reset16.inc
209 ldscript cpu/i386/reset16.lds
211 mainboardinit cpu/i386/reset32.inc
212 ldscript cpu/i386/reset32.lds
217 if CONFIG_USE_FALLBACK_IMAGE mainboardinit arch/i386/lib/noop_failover.inc end
222 #makerule ./failover.E dep "$(CONFIG_MAINBOARD)/failover.c" act "$(CPP) -I$(TOP)/src $(CPPFLAGS) $(CONFIG_MAINBOARD)/failover.c > ./failever.E"
223 #makerule ./failover.inc dep "./romcc ./failover.E" act "./romcc -O ./failover.E > failover.inc"
224 #mainboardinit ./failover.inc
225 makerule ./auto.E dep "$(CONFIG_MAINBOARD)/auto.c" act "$(CPP) -I$(TOP)/src -$(ROMCCPPFLAGS) $(CPPFLAGS) $(CONFIG_MAINBOARD)/auto.c > ./auto.E"
226 makerule ./auto.inc dep "./romcc ./auto.E" act "./romcc -O ./auto.E > auto.inc"
227 mainboardinit ./auto.inc
230 ### Include the secondary Configuration files
232 northbridge amd/amdk8
234 southbridge amd/amd8111
236 #mainboardinit arch/i386/smp/secondary.inc
238 register "com1=
{1} com2=
{0} floppy=
1 lpt=
1 keyboard=
1"
241 ##dir /src/superio/winbond/w83627hf
248 ### Build the objects we have code for in this directory.
252 object static_devices.o
253 if CONFIG_HAVE_MP_TABLE object mptable.o end
254 if CONFIG_HAVE_PIRQ_TABLE object irq_tables.o end
255 ### Location of the DIMM EEPROMS on the SMBUS
256 ### This is fixed into a narrow range by the DIMM package standard.
258 option SMBUS_MEM_DEVICE_START=(
0xa <<
3)
259 option SMBUS_MEM_DEVICE_END=(SMBUS_MEM_DEVICE_START +
1)
260 option SMBUS_MEM_DEVICE_INC=
1
262 ### The linuxBIOS bootloader.
264 option CONFIG_PAYLOAD_SIZE = (CONFIG_ROM_SECTION_SIZE - CONFIG_ROM_IMAGE_SIZE)
265 option CONFIG_ROM_PAYLOAD_START = (
0xffffffff - CONFIG_ROM_SIZE + CONFIG_ROM_SECTION_OFFSET +
1)
270 I've found the output of the new tool to be easier to
271 handle. Makefile.settings looks like this, for example:
273 TOP:=/home/rminnich/src/yapps2/freebios2
275 export CONFIG_MAINBOARD:=/home/rminnich/src/yapps2/freebios2/src/mainboard/amd/solo
276 export CONFIG_ARCH:=i386
277 export CONFIG_RAMBASE:=
0x4000
278 export CONFIG_ROM_IMAGE_SIZE:=
65535
279 export CONFIG_PAYLOAD_SIZE:=
131073
280 export CONFIG_MAX_CPUS:=
1
281 export CONFIG_HEAP_SIZE:=
8192
282 export CONFIG_STACK_SIZE:=
8192
283 export CONFIG_MEMORY_HOLE:=
0
284 export COREBOOT_VERSION:=
1.1.0
285 export CC:=$(CONFIG_CROSS_COMPILE)gcc
289 In other words, instead of expressions, we see the values. It's easier to