2004-07-27 17:47:37 +00:00
|
|
|
|
/* linux.c - boot Linux */
|
|
|
|
|
/*
|
|
|
|
|
* GRUB -- GRand Unified Bootloader
|
2010-01-03 22:05:07 +00:00
|
|
|
|
* Copyright (C) 2003,2004,2005,2007,2009 Free Software Foundation, Inc.
|
2004-07-27 17:47:37 +00:00
|
|
|
|
*
|
2007-07-21 23:32:33 +00:00
|
|
|
|
* GRUB is free software: you can redistribute it and/or modify
|
2004-07-27 17:47:37 +00:00
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2007-07-21 23:32:33 +00:00
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
2004-07-27 17:47:37 +00:00
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
2007-07-21 23:32:33 +00:00
|
|
|
|
* GRUB is distributed in the hope that it will be useful,
|
2004-07-27 17:47:37 +00:00
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2007-07-21 23:32:33 +00:00
|
|
|
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
2004-07-27 17:47:37 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <grub/elf.h>
|
2006-11-03 20:28:04 +00:00
|
|
|
|
#include <grub/elfload.h>
|
2004-07-27 17:47:37 +00:00
|
|
|
|
#include <grub/loader.h>
|
|
|
|
|
#include <grub/dl.h>
|
|
|
|
|
#include <grub/mm.h>
|
|
|
|
|
#include <grub/misc.h>
|
2005-08-03 22:53:51 +00:00
|
|
|
|
#include <grub/ieee1275/ieee1275.h>
|
2009-03-21 Bean <bean123ch@gmail.com>
* commands/blocklist.c: Add include file <grub/command.h>, remove
<grub/normal.h> and <grub/arg.h>.
(grub_cmd_blocklist): Use the new command interface.
(GRUB_MOD_INIT): Likewise.
(GRUB_MOD_FINI): Likewise.
* commands/boot.c: Likewise.
* commands/cat.c: Likewise.
* commands/cmp.c: Likewise.
* commands/configfile.c: Likewise.
* commands/crc.c: Likewise.
* commands/echo.c: Likewise.
* commands/halt.c: Likewise.
* commands/handler.c: Likewise.
* commands/hdparm.c: Likewise.
* commands/help.c: Likewise.
* commands/hexdump.c: Likewise.
* commands/loadenv.c: Likewise.
* commands/ls.c: Likewise.
* commands/lsmmap.c: Likewise.
* commands/lspci.c: Likewise.
* commands/loadenv.c: Likewise.
* commands/read.c: Likewise.
* commands/reboot.c: Likewise.
* commands/search.c: Likewise.
* commands/sleep.c: Likewise.
* commands/test.c: Likewise.
* commands/usbtest.c: Likewise.
* commands/videotest.c: Likewise.
* commands/i386/cpuid.c: Likewise.
* commands/i386/pc/halt.c: Likewise.
* commands/i386/pc/play.c: Likewise.
* commands/i386/pc/pxecmd.c: Likewise.
* commands/i386/pc/vbeinfo.c: Likewise.
* commands/i386/pc/vbetest.c: Likewise.
* commands/ieee1275/suspend.c: Likewise.
* disk/loopback.c: Likewise.
* font/font_cmd.c: Likewise.
* hello/hello.c: Likewise.
* loader/efi/appleloader.c: Likewise.
* loader/efi/chainloader.c: Likewise.
* loader/i386/bsd.c: Likewise.
* loader/i386/efi/linux.c: Likewise.
* loader/i386/ieee1275/linux.c: Likewise.
* loader/i386/linux.c: Likewise.
* loader/i386/pc/chainloader.c: Likewise.
* loader/i386/pc/linux.c: Likewise.
* loader/powerpc/ieee1275/linux.c: Likewise.
* loader/multiboot_loader.c: Likewise.
* term/gfxterm.c: Likewise.
* term/i386/pc/serial.c: Likewise.
* term/terminfo.c: Likewise.
* term/i386/pc/vesafb.c: Removed <grub/arg.h>.
* term/i386/pc/vga.c: Likewise.
* video/readers/jpeg.c: Likewise.
* video/readers/png.c: Likewise.
* video/readers/tga.c: Likewise.
* util/grub-fstest (cmd_loopback): Removed.
(cmd_blocklist): Likewise.
(cmd_ls): Likewise.
(grub_register_command): Likewise.
(grub_unregister_command): Likewise.
(execute_command): Use grub_command_find to locate command and execute
it.
* include/grub/efi/chainloader.h: Removed.
* loader/efi/chainloader_normal.c: Likewise.
* loader/i386/bsd_normal.c: Likewise.
* loader/i386/pc/chainloader_normal.c: Likewise.
* loader/i386/pc/multiboot_normal.c: Likewise.
* loader/linux_normal.c: Likewise.
* loader/multiboot_loader_normal.c: Likewise.
* loader/powerpc/ieee1275/linux_normal.c: Likewise.
* gencmdlist.sh: Scan new registration command grub_register_extcmd
and grub_register_command_p1.
* conf/common.rmk (grub_fstest_SOURCES): Add kern/list.c,
kern/command.c, lib/arg.c and commands/extcmd.c.
(pkglib_MODULES): Remove boot.mod, and minicmd.mod and extcmd.mod.
(minicmd_mod_SOURCES): New variable.
(minicmd_mod_CFLAGS): Likewise.
(minicmd_mod_LDFLAGS): Likewise.
(extcmd_mod_SOURCES): Likewise.
(extcmd_mod_CFLAGS): Likewise.
(extcmd_mod_LDFLAGS): Likewise.
(boot_mod_SOURCES): Removed.
(boot_mod_CFLAGS): Likewise.
(boot_mod_LDFLAGS): Likewise.
* conf/i386-pc.rmk (kernel_img_SOURCES): Add kern/command.c and
kern/corecmd.c.
(kernel_img_HEADERS): Add command.h.
(grub_emu_SOURCES): Remove commands/boot.c and normal/arg.c, add
commands/minicmd.c, kern/command.c, kern/corecmd.c, commands/extcmd.c
and lib/arg.c.
(pkglib_MODULES): Change _linux.mod, _chain.mod, _bsd.mod and
_multiboot.mod as linux.mod, chain.mod, bsd.mod and multiboot.mod,
remove the corresponding normal mode command.
(normal_mod_SOURCES): Remove normal/arg.c.
* conf/i386-coreboot.rmk: Likewise.
* conf/i386-efi.rmk: Likewise.
* conf/i386-ieee1275.rmk: Likewise.
* conf/powerpc-ieee1275.rmk: Likewise.
* conf/x86_64-efi.rmk: Likewise.
* include/grub/arg.h: Move from here ...
* include/grub/lib/arg.h: ... to here.
* normal/arg.c: Move from here ...
* lib/arg.c: ... to here.
* commands/extcmd.c: New file.
* commands/minicmd.c: Likewise.
* include/grub/command.h: Likewise.
* include/grub/extcmd.h: Likewise.
* kern/command.c: Likewise.
* kern/corecmd.c: Likewise.
* kern/list.c (grub_list_iterate): Return int instead of void.
(grub_list_insert): New function.
(grub_prio_list_insert): Likewise.
* kern/rescue.c (grub_rescue_command): Removed.
(grub_rescue_command_list): Likewise.
(grub_rescue_register_command): Likewise.
(grub_rescue_unregister_command): Likewise.
(grub_rescue_cmd_boot): Move to minicmd.c
(grub_rescue_cmd_help): Likewise.
(grub_rescue_cmd_info): Likewise.
(grub_rescue_cmd_boot): Likewise.
(grub_rescue_cmd_testload): Likewise.
(grub_rescue_cmd_dump): Likewise.
(grub_rescue_cmd_rmmod): Likewise.
(grub_rescue_cmd_lsmod): Likewise.
(grub_rescue_cmd_exit): Likewise.
(grub_rescue_print_devices): Moved to corecmd.c.
(grub_rescue_print_files): Likewise.
(grub_rescue_cmd_ls): Likewise.
(grub_rescue_cmd_insmod): Likewise.
(grub_rescue_cmd_set): Likewise.
(grub_rescue_cmd_unset): Likewise.
(attemp_normal_mode): Use grub_command_find to get normal module.
(grub_enter_rescue_mode): Use grub_register_core_commands to register
commands, remove grub_rescue_regiter_command calls.
* normal/command.c (grub_regiser_command): Removed.
(grub_unregister_command): Likewise.
(grub_command_find): Likewise.
(grub_iterate_commands): Likewise.
(rescue_command): Likewise.
(export_command): Moved to corecmd.c.
(set_command): Removed.
(unset_command): Likewise.
(insmod_command): Likewise.
(rmmod_command): Likewise.
(lsmod_command): Likewise.
(grub_command_init): Likewise.
* normal/completion.c (iterate_command): Use cmd->prio to check for
active command.
(complete_arguments): Use grub_extcmd_t structure to find options.
(grub_normal_do_completion): Change function grub_iterate_commands to
grub_command_iterate.
* normal/execute.c (grub_script_execute_cmd): No need to parse
argument here.
* normal/main.c (grub_dyncmd_dispatcher): New function.
(read_command_list): Register unload commands as dyncmd.
(grub_cmd_normal): Use new command interface, register rescue,
unregister normal at entry, register normal, unregister rescue at exit.
* include/grub/list.h (grub_list_test_t): New type.
(grub_list_iterate): Return int instead of void.
(grub_list_insert): New function.
(GRUB_AS_NAMED_LIST_P): New macro.
(GRUB_AS_PRIO_LIST): Likewise.
(GRUB_AS_PRIO_LIST_P): Likewise.
(GRUB_PRIO_LIST_PRIO_MASK): New constant.
(GRUB_PRIO_LIST_FLAG_ACTIVE): Likewise.
(grub_prio_list): New structure.
(grub_prio_list_insert): New function.
(grub_prio_list_remove): New inline function.
* include/grub/normal.h: Remove <grub/arg.h>, add <grub/command.h>.
(GRUB_COMMAND_FLAG_CMDLINE): Moved to command.h.
(GRUB_COMMAND_FLAG_MENU): Likewise.
(GRUB_COMMAND_FLAG_BOTH): Likewise.
(GRUB_COMMAND_FLAG_TITLE): Likewise.
(GRUB_COMMAND_FLAG_NO_ECHO): Likewise.
(GRUB_COMMAND_FLAG_NO_ARG_PARSE): Removed.
(GRUB_COMMAND_FLAG_NOT_LOADED): Likewise.
(grub_command): Likewise.
(grub_register_command): Likewise.
(grub_command_find): Likewise.
(grub_iterate_commands): Likewise.
(grub_command_init): Likewise.
(grub_arg_parse): Likewise.
(grub_arg_show_help): Likewise.
* include/grub/rescue.h (grub_rescue_register_command): Removed.
(grub_rescue_unregister_command): Likewise.
* include/grub/i386/bsd.h: Remove grub_rescue_cmd_freebsd,
grub_rescue_cmd_openbsd, grub_rescue_cmd_netbsd,
grub_rescue_cmd_freebsd_loadenv and grub_rescue_cmd_freebsd_module.
* include/grub/i386/efi/loader.h: Remove grub_rescue_cmd_linux and
grub_rescue_cmd_initrd.
* include/grub/i386/loader.h: Likewise.
* include/grub/x86_64/loader.h: Likewise.
* include/grub/i386/pc/chainloader.h: Remove grub_chainloader_cmd.
2009-03-21 08:39:59 +00:00
|
|
|
|
#include <grub/command.h>
|
2010-01-08 Carles Pina i Estany <carles@pina.cat>
* loader/efi/appleloader.c: Include `<grub/i18n.h>'.
(GRUB_MOD_INIT): Gettextizze.
* loader/efi/chainloader.c: Include `<grub/i18n.h>'.
(GRUB_MOD_INIT): Gettextizze.
* loader/i386/efi/linux.c: Include `<grub/i18n.h>'.
(grub_cmd_linux): Capitalise Linux.
(GRUB_MOD_INIT): Gettextizze.
* loader/i386/ieee1275/linux.c: Include `<grub/i18n.h>'.
(grub_cmd_linux): Capitalise Linux.
(GRUB_MOD_INIT): Gettextizze.
* loader/i386/linux.c: Include `<grub/i18n.h>'.
(grub_cmd_linux): Capitalise Linux.
(GRUB_MOD_INIT): Gettextizze.
* loader/i386/pc/chainloader.c: Include `<grub/i18n.h>'.
(GRUB_MOD_INIT): Gettextizze.
* loader/i386/pc/linux.c: Include `<grub/i18n.h>'.
(grub_cmd_linux): Capitalise Linux.
(GRUB_MOD_INIT): Gettextizze.
* loader/i386/xnu.c: Include `<grub/i18n.h>'.
(grub_cpu_xnu_init): Gettextizze.
* loader/multiboot_loader.c: Include `<grub/i18n.h>'.
(GRUB_MOD_INIT): Gettextizze.
* loader/powerpc/ieee1275/linux.c: Include `<grub/i18n.h>'.
(GRUB_MOD_INIT): Gettextizze.
* loader/sparc64/ieee1275/linux.c: Include `<grub/i18n.h>'.
(grub_linux_load64): Capitalise Linux.
(GRUB_MOD_INIT): Gettextizze.
* loader/xnu.c: Include `<grub/i18n.h>'.
(GRUB_MOD_INIT): Gettextizze.
* po/POTFILES: Add `loader/efi/appleloader.c',
`loader/efi/chainloader.c', `loader/i386/efi/linux.c',
`loader/i386/ieee1275/linux.c', `loader/i386/linux.c',
`loader/i386/pc/chainloader.c', `loader/i386/pc/linux.c',
`loader/i386/xnu.c', `loader/multiboot_loader.c',
`loader/powerpc/ieee1275/linux.c', `loader/sparc64/ieee1275/linux.c'
and `loader/xnu.c'.
2010-01-08 21:35:38 +00:00
|
|
|
|
#include <grub/i18n.h>
|
2010-11-08 13:14:54 +00:00
|
|
|
|
#include <grub/memory.h>
|
2011-01-07 16:09:39 +00:00
|
|
|
|
#include <grub/lib/cmdline.h>
|
2012-06-06 16:58:19 +00:00
|
|
|
|
#include <grub/cache.h>
|
2004-07-27 17:47:37 +00:00
|
|
|
|
|
2011-04-11 21:01:51 +00:00
|
|
|
|
GRUB_MOD_LICENSE ("GPLv3+");
|
|
|
|
|
|
2006-11-03 20:28:04 +00:00
|
|
|
|
#define ELF32_LOADMASK (0xc0000000UL)
|
|
|
|
|
#define ELF64_LOADMASK (0xc000000000000000ULL)
|
|
|
|
|
|
2004-07-27 17:47:37 +00:00
|
|
|
|
static grub_dl_t my_mod;
|
|
|
|
|
|
|
|
|
|
static int loaded;
|
|
|
|
|
|
|
|
|
|
static grub_addr_t initrd_addr;
|
|
|
|
|
static grub_size_t initrd_size;
|
|
|
|
|
|
|
|
|
|
static grub_addr_t linux_addr;
|
2012-06-12 23:15:15 +00:00
|
|
|
|
static grub_addr_t linux_entry;
|
2004-07-27 17:47:37 +00:00
|
|
|
|
static grub_size_t linux_size;
|
|
|
|
|
|
|
|
|
|
static char *linux_args;
|
|
|
|
|
|
2005-08-03 22:53:51 +00:00
|
|
|
|
typedef void (*kernel_entry_t) (void *, unsigned long, int (void *),
|
2004-07-27 17:47:37 +00:00
|
|
|
|
unsigned long, unsigned long);
|
|
|
|
|
|
2013-01-21 14:41:06 +00:00
|
|
|
|
/* Context for grub_linux_claimmap_iterate. */
|
|
|
|
|
struct grub_linux_claimmap_iterate_ctx
|
|
|
|
|
{
|
|
|
|
|
grub_addr_t target;
|
|
|
|
|
grub_size_t size;
|
|
|
|
|
grub_size_t align;
|
|
|
|
|
grub_addr_t found_addr;
|
|
|
|
|
};
|
|
|
|
|
|
2013-01-15 12:02:35 +00:00
|
|
|
|
/* Helper for grub_linux_claimmap_iterate. */
|
|
|
|
|
static int
|
|
|
|
|
alloc_mem (grub_uint64_t addr, grub_uint64_t len, grub_memory_type_t type,
|
|
|
|
|
void *data)
|
|
|
|
|
{
|
2013-01-21 14:41:06 +00:00
|
|
|
|
struct grub_linux_claimmap_iterate_ctx *ctx = data;
|
2013-01-15 12:02:35 +00:00
|
|
|
|
|
|
|
|
|
grub_uint64_t end = addr + len;
|
2013-01-21 14:41:06 +00:00
|
|
|
|
addr = ALIGN_UP (addr, ctx->align);
|
|
|
|
|
ctx->target = ALIGN_UP (ctx->target, ctx->align);
|
2013-01-15 12:02:35 +00:00
|
|
|
|
|
|
|
|
|
/* Target above the memory chunk. */
|
2013-01-21 14:41:06 +00:00
|
|
|
|
if (type != GRUB_MEMORY_AVAILABLE || ctx->target > end)
|
2013-01-15 12:02:35 +00:00
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
/* Target inside the memory chunk. */
|
2013-01-21 14:41:06 +00:00
|
|
|
|
if (ctx->target >= addr && ctx->target < end &&
|
|
|
|
|
ctx->size <= end - ctx->target)
|
2013-01-15 12:02:35 +00:00
|
|
|
|
{
|
2013-01-21 14:41:06 +00:00
|
|
|
|
if (grub_claimmap (ctx->target, ctx->size) == GRUB_ERR_NONE)
|
2013-01-15 12:02:35 +00:00
|
|
|
|
{
|
2013-01-21 14:41:06 +00:00
|
|
|
|
ctx->found_addr = ctx->target;
|
2013-01-15 12:02:35 +00:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
grub_print_error ();
|
|
|
|
|
}
|
|
|
|
|
/* Target below the memory chunk. */
|
2013-01-21 14:41:06 +00:00
|
|
|
|
if (ctx->target < addr && addr + ctx->size <= end)
|
2013-01-15 12:02:35 +00:00
|
|
|
|
{
|
2013-01-21 14:41:06 +00:00
|
|
|
|
if (grub_claimmap (addr, ctx->size) == GRUB_ERR_NONE)
|
2013-01-15 12:02:35 +00:00
|
|
|
|
{
|
2013-01-21 14:41:06 +00:00
|
|
|
|
ctx->found_addr = addr;
|
2013-01-15 12:02:35 +00:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
grub_print_error ();
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-08 13:14:54 +00:00
|
|
|
|
static grub_addr_t
|
|
|
|
|
grub_linux_claimmap_iterate (grub_addr_t target, grub_size_t size,
|
|
|
|
|
grub_size_t align)
|
|
|
|
|
{
|
2013-01-21 14:41:06 +00:00
|
|
|
|
struct grub_linux_claimmap_iterate_ctx ctx = {
|
|
|
|
|
.target = target,
|
|
|
|
|
.size = size,
|
|
|
|
|
.align = align,
|
|
|
|
|
.found_addr = (grub_addr_t) -1
|
|
|
|
|
};
|
2010-11-08 13:14:54 +00:00
|
|
|
|
|
2013-01-21 14:41:06 +00:00
|
|
|
|
grub_machine_mmap_iterate (alloc_mem, &ctx);
|
2010-11-08 13:14:54 +00:00
|
|
|
|
|
2013-01-21 14:41:06 +00:00
|
|
|
|
return ctx.found_addr;
|
2010-11-08 13:14:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
2004-07-27 17:47:37 +00:00
|
|
|
|
static grub_err_t
|
|
|
|
|
grub_linux_boot (void)
|
|
|
|
|
{
|
|
|
|
|
kernel_entry_t linuxmain;
|
2006-09-26 03:49:41 +00:00
|
|
|
|
grub_ssize_t actual;
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2012-06-06 16:58:19 +00:00
|
|
|
|
grub_arch_sync_caches ((void *) linux_addr, linux_size);
|
2004-07-27 17:47:37 +00:00
|
|
|
|
/* Set the command line arguments. */
|
2005-06-21 02:33:52 +00:00
|
|
|
|
grub_ieee1275_set_property (grub_ieee1275_chosen, "bootargs", linux_args,
|
2004-07-27 17:47:37 +00:00
|
|
|
|
grub_strlen (linux_args) + 1, &actual);
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2012-06-12 23:15:15 +00:00
|
|
|
|
grub_dprintf ("loader", "Entry point: 0x%x\n", linux_entry);
|
2005-07-12 22:36:43 +00:00
|
|
|
|
grub_dprintf ("loader", "Initrd at: 0x%x, size 0x%x\n", initrd_addr,
|
|
|
|
|
initrd_size);
|
|
|
|
|
grub_dprintf ("loader", "Boot arguments: %s\n", linux_args);
|
|
|
|
|
grub_dprintf ("loader", "Jumping to Linux...\n");
|
|
|
|
|
|
2004-07-27 17:47:37 +00:00
|
|
|
|
/* Boot the kernel. */
|
2012-06-12 23:15:15 +00:00
|
|
|
|
linuxmain = (kernel_entry_t) linux_entry;
|
2004-07-27 17:47:37 +00:00
|
|
|
|
linuxmain ((void *) initrd_addr, initrd_size, grub_ieee1275_entry_fn, 0, 0);
|
|
|
|
|
|
|
|
|
|
return GRUB_ERR_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static grub_err_t
|
|
|
|
|
grub_linux_release_mem (void)
|
|
|
|
|
{
|
|
|
|
|
grub_free (linux_args);
|
|
|
|
|
linux_args = 0;
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2004-10-03 09:19:10 +00:00
|
|
|
|
if (linux_addr && grub_ieee1275_release (linux_addr, linux_size))
|
2009-12-25 00:04:51 +00:00
|
|
|
|
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "cannot release memory");
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2005-01-31 21:44:35 +00:00
|
|
|
|
if (initrd_addr && grub_ieee1275_release (initrd_addr, initrd_size))
|
2009-12-25 00:04:51 +00:00
|
|
|
|
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "cannot release memory");
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2004-07-27 17:47:37 +00:00
|
|
|
|
linux_addr = 0;
|
2005-01-31 21:44:35 +00:00
|
|
|
|
initrd_addr = 0;
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2004-07-27 17:47:37 +00:00
|
|
|
|
return GRUB_ERR_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static grub_err_t
|
|
|
|
|
grub_linux_unload (void)
|
|
|
|
|
{
|
|
|
|
|
grub_err_t err;
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2004-07-27 17:47:37 +00:00
|
|
|
|
err = grub_linux_release_mem ();
|
|
|
|
|
grub_dl_unref (my_mod);
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2004-07-27 17:47:37 +00:00
|
|
|
|
loaded = 0;
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2004-07-27 17:47:37 +00:00
|
|
|
|
return err;
|
|
|
|
|
}
|
|
|
|
|
|
2006-11-03 20:28:04 +00:00
|
|
|
|
static grub_err_t
|
2012-02-08 18:26:01 +00:00
|
|
|
|
grub_linux_load32 (grub_elf_t elf, const char *filename)
|
2004-07-27 17:47:37 +00:00
|
|
|
|
{
|
2010-11-08 13:14:54 +00:00
|
|
|
|
Elf32_Addr base_addr;
|
|
|
|
|
grub_addr_t seg_addr;
|
|
|
|
|
grub_uint32_t align;
|
2011-01-11 22:01:07 +00:00
|
|
|
|
grub_uint32_t offset;
|
|
|
|
|
Elf32_Addr entry;
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2012-02-08 18:26:01 +00:00
|
|
|
|
linux_size = grub_elf32_size (elf, filename, &base_addr, &align);
|
2006-11-03 20:28:04 +00:00
|
|
|
|
if (linux_size == 0)
|
|
|
|
|
return grub_errno;
|
|
|
|
|
/* Pad it; the kernel scribbles over memory beyond its load address. */
|
|
|
|
|
linux_size += 0x100000;
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2011-01-11 22:01:07 +00:00
|
|
|
|
/* Linux's entry point incorrectly contains a virtual address. */
|
|
|
|
|
entry = elf->ehdr.ehdr32.e_entry & ~ELF32_LOADMASK;
|
|
|
|
|
|
2010-11-08 13:14:54 +00:00
|
|
|
|
/* Linux's incorrectly contains a virtual address. */
|
|
|
|
|
base_addr &= ~ELF32_LOADMASK;
|
2011-01-11 22:01:07 +00:00
|
|
|
|
offset = entry - base_addr;
|
2010-11-08 13:14:54 +00:00
|
|
|
|
|
2006-11-03 20:28:04 +00:00
|
|
|
|
/* On some systems, firmware occupies the memory we're trying to use.
|
|
|
|
|
* Happily, Linux can be loaded anywhere (it relocates itself). Iterate
|
|
|
|
|
* until we find an open area. */
|
2010-11-08 13:14:54 +00:00
|
|
|
|
seg_addr = grub_linux_claimmap_iterate (base_addr & ~ELF32_LOADMASK, linux_size, align);
|
|
|
|
|
if (seg_addr == (grub_addr_t) -1)
|
2009-12-25 00:04:51 +00:00
|
|
|
|
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't claim memory");
|
2004-07-27 17:47:37 +00:00
|
|
|
|
|
2012-06-12 23:15:15 +00:00
|
|
|
|
linux_entry = seg_addr + offset;
|
|
|
|
|
linux_addr = seg_addr;
|
2010-11-08 13:14:54 +00:00
|
|
|
|
|
2006-11-03 20:28:04 +00:00
|
|
|
|
/* Now load the segments into the area we claimed. */
|
2009-06-21 23:55:23 +00:00
|
|
|
|
auto grub_err_t offset_phdr (Elf32_Phdr *phdr, grub_addr_t *addr, int *do_load);
|
2009-06-21 15:48:10 +00:00
|
|
|
|
grub_err_t offset_phdr (Elf32_Phdr *phdr, grub_addr_t *addr, int *do_load)
|
2004-07-27 17:47:37 +00:00
|
|
|
|
{
|
2009-06-21 15:48:10 +00:00
|
|
|
|
if (phdr->p_type != PT_LOAD)
|
|
|
|
|
{
|
|
|
|
|
*do_load = 0;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
*do_load = 1;
|
|
|
|
|
|
2010-11-08 13:14:54 +00:00
|
|
|
|
*addr = (phdr->p_paddr - base_addr) + seg_addr;
|
2006-11-03 20:28:04 +00:00
|
|
|
|
return 0;
|
2004-07-27 17:47:37 +00:00
|
|
|
|
}
|
2012-02-08 18:26:01 +00:00
|
|
|
|
return grub_elf32_load (elf, filename, offset_phdr, 0, 0);
|
2006-11-03 20:28:04 +00:00
|
|
|
|
}
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2006-11-03 20:28:04 +00:00
|
|
|
|
static grub_err_t
|
2012-02-08 18:26:01 +00:00
|
|
|
|
grub_linux_load64 (grub_elf_t elf, const char *filename)
|
2006-11-03 20:28:04 +00:00
|
|
|
|
{
|
2010-11-08 13:14:54 +00:00
|
|
|
|
Elf64_Addr base_addr;
|
|
|
|
|
grub_addr_t seg_addr;
|
|
|
|
|
grub_uint64_t align;
|
2011-01-11 22:01:07 +00:00
|
|
|
|
grub_uint64_t offset;
|
|
|
|
|
Elf64_Addr entry;
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2012-02-08 18:26:01 +00:00
|
|
|
|
linux_size = grub_elf64_size (elf, filename, &base_addr, &align);
|
2006-11-03 20:28:04 +00:00
|
|
|
|
if (linux_size == 0)
|
|
|
|
|
return grub_errno;
|
|
|
|
|
/* Pad it; the kernel scribbles over memory beyond its load address. */
|
2004-07-27 17:47:37 +00:00
|
|
|
|
linux_size += 0x100000;
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2010-11-08 13:14:54 +00:00
|
|
|
|
base_addr &= ~ELF64_LOADMASK;
|
2011-01-11 22:01:07 +00:00
|
|
|
|
entry = elf->ehdr.ehdr64.e_entry & ~ELF64_LOADMASK;
|
|
|
|
|
offset = entry - base_addr;
|
|
|
|
|
/* Linux's incorrectly contains a virtual address. */
|
2010-11-08 13:14:54 +00:00
|
|
|
|
|
2006-11-03 20:28:04 +00:00
|
|
|
|
/* On some systems, firmware occupies the memory we're trying to use.
|
|
|
|
|
* Happily, Linux can be loaded anywhere (it relocates itself). Iterate
|
|
|
|
|
* until we find an open area. */
|
2010-11-08 13:14:54 +00:00
|
|
|
|
seg_addr = grub_linux_claimmap_iterate (base_addr & ~ELF64_LOADMASK, linux_size, align);
|
|
|
|
|
if (seg_addr == (grub_addr_t) -1)
|
2009-12-25 00:04:51 +00:00
|
|
|
|
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't claim memory");
|
2006-11-03 20:28:04 +00:00
|
|
|
|
|
2012-06-12 23:15:15 +00:00
|
|
|
|
linux_entry = seg_addr + offset;
|
|
|
|
|
linux_addr = seg_addr;
|
2010-11-08 13:14:54 +00:00
|
|
|
|
|
2006-11-03 20:28:04 +00:00
|
|
|
|
/* Now load the segments into the area we claimed. */
|
2009-06-21 23:55:23 +00:00
|
|
|
|
auto grub_err_t offset_phdr (Elf64_Phdr *phdr, grub_addr_t *addr, int *do_load);
|
2009-06-21 15:48:10 +00:00
|
|
|
|
grub_err_t offset_phdr (Elf64_Phdr *phdr, grub_addr_t *addr, int *do_load)
|
2004-07-27 17:47:37 +00:00
|
|
|
|
{
|
2009-06-21 15:48:10 +00:00
|
|
|
|
if (phdr->p_type != PT_LOAD)
|
|
|
|
|
{
|
|
|
|
|
*do_load = 0;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
*do_load = 1;
|
2010-11-08 13:14:54 +00:00
|
|
|
|
|
|
|
|
|
*addr = (phdr->p_paddr - base_addr) + seg_addr;
|
2006-11-03 20:28:04 +00:00
|
|
|
|
return 0;
|
2004-07-27 17:47:37 +00:00
|
|
|
|
}
|
2012-02-08 18:26:01 +00:00
|
|
|
|
return grub_elf64_load (elf, filename, offset_phdr, 0, 0);
|
2006-11-03 20:28:04 +00:00
|
|
|
|
}
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2009-03-21 Bean <bean123ch@gmail.com>
* commands/blocklist.c: Add include file <grub/command.h>, remove
<grub/normal.h> and <grub/arg.h>.
(grub_cmd_blocklist): Use the new command interface.
(GRUB_MOD_INIT): Likewise.
(GRUB_MOD_FINI): Likewise.
* commands/boot.c: Likewise.
* commands/cat.c: Likewise.
* commands/cmp.c: Likewise.
* commands/configfile.c: Likewise.
* commands/crc.c: Likewise.
* commands/echo.c: Likewise.
* commands/halt.c: Likewise.
* commands/handler.c: Likewise.
* commands/hdparm.c: Likewise.
* commands/help.c: Likewise.
* commands/hexdump.c: Likewise.
* commands/loadenv.c: Likewise.
* commands/ls.c: Likewise.
* commands/lsmmap.c: Likewise.
* commands/lspci.c: Likewise.
* commands/loadenv.c: Likewise.
* commands/read.c: Likewise.
* commands/reboot.c: Likewise.
* commands/search.c: Likewise.
* commands/sleep.c: Likewise.
* commands/test.c: Likewise.
* commands/usbtest.c: Likewise.
* commands/videotest.c: Likewise.
* commands/i386/cpuid.c: Likewise.
* commands/i386/pc/halt.c: Likewise.
* commands/i386/pc/play.c: Likewise.
* commands/i386/pc/pxecmd.c: Likewise.
* commands/i386/pc/vbeinfo.c: Likewise.
* commands/i386/pc/vbetest.c: Likewise.
* commands/ieee1275/suspend.c: Likewise.
* disk/loopback.c: Likewise.
* font/font_cmd.c: Likewise.
* hello/hello.c: Likewise.
* loader/efi/appleloader.c: Likewise.
* loader/efi/chainloader.c: Likewise.
* loader/i386/bsd.c: Likewise.
* loader/i386/efi/linux.c: Likewise.
* loader/i386/ieee1275/linux.c: Likewise.
* loader/i386/linux.c: Likewise.
* loader/i386/pc/chainloader.c: Likewise.
* loader/i386/pc/linux.c: Likewise.
* loader/powerpc/ieee1275/linux.c: Likewise.
* loader/multiboot_loader.c: Likewise.
* term/gfxterm.c: Likewise.
* term/i386/pc/serial.c: Likewise.
* term/terminfo.c: Likewise.
* term/i386/pc/vesafb.c: Removed <grub/arg.h>.
* term/i386/pc/vga.c: Likewise.
* video/readers/jpeg.c: Likewise.
* video/readers/png.c: Likewise.
* video/readers/tga.c: Likewise.
* util/grub-fstest (cmd_loopback): Removed.
(cmd_blocklist): Likewise.
(cmd_ls): Likewise.
(grub_register_command): Likewise.
(grub_unregister_command): Likewise.
(execute_command): Use grub_command_find to locate command and execute
it.
* include/grub/efi/chainloader.h: Removed.
* loader/efi/chainloader_normal.c: Likewise.
* loader/i386/bsd_normal.c: Likewise.
* loader/i386/pc/chainloader_normal.c: Likewise.
* loader/i386/pc/multiboot_normal.c: Likewise.
* loader/linux_normal.c: Likewise.
* loader/multiboot_loader_normal.c: Likewise.
* loader/powerpc/ieee1275/linux_normal.c: Likewise.
* gencmdlist.sh: Scan new registration command grub_register_extcmd
and grub_register_command_p1.
* conf/common.rmk (grub_fstest_SOURCES): Add kern/list.c,
kern/command.c, lib/arg.c and commands/extcmd.c.
(pkglib_MODULES): Remove boot.mod, and minicmd.mod and extcmd.mod.
(minicmd_mod_SOURCES): New variable.
(minicmd_mod_CFLAGS): Likewise.
(minicmd_mod_LDFLAGS): Likewise.
(extcmd_mod_SOURCES): Likewise.
(extcmd_mod_CFLAGS): Likewise.
(extcmd_mod_LDFLAGS): Likewise.
(boot_mod_SOURCES): Removed.
(boot_mod_CFLAGS): Likewise.
(boot_mod_LDFLAGS): Likewise.
* conf/i386-pc.rmk (kernel_img_SOURCES): Add kern/command.c and
kern/corecmd.c.
(kernel_img_HEADERS): Add command.h.
(grub_emu_SOURCES): Remove commands/boot.c and normal/arg.c, add
commands/minicmd.c, kern/command.c, kern/corecmd.c, commands/extcmd.c
and lib/arg.c.
(pkglib_MODULES): Change _linux.mod, _chain.mod, _bsd.mod and
_multiboot.mod as linux.mod, chain.mod, bsd.mod and multiboot.mod,
remove the corresponding normal mode command.
(normal_mod_SOURCES): Remove normal/arg.c.
* conf/i386-coreboot.rmk: Likewise.
* conf/i386-efi.rmk: Likewise.
* conf/i386-ieee1275.rmk: Likewise.
* conf/powerpc-ieee1275.rmk: Likewise.
* conf/x86_64-efi.rmk: Likewise.
* include/grub/arg.h: Move from here ...
* include/grub/lib/arg.h: ... to here.
* normal/arg.c: Move from here ...
* lib/arg.c: ... to here.
* commands/extcmd.c: New file.
* commands/minicmd.c: Likewise.
* include/grub/command.h: Likewise.
* include/grub/extcmd.h: Likewise.
* kern/command.c: Likewise.
* kern/corecmd.c: Likewise.
* kern/list.c (grub_list_iterate): Return int instead of void.
(grub_list_insert): New function.
(grub_prio_list_insert): Likewise.
* kern/rescue.c (grub_rescue_command): Removed.
(grub_rescue_command_list): Likewise.
(grub_rescue_register_command): Likewise.
(grub_rescue_unregister_command): Likewise.
(grub_rescue_cmd_boot): Move to minicmd.c
(grub_rescue_cmd_help): Likewise.
(grub_rescue_cmd_info): Likewise.
(grub_rescue_cmd_boot): Likewise.
(grub_rescue_cmd_testload): Likewise.
(grub_rescue_cmd_dump): Likewise.
(grub_rescue_cmd_rmmod): Likewise.
(grub_rescue_cmd_lsmod): Likewise.
(grub_rescue_cmd_exit): Likewise.
(grub_rescue_print_devices): Moved to corecmd.c.
(grub_rescue_print_files): Likewise.
(grub_rescue_cmd_ls): Likewise.
(grub_rescue_cmd_insmod): Likewise.
(grub_rescue_cmd_set): Likewise.
(grub_rescue_cmd_unset): Likewise.
(attemp_normal_mode): Use grub_command_find to get normal module.
(grub_enter_rescue_mode): Use grub_register_core_commands to register
commands, remove grub_rescue_regiter_command calls.
* normal/command.c (grub_regiser_command): Removed.
(grub_unregister_command): Likewise.
(grub_command_find): Likewise.
(grub_iterate_commands): Likewise.
(rescue_command): Likewise.
(export_command): Moved to corecmd.c.
(set_command): Removed.
(unset_command): Likewise.
(insmod_command): Likewise.
(rmmod_command): Likewise.
(lsmod_command): Likewise.
(grub_command_init): Likewise.
* normal/completion.c (iterate_command): Use cmd->prio to check for
active command.
(complete_arguments): Use grub_extcmd_t structure to find options.
(grub_normal_do_completion): Change function grub_iterate_commands to
grub_command_iterate.
* normal/execute.c (grub_script_execute_cmd): No need to parse
argument here.
* normal/main.c (grub_dyncmd_dispatcher): New function.
(read_command_list): Register unload commands as dyncmd.
(grub_cmd_normal): Use new command interface, register rescue,
unregister normal at entry, register normal, unregister rescue at exit.
* include/grub/list.h (grub_list_test_t): New type.
(grub_list_iterate): Return int instead of void.
(grub_list_insert): New function.
(GRUB_AS_NAMED_LIST_P): New macro.
(GRUB_AS_PRIO_LIST): Likewise.
(GRUB_AS_PRIO_LIST_P): Likewise.
(GRUB_PRIO_LIST_PRIO_MASK): New constant.
(GRUB_PRIO_LIST_FLAG_ACTIVE): Likewise.
(grub_prio_list): New structure.
(grub_prio_list_insert): New function.
(grub_prio_list_remove): New inline function.
* include/grub/normal.h: Remove <grub/arg.h>, add <grub/command.h>.
(GRUB_COMMAND_FLAG_CMDLINE): Moved to command.h.
(GRUB_COMMAND_FLAG_MENU): Likewise.
(GRUB_COMMAND_FLAG_BOTH): Likewise.
(GRUB_COMMAND_FLAG_TITLE): Likewise.
(GRUB_COMMAND_FLAG_NO_ECHO): Likewise.
(GRUB_COMMAND_FLAG_NO_ARG_PARSE): Removed.
(GRUB_COMMAND_FLAG_NOT_LOADED): Likewise.
(grub_command): Likewise.
(grub_register_command): Likewise.
(grub_command_find): Likewise.
(grub_iterate_commands): Likewise.
(grub_command_init): Likewise.
(grub_arg_parse): Likewise.
(grub_arg_show_help): Likewise.
* include/grub/rescue.h (grub_rescue_register_command): Removed.
(grub_rescue_unregister_command): Likewise.
* include/grub/i386/bsd.h: Remove grub_rescue_cmd_freebsd,
grub_rescue_cmd_openbsd, grub_rescue_cmd_netbsd,
grub_rescue_cmd_freebsd_loadenv and grub_rescue_cmd_freebsd_module.
* include/grub/i386/efi/loader.h: Remove grub_rescue_cmd_linux and
grub_rescue_cmd_initrd.
* include/grub/i386/loader.h: Likewise.
* include/grub/x86_64/loader.h: Likewise.
* include/grub/i386/pc/chainloader.h: Remove grub_chainloader_cmd.
2009-03-21 08:39:59 +00:00
|
|
|
|
static grub_err_t
|
|
|
|
|
grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|
|
|
|
int argc, char *argv[])
|
2006-11-03 20:28:04 +00:00
|
|
|
|
{
|
|
|
|
|
grub_elf_t elf = 0;
|
|
|
|
|
int size;
|
2004-07-27 17:47:37 +00:00
|
|
|
|
|
2006-11-03 20:28:04 +00:00
|
|
|
|
grub_dl_ref (my_mod);
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2006-11-03 20:28:04 +00:00
|
|
|
|
if (argc == 0)
|
|
|
|
|
{
|
2012-02-08 18:26:01 +00:00
|
|
|
|
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
2006-11-03 20:28:04 +00:00
|
|
|
|
goto out;
|
|
|
|
|
}
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2006-11-03 20:28:04 +00:00
|
|
|
|
elf = grub_elf_open (argv[0]);
|
|
|
|
|
if (! elf)
|
|
|
|
|
goto out;
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2010-07-14 15:47:45 +00:00
|
|
|
|
if (elf->ehdr.ehdr32.e_type != ET_EXEC && elf->ehdr.ehdr32.e_type != ET_DYN)
|
2006-11-03 20:28:04 +00:00
|
|
|
|
{
|
|
|
|
|
grub_error (GRUB_ERR_UNKNOWN_OS,
|
2012-02-08 18:26:01 +00:00
|
|
|
|
N_("this ELF file is not of the right type"));
|
2006-11-03 20:28:04 +00:00
|
|
|
|
goto out;
|
|
|
|
|
}
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2006-11-03 20:28:04 +00:00
|
|
|
|
/* Release the previously used memory. */
|
|
|
|
|
grub_loader_unset ();
|
2004-07-27 17:47:37 +00:00
|
|
|
|
|
2006-11-03 20:28:04 +00:00
|
|
|
|
if (grub_elf_is_elf32 (elf))
|
2012-02-08 18:26:01 +00:00
|
|
|
|
grub_linux_load32 (elf, argv[0]);
|
2006-11-03 20:28:04 +00:00
|
|
|
|
else
|
|
|
|
|
if (grub_elf_is_elf64 (elf))
|
2012-02-08 18:26:01 +00:00
|
|
|
|
grub_linux_load64 (elf, argv[0]);
|
2006-11-03 20:28:04 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
2012-02-26 16:28:05 +00:00
|
|
|
|
grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("invalid arch-dependent ELF magic"));
|
2006-11-03 20:28:04 +00:00
|
|
|
|
goto out;
|
2004-07-27 17:47:37 +00:00
|
|
|
|
}
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2011-01-07 16:09:39 +00:00
|
|
|
|
size = grub_loader_cmdline_size(argc, argv);
|
|
|
|
|
linux_args = grub_malloc (size + sizeof (LINUX_IMAGE));
|
2005-08-20 08:25:51 +00:00
|
|
|
|
if (! linux_args)
|
2006-11-03 20:28:04 +00:00
|
|
|
|
goto out;
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2011-01-07 16:09:39 +00:00
|
|
|
|
/* Create kernel command line. */
|
|
|
|
|
grub_memcpy (linux_args, LINUX_IMAGE, sizeof (LINUX_IMAGE));
|
|
|
|
|
grub_create_loader_cmdline (argc, argv, linux_args + sizeof (LINUX_IMAGE) - 1,
|
|
|
|
|
size);
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2006-11-03 20:28:04 +00:00
|
|
|
|
out:
|
2004-07-27 17:47:37 +00:00
|
|
|
|
|
2006-11-03 20:28:04 +00:00
|
|
|
|
if (elf)
|
|
|
|
|
grub_elf_close (elf);
|
2004-07-27 17:47:37 +00:00
|
|
|
|
|
|
|
|
|
if (grub_errno != GRUB_ERR_NONE)
|
|
|
|
|
{
|
|
|
|
|
grub_linux_release_mem ();
|
|
|
|
|
grub_dl_unref (my_mod);
|
|
|
|
|
loaded = 0;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2006-04-30 21:09:37 +00:00
|
|
|
|
grub_loader_set (grub_linux_boot, grub_linux_unload, 1);
|
2005-06-21 02:33:52 +00:00
|
|
|
|
initrd_addr = 0;
|
2004-07-27 17:47:37 +00:00
|
|
|
|
loaded = 1;
|
|
|
|
|
}
|
2009-03-21 Bean <bean123ch@gmail.com>
* commands/blocklist.c: Add include file <grub/command.h>, remove
<grub/normal.h> and <grub/arg.h>.
(grub_cmd_blocklist): Use the new command interface.
(GRUB_MOD_INIT): Likewise.
(GRUB_MOD_FINI): Likewise.
* commands/boot.c: Likewise.
* commands/cat.c: Likewise.
* commands/cmp.c: Likewise.
* commands/configfile.c: Likewise.
* commands/crc.c: Likewise.
* commands/echo.c: Likewise.
* commands/halt.c: Likewise.
* commands/handler.c: Likewise.
* commands/hdparm.c: Likewise.
* commands/help.c: Likewise.
* commands/hexdump.c: Likewise.
* commands/loadenv.c: Likewise.
* commands/ls.c: Likewise.
* commands/lsmmap.c: Likewise.
* commands/lspci.c: Likewise.
* commands/loadenv.c: Likewise.
* commands/read.c: Likewise.
* commands/reboot.c: Likewise.
* commands/search.c: Likewise.
* commands/sleep.c: Likewise.
* commands/test.c: Likewise.
* commands/usbtest.c: Likewise.
* commands/videotest.c: Likewise.
* commands/i386/cpuid.c: Likewise.
* commands/i386/pc/halt.c: Likewise.
* commands/i386/pc/play.c: Likewise.
* commands/i386/pc/pxecmd.c: Likewise.
* commands/i386/pc/vbeinfo.c: Likewise.
* commands/i386/pc/vbetest.c: Likewise.
* commands/ieee1275/suspend.c: Likewise.
* disk/loopback.c: Likewise.
* font/font_cmd.c: Likewise.
* hello/hello.c: Likewise.
* loader/efi/appleloader.c: Likewise.
* loader/efi/chainloader.c: Likewise.
* loader/i386/bsd.c: Likewise.
* loader/i386/efi/linux.c: Likewise.
* loader/i386/ieee1275/linux.c: Likewise.
* loader/i386/linux.c: Likewise.
* loader/i386/pc/chainloader.c: Likewise.
* loader/i386/pc/linux.c: Likewise.
* loader/powerpc/ieee1275/linux.c: Likewise.
* loader/multiboot_loader.c: Likewise.
* term/gfxterm.c: Likewise.
* term/i386/pc/serial.c: Likewise.
* term/terminfo.c: Likewise.
* term/i386/pc/vesafb.c: Removed <grub/arg.h>.
* term/i386/pc/vga.c: Likewise.
* video/readers/jpeg.c: Likewise.
* video/readers/png.c: Likewise.
* video/readers/tga.c: Likewise.
* util/grub-fstest (cmd_loopback): Removed.
(cmd_blocklist): Likewise.
(cmd_ls): Likewise.
(grub_register_command): Likewise.
(grub_unregister_command): Likewise.
(execute_command): Use grub_command_find to locate command and execute
it.
* include/grub/efi/chainloader.h: Removed.
* loader/efi/chainloader_normal.c: Likewise.
* loader/i386/bsd_normal.c: Likewise.
* loader/i386/pc/chainloader_normal.c: Likewise.
* loader/i386/pc/multiboot_normal.c: Likewise.
* loader/linux_normal.c: Likewise.
* loader/multiboot_loader_normal.c: Likewise.
* loader/powerpc/ieee1275/linux_normal.c: Likewise.
* gencmdlist.sh: Scan new registration command grub_register_extcmd
and grub_register_command_p1.
* conf/common.rmk (grub_fstest_SOURCES): Add kern/list.c,
kern/command.c, lib/arg.c and commands/extcmd.c.
(pkglib_MODULES): Remove boot.mod, and minicmd.mod and extcmd.mod.
(minicmd_mod_SOURCES): New variable.
(minicmd_mod_CFLAGS): Likewise.
(minicmd_mod_LDFLAGS): Likewise.
(extcmd_mod_SOURCES): Likewise.
(extcmd_mod_CFLAGS): Likewise.
(extcmd_mod_LDFLAGS): Likewise.
(boot_mod_SOURCES): Removed.
(boot_mod_CFLAGS): Likewise.
(boot_mod_LDFLAGS): Likewise.
* conf/i386-pc.rmk (kernel_img_SOURCES): Add kern/command.c and
kern/corecmd.c.
(kernel_img_HEADERS): Add command.h.
(grub_emu_SOURCES): Remove commands/boot.c and normal/arg.c, add
commands/minicmd.c, kern/command.c, kern/corecmd.c, commands/extcmd.c
and lib/arg.c.
(pkglib_MODULES): Change _linux.mod, _chain.mod, _bsd.mod and
_multiboot.mod as linux.mod, chain.mod, bsd.mod and multiboot.mod,
remove the corresponding normal mode command.
(normal_mod_SOURCES): Remove normal/arg.c.
* conf/i386-coreboot.rmk: Likewise.
* conf/i386-efi.rmk: Likewise.
* conf/i386-ieee1275.rmk: Likewise.
* conf/powerpc-ieee1275.rmk: Likewise.
* conf/x86_64-efi.rmk: Likewise.
* include/grub/arg.h: Move from here ...
* include/grub/lib/arg.h: ... to here.
* normal/arg.c: Move from here ...
* lib/arg.c: ... to here.
* commands/extcmd.c: New file.
* commands/minicmd.c: Likewise.
* include/grub/command.h: Likewise.
* include/grub/extcmd.h: Likewise.
* kern/command.c: Likewise.
* kern/corecmd.c: Likewise.
* kern/list.c (grub_list_iterate): Return int instead of void.
(grub_list_insert): New function.
(grub_prio_list_insert): Likewise.
* kern/rescue.c (grub_rescue_command): Removed.
(grub_rescue_command_list): Likewise.
(grub_rescue_register_command): Likewise.
(grub_rescue_unregister_command): Likewise.
(grub_rescue_cmd_boot): Move to minicmd.c
(grub_rescue_cmd_help): Likewise.
(grub_rescue_cmd_info): Likewise.
(grub_rescue_cmd_boot): Likewise.
(grub_rescue_cmd_testload): Likewise.
(grub_rescue_cmd_dump): Likewise.
(grub_rescue_cmd_rmmod): Likewise.
(grub_rescue_cmd_lsmod): Likewise.
(grub_rescue_cmd_exit): Likewise.
(grub_rescue_print_devices): Moved to corecmd.c.
(grub_rescue_print_files): Likewise.
(grub_rescue_cmd_ls): Likewise.
(grub_rescue_cmd_insmod): Likewise.
(grub_rescue_cmd_set): Likewise.
(grub_rescue_cmd_unset): Likewise.
(attemp_normal_mode): Use grub_command_find to get normal module.
(grub_enter_rescue_mode): Use grub_register_core_commands to register
commands, remove grub_rescue_regiter_command calls.
* normal/command.c (grub_regiser_command): Removed.
(grub_unregister_command): Likewise.
(grub_command_find): Likewise.
(grub_iterate_commands): Likewise.
(rescue_command): Likewise.
(export_command): Moved to corecmd.c.
(set_command): Removed.
(unset_command): Likewise.
(insmod_command): Likewise.
(rmmod_command): Likewise.
(lsmod_command): Likewise.
(grub_command_init): Likewise.
* normal/completion.c (iterate_command): Use cmd->prio to check for
active command.
(complete_arguments): Use grub_extcmd_t structure to find options.
(grub_normal_do_completion): Change function grub_iterate_commands to
grub_command_iterate.
* normal/execute.c (grub_script_execute_cmd): No need to parse
argument here.
* normal/main.c (grub_dyncmd_dispatcher): New function.
(read_command_list): Register unload commands as dyncmd.
(grub_cmd_normal): Use new command interface, register rescue,
unregister normal at entry, register normal, unregister rescue at exit.
* include/grub/list.h (grub_list_test_t): New type.
(grub_list_iterate): Return int instead of void.
(grub_list_insert): New function.
(GRUB_AS_NAMED_LIST_P): New macro.
(GRUB_AS_PRIO_LIST): Likewise.
(GRUB_AS_PRIO_LIST_P): Likewise.
(GRUB_PRIO_LIST_PRIO_MASK): New constant.
(GRUB_PRIO_LIST_FLAG_ACTIVE): Likewise.
(grub_prio_list): New structure.
(grub_prio_list_insert): New function.
(grub_prio_list_remove): New inline function.
* include/grub/normal.h: Remove <grub/arg.h>, add <grub/command.h>.
(GRUB_COMMAND_FLAG_CMDLINE): Moved to command.h.
(GRUB_COMMAND_FLAG_MENU): Likewise.
(GRUB_COMMAND_FLAG_BOTH): Likewise.
(GRUB_COMMAND_FLAG_TITLE): Likewise.
(GRUB_COMMAND_FLAG_NO_ECHO): Likewise.
(GRUB_COMMAND_FLAG_NO_ARG_PARSE): Removed.
(GRUB_COMMAND_FLAG_NOT_LOADED): Likewise.
(grub_command): Likewise.
(grub_register_command): Likewise.
(grub_command_find): Likewise.
(grub_iterate_commands): Likewise.
(grub_command_init): Likewise.
(grub_arg_parse): Likewise.
(grub_arg_show_help): Likewise.
* include/grub/rescue.h (grub_rescue_register_command): Removed.
(grub_rescue_unregister_command): Likewise.
* include/grub/i386/bsd.h: Remove grub_rescue_cmd_freebsd,
grub_rescue_cmd_openbsd, grub_rescue_cmd_netbsd,
grub_rescue_cmd_freebsd_loadenv and grub_rescue_cmd_freebsd_module.
* include/grub/i386/efi/loader.h: Remove grub_rescue_cmd_linux and
grub_rescue_cmd_initrd.
* include/grub/i386/loader.h: Likewise.
* include/grub/x86_64/loader.h: Likewise.
* include/grub/i386/pc/chainloader.h: Remove grub_chainloader_cmd.
2009-03-21 08:39:59 +00:00
|
|
|
|
|
|
|
|
|
return grub_errno;
|
2004-07-27 17:47:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-03-21 Bean <bean123ch@gmail.com>
* commands/blocklist.c: Add include file <grub/command.h>, remove
<grub/normal.h> and <grub/arg.h>.
(grub_cmd_blocklist): Use the new command interface.
(GRUB_MOD_INIT): Likewise.
(GRUB_MOD_FINI): Likewise.
* commands/boot.c: Likewise.
* commands/cat.c: Likewise.
* commands/cmp.c: Likewise.
* commands/configfile.c: Likewise.
* commands/crc.c: Likewise.
* commands/echo.c: Likewise.
* commands/halt.c: Likewise.
* commands/handler.c: Likewise.
* commands/hdparm.c: Likewise.
* commands/help.c: Likewise.
* commands/hexdump.c: Likewise.
* commands/loadenv.c: Likewise.
* commands/ls.c: Likewise.
* commands/lsmmap.c: Likewise.
* commands/lspci.c: Likewise.
* commands/loadenv.c: Likewise.
* commands/read.c: Likewise.
* commands/reboot.c: Likewise.
* commands/search.c: Likewise.
* commands/sleep.c: Likewise.
* commands/test.c: Likewise.
* commands/usbtest.c: Likewise.
* commands/videotest.c: Likewise.
* commands/i386/cpuid.c: Likewise.
* commands/i386/pc/halt.c: Likewise.
* commands/i386/pc/play.c: Likewise.
* commands/i386/pc/pxecmd.c: Likewise.
* commands/i386/pc/vbeinfo.c: Likewise.
* commands/i386/pc/vbetest.c: Likewise.
* commands/ieee1275/suspend.c: Likewise.
* disk/loopback.c: Likewise.
* font/font_cmd.c: Likewise.
* hello/hello.c: Likewise.
* loader/efi/appleloader.c: Likewise.
* loader/efi/chainloader.c: Likewise.
* loader/i386/bsd.c: Likewise.
* loader/i386/efi/linux.c: Likewise.
* loader/i386/ieee1275/linux.c: Likewise.
* loader/i386/linux.c: Likewise.
* loader/i386/pc/chainloader.c: Likewise.
* loader/i386/pc/linux.c: Likewise.
* loader/powerpc/ieee1275/linux.c: Likewise.
* loader/multiboot_loader.c: Likewise.
* term/gfxterm.c: Likewise.
* term/i386/pc/serial.c: Likewise.
* term/terminfo.c: Likewise.
* term/i386/pc/vesafb.c: Removed <grub/arg.h>.
* term/i386/pc/vga.c: Likewise.
* video/readers/jpeg.c: Likewise.
* video/readers/png.c: Likewise.
* video/readers/tga.c: Likewise.
* util/grub-fstest (cmd_loopback): Removed.
(cmd_blocklist): Likewise.
(cmd_ls): Likewise.
(grub_register_command): Likewise.
(grub_unregister_command): Likewise.
(execute_command): Use grub_command_find to locate command and execute
it.
* include/grub/efi/chainloader.h: Removed.
* loader/efi/chainloader_normal.c: Likewise.
* loader/i386/bsd_normal.c: Likewise.
* loader/i386/pc/chainloader_normal.c: Likewise.
* loader/i386/pc/multiboot_normal.c: Likewise.
* loader/linux_normal.c: Likewise.
* loader/multiboot_loader_normal.c: Likewise.
* loader/powerpc/ieee1275/linux_normal.c: Likewise.
* gencmdlist.sh: Scan new registration command grub_register_extcmd
and grub_register_command_p1.
* conf/common.rmk (grub_fstest_SOURCES): Add kern/list.c,
kern/command.c, lib/arg.c and commands/extcmd.c.
(pkglib_MODULES): Remove boot.mod, and minicmd.mod and extcmd.mod.
(minicmd_mod_SOURCES): New variable.
(minicmd_mod_CFLAGS): Likewise.
(minicmd_mod_LDFLAGS): Likewise.
(extcmd_mod_SOURCES): Likewise.
(extcmd_mod_CFLAGS): Likewise.
(extcmd_mod_LDFLAGS): Likewise.
(boot_mod_SOURCES): Removed.
(boot_mod_CFLAGS): Likewise.
(boot_mod_LDFLAGS): Likewise.
* conf/i386-pc.rmk (kernel_img_SOURCES): Add kern/command.c and
kern/corecmd.c.
(kernel_img_HEADERS): Add command.h.
(grub_emu_SOURCES): Remove commands/boot.c and normal/arg.c, add
commands/minicmd.c, kern/command.c, kern/corecmd.c, commands/extcmd.c
and lib/arg.c.
(pkglib_MODULES): Change _linux.mod, _chain.mod, _bsd.mod and
_multiboot.mod as linux.mod, chain.mod, bsd.mod and multiboot.mod,
remove the corresponding normal mode command.
(normal_mod_SOURCES): Remove normal/arg.c.
* conf/i386-coreboot.rmk: Likewise.
* conf/i386-efi.rmk: Likewise.
* conf/i386-ieee1275.rmk: Likewise.
* conf/powerpc-ieee1275.rmk: Likewise.
* conf/x86_64-efi.rmk: Likewise.
* include/grub/arg.h: Move from here ...
* include/grub/lib/arg.h: ... to here.
* normal/arg.c: Move from here ...
* lib/arg.c: ... to here.
* commands/extcmd.c: New file.
* commands/minicmd.c: Likewise.
* include/grub/command.h: Likewise.
* include/grub/extcmd.h: Likewise.
* kern/command.c: Likewise.
* kern/corecmd.c: Likewise.
* kern/list.c (grub_list_iterate): Return int instead of void.
(grub_list_insert): New function.
(grub_prio_list_insert): Likewise.
* kern/rescue.c (grub_rescue_command): Removed.
(grub_rescue_command_list): Likewise.
(grub_rescue_register_command): Likewise.
(grub_rescue_unregister_command): Likewise.
(grub_rescue_cmd_boot): Move to minicmd.c
(grub_rescue_cmd_help): Likewise.
(grub_rescue_cmd_info): Likewise.
(grub_rescue_cmd_boot): Likewise.
(grub_rescue_cmd_testload): Likewise.
(grub_rescue_cmd_dump): Likewise.
(grub_rescue_cmd_rmmod): Likewise.
(grub_rescue_cmd_lsmod): Likewise.
(grub_rescue_cmd_exit): Likewise.
(grub_rescue_print_devices): Moved to corecmd.c.
(grub_rescue_print_files): Likewise.
(grub_rescue_cmd_ls): Likewise.
(grub_rescue_cmd_insmod): Likewise.
(grub_rescue_cmd_set): Likewise.
(grub_rescue_cmd_unset): Likewise.
(attemp_normal_mode): Use grub_command_find to get normal module.
(grub_enter_rescue_mode): Use grub_register_core_commands to register
commands, remove grub_rescue_regiter_command calls.
* normal/command.c (grub_regiser_command): Removed.
(grub_unregister_command): Likewise.
(grub_command_find): Likewise.
(grub_iterate_commands): Likewise.
(rescue_command): Likewise.
(export_command): Moved to corecmd.c.
(set_command): Removed.
(unset_command): Likewise.
(insmod_command): Likewise.
(rmmod_command): Likewise.
(lsmod_command): Likewise.
(grub_command_init): Likewise.
* normal/completion.c (iterate_command): Use cmd->prio to check for
active command.
(complete_arguments): Use grub_extcmd_t structure to find options.
(grub_normal_do_completion): Change function grub_iterate_commands to
grub_command_iterate.
* normal/execute.c (grub_script_execute_cmd): No need to parse
argument here.
* normal/main.c (grub_dyncmd_dispatcher): New function.
(read_command_list): Register unload commands as dyncmd.
(grub_cmd_normal): Use new command interface, register rescue,
unregister normal at entry, register normal, unregister rescue at exit.
* include/grub/list.h (grub_list_test_t): New type.
(grub_list_iterate): Return int instead of void.
(grub_list_insert): New function.
(GRUB_AS_NAMED_LIST_P): New macro.
(GRUB_AS_PRIO_LIST): Likewise.
(GRUB_AS_PRIO_LIST_P): Likewise.
(GRUB_PRIO_LIST_PRIO_MASK): New constant.
(GRUB_PRIO_LIST_FLAG_ACTIVE): Likewise.
(grub_prio_list): New structure.
(grub_prio_list_insert): New function.
(grub_prio_list_remove): New inline function.
* include/grub/normal.h: Remove <grub/arg.h>, add <grub/command.h>.
(GRUB_COMMAND_FLAG_CMDLINE): Moved to command.h.
(GRUB_COMMAND_FLAG_MENU): Likewise.
(GRUB_COMMAND_FLAG_BOTH): Likewise.
(GRUB_COMMAND_FLAG_TITLE): Likewise.
(GRUB_COMMAND_FLAG_NO_ECHO): Likewise.
(GRUB_COMMAND_FLAG_NO_ARG_PARSE): Removed.
(GRUB_COMMAND_FLAG_NOT_LOADED): Likewise.
(grub_command): Likewise.
(grub_register_command): Likewise.
(grub_command_find): Likewise.
(grub_iterate_commands): Likewise.
(grub_command_init): Likewise.
(grub_arg_parse): Likewise.
(grub_arg_show_help): Likewise.
* include/grub/rescue.h (grub_rescue_register_command): Removed.
(grub_rescue_unregister_command): Likewise.
* include/grub/i386/bsd.h: Remove grub_rescue_cmd_freebsd,
grub_rescue_cmd_openbsd, grub_rescue_cmd_netbsd,
grub_rescue_cmd_freebsd_loadenv and grub_rescue_cmd_freebsd_module.
* include/grub/i386/efi/loader.h: Remove grub_rescue_cmd_linux and
grub_rescue_cmd_initrd.
* include/grub/i386/loader.h: Likewise.
* include/grub/x86_64/loader.h: Likewise.
* include/grub/i386/pc/chainloader.h: Remove grub_chainloader_cmd.
2009-03-21 08:39:59 +00:00
|
|
|
|
static grub_err_t
|
|
|
|
|
grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
|
|
|
|
|
int argc, char *argv[])
|
2004-07-27 17:47:37 +00:00
|
|
|
|
{
|
2012-01-13 12:54:24 +00:00
|
|
|
|
grub_file_t *files = 0;
|
|
|
|
|
grub_size_t size = 0;
|
2005-11-23 04:25:16 +00:00
|
|
|
|
grub_addr_t first_addr;
|
2005-01-31 21:44:35 +00:00
|
|
|
|
grub_addr_t addr;
|
2012-01-13 12:54:24 +00:00
|
|
|
|
int i;
|
|
|
|
|
int nfiles = 0;
|
|
|
|
|
grub_uint8_t *ptr;
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2005-01-31 21:44:35 +00:00
|
|
|
|
if (argc == 0)
|
|
|
|
|
{
|
2012-02-08 18:26:01 +00:00
|
|
|
|
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
2005-01-31 21:44:35 +00:00
|
|
|
|
goto fail;
|
|
|
|
|
}
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2005-01-31 21:44:35 +00:00
|
|
|
|
if (!loaded)
|
|
|
|
|
{
|
2012-02-08 18:26:01 +00:00
|
|
|
|
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("you need to load the kernel first"));
|
2005-01-31 21:44:35 +00:00
|
|
|
|
goto fail;
|
|
|
|
|
}
|
2004-07-27 17:47:37 +00:00
|
|
|
|
|
2012-01-13 12:54:24 +00:00
|
|
|
|
files = grub_zalloc (argc * sizeof (files[0]));
|
|
|
|
|
if (!files)
|
2005-01-31 21:44:35 +00:00
|
|
|
|
goto fail;
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2012-01-13 12:54:24 +00:00
|
|
|
|
for (i = 0; i < argc; i++)
|
|
|
|
|
{
|
|
|
|
|
grub_file_filter_disable_compression ();
|
|
|
|
|
files[i] = grub_file_open (argv[i]);
|
|
|
|
|
if (! files[i])
|
|
|
|
|
goto fail;
|
|
|
|
|
nfiles++;
|
2012-03-05 00:17:55 +00:00
|
|
|
|
size += ALIGN_UP (grub_file_size (files[i]), 4);
|
2012-01-13 12:54:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-11-23 04:25:16 +00:00
|
|
|
|
first_addr = linux_addr + linux_size;
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2005-11-23 04:25:16 +00:00
|
|
|
|
/* Attempt to claim at a series of addresses until successful in
|
|
|
|
|
the same way that grub_rescue_cmd_linux does. */
|
2010-11-08 13:14:54 +00:00
|
|
|
|
addr = grub_linux_claimmap_iterate (first_addr, size, 0x100000);
|
|
|
|
|
if (addr == (grub_addr_t) -1)
|
|
|
|
|
goto fail;
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
|
|
|
|
grub_dprintf ("loader", "Loading initrd at 0x%x, size 0x%x\n", addr, size);
|
|
|
|
|
|
2012-01-13 12:54:24 +00:00
|
|
|
|
ptr = (void *) addr;
|
|
|
|
|
for (i = 0; i < nfiles; i++)
|
2005-01-31 21:44:35 +00:00
|
|
|
|
{
|
2012-01-13 12:54:24 +00:00
|
|
|
|
grub_ssize_t cursize = grub_file_size (files[i]);
|
|
|
|
|
if (grub_file_read (files[i], ptr, cursize) != cursize)
|
|
|
|
|
{
|
|
|
|
|
grub_ieee1275_release (addr, size);
|
|
|
|
|
if (!grub_errno)
|
|
|
|
|
grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"),
|
|
|
|
|
argv[i]);
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
|
|
|
|
ptr += cursize;
|
2012-03-05 00:17:55 +00:00
|
|
|
|
grub_memset (ptr, 0, ALIGN_UP_OVERHEAD (cursize, 4));
|
|
|
|
|
ptr += ALIGN_UP_OVERHEAD (cursize, 4);
|
2005-01-31 21:44:35 +00:00
|
|
|
|
}
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2005-01-31 21:44:35 +00:00
|
|
|
|
initrd_addr = addr;
|
|
|
|
|
initrd_size = size;
|
2005-07-12 22:36:43 +00:00
|
|
|
|
|
2005-01-31 21:44:35 +00:00
|
|
|
|
fail:
|
2012-01-14 10:42:52 +00:00
|
|
|
|
for (i = 0; i < nfiles; i++)
|
|
|
|
|
grub_file_close (files[i]);
|
|
|
|
|
grub_free (files);
|
2004-07-27 17:47:37 +00:00
|
|
|
|
|
2009-03-21 Bean <bean123ch@gmail.com>
* commands/blocklist.c: Add include file <grub/command.h>, remove
<grub/normal.h> and <grub/arg.h>.
(grub_cmd_blocklist): Use the new command interface.
(GRUB_MOD_INIT): Likewise.
(GRUB_MOD_FINI): Likewise.
* commands/boot.c: Likewise.
* commands/cat.c: Likewise.
* commands/cmp.c: Likewise.
* commands/configfile.c: Likewise.
* commands/crc.c: Likewise.
* commands/echo.c: Likewise.
* commands/halt.c: Likewise.
* commands/handler.c: Likewise.
* commands/hdparm.c: Likewise.
* commands/help.c: Likewise.
* commands/hexdump.c: Likewise.
* commands/loadenv.c: Likewise.
* commands/ls.c: Likewise.
* commands/lsmmap.c: Likewise.
* commands/lspci.c: Likewise.
* commands/loadenv.c: Likewise.
* commands/read.c: Likewise.
* commands/reboot.c: Likewise.
* commands/search.c: Likewise.
* commands/sleep.c: Likewise.
* commands/test.c: Likewise.
* commands/usbtest.c: Likewise.
* commands/videotest.c: Likewise.
* commands/i386/cpuid.c: Likewise.
* commands/i386/pc/halt.c: Likewise.
* commands/i386/pc/play.c: Likewise.
* commands/i386/pc/pxecmd.c: Likewise.
* commands/i386/pc/vbeinfo.c: Likewise.
* commands/i386/pc/vbetest.c: Likewise.
* commands/ieee1275/suspend.c: Likewise.
* disk/loopback.c: Likewise.
* font/font_cmd.c: Likewise.
* hello/hello.c: Likewise.
* loader/efi/appleloader.c: Likewise.
* loader/efi/chainloader.c: Likewise.
* loader/i386/bsd.c: Likewise.
* loader/i386/efi/linux.c: Likewise.
* loader/i386/ieee1275/linux.c: Likewise.
* loader/i386/linux.c: Likewise.
* loader/i386/pc/chainloader.c: Likewise.
* loader/i386/pc/linux.c: Likewise.
* loader/powerpc/ieee1275/linux.c: Likewise.
* loader/multiboot_loader.c: Likewise.
* term/gfxterm.c: Likewise.
* term/i386/pc/serial.c: Likewise.
* term/terminfo.c: Likewise.
* term/i386/pc/vesafb.c: Removed <grub/arg.h>.
* term/i386/pc/vga.c: Likewise.
* video/readers/jpeg.c: Likewise.
* video/readers/png.c: Likewise.
* video/readers/tga.c: Likewise.
* util/grub-fstest (cmd_loopback): Removed.
(cmd_blocklist): Likewise.
(cmd_ls): Likewise.
(grub_register_command): Likewise.
(grub_unregister_command): Likewise.
(execute_command): Use grub_command_find to locate command and execute
it.
* include/grub/efi/chainloader.h: Removed.
* loader/efi/chainloader_normal.c: Likewise.
* loader/i386/bsd_normal.c: Likewise.
* loader/i386/pc/chainloader_normal.c: Likewise.
* loader/i386/pc/multiboot_normal.c: Likewise.
* loader/linux_normal.c: Likewise.
* loader/multiboot_loader_normal.c: Likewise.
* loader/powerpc/ieee1275/linux_normal.c: Likewise.
* gencmdlist.sh: Scan new registration command grub_register_extcmd
and grub_register_command_p1.
* conf/common.rmk (grub_fstest_SOURCES): Add kern/list.c,
kern/command.c, lib/arg.c and commands/extcmd.c.
(pkglib_MODULES): Remove boot.mod, and minicmd.mod and extcmd.mod.
(minicmd_mod_SOURCES): New variable.
(minicmd_mod_CFLAGS): Likewise.
(minicmd_mod_LDFLAGS): Likewise.
(extcmd_mod_SOURCES): Likewise.
(extcmd_mod_CFLAGS): Likewise.
(extcmd_mod_LDFLAGS): Likewise.
(boot_mod_SOURCES): Removed.
(boot_mod_CFLAGS): Likewise.
(boot_mod_LDFLAGS): Likewise.
* conf/i386-pc.rmk (kernel_img_SOURCES): Add kern/command.c and
kern/corecmd.c.
(kernel_img_HEADERS): Add command.h.
(grub_emu_SOURCES): Remove commands/boot.c and normal/arg.c, add
commands/minicmd.c, kern/command.c, kern/corecmd.c, commands/extcmd.c
and lib/arg.c.
(pkglib_MODULES): Change _linux.mod, _chain.mod, _bsd.mod and
_multiboot.mod as linux.mod, chain.mod, bsd.mod and multiboot.mod,
remove the corresponding normal mode command.
(normal_mod_SOURCES): Remove normal/arg.c.
* conf/i386-coreboot.rmk: Likewise.
* conf/i386-efi.rmk: Likewise.
* conf/i386-ieee1275.rmk: Likewise.
* conf/powerpc-ieee1275.rmk: Likewise.
* conf/x86_64-efi.rmk: Likewise.
* include/grub/arg.h: Move from here ...
* include/grub/lib/arg.h: ... to here.
* normal/arg.c: Move from here ...
* lib/arg.c: ... to here.
* commands/extcmd.c: New file.
* commands/minicmd.c: Likewise.
* include/grub/command.h: Likewise.
* include/grub/extcmd.h: Likewise.
* kern/command.c: Likewise.
* kern/corecmd.c: Likewise.
* kern/list.c (grub_list_iterate): Return int instead of void.
(grub_list_insert): New function.
(grub_prio_list_insert): Likewise.
* kern/rescue.c (grub_rescue_command): Removed.
(grub_rescue_command_list): Likewise.
(grub_rescue_register_command): Likewise.
(grub_rescue_unregister_command): Likewise.
(grub_rescue_cmd_boot): Move to minicmd.c
(grub_rescue_cmd_help): Likewise.
(grub_rescue_cmd_info): Likewise.
(grub_rescue_cmd_boot): Likewise.
(grub_rescue_cmd_testload): Likewise.
(grub_rescue_cmd_dump): Likewise.
(grub_rescue_cmd_rmmod): Likewise.
(grub_rescue_cmd_lsmod): Likewise.
(grub_rescue_cmd_exit): Likewise.
(grub_rescue_print_devices): Moved to corecmd.c.
(grub_rescue_print_files): Likewise.
(grub_rescue_cmd_ls): Likewise.
(grub_rescue_cmd_insmod): Likewise.
(grub_rescue_cmd_set): Likewise.
(grub_rescue_cmd_unset): Likewise.
(attemp_normal_mode): Use grub_command_find to get normal module.
(grub_enter_rescue_mode): Use grub_register_core_commands to register
commands, remove grub_rescue_regiter_command calls.
* normal/command.c (grub_regiser_command): Removed.
(grub_unregister_command): Likewise.
(grub_command_find): Likewise.
(grub_iterate_commands): Likewise.
(rescue_command): Likewise.
(export_command): Moved to corecmd.c.
(set_command): Removed.
(unset_command): Likewise.
(insmod_command): Likewise.
(rmmod_command): Likewise.
(lsmod_command): Likewise.
(grub_command_init): Likewise.
* normal/completion.c (iterate_command): Use cmd->prio to check for
active command.
(complete_arguments): Use grub_extcmd_t structure to find options.
(grub_normal_do_completion): Change function grub_iterate_commands to
grub_command_iterate.
* normal/execute.c (grub_script_execute_cmd): No need to parse
argument here.
* normal/main.c (grub_dyncmd_dispatcher): New function.
(read_command_list): Register unload commands as dyncmd.
(grub_cmd_normal): Use new command interface, register rescue,
unregister normal at entry, register normal, unregister rescue at exit.
* include/grub/list.h (grub_list_test_t): New type.
(grub_list_iterate): Return int instead of void.
(grub_list_insert): New function.
(GRUB_AS_NAMED_LIST_P): New macro.
(GRUB_AS_PRIO_LIST): Likewise.
(GRUB_AS_PRIO_LIST_P): Likewise.
(GRUB_PRIO_LIST_PRIO_MASK): New constant.
(GRUB_PRIO_LIST_FLAG_ACTIVE): Likewise.
(grub_prio_list): New structure.
(grub_prio_list_insert): New function.
(grub_prio_list_remove): New inline function.
* include/grub/normal.h: Remove <grub/arg.h>, add <grub/command.h>.
(GRUB_COMMAND_FLAG_CMDLINE): Moved to command.h.
(GRUB_COMMAND_FLAG_MENU): Likewise.
(GRUB_COMMAND_FLAG_BOTH): Likewise.
(GRUB_COMMAND_FLAG_TITLE): Likewise.
(GRUB_COMMAND_FLAG_NO_ECHO): Likewise.
(GRUB_COMMAND_FLAG_NO_ARG_PARSE): Removed.
(GRUB_COMMAND_FLAG_NOT_LOADED): Likewise.
(grub_command): Likewise.
(grub_register_command): Likewise.
(grub_command_find): Likewise.
(grub_iterate_commands): Likewise.
(grub_command_init): Likewise.
(grub_arg_parse): Likewise.
(grub_arg_show_help): Likewise.
* include/grub/rescue.h (grub_rescue_register_command): Removed.
(grub_rescue_unregister_command): Likewise.
* include/grub/i386/bsd.h: Remove grub_rescue_cmd_freebsd,
grub_rescue_cmd_openbsd, grub_rescue_cmd_netbsd,
grub_rescue_cmd_freebsd_loadenv and grub_rescue_cmd_freebsd_module.
* include/grub/i386/efi/loader.h: Remove grub_rescue_cmd_linux and
grub_rescue_cmd_initrd.
* include/grub/i386/loader.h: Likewise.
* include/grub/x86_64/loader.h: Likewise.
* include/grub/i386/pc/chainloader.h: Remove grub_chainloader_cmd.
2009-03-21 08:39:59 +00:00
|
|
|
|
return grub_errno;
|
|
|
|
|
}
|
2005-01-31 21:44:35 +00:00
|
|
|
|
|
2009-03-21 Bean <bean123ch@gmail.com>
* commands/blocklist.c: Add include file <grub/command.h>, remove
<grub/normal.h> and <grub/arg.h>.
(grub_cmd_blocklist): Use the new command interface.
(GRUB_MOD_INIT): Likewise.
(GRUB_MOD_FINI): Likewise.
* commands/boot.c: Likewise.
* commands/cat.c: Likewise.
* commands/cmp.c: Likewise.
* commands/configfile.c: Likewise.
* commands/crc.c: Likewise.
* commands/echo.c: Likewise.
* commands/halt.c: Likewise.
* commands/handler.c: Likewise.
* commands/hdparm.c: Likewise.
* commands/help.c: Likewise.
* commands/hexdump.c: Likewise.
* commands/loadenv.c: Likewise.
* commands/ls.c: Likewise.
* commands/lsmmap.c: Likewise.
* commands/lspci.c: Likewise.
* commands/loadenv.c: Likewise.
* commands/read.c: Likewise.
* commands/reboot.c: Likewise.
* commands/search.c: Likewise.
* commands/sleep.c: Likewise.
* commands/test.c: Likewise.
* commands/usbtest.c: Likewise.
* commands/videotest.c: Likewise.
* commands/i386/cpuid.c: Likewise.
* commands/i386/pc/halt.c: Likewise.
* commands/i386/pc/play.c: Likewise.
* commands/i386/pc/pxecmd.c: Likewise.
* commands/i386/pc/vbeinfo.c: Likewise.
* commands/i386/pc/vbetest.c: Likewise.
* commands/ieee1275/suspend.c: Likewise.
* disk/loopback.c: Likewise.
* font/font_cmd.c: Likewise.
* hello/hello.c: Likewise.
* loader/efi/appleloader.c: Likewise.
* loader/efi/chainloader.c: Likewise.
* loader/i386/bsd.c: Likewise.
* loader/i386/efi/linux.c: Likewise.
* loader/i386/ieee1275/linux.c: Likewise.
* loader/i386/linux.c: Likewise.
* loader/i386/pc/chainloader.c: Likewise.
* loader/i386/pc/linux.c: Likewise.
* loader/powerpc/ieee1275/linux.c: Likewise.
* loader/multiboot_loader.c: Likewise.
* term/gfxterm.c: Likewise.
* term/i386/pc/serial.c: Likewise.
* term/terminfo.c: Likewise.
* term/i386/pc/vesafb.c: Removed <grub/arg.h>.
* term/i386/pc/vga.c: Likewise.
* video/readers/jpeg.c: Likewise.
* video/readers/png.c: Likewise.
* video/readers/tga.c: Likewise.
* util/grub-fstest (cmd_loopback): Removed.
(cmd_blocklist): Likewise.
(cmd_ls): Likewise.
(grub_register_command): Likewise.
(grub_unregister_command): Likewise.
(execute_command): Use grub_command_find to locate command and execute
it.
* include/grub/efi/chainloader.h: Removed.
* loader/efi/chainloader_normal.c: Likewise.
* loader/i386/bsd_normal.c: Likewise.
* loader/i386/pc/chainloader_normal.c: Likewise.
* loader/i386/pc/multiboot_normal.c: Likewise.
* loader/linux_normal.c: Likewise.
* loader/multiboot_loader_normal.c: Likewise.
* loader/powerpc/ieee1275/linux_normal.c: Likewise.
* gencmdlist.sh: Scan new registration command grub_register_extcmd
and grub_register_command_p1.
* conf/common.rmk (grub_fstest_SOURCES): Add kern/list.c,
kern/command.c, lib/arg.c and commands/extcmd.c.
(pkglib_MODULES): Remove boot.mod, and minicmd.mod and extcmd.mod.
(minicmd_mod_SOURCES): New variable.
(minicmd_mod_CFLAGS): Likewise.
(minicmd_mod_LDFLAGS): Likewise.
(extcmd_mod_SOURCES): Likewise.
(extcmd_mod_CFLAGS): Likewise.
(extcmd_mod_LDFLAGS): Likewise.
(boot_mod_SOURCES): Removed.
(boot_mod_CFLAGS): Likewise.
(boot_mod_LDFLAGS): Likewise.
* conf/i386-pc.rmk (kernel_img_SOURCES): Add kern/command.c and
kern/corecmd.c.
(kernel_img_HEADERS): Add command.h.
(grub_emu_SOURCES): Remove commands/boot.c and normal/arg.c, add
commands/minicmd.c, kern/command.c, kern/corecmd.c, commands/extcmd.c
and lib/arg.c.
(pkglib_MODULES): Change _linux.mod, _chain.mod, _bsd.mod and
_multiboot.mod as linux.mod, chain.mod, bsd.mod and multiboot.mod,
remove the corresponding normal mode command.
(normal_mod_SOURCES): Remove normal/arg.c.
* conf/i386-coreboot.rmk: Likewise.
* conf/i386-efi.rmk: Likewise.
* conf/i386-ieee1275.rmk: Likewise.
* conf/powerpc-ieee1275.rmk: Likewise.
* conf/x86_64-efi.rmk: Likewise.
* include/grub/arg.h: Move from here ...
* include/grub/lib/arg.h: ... to here.
* normal/arg.c: Move from here ...
* lib/arg.c: ... to here.
* commands/extcmd.c: New file.
* commands/minicmd.c: Likewise.
* include/grub/command.h: Likewise.
* include/grub/extcmd.h: Likewise.
* kern/command.c: Likewise.
* kern/corecmd.c: Likewise.
* kern/list.c (grub_list_iterate): Return int instead of void.
(grub_list_insert): New function.
(grub_prio_list_insert): Likewise.
* kern/rescue.c (grub_rescue_command): Removed.
(grub_rescue_command_list): Likewise.
(grub_rescue_register_command): Likewise.
(grub_rescue_unregister_command): Likewise.
(grub_rescue_cmd_boot): Move to minicmd.c
(grub_rescue_cmd_help): Likewise.
(grub_rescue_cmd_info): Likewise.
(grub_rescue_cmd_boot): Likewise.
(grub_rescue_cmd_testload): Likewise.
(grub_rescue_cmd_dump): Likewise.
(grub_rescue_cmd_rmmod): Likewise.
(grub_rescue_cmd_lsmod): Likewise.
(grub_rescue_cmd_exit): Likewise.
(grub_rescue_print_devices): Moved to corecmd.c.
(grub_rescue_print_files): Likewise.
(grub_rescue_cmd_ls): Likewise.
(grub_rescue_cmd_insmod): Likewise.
(grub_rescue_cmd_set): Likewise.
(grub_rescue_cmd_unset): Likewise.
(attemp_normal_mode): Use grub_command_find to get normal module.
(grub_enter_rescue_mode): Use grub_register_core_commands to register
commands, remove grub_rescue_regiter_command calls.
* normal/command.c (grub_regiser_command): Removed.
(grub_unregister_command): Likewise.
(grub_command_find): Likewise.
(grub_iterate_commands): Likewise.
(rescue_command): Likewise.
(export_command): Moved to corecmd.c.
(set_command): Removed.
(unset_command): Likewise.
(insmod_command): Likewise.
(rmmod_command): Likewise.
(lsmod_command): Likewise.
(grub_command_init): Likewise.
* normal/completion.c (iterate_command): Use cmd->prio to check for
active command.
(complete_arguments): Use grub_extcmd_t structure to find options.
(grub_normal_do_completion): Change function grub_iterate_commands to
grub_command_iterate.
* normal/execute.c (grub_script_execute_cmd): No need to parse
argument here.
* normal/main.c (grub_dyncmd_dispatcher): New function.
(read_command_list): Register unload commands as dyncmd.
(grub_cmd_normal): Use new command interface, register rescue,
unregister normal at entry, register normal, unregister rescue at exit.
* include/grub/list.h (grub_list_test_t): New type.
(grub_list_iterate): Return int instead of void.
(grub_list_insert): New function.
(GRUB_AS_NAMED_LIST_P): New macro.
(GRUB_AS_PRIO_LIST): Likewise.
(GRUB_AS_PRIO_LIST_P): Likewise.
(GRUB_PRIO_LIST_PRIO_MASK): New constant.
(GRUB_PRIO_LIST_FLAG_ACTIVE): Likewise.
(grub_prio_list): New structure.
(grub_prio_list_insert): New function.
(grub_prio_list_remove): New inline function.
* include/grub/normal.h: Remove <grub/arg.h>, add <grub/command.h>.
(GRUB_COMMAND_FLAG_CMDLINE): Moved to command.h.
(GRUB_COMMAND_FLAG_MENU): Likewise.
(GRUB_COMMAND_FLAG_BOTH): Likewise.
(GRUB_COMMAND_FLAG_TITLE): Likewise.
(GRUB_COMMAND_FLAG_NO_ECHO): Likewise.
(GRUB_COMMAND_FLAG_NO_ARG_PARSE): Removed.
(GRUB_COMMAND_FLAG_NOT_LOADED): Likewise.
(grub_command): Likewise.
(grub_register_command): Likewise.
(grub_command_find): Likewise.
(grub_iterate_commands): Likewise.
(grub_command_init): Likewise.
(grub_arg_parse): Likewise.
(grub_arg_show_help): Likewise.
* include/grub/rescue.h (grub_rescue_register_command): Removed.
(grub_rescue_unregister_command): Likewise.
* include/grub/i386/bsd.h: Remove grub_rescue_cmd_freebsd,
grub_rescue_cmd_openbsd, grub_rescue_cmd_netbsd,
grub_rescue_cmd_freebsd_loadenv and grub_rescue_cmd_freebsd_module.
* include/grub/i386/efi/loader.h: Remove grub_rescue_cmd_linux and
grub_rescue_cmd_initrd.
* include/grub/i386/loader.h: Likewise.
* include/grub/x86_64/loader.h: Likewise.
* include/grub/i386/pc/chainloader.h: Remove grub_chainloader_cmd.
2009-03-21 08:39:59 +00:00
|
|
|
|
static grub_command_t cmd_linux, cmd_initrd;
|
2005-01-31 21:44:35 +00:00
|
|
|
|
|
2005-11-13 Marco Gerards <mgerards@xs4all.nl>
* geninit.sh: New file.
* geninitheader.sh: Likewise.
* commands/boot.c (grub_boot_init, grub_boot_fini): Removed.
* commands/cat.c (grub_cat_init, grub_cat_fini): Likewise.
* commands/cmp.c (grub_cmp_init, grub_cmp_fini): Likewise.
* commands/configfile.c (grub_configfile_init)
(grub_configfile_fini): Likewise.
* commands/default.c (grub_default_init, grub_default_fini):
Likewise.
* commands/help.c (grub_help_init, grub_help_fini): Likewise.
* commands/ls.c (grub_ls_init, grub_ls_fini): Likewise.
* commands/search.c (grub_search_init, grub_search_fini): Likewise.
* commands/terminal.c (grub_terminal_init, grub_terminal_fini):
Likewise.
* commands/test.c (grub_test_init, grub_test_fini): Likewise.
* commands/timeout.c (grub_timeout_init, grub_timeout_fini):
Likewise.
* commands/i386/pc/halt.c (grub_halt_init, grub_halt_fini): Likewise.
* commands/iee1275/halt.c (grub_halt_init, grub_halt_fini):
Likewise.
* commands/i386/pc/reboot.c (grub_reboot_init, grub_reboot_fini):
Likewise.
* commands/iee1275/reboot.c (grub_reboot_init, grub_reboot_fini):
Likewise.
* disk/loopback.c (grub_loop_init, grub_loop_fini): Likewise.
* fs/affs.c (grub_affs_init, grub_affs_fini): Likewise.
* fs/ext2.c (grub_ext2_init, grub_ext2_fini): Likewise.
* fs/fat.c (grub_fat_init, grub_fat_fini): Likewise.
* fs/hfs.c (grub_hfs_init, grub_hfs_fini): Likewise.
* fs/iso9660.c (grub_iso9660_init, grub_iso9660_fini): Likewise.
* fs/jfs.c (grub_jfs_init, grub_jfs_fini): Likewise.
* fs/minix.c (grub_minix_init, grub_minix_fini): Likewise.
* fs/sfs.c (grub_sfs_init, grub_sfs_fini): Likewise.
* fs/ufs.c (grub_ufs_init, grub_ufs_fini): Likewise.
* fs/xfs.c (grub_xfs_init, grub_xfs_fini): Likewise.
* normal/main.c (grub_normal_init, grub_normal_fini): Likewise.
* partmap/amiga.c (grub_amiga_partition_map_init)
(grub_amiga_partition_map_fini): Likewise.
* partmap/apple.c (grub_apple_partition_map_init)
(grub_apple_partition_map_fini): Likewise.
* partmap/pc.c (grub_pc_partition_map_init)
(grub_pc_partition_map_fini): Likewise.
* partmap/sun.c (grub_sun_partition_map_init,
grub_sun_partition_map_fini): Likewise.
* term/terminfo.c (grub_terminal_init, grub_terminal_fini):
Likewise.
* util/grub-emu.c: Include <grub_modules_init.h>.
(main): Don't initialize and de-initialize any modules directly,
use `grub_init_all' and `grub_fini_all' instead.
* term/i386/pc/vesafb.c (grub_vesafb_init): Renamed to
`grub_vesafb_mod_init'.
(grub_vesafb_fini): Renamed to `grub_vesafb_mod_fini'. Updated
all users.
* term/i386/pc/vga.c (grub_vga_init): Renamed to
`grub_vga_mod_init'. Updated all users.
(grub_vga_fini): Renamed to `grub_vga_mod_fini'.
* conf/i386-pc.rmk (grub_emu_SOURCES): Add `grub_emu_init.c'.
(grub_modules_init.lst, grub_modules_init.h, grub_emu_init.c): New
rules.
* include/grub/dl.h (GRUB_MOD_INIT): Add argument `name'.
Generate a function to initialize the module in utilities.
Updated all callers.
(GRUB_MOD_FINI): Add argument `name'. Generate a function to
initialize the module in utilities. Updated all callers.
2005-11-13 15:47:09 +00:00
|
|
|
|
GRUB_MOD_INIT(linux)
|
2004-07-27 17:47:37 +00:00
|
|
|
|
{
|
2009-03-21 Bean <bean123ch@gmail.com>
* commands/blocklist.c: Add include file <grub/command.h>, remove
<grub/normal.h> and <grub/arg.h>.
(grub_cmd_blocklist): Use the new command interface.
(GRUB_MOD_INIT): Likewise.
(GRUB_MOD_FINI): Likewise.
* commands/boot.c: Likewise.
* commands/cat.c: Likewise.
* commands/cmp.c: Likewise.
* commands/configfile.c: Likewise.
* commands/crc.c: Likewise.
* commands/echo.c: Likewise.
* commands/halt.c: Likewise.
* commands/handler.c: Likewise.
* commands/hdparm.c: Likewise.
* commands/help.c: Likewise.
* commands/hexdump.c: Likewise.
* commands/loadenv.c: Likewise.
* commands/ls.c: Likewise.
* commands/lsmmap.c: Likewise.
* commands/lspci.c: Likewise.
* commands/loadenv.c: Likewise.
* commands/read.c: Likewise.
* commands/reboot.c: Likewise.
* commands/search.c: Likewise.
* commands/sleep.c: Likewise.
* commands/test.c: Likewise.
* commands/usbtest.c: Likewise.
* commands/videotest.c: Likewise.
* commands/i386/cpuid.c: Likewise.
* commands/i386/pc/halt.c: Likewise.
* commands/i386/pc/play.c: Likewise.
* commands/i386/pc/pxecmd.c: Likewise.
* commands/i386/pc/vbeinfo.c: Likewise.
* commands/i386/pc/vbetest.c: Likewise.
* commands/ieee1275/suspend.c: Likewise.
* disk/loopback.c: Likewise.
* font/font_cmd.c: Likewise.
* hello/hello.c: Likewise.
* loader/efi/appleloader.c: Likewise.
* loader/efi/chainloader.c: Likewise.
* loader/i386/bsd.c: Likewise.
* loader/i386/efi/linux.c: Likewise.
* loader/i386/ieee1275/linux.c: Likewise.
* loader/i386/linux.c: Likewise.
* loader/i386/pc/chainloader.c: Likewise.
* loader/i386/pc/linux.c: Likewise.
* loader/powerpc/ieee1275/linux.c: Likewise.
* loader/multiboot_loader.c: Likewise.
* term/gfxterm.c: Likewise.
* term/i386/pc/serial.c: Likewise.
* term/terminfo.c: Likewise.
* term/i386/pc/vesafb.c: Removed <grub/arg.h>.
* term/i386/pc/vga.c: Likewise.
* video/readers/jpeg.c: Likewise.
* video/readers/png.c: Likewise.
* video/readers/tga.c: Likewise.
* util/grub-fstest (cmd_loopback): Removed.
(cmd_blocklist): Likewise.
(cmd_ls): Likewise.
(grub_register_command): Likewise.
(grub_unregister_command): Likewise.
(execute_command): Use grub_command_find to locate command and execute
it.
* include/grub/efi/chainloader.h: Removed.
* loader/efi/chainloader_normal.c: Likewise.
* loader/i386/bsd_normal.c: Likewise.
* loader/i386/pc/chainloader_normal.c: Likewise.
* loader/i386/pc/multiboot_normal.c: Likewise.
* loader/linux_normal.c: Likewise.
* loader/multiboot_loader_normal.c: Likewise.
* loader/powerpc/ieee1275/linux_normal.c: Likewise.
* gencmdlist.sh: Scan new registration command grub_register_extcmd
and grub_register_command_p1.
* conf/common.rmk (grub_fstest_SOURCES): Add kern/list.c,
kern/command.c, lib/arg.c and commands/extcmd.c.
(pkglib_MODULES): Remove boot.mod, and minicmd.mod and extcmd.mod.
(minicmd_mod_SOURCES): New variable.
(minicmd_mod_CFLAGS): Likewise.
(minicmd_mod_LDFLAGS): Likewise.
(extcmd_mod_SOURCES): Likewise.
(extcmd_mod_CFLAGS): Likewise.
(extcmd_mod_LDFLAGS): Likewise.
(boot_mod_SOURCES): Removed.
(boot_mod_CFLAGS): Likewise.
(boot_mod_LDFLAGS): Likewise.
* conf/i386-pc.rmk (kernel_img_SOURCES): Add kern/command.c and
kern/corecmd.c.
(kernel_img_HEADERS): Add command.h.
(grub_emu_SOURCES): Remove commands/boot.c and normal/arg.c, add
commands/minicmd.c, kern/command.c, kern/corecmd.c, commands/extcmd.c
and lib/arg.c.
(pkglib_MODULES): Change _linux.mod, _chain.mod, _bsd.mod and
_multiboot.mod as linux.mod, chain.mod, bsd.mod and multiboot.mod,
remove the corresponding normal mode command.
(normal_mod_SOURCES): Remove normal/arg.c.
* conf/i386-coreboot.rmk: Likewise.
* conf/i386-efi.rmk: Likewise.
* conf/i386-ieee1275.rmk: Likewise.
* conf/powerpc-ieee1275.rmk: Likewise.
* conf/x86_64-efi.rmk: Likewise.
* include/grub/arg.h: Move from here ...
* include/grub/lib/arg.h: ... to here.
* normal/arg.c: Move from here ...
* lib/arg.c: ... to here.
* commands/extcmd.c: New file.
* commands/minicmd.c: Likewise.
* include/grub/command.h: Likewise.
* include/grub/extcmd.h: Likewise.
* kern/command.c: Likewise.
* kern/corecmd.c: Likewise.
* kern/list.c (grub_list_iterate): Return int instead of void.
(grub_list_insert): New function.
(grub_prio_list_insert): Likewise.
* kern/rescue.c (grub_rescue_command): Removed.
(grub_rescue_command_list): Likewise.
(grub_rescue_register_command): Likewise.
(grub_rescue_unregister_command): Likewise.
(grub_rescue_cmd_boot): Move to minicmd.c
(grub_rescue_cmd_help): Likewise.
(grub_rescue_cmd_info): Likewise.
(grub_rescue_cmd_boot): Likewise.
(grub_rescue_cmd_testload): Likewise.
(grub_rescue_cmd_dump): Likewise.
(grub_rescue_cmd_rmmod): Likewise.
(grub_rescue_cmd_lsmod): Likewise.
(grub_rescue_cmd_exit): Likewise.
(grub_rescue_print_devices): Moved to corecmd.c.
(grub_rescue_print_files): Likewise.
(grub_rescue_cmd_ls): Likewise.
(grub_rescue_cmd_insmod): Likewise.
(grub_rescue_cmd_set): Likewise.
(grub_rescue_cmd_unset): Likewise.
(attemp_normal_mode): Use grub_command_find to get normal module.
(grub_enter_rescue_mode): Use grub_register_core_commands to register
commands, remove grub_rescue_regiter_command calls.
* normal/command.c (grub_regiser_command): Removed.
(grub_unregister_command): Likewise.
(grub_command_find): Likewise.
(grub_iterate_commands): Likewise.
(rescue_command): Likewise.
(export_command): Moved to corecmd.c.
(set_command): Removed.
(unset_command): Likewise.
(insmod_command): Likewise.
(rmmod_command): Likewise.
(lsmod_command): Likewise.
(grub_command_init): Likewise.
* normal/completion.c (iterate_command): Use cmd->prio to check for
active command.
(complete_arguments): Use grub_extcmd_t structure to find options.
(grub_normal_do_completion): Change function grub_iterate_commands to
grub_command_iterate.
* normal/execute.c (grub_script_execute_cmd): No need to parse
argument here.
* normal/main.c (grub_dyncmd_dispatcher): New function.
(read_command_list): Register unload commands as dyncmd.
(grub_cmd_normal): Use new command interface, register rescue,
unregister normal at entry, register normal, unregister rescue at exit.
* include/grub/list.h (grub_list_test_t): New type.
(grub_list_iterate): Return int instead of void.
(grub_list_insert): New function.
(GRUB_AS_NAMED_LIST_P): New macro.
(GRUB_AS_PRIO_LIST): Likewise.
(GRUB_AS_PRIO_LIST_P): Likewise.
(GRUB_PRIO_LIST_PRIO_MASK): New constant.
(GRUB_PRIO_LIST_FLAG_ACTIVE): Likewise.
(grub_prio_list): New structure.
(grub_prio_list_insert): New function.
(grub_prio_list_remove): New inline function.
* include/grub/normal.h: Remove <grub/arg.h>, add <grub/command.h>.
(GRUB_COMMAND_FLAG_CMDLINE): Moved to command.h.
(GRUB_COMMAND_FLAG_MENU): Likewise.
(GRUB_COMMAND_FLAG_BOTH): Likewise.
(GRUB_COMMAND_FLAG_TITLE): Likewise.
(GRUB_COMMAND_FLAG_NO_ECHO): Likewise.
(GRUB_COMMAND_FLAG_NO_ARG_PARSE): Removed.
(GRUB_COMMAND_FLAG_NOT_LOADED): Likewise.
(grub_command): Likewise.
(grub_register_command): Likewise.
(grub_command_find): Likewise.
(grub_iterate_commands): Likewise.
(grub_command_init): Likewise.
(grub_arg_parse): Likewise.
(grub_arg_show_help): Likewise.
* include/grub/rescue.h (grub_rescue_register_command): Removed.
(grub_rescue_unregister_command): Likewise.
* include/grub/i386/bsd.h: Remove grub_rescue_cmd_freebsd,
grub_rescue_cmd_openbsd, grub_rescue_cmd_netbsd,
grub_rescue_cmd_freebsd_loadenv and grub_rescue_cmd_freebsd_module.
* include/grub/i386/efi/loader.h: Remove grub_rescue_cmd_linux and
grub_rescue_cmd_initrd.
* include/grub/i386/loader.h: Likewise.
* include/grub/x86_64/loader.h: Likewise.
* include/grub/i386/pc/chainloader.h: Remove grub_chainloader_cmd.
2009-03-21 08:39:59 +00:00
|
|
|
|
cmd_linux = grub_register_command ("linux", grub_cmd_linux,
|
2010-01-08 Carles Pina i Estany <carles@pina.cat>
* loader/efi/appleloader.c: Include `<grub/i18n.h>'.
(GRUB_MOD_INIT): Gettextizze.
* loader/efi/chainloader.c: Include `<grub/i18n.h>'.
(GRUB_MOD_INIT): Gettextizze.
* loader/i386/efi/linux.c: Include `<grub/i18n.h>'.
(grub_cmd_linux): Capitalise Linux.
(GRUB_MOD_INIT): Gettextizze.
* loader/i386/ieee1275/linux.c: Include `<grub/i18n.h>'.
(grub_cmd_linux): Capitalise Linux.
(GRUB_MOD_INIT): Gettextizze.
* loader/i386/linux.c: Include `<grub/i18n.h>'.
(grub_cmd_linux): Capitalise Linux.
(GRUB_MOD_INIT): Gettextizze.
* loader/i386/pc/chainloader.c: Include `<grub/i18n.h>'.
(GRUB_MOD_INIT): Gettextizze.
* loader/i386/pc/linux.c: Include `<grub/i18n.h>'.
(grub_cmd_linux): Capitalise Linux.
(GRUB_MOD_INIT): Gettextizze.
* loader/i386/xnu.c: Include `<grub/i18n.h>'.
(grub_cpu_xnu_init): Gettextizze.
* loader/multiboot_loader.c: Include `<grub/i18n.h>'.
(GRUB_MOD_INIT): Gettextizze.
* loader/powerpc/ieee1275/linux.c: Include `<grub/i18n.h>'.
(GRUB_MOD_INIT): Gettextizze.
* loader/sparc64/ieee1275/linux.c: Include `<grub/i18n.h>'.
(grub_linux_load64): Capitalise Linux.
(GRUB_MOD_INIT): Gettextizze.
* loader/xnu.c: Include `<grub/i18n.h>'.
(GRUB_MOD_INIT): Gettextizze.
* po/POTFILES: Add `loader/efi/appleloader.c',
`loader/efi/chainloader.c', `loader/i386/efi/linux.c',
`loader/i386/ieee1275/linux.c', `loader/i386/linux.c',
`loader/i386/pc/chainloader.c', `loader/i386/pc/linux.c',
`loader/i386/xnu.c', `loader/multiboot_loader.c',
`loader/powerpc/ieee1275/linux.c', `loader/sparc64/ieee1275/linux.c'
and `loader/xnu.c'.
2010-01-08 21:35:38 +00:00
|
|
|
|
0, N_("Load Linux."));
|
2009-03-21 Bean <bean123ch@gmail.com>
* commands/blocklist.c: Add include file <grub/command.h>, remove
<grub/normal.h> and <grub/arg.h>.
(grub_cmd_blocklist): Use the new command interface.
(GRUB_MOD_INIT): Likewise.
(GRUB_MOD_FINI): Likewise.
* commands/boot.c: Likewise.
* commands/cat.c: Likewise.
* commands/cmp.c: Likewise.
* commands/configfile.c: Likewise.
* commands/crc.c: Likewise.
* commands/echo.c: Likewise.
* commands/halt.c: Likewise.
* commands/handler.c: Likewise.
* commands/hdparm.c: Likewise.
* commands/help.c: Likewise.
* commands/hexdump.c: Likewise.
* commands/loadenv.c: Likewise.
* commands/ls.c: Likewise.
* commands/lsmmap.c: Likewise.
* commands/lspci.c: Likewise.
* commands/loadenv.c: Likewise.
* commands/read.c: Likewise.
* commands/reboot.c: Likewise.
* commands/search.c: Likewise.
* commands/sleep.c: Likewise.
* commands/test.c: Likewise.
* commands/usbtest.c: Likewise.
* commands/videotest.c: Likewise.
* commands/i386/cpuid.c: Likewise.
* commands/i386/pc/halt.c: Likewise.
* commands/i386/pc/play.c: Likewise.
* commands/i386/pc/pxecmd.c: Likewise.
* commands/i386/pc/vbeinfo.c: Likewise.
* commands/i386/pc/vbetest.c: Likewise.
* commands/ieee1275/suspend.c: Likewise.
* disk/loopback.c: Likewise.
* font/font_cmd.c: Likewise.
* hello/hello.c: Likewise.
* loader/efi/appleloader.c: Likewise.
* loader/efi/chainloader.c: Likewise.
* loader/i386/bsd.c: Likewise.
* loader/i386/efi/linux.c: Likewise.
* loader/i386/ieee1275/linux.c: Likewise.
* loader/i386/linux.c: Likewise.
* loader/i386/pc/chainloader.c: Likewise.
* loader/i386/pc/linux.c: Likewise.
* loader/powerpc/ieee1275/linux.c: Likewise.
* loader/multiboot_loader.c: Likewise.
* term/gfxterm.c: Likewise.
* term/i386/pc/serial.c: Likewise.
* term/terminfo.c: Likewise.
* term/i386/pc/vesafb.c: Removed <grub/arg.h>.
* term/i386/pc/vga.c: Likewise.
* video/readers/jpeg.c: Likewise.
* video/readers/png.c: Likewise.
* video/readers/tga.c: Likewise.
* util/grub-fstest (cmd_loopback): Removed.
(cmd_blocklist): Likewise.
(cmd_ls): Likewise.
(grub_register_command): Likewise.
(grub_unregister_command): Likewise.
(execute_command): Use grub_command_find to locate command and execute
it.
* include/grub/efi/chainloader.h: Removed.
* loader/efi/chainloader_normal.c: Likewise.
* loader/i386/bsd_normal.c: Likewise.
* loader/i386/pc/chainloader_normal.c: Likewise.
* loader/i386/pc/multiboot_normal.c: Likewise.
* loader/linux_normal.c: Likewise.
* loader/multiboot_loader_normal.c: Likewise.
* loader/powerpc/ieee1275/linux_normal.c: Likewise.
* gencmdlist.sh: Scan new registration command grub_register_extcmd
and grub_register_command_p1.
* conf/common.rmk (grub_fstest_SOURCES): Add kern/list.c,
kern/command.c, lib/arg.c and commands/extcmd.c.
(pkglib_MODULES): Remove boot.mod, and minicmd.mod and extcmd.mod.
(minicmd_mod_SOURCES): New variable.
(minicmd_mod_CFLAGS): Likewise.
(minicmd_mod_LDFLAGS): Likewise.
(extcmd_mod_SOURCES): Likewise.
(extcmd_mod_CFLAGS): Likewise.
(extcmd_mod_LDFLAGS): Likewise.
(boot_mod_SOURCES): Removed.
(boot_mod_CFLAGS): Likewise.
(boot_mod_LDFLAGS): Likewise.
* conf/i386-pc.rmk (kernel_img_SOURCES): Add kern/command.c and
kern/corecmd.c.
(kernel_img_HEADERS): Add command.h.
(grub_emu_SOURCES): Remove commands/boot.c and normal/arg.c, add
commands/minicmd.c, kern/command.c, kern/corecmd.c, commands/extcmd.c
and lib/arg.c.
(pkglib_MODULES): Change _linux.mod, _chain.mod, _bsd.mod and
_multiboot.mod as linux.mod, chain.mod, bsd.mod and multiboot.mod,
remove the corresponding normal mode command.
(normal_mod_SOURCES): Remove normal/arg.c.
* conf/i386-coreboot.rmk: Likewise.
* conf/i386-efi.rmk: Likewise.
* conf/i386-ieee1275.rmk: Likewise.
* conf/powerpc-ieee1275.rmk: Likewise.
* conf/x86_64-efi.rmk: Likewise.
* include/grub/arg.h: Move from here ...
* include/grub/lib/arg.h: ... to here.
* normal/arg.c: Move from here ...
* lib/arg.c: ... to here.
* commands/extcmd.c: New file.
* commands/minicmd.c: Likewise.
* include/grub/command.h: Likewise.
* include/grub/extcmd.h: Likewise.
* kern/command.c: Likewise.
* kern/corecmd.c: Likewise.
* kern/list.c (grub_list_iterate): Return int instead of void.
(grub_list_insert): New function.
(grub_prio_list_insert): Likewise.
* kern/rescue.c (grub_rescue_command): Removed.
(grub_rescue_command_list): Likewise.
(grub_rescue_register_command): Likewise.
(grub_rescue_unregister_command): Likewise.
(grub_rescue_cmd_boot): Move to minicmd.c
(grub_rescue_cmd_help): Likewise.
(grub_rescue_cmd_info): Likewise.
(grub_rescue_cmd_boot): Likewise.
(grub_rescue_cmd_testload): Likewise.
(grub_rescue_cmd_dump): Likewise.
(grub_rescue_cmd_rmmod): Likewise.
(grub_rescue_cmd_lsmod): Likewise.
(grub_rescue_cmd_exit): Likewise.
(grub_rescue_print_devices): Moved to corecmd.c.
(grub_rescue_print_files): Likewise.
(grub_rescue_cmd_ls): Likewise.
(grub_rescue_cmd_insmod): Likewise.
(grub_rescue_cmd_set): Likewise.
(grub_rescue_cmd_unset): Likewise.
(attemp_normal_mode): Use grub_command_find to get normal module.
(grub_enter_rescue_mode): Use grub_register_core_commands to register
commands, remove grub_rescue_regiter_command calls.
* normal/command.c (grub_regiser_command): Removed.
(grub_unregister_command): Likewise.
(grub_command_find): Likewise.
(grub_iterate_commands): Likewise.
(rescue_command): Likewise.
(export_command): Moved to corecmd.c.
(set_command): Removed.
(unset_command): Likewise.
(insmod_command): Likewise.
(rmmod_command): Likewise.
(lsmod_command): Likewise.
(grub_command_init): Likewise.
* normal/completion.c (iterate_command): Use cmd->prio to check for
active command.
(complete_arguments): Use grub_extcmd_t structure to find options.
(grub_normal_do_completion): Change function grub_iterate_commands to
grub_command_iterate.
* normal/execute.c (grub_script_execute_cmd): No need to parse
argument here.
* normal/main.c (grub_dyncmd_dispatcher): New function.
(read_command_list): Register unload commands as dyncmd.
(grub_cmd_normal): Use new command interface, register rescue,
unregister normal at entry, register normal, unregister rescue at exit.
* include/grub/list.h (grub_list_test_t): New type.
(grub_list_iterate): Return int instead of void.
(grub_list_insert): New function.
(GRUB_AS_NAMED_LIST_P): New macro.
(GRUB_AS_PRIO_LIST): Likewise.
(GRUB_AS_PRIO_LIST_P): Likewise.
(GRUB_PRIO_LIST_PRIO_MASK): New constant.
(GRUB_PRIO_LIST_FLAG_ACTIVE): Likewise.
(grub_prio_list): New structure.
(grub_prio_list_insert): New function.
(grub_prio_list_remove): New inline function.
* include/grub/normal.h: Remove <grub/arg.h>, add <grub/command.h>.
(GRUB_COMMAND_FLAG_CMDLINE): Moved to command.h.
(GRUB_COMMAND_FLAG_MENU): Likewise.
(GRUB_COMMAND_FLAG_BOTH): Likewise.
(GRUB_COMMAND_FLAG_TITLE): Likewise.
(GRUB_COMMAND_FLAG_NO_ECHO): Likewise.
(GRUB_COMMAND_FLAG_NO_ARG_PARSE): Removed.
(GRUB_COMMAND_FLAG_NOT_LOADED): Likewise.
(grub_command): Likewise.
(grub_register_command): Likewise.
(grub_command_find): Likewise.
(grub_iterate_commands): Likewise.
(grub_command_init): Likewise.
(grub_arg_parse): Likewise.
(grub_arg_show_help): Likewise.
* include/grub/rescue.h (grub_rescue_register_command): Removed.
(grub_rescue_unregister_command): Likewise.
* include/grub/i386/bsd.h: Remove grub_rescue_cmd_freebsd,
grub_rescue_cmd_openbsd, grub_rescue_cmd_netbsd,
grub_rescue_cmd_freebsd_loadenv and grub_rescue_cmd_freebsd_module.
* include/grub/i386/efi/loader.h: Remove grub_rescue_cmd_linux and
grub_rescue_cmd_initrd.
* include/grub/i386/loader.h: Likewise.
* include/grub/x86_64/loader.h: Likewise.
* include/grub/i386/pc/chainloader.h: Remove grub_chainloader_cmd.
2009-03-21 08:39:59 +00:00
|
|
|
|
cmd_initrd = grub_register_command ("initrd", grub_cmd_initrd,
|
2010-01-08 Carles Pina i Estany <carles@pina.cat>
* loader/efi/appleloader.c: Include `<grub/i18n.h>'.
(GRUB_MOD_INIT): Gettextizze.
* loader/efi/chainloader.c: Include `<grub/i18n.h>'.
(GRUB_MOD_INIT): Gettextizze.
* loader/i386/efi/linux.c: Include `<grub/i18n.h>'.
(grub_cmd_linux): Capitalise Linux.
(GRUB_MOD_INIT): Gettextizze.
* loader/i386/ieee1275/linux.c: Include `<grub/i18n.h>'.
(grub_cmd_linux): Capitalise Linux.
(GRUB_MOD_INIT): Gettextizze.
* loader/i386/linux.c: Include `<grub/i18n.h>'.
(grub_cmd_linux): Capitalise Linux.
(GRUB_MOD_INIT): Gettextizze.
* loader/i386/pc/chainloader.c: Include `<grub/i18n.h>'.
(GRUB_MOD_INIT): Gettextizze.
* loader/i386/pc/linux.c: Include `<grub/i18n.h>'.
(grub_cmd_linux): Capitalise Linux.
(GRUB_MOD_INIT): Gettextizze.
* loader/i386/xnu.c: Include `<grub/i18n.h>'.
(grub_cpu_xnu_init): Gettextizze.
* loader/multiboot_loader.c: Include `<grub/i18n.h>'.
(GRUB_MOD_INIT): Gettextizze.
* loader/powerpc/ieee1275/linux.c: Include `<grub/i18n.h>'.
(GRUB_MOD_INIT): Gettextizze.
* loader/sparc64/ieee1275/linux.c: Include `<grub/i18n.h>'.
(grub_linux_load64): Capitalise Linux.
(GRUB_MOD_INIT): Gettextizze.
* loader/xnu.c: Include `<grub/i18n.h>'.
(GRUB_MOD_INIT): Gettextizze.
* po/POTFILES: Add `loader/efi/appleloader.c',
`loader/efi/chainloader.c', `loader/i386/efi/linux.c',
`loader/i386/ieee1275/linux.c', `loader/i386/linux.c',
`loader/i386/pc/chainloader.c', `loader/i386/pc/linux.c',
`loader/i386/xnu.c', `loader/multiboot_loader.c',
`loader/powerpc/ieee1275/linux.c', `loader/sparc64/ieee1275/linux.c'
and `loader/xnu.c'.
2010-01-08 21:35:38 +00:00
|
|
|
|
0, N_("Load initrd."));
|
2005-01-31 21:44:35 +00:00
|
|
|
|
my_mod = mod;
|
2004-07-27 17:47:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-11-13 Marco Gerards <mgerards@xs4all.nl>
* geninit.sh: New file.
* geninitheader.sh: Likewise.
* commands/boot.c (grub_boot_init, grub_boot_fini): Removed.
* commands/cat.c (grub_cat_init, grub_cat_fini): Likewise.
* commands/cmp.c (grub_cmp_init, grub_cmp_fini): Likewise.
* commands/configfile.c (grub_configfile_init)
(grub_configfile_fini): Likewise.
* commands/default.c (grub_default_init, grub_default_fini):
Likewise.
* commands/help.c (grub_help_init, grub_help_fini): Likewise.
* commands/ls.c (grub_ls_init, grub_ls_fini): Likewise.
* commands/search.c (grub_search_init, grub_search_fini): Likewise.
* commands/terminal.c (grub_terminal_init, grub_terminal_fini):
Likewise.
* commands/test.c (grub_test_init, grub_test_fini): Likewise.
* commands/timeout.c (grub_timeout_init, grub_timeout_fini):
Likewise.
* commands/i386/pc/halt.c (grub_halt_init, grub_halt_fini): Likewise.
* commands/iee1275/halt.c (grub_halt_init, grub_halt_fini):
Likewise.
* commands/i386/pc/reboot.c (grub_reboot_init, grub_reboot_fini):
Likewise.
* commands/iee1275/reboot.c (grub_reboot_init, grub_reboot_fini):
Likewise.
* disk/loopback.c (grub_loop_init, grub_loop_fini): Likewise.
* fs/affs.c (grub_affs_init, grub_affs_fini): Likewise.
* fs/ext2.c (grub_ext2_init, grub_ext2_fini): Likewise.
* fs/fat.c (grub_fat_init, grub_fat_fini): Likewise.
* fs/hfs.c (grub_hfs_init, grub_hfs_fini): Likewise.
* fs/iso9660.c (grub_iso9660_init, grub_iso9660_fini): Likewise.
* fs/jfs.c (grub_jfs_init, grub_jfs_fini): Likewise.
* fs/minix.c (grub_minix_init, grub_minix_fini): Likewise.
* fs/sfs.c (grub_sfs_init, grub_sfs_fini): Likewise.
* fs/ufs.c (grub_ufs_init, grub_ufs_fini): Likewise.
* fs/xfs.c (grub_xfs_init, grub_xfs_fini): Likewise.
* normal/main.c (grub_normal_init, grub_normal_fini): Likewise.
* partmap/amiga.c (grub_amiga_partition_map_init)
(grub_amiga_partition_map_fini): Likewise.
* partmap/apple.c (grub_apple_partition_map_init)
(grub_apple_partition_map_fini): Likewise.
* partmap/pc.c (grub_pc_partition_map_init)
(grub_pc_partition_map_fini): Likewise.
* partmap/sun.c (grub_sun_partition_map_init,
grub_sun_partition_map_fini): Likewise.
* term/terminfo.c (grub_terminal_init, grub_terminal_fini):
Likewise.
* util/grub-emu.c: Include <grub_modules_init.h>.
(main): Don't initialize and de-initialize any modules directly,
use `grub_init_all' and `grub_fini_all' instead.
* term/i386/pc/vesafb.c (grub_vesafb_init): Renamed to
`grub_vesafb_mod_init'.
(grub_vesafb_fini): Renamed to `grub_vesafb_mod_fini'. Updated
all users.
* term/i386/pc/vga.c (grub_vga_init): Renamed to
`grub_vga_mod_init'. Updated all users.
(grub_vga_fini): Renamed to `grub_vga_mod_fini'.
* conf/i386-pc.rmk (grub_emu_SOURCES): Add `grub_emu_init.c'.
(grub_modules_init.lst, grub_modules_init.h, grub_emu_init.c): New
rules.
* include/grub/dl.h (GRUB_MOD_INIT): Add argument `name'.
Generate a function to initialize the module in utilities.
Updated all callers.
(GRUB_MOD_FINI): Add argument `name'. Generate a function to
initialize the module in utilities. Updated all callers.
2005-11-13 15:47:09 +00:00
|
|
|
|
GRUB_MOD_FINI(linux)
|
2004-07-27 17:47:37 +00:00
|
|
|
|
{
|
2009-03-21 Bean <bean123ch@gmail.com>
* commands/blocklist.c: Add include file <grub/command.h>, remove
<grub/normal.h> and <grub/arg.h>.
(grub_cmd_blocklist): Use the new command interface.
(GRUB_MOD_INIT): Likewise.
(GRUB_MOD_FINI): Likewise.
* commands/boot.c: Likewise.
* commands/cat.c: Likewise.
* commands/cmp.c: Likewise.
* commands/configfile.c: Likewise.
* commands/crc.c: Likewise.
* commands/echo.c: Likewise.
* commands/halt.c: Likewise.
* commands/handler.c: Likewise.
* commands/hdparm.c: Likewise.
* commands/help.c: Likewise.
* commands/hexdump.c: Likewise.
* commands/loadenv.c: Likewise.
* commands/ls.c: Likewise.
* commands/lsmmap.c: Likewise.
* commands/lspci.c: Likewise.
* commands/loadenv.c: Likewise.
* commands/read.c: Likewise.
* commands/reboot.c: Likewise.
* commands/search.c: Likewise.
* commands/sleep.c: Likewise.
* commands/test.c: Likewise.
* commands/usbtest.c: Likewise.
* commands/videotest.c: Likewise.
* commands/i386/cpuid.c: Likewise.
* commands/i386/pc/halt.c: Likewise.
* commands/i386/pc/play.c: Likewise.
* commands/i386/pc/pxecmd.c: Likewise.
* commands/i386/pc/vbeinfo.c: Likewise.
* commands/i386/pc/vbetest.c: Likewise.
* commands/ieee1275/suspend.c: Likewise.
* disk/loopback.c: Likewise.
* font/font_cmd.c: Likewise.
* hello/hello.c: Likewise.
* loader/efi/appleloader.c: Likewise.
* loader/efi/chainloader.c: Likewise.
* loader/i386/bsd.c: Likewise.
* loader/i386/efi/linux.c: Likewise.
* loader/i386/ieee1275/linux.c: Likewise.
* loader/i386/linux.c: Likewise.
* loader/i386/pc/chainloader.c: Likewise.
* loader/i386/pc/linux.c: Likewise.
* loader/powerpc/ieee1275/linux.c: Likewise.
* loader/multiboot_loader.c: Likewise.
* term/gfxterm.c: Likewise.
* term/i386/pc/serial.c: Likewise.
* term/terminfo.c: Likewise.
* term/i386/pc/vesafb.c: Removed <grub/arg.h>.
* term/i386/pc/vga.c: Likewise.
* video/readers/jpeg.c: Likewise.
* video/readers/png.c: Likewise.
* video/readers/tga.c: Likewise.
* util/grub-fstest (cmd_loopback): Removed.
(cmd_blocklist): Likewise.
(cmd_ls): Likewise.
(grub_register_command): Likewise.
(grub_unregister_command): Likewise.
(execute_command): Use grub_command_find to locate command and execute
it.
* include/grub/efi/chainloader.h: Removed.
* loader/efi/chainloader_normal.c: Likewise.
* loader/i386/bsd_normal.c: Likewise.
* loader/i386/pc/chainloader_normal.c: Likewise.
* loader/i386/pc/multiboot_normal.c: Likewise.
* loader/linux_normal.c: Likewise.
* loader/multiboot_loader_normal.c: Likewise.
* loader/powerpc/ieee1275/linux_normal.c: Likewise.
* gencmdlist.sh: Scan new registration command grub_register_extcmd
and grub_register_command_p1.
* conf/common.rmk (grub_fstest_SOURCES): Add kern/list.c,
kern/command.c, lib/arg.c and commands/extcmd.c.
(pkglib_MODULES): Remove boot.mod, and minicmd.mod and extcmd.mod.
(minicmd_mod_SOURCES): New variable.
(minicmd_mod_CFLAGS): Likewise.
(minicmd_mod_LDFLAGS): Likewise.
(extcmd_mod_SOURCES): Likewise.
(extcmd_mod_CFLAGS): Likewise.
(extcmd_mod_LDFLAGS): Likewise.
(boot_mod_SOURCES): Removed.
(boot_mod_CFLAGS): Likewise.
(boot_mod_LDFLAGS): Likewise.
* conf/i386-pc.rmk (kernel_img_SOURCES): Add kern/command.c and
kern/corecmd.c.
(kernel_img_HEADERS): Add command.h.
(grub_emu_SOURCES): Remove commands/boot.c and normal/arg.c, add
commands/minicmd.c, kern/command.c, kern/corecmd.c, commands/extcmd.c
and lib/arg.c.
(pkglib_MODULES): Change _linux.mod, _chain.mod, _bsd.mod and
_multiboot.mod as linux.mod, chain.mod, bsd.mod and multiboot.mod,
remove the corresponding normal mode command.
(normal_mod_SOURCES): Remove normal/arg.c.
* conf/i386-coreboot.rmk: Likewise.
* conf/i386-efi.rmk: Likewise.
* conf/i386-ieee1275.rmk: Likewise.
* conf/powerpc-ieee1275.rmk: Likewise.
* conf/x86_64-efi.rmk: Likewise.
* include/grub/arg.h: Move from here ...
* include/grub/lib/arg.h: ... to here.
* normal/arg.c: Move from here ...
* lib/arg.c: ... to here.
* commands/extcmd.c: New file.
* commands/minicmd.c: Likewise.
* include/grub/command.h: Likewise.
* include/grub/extcmd.h: Likewise.
* kern/command.c: Likewise.
* kern/corecmd.c: Likewise.
* kern/list.c (grub_list_iterate): Return int instead of void.
(grub_list_insert): New function.
(grub_prio_list_insert): Likewise.
* kern/rescue.c (grub_rescue_command): Removed.
(grub_rescue_command_list): Likewise.
(grub_rescue_register_command): Likewise.
(grub_rescue_unregister_command): Likewise.
(grub_rescue_cmd_boot): Move to minicmd.c
(grub_rescue_cmd_help): Likewise.
(grub_rescue_cmd_info): Likewise.
(grub_rescue_cmd_boot): Likewise.
(grub_rescue_cmd_testload): Likewise.
(grub_rescue_cmd_dump): Likewise.
(grub_rescue_cmd_rmmod): Likewise.
(grub_rescue_cmd_lsmod): Likewise.
(grub_rescue_cmd_exit): Likewise.
(grub_rescue_print_devices): Moved to corecmd.c.
(grub_rescue_print_files): Likewise.
(grub_rescue_cmd_ls): Likewise.
(grub_rescue_cmd_insmod): Likewise.
(grub_rescue_cmd_set): Likewise.
(grub_rescue_cmd_unset): Likewise.
(attemp_normal_mode): Use grub_command_find to get normal module.
(grub_enter_rescue_mode): Use grub_register_core_commands to register
commands, remove grub_rescue_regiter_command calls.
* normal/command.c (grub_regiser_command): Removed.
(grub_unregister_command): Likewise.
(grub_command_find): Likewise.
(grub_iterate_commands): Likewise.
(rescue_command): Likewise.
(export_command): Moved to corecmd.c.
(set_command): Removed.
(unset_command): Likewise.
(insmod_command): Likewise.
(rmmod_command): Likewise.
(lsmod_command): Likewise.
(grub_command_init): Likewise.
* normal/completion.c (iterate_command): Use cmd->prio to check for
active command.
(complete_arguments): Use grub_extcmd_t structure to find options.
(grub_normal_do_completion): Change function grub_iterate_commands to
grub_command_iterate.
* normal/execute.c (grub_script_execute_cmd): No need to parse
argument here.
* normal/main.c (grub_dyncmd_dispatcher): New function.
(read_command_list): Register unload commands as dyncmd.
(grub_cmd_normal): Use new command interface, register rescue,
unregister normal at entry, register normal, unregister rescue at exit.
* include/grub/list.h (grub_list_test_t): New type.
(grub_list_iterate): Return int instead of void.
(grub_list_insert): New function.
(GRUB_AS_NAMED_LIST_P): New macro.
(GRUB_AS_PRIO_LIST): Likewise.
(GRUB_AS_PRIO_LIST_P): Likewise.
(GRUB_PRIO_LIST_PRIO_MASK): New constant.
(GRUB_PRIO_LIST_FLAG_ACTIVE): Likewise.
(grub_prio_list): New structure.
(grub_prio_list_insert): New function.
(grub_prio_list_remove): New inline function.
* include/grub/normal.h: Remove <grub/arg.h>, add <grub/command.h>.
(GRUB_COMMAND_FLAG_CMDLINE): Moved to command.h.
(GRUB_COMMAND_FLAG_MENU): Likewise.
(GRUB_COMMAND_FLAG_BOTH): Likewise.
(GRUB_COMMAND_FLAG_TITLE): Likewise.
(GRUB_COMMAND_FLAG_NO_ECHO): Likewise.
(GRUB_COMMAND_FLAG_NO_ARG_PARSE): Removed.
(GRUB_COMMAND_FLAG_NOT_LOADED): Likewise.
(grub_command): Likewise.
(grub_register_command): Likewise.
(grub_command_find): Likewise.
(grub_iterate_commands): Likewise.
(grub_command_init): Likewise.
(grub_arg_parse): Likewise.
(grub_arg_show_help): Likewise.
* include/grub/rescue.h (grub_rescue_register_command): Removed.
(grub_rescue_unregister_command): Likewise.
* include/grub/i386/bsd.h: Remove grub_rescue_cmd_freebsd,
grub_rescue_cmd_openbsd, grub_rescue_cmd_netbsd,
grub_rescue_cmd_freebsd_loadenv and grub_rescue_cmd_freebsd_module.
* include/grub/i386/efi/loader.h: Remove grub_rescue_cmd_linux and
grub_rescue_cmd_initrd.
* include/grub/i386/loader.h: Likewise.
* include/grub/x86_64/loader.h: Likewise.
* include/grub/i386/pc/chainloader.h: Remove grub_chainloader_cmd.
2009-03-21 08:39:59 +00:00
|
|
|
|
grub_unregister_command (cmd_linux);
|
|
|
|
|
grub_unregister_command (cmd_initrd);
|
2004-07-27 17:47:37 +00:00
|
|
|
|
}
|