From 20134a6f1c4e316c1ff4ca7f4aa399cb74ceaa99 Mon Sep 17 00:00:00 2001 From: Thomas Nikolajsen Date: Sat, 30 Oct 2010 09:09:52 +0200 Subject: [PATCH] loader(8): adjustment & man update * add/enhance info on if*/else*/endif * add info on default_kernel variable * include more variables in kenv_vars, including autoboot_delay, to make setting them in loader.conf work * remove a few unused variables --- sys/boot/common/commands.c | 10 ++-- sys/boot/common/help.common | 74 ++++++++++++++++++++++++------ sys/boot/common/loader.8 | 43 +++++++++++++++-- sys/boot/dloader/cmds.c | 25 ++-------- sys/boot/dloader/loader-bootp.conf | 1 + sys/boot/dloader/loader.conf | 1 + 6 files changed, 110 insertions(+), 44 deletions(-) diff --git a/sys/boot/common/commands.c b/sys/boot/common/commands.c index 4c3a62cd11..7084ee9825 100644 --- a/sys/boot/common/commands.c +++ b/sys/boot/common/commands.c @@ -500,7 +500,7 @@ command_lsdev(int argc, char *argv[]) /* * CONDITIONALS */ -COMMAND_SET_COND(ifexists, "ifexists", "conditional f/d present", +COMMAND_SET_COND(ifexists, "ifexists", "conditional file/dir present", command_ifexists); struct cond { @@ -536,7 +536,7 @@ command_ifexists(int argc, char *argv[]) } } -COMMAND_SET_COND(ifset, "ifset", "conditional kenv present", command_ifset); +COMMAND_SET_COND(ifset, "ifset", "conditional kenv variable present", command_ifset); static int command_ifset(int argc, char *argv[]) @@ -562,7 +562,7 @@ command_ifset(int argc, char *argv[]) } } -COMMAND_SET_COND(elseifexists, "elseifexists", "conditional f/d present", +COMMAND_SET_COND(elseifexists, "elseifexists", "conditional file/dir present", command_elseifexists); static int @@ -596,7 +596,7 @@ command_elseifexists(int argc, char *argv[]) } } -COMMAND_SET_COND(else, "else", "cond if/else/endif", command_else); +COMMAND_SET_COND(else, "else", "conditional if/else/endif", command_else); static int command_else(int argc, char *argv[]) @@ -614,7 +614,7 @@ command_else(int argc, char *argv[]) } } -COMMAND_SET_COND(endif, "endif", "cond if/else/endif", command_endif); +COMMAND_SET_COND(endif, "endif", "conditional if/else/endif", command_endif); static int command_endif(int argc, char *argv[]) diff --git a/sys/boot/common/help.common b/sys/boot/common/help.common index ea006f3327..1af38317d9 100644 --- a/sys/boot/common/help.common +++ b/sys/boot/common/help.common @@ -45,18 +45,18 @@ = - Assign value to variable. Value is always assigned to local variable - . If is in list of known kernel environment - variables or is a kernel tunable, it is also assigned to the kernel - environment variable of the given name. - is unset if is empty. + Assign value to variable. The value is always assigned to local + variable . If is in the list of known kernel + environment variables or is a kernel tunable, the value is also + assigned to the kernel environment variable of the given name. + Local variables are unset if is empty. Kernel environment + variables may have empty values. Two kinds of variables are maintained by this program (loader(8)): local variables, that is for loader(8) use only, and kernel environment variables, that kernel will have access to when it starts. - The assignment described above, will assign to a local variable and, - if it seems applicable, also snoop assignment to kernel environment - variable. + The assignment described above, will assign to a local variable and, if + it is applicable, also snoop assignment to kernel environment variable. ################################################################################ # TAHCI DControl AHCI module behaviour @@ -94,7 +94,7 @@ Displays or a default prompt, and counts down seconds before attempting to boot. If is not specified, the default - value is 10. + value is $autoboot_delay. ################################################################################ # Tboot DBoot immediately @@ -226,11 +226,12 @@ kernel environment variables. ################################################################################ -# Tset Sautoboot_delay DSet the default autoboot delay +# Tset Sautoboot_delay DSet the default autoboot / menu delay set autoboot_delay= - Sets the default delay for the autoboot command to seconds. + Sets the default delay in seconds for the `autoboot' and `menu' + commands to wait before booting. The default value is 10 seconds. ################################################################################ # Tset Sbootfile DSet the default boot file set @@ -239,8 +240,8 @@ Sets the default set of kernel boot filename(s). It may be overridden by setting the bootfile variable to a semicolon-separated list of - filenames, each of which will be searched for in the module_path - directories. The default bootfile set is "kernel". + filenames, each of which will be searched for in the $module_path + directories. The default value is "kernel". ################################################################################ # Tset Sboot_askname DPrompt for root device @@ -322,6 +323,14 @@ and `nullconsole'. If is omitted, a list of valid consoles will be displayed. +################################################################################ +# Tset Sdefault_kernel DSet default kernel directory + + set default_kernel= + + Selects the default kernel directory for `menu' command. Default value + is "kernel". + ################################################################################ # Tset Scurrdev DSet the current device @@ -345,8 +354,8 @@ Sets the list of directories which will be searched in for modules named in a load command or implicitly required by a dependency. An - Empty specifies the current directory. The default module_path - is ";modules". + empty specifies the current directory. The default value is + ";modules". ################################################################################ # Tset Sprompt DSet the command prompt @@ -554,6 +563,41 @@ Load kernel and all modules specified by MODULE_load variables. +################################################################################ +# Tifexists DConditional file/dir present + + ifexists + + Conditional exists, i.e. file/dir present. + +################################################################################ +# Tifset DConditional kenv variable present + + ifset + + Conditional exists. + +################################################################################ +# Telseifexists DConditional file/dir present + + elseifexists + + Conditional exists, i.e. file/dir present. + +################################################################################ +# Telse DConditional if/else/endif + + else + + Conditional if/else/endif. + +################################################################################ +# Tendif DConditional if/else/endif + + endif + + Conditional if/else/endif. + ################################################################################ # Tmenuclear DClear all menus diff --git a/sys/boot/common/loader.8 b/sys/boot/common/loader.8 index df7015680b..6e14de2bf5 100644 --- a/sys/boot/common/loader.8 +++ b/sys/boot/common/loader.8 @@ -164,6 +164,11 @@ Any flags or arguments are passed to the kernel, but they must precede the kernel name, if a kernel name is provided. Flags are described in .Xr boot 8 . +See also +.Va boot_* +and +.Va kernel_options +variables. .Pp .It Ic cd Op Ar directory Change working directory to @@ -176,6 +181,17 @@ A new line will be printed unless .Fl n is specified. .Pp +.It Ic else +Conditional if/else/endif. +.Pp +.It Ic elseifexists Ar path +Conditional +.Ar path +exists, i.e.\& file/dir present. +.Pp +.It Ic endif +Conditional if/else/endif. +.Pp .It Ic heap Displays memory usage statistics. For debugging purposes only. @@ -188,6 +204,16 @@ The special .Cm index will list all topics available. .Pp +.It Ic ifexists Ar path +Conditional +Ar path +exists, i.e.\& file/dir present. +.Pp +.It Ic ifset Ar env_variable +Conditional +.Ar env_variable +exists. +.Pp .It Ic include Ar Process script files. Each file, in turn, is completely read into memory, @@ -375,10 +401,10 @@ Unset this to disable automatic loading of the ACPI module. .It Va autoboot_delay Number of seconds .Ic autoboot +and +.Ic menu will wait before booting. -If this variable is not defined, -.Ic autoboot -will default to 10 seconds. +Default value is 10 seconds. .Pp If set to .Dq NO , @@ -409,12 +435,16 @@ by the kernel during and after the boot phase. .It Va bootfile List of semicolon-separated search path for bootable kernels. The default is -.Dq Li kernel;kernel.old . +.Dq Li kernel . .It Va console Defines the current console. .It Va currdev Selects the default device. Syntax for devices is odd. +.It Va default_kernel +Selects default kernel loaded by +.Ic menu +command. .It Va ehci_load Unset this to disable automatic loading of the EHCI module. .It Va init_path @@ -423,6 +453,11 @@ process. The first matching binary is used. The default list is .Dq Li /sbin/init:/sbin/oinit:/sbin/init.bak . +.It Va kernel_options +Set kernel boot flags. +See also +.Ic boot +command. .It Va LINES Define the number of lines on the screen, to be used by the pager. .It Va module_path diff --git a/sys/boot/dloader/cmds.c b/sys/boot/dloader/cmds.c index 24f091ad43..0a3885e8d5 100644 --- a/sys/boot/dloader/cmds.c +++ b/sys/boot/dloader/cmds.c @@ -65,6 +65,8 @@ static int curitem; static int curadd; static char *kenv_vars[] = { + "LINES", + "autoboot_delay", "boot_askname", "boot_cdrom", "boot_ddb", @@ -77,11 +79,13 @@ static char *kenv_vars[] = { "bootfile", "console", "currdev", + "default_kernel", "init_path", - "kernelname", "kernel_options", + "kernelname", "loaddev", "module_path", + "root_disk_unit", NULL }; @@ -444,7 +448,6 @@ command_menu(int ac, char **av) #define FRED_LEFT 0 #define FRED_RIGHT 1 static char *logo_blank_line = " "; -static char *menu_footer = "===============================================================================\n"; static char *logo_color[LOGO_LINES] = { " ,--, | ,--, ", @@ -482,24 +485,6 @@ static char *logo_mono[LOGO_LINES] = { " `|' ", " " }; -static char *logo_blank[LOGO_LINES] = { - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " " }; - static void logo_display(char **logo, int line, int orientation) { diff --git a/sys/boot/dloader/loader-bootp.conf b/sys/boot/dloader/loader-bootp.conf index fbb5b30ac8..92c6c4515f 100644 --- a/sys/boot/dloader/loader-bootp.conf +++ b/sys/boot/dloader/loader-bootp.conf @@ -13,6 +13,7 @@ ### Basic configuration options ############################ ############################################################## +default_kernel="kernel" kernel="kernel.BOOTP" bootfile="kernel.BOOTP" # Kernel name (possibly absolute path) kernel_options="" diff --git a/sys/boot/dloader/loader.conf b/sys/boot/dloader/loader.conf index 4b70117ccf..6a8d3e32c2 100644 --- a/sys/boot/dloader/loader.conf +++ b/sys/boot/dloader/loader.conf @@ -13,6 +13,7 @@ ### Basic configuration options ############################ ############################################################## +default_kernel="kernel" kernel="kernel" bootfile="kernel" # Kernel name (possibly absolute path) kernel_options="" -- 2.41.0