3 novaboot - A tool for booting various operating systems on various hardware or in qemu
7 __novaboot__ \[ options \] \[--\] script...
9 __./script__ \[ options \]
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
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.
29 With `novaboot` you can:
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.
39 ./script --server --iprelay
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.
45 3. Run DHCP and TFTP server on developer's machine to PXE-boot NOVA from
50 When a PXE-bootable machine is connected via Ethernet to developer's
51 machine, it will boot the configuration described in _script_.
53 4. Create bootable ISO images. E.g.
55 novaboot --iso -- script1 script2
57 The created ISO image will have GRUB bootloader installed on it and
58 the boot menu will allow selecting between _script1_ and _script2_
63 - \-a, --append=<parameters>
65 Appends a string to the root task's command line.
69 Boot bender tool before the kernel to find PCI serial ports.
71 - \--build-dir=<directory>
73 Overrides the default build directory location.
75 The default build directory location is determined as follows:
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.
84 - \-c, --config=<filename>
86 Use a different configuration file than the default one (i.e.
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.
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
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
105 Prints the content of the novaboot script after removing comments and
106 evaluating all _\--scriptmod_ expressions.
110 Dumps current configuration to stdout end exits. Useful as an initial
111 template for a configuration file.
113 - \-g, --grub\[=_filename_\]
115 Generates grub menu file. If the _filename_ is not specified,
116 `menu.lst` is used. The _filename_ is relative to NUL build
119 - \--grub-prefix=_prefix_
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
125 - \--grub2\[=_filename_\]
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.
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.
137 if [ -f /path/to/nul/build/grub.cfg ]; then
138 source /path/to/nul/build/grub.cfg
145 Print short (__\-h__) or long (__\--help__) help.
147 - \--iprelay\[=addr or cmd\]
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
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.
158 Note: This option is expected to work with HWG-ER02a IP relays.
160 - \-i, --iso\[=filename\]
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__).
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.
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.
180 Synonym for --iprelay=on/off.
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.
190 Do not generate files on the fly (i.e. "<" syntax) except for the
191 files generated via "<<WORD" syntax.
193 - \-p, --pulsar\[=mac\]
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.
199 - \-Q, --qemu=_qemu-binary_
201 Use specific version of qemu binary. The default is 'qemu'.
203 - \--qemu-append=_flags_
205 Append _flags_ to the default qemu flags (QEMU\_FLAGS variable or
206 `-cpu coreduo -smp 2`).
208 - \-q, --qemu-flags=_flags_
210 Replace the default qemu flags (QEMU\_FLAGS variable or `-cpu coreduo
211 -smp 2`) with _flags_ specified here.
213 - \--rsync-flags=_flags_
215 Specifies which _flags_ are appended to `rsync` command line when
216 copying files as a result of _\--server_ option.
218 - \--scons\[=scons command\]
220 Runs _scons_ to build files that are not generated by novaboot
223 - \--scriptmod=_perl expression_
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_.
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
235 - \--server\[=\[\[user@\]server:\]path\]
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__).
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.
247 - \-s, --serial\[=device\]
249 Use serial line to control GRUB bootloader and to get the serial
250 output of the machine. The default value is /dev/ttyUSB0.
254 Strip _rom://_ prefix from command lines and generated config files.
255 This is needed for NRE.
257 # NOVABOOT SCRIPT SYNTAX
259 The syntax tries to mimic POSIX shell syntax. The syntax is defined with the following rules.
261 Lines starting with "\#" are ignored.
263 Lines that end with "\\" are concatenated with the following line after
264 removal of the final "\\" and leading whitespace of the following line.
266 Lines in the form _VARIABLE=..._ (i.e. matching '^\[A-Z\_\]+=' regular
267 expression) assign values to internal variables. See VARIABLES
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
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
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.
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
290 hello.nulconfig <<EOF
291 sigma0::mem:16 name::/s0/log name::/s0/timer name::/s0/fs/rom ||
292 rom://bin/apps/hello.nul
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
302 The following variables are interpreted in the novaboot script:
306 Description of the wvtest-compliant program.
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
317 Use specific qemu flags (can be overriden by __\-q__).
321 Parameters passed to hypervisor. The default value is "serial", unless
322 overriden in configuration file.
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.
333 novaboot can read its configuration from ~/.novaboot file (or another
334 file specified with __\-c__ parameter or NOVABOOT\_CONFIG environment
335 variable). It is a file with perl syntax, which sets values of certain
336 variables. The current configuration can be dumped with
337 __\--dump-config__ switch. Use
339 novaboot --dump-config > ~/.novaboot
341 to create a default configuration file and modify it to your needs.
342 Some configuration variables can be overriden by environment variables
343 (see below) or by command line switches.
345 Documentation of some configuration variables follows:
349 Custom chainloaders to load before hypervisor and files specified in
350 novaboot script. E.g. ('bin/boot/bender promisc', 'bin/boot/zapp').
354 Defines custom command line options that can serve as aliases for
355 other options. E.g. 'S' => '--server=boot:/tftproot
356 \--serial=/dev/ttyUSB0'.
358 # ENVIRONMENT VARIABLES
360 Some options can be specified not only via config file or command line
361 but also through environment variables. Environment variables override
362 the values from configuration file and command line parameters
363 override the environment variables.
367 A name of default novaboot configuration file.
371 Defining this variable has the same meaning as __\--bender__ option.
375 The IP address (and optionally the port) of the IP relay. This
376 overrides $iprelay\_addr variable from the configuration file.
380 Michal Sojka <sojka@os.inf.tu-dresden.de>