Skip to content

Commit 7786954

Browse files
Steven Rostedtrostedt
authored andcommitted
ktest: Add native support for syslinux boot loader
I installed Fedora 17 which no longer supports grub v1. I worked with grub2 for a while, but there's so many issues with it and automated rebooting, that I decided to switch to syslinux. Instead of using the REBOOT_SCRIPT and add customized changes to get syslinux booted, I thought it better to make ktest aware of syslinux and add options to simplify the use of syslinux on a target test box. Acked-by: H. Peter Anvin <[email protected]> Cc: John 'Warthog9' Hawley <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
1 parent a496872 commit 7786954

2 files changed

Lines changed: 48 additions & 2 deletions

File tree

tools/testing/ktest/ktest.pl

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454
"STOP_TEST_AFTER" => 600,
5555
"MAX_MONITOR_WAIT" => 1800,
5656
"GRUB_REBOOT" => "grub2-reboot",
57+
"SYSLINUX" => "extlinux",
58+
"SYSLINUX_PATH" => "/boot/extlinux",
5759

5860
# required, and we will ask users if they don't have them but we keep the default
5961
# value something that is common.
@@ -109,6 +111,9 @@
109111
my $grub_file;
110112
my $grub_number;
111113
my $grub_reboot;
114+
my $syslinux;
115+
my $syslinux_path;
116+
my $syslinux_label;
112117
my $target;
113118
my $make;
114119
my $pre_install;
@@ -237,6 +242,9 @@
237242
"GRUB_MENU" => \$grub_menu,
238243
"GRUB_FILE" => \$grub_file,
239244
"GRUB_REBOOT" => \$grub_reboot,
245+
"SYSLINUX" => \$syslinux,
246+
"SYSLINUX_PATH" => \$syslinux_path,
247+
"SYSLINUX_LABEL" => \$syslinux_label,
240248
"PRE_INSTALL" => \$pre_install,
241249
"POST_INSTALL" => \$post_install,
242250
"NO_INSTALL" => \$no_install,
@@ -373,7 +381,7 @@
373381
;
374382
$config_help{"REBOOT_TYPE"} = << "EOF"
375383
Way to reboot the box to the test kernel.
376-
Only valid options so far are "grub", "grub2", and "script".
384+
Only valid options so far are "grub", "grub2", "syslinux", and "script".
377385
378386
If you specify grub, it will assume grub version 1
379387
and will search in /boot/grub/menu.lst for the title \$GRUB_MENU
@@ -386,6 +394,11 @@
386394
387395
If you specify grub2, then you also need to specify both \$GRUB_MENU
388396
and \$GRUB_FILE.
397+
398+
If you specify syslinux, then you may use SYSLINUX to define the syslinux
399+
command (defaults to extlinux), and SYSLINUX_PATH to specify the path to
400+
the syslinux install (defaults to /boot/extlinux). But you have to specify
401+
SYSLINUX_LABEL to define the label to boot to for the test kernel.
389402
EOF
390403
;
391404
$config_help{"GRUB_MENU"} = << "EOF"
@@ -414,6 +427,11 @@
414427
here. Use something like /boot/grub2/grub.cfg to search.
415428
EOF
416429
;
430+
$config_help{"SYSLINUX_LABEL"} = << "EOF"
431+
If syslinux is used, the label that boots the target kernel must
432+
be specified with SYSLINUX_LABEL.
433+
EOF
434+
;
417435
$config_help{"REBOOT_SCRIPT"} = << "EOF"
418436
A script to reboot the target into the test kernel
419437
(Only mandatory if REBOOT_TYPE = script)
@@ -545,6 +563,10 @@ sub get_ktest_configs {
545563
get_ktest_config("GRUB_MENU");
546564
get_ktest_config("GRUB_FILE");
547565
}
566+
567+
if ($rtype eq "syslinux") {
568+
get_ktest_config("SYSLINUX_LABEL");
569+
}
548570
}
549571

550572
sub process_variables {
@@ -1589,6 +1611,8 @@ sub reboot_to {
15891611
run_ssh "'(echo \"savedefault --default=$grub_number --once\" | grub --batch)'";
15901612
} elsif ($reboot_type eq "grub2") {
15911613
run_ssh "$grub_reboot $grub_number";
1614+
} elsif ($reboot_type eq "syslinux") {
1615+
run_ssh "$syslinux --once \\\"$syslinux_label\\\" $syslinux_path";
15921616
} elsif (defined $reboot_script) {
15931617
run_command "$reboot_script";
15941618
}
@@ -3768,6 +3792,8 @@ sub set_test_option {
37683792
} elsif ($reboot_type eq "grub2") {
37693793
dodie "GRUB_MENU not defined" if (!defined($grub_menu));
37703794
dodie "GRUB_FILE not defined" if (!defined($grub_file));
3795+
} elsif ($reboot_type eq "syslinux") {
3796+
dodie "SYSLINUX_LABEL not defined" if (!defined($syslinux_label));
37713797
}
37723798
}
37733799

tools/testing/ktest/sample.conf

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,22 @@
364364
#
365365
#GRUB_MENU = Test Kernel
366366

367+
# For REBOOT_TYPE = syslinux, the name of the syslinux executable
368+
# (on the target) to use to set up the next reboot to boot the
369+
# test kernel.
370+
# (default extlinux)
371+
#SYSLINUX = syslinux
372+
373+
# For REBOOT_TYPE = syslinux, the path that is passed to to the
374+
# syslinux command where syslinux is installed.
375+
# (default /boot/extlinux)
376+
#SYSLINUX_PATH = /boot/syslinux
377+
378+
# For REBOOT_TYPE = syslinux, the syslinux label that references the
379+
# test kernel in the syslinux config file.
380+
# (default undefined)
381+
#SYSLINUX_LABEL = "test-kernel"
382+
367383
# A script to reboot the target into the test kernel
368384
# This and SWITCH_TO_TEST are about the same, except
369385
# SWITCH_TO_TEST is run even for REBOOT_TYPE = grub.
@@ -516,7 +532,7 @@
516532
#POST_BUILD_DIE = 1
517533

518534
# Way to reboot the box to the test kernel.
519-
# Only valid options so far are "grub", "grub2" and "script"
535+
# Only valid options so far are "grub", "grub2", "syslinux" and "script"
520536
# (default grub)
521537
# If you specify grub, it will assume grub version 1
522538
# and will search in /boot/grub/menu.lst for the title $GRUB_MENU
@@ -527,6 +543,10 @@
527543
# For REBOOT_TYPE = grub2, you must define both GRUB_MENU and
528544
# GRUB_FILE.
529545
#
546+
# For REBOOT_TYPE = syslinux, you must define SYSLINUX_LABEL, and
547+
# perhaps modify SYSLINUX (default extlinux) and SYSLINUX_PATH
548+
# (default /boot/extlinux)
549+
#
530550
# The entry in /boot/grub/menu.lst must be entered in manually.
531551
# The test will not modify that file.
532552
#REBOOT_TYPE = grub

0 commit comments

Comments
 (0)