]> rtime.felk.cvut.cz Git - novaboot.git/commitdiff
Move implementation of --chainloader and --bender to where it is documented
authorMichal Sojka <sojkam1@fel.cvut.cz>
Sun, 19 Jan 2014 13:51:03 +0000 (14:51 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Sun, 19 Jan 2014 13:51:03 +0000 (14:51 +0100)
i.e. Script preprocessing phase.

Also move --strip-rom documentation to section "File generation phase",
because it is implemented there.

README.md
novaboot
tests/Makefile
tests/novaboot.wv
tests/parser.wv

index 5162ba3cf4e0916a175e513b8f3e0452cc6bfe5e..823474f9f22ca417e33bbf1d110418eeb3b4194f 100644 (file)
--- a/README.md
+++ b/README.md
@@ -131,9 +131,9 @@ used in the later phases.
 
 - \--dump
 
-    Print the modules to boot and their parameters. This happens after
-    parsing the novaboot script, i.e. after evaluating all _\--scriptmod_
-    expressions etc. Exit after reading (and dumping) the script.
+    Print the modules to boot and their parameters after this phase
+    finishes. Then exit. This is useful for seeing the effect of other
+    options in this section.
 
 - \-k, --kernel=`file`
 
@@ -152,19 +152,14 @@ used in the later phases.
     is given multiple times all expressions are evaluated in the command
     line order.
 
-- \--strip-rom
-
-    Strip _rom://_ prefix from command lines and generated config files.
-    The _rom://_ prefix is used by NUL. For NRE, it has to be stripped.
-
 ## File generation phase
 
 In this phase, files needed for booting are generated in a so called
-_build directory_ (see TODO). In most cases configuration for a
-bootloader is generated automatically by novaboot. It is also possible
-to generate other files using _heredoc_ or _"<"_ syntax in novaboot
-scripts. Finally, binaries can be generated in this phases by running
-`scons` or `make`.
+_build directory_ (see [--build-dir](https://metacpan.org/pod/--build-dir)). In most cases configuration
+for a bootloader is generated automatically by novaboot. It is also
+possible to generate other files using _heredoc_ or _"<"_ syntax in
+novaboot scripts. Finally, binaries can be generated in this phases by
+running `scons` or `make`.
 
 - \--build-dir=_directory_
 
@@ -244,6 +239,11 @@ scripts. Finally, binaries can be generated in this phases by running
     Runs `scons` to build files that are not generated by novaboot
     itself.
 
+- \--strip-rom
+
+    Strip _rom://_ prefix from command lines and generated config files.
+    The _rom://_ prefix is used by NUL. For NRE, it has to be stripped.
+
 - \--gen-only
 
     Exit novaboot after file generation phase.
index ec2a8b3e8368fa2bb6da44071ff708512b0009a9..e3c78d6d000a4e6a5b21b74ce56a1b42d43973c2 100755 (executable)
--- a/novaboot
+++ b/novaboot
@@ -291,13 +291,28 @@ while (<>) {
 # use Data::Dumper;
 # print Dumper(\@scripts);
 
-
 foreach my $script (@scripts) {
-    $$script{modules}[0] =~ s/^[^ ]*/$kernel_opt/ if $kernel_opt;
-    $$script{modules}[0] .= ' ' . join(' ', @append) if @append;
-}
-
+    $modules = $$script{modules};
+    @$modules[0] =~ s/^[^ ]*/$kernel_opt/ if $kernel_opt;
+    @$modules[0] .= ' ' . join(' ', @append) if @append;
 
+    my $kernel;
+    if (exists $variables->{KERNEL}) {
+       $kernel = $variables->{KERNEL};
+    } else {
+       if ($CFG::hypervisor) {
+           $kernel = $CFG::hypervisor . " ";
+           if (exists $variables->{HYPERVISOR_PARAMS}) {
+               $kernel .= $variables->{HYPERVISOR_PARAMS};
+           } else {
+               $kernel .= $CFG::hypervisor_params;
+           }
+       }
+    }
+    @$modules = ($kernel, @$modules) if $kernel;
+    @$modules = (@chainloaders, @$modules);
+    @$modules = ("bin/boot/bender", @$modules) if ($bender || defined $ENV{'NOVABOOT_BENDER'});
+}
 
 if ($dump_opt) {
     foreach my $script (@scripts) {
@@ -574,23 +589,6 @@ foreach my $script (@scripts) {
        print "novaboot: Entering directory `$builddir'\n";
     }
 
-    my $kernel;
-    if (exists $variables->{KERNEL}) {
-       $kernel = $variables->{KERNEL};
-    } else {
-       if ($CFG::hypervisor) {
-           $kernel = $CFG::hypervisor . " ";
-           if (exists $variables->{HYPERVISOR_PARAMS}) {
-               $kernel .= $variables->{HYPERVISOR_PARAMS};
-           } else {
-               $kernel .= $CFG::hypervisor_params;
-           }
-       }
-    }
-    @$modules = ($kernel, @$modules) if $kernel;
-    @$modules = (@chainloaders, @$modules);
-    @$modules = ("bin/boot/bender", @$modules) if ($bender || defined $ENV{'NOVABOOT_BENDER'});
-
     my $prefix;
     ($prefix = $grub_prefix) =~ s/\$NAME/$config_name/ if defined $grub_prefix;
     $prefix ||= $builddir;
@@ -998,9 +996,9 @@ in the novaboot script. E.g. 'bin/boot/bender promisc'.
 
 =item --dump
 
-Print the modules to boot and their parameters. This happens after
-parsing the novaboot script, i.e. after evaluating all I<--scriptmod>
-expressions etc. Exit after reading (and dumping) the script.
+Print the modules to boot and their parameters after this phase
+finishes. Then exit. This is useful for seeing the effect of other
+options in this section.
 
 =item -k, --kernel=F<file>
 
@@ -1019,21 +1017,16 @@ from the configuration file, which has the same effect. If this option
 is given multiple times all expressions are evaluated in the command
 line order.
 
-=item --strip-rom
-
-Strip I<rom://> prefix from command lines and generated config files.
-The I<rom://> prefix is used by NUL. For NRE, it has to be stripped.
-
 =back
 
 =head2 File generation phase
 
 In this phase, files needed for booting are generated in a so called
-I<build directory> (see TODO). In most cases configuration for a
-bootloader is generated automatically by novaboot. It is also possible
-to generate other files using I<heredoc> or I<"<"> syntax in novaboot
-scripts. Finally, binaries can be generated in this phases by running
-C<scons> or C<make>.
+I<build directory> (see L<--build-dir>). In most cases configuration
+for a bootloader is generated automatically by novaboot. It is also
+possible to generate other files using I<heredoc> or I<"<"> syntax in
+novaboot scripts. Finally, binaries can be generated in this phases by
+running C<scons> or C<make>.
 
 =over 8
 
@@ -1115,6 +1108,11 @@ I<novaboot>.
 Runs C<scons> to build files that are not generated by novaboot
 itself.
 
+=item --strip-rom
+
+Strip I<rom://> prefix from command lines and generated config files.
+The I<rom://> prefix is used by NUL. For NRE, it has to be stripped.
+
 =item --gen-only
 
 Exit novaboot after file generation phase.
index 5a9f298d00a1273b09cc45e79d2317256e48f942..bcd9f7d7e37a87729073c7feb2b66e7270690c45 100644 (file)
@@ -1,7 +1,7 @@
 all:
        ./wvtestrun $(MAKE) run-all
 
-run-all: novaboot.wv *.wv
+run-all: novaboot.wv parser.wv expect.wv *.wv
 
 .PHONY: $(wildcard *.wv)
 
index 0019185b4205f39e4957bec79de53bb83a82c7a5..03f8ae441e284f9444cfe93a506c2e7d42da4d07 100755 (executable)
@@ -19,17 +19,6 @@ create_dummy
 WVPASS ./script --gen-only --pulsar --pulsar-root=ASDF
 WVPASS grep "root ASDF" config-novaboot
 
-WVSTART Bender
-create_dummy
-WVPASS ./script --gen-only --bender --pulsar
-WVPASS grep "bender" config-novaboot
-
-WVSTART Chainloader support
-create_dummy
-WVPASS ./script --gen-only --chainloader=chain1 -chainloader=chain2 --pulsar
-WVPASS grep "exec chain1" config-novaboot
-WVPASS grep "load chain2" config-novaboot
-
 WVSTART Configuration files
 create_dummy
 echo '1;' > .novaboot
index 161fecb8335c910287ec4785cf4a6ea8fcd3eeb6..ff6384fd442f63b6fc875ed45f07335185d3924d 100755 (executable)
@@ -43,3 +43,22 @@ WVPASS diff -u - dump <<EOF
 new arg1 arg2
 file farg11
 EOF
+
+WVSTART --bender
+create_dummy
+WVPASS bash -c "./script --gen-only --bender --dump > dump"
+WVPASS diff -u - dump <<EOF
+bin/boot/bender
+kernel
+file
+EOF
+
+WVSTART --chainloader
+create_dummy
+WVPASS bash -c "./script --chainloader=chain1 -chainloader='chain2 arg' --dump > dump"
+WVPASS diff -u - dump <<EOF
+chain1
+chain2 arg
+kernel
+file
+EOF