# SYNOPSIS
-__novaboot__ --help
+**novaboot** --help
-__novaboot__ \[option\]... \[--\] script...
+**novaboot** \[option\]... \[--\] script...
-__./script__ \[option\]...
+**./script** \[option\]...
# DESCRIPTION
configurations.
Note that the options needed for a specific target can be stored in a
-["CONFIGURATION FILE"](#configuration-file). Then it is sufficient to use only the __-t__
+["CONFIGURATION FILE"](#configuration-file). Then it is sufficient to use only the **-t**
option to specify the name of the target.
# PHASES AND OPTIONS
- -h, --help
- Print short (__-h__) or long (__--help__) help.
+ Print short (**-h**) or long (**--help**) help.
- -t, --target=_target_
Generates grub bootloader menu file. If the _filename_ is not
specified, `menu.lst` is used. The _filename_ is relative to the
- build directory (see __--build-dir__).
+ build directory (see **--build-dir**).
- --grub-preamble=_prefix_
`menu.lst`. The default value is the absolute path to the build directory.
If the _prefix_ contains string $NAME, it will be replaced with the
- name of the novaboot script (see also __--name__).
+ name of the novaboot script (see also **--name**).
- --grub2\[=_filename_\]
Generate GRUB2 menuentry in _filename_. If _filename_ is not
specified `grub.cfg` is used. The content of the menuentry can be
- customized with __--grub-preable__, __--grub2-prolog__ or
- __--grub\_prefix__ options.
+ customized with **--grub-preable**, **--grub2-prolog** or
+ **--grub\_prefix** options.
In order to use the the generated menuentry on your development
machine that uses GRUB2, append the following snippet to
- --stty=_settings_
Specifies settings passed to `stty` invoked on the serial line
- specified with __--serial__ option. If this option is not given,
+ specified with **--serial** option. If this option is not given,
`stty` is called with `raw -crtscts -onlcr 115200` settings.
- --remote-cmd=_cmd_
Generates the ISO image that boots NOVA system via GRUB. If no filename
is given, the image is stored under _NAME_.iso, where _NAME_ is the name
- of the novaboot script (see also __--name__).
+ of the novaboot script (see also **--name**).
- --server\[=\[\[user@\]server:\]path\]
- Copy all files needed for booting to another location (implies __-g__
- unless __--grub2__ is given). The files will be copied (by __rsync__
+ Copy all files needed for booting to another location (implies **-g**
+ unless **--grub2** is given). The files will be copied (by **rsync**
tool) to the directory _path_. If the _path_ contains string $NAME,
it will be replaced with the name of the novaboot script (see also
- __--name__).
+ **--name**).
- --concat
- If __--server__ is used and its value ends with $NAME, then after
+ If **--server** is used and its value ends with $NAME, then after
copying the files, a new bootloader configuration file (e.g. menu.lst)
- is created at _path-wo-name_, i.e. the path specified by __--server__
+ is created at _path-wo-name_, i.e. the path specified by **--server**
with $NAME part removed. The content of the file is created by
concatenating all files of the same name from all subdirectories of
_path-wo-name_ found on the "server".
- --on, --off
Switch on/off the target machine and exit. The script (if any) is
- completely ignored. Currently it works only with __--iprelay__ or
- __--amt__.
+ completely ignored. Currently it works only with **--iprelay** or
+ **--amt**.
- -Q, --qemu\[=_qemu-binary_\]
When _string_ is sent by the target, novaboot exits. This option can
be specified multiple times.
- If _string_ is `-re`, then the next __--exiton__'s _string_ is
+ If _string_ is `-re`, then the next **--exiton**'s _string_ is
treated as regular expression. For example:
--exiton -re --exiton 'error:.*failed'
- --expect=_string_
When _string_ is received from the target, send the string specified
- with the subsequent __--send\*__ option to the target.
+ with the subsequent **--send\*** option to the target.
- --expect-re=_regex_
When target's output matches regular expression _regex_, send the
- string specified with the subsequent __--send\*__ option to the target.
+ string specified with the subsequent **--send\*** option to the target.
- --expect-raw=_perl-code_
- --send=_string_
Send _string_ to the target after the previously specified
- __--expect\*__ was matched in the target's output. The _string_ may
+ **--expect\*** was matched in the target's output. The _string_ may
contain escape sequences such as "\\n".
Note that _string_ is actually interpreted by Perl, so it can contain
- --sendcont=_string_
- Similar to __--send__ but continue expecting more input.
+ Similar to **--send** but continue expecting more input.
Example: `--expect='Continue?' --sendcont='yes\n'`
Lines starting with `load` keyword represent modules to boot. The
word after `load` is a file name (relative to the build directory
-(see __--build-dir__) of the module to load and the remaining words are
+(see **--build-dir**) of the module to load and the remaining words are
passed to it as the command line parameters.
When the `load` line ends with "<<WORD" then the subsequent lines
- QEMU
- Use a specific qemu binary (can be overridden with __-Q__) and flags
+ Use a specific qemu binary (can be overridden with **-Q**) and flags
when booting this script under qemu. If QEMU\_FLAGS variable is also
specified flags specified in QEMU variable are replaced by those in
QEMU\_FLAGS.
- QEMU\_FLAGS
- Use specific qemu flags (can be overridden with __-q__).
+ Use specific qemu flags (can be overridden with **-q**).
- WVDESC
Novaboot can read its configuration from one or more files. By
default, novaboot looks for files named `.novaboot` as described in
["Configuration reading phase"](#configuration-reading-phase). Alternatively, its location can be
-specified with the __-c__ switch or with the NOVABOOT\_CONFIG
+specified with the **-c** switch or with the NOVABOOT\_CONFIG
environment variable. The configuration file has perl syntax and
should set values of certain Perl variables. The current configuration
-can be dumped with the __--dump-config__ switch. Some configuration
+can be dumped with the **--dump-config** switch. Some configuration
variables can be overridden by environment variables (see below) or by
command line switches.
- $default\_target
Default target (see below) to use when no target is explicitly
- specified on command line with the __--target__ option.
+ specified on command line with the **--target** option.
- %targets
- Hash of shortcuts to be used with the __--target__ option. If the hash
+ Hash of shortcuts to be used with the **--target** option. If the hash
contains, for instance, the following pair of values
'mybox' => '--server=boot:/tftproot --serial=/dev/ttyUSB0 --grub',
- NOVABOOT\_BENDER
- Defining this variable has the same meaning as __--bender__ option.
+ Defining this variable has the same meaning as **--bender** option.
# AUTHORS
return $filename;
}
+sub generate_syslinux_config($$$$)
+{
+ my ($filename, $title, $base, $modules_ref) = @_;
+ if ($base && $base !~ /\/$/) { $base = "$base/"; };
+ open(my $fg, '>', $filename) or die "$filename: $!";
+ print $fg "LABEL $title\n";
+ #TODO print $fg "MENU LABEL $human_readable_title\n";
+ print $fg "KERNEL mboot.c32\n";
+
+ my @append;
+ foreach (@$modules_ref) {
+ s|\brom://([^ ]*)|$rom_prefix$base$1|g; # Translate rom:// files - needed for vdisk parameter of sigma0
+ push @append, "$base$_";
+ }
+ print $fg "APPEND ".join(' --- ', @append)."\n";
+ #TODO print $fg "TEXT HELP\n";
+ #TODO print $fg "some help here\n";
+ #TODO print $fg "ENDTEXT\n";
+ close($fg);
+ print("novaboot: Created $builddir/$filename\n");
+ return $filename;
+}
+
sub generate_grub2_config($$$$;$$)
{
my ($filename, $title, $base, $modules_ref, $preamble, $prolog) = @_;
if (defined $iso_image) {
generate_configs("(cd)", $generated, $filename);
my $menu;
- generate_grub_config(\$menu, $config_name, "(cd)", $modules);
+ generate_syslinux_config(\$menu, $config_name, "/", $modules);
$menu_iso .= "$menu\n";
map { ($file,undef) = split; $files_iso{$file} = 1; } @$modules;
}
## Generate ISO image
if (defined $iso_image) {
- open(my $fh, ">menu-iso.lst");
- print $fh "timeout 5\n\n$menu_iso";
+ system_verbose("mkdir -p isolinux");
+ system_verbose('cp /usr/lib/syslinux/isolinux.bin /usr/lib/syslinux/mboot.c32 /usr/lib/syslinux/menu.c32 isolinux');
+ open(my $fh, ">isolinux/isolinux.cfg");
+ if ($#scripts) {
+ print $fh "TIMEOUT 50\n";
+ print $fh "DEFAULT menu\n";
+ } else {
+ print $fh "DEFAULT $config_name\n";
+ }
+ print $fh "$menu_iso";
close($fh);
- my $files = "boot/grub/menu.lst=menu-iso.lst " . join(" ", map("$_=$_", keys(%files_iso)));
+
+ my $files = join(" ", map("$_=$_", (keys(%files_iso), 'isolinux/isolinux.bin', 'isolinux/isolinux.cfg', 'isolinux/mboot.c32', 'isolinux/menu.c32')));
$iso_image ||= "$config_name.iso";
- system_verbose("$CFG::genisoimage -R -b stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -hide-rr-moved -J -joliet-long -o $iso_image -graft-points bin/boot/grub/ $files");
+
+ # Note: We use -U flag below to "Allow 'untranslated' filenames,
+ # completely violating the ISO9660 standards". Without this
+ # option, isolinux is not able to read files names for example
+ # bzImage-3.0.
+ system_verbose("$CFG::genisoimage -R -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -hide-rr-moved -U -o $iso_image -graft-points $files");
print("ISO image created: $builddir/$iso_image\n");
}