[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH OSSTEST 07/15] Refactor pxelinux configuration
The mechanism used to PXE boot can differ depending on the firmware type. Therefore refactor into Osstest::TestSupport and key off a new host property "firmware". Currently supported is "bios" (the default) and "uboot", both of which use pxelinux.cfg style files. The default for the firmware property is "bios", hence no change for any existing system (including those which use uboot, regardless of whether they are now configured with the firmware proprty or not) Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx> --- Osstest/TestSupport.pm | 44 +++++++++++++++++++++++++++++++++++++++++--- ts-host-install | 19 +++++-------------- 2 files changed, 46 insertions(+), 17 deletions(-) diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index abb3195..da881ec 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -2078,16 +2078,34 @@ sub host_pxefile ($;$) { (join ",", sort keys %v)." ?"; } -sub setup_pxeboot ($$) { +sub setup_pxelinux_bootcfg ($$) { my ($ho, $bootfile) = @_; my $f= host_pxefile($ho); file_link_contents("$ho->{Tftp}{Path}$ho->{Tftp}{PxeDir}$f", $bootfile, "$ho->{Name}-pxelinux.cfg"); } -sub setup_pxeboot_local ($) { +# Systems using BIOS are configured to use pxelinux +sub setup_bios_pxeboot ($$$$$;%) { + my ($ho,$kern,$initrd,$dicmd,$hocmd,%xopts) = @_; + my $dtbs = "fdtdir $xopts{dtbs}" if $xopts{dtbs}; + setup_pxelinux_bootcfg($ho, <<END); + serial 0 $c{Baud} +timeout 5 +label overwrite + menu label ^Overwrite + menu default + kernel $kern + append $dicmd initrd=$initrd -- $hocmd + ipappend $xopts{ipappend} + $dtbs +default overwrite +END +} + +sub setup_bios_pxeboot_local ($) { my ($ho) = @_; - setup_pxeboot($ho, <<END); + setup_pxelinux_bootcfg($ho, <<END); serial 0 $c{Baud} timeout 5 label local @@ -2096,6 +2114,26 @@ default local END } +# uboot emulates pxelinux, so reuse BIOS stuff +sub setup_uboot_pxeboot ($$$$$;%) { return &setup_bios_pxeboot; } +sub setup_uboot_pxeboot_local ($) { return &setup_bios_pxeboot_local; } + +sub setup_pxeboot_local ($) { + my ($ho) = @_; + my $firmware = get_host_property($ho, "firmware", "bios"); + $firmware =~ s/-/_/g; + no strict qw(refs); + return &{"setup_${firmware}_pxeboot_local"}($ho); +} + +sub setup_pxeboot ($$$$$;%) { + my ($ho,$kern,$initrd,$dicmd,$hocmd,%xopts) = @_; + my $firmware = get_host_property($ho, "firmware", "bios"); + $firmware =~ s/-/_/g; + no strict qw(refs); + return &{"setup_${firmware}_pxeboot"}($ho,$kern,$initrd,$dicmd,$hocmd,%xopts); +} + #---------- ISO images ---------- sub iso_create_genisoimage ($$$$;@) { my ($ho,$iso,$dir,$isotimeout,@xopts) = @_; diff --git a/ts-host-install b/ts-host-install index ea92db3..aab5241 100755 --- a/ts-host-install +++ b/ts-host-install @@ -247,13 +247,14 @@ SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="$ho->{Ether}", A END } - my $dtbs = ""; + my %xopts; + foreach my $kp (keys %{ $ho->{Flags} }) { # Backwards compatibility $kp = "need-kernel-deb-wheezy-backports" if $kp eq "need-kernel-deb-armmp"; $kp =~ s/need-kernel-deb-$ho->{Suite}-// or next; - $dtbs = "fdtdir /$d_i/$kp-dtbs" + $xopts{dtbs} = "/$d_i/$kp-dtbs" if -e "$ho->{Tftp}{Path}/$d_i/$kp-dtbs"; } @@ -290,18 +291,8 @@ END my $dicmd= join ' ', @dicmdline; my $hocmd= join ' ', @hocmdline; - setup_pxeboot($ho, <<END); -serial 0 $c{Baud} -timeout 5 -label overwrite - menu label ^Overwrite - menu default - kernel $kernel - append initrd=/$initrd $dicmd -- $hocmd - ipappend $ipappend - $dtbs -default overwrite -END + $xopts{ipappend} = $ipappend; + setup_pxeboot($ho, $kernel, "/$initrd", $dicmd, $hocmd, %xopts); } install(); -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |