]> rtime.felk.cvut.cz Git - novaboot.git/blob - README.md
Document that configuration file should not be used
[novaboot.git] / README.md
1 # NAME
2
3 novaboot - A tool for booting various operating systems on various hardware or in qemu
4
5 # SYNOPSIS
6
7 __novaboot__ \[ options \] \[--\] script...
8
9 __./script__ \[ options \]
10
11 __novaboot__ --help
12
13 # DESCRIPTION
14
15 This program makes it easier to boot NOVA or other operating system
16 (OS) in different environments. It reads a so called novaboot script
17 and uses it either to boot the OS in an emulator (e.g. in qemu) or to
18 generate the configuration for a specific bootloader and optionally to
19 copy the necessary binaries and other needed files to proper
20 locations, perhaps on a remote server. In case the system is actually
21 booted, its serial output is redirected to standard output if that is
22 possible.
23
24 A typical way of using novaboot is to make the novaboot script
25 executable and set its first line to _\#!/usr/bin/env novaboot_. Then,
26 booting a particular OS configuration becomes the same as executing a
27 local program - the novaboot script.
28
29 With `novaboot` you can:
30
31 1. Run an OS in Qemu. This is the default action when no other action is
32 specified by command line switches. Thus running `novaboot ./script`
33 (or `./script` as described above) will run Qemu and make it boot the
34 configuration specified in the _script_.
35 2. Create a bootloader configuration file (currently supported
36 bootloaders are GRUB, GRUB2 and Pulsar) and copy it with all other
37 files needed for booting to another, perhaps remote, location.
38
39         ./script --server --iprelay
40
41     This command copies files to a TFTP server specified in the
42     configuration file and uses TCP/IP-controlled relay to reset the test
43     box and receive its serial output.
44
45 3. Run DHCP and TFTP server on developer's machine to PXE-boot NOVA from
46 it. E.g.
47
48         ./script --dhcp-tftp
49
50     When a PXE-bootable machine is connected via Ethernet to developer's
51     machine, it will boot the configuration described in _script_.
52
53 4. Create bootable ISO images. E.g.
54
55         novaboot --iso -- script1 script2
56
57     The created ISO image will have GRUB bootloader installed on it and
58     the boot menu will allow selecting between _script1_ and _script2_
59     configurations.
60
61 # OPTIONS
62
63 - \-a, --append=<parameters>
64
65     Appends a string to the root task's command line.
66
67 - \-b, --bender
68
69     Boot bender tool before the kernel to find PCI serial ports.
70
71 - \--build-dir=<directory>
72
73     Overrides the default build directory location.
74
75     The default build directory location is determined as follows:
76
77     If there is a configuration file, the value specified in _$builddir_
78     variable is used. Otherwise, if the current working directory is
79     inside git work tree and there is `build` directory at the top of
80     that tree, it is used. Otherwise, if directory `~/nul/build` exists,
81     it is used. Otherwise, it is the directory that contains the first
82     processed novaboot script.
83
84 - \-c, --config=<filename>
85
86     Use a different configuration file than the default one (i.e.
87     `~/.novaboot`).
88
89 - \-d, --dhcp-tftp
90
91     Turns your workstation into a DHCP and TFTP server so that NOVA
92     can be booted via PXE BIOS on a test machine directly connected by
93     a plain Ethernet cable to your workstation.
94
95     The DHCP and TFTP servers require root privileges and `novaboot`
96     uses `sudo` command to obtain those. You can put the following to
97     _/etc/sudoers_ to allow running the necessary commands without
98     asking for password.
99
100         Cmnd_Alias NOVABOOT = /bin/ip a add 10.23.23.1/24 dev eth0, /bin/ip l set dev eth0 up, /usr/sbin/dhcpd -d -cf dhcpd.conf -lf dhcpd.leases -pf dhcpd.pid, /usr/sbin/in.tftpd --foreground --secure -v -v -v *, /usr/bin/touch dhcpd.leases
101         your_login ALL=NOPASSWD: NOVABOOT
102
103 - \--dump
104
105     Prints the content of the novaboot script after removing comments and
106     evaluating all _\--scriptmod_ expressions.
107
108 - \--dump-config
109
110     Dumps current configuration to stdout end exits. Useful as an initial
111     template for a configuration file.
112
113 - \-g, --grub\[=_filename_\]
114
115     Generates grub menu file. If the _filename_ is not specified,
116     `menu.lst` is used. The _filename_ is relative to NUL build
117     directory.
118
119 - \--grub-prefix=_prefix_
120
121     Specifies _prefix_ that is put before every file in GRUB's menu.lst.
122     This overrides the value of _$server\_grub\_prefix_ from the
123     configuration file.
124
125 - \--grub2\[=_filename_\]
126
127     Generate GRUB2 menuentry in _filename_. If _filename_ is not
128     specified grub.cfg is used. The content of the menuentry can be
129     customized by _$grub2\_prolog_ and _$server\_grub\_prefix_
130     configuration variables.
131
132     In order to use the the generated menuentry on your development
133     machine that uses GRUB2, append the following snippet to
134     `/etc/grub.d/40\_custom` file and regenerate your grub configuration,
135     i.e. run update-grub on Debian/Ubuntu.
136
137         if [ -f /path/to/nul/build/grub.cfg ]; then
138           source /path/to/nul/build/grub.cfg
139         fi
140
141
142
143 - \-h, --help
144
145     Print short (__\-h__) or long (__\--help__) help.
146
147 - \--iprelay\[=addr or cmd\]
148
149     If no _cmd_ is given, use IP relay to reset the machine and to get
150     the serial output. The IP address of the relay is given by _addr_
151     parameter if specified or by $iprelay\_addr variable in the
152     configuration file.
153
154     If _cmd_ is one of "on" or "off", the IP relay is used to press power
155     button for a short (in case of "on") or long (in case of "off") time.
156     Then, novaboot exits.
157
158     Note: This option is expected to work with HWG-ER02a IP relays.
159
160 - \-i, --iso\[=filename\]
161
162     Generates the ISO image that boots NOVA system via GRUB. If no filename
163     is given, the image is stored under _NAME_.iso, where _NAME_ is the name
164     of novaboot script (see also __\--name__).
165
166 - \-I
167
168     This is an alias (see `%custom_options` below) defined in the default
169     configuration. When used, it causes novaboot to use Michal's remotely
170     controllable test bed.
171
172 - \-J
173
174     This is an alias (see `%custom_options` below) defined in the default
175     configuration. When used, it causes novaboot to use another remotely
176     controllable test bed.
177
178 - \--on, --off
179
180     Synonym for --iprelay=on/off.
181
182 - \--name=_string_
183
184     Use the name _string_ instead of the name of the novaboot script.
185     This name is used for things like a title of grub menu or for the
186     server directory where the boot files are copied to.
187
188 - \--no-file-gen
189
190     Do not generate files on the fly (i.e. "<" syntax) except for the
191     files generated via "<<WORD" syntax.
192
193 - \-p, --pulsar\[=mac\]
194
195     Generates pulsar bootloader configuration file whose name is based on
196     the MAC address specified either on the command line or taken from
197     _.novaboot_ configuration file.
198
199 - \-Q, --qemu=_qemu-binary_
200
201     Use specific version of qemu binary. The default is 'qemu'.
202
203 - \--qemu-append=_flags_
204
205     Append _flags_ to the default qemu flags (QEMU\_FLAGS variable or
206     `-cpu coreduo -smp 2`).
207
208 - \-q, --qemu-flags=_flags_
209
210     Replace the default qemu flags (QEMU\_FLAGS variable or `-cpu coreduo
211     -smp 2`) with _flags_ specified here.
212
213 - \--rsync-flags=_flags_
214
215     Specifies which _flags_ are appended to `rsync` command line when
216     copying files as a result of _\--server_ option.
217
218 - \--scons\[=scons command\]
219
220     Runs _scons_ to build files that are not generated by novaboot
221     itself.
222
223 - \--scriptmod=_perl expression_
224
225     When novaboot script is read, _perl expression_ is executed for every
226     line (in $\_ variable). For example, `novaboot
227     --scriptmod=s/sigma0/omega6/g` replaces every occurrence of _sigma0_
228     in the script with _omega6_.
229
230     When this option is present, it overrides _$script\_modifier_ variable
231     from the configuration file, which has the same effect. If this option
232     is given multiple times all expressions are evaluated in the command
233     line order.
234
235 - \--server\[=\[\[user@\]server:\]path\]
236
237     Copy all files needed for booting to a server (implies __\-g__ unless
238     __\--grub2__ is given). The files will be copied to the directory
239     _path_. If the _path_ contains string $NAME, it will be replaced
240     with the name of the novaboot script (see also __\--name__).
241
242     Additionally, if $NAME is the last component of the _path_, a file
243     named _path_/menu.lst (with $NAME removed from the _path_) will be
244     created on the server by concatenating all _path_/\*/menu.lst (with
245     $NAME removed from the _path_) files found on the server.
246
247 - \-s, --serial\[=device\]
248
249     Use serial line to control GRUB bootloader and to get the serial
250     output of the machine. The default value is /dev/ttyUSB0.
251
252 - \--strip-rom
253
254     Strip _rom://_ prefix from command lines and generated config files.
255     This is needed for NRE.
256
257 # NOVABOOT SCRIPT SYNTAX
258
259 The syntax tries to mimic POSIX shell syntax. The syntax is defined with the following rules.
260
261 Lines starting with "\#" are ignored.
262
263 Lines that end with "\\" are concatenated with the following line after
264 removal of the final "\\" and leading whitespace of the following line.
265
266 Lines in the form _VARIABLE=..._ (i.e. matching '^\[A-Z\_\]+=' regular
267 expression) assign values to internal variables. See VARIABLES
268 section.
269
270 Otherwise, the first word on the line represents the filename
271 (relative to the build directory (see _\--build-dir_) of the module to
272 load and the remaining words are passed as the command line
273 parameters.
274
275 When the line ends with "<<WORD" then the subsequent lines until the
276 line containing only WORD are copied literally to the file named on
277 that line.
278
279 When the line ends with "< CMD" the command CMD is executed with
280 `/bin/sh` and its standard output is stored in the file named on that
281 line. The SRCDIR variable in CMD's environment is set to the absolute
282 path of the directory containing the interpreted novaboot script.
283
284 Example:
285   \#!/usr/bin/env novaboot
286   WVDESC=Example program
287   bin/apps/sigma0.nul S0\_DEFAULT script\_start:1,1 \\
288     verbose hostkeyb:0,0x60,1,12,2
289   bin/apps/hello.nul
290   hello.nulconfig <<EOF
291   sigma0::mem:16 name::/s0/log name::/s0/timer name::/s0/fs/rom ||
292   rom://bin/apps/hello.nul
293   EOF
294
295 This example will load three modules: sigma0.nul, hello.nul and
296 hello.nulconfig. sigma0 gets some command line parameters and
297 hello.nulconfig file is generated on the fly from the lines between
298 <<EOF and EOF.
299
300 ## VARIABLES
301
302 The following variables are interpreted in the novaboot script:
303
304 - WVDESC
305
306     Description of the wvtest-compliant program.
307
308 - WVTEST\_TIMEOUT
309
310     The timeout in seconds for WvTest harness. If no complete line appears
311     in the test output within the time specified here, the test fails. It
312     is necessary to specify this for long running tests that produce no
313     intermediate output.
314
315 - QEMU\_FLAGS
316
317     Use specific qemu flags (can be overriden by __\-q__).
318
319 - HYPERVISOR\_PARAMS
320
321     Parameters passed to hypervisor. The default value is "serial", unless
322     overriden in configuration file.
323
324 - KERNEL
325
326     The kernel to use instead of NOVA hypervisor specified in the
327     configuration file. The value should contain the name of the kernel
328     image as well as its command line parameters. If this variable is
329     defined and non-empty, the variable HYPERVISOR\_PARAMS is not used.
330
331 # CONFIGURATION FILE
332
333 Novaboot can read its configuration from a file. Configuration file
334 was necessary in early days of novaboot. Nowadays, the attempt is made
335 to not use the configuration file because it makes certain novaboot
336 scripts unusable on systems without (or with different) configuration
337 file. The only recommended use of the configuration file is to specify
338 custom\_options (see bellow).
339
340 If you decide to use the configuration file, its default location is
341 ~/.novaboot, other location can be specified __\-c__ parameter or with
342 NOVABOOT\_CONFIG environment variable. The configuration has perl
343 syntax and sets values of certain variables. The current configuration
344 can be dumped with __\--dump-config__ switch. Some configuration
345 variables can be overriden by environment variables (see below) or by
346 command line switches.
347
348 Documentation of some configuration variables follows:
349
350 - @chainloaders
351
352     Custom chainloaders to load before hypervisor and files specified in
353     novaboot script. E.g. ('bin/boot/bender promisc', 'bin/boot/zapp').
354
355 - %custom\_options
356
357     Defines custom command line options that can serve as aliases for
358     other options. E.g. 'S' => '--server=boot:/tftproot
359     \--serial=/dev/ttyUSB0'.
360
361 # ENVIRONMENT VARIABLES
362
363 Some options can be specified not only via config file or command line
364 but also through environment variables. Environment variables override
365 the values from configuration file and command line parameters
366 override the environment variables.
367
368 - NOVABOOT\_CONFIG
369
370     A name of default novaboot configuration file.
371
372 - NOVABOOT\_BENDER
373
374     Defining this variable has the same meaning as __\--bender__ option.
375
376 - NOVABOOT\_IPRELAY
377
378     The IP address (and optionally the port) of the IP relay. This
379     overrides $iprelay\_addr variable from the configuration file.
380
381 # AUTHORS
382
383 Michal Sojka <sojka@os.inf.tu-dresden.de>