Support few more legacy commands
This commit is contained in:
parent
a37376e72a
commit
237a43b1c1
2 changed files with 75 additions and 25 deletions
|
@ -351,6 +351,42 @@ grub_cmd_legacy_initrd (struct grub_command *mycmd __attribute__ ((unused)),
|
||||||
"no kernel with module support is loaded in legacy way");
|
"no kernel with module support is loaded in legacy way");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
grub_cmd_legacy_initrdnounzip (struct grub_command *mycmd __attribute__ ((unused)),
|
||||||
|
int argc, char **args)
|
||||||
|
{
|
||||||
|
struct grub_command *cmd;
|
||||||
|
|
||||||
|
if (kernel_type == LINUX)
|
||||||
|
{
|
||||||
|
cmd = grub_command_find ("initrd16");
|
||||||
|
if (!cmd)
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "command initrd16 not found");
|
||||||
|
|
||||||
|
return cmd->func (cmd, argc, args);
|
||||||
|
}
|
||||||
|
if (kernel_type == MULTIBOOT)
|
||||||
|
{
|
||||||
|
char **newargs;
|
||||||
|
grub_err_t err;
|
||||||
|
newargs = grub_malloc ((argc + 1) * sizeof (newargs[0]));
|
||||||
|
if (!newargs)
|
||||||
|
return grub_errno;
|
||||||
|
grub_memcpy (newargs + 1, args, argc * sizeof (newargs[0]));
|
||||||
|
newargs[0] = "--nounzip";
|
||||||
|
cmd = grub_command_find ("module");
|
||||||
|
if (!cmd)
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "command module not found");
|
||||||
|
|
||||||
|
err = cmd->func (cmd, argc + 1, newargs);
|
||||||
|
grub_free (newargs);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||||
|
"no kernel with module support is loaded in legacy way");
|
||||||
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cmd_legacy_color (struct grub_command *mycmd __attribute__ ((unused)),
|
grub_cmd_legacy_color (struct grub_command *mycmd __attribute__ ((unused)),
|
||||||
int argc, char **args)
|
int argc, char **args)
|
||||||
|
@ -565,7 +601,7 @@ grub_cmd_legacy_password (struct grub_command *mycmd __attribute__ ((unused)),
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_command_t cmd_source, cmd_configfile, cmd_kernel, cmd_initrd;
|
static grub_command_t cmd_source, cmd_configfile, cmd_kernel, cmd_initrd;
|
||||||
static grub_command_t cmd_color, cmd_password;
|
static grub_command_t cmd_color, cmd_password, cmd_initrdnounzip;
|
||||||
|
|
||||||
GRUB_MOD_INIT(legacycfg)
|
GRUB_MOD_INIT(legacycfg)
|
||||||
{
|
{
|
||||||
|
@ -581,6 +617,11 @@ GRUB_MOD_INIT(legacycfg)
|
||||||
grub_cmd_legacy_initrd,
|
grub_cmd_legacy_initrd,
|
||||||
N_("FILE [ARG ...]"),
|
N_("FILE [ARG ...]"),
|
||||||
N_("Simulate grub-legacy initrd command"));
|
N_("Simulate grub-legacy initrd command"));
|
||||||
|
cmd_initrdnounzip = grub_register_command ("legacy_initrd_nounzip",
|
||||||
|
grub_cmd_legacy_initrdnounzip,
|
||||||
|
N_("FILE [ARG ...]"),
|
||||||
|
N_("Simulate grub-legacy modulenounzip command"));
|
||||||
|
|
||||||
cmd_configfile = grub_register_command ("legacy_configfile",
|
cmd_configfile = grub_register_command ("legacy_configfile",
|
||||||
grub_cmd_legacy_configfile,
|
grub_cmd_legacy_configfile,
|
||||||
N_("FILE"),
|
N_("FILE"),
|
||||||
|
@ -601,6 +642,7 @@ GRUB_MOD_FINI(legacycfg)
|
||||||
grub_unregister_command (cmd_configfile);
|
grub_unregister_command (cmd_configfile);
|
||||||
grub_unregister_command (cmd_kernel);
|
grub_unregister_command (cmd_kernel);
|
||||||
grub_unregister_command (cmd_initrd);
|
grub_unregister_command (cmd_initrd);
|
||||||
|
grub_unregister_command (cmd_initrdnounzip);
|
||||||
grub_unregister_command (cmd_color);
|
grub_unregister_command (cmd_color);
|
||||||
grub_unregister_command (cmd_password);
|
grub_unregister_command (cmd_password);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ struct legacy_command legacy_commands[] =
|
||||||
"Print the blocklist notation of the file FILE."},
|
"Print the blocklist notation of the file FILE."},
|
||||||
{"boot", "boot\n", 0, {}, 0, 0,
|
{"boot", "boot\n", 0, {}, 0, 0,
|
||||||
"Boot the OS/chain-loader which has been loaded."},
|
"Boot the OS/chain-loader which has been loaded."},
|
||||||
/* bootp unsupported. */
|
/* FIXME: bootp unsupported. */
|
||||||
{"cat", "cat '%s'\n", 1, {TYPE_FILE}, 0, "FILE",
|
{"cat", "cat '%s'\n", 1, {TYPE_FILE}, 0, "FILE",
|
||||||
"Print the contents of the file FILE."},
|
"Print the contents of the file FILE."},
|
||||||
{"chainloader", "chainloader %s '%s'\n", 2, {TYPE_FORCE_OPTION, TYPE_FILE},
|
{"chainloader", "chainloader %s '%s'\n", 2, {TYPE_FORCE_OPTION, TYPE_FILE},
|
||||||
|
@ -87,8 +87,8 @@ struct legacy_command legacy_commands[] =
|
||||||
"[NUM | `saved']",
|
"[NUM | `saved']",
|
||||||
"Set the default entry to entry number NUM (if not specified, it is"
|
"Set the default entry to entry number NUM (if not specified, it is"
|
||||||
" 0, the first entry) or the entry number saved by savedefault."},
|
" 0, the first entry) or the entry number saved by savedefault."},
|
||||||
/* dhcp unsupported. */
|
/* FIXME: dhcp unsupported. */
|
||||||
/* displayapm unsupported. */
|
/* FIXME: displayapm unsupported. */
|
||||||
{"displaymem", "lsmmap\n", 0, {}, 0, 0,
|
{"displaymem", "lsmmap\n", 0, {}, 0, 0,
|
||||||
"Display what GRUB thinks the system address space map of the"
|
"Display what GRUB thinks the system address space map of the"
|
||||||
" machine is, including all regions of physical RAM installed."},
|
" machine is, including all regions of physical RAM installed."},
|
||||||
|
@ -102,25 +102,25 @@ struct legacy_command legacy_commands[] =
|
||||||
{"find", "search -sf '%s'\n", 1, {TYPE_FILE}, 0, "FILENAME",
|
{"find", "search -sf '%s'\n", 1, {TYPE_FILE}, 0, "FILENAME",
|
||||||
"Search for the filename FILENAME in all of partitions and print the list of"
|
"Search for the filename FILENAME in all of partitions and print the list of"
|
||||||
" the devices which contain the file."},
|
" the devices which contain the file."},
|
||||||
/* fstest unsupported. */
|
/* FIXME: fstest unsupported. */
|
||||||
/* geometry unsupported. */
|
/* FIXME: geometry unsupported. */
|
||||||
{"halt", "halt %s\n", 1, {TYPE_NOAPM_OPTION}, 0, "[--no-apm]",
|
{"halt", "halt %s\n", 1, {TYPE_NOAPM_OPTION}, 0, "[--no-apm]",
|
||||||
"Halt your system. If APM is available on it, turn off the power using"
|
"Halt your system. If APM is available on it, turn off the power using"
|
||||||
" the APM BIOS, unless you specify the option `--no-apm'."},
|
" the APM BIOS, unless you specify the option `--no-apm'."},
|
||||||
/* help unsupported. */ /* NUL_TERMINATE */
|
/* FIXME: help unsupported. */ /* NUL_TERMINATE */
|
||||||
/* hiddenmenu unsupported. */
|
/* FIXME: hiddenmenu unsupported. */
|
||||||
{"hide", "parttool '%s' hidden+\n", 1, {TYPE_PARTITION}, 0, "PARTITION",
|
{"hide", "parttool '%s' hidden+\n", 1, {TYPE_PARTITION}, 0, "PARTITION",
|
||||||
"Hide PARTITION by setting the \"hidden\" bit in"
|
"Hide PARTITION by setting the \"hidden\" bit in"
|
||||||
" its partition type code."},
|
" its partition type code."},
|
||||||
/* ifconfig unsupported. */
|
/* FIXME: ifconfig unsupported. */
|
||||||
/* impsprobe unsupported. */
|
/* FIXME: impsprobe unsupported. */
|
||||||
{"initrd", "legacy_initrd '%s' %s\n", 2, {TYPE_FILE_NO_CONSUME,
|
{"initrd", "legacy_initrd '%s' %s\n", 2, {TYPE_FILE_NO_CONSUME,
|
||||||
TYPE_REST_VERBATIM}, 0,
|
TYPE_REST_VERBATIM}, 0,
|
||||||
"FILE [ARG ...]",
|
"FILE [ARG ...]",
|
||||||
"Load an initial ramdisk FILE for a Linux format boot image and set the"
|
"Load an initial ramdisk FILE for a Linux format boot image and set the"
|
||||||
" appropriate parameters in the Linux setup area in memory."},
|
" appropriate parameters in the Linux setup area in memory."},
|
||||||
/* install unsupported. */
|
/* install unsupported. */
|
||||||
/* ioprobe unsupported. */
|
/* FIXME: ioprobe unsupported. */
|
||||||
/* FIXME: really support --no-mem-option. */
|
/* FIXME: really support --no-mem-option. */
|
||||||
{"kernel", "legacy_kernel %s %s '%s' %s\n", 4, {TYPE_TYPE_OR_NOMEM_OPTION,
|
{"kernel", "legacy_kernel %s %s '%s' %s\n", 4, {TYPE_TYPE_OR_NOMEM_OPTION,
|
||||||
TYPE_TYPE_OR_NOMEM_OPTION,
|
TYPE_TYPE_OR_NOMEM_OPTION,
|
||||||
|
@ -134,7 +134,7 @@ struct legacy_command legacy_commands[] =
|
||||||
" \"netbsd\", \"freebsd\", \"openbsd\", \"linux\", \"biglinux\" and"
|
" \"netbsd\", \"freebsd\", \"openbsd\", \"linux\", \"biglinux\" and"
|
||||||
" \"multiboot\". The option --no-mem-option tells GRUB not to pass a"
|
" \"multiboot\". The option --no-mem-option tells GRUB not to pass a"
|
||||||
" Linux's mem option automatically."},
|
" Linux's mem option automatically."},
|
||||||
/* lock is unsupported. */
|
/* FIXME: lock is unsupported. */
|
||||||
{"makeactive", "parttool \"$root\" boot+\n", 0, {}, 0, 0,
|
{"makeactive", "parttool \"$root\" boot+\n", 0, {}, 0, 0,
|
||||||
"Set the active partition on the root disk to GRUB's root device."
|
"Set the active partition on the root disk to GRUB's root device."
|
||||||
" This command is limited to _primary_ PC partitions on a hard disk."},
|
" This command is limited to _primary_ PC partitions on a hard disk."},
|
||||||
|
@ -143,7 +143,8 @@ struct legacy_command legacy_commands[] =
|
||||||
"Map the drive FROM_DRIVE to the drive TO_DRIVE. This is necessary"
|
"Map the drive FROM_DRIVE to the drive TO_DRIVE. This is necessary"
|
||||||
" when you chain-load some operating systems, such as DOS, if such an"
|
" when you chain-load some operating systems, such as DOS, if such an"
|
||||||
" OS resides at a non-first drive."},
|
" OS resides at a non-first drive."},
|
||||||
/* md5crypt unsupported. */
|
/* md5crypt unsupported since GRUB has not enough entropy and this
|
||||||
|
hash shouldn't be used anymore. */
|
||||||
{"module", "legacy_initrd '%s' %s\n", 1, {TYPE_FILE_NO_CONSUME,
|
{"module", "legacy_initrd '%s' %s\n", 1, {TYPE_FILE_NO_CONSUME,
|
||||||
TYPE_REST_VERBATIM}, 0,
|
TYPE_REST_VERBATIM}, 0,
|
||||||
"FILE [ARG ...]",
|
"FILE [ARG ...]",
|
||||||
|
@ -152,12 +153,16 @@ struct legacy_command legacy_commands[] =
|
||||||
" command must know what the kernel in question expects). The"
|
" command must know what the kernel in question expects). The"
|
||||||
" rest of the line is passed as the \"module command line\", like"
|
" rest of the line is passed as the \"module command line\", like"
|
||||||
" the `kernel' command."},
|
" the `kernel' command."},
|
||||||
/* modulenounzip unsupported. */
|
{"modulenounzip", "legacy_initrd_nounzip '%s' %s\n", 1,
|
||||||
|
{TYPE_FILE_NO_CONSUME, TYPE_REST_VERBATIM}, 0,
|
||||||
|
"FILE [ARG ...]",
|
||||||
|
"The same as `module', except that automatic decompression is"
|
||||||
|
" disabled."},
|
||||||
/* FIXME: allow toggle. */
|
/* FIXME: allow toggle. */
|
||||||
{"pager", "set pager=%d\n", 1, {TYPE_BOOL}, 0, "[FLAG]",
|
{"pager", "set pager=%d\n", 1, {TYPE_BOOL}, 0, "[FLAG]",
|
||||||
"Toggle pager mode with no argument. If FLAG is given and its value"
|
"Toggle pager mode with no argument. If FLAG is given and its value"
|
||||||
" is `on', turn on the mode. If FLAG is `off', turn off the mode."},
|
" is `on', turn on the mode. If FLAG is `off', turn off the mode."},
|
||||||
/* partnew unsupported. */
|
/* FIXME: partnew unsupported. */
|
||||||
{"parttype", "parttool '%s' type=%s\n", 2, {TYPE_PARTITION, TYPE_INT}, 0,
|
{"parttype", "parttool '%s' type=%s\n", 2, {TYPE_PARTITION, TYPE_INT}, 0,
|
||||||
"PART TYPE", "Change the type of the partition PART to TYPE."},
|
"PART TYPE", "Change the type of the partition PART to TYPE."},
|
||||||
/* FIXME: support config file reloading. */
|
/* FIXME: support config file reloading. */
|
||||||
|
@ -175,8 +180,8 @@ struct legacy_command legacy_commands[] =
|
||||||
" which case it will ask for the password, before continuing."
|
" which case it will ask for the password, before continuing."
|
||||||
" The option --md5 tells GRUB that PASSWD is encrypted with"
|
" The option --md5 tells GRUB that PASSWD is encrypted with"
|
||||||
" md5crypt."},
|
" md5crypt."},
|
||||||
/* pause unsupported. */
|
/* FIXME: pause unsupported. */
|
||||||
/* rarp unsupported. */
|
/* FIXME: rarp unsupported. */
|
||||||
{"read", "read_dword %s\n", 1, {TYPE_INT}, 0, "ADDR",
|
{"read", "read_dword %s\n", 1, {TYPE_INT}, 0, "ADDR",
|
||||||
"Read a 32-bit value from memory at address ADDR and"
|
"Read a 32-bit value from memory at address ADDR and"
|
||||||
" display it in hex format."},
|
" display it in hex format."},
|
||||||
|
@ -217,17 +222,17 @@ struct legacy_command legacy_commands[] =
|
||||||
" STOP is the length of stop bit(s). The option --device can be used only"
|
" STOP is the length of stop bit(s). The option --device can be used only"
|
||||||
" in the grub shell, which specifies the file name of a tty device. The"
|
" in the grub shell, which specifies the file name of a tty device. The"
|
||||||
" default values are COM1, 9600, 8N1."},
|
" default values are COM1, 9600, 8N1."},
|
||||||
/* setkey unsupported. */ /* NUL_TERMINATE */
|
/* FIXME: setkey unsupported. */ /* NUL_TERMINATE */
|
||||||
/* setup unsupported. */
|
/* FIXME: setup unsupported. */
|
||||||
/* terminal unsupported. */ /* NUL_TERMINATE */
|
/* FIXME: terminal unsupported. */ /* NUL_TERMINATE */
|
||||||
/* terminfo unsupported. */ /* NUL_TERMINATE */
|
/* FIXME: terminfo unsupported. */ /* NUL_TERMINATE */
|
||||||
{"testload", "cat '%s'\n", 1, {TYPE_FILE}, 0, "FILE",
|
{"testload", "cat '%s'\n", 1, {TYPE_FILE}, 0, "FILE",
|
||||||
"Read the entire contents of FILE in several different ways and"
|
"Read the entire contents of FILE in several different ways and"
|
||||||
" compares them, to test the filesystem code. "
|
" compares them, to test the filesystem code. "
|
||||||
" If this test succeeds, then a good next"
|
" If this test succeeds, then a good next"
|
||||||
" step is to try loading a kernel."},
|
" step is to try loading a kernel."},
|
||||||
/* testvbe unsupported. */
|
/* FIXME: testvbe unsupported. */
|
||||||
/* tftpserver unsupported. */
|
/* FIXME: tftpserver unsupported. */
|
||||||
{"timeout", "set timeout=%s\n", 1, {TYPE_INT}, 0, "SEC",
|
{"timeout", "set timeout=%s\n", 1, {TYPE_INT}, 0, "SEC",
|
||||||
"Set a timeout, in SEC seconds, before automatically booting the"
|
"Set a timeout, in SEC seconds, before automatically booting the"
|
||||||
" default entry (normally the first entry defined)."},
|
" default entry (normally the first entry defined)."},
|
||||||
|
@ -235,10 +240,13 @@ struct legacy_command legacy_commands[] =
|
||||||
{"unhide", "parttool '%s' hidden-\n", 1, {TYPE_PARTITION}, 0, "PARTITION",
|
{"unhide", "parttool '%s' hidden-\n", 1, {TYPE_PARTITION}, 0, "PARTITION",
|
||||||
"Unhide PARTITION by clearing the \"hidden\" bit in its"
|
"Unhide PARTITION by clearing the \"hidden\" bit in its"
|
||||||
" partition type code."},
|
" partition type code."},
|
||||||
/* uppermem unsupported. */
|
/* FIXME: uppermem unsupported. */
|
||||||
{"uuid", "search -u '%s'\n", 1, {TYPE_VERBATIM}, 0, "UUID",
|
{"uuid", "search -u '%s'\n", 1, {TYPE_VERBATIM}, 0, "UUID",
|
||||||
"Find root by UUID"},
|
"Find root by UUID"},
|
||||||
/* vbeprobe unsupported. */
|
/* FIXME: support MODE. */
|
||||||
|
{"vbeprobe", "vbeinfo", 0, {}, 0, "[MODE]",
|
||||||
|
"Probe VBE information. If the mode number MODE is specified, show only"
|
||||||
|
" the information about only the mode."}
|
||||||
};
|
};
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
|
Loading…
Reference in a new issue