]> rtime.felk.cvut.cz Git - novaboot.git/blob - README.pod
Do not run --uboot-cmd if it is empty string
[novaboot.git] / README.pod
1 =head1 NAME
2
3 novaboot - Boots a locally compiled operating system on a remote
4 target or in qemu
5
6 =head1 SYNOPSIS
7
8 B<novaboot> --help
9
10 B<novaboot> [option]... [--] script...
11
12 B<./script> [option]...
13
14 =head1 DESCRIPTION
15
16 This program makes booting of a locally compiled operating system (OS)
17 (e.g. NOVA or Linux) on remote targets as simple as running a program
18 locally. It automates things like copying OS images to a TFTP server,
19 generation of bootloader configuration files, resetting of target
20 hardware or redirection of target's serial line to stdin/out. Novaboot
21 is highly configurable and it makes it easy to boot a single image on
22 different targets or different images on a single target.
23
24 Novaboot operation is controlled by command line options and by a so
25 called novaboot script, which can be thought as a generalization of
26 bootloader configuration files (see L</"NOVABOOT SCRIPT SYNTAX">).
27 Typical way of using novaboot is to make the novaboot script
28 executable and set its first line to I<#!/usr/bin/env novaboot>. Then,
29 booting a particular OS configuration becomes the same as executing a
30 local program - the novaboot script.
31
32 Novaboot uses configuration files to, among other things, define
33 command line options needed for different targets. Users typically use
34 only the B<-t>/B<--target> command line option to select the target.
35 Internally, this option expands to the pre-configured options.
36 Configuration files are searched at multiple places, which allows to
37 have per-system, per-user or per-project configurations. Configuration
38 file syntax is described in section L</"CONFIGURATION FILES">.
39
40 Simple examples of using C<novaboot>:
41
42 =over 3
43
44 =item 1.
45
46 Run an OS in Qemu. This is can be specified with the B<--qemu> option.
47 Thus running C<novaboot --qemu myos> (or C<./myos --qemu> as described
48 above) will run Qemu and make it boot the configuration specified in
49 the F<myos> script.
50
51 =item 2.
52
53 Create a bootloader configuration file (currently supported
54 bootloaders are GRUB, GRUB2, ISOLINUX, Pulsar and U-Boot) and copy it
55 with all other files needed for booting to a remote boot server. Then
56 use a TCP/IP-controlled relay/serial-to-TCP converter to reset the
57 target and receive its serial output.
58
59  ./myos --grub2 --server=192.168.1.1:/tftp --iprelay=192.168.1.2
60
61 =item 3.
62
63 Run DHCP and TFTP server on developer's machine to boot the target
64 from it.
65
66  ./myos --dhcp-tftp
67
68 This is useful when no network infrastructure is in place and
69 the target is connected directly to developer's box.
70
71 =item 4.
72
73 Create bootable ISO image.
74
75  novaboot --iso -- script1 script2
76
77 The created ISO image will have ISOLINUX bootloader installed on it
78 and the boot menu will allow selecting between I<script1> and
79 I<script2> configurations.
80
81 =back
82
83 =head1 PHASES AND OPTIONS
84
85 Novaboot performs its work in several phases. Each phase can be
86 influenced by several command line options, certain phases can be
87 skipped. The list of phases (in the execution order) is as follows.
88
89 =over
90
91 =item 1. L<Configuration reading|/Configuration reading phase>
92
93 =item 2. L<Command line processing|/Command line processing phase>
94
95 =item 3. L<Script preprocessing|/Script preprocessing phase>
96
97 =item 4. L<File generation|/File generation phase>
98
99 =item 5. L<Target connection|/Target connection check>
100
101 =item 6. L<File deployment|/File deployment phase>
102
103 =item 7. L<Target power-on and reset|/Target power-on and reset phase>
104
105 =item 8. L<Interaction with the bootloader|/Interaction with the bootloader on the target>
106
107 =item 9. L<Target interaction|/Target interaction phase>
108
109 =back
110
111 Each phase is described in the following sections together with the
112 command line options that control it.
113
114 =head2 Configuration reading phase
115
116 After starting, novaboot reads configuration files. Their content is
117 described in section L</"CONFIGURATION FILES">. By default,
118 configuration is read from multiple locations. First from the system
119 configuration directory (F</etc/novaboot.d/>), second from the user
120 configuration file (F<~/.config/novaboot>) and third from F<.novaboot>
121 files along the path to the current directory. Alternatively, a single
122 configuration file specified with the B<-c> switch or with the
123 C<NOVABOOT_CONFIG> environment variable is read. The latter read files
124 override settings from the former ones.
125
126 The system configuration directory is determined by the content of
127 NOVABOOT_CONFIG_DIR environment variable and defaults to
128 F</etc/novaboot.d>. Files in this directory with names consisting
129 solely of English letters, numbers, dashes '-' and underscores '_'
130 (note that dot '.' is not included) are read in alphabetical order.
131
132 Then, the user configuration file is read from
133 F<$XDG_CONFIG_HOME/novaboot>. If C<$XDG_CONFIG_HOME> environemnt
134 variable is not set F<~/.config/novaboot> is read instead.
135
136 Finally, novaboot searches for files named F<.novaboot> starting from the
137 directory of the novaboot script (or working directory, see bellow)
138 and continuing upwards up to the root directory. The found
139 configuration files are then read in the opposite order (i.e. from the
140 root directory downwards). This allows to have, for example, a project
141 specific configuration in F<~/project/.novaboot>.
142
143 Note the difference between F<~/.config/novaboot> and F<~/.novaboot>.
144 The former one is read always, whereas the latter only when novaboot
145 script or working directory is under the C<$HOME> directory.
146
147 In certain cases, the location of the novaboot script cannot be
148 determined in this early phase. This happens either when the script is
149 read from the standard input or when novaboot is invoked explicitly as
150 in the example L</"4."> above. In this case the current working
151 directory is used as a starting point for configuration file search
152 instead of the novaboot script directory.
153
154 =over 8
155
156 =item -c, --config=I<filename>
157
158 Use the specified configuration file instead of the default one(s).
159
160 =back
161
162 =head2 Command line processing phase
163
164 =over 8
165
166 =item --dump-config
167
168 Dump the current configuration to stdout end exit. Useful as an
169 initial template for a configuration file.
170
171 =item -h, --help
172
173 Print short (B<-h>) or long (B<--help>) help.
174
175 =item -t, --target=I<target>
176
177 This option serves as a user configurable shortcut for other novaboot
178 options. The effect of this option is the same as specifying the
179 options stored in the C<%targets> configuration variable under key
180 I<target>. See also L</"CONFIGURATION FILES">.
181
182 When this option is not given, novaboot tries to determine the target
183 to use from either B<NOVABOOT_TARGET> environment variable or from
184 B<$default_target> configuration file variable.
185
186 =back
187
188 =head2 Script preprocessing phase
189
190 This phases allows to modify the parsed novaboot script before it is
191 used in the later phases.
192
193 =over 8
194
195 =item -a, --append=I<parameters>
196
197 Append a string to the first C<load> line in the novaboot script. This
198 can be used to append parameters to the kernel's or root task's
199 command line. This option can appear multiple times.
200
201 =item -b, --bender
202
203 Use F<bender> chainloader. Bender scans the PCI bus for PCI serial
204 ports and stores the information about them in the BIOS data area for
205 use by the kernel.
206
207 =item --chainloader=I<chainloader>
208
209 Specifies a chainloader that is loaded before the kernel and other
210 files specified in the novaboot script. E.g. 'bin/boot/bender
211 promisc'.
212
213 =item --dump
214
215 Print the modules to boot and their parameters after this phase
216 finishes. Then exit. This is useful for seeing the effect of other
217 options in this section.
218
219 =item -k, --kernel=F<file>
220
221 Replace the first word on the first C<load> line in the novaboot
222 script with F<file>.
223
224 =item --scriptmod=I<perl expression>
225
226 When novaboot script is read, I<perl expression> is executed for every
227 line (in $_ variable). For example, C<novaboot
228 --scriptmod=s/sigma0/omega6/g> replaces every occurrence of I<sigma0>
229 in the script with I<omega6>.
230
231 When this option is present, it overrides I<$script_modifier> variable
232 from the configuration file, which has the same effect. If this option
233 is given multiple times all expressions are evaluated in the command
234 line order.
235
236 =back
237
238 =head2 File generation phase
239
240 In this phase, files needed for booting are generated in a so called
241 I<build directory> (see L</--build-dir>). In most cases configuration
242 for a bootloader is generated automatically by novaboot. It is also
243 possible to generate other files using I<heredoc> or I<"<"> syntax in
244 novaboot scripts. Finally, binaries can be generated in this phases by
245 running C<scons> or C<make>.
246
247 =over 8
248
249 =item --build-dir=I<directory>
250
251 Overrides the default build directory location.
252
253 The default build directory location is determined as follows: If the
254 configuration file defines the C<$builddir> variable, its value is
255 used. Otherwise, it is the directory that contains the first processed
256 novaboot script.
257
258 See also L</BUILDDIR> variable.
259
260 =item -g, --grub[=I<filename>]
261
262 Generates grub bootloader menu file. If the I<filename> is not
263 specified, F<menu.lst> is used. The I<filename> is relative to the
264 build directory (see B<--build-dir>).
265
266 =item --grub-preamble=I<prefix>
267
268 Specifies the I<preable> that is at the beginning of the generated
269 GRUB or GRUB2 config files. This is useful for specifying GRUB's
270 timeout.
271
272 =item --prefix=I<prefix>
273
274 Specifies I<prefix> (e.g. F</srv/tftp>) that is put in front of every
275 file name in generated bootloader configuration files (or in U-Boot
276 commands).
277
278 If the I<prefix> contains string $NAME, it will be replaced with the
279 name of the novaboot script (see also B<--name>).
280
281 If the I<prefix> contains string $BUILDDIR, it will be replaced with
282 the build directory (see also B<--build-dir>).
283
284 =item --grub-prefix
285
286 Alias for B<--prefix>.
287
288 =item --grub2[=I<filename>]
289
290 Generate GRUB2 menu entry in I<filename>. If I<filename> is not
291 specified F<grub.cfg> is used. The content of the menu entry can be
292 customized with B<--grub-preamble>, B<--grub2-prolog> or
293 B<--grub_prefix> options.
294
295 In order to use the the generated menu entry on your development
296 machine that uses GRUB2, append the following snippet to
297 F</etc/grub.d/40_custom> file and regenerate your grub configuration,
298 i.e. run update-grub on Debian/Ubuntu.
299
300   if [ -f /path/to/nul/build/grub.cfg ]; then
301     source /path/to/nul/build/grub.cfg
302   fi
303
304 =item --grub2-prolog=I<prolog>
305
306 Specifies text that is put at the beginning of the GRUB2 menu entry.
307
308 =item -m, --make[=make command]
309
310 Runs C<make> to build files that are not generated by novaboot itself.
311
312 =item --name=I<string>
313
314 Use the name I<string> instead of the name of the novaboot script.
315 This name is used for things like a title of grub menu or for the
316 server directory where the boot files are copied to.
317
318 =item --no-file-gen
319
320 Do not run external commands to generate files (i.e. "<" syntax and
321 C<run> keyword). This switch does not influence generation of files
322 specified with "<<WORD" syntax.
323
324 =item -p, --pulsar[=mac]
325
326 Generates pulsar bootloader configuration file named F<config-I<mac>>
327 The I<mac> string is typically a MAC address and defaults to
328 I<novaboot>.
329
330 =item --scons[=scons command]
331
332 Runs C<scons> to build files that are not generated by novaboot
333 itself.
334
335 =item --strip-rom
336
337 Strip I<rom://> prefix from command lines and generated config files.
338 The I<rom://> prefix is used by NUL. For NRE, it has to be stripped.
339
340 =item --gen-only
341
342 Exit novaboot after file generation phase.
343
344 =back
345
346 =head2 Target connection check
347
348 If supported by the target, the connection to it is made and it is
349 checked whether the target is not occupied by another novaboot
350 user/instance.
351
352 =over 8
353
354 =item --amt=I<"[user[:password]@]host[:port]>
355
356 Use Intel AMT technology to control the target machine. WS management
357 is used to powercycle it and Serial-Over-Lan (SOL) for input/output.
358 The hostname or (IP address) is given by the I<host> parameter. If
359 I<password> is not specified, environment variable AMT_PASSWORD is
360 used. The I<port> specifies a TCP port for SOL. If not specified, the
361 default is 16992. Default I<user> is admin.
362
363 =item --iprelay=I<addr[:port]>
364
365 Use TCP/IP relay and serial port to access the target's serial port
366 and powercycle it. The IP address of the relay is given by I<addr>
367 parameter. If I<port> is not specified, it default to 23.
368
369 Note: This option is supposed to work with HWG-ER02a IP relays.
370
371 =item -s, --serial[=device]
372
373 Target's serial line is connected to host's serial line (device). The
374 default value for device is F</dev/ttyUSB0>.
375
376 The value of this option is exported in NB_NOVABOOT environment
377 variable to all subprocesses run by C<novaboot>.
378
379 =item --stty=I<settings>
380
381 Specifies settings passed to C<stty> invoked on the serial line
382 specified with B<--serial> option. If this option is not given,
383 C<stty> is called with C<raw -crtscts -onlcr 115200> settings.
384
385 =item --remote-cmd=I<cmd>
386
387 Command that mediates connection to the target's serial line. For
388 example C<ssh server 'cu -l /dev/ttyS0'>.
389
390 =item --remote-expect=I<string>
391
392 Wait for reception of I<string> after establishing the remote
393 connection.
394
395 =item --remote-expect-silent=I<string>
396
397 The same as B<--remote-expect> except that the remote output is not
398 echoed to stdout while waiting for the I<string>. Everything after the
399 matched string is printed to stdout, so you may want to include line
400 end characters in the I<string> as well.
401
402 =back
403
404 =head2 File deployment phase
405
406 In some setups, it is necessary to copy the files needed for booting
407 to a particular location, e.g. to a TFTP boot server or to the
408 F</boot> partition.
409
410 =over 8
411
412 =item -d, --dhcp-tftp
413
414 Turns your workstation into a DHCP and TFTP server so that the OS can
415 be booted via PXE BIOS (or similar mechanism) on the test machine
416 directly connected by a plain Ethernet cable to your workstation.
417
418 The DHCP and TFTP servers requires root privileges and C<novaboot>
419 uses C<sudo> command to obtain those. You can put the following to
420 I</etc/sudoers> to allow running the necessary commands without asking
421 for password.
422
423  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 --listen --secure -v -v -v --pidfile tftpd.pid *, /usr/bin/touch dhcpd.leases, /usr/bin/pkill --pidfile=dhcpd.pid, /usr/bin/pkill --pidfile=tftpd.pid
424  your_login ALL=NOPASSWD: NOVABOOT
425
426 =item --tftp
427
428 Starts a TFTP server on your workstation. This is similar to
429 B<--dhcp-tftp> except that DHCP server is not started.
430
431 The TFTP server require root privileges and C<novaboot> uses C<sudo>
432 command to obtain those. You can put the following to I</etc/sudoers>
433 to allow running the necessary commands without asking for password.
434
435  Cmnd_Alias NOVABOOT =  /usr/sbin/in.tftpd --listen --secure -v -v -v --pidfile tftpd.pid *, /usr/bin/pkill --pidfile=tftpd.pid
436  your_login ALL=NOPASSWD: NOVABOOT
437
438 =item --tftp-port=I<port>
439
440 Port to run the TFTP server on. Implies B<--tftp>.
441
442 =item --netif=I<network interface>
443
444 Network interface used to deploy files to the target. Default value is
445 I<eth0>. This influences the configuration of the DHCP server started
446 by B<--dhcp-tftp> and the value that B<$NB_MYIP> get replaced with in
447 U-Boot conversation.
448
449 =item --iso[=filename]
450
451 Generates the ISO image that boots NOVA system via GRUB. If no filename
452 is given, the image is stored under I<NAME>.iso, where I<NAME> is the name
453 of the novaboot script (see also B<--name>).
454
455 =item --server[=[[user@]server:]path]
456
457 Copy all files needed for booting to another location. The files will
458 be copied (by B<rsync> tool) to the directory I<path>. If the I<path>
459 contains string $NAME, it will be replaced with the name of the
460 novaboot script (see also B<--name>).
461
462 =item --rsync-flags=I<flags>
463
464 Specifies which I<flags> are appended to F<rsync> command line when
465 copying files as a result of I<--server> option.
466
467 =item --concat
468
469 If B<--server> is used and its value ends with $NAME, then after
470 copying the files, a new bootloader configuration file (e.g. menu.lst)
471 is created at I<path-wo-name>, i.e. the path specified by B<--server>
472 with $NAME part removed. The content of the file is created by
473 concatenating all files of the same name from all subdirectories of
474 I<path-wo-name> found on the "server".
475
476 =item --ider
477
478 Use Intel AMT technology for IDE redirection. This allows the target
479 machine to boot from novaboot created ISO image. Implies B<--iso>.
480
481 The experimental C<amtider> utility needed by this option can be
482 obtained from https://github.com/wentasah/amtterm.
483
484 =back
485
486 =head2 Target power-on and reset phase
487
488 At this point, the target is reset (or switched on/off). There is
489 several ways how this can be accomplished. Resetting a physical target
490 can currently be accomplished by the following options: B<--amt>,
491 B<--iprelay>, B<--reset-cmd>.
492
493 =over 8
494
495 =item --on, --off
496
497 Switch on/off the target machine and exit. The script (if any) is
498 completely ignored. Currently it works only with B<--iprelay> or
499 B<--amt>.
500
501 =item -Q, --qemu[=I<qemu-binary>]
502
503 Boot the configuration in qemu. Optionally, the name of qemu binary
504 can be specified as a parameter.
505
506 =item --qemu-append=I<flags>
507
508 Append I<flags> to the default qemu flags (QEMU_FLAGS variable or
509 C<-cpu coreduo -smp 2>).
510
511 =item -q, --qemu-flags=I<flags>
512
513 Replace the default qemu flags (QEMU_FLAGS variable or C<-cpu coreduo
514 -smp 2>) with I<flags> specified here.
515
516 =item --reset-cmd=I<cmd>
517
518 Command that resets the target.
519
520 =item --no-reset, --reset
521
522 Disable/enable resetting of the target.
523
524 =back
525
526 =head2 Interaction with the bootloader on the target
527
528 =over 8
529
530 =item --uboot[=I<prompt>]
531
532 Interact with U-Boot bootloader to boot the thing described in the
533 novaboot script. I<prompt> specifies the U-Boot's prompt (default is
534 "=> ", other common prompts are "U-Boot> " or "U-Boot# ").
535 Implementation of this option is currently tied to a particular board
536 that we use. It may be subject to changes in the future!
537
538 =item --no-uboot
539
540 Disable U-Boot interaction previously enabled with B<--uboot>.
541
542 =item --uboot-init
543
544 Command(s) to send the U-Boot bootloader before loading the images and
545 booting them. This option can be given multiple times. After sending
546 commands from each option novaboot waits for U-Boot I<prompt>.
547
548 If the command contains string I<$NB_MYIP> then this string is
549 replaced by IPv4 address of eth0 interface (see also B<--netif>).
550 Similarly I<$NB_PREFIX> is replaced with prefix given by B<--prefix>.
551
552 See also C<uboot> keyword in L</"NOVABOOT SCRIPT SYNTAX">).
553
554 =item --uboot-addr I<name>=I<address>
555
556 Load address of U-Boot's C<tftpboot> command for loading I<name>,
557 where name is one of I<kernel>, I<ramdisk> or I<fdt> (flattened device
558 tree).
559
560 The default addresses are ${I<name>_addr_r}, i.e. U-Boot environment
561 variables used by convention for this purpose.
562
563 =item --uboot-cmd=I<command>
564
565 Specifies U-Boot command used to execute the OS. If the command
566 contains strings C<$kernel_addr>, C<$ramdisk_addr>, C<$fdt_addr>,
567 these are replaced with the addresses configured with B<--uboot-addr>.
568
569 The default value is
570
571     bootm $kernel_addr $ramdisk_addr $fdt_addr
572
573 or the C<UBOOT_CMD> variable if defined in the novaboot script.
574
575 =back
576
577 =head2 Target interaction phase
578
579 In this phase, target's serial output is redirected to stdout and if
580 stdin is a TTY, it is redirected to the target's serial input allowing
581 interactive work with the target.
582
583 =over 8
584
585 =item --exiton=I<string>
586
587 When I<string> is sent by the target, novaboot exits. This option can
588 be specified multiple times, in which case novaboot exits whenever
589 either of the specified strings is sent.
590
591 If I<string> is C<-re>, then the next B<--exiton>'s I<string> is
592 treated as regular expression. For example:
593
594     --exiton -re --exiton 'error:.*failed'
595
596 =item --exiton-re=I<regex>
597
598 The same as --exiton -re --exiton I<regex>.
599
600 =item --exiton-timeout=I<seconds>
601
602 By default B<--exiton> waits for the string match forever. When this
603 option is specified, "exiton" timeouts after the specifies number of
604 seconds and novaboot returns non-zero exit code.
605
606 =item -i, --interactive
607
608 Setup things for interactive use of target. Your terminal will be
609 switched to raw mode. In raw mode, your system does not process input
610 in any way (no echoing of entered characters, no interpretation
611 special characters). This, among others, means that Ctrl-C is passed
612 to the target and does no longer interrupt novaboot. Use "~~."
613 sequence to exit novaboot.
614
615 =item --no-interaction, --interaction
616
617 Skip resp. force target interaction phase. When skipped, novaboot exits
618 immediately when boot is initiated.
619
620 =item --expect=I<string>
621
622 When I<string> is received from the target, send the string specified
623 with the subsequent B<--send*> option to the target.
624
625 =item --expect-re=I<regex>
626
627 When target's output matches regular expression I<regex>, send the
628 string specified with the subsequent B<--send*> option to the target.
629
630 =item --expect-raw=I<perl-code>
631
632 Provides direct control over Perl's Expect module.
633
634 =item --send=I<string>
635
636 Send I<string> to the target after the previously specified
637 B<--expect*> was matched in the target's output. The I<string> may
638 contain escape sequences such as "\n".
639
640 Note that I<string> is actually interpreted by Perl, so it can contain
641 much more that escape sequences. This behavior may change in the
642 future.
643
644 Example: C<--expect='login: ' --send='root\n'>
645
646 =item --sendcont=I<string>
647
648 Similar to B<--send> but continue expecting more input.
649
650 Example: C<--expect='Continue?' --sendcont='yes\n'>
651
652 =item --final-eol, --no-final-eol
653
654 By default, B<novaboot> always prints an end-of-line character at the
655 end of its execution in order to ensure that the output of programs
656 started after novaboot appears at the beginning of the line. When this
657 is not desired B<--no-final-eol> option can be used to override this
658 behavior.
659
660 =back
661
662 =head1 NOVABOOT SCRIPT SYNTAX
663
664 The syntax tries to mimic POSIX shell syntax. The syntax is defined
665 with the following rules.
666
667 Lines starting with "#" and empty lines are ignored.
668
669 Lines that end with "\" are concatenated with the following line after
670 removal of the final "\" and leading whitespace of the following line.
671
672 Lines of the form I<VARIABLE=...> (i.e. matching '^[A-Z_]+=' regular
673 expression) assign values to internal variables. See L</VARIABLES>
674 section.
675
676 Lines starting with C<load> keyword represent modules to boot. The
677 word after C<load> is a file name (relative to the build directory
678 (see B<--build-dir>) of the module to load and the remaining words are
679 passed to it as the command line parameters.
680
681 When the C<load> line ends with "<<WORD" then the subsequent lines
682 until the line containing solely WORD are copied literally to the file
683 named on that line. This is similar to shell's heredoc feature.
684
685 When the C<load> line ends with "< CMD" then command CMD is executed
686 with F</bin/sh> and its standard output is stored in the file named on
687 that line. The SRCDIR variable in CMD's environment is set to the
688 absolute path of the directory containing the interpreted novaboot
689 script.
690
691 Lines starting with C<run> keyword contain shell commands that are run
692 during file generation phase. This is the same as the "< CMD" syntax
693 for C<load> keyboard except that the command's output is not
694 redirected to a file. The ordering of commands is the same as they
695 appear in the novaboot script.
696
697 Lines starting with C<uboot> represent U-Boot commands that are sent
698 to the target if B<--uboot> option is given. Having a U-Boot line in
699 the novaboot script is the same as passing an equivalent
700 B<--uboot-init> option to novaboot. The C<uboot> keyword can be
701 suffixed with timeout specification. The syntax is C<uboot:Ns>, where
702 C<N> is the whole number of seconds. If the U-Boot command prompt does
703 not appear before the timeout, novaboot fails. The default timeout is
704 10 seconds.
705
706 Example (Linux):
707
708   #!/usr/bin/env novaboot
709   load bzImage console=ttyS0,115200
710   run  make -C buildroot
711   load rootfs.cpio < gen_cpio buildroot/images/rootfs.cpio "myapp->/etc/init.d/S99myapp"
712
713 Example (NOVA User Land - NUL):
714
715   #!/usr/bin/env novaboot
716   WVDESC=Example program
717   load bin/apps/sigma0.nul S0_DEFAULT script_start:1,1 \
718                            verbose hostkeyb:0,0x60,1,12,2
719   load bin/apps/hello.nul
720   load hello.nulconfig <<EOF
721   sigma0::mem:16 name::/s0/log name::/s0/timer name::/s0/fs/rom ||
722   rom://bin/apps/hello.nul
723   EOF
724
725 This example will load three modules: F<sigma0.nul>, F<hello.nul> and
726 F<hello.nulconfig>. sigma0 receives some command line parameters and
727 F<hello.nulconfig> file is generated on the fly from the lines between
728 C<<<EOF> and C<EOF>.
729
730 =head2 VARIABLES
731
732 The following variables are interpreted in the novaboot script:
733
734 =over 8
735
736 =item BUILDDIR
737
738 Novaboot chdir()s to this directory before file generation phase. The
739 directory name specified here is relative to the build directory
740 specified by other means (see L</--build-dir>).
741
742 =item EXITON
743
744 Assigning this variable has the same effect as specifying L</--exiton>
745 option.
746
747 =item HYPERVISOR_PARAMS
748
749 Parameters passed to hypervisor. The default value is "serial", unless
750 overridden in configuration file.
751
752 =item KERNEL
753
754 The kernel to use instead of the hypervisor specified in the
755 configuration file with the C<$hypervisor> variable. The value should
756 contain the name of the kernel image as well as its command line
757 parameters. If this variable is defined and non-empty, the variable
758 HYPERVISOR_PARAMS is not used.
759
760 =item NO_BOOT
761
762 If this variable is 1, the system is not booted. This is currently
763 only implemented for U-Boot bootloader where it is useful for
764 interacting with the bootloader without booting the system - e.g. for
765 flashing.
766
767 =item QEMU
768
769 Use a specific qemu binary (can be overridden with B<-Q>) and flags
770 when booting this script under qemu. If QEMU_FLAGS variable is also
771 specified flags specified in QEMU variable are replaced by those in
772 QEMU_FLAGS.
773
774 =item QEMU_FLAGS
775
776 Use specific qemu flags (can be overridden with B<-q>).
777
778 =item UBOOT_CMD
779
780 See L</--uboot-cmd>.
781
782 =item WVDESC
783
784 Description of the WvTest-compliant program.
785
786 =item WVTEST_TIMEOUT
787
788 The timeout in seconds for WvTest harness. If no complete line appears
789 in the test output within the time specified here, the test fails. It
790 is necessary to specify this for long running tests that produce no
791 intermediate output.
792
793 =back
794
795 =head1 CONFIGURATION FILES
796
797 Novaboot can read its configuration from one or more files. By
798 default, novaboot looks for files in F</etc/novaboot.d>, file
799 F<~/.config/novaboot> and files named F<.novaboot> as described in
800 L</Configuration reading phase>. Alternatively, configuration file
801 location can be specified with the B<-c> switch or with the
802 NOVABOOT_CONFIG environment variable. The configuration file has Perl
803 syntax (i.e. it is better to put C<1;> as the last line) and should set
804 values of certain Perl variables. The current configuration can be
805 dumped with the B<--dump-config> switch. Some configuration variables
806 can be overridden by environment variables (see below) or by command
807 line switches.
808
809 Supported configuration variables include:
810
811 =over 8
812
813 =item $builddir
814
815 Build directory location relative to the location of the configuration
816 file.
817
818 =item $default_target
819
820 Default target (see below) to use when no target is explicitly
821 specified with the B<--target> command line option or
822 B<NOVABOOT_TARGET> environment variable.
823
824 =item %targets
825
826 Hash of target definitions to be used with the B<--target> option. The
827 key is the identifier of the target, the value is the string with
828 command line options. For instance, if the configuration file contains:
829
830  $targets{'mybox'} = '--server=boot:/tftproot --serial=/dev/ttyUSB0 --grub',
831
832 then the following two commands are equivalent:
833
834  ./myos --server=boot:/tftproot --serial=/dev/ttyUSB0 --grub
835  ./myos -t mybox
836
837 =back
838
839 =head1 ENVIRONMENT VARIABLES
840
841 Some options can be specified not only via config file or command line
842 but also through environment variables. Environment variables override
843 the values from configuration file and command line parameters
844 override the environment variables.
845
846 =over 8
847
848 =item NOVABOOT_CONFIG
849
850 Name of the novaboot configuration file to use instead of the default
851 one(s).
852
853 =item NOVABOOT_CONFIG_DIR
854
855 Name of the novaboot configuration directory. When not specified
856 F</etc/novaboot.d> is used.
857
858 =item NOVABOOT_TARGET
859
860 Name of the novaboot target to use. This overrides the value of
861 B<$default_target> from the configuration file and can be overriden
862 with the B<--target> command line option.
863
864 =item NOVABOOT_BENDER
865
866 Defining this variable has the same meaning as B<--bender> option.
867
868 =back
869
870 =head1 AUTHORS
871
872 Michal Sojka <sojka@os.inf.tu-dresden.de>
873