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