[2036] 2009-03-21 Bean <[email protected]>

Bean <[email protected]>
Newsgroups gmane.comp.boot-loaders.grub.cvs
Message-ID <[email protected]>
Revision: 2036
          http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=2036
Author:   bean
Date:     2009-03-21 08:39:59 +0000 (Sat, 21 Mar 2009)
Log Message:
-----------
2009-03-21  Bean  <[email protected]>

	* 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.

Modified Paths:
--------------
    trunk/grub2/ChangeLog
    trunk/grub2/DISTLIST
    trunk/grub2/commands/blocklist.c
    trunk/grub2/commands/boot.c
    trunk/grub2/commands/cat.c
    trunk/grub2/commands/cmp.c
    trunk/grub2/commands/configfile.c
    trunk/grub2/commands/crc.c
    trunk/grub2/commands/date.c
    trunk/grub2/commands/echo.c
    trunk/grub2/commands/halt.c
    trunk/grub2/commands/handler.c
    trunk/grub2/commands/hdparm.c
    trunk/grub2/commands/help.c
    trunk/grub2/commands/hexdump.c
    trunk/grub2/commands/i386/cpuid.c
    trunk/grub2/commands/i386/pc/halt.c
    trunk/grub2/commands/i386/pc/play.c
    trunk/grub2/commands/i386/pc/pxecmd.c
    trunk/grub2/commands/i386/pc/vbeinfo.c
    trunk/grub2/commands/i386/pc/vbetest.c
    trunk/grub2/commands/ieee1275/suspend.c
    trunk/grub2/commands/loadenv.c
    trunk/grub2/commands/ls.c
    trunk/grub2/commands/lsmmap.c
    trunk/grub2/commands/lspci.c
    trunk/grub2/commands/read.c
    trunk/grub2/commands/reboot.c
    trunk/grub2/commands/search.c
    trunk/grub2/commands/sleep.c
    trunk/grub2/commands/test.c
    trunk/grub2/commands/usbtest.c
    trunk/grub2/commands/videotest.c
    trunk/grub2/conf/common.mk
    trunk/grub2/conf/common.rmk
    trunk/grub2/conf/i386-coreboot.mk
    trunk/grub2/conf/i386-coreboot.rmk
    trunk/grub2/conf/i386-efi.mk
    trunk/grub2/conf/i386-efi.rmk
    trunk/grub2/conf/i386-ieee1275.mk
    trunk/grub2/conf/i386-ieee1275.rmk
    trunk/grub2/conf/i386-pc.mk
    trunk/grub2/conf/i386-pc.rmk
    trunk/grub2/conf/powerpc-ieee1275.mk
    trunk/grub2/conf/powerpc-ieee1275.rmk
    trunk/grub2/conf/x86_64-efi.mk
    trunk/grub2/conf/x86_64-efi.rmk
    trunk/grub2/disk/loopback.c
    trunk/grub2/font/font_cmd.c
    trunk/grub2/gencmdlist.sh
    trunk/grub2/hello/hello.c
    trunk/grub2/include/grub/i386/bsd.h
    trunk/grub2/include/grub/i386/efi/loader.h
    trunk/grub2/include/grub/i386/loader.h
    trunk/grub2/include/grub/i386/pc/chainloader.h
    trunk/grub2/include/grub/list.h
    trunk/grub2/include/grub/normal.h
    trunk/grub2/include/grub/rescue.h
    trunk/grub2/include/grub/x86_64/efi/loader.h
    trunk/grub2/kern/list.c
    trunk/grub2/kern/rescue.c
    trunk/grub2/loader/efi/appleloader.c
    trunk/grub2/loader/efi/chainloader.c
    trunk/grub2/loader/i386/bsd.c
    trunk/grub2/loader/i386/efi/linux.c
    trunk/grub2/loader/i386/ieee1275/linux.c
    trunk/grub2/loader/i386/linux.c
    trunk/grub2/loader/i386/pc/chainloader.c
    trunk/grub2/loader/i386/pc/linux.c
    trunk/grub2/loader/multiboot_loader.c
    trunk/grub2/loader/powerpc/ieee1275/linux.c
    trunk/grub2/normal/command.c
    trunk/grub2/normal/completion.c
    trunk/grub2/normal/execute.c
    trunk/grub2/normal/main.c
    trunk/grub2/term/gfxterm.c
    trunk/grub2/term/i386/pc/serial.c
    trunk/grub2/term/i386/pc/vesafb.c
    trunk/grub2/term/i386/pc/vga.c
    trunk/grub2/term/terminfo.c
    trunk/grub2/util/grub-fstest.c
    trunk/grub2/video/readers/jpeg.c
    trunk/grub2/video/readers/png.c
    trunk/grub2/video/readers/tga.c

Added Paths:
-----------
    trunk/grub2/commands/extcmd.c
    trunk/grub2/commands/minicmd.c
    trunk/grub2/include/grub/command.h
    trunk/grub2/include/grub/extcmd.h
    trunk/grub2/include/grub/lib/arg.h
    trunk/grub2/kern/command.c
    trunk/grub2/kern/corecmd.c
    trunk/grub2/lib/arg.c

Removed Paths:
-------------
    trunk/grub2/include/grub/arg.h
    trunk/grub2/include/grub/efi/chainloader.h
    trunk/grub2/loader/efi/chainloader_normal.c
    trunk/grub2/loader/i386/bsd_normal.c
    trunk/grub2/loader/i386/pc/chainloader_normal.c
    trunk/grub2/loader/i386/pc/multiboot_normal.c
    trunk/grub2/loader/linux_normal.c
    trunk/grub2/loader/multiboot_loader_normal.c
    trunk/grub2/loader/powerpc/ieee1275/linux_normal.c
    trunk/grub2/normal/arg.c

Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/ChangeLog	2009-03-21 08:39:59 UTC (rev 2036)
@@ -1,5 +1,223 @@
 2009-03-21  Bean  <[email protected]>
 
+	* 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  Bean  <[email protected]>
+
 	* util/hostdisk.c (read_device_map): Use grub_util_get_disk_size
 	instead of stat in mingw environment.
 

Modified: trunk/grub2/DISTLIST
===================================================================
--- trunk/grub2/DISTLIST	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/DISTLIST	2009-03-21 08:39:59 UTC (rev 2036)
@@ -48,6 +48,7 @@
 commands/crc.c
 commands/date.c
 commands/echo.c
+commands/extcmd.c
 commands/halt.c
 commands/handler.c
 commands/hdparm.c
@@ -57,6 +58,7 @@
 commands/ls.c
 commands/lsmmap.c
 commands/lspci.c
+commands/minicmd.c
 commands/read.c
 commands/reboot.c
 commands/search.c
@@ -140,12 +142,12 @@
 include/multiboot2.h
 include/grub/acorn_filecore.h
 include/grub/aout.h
-include/grub/arg.h
 include/grub/ata.h
 include/grub/bitmap.h
 include/grub/boot.h
 include/grub/bufio.h
 include/grub/cache.h
+include/grub/command.h
 include/grub/device.h
 include/grub/disk.h
 include/grub/dl.h
@@ -153,6 +155,7 @@
 include/grub/elfload.h
 include/grub/env.h
 include/grub/err.h
+include/grub/extcmd.h
 include/grub/file.h
 include/grub/font.h
 include/grub/fs.h
@@ -196,7 +199,6 @@
 include/grub/usbtrans.h
 include/grub/video.h
 include/grub/efi/api.h
-include/grub/efi/chainloader.h
 include/grub/efi/console.h
 include/grub/efi/console_control.h
 include/grub/efi/disk.h
@@ -265,6 +267,7 @@
 include/grub/lib/LzmaDec.h
 include/grub/lib/LzmaEnc.h
 include/grub/lib/LzmaTypes.h
+include/grub/lib/arg.h
 include/grub/lib/crc.h
 include/grub/lib/datetime.h
 include/grub/lib/envblk.h
@@ -310,6 +313,8 @@
 include/grub/x86_64/efi/time.h
 io/bufio.c
 io/gzio.c
+kern/command.c
+kern/corecmd.c
 kern/device.c
 kern/disk.c
 kern/dl.c
@@ -372,6 +377,7 @@
 lib/LzFind.c
 lib/LzmaDec.c
 lib/LzmaEnc.c
+lib/arg.c
 lib/crc.c
 lib/datetime.c
 lib/envblk.c
@@ -379,30 +385,21 @@
 lib/efi/datetime.c
 lib/i386/datetime.c
 loader/aout.c
-loader/linux_normal.c
 loader/multiboot2.c
 loader/multiboot_loader.c
-loader/multiboot_loader_normal.c
 loader/efi/appleloader.c
 loader/efi/chainloader.c
-loader/efi/chainloader_normal.c
 loader/i386/bsd.c
-loader/i386/bsd_normal.c
 loader/i386/linux.c
 loader/i386/multiboot.c
 loader/i386/multiboot_elfxx.c
 loader/i386/efi/linux.c
-loader/i386/efi/loadbios.c
 loader/i386/ieee1275/linux.c
 loader/i386/pc/chainloader.c
-loader/i386/pc/chainloader_normal.c
 loader/i386/pc/linux.c
 loader/i386/pc/multiboot2.c
-loader/i386/pc/multiboot_normal.c
 loader/ieee1275/multiboot2.c
 loader/powerpc/ieee1275/linux.c
-loader/powerpc/ieee1275/linux_normal.c
-normal/arg.c
 normal/cmdline.c
 normal/color.c
 normal/command.c

Modified: trunk/grub2/commands/blocklist.c
===================================================================
--- trunk/grub2/commands/blocklist.c	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/commands/blocklist.c	2009-03-21 08:39:59 UTC (rev 2036)
@@ -17,17 +17,16 @@
  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <grub/normal.h>
 #include <grub/dl.h>
-#include <grub/arg.h>
 #include <grub/misc.h>
 #include <grub/file.h>
 #include <grub/mm.h>
 #include <grub/disk.h>
 #include <grub/partition.h>
+#include <grub/command.h>
 
 static grub_err_t
-grub_cmd_blocklist (struct grub_arg_list *state __attribute__ ((unused)),
+grub_cmd_blocklist (grub_command_t cmd __attribute__ ((unused)),
 		    int argc, char **args)
 {
   grub_file_t file;
@@ -106,17 +105,16 @@
   return grub_errno;
 }
 
+static grub_command_t cmd;
 
 GRUB_MOD_INIT(blocklist)
 {
   (void) mod;			/* To stop warning. */
-  grub_register_command ("blocklist", grub_cmd_blocklist,
-			 GRUB_COMMAND_FLAG_BOTH,
-			 "blocklist FILE",
-			 "Print a block list.", 0);
+  cmd = grub_register_command ("blocklist", grub_cmd_blocklist,
+			       "blocklist FILE", "Print a block list.");
 }
 
 GRUB_MOD_FINI(blocklist)
 {
-  grub_unregister_command ("blocklist");
+  grub_unregister_command (cmd);
 }

Modified: trunk/grub2/commands/boot.c
===================================================================
--- trunk/grub2/commands/boot.c	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/commands/boot.c	2009-03-21 08:39:59 UTC (rev 2036)
@@ -19,7 +19,6 @@
 
 #include <grub/normal.h>
 #include <grub/dl.h>
-#include <grub/arg.h>
 #include <grub/misc.h>
 #include <grub/loader.h>
 

Modified: trunk/grub2/commands/cat.c
===================================================================
--- trunk/grub2/commands/cat.c	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/commands/cat.c	2009-03-21 08:39:59 UTC (rev 2036)
@@ -17,17 +17,16 @@
  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <grub/normal.h>
 #include <grub/dl.h>
-#include <grub/arg.h>
 #include <grub/file.h>
 #include <grub/disk.h>
 #include <grub/term.h>
 #include <grub/misc.h>
 #include <grub/gzio.h>
+#include <grub/command.h>
 
 static grub_err_t
-grub_cmd_cat (struct grub_arg_list *state __attribute__ ((unused)),
+grub_cmd_cat (grub_command_t cmd __attribute__ ((unused)),
 	      int argc, char **args)
 
 {
@@ -74,15 +73,16 @@
   return 0;
 }
 
+static grub_command_t cmd;
 
 GRUB_MOD_INIT(cat)
 {
   (void) mod;			/* To stop warning. */
-  grub_register_command ("cat", grub_cmd_cat, GRUB_COMMAND_FLAG_BOTH,
-			 "cat FILE", "Show the contents of a file.", 0);
+  cmd = grub_register_command_p1 ("cat", grub_cmd_cat,
+				  "cat FILE", "Show the contents of a file.");
 }
 
 GRUB_MOD_FINI(cat)
 {
-  grub_unregister_command ("cat");
+  grub_unregister_command (cmd);
 }

Modified: trunk/grub2/commands/cmp.c
===================================================================
--- trunk/grub2/commands/cmp.c	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/commands/cmp.c	2009-03-21 08:39:59 UTC (rev 2036)
@@ -17,18 +17,17 @@
  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <grub/normal.h>
 #include <grub/dl.h>
-#include <grub/arg.h>
 #include <grub/misc.h>
 #include <grub/file.h>
 #include <grub/mm.h>
 #include <grub/gzio.h>
+#include <grub/command.h>
 
 #define BUFFER_SIZE 512
 
 static grub_err_t
-grub_cmd_cmp (struct grub_arg_list *state __attribute__ ((unused)),
+grub_cmd_cmp (grub_command_t cmd __attribute__ ((unused)),
 	      int argc, char **args)
 {
   grub_ssize_t rd1, rd2;
@@ -105,15 +104,16 @@
   return grub_errno;
 }
 
+static grub_command_t cmd;
 
 GRUB_MOD_INIT(cmp)
 {
   (void) mod;			/* To stop warning. */
-  grub_register_command ("cmp", grub_cmd_cmp, GRUB_COMMAND_FLAG_BOTH,
-			 "cmp FILE1 FILE2", "Compare two files.", 0);
+  cmd = grub_register_command ("cmp", grub_cmd_cmp,
+			       "cmp FILE1 FILE2", "Compare two files.");
 }
 
 GRUB_MOD_FINI(cmp)
 {
-  grub_unregister_command ("cmp");
+  grub_unregister_command (cmd);
 }

Modified: trunk/grub2/commands/configfile.c
===================================================================
--- trunk/grub2/commands/configfile.c	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/commands/configfile.c	2009-03-21 08:39:59 UTC (rev 2036)
@@ -17,62 +17,59 @@
  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <grub/normal.h>
 #include <grub/dl.h>
-#include <grub/arg.h>
 #include <grub/term.h>
-#include <grub/misc.h>
 #include <grub/env.h>
+#include <grub/normal.h>
+#include <grub/command.h>
 
 static grub_err_t
-grub_cmd_configfile (struct grub_arg_list *state __attribute__ ((unused)),
-             int argc, char **args)
-
+grub_cmd_source (grub_command_t cmd, int argc, char **args)
 {
+  int new_env;
+
   if (argc != 1)
     return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
 
-  grub_cls ();
-  grub_env_context_open ();
-  grub_normal_execute (args[0], 1);
-  grub_env_context_close ();
+  new_env = (cmd->name[0] == 'c');
 
-  return 0;
-}
+  if (new_env)
+    {
+      grub_cls ();
+      grub_env_context_open ();
+    }
 
-static grub_err_t
-grub_cmd_source (struct grub_arg_list *state __attribute__ ((unused)),
-		 int argc, char **args)
-
-{
-  if (argc != 1)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
-
   grub_normal_execute (args[0], 1);
 
+  if (new_env)
+    grub_env_context_close ();
+
   return 0;
 }
 
+static grub_command_t cmd_configfile, cmd_source, cmd_dot;
 
 GRUB_MOD_INIT(configfile)
 {
   (void) mod;                   /* To stop warning. */
-  grub_register_command ("configfile", grub_cmd_configfile,
-                        GRUB_COMMAND_FLAG_BOTH, "configfile FILE",
-                        "Load another config file.", 0);
-  grub_register_command ("source", grub_cmd_source,
-                        GRUB_COMMAND_FLAG_BOTH, "source FILE",
-                        "Load another config file without changing context.",
-			 0);
-  grub_register_command (".", grub_cmd_source,
-                        GRUB_COMMAND_FLAG_BOTH, ". FILE",
-                        "Load another config file without changing context.",
-			 0);
+  cmd_configfile =
+    grub_register_command ("configfile", grub_cmd_source,
+			   "configfile FILE", "Load another config file.");
+  cmd_source =
+    grub_register_command ("source", grub_cmd_source,
+			   "source FILE",
+			   "Load another config file without changing context."
+			   );
+  cmd_dot =
+    grub_register_command (".", grub_cmd_source,
+			   ". FILE",
+			   "Load another config file without changing context."
+			   );
 }
 
 GRUB_MOD_FINI(configfile)
 {
-  grub_unregister_command ("configfile");
-  grub_unregister_command ("source");
-  grub_unregister_command (".");
+  grub_unregister_command (cmd_configfile);
+  grub_unregister_command (cmd_source);
+  grub_unregister_command (cmd_dot);
 }

Modified: trunk/grub2/commands/crc.c
===================================================================
--- trunk/grub2/commands/crc.c	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/commands/crc.c	2009-03-21 08:39:59 UTC (rev 2036)
@@ -17,16 +17,15 @@
  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <grub/normal.h>
 #include <grub/dl.h>
-#include <grub/arg.h>
 #include <grub/disk.h>
 #include <grub/file.h>
 #include <grub/misc.h>
 #include <grub/lib/crc.h>
+#include <grub/command.h>
 
 static grub_err_t
-grub_cmd_crc (struct grub_arg_list *state __attribute__ ((unused)),
+grub_cmd_crc (grub_command_t cmd __attribute__ ((unused)),
 	      int argc, char **args)
 
 {
@@ -53,14 +52,17 @@
   return 0;
 }
 
+static grub_command_t cmd;
+
 GRUB_MOD_INIT(crc)
 {
   (void) mod;			/* To stop warning. */
-  grub_register_command ("crc", grub_cmd_crc, GRUB_COMMAND_FLAG_BOTH,
-			 "crc FILE", "Calculate the crc32 checksum of a file.", 0);
+  cmd = grub_register_command ("crc", grub_cmd_crc,
+			       "crc FILE",
+			       "Calculate the crc32 checksum of a file.");
 }
 
 GRUB_MOD_FINI(crc)
 {
-  grub_unregister_command ("crc");
+  grub_unregister_command (cmd);
 }

Modified: trunk/grub2/commands/date.c
===================================================================
--- trunk/grub2/commands/date.c	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/commands/date.c	2009-03-21 08:39:59 UTC (rev 2036)
@@ -17,12 +17,11 @@
  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <grub/normal.h>
 #include <grub/dl.h>
-#include <grub/arg.h>
 #include <grub/err.h>
 #include <grub/misc.h>
 #include <grub/lib/datetime.h>
+#include <grub/command.h>
 
 #define GRUB_DATETIME_SET_YEAR		1
 #define GRUB_DATETIME_SET_MONTH		2
@@ -32,7 +31,7 @@
 #define GRUB_DATETIME_SET_SECOND	32
 
 static grub_err_t
-grub_cmd_date (struct grub_arg_list *state __attribute__ ((unused)),
+grub_cmd_date (grub_command_t cmd __attribute__ ((unused)),
                int argc, char **args)
 {
   struct grub_datetime datetime;
@@ -130,16 +129,18 @@
   return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid datetime");
 }
 
+static grub_command_t cmd;
+
 GRUB_MOD_INIT(date)
 {
   (void) mod;			/* To stop warning. */
-  grub_register_command ("date", grub_cmd_date,
-                         GRUB_COMMAND_FLAG_BOTH,
-			 "date [[year-]month-day] [hour:minute[:second]]",
-                         "Command to display/set current datetime.", 0);
+  cmd =
+    grub_register_command ("date", grub_cmd_date,
+			   "date [[year-]month-day] [hour:minute[:second]]",
+			   "Command to display/set current datetime.");
 }
 
 GRUB_MOD_FINI(date)
 {
-  grub_unregister_command ("date");
+  grub_unregister_command (cmd);
 }

Modified: trunk/grub2/commands/echo.c
===================================================================
--- trunk/grub2/commands/echo.c	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/commands/echo.c	2009-03-21 08:39:59 UTC (rev 2036)
@@ -17,10 +17,9 @@
  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <grub/normal.h>
 #include <grub/dl.h>
-#include <grub/arg.h>
 #include <grub/misc.h>
+#include <grub/extcmd.h>
 
 static const struct grub_arg_option options[] =
   {
@@ -29,10 +28,10 @@
     {0, 0, 0, 0, 0, 0}
   };
 
-
 static grub_err_t
-grub_cmd_echo (struct grub_arg_list *state, int argc, char **args)
+grub_cmd_echo (grub_extcmd_t cmd, int argc, char **args)
 {
+  struct grub_arg_list *state = cmd->state;
   int newline = 1;
   int i;
 
@@ -109,16 +108,17 @@
   return 0;
 }
 
+static grub_extcmd_t cmd;
 
 GRUB_MOD_INIT(echo)
 {
   (void) mod;			/* To stop warning. */
-  grub_register_command ("echo", grub_cmd_echo, GRUB_COMMAND_FLAG_BOTH,
-			 "echo [-e|-n] FILE", "Display a line of text.",
-			 options);
+  cmd = grub_register_extcmd ("echo", grub_cmd_echo, GRUB_COMMAND_FLAG_BOTH,
+			      "echo [-e|-n] FILE", "Display a line of text.",
+			      options);
 }
 
 GRUB_MOD_FINI(echo)
 {
-  grub_unregister_command ("echo");
+  grub_unregister_extcmd (cmd);
 }

Added: trunk/grub2/commands/extcmd.c
===================================================================
--- trunk/grub2/commands/extcmd.c	                        (rev 0)
+++ trunk/grub2/commands/extcmd.c	2009-03-21 08:39:59 UTC (rev 2036)
@@ -0,0 +1,97 @@
+/* extcmd.c - support extended command */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2009  Free Software Foundation, Inc.
+ *
+ *  GRUB is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  GRUB is distributed in the hope that it will be useful,
+ *  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
+ *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/mm.h>
+#include <grub/list.h>
+#include <grub/misc.h>
+#include <grub/extcmd.h>
+
+static grub_err_t
+grub_extcmd_dispatcher (struct grub_command *cmd,
+			int argc, char **args)
+{
+  int new_argc;
+  char **new_args;
+  struct grub_arg_option *parser;
+  struct grub_arg_list *state;
+  int maxargs = 0;
+  grub_err_t ret;
+  grub_extcmd_t ext;
+
+  ext = cmd->data;
+  parser = (struct grub_arg_option *) ext->options;
+  while (parser && (parser++)->doc)
+    maxargs++;
+
+  /* Set up the option state.  */
+  state = grub_malloc (sizeof (struct grub_arg_list) * maxargs);
+  grub_memset (state, 0, sizeof (struct grub_arg_list) * maxargs);
+
+  if (grub_arg_parse (ext, argc, args, state, &new_args, &new_argc))
+    {
+      ext->state = state;
+      ret = (ext->func) (ext, new_argc, new_args);
+      grub_free (new_args);
+    }
+  else
+    ret = grub_errno;
+
+  grub_free (state);
+
+  return ret;
+}
+
+grub_extcmd_t
+grub_register_extcmd (const char *name, grub_extcmd_func_t func,
+		      unsigned flags, const char *summary,
+		      const char *description,
+		      const struct grub_arg_option *parser)
+{
+  grub_extcmd_t ext;
+  grub_command_t cmd;
+
+  ext = (grub_extcmd_t) grub_malloc (sizeof (*ext));
+  if (! ext)
+    return 0;
+
+  cmd = grub_register_command_prio (name, grub_extcmd_dispatcher,
+				    summary, description, 1);
+  if (! cmd)
+    {
+      grub_free (ext);
+      return 0;
+    }
+
+  cmd->flags = (flags | GRUB_COMMAND_FLAG_EXTCMD);
+  cmd->data = ext;
+
+  ext->cmd = cmd;
+  ext->func = func;
+  ext->options = parser;
+  ext->data = 0;
+
+  return ext;
+}
+
+void
+grub_unregister_extcmd (grub_extcmd_t ext)
+{
+  grub_unregister_command (ext->cmd);
+  grub_free (ext);
+}

Modified: trunk/grub2/commands/halt.c
===================================================================
--- trunk/grub2/commands/halt.c	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/commands/halt.c	2009-03-21 08:39:59 UTC (rev 2036)
@@ -17,9 +17,9 @@
  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <grub/normal.h>
 #include <grub/dl.h>
 #include <grub/machine/machine.h>
+#include <grub/command.h>
 
 #if defined(GRUB_MACHINE_IEEE1275)
 #include <grub/machine/kernel.h>
@@ -31,7 +31,7 @@
 #endif
 
 static grub_err_t
-grub_cmd_halt (struct grub_arg_list *state __attribute__ ((unused)),
+grub_cmd_halt (grub_command_t cmd __attribute__ ((unused)),
 	       int argc __attribute__ ((unused)),
 	       char **args __attribute__ ((unused)))
 {
@@ -39,16 +39,17 @@
   return 0;
 }
 
+static grub_command_t cmd;
 
 GRUB_MOD_INIT(halt)
 {
   (void)mod;			/* To stop warning. */
-  grub_register_command ("halt", grub_cmd_halt, GRUB_COMMAND_FLAG_BOTH,
-			 "halt", "halts the computer.  This command does not"
-			 " work on all firmware.", 0);
+  cmd = grub_register_command ("halt", grub_cmd_halt,
+			       0, "halts the computer.  This command does not"
+			       " work on all firmware.");
 }
 
 GRUB_MOD_FINI(halt)
 {
-  grub_unregister_command ("halt");
+  grub_unregister_command (cmd);
 }

Modified: trunk/grub2/commands/handler.c
===================================================================
--- trunk/grub2/commands/handler.c	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/commands/handler.c	2009-03-21 08:39:59 UTC (rev 2036)
@@ -17,18 +17,18 @@
  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <grub/normal.h>
 #include <grub/dl.h>
 #include <grub/err.h>
 #include <grub/misc.h>
 #include <grub/term.h>
 #include <grub/handler.h>
+#include <grub/command.h>
 
 static grub_err_t
-grub_cmd_handler_generic (int argc, char **args, char *class_name)
+grub_cmd_handler (struct grub_command *cmd,
+		  int argc, char **args)
 {
-  char *find_name;
-  void *find_result;
+  char *class_name;
   void *curr_item = 0;
   grub_handler_class_t head;
 
@@ -43,10 +43,12 @@
       return 0;
     }
 
+  class_name = (grub_strcmp (cmd->name, "handler")) ? (char *) cmd->name : 0;
+
   head = grub_handler_class_list;
   if ((argc == 0) && (class_name == 0))
     {
-      grub_list_iterate (head, (grub_list_hook_t) list_item);
+      grub_list_iterate (GRUB_AS_LIST (head), (grub_list_hook_t) list_item);
     }
   else
     {
@@ -66,7 +68,7 @@
       if (argc == 0)
 	{
 	  curr_item = class->cur_handler;
-	  grub_list_iterate (class->handler_list,
+	  grub_list_iterate (GRUB_AS_LIST (class->handler_list),
 			     (grub_list_hook_t) list_item);
 	}
       else
@@ -87,46 +89,28 @@
   return 0;
 }
 
-static grub_err_t
-grub_cmd_handler (struct grub_arg_list *state __attribute__ ((unused)),
-		  int argc, char **args)
-{
-  return grub_cmd_handler_generic (argc, args, 0);
-}
+static grub_command_t cmd_handler, cmd_terminal_input, cmd_terminal_output;
 
-static grub_err_t
-grub_cmd_terminal_input (struct grub_arg_list *state __attribute__ ((unused)),
-			 int argc, char **args)
-{
-  return grub_cmd_handler_generic (argc, args, "terminal_input");
-}
-
-static grub_err_t
-grub_cmd_terminal_output (struct grub_arg_list *state __attribute__ ((unused)),
-			  int argc, char **args)
-{
-  return grub_cmd_handler_generic (argc, args, "terminal_output");
-}
-
 GRUB_MOD_INIT(handler)
 {
   (void)mod;			/* To stop warning. */
-  grub_register_command ("handler", grub_cmd_handler, GRUB_COMMAND_FLAG_BOTH,
-			 "handler [class [handler]]",
-			 "List or select a handler", 0);
-  grub_register_command ("terminal_input", grub_cmd_terminal_input,
-			 GRUB_COMMAND_FLAG_BOTH,
-			 "terminal_input [handler]",
-			 "List or select a handler", 0);
-  grub_register_command ("terminal_output", grub_cmd_terminal_output,
-			 GRUB_COMMAND_FLAG_BOTH,
-			 "terminal_output [handler]",
-			 "List or select a handler", 0);
+  cmd_handler =
+    grub_register_command ("handler", grub_cmd_handler,
+			   "handler [class [handler]]",
+			   "List or select a handler");
+  cmd_terminal_input =
+    grub_register_command ("terminal_input", grub_cmd_handler,
+			   "terminal_input [handler]",
+			   "List or select a handler");
+  cmd_terminal_output =
+    grub_register_command ("terminal_output", grub_cmd_handler,
+			   "terminal_output [handler]",
+			   "List or select a handler");
 }
 
 GRUB_MOD_FINI(handler)
 {
-  grub_unregister_command ("terminal_input");
-  grub_unregister_command ("terminal_output");
-  grub_unregister_command ("handler");
+  grub_unregister_command (cmd_handler);
+  grub_unregister_command (cmd_terminal_input);
+  grub_unregister_command (cmd_terminal_output);
 }

Modified: trunk/grub2/commands/hdparm.c
===================================================================
--- trunk/grub2/commands/hdparm.c	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/commands/hdparm.c	2009-03-21 08:39:59 UTC (rev 2036)
@@ -17,16 +17,14 @@
  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <grub/arg.h>
 #include <grub/ata.h>
 #include <grub/disk.h>
 #include <grub/dl.h>
 #include <grub/misc.h>
-#include <grub/normal.h>
 #include <grub/mm.h>
 #include <grub/lib/hexdump.h>
+#include <grub/extcmd.h>
 
-
 static const struct grub_arg_option options[] = {
   {"apm",             'B', 0, "set Advanced Power Management\n"
 			      "(1=low, ..., 254=high, 255=off)",
@@ -270,10 +268,11 @@
   return (state->set ? (int)grub_strtoul (state->arg, 0, 0) : -1);
 }
 
-
 static grub_err_t
-grub_cmd_hdparm (struct grub_arg_list *state, int argc, char **args) // state????
+grub_cmd_hdparm (grub_extcmd_t cmd, int argc, char **args) // state????
 {
+  struct grub_arg_list *state = cmd->state;
+
   /* Check command line.  */
   if (argc != 1)
     return grub_error (GRUB_ERR_BAD_ARGUMENT, "missing device name argument");
@@ -405,17 +404,19 @@
   return status;
 }
 
+static grub_extcmd_t cmd;
 
 GRUB_MOD_INIT(hdparm)
 {
   (void) mod;
 
-  grub_register_command ("hdparm", grub_cmd_hdparm, GRUB_COMMAND_FLAG_BOTH,
-			 "hdparm [OPTIONS] DISK",
-			 "Get/set ATA disk parameters.", options);
+  cmd = grub_register_extcmd ("hdparm", grub_cmd_hdparm,
+			      GRUB_COMMAND_FLAG_BOTH,
+			      "hdparm [OPTIONS] DISK",
+			      "Get/set ATA disk parameters.", options);
 }
 
 GRUB_MOD_FINI(hdparm)
 {
-  grub_unregister_command ("hdparm");
+  grub_unregister_extcmd (cmd);
 }

Modified: trunk/grub2/commands/help.c
===================================================================
--- trunk/grub2/commands/help.c	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/commands/help.c	2009-03-21 08:39:59 UTC (rev 2036)
@@ -17,16 +17,14 @@
  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <grub/normal.h>
 #include <grub/dl.h>
-#include <grub/arg.h>
 #include <grub/misc.h>
 #include <grub/term.h>
+#include <grub/extcmd.h>
 
 static grub_err_t
-grub_cmd_help (struct grub_arg_list *state __attribute__ ((unused)), int argc,
+grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc,
 	       char **args)
-
 {
   int cnt = 0;
   char *currarg;
@@ -36,44 +34,46 @@
 
   int print_command_info (grub_command_t cmd)
     {
-      if (grub_command_find (cmd->name))
+      if ((cmd->prio & GRUB_PRIO_LIST_FLAG_ACTIVE) &&
+	  (cmd->flags & GRUB_COMMAND_FLAG_CMDLINE))
 	{
-	  if (cmd->flags & GRUB_COMMAND_FLAG_CMDLINE)
-	    {
-	      char description[GRUB_TERM_WIDTH / 2];
-	      int desclen = grub_strlen (cmd->summary);
-	      
-	      /* Make a string with a length of GRUB_TERM_WIDTH / 2 - 1 filled
-		 with the description followed by spaces.  */
-	      grub_memset (description, ' ', GRUB_TERM_WIDTH / 2 - 1);
-	      description[GRUB_TERM_WIDTH / 2 - 1] = '\0';
-	      grub_memcpy (description, cmd->summary,
-			   (desclen < GRUB_TERM_WIDTH / 2 - 1 
-			    ? desclen : GRUB_TERM_WIDTH / 2 - 1));
-	      
-	      grub_printf ("%s%s", description, (cnt++) % 2 ? "\n" : " ");
-	    }
+	  char description[GRUB_TERM_WIDTH / 2];
+	  int desclen = grub_strlen (cmd->summary);
+
+	  /* Make a string with a length of GRUB_TERM_WIDTH / 2 - 1 filled
+	     with the description followed by spaces.  */
+	  grub_memset (description, ' ', GRUB_TERM_WIDTH / 2 - 1);
+	  description[GRUB_TERM_WIDTH / 2 - 1] = '\0';
+	  grub_memcpy (description, cmd->summary,
+		       (desclen < GRUB_TERM_WIDTH / 2 - 1
+			? desclen : GRUB_TERM_WIDTH / 2 - 1));
+
+	  grub_printf ("%s%s", description, (cnt++) % 2 ? "\n" : " ");
 	}
       return 0;
     }
 
   int print_command_help (grub_command_t cmd)
     {
-      if (grub_command_find (cmd->name))
+      if (cmd->flags & GRUB_PRIO_LIST_FLAG_ACTIVE)
 	{
 	  if (! grub_strncmp (cmd->name, currarg, grub_strlen (currarg)))
 	    {
 	      if (cnt++ > 0)
 		grub_printf ("\n\n");
 	      
-	      grub_arg_show_help (cmd);
+	      if (cmd->flags & GRUB_COMMAND_FLAG_EXTCMD)
+		grub_arg_show_help ((grub_extcmd_t) cmd->data);
+	      else
+		grub_printf ("Usage: %s\n%s\b", cmd->summary,
+			     cmd->description);
 	    }
 	}
       return 0;
     }
   
   if (argc == 0)
-    grub_iterate_commands (print_command_info);
+    grub_command_iterate (print_command_info);
   else
     {
       int i;
@@ -81,23 +81,25 @@
       for (i = 0; i < argc; i++)
 	{
 	  currarg = args[i];
-	  grub_iterate_commands (print_command_help);	  
+	  grub_command_iterate (print_command_help);
 	}
     }
   
   return 0;
 }
 
-
+static grub_extcmd_t cmd;
 
 GRUB_MOD_INIT(help)
 {
   (void)mod;			/* To stop warning. */
-  grub_register_command ("help", grub_cmd_help, GRUB_COMMAND_FLAG_CMDLINE,
-			 "help [PATTERN ...]", "Show a help message.", 0);
+  cmd = grub_register_extcmd ("help", grub_cmd_help,
+			      GRUB_COMMAND_FLAG_CMDLINE,
+			      "help [PATTERN ...]",
+			      "Show a help message.", 0);
 }
 
 GRUB_MOD_FINI(help)
 {
-  grub_unregister_command ("help");
+  grub_unregister_extcmd (cmd);
 }

Modified: trunk/grub2/commands/hexdump.c
===================================================================
--- trunk/grub2/commands/hexdump.c	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/commands/hexdump.c	2009-03-21 08:39:59 UTC (rev 2036)
@@ -17,15 +17,14 @@
  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <grub/normal.h>
 #include <grub/dl.h>
-#include <grub/arg.h>
 #include <grub/file.h>
 #include <grub/disk.h>
 #include <grub/misc.h>
 #include <grub/gzio.h>
 #include <grub/partition.h>
 #include <grub/lib/hexdump.h>
+#include <grub/extcmd.h>
 
 static const struct grub_arg_option options[] = {
   {"skip", 's', 0, "skip offset bytes from the beginning of file.", 0,
@@ -35,8 +34,9 @@
 };
 
 static grub_err_t
-grub_cmd_hexdump (struct grub_arg_list *state, int argc, char **args)
+grub_cmd_hexdump (grub_extcmd_t cmd, int argc, char **args)
 {
+  struct grub_arg_list *state = cmd->state;
   char buf[GRUB_DISK_SECTOR_SIZE * 4];
   grub_ssize_t size, length;
   grub_addr_t skip;
@@ -121,16 +121,19 @@
   return 0;
 }
 
+static grub_extcmd_t cmd;
 
 GRUB_MOD_INIT (hexdump)
 {
   (void) mod;			/* To stop warning. */
-  grub_register_command ("hexdump", grub_cmd_hexdump, GRUB_COMMAND_FLAG_BOTH,
-			 "hexdump [OPTIONS] FILE_OR_DEVICE",
-			 "Dump the contents of a file or memory.", options);
+  cmd = grub_register_extcmd ("hexdump", grub_cmd_hexdump,
+			      GRUB_COMMAND_FLAG_BOTH,
+			      "hexdump [OPTIONS] FILE_OR_DEVICE",
+			      "Dump the contents of a file or memory.",
+			      options);
 }
 
 GRUB_MOD_FINI (hexdump)
 {
-  grub_unregister_command ("hexdump");
+  grub_unregister_extcmd (cmd);
 }

Modified: trunk/grub2/commands/i386/cpuid.c
===================================================================
--- trunk/grub2/commands/i386/cpuid.c	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/commands/i386/cpuid.c	2009-03-21 08:39:59 UTC (rev 2036)
@@ -18,12 +18,11 @@
  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <grub/normal.h>
 #include <grub/dl.h>
-#include <grub/arg.h>
 #include <grub/misc.h>
 #include <grub/mm.h>
 #include <grub/env.h>
+#include <grub/command.h>
 
 #define cpuid(num,a,b,c,d) \
   asm volatile ("xchgl %%ebx, %1; cpuid; xchgl %%ebx, %1" \
@@ -34,20 +33,16 @@
 
 static unsigned char has_longmode = 0;
 
-static const struct grub_arg_option options[] =
-  {
-    {"long-mode", 'l', 0, "check for long mode flag (default)", 0, 0},
-    {0, 0, 0, 0, 0, 0}
-  };
-
 static grub_err_t
-grub_cmd_cpuid (struct grub_arg_list *state __attribute__ ((unused)),
+grub_cmd_cpuid (struct grub_command *cmd __attribute__ ((unused)),
 	       int argc __attribute__ ((unused)),
 	       char **args __attribute__ ((unused)))
 {
   return !has_longmode;
 }
 
+static grub_command_t cmd;
+
 GRUB_MOD_INIT(cpuid)
 {
 #ifdef __x86_64__
@@ -83,11 +78,11 @@
 done:
 #endif
 
-  grub_register_command ("cpuid", grub_cmd_cpuid, GRUB_COMMAND_FLAG_CMDLINE,
-			 "cpuid", "Check for CPU features", options);
+  cmd = grub_register_command ("cpuid", grub_cmd_cpuid,
+			       0, "Check for CPU features");
 }
 
 GRUB_MOD_FINI(cpuid)
 {
-  grub_unregister_command ("cpuid");
+  grub_unregister_command (cmd);
 }

Modified: trunk/grub2/commands/i386/pc/halt.c
===================================================================
--- trunk/grub2/commands/i386/pc/halt.c	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/commands/i386/pc/halt.c	2009-03-21 08:39:59 UTC (rev 2036)
@@ -17,10 +17,9 @@
  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <grub/normal.h>
 #include <grub/dl.h>
-#include <grub/arg.h>
 #include <grub/machine/init.h>
+#include <grub/extcmd.h>
 
 static const struct grub_arg_option options[] =
   {
@@ -29,11 +28,12 @@
   };
 
 static grub_err_t
-grub_cmd_halt (struct grub_arg_list *state,
+grub_cmd_halt (grub_extcmd_t cmd,
 	       int argc __attribute__ ((unused)),
 	       char **args __attribute__ ((unused)))
 
 {
+  struct grub_arg_list *state = cmd->state;
   int no_apm = 0;
   if (state[0].set)
     no_apm = 1;
@@ -41,17 +41,18 @@
   return 0;
 }
 
-
+static grub_extcmd_t cmd;
 
 GRUB_MOD_INIT(halt)
 {
   (void)mod;			/* To stop warning. */
-  grub_register_command ("halt", grub_cmd_halt, GRUB_COMMAND_FLAG_BOTH,
-			 "halt [-n]",
-			 "Halt the system, if possible using APM", options);
+  cmd = grub_register_extcmd ("halt", grub_cmd_halt, GRUB_COMMAND_FLAG_BOTH,
+			      "halt [-n]",
+			      "Halt the system, if possible using APM",
+			      options);
 }
 
 GRUB_MOD_FINI(halt)
 {
-  grub_unregister_command ("halt");
+  grub_unregister_extcmd (cmd);
 }

Modified: trunk/grub2/commands/i386/pc/play.c
===================================================================
--- trunk/grub2/commands/i386/pc/play.c	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/commands/i386/pc/play.c	2009-03-21 08:39:59 UTC (rev 2036)
@@ -19,15 +19,14 @@
 
 /* Lots of this file is borrowed from GNU/Hurd generic-speaker driver.  */
 
-#include <grub/normal.h>
 #include <grub/dl.h>
-#include <grub/arg.h>
 #include <grub/file.h>
 #include <grub/disk.h>
 #include <grub/term.h>
 #include <grub/misc.h>
 #include <grub/machine/time.h>
 #include <grub/cpu/io.h>
+#include <grub/command.h>
 
 #define BASE_TEMPO 120
 
@@ -144,7 +143,7 @@
 }
 
 static grub_err_t
-grub_cmd_play (struct grub_arg_list *state __attribute__ ((unused)),
+grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
 	       int argc, char **args)
 {
   grub_file_t file;
@@ -203,15 +202,16 @@
   return 0;
 }
 
+static grub_command_t cmd;
 
 GRUB_MOD_INIT(play)
 {
   (void)mod;			/* To stop warning. */
-  grub_register_command ("play", grub_cmd_play, GRUB_COMMAND_FLAG_BOTH,
-			 "play FILE", "Play a tune", 0);
+  cmd = grub_register_command ("play", grub_cmd_play,
+			       "play FILE", "Play a tune");
 }
 
 GRUB_MOD_FINI(play)
 {
-  grub_unregister_command ("play");
+  grub_unregister_command (cmd);
 }

Modified: trunk/grub2/commands/i386/pc/pxecmd.c
===================================================================
--- trunk/grub2/commands/i386/pc/pxecmd.c	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/commands/i386/pc/pxecmd.c	2009-03-21 08:39:59 UTC (rev 2036)
@@ -17,12 +17,11 @@
  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <grub/normal.h>
 #include <grub/dl.h>
-#include <grub/arg.h>
 #include <grub/err.h>
 #include <grub/misc.h>
 #include <grub/machine/pxe.h>
+#include <grub/extcmd.h>
 
 static const struct grub_arg_option options[] =
 {
@@ -46,9 +45,11 @@
 }
 
 static grub_err_t
-grub_cmd_pxe (struct grub_arg_list *state, int argc __attribute__ ((unused)),
+grub_cmd_pxe (grub_extcmd_t cmd, int argc __attribute__ ((unused)),
 	      char **args __attribute__ ((unused)))
 {
+  struct grub_arg_list *state = cmd->state;
+
   if (! grub_pxe_pxenv)
     return grub_error (GRUB_ERR_FILE_NOT_FOUND, "no pxe environment");
 
@@ -83,15 +84,17 @@
   return 0;
 }
 
+static grub_extcmd_t cmd;
+
 GRUB_MOD_INIT(pxecmd)
 {
   (void) mod;			/* To stop warning. */
-  grub_register_command ("pxe", grub_cmd_pxe, GRUB_COMMAND_FLAG_BOTH,
-			 "pxe [-i|-b|-u]",
-                         "Command to control the PXE device.", options);
+  cmd = grub_register_extcmd ("pxe", grub_cmd_pxe, GRUB_COMMAND_FLAG_BOTH,
+			      "pxe [-i|-b|-u]",
+			      "Command to control the PXE device.", options);
 }
 
 GRUB_MOD_FINI(pxecmd)
 {
-  grub_unregister_command ("pxe");
+  grub_unregister_extcmd (cmd);
 }

Modified: trunk/grub2/commands/i386/pc/vbeinfo.c
===================================================================
--- trunk/grub2/commands/i386/pc/vbeinfo.c	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/commands/i386/pc/vbeinfo.c	2009-03-21 08:39:59 UTC (rev 2036)
@@ -17,14 +17,13 @@
  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <grub/normal.h>
 #include <grub/dl.h>
-#include <grub/arg.h>
 #include <grub/env.h>
 #include <grub/misc.h>
 #include <grub/machine/init.h>
 #include <grub/machine/vbe.h>
 #include <grub/mm.h>
+#include <grub/command.h>
 
 static void *
 real2pm (grub_vbe_farptr_t ptr)
@@ -34,7 +33,7 @@
 }
 
 static grub_err_t
-grub_cmd_vbeinfo (struct grub_arg_list *state __attribute__ ((unused)),
+grub_cmd_vbeinfo (grub_command_t cmd __attribute__ ((unused)),
 		  int argc __attribute__ ((unused)),
 		  char **args __attribute__ ((unused)))
 {
@@ -53,7 +52,7 @@
     return err;
 
   grub_printf ("VBE info:   version: %d.%d  OEM software rev: %d.%d\n",
-               controller_info.version >> 8, 
+	       controller_info.version >> 8,
                controller_info.version & 0xFF,
                controller_info.oem_software_rev >> 8,
                controller_info.oem_software_rev & 0xFF);
@@ -77,7 +76,7 @@
   
   grub_printf ("List of compatible video modes:\n");
   grub_printf ("Legend: P=Packed pixel, D=Direct color, "
-               "mask/pos=R/G/B/reserved\n"); 
+	       "mask/pos=R/G/B/reserved\n");
 
   /* Walk through all video modes listed.  */
   for (p = saved_video_mode_list; *p != 0xFFFF; p++)
@@ -170,18 +169,17 @@
   return 0;
 }
 
+static grub_command_t cmd;
+
 GRUB_MOD_INIT(vbeinfo)
 {
   (void) mod;			/* To stop warning.  */
-  grub_register_command ("vbeinfo",
-                         grub_cmd_vbeinfo,
-                         GRUB_COMMAND_FLAG_BOTH,
-                         "vbeinfo",
-                         "List compatible VESA BIOS extension video modes.",
-                         0);
+  cmd =
+    grub_register_command ("vbeinfo", grub_cmd_vbeinfo, 0,
+			   "List compatible VESA BIOS extension video modes.");
 }
 
 GRUB_MOD_FINI(vbeinfo)
 {
-  grub_unregister_command ("vbeinfo");
+  grub_unregister_command (cmd);
 }

Modified: trunk/grub2/commands/i386/pc/vbetest.c
===================================================================
--- trunk/grub2/commands/i386/pc/vbetest.c	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/commands/i386/pc/vbetest.c	2009-03-21 08:39:59 UTC (rev 2036)
@@ -19,7 +19,6 @@
 
 #include <grub/normal.h>
 #include <grub/dl.h>
-#include <grub/arg.h>
 #include <grub/env.h>
 #include <grub/misc.h>
 #include <grub/term.h>
@@ -28,7 +27,7 @@
 #include <grub/err.h>
 
 static grub_err_t
-grub_cmd_vbetest (struct grub_arg_list *state __attribute__ ((unused)),
+grub_cmd_vbetest (grub_command_t cmd __attribute__ ((unused)),
 		  int argc __attribute__ ((unused)),
 		  char **args __attribute__ ((unused)))
 {
@@ -162,18 +161,16 @@
   return grub_errno;
 }
 
+static grub_command_t cmd;
+
 GRUB_MOD_INIT(vbetest)
 {
   (void) mod;			/* To stop warning.  */
-  grub_register_command ("vbetest",
-                         grub_cmd_vbetest,
-                         GRUB_COMMAND_FLAG_BOTH,
-                         "vbetest",
-                         "Test VESA BIOS Extension 2.0+ support",
-                         0);
+  cmd = grub_register_command ("vbetest", grub_cmd_vbetest,
+			       0, "Test VESA BIOS Extension 2.0+ support");
 }
 
 GRUB_MOD_FINI(vbetest)
 {
-  grub_unregister_command ("vbetest");
+  grub_unregister_command (cmd);
 }

Modified: trunk/grub2/commands/ieee1275/suspend.c
===================================================================
--- trunk/grub2/commands/ieee1275/suspend.c	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/commands/ieee1275/suspend.c	2009-03-21 08:39:59 UTC (rev 2036)
@@ -17,14 +17,14 @@
  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <grub/normal.h>
 #include <grub/dl.h>
 #include <grub/misc.h>
 #include <grub/term.h>
 #include <grub/ieee1275/ieee1275.h>
+#include <grub/command.h>
 
 static grub_err_t
-grub_cmd_suspend (struct grub_arg_list *state  __attribute__ ((unused)),
+grub_cmd_suspend (grub_command_t cmd __attribute__ ((unused)),
 		  int argc __attribute__ ((unused)),
 		  char **args __attribute__ ((unused)))
 {
@@ -34,15 +34,16 @@
   return 0;
 }
 
+static grub_command_t cmd;
 
 GRUB_MOD_INIT(ieee1275_suspend)
 {
   (void)mod;			/* To stop warning. */
-  grub_register_command ("suspend", grub_cmd_suspend, GRUB_COMMAND_FLAG_BOTH,
-			 "suspend", "Return to Open Firmware prompt", 0);
+  cmd = grub_register_command ("suspend", grub_cmd_suspend,
+			       0, "Return to Open Firmware prompt");
 }
 
 GRUB_MOD_FINI(ieee1275_suspend)
 {
-  grub_unregister_command ("suspend");
+  grub_unregister_command (cmd);
 }

Modified: trunk/grub2/commands/loadenv.c
===================================================================
--- trunk/grub2/commands/loadenv.c	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/commands/loadenv.c	2009-03-21 08:39:59 UTC (rev 2036)
@@ -17,16 +17,15 @@
  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <grub/normal.h>
 #include <grub/dl.h>
 #include <grub/mm.h>
-#include <grub/arg.h>
 #include <grub/file.h>
 #include <grub/disk.h>
 #include <grub/misc.h>
 #include <grub/env.h>
 #include <grub/partition.h>
 #include <grub/lib/envblk.h>
+#include <grub/extcmd.h>
 
 static const struct grub_arg_option options[] =
   {
@@ -102,10 +101,12 @@
 }
 
 static grub_err_t
-grub_cmd_load_env (struct grub_arg_list *state,
-                   int argc __attribute__ ((unused)), char **args __attribute__ ((unused)))
+grub_cmd_load_env (grub_extcmd_t cmd,
+		   int argc __attribute__ ((unused)),
+		   char **args __attribute__ ((unused)))
 
 {
+  struct grub_arg_list *state = cmd->state;
   grub_file_t file;
 
   auto int hook (char *name, char *value);
@@ -128,9 +129,11 @@
 }
 
 static grub_err_t
-grub_cmd_list_env (struct grub_arg_list *state,
-                   int argc __attribute__ ((unused)), char **args __attribute__ ((unused)))
+grub_cmd_list_env (grub_extcmd_t cmd,
+		   int argc __attribute__ ((unused)),
+		   char **args __attribute__ ((unused)))
 {
+  struct grub_arg_list *state = cmd->state;
   grub_file_t file;
 
   auto int hook (char *name, char *value);
@@ -153,8 +156,9 @@
 }
 
 static grub_err_t
-grub_cmd_save_env (struct grub_arg_list *state, int argc, char **args)
+grub_cmd_save_env (grub_extcmd_t cmd, int argc, char **args)
 {
+  struct grub_arg_list *state = cmd->state;
   grub_file_t file;
   grub_disk_t disk;
   grub_disk_addr_t addr[GRUB_ENVBLK_MAXLEN >> GRUB_DISK_SECTOR_BITS];
@@ -238,20 +242,35 @@
   return grub_errno;
 }
 
+static grub_extcmd_t cmd_load, cmd_list, cmd_save;
+
 GRUB_MOD_INIT(loadenv)
 {
   (void) mod;
-  grub_register_command ("load_env", grub_cmd_load_env, GRUB_COMMAND_FLAG_BOTH,
-			 "load_env [-f FILE]", "Load variables from environment block file.", options);
-  grub_register_command ("list_env", grub_cmd_list_env, GRUB_COMMAND_FLAG_BOTH,
-			 "list_env [-f FILE]", "List variables from environment block file.", options);
-  grub_register_command ("save_env", grub_cmd_save_env, GRUB_COMMAND_FLAG_BOTH,
-			 "save_env [-f FILE] variable_name [...]", "Save variables to environment block file.", options);
+
+  cmd_load =
+    grub_register_extcmd ("load_env", grub_cmd_load_env,
+			  GRUB_COMMAND_FLAG_BOTH,
+			  "load_env [-f FILE]",
+			  "Load variables from environment block file.",
+			  options);
+  cmd_list =
+    grub_register_extcmd ("list_env", grub_cmd_list_env,
+			  GRUB_COMMAND_FLAG_BOTH,
+			  "list_env [-f FILE]",
+			  "List variables from environment block file.",
+			  options);
+  cmd_save =
+    grub_register_extcmd ("save_env", grub_cmd_save_env,
+			  GRUB_COMMAND_FLAG_BOTH,
+			  "save_env [-f FILE] variable_name [...]",
+			  "Save variables to environment block file.",
+			  options);
 }
 
 GRUB_MOD_FINI(loadenv)
 {
-  grub_unregister_command ("load_env");
-  grub_unregister_command ("list_env");
-  grub_unregister_command ("save_env");
+  grub_unregister_extcmd (cmd_load);
+  grub_unregister_extcmd (cmd_list);
+  grub_unregister_extcmd (cmd_save);
 }

Modified: trunk/grub2/commands/ls.c
===================================================================
--- trunk/grub2/commands/ls.c	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/commands/ls.c	2009-03-21 08:39:59 UTC (rev 2036)
@@ -22,13 +22,13 @@
 #include <grub/mm.h>
 #include <grub/err.h>
 #include <grub/dl.h>
-#include <grub/normal.h>
-#include <grub/arg.h>
 #include <grub/disk.h>
 #include <grub/device.h>
 #include <grub/term.h>
 #include <grub/partition.h>
 #include <grub/file.h>
+#include <grub/normal.h>
+#include <grub/extcmd.h>
 
 static const struct grub_arg_option options[] =
   {
@@ -134,7 +134,7 @@
 	      
 	    }
 	  grub_file_close (file);
-      	}
+	}
       else
 	grub_printf ("%-12s", "DIR");
 
@@ -220,8 +220,10 @@
 }
 
 static grub_err_t
-grub_cmd_ls (struct grub_arg_list *state, int argc, char **args)
+grub_cmd_ls (grub_extcmd_t cmd, int argc, char **args)
 {
+  struct grub_arg_list *state = cmd->state;
+
   if (argc == 0)
     grub_ls_list_devices (state[0].set);
   else
@@ -231,15 +233,17 @@
   return 0;
 }
 
+static grub_extcmd_t cmd;
+
 GRUB_MOD_INIT(ls)
 {
   (void)mod;			/* To stop warning. */
-  grub_register_command ("ls", grub_cmd_ls, GRUB_COMMAND_FLAG_BOTH,
-			 "ls [-l|-h|-a] [FILE]",
-			 "List devices and files.", options);
+  cmd = grub_register_extcmd ("ls", grub_cmd_ls, GRUB_COMMAND_FLAG_BOTH,
+			      "ls [-l|-h|-a] [FILE]",
+			      "List devices and files.", options);
 }
 
 GRUB_MOD_FINI(ls)
 {
-  grub_unregister_command ("ls");
+  grub_unregister_extcmd (cmd);
 }

Modified: trunk/grub2/commands/lsmmap.c
===================================================================
--- trunk/grub2/commands/lsmmap.c	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/commands/lsmmap.c	2009-03-21 08:39:59 UTC (rev 2036)
@@ -17,13 +17,12 @@
  */
 
 #include <grub/machine/memory.h>
-#include <grub/normal.h>
 #include <grub/dl.h>
-#include <grub/arg.h>
 #include <grub/misc.h>
+#include <grub/command.h>
 
 static grub_err_t
-grub_cmd_lsmmap (struct grub_arg_list *state __attribute__ ((unused)),
+grub_cmd_lsmmap (grub_command_t cmd __attribute__ ((unused)),
 		 int argc __attribute__ ((unused)), char **args __attribute__ ((unused)))
 
 {
@@ -39,15 +38,16 @@
   return 0;
 }
 
+static grub_command_t cmd;
 
 GRUB_MOD_INIT(lsmmap)
 {
   (void) mod;			/* To stop warning. */
-  grub_register_command ("lsmmap", grub_cmd_lsmmap, GRUB_COMMAND_FLAG_BOTH,
-			 "lsmmap", "List memory map provided by firmware.", 0);
+  cmd = grub_register_command ("lsmmap", grub_cmd_lsmmap,
+			       0, "List memory map provided by firmware.");
 }
 
 GRUB_MOD_FINI(lsmmap)
 {
-  grub_unregister_command ("lsmmap");
+  grub_unregister_command (cmd);
 }

Modified: trunk/grub2/commands/lspci.c
===================================================================
--- trunk/grub2/commands/lspci.c	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/commands/lspci.c	2009-03-21 08:39:59 UTC (rev 2036)
@@ -19,8 +19,8 @@
 
 #include <grub/pci.h>
 #include <grub/dl.h>
-#include <grub/normal.h>
 #include <grub/misc.h>
+#include <grub/command.h>
 
 struct grub_pci_classname
 {
@@ -146,7 +146,7 @@
 }
 
 static grub_err_t
-grub_cmd_lspci (struct grub_arg_list *state __attribute__ ((unused)),
+grub_cmd_lspci (grub_command_t cmd __attribute__ ((unused)),
 		int argc __attribute__ ((unused)),
 		char **args __attribute__ ((unused)))
 {
@@ -154,18 +154,16 @@
   return GRUB_ERR_NONE;
 }
 
+static grub_command_t cmd;
 
-
-
 GRUB_MOD_INIT(pci)
 {
   (void) mod;			/* To stop warning. */
-  grub_register_command ("lspci", grub_cmd_lspci, GRUB_COMMAND_FLAG_BOTH,
-			 "lspci", "List PCI devices", 0);
+  cmd = grub_register_command ("lspci", grub_cmd_lspci,
+			       0, "List PCI devices");
 }
 
-
 GRUB_MOD_FINI(pci)
 {
-  grub_unregister_command ("lspci");
+  grub_unregister_command (cmd);
 }

Added: trunk/grub2/commands/minicmd.c
===================================================================
--- trunk/grub2/commands/minicmd.c	                        (rev 0)
+++ trunk/grub2/commands/minicmd.c	2009-03-21 08:39:59 UTC (rev 2036)
@@ -0,0 +1,391 @@
+/* minicmd.c - commands for the rescue mode */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2003,2005,2006,2007  Free Software Foundation, Inc.
+ *
+ *  GRUB is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  GRUB is distributed in the hope that it will be useful,
+ *  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
+ *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/dl.h>
+#include <grub/mm.h>
+#include <grub/err.h>
+#include <grub/env.h>
+#include <grub/misc.h>
+#include <grub/file.h>
+#include <grub/disk.h>
+#include <grub/term.h>
+#include <grub/loader.h>
+#include <grub/command.h>
+
+/* boot */
+static grub_err_t
+grub_mini_cmd_boot (struct grub_command *cmd __attribute__ ((unused)),
+		    int argc __attribute__ ((unused)),
+		    char *argv[] __attribute__ ((unused)))
+{
+  return grub_loader_boot ();
+}
+
+/* cat FILE */
+static grub_err_t
+grub_mini_cmd_cat (struct grub_command *cmd __attribute__ ((unused)),
+		   int argc, char *argv[])
+{
+  grub_file_t file;
+  char buf[GRUB_DISK_SECTOR_SIZE];
+  grub_ssize_t size;
+
+  if (argc < 1)
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, "no file specified");
+
+  file = grub_file_open (argv[0]);
+  if (! file)
+    return grub_errno;
+
+  while ((size = grub_file_read (file, buf, sizeof (buf))) > 0)
+    {
+      int i;
+
+      for (i = 0; i < size; i++)
+	{
+	  unsigned char c = buf[i];
+
+	  if ((grub_isprint (c) || grub_isspace (c)) && c != '\r')
+	    grub_putchar (c);
+	  else
+	    {
+	      grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT);
+	      grub_printf ("<%x>", (int) c);
+	      grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);
+	    }
+	}
+    }
+
+  grub_putchar ('\n');
+  grub_refresh ();
+  grub_file_close (file);
+
+  return 0;
+}
+
+/* help */
+static grub_err_t
+grub_mini_cmd_help (struct grub_command *cmd __attribute__ ((unused)),
+		    int argc __attribute__ ((unused)),
+		    char *argv[] __attribute__ ((unused)))
+{
+  grub_command_t p;
+
+  for (p = grub_command_list; p; p = p->next)
+    grub_printf ("%s (%d%c)\t%s\n", p->name,
+		 p->prio & GRUB_PRIO_LIST_PRIO_MASK,
+		 (p->prio & GRUB_PRIO_LIST_FLAG_ACTIVE) ? '+' : '-',
+		 p->description);
+
+  return 0;
+}
+
+#if 0
+static void
+grub_rescue_cmd_info (void)
+{
+  extern void grub_disk_cache_get_performance (unsigned long *,
+					       unsigned long *);
+  unsigned long hits, misses;
+
+  grub_disk_cache_get_performance (&hits, &misses);
+  grub_printf ("Disk cache: hits = %u, misses = %u ", hits, misses);
+  if (hits + misses)
+    {
+      unsigned long ratio = hits * 10000 / (hits + misses);
+      grub_printf ("(%u.%u%%)\n", ratio / 100, ratio % 100);
+    }
+  else
+    grub_printf ("(N/A)\n");
+}
+#endif
+
+/* root [DEVICE] */
+static grub_err_t
+grub_mini_cmd_root (struct grub_command *cmd __attribute__ ((unused)),
+		    int argc, char *argv[])
+{
+  grub_device_t dev;
+  grub_fs_t fs;
+
+  if (argc > 0)
+    {
+      char *device_name = grub_file_get_device_name (argv[0]);
+      if (! device_name)
+	return grub_errno;
+
+      grub_env_set ("root", device_name);
+      grub_free (device_name);
+    }
+
+  dev = grub_device_open (0);
+  if (! dev)
+    return grub_errno;
+
+  fs = grub_fs_probe (dev);
+  if (grub_errno == GRUB_ERR_UNKNOWN_FS)
+    grub_errno = GRUB_ERR_NONE;
+
+  grub_printf ("(%s): Filesystem is %s.\n",
+	       grub_env_get ("root"), fs ? fs->name : "unknown");
+
+  grub_device_close (dev);
+
+  return 0;
+}
+
+#if 0
+static void
+grub_rescue_cmd_testload (int argc, char *argv[])
+{
+  grub_file_t file;
+  char *buf;
+  grub_ssize_t size;
+  grub_ssize_t pos;
+  auto void read_func (unsigned long sector, unsigned offset, unsigned len);
+
+  void read_func (unsigned long sector __attribute__ ((unused)),
+		  unsigned offset __attribute__ ((unused)),
+		  unsigned len __attribute__ ((unused)))
+    {
+      grub_putchar ('.');
+      grub_refresh ();
+    }
+
+  if (argc < 1)
+    {
+      grub_error (GRUB_ERR_BAD_ARGUMENT, "no file specified");
+      return;
+    }
+
+  file = grub_file_open (argv[0]);
+  if (! file)
+    return;
+
+  size = grub_file_size (file) & ~(GRUB_DISK_SECTOR_SIZE - 1);
+  if (size == 0)
+    {
+      grub_file_close (file);
+      return;
+    }
+
+  buf = grub_malloc (size);
+  if (! buf)
+    goto fail;
+
+  grub_printf ("Reading %s sequentially", argv[0]);
+  file->read_hook = read_func;
+  if (grub_file_read (file, buf, size) != size)
+    goto fail;
+  grub_printf (" Done.\n");
+
+  /* Read sequentially again.  */
+  grub_printf ("Reading %s sequentially again", argv[0]);
+  if (grub_file_seek (file, 0) < 0)
+    goto fail;
+
+  for (pos = 0; pos < size; pos += GRUB_DISK_SECTOR_SIZE)
+    {
+      char sector[GRUB_DISK_SECTOR_SIZE];
+
+      if (grub_file_read (file, sector, GRUB_DISK_SECTOR_SIZE)
+	  != GRUB_DISK_SECTOR_SIZE)
+	goto fail;
+
+      if (grub_memcmp (sector, buf + pos, GRUB_DISK_SECTOR_SIZE) != 0)
+	{
+	  grub_printf ("\nDiffers in %d\n", pos);
+	  goto fail;
+	}
+    }
+  grub_printf (" Done.\n");
+
+  /* Read backwards and compare.  */
+  grub_printf ("Reading %s backwards", argv[0]);
+  pos = size;
+  while (pos > 0)
+    {
+      char sector[GRUB_DISK_SECTOR_SIZE];
+
+      pos -= GRUB_DISK_SECTOR_SIZE;
+
+      if (grub_file_seek (file, pos) < 0)
+	goto fail;
+
+      if (grub_file_read (file, sector, GRUB_DISK_SECTOR_SIZE)
+	  != GRUB_DISK_SECTOR_SIZE)
+	goto fail;
+
+      if (grub_memcmp (sector, buf + pos, GRUB_DISK_SECTOR_SIZE) != 0)
+	{
+	  int i;
+
+	  grub_printf ("\nDiffers in %d\n", pos);
+
+	  for (i = 0; i < GRUB_DISK_SECTOR_SIZE; i++)
+	    grub_putchar (buf[pos + i]);
+
+	  if (i)
+	    grub_refresh ();
+
+	  goto fail;
+	}
+    }
+  grub_printf (" Done.\n");
+
+ fail:
+
+  grub_file_close (file);
+  grub_free (buf);
+}
+#endif
+
+/* dump ADDRESS [SIZE] */
+static grub_err_t
+grub_mini_cmd_dump (struct grub_command *cmd __attribute__ ((unused)),
+		    int argc, char *argv[])
+{
+  grub_uint8_t *addr;
+  grub_size_t size = 4;
+
+  if (argc == 0)
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, "no address specified");
+
+  addr = (grub_uint8_t *) grub_strtoul (argv[0], 0, 0);
+  if (grub_errno)
+    return grub_errno;
+
+  if (argc > 1)
+    size = (grub_size_t) grub_strtoul (argv[1], 0, 0);
+
+  while (size--)
+    {
+      grub_printf ("%x%x ", *addr >> 4, *addr & 0xf);
+      addr++;
+    }
+
+  return 0;
+}
+
+/* rmmod MODULE */
+static grub_err_t
+grub_mini_cmd_rmmod (struct grub_command *cmd __attribute__ ((unused)),
+		     int argc, char *argv[])
+{
+  grub_dl_t mod;
+
+  if (argc == 0)
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, "no module specified");
+
+  mod = grub_dl_get (argv[0]);
+  if (! mod)
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, "no such module");
+
+  if (grub_dl_unref (mod) <= 0)
+    grub_dl_unload (mod);
+
+  return 0;
+}
+
+/* lsmod */
+static grub_err_t
+grub_mini_cmd_lsmod (struct grub_command *cmd __attribute__ ((unused)),
+		     int argc __attribute__ ((unused)),
+		     char *argv[] __attribute__ ((unused)))
+{
+  auto int print_module (grub_dl_t mod);
+
+  int print_module (grub_dl_t mod)
+    {
+      grub_dl_dep_t dep;
+
+      grub_printf ("%s\t%d\t\t", mod->name, mod->ref_count);
+      for (dep = mod->dep; dep; dep = dep->next)
+	{
+	  if (dep != mod->dep)
+	    grub_putchar (',');
+
+	  grub_printf ("%s", dep->mod->name);
+	}
+      grub_putchar ('\n');
+      grub_refresh ();
+
+      return 0;
+    }
+
+  grub_printf ("Name\tRef Count\tDependencies\n");
+  grub_dl_iterate (print_module);
+
+  return 0;
+}
+
+/* exit */
+static grub_err_t
+grub_mini_cmd_exit (struct grub_command *cmd __attribute__ ((unused)),
+		    int argc __attribute__ ((unused)),
+		    char *argv[] __attribute__ ((unused)))
+{
+  grub_exit ();
+  return 0;
+}
+
+static grub_command_t cmd_boot, cmd_cat, cmd_help, cmd_root;
+static grub_command_t cmd_dump, cmd_rmmod, cmd_lsmod, cmd_exit;
+
+GRUB_MOD_INIT(minicmd)
+{
+  (void) mod;			/* To stop warning. */
+
+  cmd_boot =
+    grub_register_command ("boot", grub_mini_cmd_boot,
+			   0, "boot an operating system");
+  cmd_cat =
+    grub_register_command ("cat", grub_mini_cmd_cat,
+			   "cat FILE", "show the contents of a file");
+  cmd_help =
+    grub_register_command ("help", grub_mini_cmd_help,
+			   0, "show this message");
+  cmd_root =
+    grub_register_command ("root", grub_mini_cmd_root,
+			   "root [DEVICE]", "set the root device");
+  cmd_dump =
+    grub_register_command ("dump", grub_mini_cmd_dump,
+			   "dump ADDR", "dump memory");
+  cmd_rmmod =
+    grub_register_command ("rmmod", grub_mini_cmd_rmmod,
+			   "rmmod MODULE", "remove a module");
+  cmd_lsmod =
+    grub_register_command ("lsmod", grub_mini_cmd_lsmod,
+			   0, "show loaded modules");
+  cmd_exit =
+    grub_register_command ("exit", grub_mini_cmd_exit,
+			   0, "exit from GRUB");
+}
+
+GRUB_MOD_FINI(minicmd)
+{
+  grub_unregister_command (cmd_boot);
+  grub_unregister_command (cmd_cat);
+  grub_unregister_command (cmd_help);
+  grub_unregister_command (cmd_root);
+  grub_unregister_command (cmd_dump);
+  grub_unregister_command (cmd_rmmod);
+  grub_unregister_command (cmd_lsmod);
+  grub_unregister_command (cmd_exit);
+}

Modified: trunk/grub2/commands/read.c
===================================================================
--- trunk/grub2/commands/read.c	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/commands/read.c	2009-03-21 08:39:59 UTC (rev 2036)
@@ -20,9 +20,10 @@
 #include <grub/dl.h>
 #include <grub/misc.h>
 #include <grub/mm.h>
-#include <grub/normal.h>
+#include <grub/env.h>
 #include <grub/term.h>
 #include <grub/types.h>
+#include <grub/command.h>
 
 static char *
 grub_getline (void)
@@ -61,7 +62,7 @@
 }
 
 static grub_err_t
-grub_cmd_read (struct grub_arg_list *state UNUSED, int argc, char **args)
+grub_cmd_read (grub_command_t cmd UNUSED, int argc, char **args)
 {
   char *line = grub_getline ();
   if (! line)
@@ -73,14 +74,16 @@
   return 0;
 }
 
+static grub_command_t cmd;
 
 GRUB_MOD_INIT(read)
 {
-  grub_register_command ("read", grub_cmd_read, GRUB_COMMAND_FLAG_CMDLINE,
-			 "read [ENVVAR]", "Set variable with user input", 0);
+  cmd = grub_register_command ("read", grub_cmd_read,
+			       "read [ENVVAR]",
+			       "Set variable with user input");
 }
 
 GRUB_MOD_FINI(read)
 {
-  grub_unregister_command ("read");
+  grub_unregister_command (cmd);
 }

Modified: trunk/grub2/commands/reboot.c
===================================================================
--- trunk/grub2/commands/reboot.c	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/commands/reboot.c	2009-03-21 08:39:59 UTC (rev 2036)
@@ -17,9 +17,9 @@
  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <grub/normal.h>
 #include <grub/dl.h>
 #include <grub/machine/machine.h>
+#include <grub/command.h>
 
 #if defined(GRUB_MACHINE_IEEE1275)
 #include <grub/machine/kernel.h>
@@ -34,7 +34,7 @@
 
 
 static grub_err_t
-grub_cmd_reboot (struct grub_arg_list *state __attribute__ ((unused)),
+grub_cmd_reboot (grub_command_t cmd __attribute__ ((unused)),
 		 int argc __attribute__ ((unused)),
 		 char **args __attribute__ ((unused)))
 {
@@ -42,15 +42,16 @@
   return 0;
 }
 
+static grub_command_t cmd;
 
 GRUB_MOD_INIT(reboot)
 {
   (void)mod;			/* To stop warning. */
-  grub_register_command ("reboot", grub_cmd_reboot, GRUB_COMMAND_FLAG_BOTH,
-			 "reboot", "Reboot the computer", 0);
+  cmd = grub_register_command ("reboot", grub_cmd_reboot,
+			       0, "Reboot the computer");
 }
 
 GRUB_MOD_FINI(reboot)
 {
-  grub_unregister_command ("reboot");
+  grub_unregister_command (cmd);
 }

Modified: trunk/grub2/commands/search.c
===================================================================
--- trunk/grub2/commands/search.c	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/commands/search.c	2009-03-21 08:39:59 UTC (rev 2036)
@@ -22,11 +22,10 @@
 #include <grub/mm.h>
 #include <grub/err.h>
 #include <grub/dl.h>
-#include <grub/normal.h>
-#include <grub/arg.h>
 #include <grub/device.h>
 #include <grub/file.h>
 #include <grub/env.h>
+#include <grub/extcmd.h>
 
 static const struct grub_arg_option options[] =
   {
@@ -121,8 +120,8 @@
 		      count++;
 		      if (var)
 			{
- 			  grub_env_set (var, name);
- 			  abort = 1;
+			  grub_env_set (var, name);
+			  abort = 1;
 			}
 		      else
 			grub_printf (" %s", name);
@@ -196,8 +195,9 @@
 }
 
 static grub_err_t
-grub_cmd_search (struct grub_arg_list *state, int argc, char **args)
+grub_cmd_search (grub_extcmd_t cmd, int argc, char **args)
 {
+  struct grub_arg_list *state = cmd->state;
   const char *var = 0;
   
   if (argc == 0)
@@ -216,19 +216,23 @@
   return grub_errno;
 }
 
+static grub_extcmd_t cmd;
+
 GRUB_MOD_INIT(search)
 {
   (void) mod;			/* To stop warning. */
-  grub_register_command ("search", grub_cmd_search, GRUB_COMMAND_FLAG_BOTH,
-			 "search [-f|-l|-u|-s] NAME",
-			 "Search devices by file, filesystem label or filesystem UUID."
-			 " If --set is specified, the first device found is"
-			 " set to a variable. If no variable name is"
-			 " specified, \"root\" is used.",
-			 options);
+  cmd =
+    grub_register_extcmd ("search", grub_cmd_search,
+			  GRUB_COMMAND_FLAG_BOTH,
+			  "search [-f|-l|-u|-s] NAME",
+			  "Search devices by file, filesystem label or filesystem UUID."
+			  " If --set is specified, the first device found is"
+			  " set to a variable. If no variable name is"
+			  " specified, \"root\" is used.",
+			  options);
 }
 
 GRUB_MOD_FINI(search)
 {
-  grub_unregister_command ("search");
+  grub_unregister_extcmd (cmd);
 }

Modified: trunk/grub2/commands/sleep.c
===================================================================
--- trunk/grub2/commands/sleep.c	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/commands/sleep.c	2009-03-21 08:39:59 UTC (rev 2036)
@@ -22,8 +22,8 @@
 #include <grub/time.h>
 #include <grub/types.h>
 #include <grub/misc.h>
-#include <grub/normal.h>
 #include <grub/machine/time.h>
+#include <grub/extcmd.h>
 
 static const struct grub_arg_option options[] =
   {
@@ -60,8 +60,9 @@
 }
 
 static grub_err_t
-grub_cmd_sleep (struct grub_arg_list *state, int argc, char **args)
+grub_cmd_sleep (grub_extcmd_t cmd, int argc, char **args)
 {
+  struct grub_arg_list *state = cmd->state;
   grub_uint16_t xy;
   int n;
 
@@ -99,14 +100,17 @@
   return 0;
 }
 
+static grub_extcmd_t cmd;
 
 GRUB_MOD_INIT(sleep)
 {
-  grub_register_command ("sleep", grub_cmd_sleep, GRUB_COMMAND_FLAG_BOTH,
-			 "sleep NUMBER_OF_SECONDS", "Wait for a specified number of seconds", options);
+  cmd = grub_register_extcmd ("sleep", grub_cmd_sleep, GRUB_COMMAND_FLAG_BOTH,
+			      "sleep NUMBER_OF_SECONDS",
+			      "Wait for a specified number of seconds",
+			      options);
 }
 
 GRUB_MOD_FINI(sleep)
 {
-  grub_unregister_command ("sleep");
+  grub_unregister_extcmd (cmd);
 }

Modified: trunk/grub2/commands/test.c
===================================================================
--- trunk/grub2/commands/test.c	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/commands/test.c	2009-03-21 08:39:59 UTC (rev 2036)
@@ -17,17 +17,15 @@
  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <grub/normal.h>
 #include <grub/dl.h>
-#include <grub/arg.h>
 #include <grub/misc.h>
 #include <grub/mm.h>
 #include <grub/env.h>
+#include <grub/command.h>
 
 static grub_err_t
-grub_cmd_test (struct grub_arg_list *state __attribute__ ((unused)), int argc,
-	       char **args)
-
+grub_cmd_test (grub_command_t cmd __attribute__ ((unused)),
+	       int argc, char **args)
 {
   char *eq;
   char *eqis;
@@ -52,19 +50,19 @@
   return grub_errno;
 }
 
-
+static grub_command_t cmd_1, cmd_2;
 
 GRUB_MOD_INIT(test)
 {
   (void)mod;			/* To stop warning. */
-  grub_register_command ("[", grub_cmd_test, GRUB_COMMAND_FLAG_CMDLINE,
-			 "[ EXPRESSION ]", "Evaluate an expression", 0);
-  grub_register_command ("test", grub_cmd_test, GRUB_COMMAND_FLAG_CMDLINE,
-			 "test EXPRESSION", "Evaluate an expression", 0);
+  cmd_1 = grub_register_command ("[", grub_cmd_test,
+				 "[ EXPRESSION ]", "Evaluate an expression");
+  cmd_2 = grub_register_command ("test", grub_cmd_test,
+				 "test EXPRESSION", "Evaluate an expression");
 }
 
 GRUB_MOD_FINI(test)
 {
-  grub_unregister_command ("[");
-  grub_unregister_command ("test");
+  grub_unregister_command (cmd_1);
+  grub_unregister_command (cmd_2);
 }

Modified: trunk/grub2/commands/usbtest.c
===================================================================
--- trunk/grub2/commands/usbtest.c	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/commands/usbtest.c	2009-03-21 08:39:59 UTC (rev 2036)
@@ -22,8 +22,8 @@
 #include <grub/mm.h>
 #include <grub/err.h>
 #include <grub/dl.h>
-#include <grub/normal.h>
 #include <grub/usb.h>
+#include <grub/command.h>
 
 static const char *usb_classes[] =
   {
@@ -137,7 +137,7 @@
 }
 
 static grub_err_t
-grub_cmd_usbtest (struct grub_arg_list *state __attribute__ ((unused)),
+grub_cmd_usbtest (grub_command_t cmd __attribute__ ((unused)),
 		  int argc __attribute__ ((unused)),
 		  char **args __attribute__ ((unused)))
 {
@@ -147,14 +147,16 @@
   return 0;
 }
 
+static grub_command_t cmd;
+
 GRUB_MOD_INIT(usbtest)
 {
   (void)mod;			/* To stop warning. */
-  grub_register_command ("usb", grub_cmd_usbtest, GRUB_COMMAND_FLAG_BOTH,
-			 "usb", "Test USB support", 0);
+  cmd = grub_register_command ("usb", grub_cmd_usbtest,
+			       0, "Test USB support");
 }
 
 GRUB_MOD_FINI(usbtest)
 {
-  grub_unregister_command ("usb");
+  grub_unregister_command (cmd);
 }

Modified: trunk/grub2/commands/videotest.c
===================================================================
--- trunk/grub2/commands/videotest.c	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/commands/videotest.c	2009-03-21 08:39:59 UTC (rev 2036)
@@ -20,14 +20,13 @@
 #include <grub/types.h>
 #include <grub/dl.h>
 #include <grub/misc.h>
-#include <grub/normal.h>
-#include <grub/arg.h>
 #include <grub/mm.h>
 #include <grub/font.h>
 #include <grub/term.h>
+#include <grub/command.h>
 
 static grub_err_t
-grub_cmd_videotest (struct grub_arg_list *state __attribute__ ((unused)),
+grub_cmd_videotest (grub_command_t cmd __attribute__ ((unused)),
                     int argc __attribute__ ((unused)),
                     char **args __attribute__ ((unused)))
 {
@@ -175,17 +174,15 @@
   return grub_errno;
 }
 
+static grub_command_t cmd;
+
 GRUB_MOD_INIT(videotest)
 {
-  grub_register_command ("videotest",
-                         grub_cmd_videotest,
-                         GRUB_COMMAND_FLAG_BOTH,
-                         "videotest",
-                         "Test video subsystem",
-                         0);
+  cmd = grub_register_command ("videotest", grub_cmd_videotest,
+			       0, "Test video subsystem");
 }
 
 GRUB_MOD_FINI(videotest)
 {
-  grub_unregister_command ("videotest");
+  grub_unregister_command (cmd);
 }

Modified: trunk/grub2/conf/common.mk
===================================================================
--- trunk/grub2/conf/common.mk	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/conf/common.mk	2009-03-21 08:39:59 UTC (rev 2036)
@@ -212,7 +212,8 @@
 util/grub-fstest.c_DEPENDENCIES = grub_fstest_init.h
 grub_fstest_SOURCES = util/grub-fstest.c util/hostfs.c util/misc.c 	\
 	kern/file.c kern/device.c kern/disk.c kern/err.c kern/misc.c	\
-	disk/host.c disk/loopback.c  normal/arg.c normal/misc.c		\
+	disk/host.c disk/loopback.c kern/list.c kern/command.c		\
+	lib/arg.c commands/extcmd.c normal/misc.c			\
 	lib/hexdump.c lib/crc.c commands/blocklist.c commands/ls.c 	\
 	\
 	fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c			\
@@ -225,11 +226,11 @@
 	disk/raid5_recover.c disk/raid6_recover.c 			\
 	disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c 		\
 	grub_fstest_init.c
-CLEANFILES += grub-fstest$(EXEEXT) grub_fstest-util_grub_fstest.o grub_fstest-util_hostfs.o grub_fstest-util_misc.o grub_fstest-kern_file.o grub_fstest-kern_device.o grub_fstest-kern_disk.o grub_fstest-kern_err.o grub_fstest-kern_misc.o grub_fstest-disk_host.o grub_fstest-disk_loopback.o grub_fstest-normal_arg.o grub_fstest-normal_misc.o grub_fstest-lib_hexdump.o grub_fstest-lib_crc.o grub_fstest-commands_blocklist.o grub_fstest-commands_ls.o grub_fstest-fs_affs.o grub_fstest-fs_cpio.o grub_fstest-fs_fat.o grub_fstest-fs_ext2.o grub_fstest-fs_hfs.o grub_fstest-fs_hfsplus.o grub_fstest-fs_iso9660.o grub_fstest-fs_udf.o grub_fstest-fs_jfs.o grub_fstest-fs_minix.o grub_fstest-fs_ntfs.o grub_fstest-fs_ntfscomp.o grub_fstest-fs_reiserfs.o grub_fstest-fs_sfs.o grub_fstest-fs_ufs.o grub_fstest-f
 s_xfs.o grub_fstest-fs_afs.o grub_fstest-fs_tar.o grub_fstest-kern_partition.o grub_fstest-partmap_pc.o grub_fstest-partmap_apple.o grub_fstest-partmap_gpt.o grub_fstest-kern_fs.o grub_fstest-kern_env.o grub_fstest-fs_fshelp.o grub_fstest-disk_raid.o grub_fstest-disk_raid5_recover.o grub_fstest-disk_raid6_recover.o grub_fstest-disk_mdraid_linux.o grub_fstest-disk_dmraid_nvidia.o grub_fstest-disk_lvm.o grub_fstest-grub_fstest_init.o
-MOSTLYCLEANFILES += grub_fstest-util_grub_fstest.d grub_fstest-util_hostfs.d grub_fstest-util_misc.d grub_fstest-kern_file.d grub_fstest-kern_device.d grub_fstest-kern_disk.d grub_fstest-kern_err.d grub_fstest-kern_misc.d grub_fstest-disk_host.d grub_fstest-disk_loopback.d grub_fstest-normal_arg.d grub_fstest-normal_misc.d grub_fstest-lib_hexdump.d grub_fstest-lib_crc.d grub_fstest-commands_blocklist.d grub_fstest-commands_ls.d grub_fstest-fs_affs.d grub_fstest-fs_cpio.d grub_fstest-fs_fat.d grub_fstest-fs_ext2.d grub_fstest-fs_hfs.d grub_fstest-fs_hfsplus.d grub_fstest-fs_iso9660.d grub_fstest-fs_udf.d grub_fstest-fs_jfs.d grub_fstest-fs_minix.d grub_fstest-fs_ntfs.d grub_fstest-fs_ntfscomp.d grub_fstest-fs_reiserfs.d grub_fstest-fs_sfs.d grub_fstest-fs_ufs.d grub_fstest-fs_xfs.d grub_fs
 test-fs_afs.d grub_fstest-fs_tar.d grub_fstest-kern_partition.d grub_fstest-partmap_pc.d grub_fstest-partmap_apple.d grub_fstest-partmap_gpt.d grub_fstest-kern_fs.d grub_fstest-kern_env.d grub_fstest-fs_fshelp.d grub_fstest-disk_raid.d grub_fstest-disk_raid5_recover.d grub_fstest-disk_raid6_recover.d grub_fstest-disk_mdraid_linux.d grub_fstest-disk_dmraid_nvidia.d grub_fstest-disk_lvm.d grub_fstest-grub_fstest_init.d
+CLEANFILES += grub-fstest$(EXEEXT) grub_fstest-util_grub_fstest.o grub_fstest-util_hostfs.o grub_fstest-util_misc.o grub_fstest-kern_file.o grub_fstest-kern_device.o grub_fstest-kern_disk.o grub_fstest-kern_err.o grub_fstest-kern_misc.o grub_fstest-disk_host.o grub_fstest-disk_loopback.o grub_fstest-kern_list.o grub_fstest-kern_command.o grub_fstest-lib_arg.o grub_fstest-commands_extcmd.o grub_fstest-normal_misc.o grub_fstest-lib_hexdump.o grub_fstest-lib_crc.o grub_fstest-commands_blocklist.o grub_fstest-commands_ls.o grub_fstest-fs_affs.o grub_fstest-fs_cpio.o grub_fstest-fs_fat.o grub_fstest-fs_ext2.o grub_fstest-fs_hfs.o grub_fstest-fs_hfsplus.o grub_fstest-fs_iso9660.o grub_fstest-fs_udf.o grub_fstest-fs_jfs.o grub_fstest-fs_minix.o grub_fstest-fs_ntfs.o grub_fstest-fs_ntfscomp.o gru
 b_fstest-fs_reiserfs.o grub_fstest-fs_sfs.o grub_fstest-fs_ufs.o grub_fstest-fs_xfs.o grub_fstest-fs_afs.o grub_fstest-fs_tar.o grub_fstest-kern_partition.o grub_fstest-partmap_pc.o grub_fstest-partmap_apple.o grub_fstest-partmap_gpt.o grub_fstest-kern_fs.o grub_fstest-kern_env.o grub_fstest-fs_fshelp.o grub_fstest-disk_raid.o grub_fstest-disk_raid5_recover.o grub_fstest-disk_raid6_recover.o grub_fstest-disk_mdraid_linux.o grub_fstest-disk_dmraid_nvidia.o grub_fstest-disk_lvm.o grub_fstest-grub_fstest_init.o
+MOSTLYCLEANFILES += grub_fstest-util_grub_fstest.d grub_fstest-util_hostfs.d grub_fstest-util_misc.d grub_fstest-kern_file.d grub_fstest-kern_device.d grub_fstest-kern_disk.d grub_fstest-kern_err.d grub_fstest-kern_misc.d grub_fstest-disk_host.d grub_fstest-disk_loopback.d grub_fstest-kern_list.d grub_fstest-kern_command.d grub_fstest-lib_arg.d grub_fstest-commands_extcmd.d grub_fstest-normal_misc.d grub_fstest-lib_hexdump.d grub_fstest-lib_crc.d grub_fstest-commands_blocklist.d grub_fstest-commands_ls.d grub_fstest-fs_affs.d grub_fstest-fs_cpio.d grub_fstest-fs_fat.d grub_fstest-fs_ext2.d grub_fstest-fs_hfs.d grub_fstest-fs_hfsplus.d grub_fstest-fs_iso9660.d grub_fstest-fs_udf.d grub_fstest-fs_jfs.d grub_fstest-fs_minix.d grub_fstest-fs_ntfs.d grub_fstest-fs_ntfscomp.d grub_fstest-fs_rei
 serfs.d grub_fstest-fs_sfs.d grub_fstest-fs_ufs.d grub_fstest-fs_xfs.d grub_fstest-fs_afs.d grub_fstest-fs_tar.d grub_fstest-kern_partition.d grub_fstest-partmap_pc.d grub_fstest-partmap_apple.d grub_fstest-partmap_gpt.d grub_fstest-kern_fs.d grub_fstest-kern_env.d grub_fstest-fs_fshelp.d grub_fstest-disk_raid.d grub_fstest-disk_raid5_recover.d grub_fstest-disk_raid6_recover.d grub_fstest-disk_mdraid_linux.d grub_fstest-disk_dmraid_nvidia.d grub_fstest-disk_lvm.d grub_fstest-grub_fstest_init.d
 
-grub-fstest: $(grub_fstest_DEPENDENCIES) grub_fstest-util_grub_fstest.o grub_fstest-util_hostfs.o grub_fstest-util_misc.o grub_fstest-kern_file.o grub_fstest-kern_device.o grub_fstest-kern_disk.o grub_fstest-kern_err.o grub_fstest-kern_misc.o grub_fstest-disk_host.o grub_fstest-disk_loopback.o grub_fstest-normal_arg.o grub_fstest-normal_misc.o grub_fstest-lib_hexdump.o grub_fstest-lib_crc.o grub_fstest-commands_blocklist.o grub_fstest-commands_ls.o grub_fstest-fs_affs.o grub_fstest-fs_cpio.o grub_fstest-fs_fat.o grub_fstest-fs_ext2.o grub_fstest-fs_hfs.o grub_fstest-fs_hfsplus.o grub_fstest-fs_iso9660.o grub_fstest-fs_udf.o grub_fstest-fs_jfs.o grub_fstest-fs_minix.o grub_fstest-fs_ntfs.o grub_fstest-fs_ntfscomp.o grub_fstest-fs_reiserfs.o grub_fstest-fs_sfs.o grub_fstest-fs_ufs.o grub_fs
 test-fs_xfs.o grub_fstest-fs_afs.o grub_fstest-fs_tar.o grub_fstest-kern_partition.o grub_fstest-partmap_pc.o grub_fstest-partmap_apple.o grub_fstest-partmap_gpt.o grub_fstest-kern_fs.o grub_fstest-kern_env.o grub_fstest-fs_fshelp.o grub_fstest-disk_raid.o grub_fstest-disk_raid5_recover.o grub_fstest-disk_raid6_recover.o grub_fstest-disk_mdraid_linux.o grub_fstest-disk_dmraid_nvidia.o grub_fstest-disk_lvm.o grub_fstest-grub_fstest_init.o
-	$(CC) -o $@ grub_fstest-util_grub_fstest.o grub_fstest-util_hostfs.o grub_fstest-util_misc.o grub_fstest-kern_file.o grub_fstest-kern_device.o grub_fstest-kern_disk.o grub_fstest-kern_err.o grub_fstest-kern_misc.o grub_fstest-disk_host.o grub_fstest-disk_loopback.o grub_fstest-normal_arg.o grub_fstest-normal_misc.o grub_fstest-lib_hexdump.o grub_fstest-lib_crc.o grub_fstest-commands_blocklist.o grub_fstest-commands_ls.o grub_fstest-fs_affs.o grub_fstest-fs_cpio.o grub_fstest-fs_fat.o grub_fstest-fs_ext2.o grub_fstest-fs_hfs.o grub_fstest-fs_hfsplus.o grub_fstest-fs_iso9660.o grub_fstest-fs_udf.o grub_fstest-fs_jfs.o grub_fstest-fs_minix.o grub_fstest-fs_ntfs.o grub_fstest-fs_ntfscomp.o grub_fstest-fs_reiserfs.o grub_fstest-fs_sfs.o grub_fstest-fs_ufs.o grub_fstest-fs_xfs.o grub_fstest-fs
 _afs.o grub_fstest-fs_tar.o grub_fstest-kern_partition.o grub_fstest-partmap_pc.o grub_fstest-partmap_apple.o grub_fstest-partmap_gpt.o grub_fstest-kern_fs.o grub_fstest-kern_env.o grub_fstest-fs_fshelp.o grub_fstest-disk_raid.o grub_fstest-disk_raid5_recover.o grub_fstest-disk_raid6_recover.o grub_fstest-disk_mdraid_linux.o grub_fstest-disk_dmraid_nvidia.o grub_fstest-disk_lvm.o grub_fstest-grub_fstest_init.o $(LDFLAGS) $(grub_fstest_LDFLAGS)
+grub-fstest: $(grub_fstest_DEPENDENCIES) grub_fstest-util_grub_fstest.o grub_fstest-util_hostfs.o grub_fstest-util_misc.o grub_fstest-kern_file.o grub_fstest-kern_device.o grub_fstest-kern_disk.o grub_fstest-kern_err.o grub_fstest-kern_misc.o grub_fstest-disk_host.o grub_fstest-disk_loopback.o grub_fstest-kern_list.o grub_fstest-kern_command.o grub_fstest-lib_arg.o grub_fstest-commands_extcmd.o grub_fstest-normal_misc.o grub_fstest-lib_hexdump.o grub_fstest-lib_crc.o grub_fstest-commands_blocklist.o grub_fstest-commands_ls.o grub_fstest-fs_affs.o grub_fstest-fs_cpio.o grub_fstest-fs_fat.o grub_fstest-fs_ext2.o grub_fstest-fs_hfs.o grub_fstest-fs_hfsplus.o grub_fstest-fs_iso9660.o grub_fstest-fs_udf.o grub_fstest-fs_jfs.o grub_fstest-fs_minix.o grub_fstest-fs_ntfs.o grub_fstest-fs_ntfscomp
 .o grub_fstest-fs_reiserfs.o grub_fstest-fs_sfs.o grub_fstest-fs_ufs.o grub_fstest-fs_xfs.o grub_fstest-fs_afs.o grub_fstest-fs_tar.o grub_fstest-kern_partition.o grub_fstest-partmap_pc.o grub_fstest-partmap_apple.o grub_fstest-partmap_gpt.o grub_fstest-kern_fs.o grub_fstest-kern_env.o grub_fstest-fs_fshelp.o grub_fstest-disk_raid.o grub_fstest-disk_raid5_recover.o grub_fstest-disk_raid6_recover.o grub_fstest-disk_mdraid_linux.o grub_fstest-disk_dmraid_nvidia.o grub_fstest-disk_lvm.o grub_fstest-grub_fstest_init.o
+	$(CC) -o $@ grub_fstest-util_grub_fstest.o grub_fstest-util_hostfs.o grub_fstest-util_misc.o grub_fstest-kern_file.o grub_fstest-kern_device.o grub_fstest-kern_disk.o grub_fstest-kern_err.o grub_fstest-kern_misc.o grub_fstest-disk_host.o grub_fstest-disk_loopback.o grub_fstest-kern_list.o grub_fstest-kern_command.o grub_fstest-lib_arg.o grub_fstest-commands_extcmd.o grub_fstest-normal_misc.o grub_fstest-lib_hexdump.o grub_fstest-lib_crc.o grub_fstest-commands_blocklist.o grub_fstest-commands_ls.o grub_fstest-fs_affs.o grub_fstest-fs_cpio.o grub_fstest-fs_fat.o grub_fstest-fs_ext2.o grub_fstest-fs_hfs.o grub_fstest-fs_hfsplus.o grub_fstest-fs_iso9660.o grub_fstest-fs_udf.o grub_fstest-fs_jfs.o grub_fstest-fs_minix.o grub_fstest-fs_ntfs.o grub_fstest-fs_ntfscomp.o grub_fstest-fs_reiserfs.o
  grub_fstest-fs_sfs.o grub_fstest-fs_ufs.o grub_fstest-fs_xfs.o grub_fstest-fs_afs.o grub_fstest-fs_tar.o grub_fstest-kern_partition.o grub_fstest-partmap_pc.o grub_fstest-partmap_apple.o grub_fstest-partmap_gpt.o grub_fstest-kern_fs.o grub_fstest-kern_env.o grub_fstest-fs_fshelp.o grub_fstest-disk_raid.o grub_fstest-disk_raid5_recover.o grub_fstest-disk_raid6_recover.o grub_fstest-disk_mdraid_linux.o grub_fstest-disk_dmraid_nvidia.o grub_fstest-disk_lvm.o grub_fstest-grub_fstest_init.o $(LDFLAGS) $(grub_fstest_LDFLAGS)
 
 grub_fstest-util_grub_fstest.o: util/grub-fstest.c $(util/grub-fstest.c_DEPENDENCIES)
 	$(CC) -Iutil -I$(srcdir)/util $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(grub_fstest_CFLAGS) -MD -c -o $@ $<
@@ -271,10 +272,22 @@
 	$(CC) -Idisk -I$(srcdir)/disk $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(grub_fstest_CFLAGS) -MD -c -o $@ $<
 -include grub_fstest-disk_loopback.d
 
-grub_fstest-normal_arg.o: normal/arg.c $(normal/arg.c_DEPENDENCIES)
-	$(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(grub_fstest_CFLAGS) -MD -c -o $@ $<
--include grub_fstest-normal_arg.d
+grub_fstest-kern_list.o: kern/list.c $(kern/list.c_DEPENDENCIES)
+	$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(grub_fstest_CFLAGS) -MD -c -o $@ $<
+-include grub_fstest-kern_list.d
 
+grub_fstest-kern_command.o: kern/command.c $(kern/command.c_DEPENDENCIES)
+	$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(grub_fstest_CFLAGS) -MD -c -o $@ $<
+-include grub_fstest-kern_command.d
+
+grub_fstest-lib_arg.o: lib/arg.c $(lib/arg.c_DEPENDENCIES)
+	$(CC) -Ilib -I$(srcdir)/lib $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(grub_fstest_CFLAGS) -MD -c -o $@ $<
+-include grub_fstest-lib_arg.d
+
+grub_fstest-commands_extcmd.o: commands/extcmd.c $(commands/extcmd.c_DEPENDENCIES)
+	$(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(grub_fstest_CFLAGS) -MD -c -o $@ $<
+-include grub_fstest-commands_extcmd.d
+
 grub_fstest-normal_misc.o: normal/misc.c $(normal/misc.c_DEPENDENCIES)
 	$(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(grub_fstest_CFLAGS) -MD -c -o $@ $<
 -include grub_fstest-normal_misc.d
@@ -2427,12 +2440,145 @@
 scsi_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
 # Commands.
-pkglib_MODULES += hello.mod boot.mod handler.mod ls.mod	\
-	cmp.mod cat.mod help.mod search.mod					\
+pkglib_MODULES += minicmd.mod extcmd.mod hello.mod handler.mod	\
+	 ls.mod	cmp.mod cat.mod help.mod search.mod		\
 	loopback.mod fs_uuid.mod configfile.mod echo.mod	\
 	terminfo.mod test.mod blocklist.mod hexdump.mod		\
 	read.mod sleep.mod loadenv.mod crc.mod
 
+# For minicmd.mod.
+minicmd_mod_SOURCES = commands/minicmd.c
+CLEANFILES += minicmd.mod mod-minicmd.o mod-minicmd.c pre-minicmd.o minicmd_mod-commands_minicmd.o und-minicmd.lst
+ifneq ($(minicmd_mod_EXPORTS),no)
+CLEANFILES += def-minicmd.lst
+DEFSYMFILES += def-minicmd.lst
+endif
+MOSTLYCLEANFILES += minicmd_mod-commands_minicmd.d
+UNDSYMFILES += und-minicmd.lst
+
+minicmd.mod: pre-minicmd.o mod-minicmd.o $(TARGET_OBJ2ELF)
+	-rm -f $@
+	$(TARGET_CC) $(minicmd_mod_LDFLAGS) $(TARGET_LDFLAGS) $(MODULE_LDFLAGS) -Wl,-r,-d -o $@ pre-minicmd.o mod-minicmd.o
+	if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
+	$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@
+
+pre-minicmd.o: $(minicmd_mod_DEPENDENCIES) minicmd_mod-commands_minicmd.o
+	-rm -f $@
+	$(TARGET_CC) $(minicmd_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ minicmd_mod-commands_minicmd.o
+
+mod-minicmd.o: mod-minicmd.c
+	$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(minicmd_mod_CFLAGS) -c -o $@ $<
+
+mod-minicmd.c: $(builddir)/moddep.lst $(srcdir)/genmodsrc.sh
+	sh $(srcdir)/genmodsrc.sh 'minicmd' $< > $@ || (rm -f $@; exit 1)
+
+ifneq ($(minicmd_mod_EXPORTS),no)
+def-minicmd.lst: pre-minicmd.o
+	$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 minicmd/' > $@
+endif
+
+und-minicmd.lst: pre-minicmd.o
+	echo 'minicmd' > $@
+	$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+minicmd_mod-commands_minicmd.o: commands/minicmd.c $(commands/minicmd.c_DEPENDENCIES)
+	$(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS)  $(TARGET_CFLAGS) $(minicmd_mod_CFLAGS) -MD -c -o $@ $<
+-include minicmd_mod-commands_minicmd.d
+
+CLEANFILES += cmd-minicmd_mod-commands_minicmd.lst fs-minicmd_mod-commands_minicmd.lst partmap-minicmd_mod-commands_minicmd.lst
+COMMANDFILES += cmd-minicmd_mod-commands_minicmd.lst
+FSFILES += fs-minicmd_mod-commands_minicmd.lst
+PARTMAPFILES += partmap-minicmd_mod-commands_minicmd.lst
+
+cmd-minicmd_mod-commands_minicmd.lst: commands/minicmd.c $(commands/minicmd.c_DEPENDENCIES) gencmdlist.sh
+	set -e; 	  $(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(minicmd_mod_CFLAGS) -E $< 	  | sh $(srcdir)/gencmdlist.sh minicmd > $@ || (rm -f $@; exit 1)
+
+fs-minicmd_mod-commands_minicmd.lst: commands/minicmd.c $(commands/minicmd.c_DEPENDENCIES) genfslist.sh
+	set -e; 	  $(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(minicmd_mod_CFLAGS) -E $< 	  | sh $(srcdir)/genfslist.sh minicmd > $@ || (rm -f $@; exit 1)
+
+partmap-minicmd_mod-commands_minicmd.lst: commands/minicmd.c $(commands/minicmd.c_DEPENDENCIES) genpartmaplist.sh
+	set -e; 	  $(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(minicmd_mod_CFLAGS) -E $< 	  | sh $(srcdir)/genpartmaplist.sh minicmd > $@ || (rm -f $@; exit 1)
+
+
+minicmd_mod_CFLAGS = $(COMMON_CFLAGS)
+minicmd_mod_LDFLAGS = $(COMMON_LDFLAGS)
+
+# For extcmd.mod.
+extcmd_mod_SOURCES = commands/extcmd.c lib/arg.c
+CLEANFILES += extcmd.mod mod-extcmd.o mod-extcmd.c pre-extcmd.o extcmd_mod-commands_extcmd.o extcmd_mod-lib_arg.o und-extcmd.lst
+ifneq ($(extcmd_mod_EXPORTS),no)
+CLEANFILES += def-extcmd.lst
+DEFSYMFILES += def-extcmd.lst
+endif
+MOSTLYCLEANFILES += extcmd_mod-commands_extcmd.d extcmd_mod-lib_arg.d
+UNDSYMFILES += und-extcmd.lst
+
+extcmd.mod: pre-extcmd.o mod-extcmd.o $(TARGET_OBJ2ELF)
+	-rm -f $@
+	$(TARGET_CC) $(extcmd_mod_LDFLAGS) $(TARGET_LDFLAGS) $(MODULE_LDFLAGS) -Wl,-r,-d -o $@ pre-extcmd.o mod-extcmd.o
+	if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
+	$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@
+
+pre-extcmd.o: $(extcmd_mod_DEPENDENCIES) extcmd_mod-commands_extcmd.o extcmd_mod-lib_arg.o
+	-rm -f $@
+	$(TARGET_CC) $(extcmd_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ extcmd_mod-commands_extcmd.o extcmd_mod-lib_arg.o
+
+mod-extcmd.o: mod-extcmd.c
+	$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(extcmd_mod_CFLAGS) -c -o $@ $<
+
+mod-extcmd.c: $(builddir)/moddep.lst $(srcdir)/genmodsrc.sh
+	sh $(srcdir)/genmodsrc.sh 'extcmd' $< > $@ || (rm -f $@; exit 1)
+
+ifneq ($(extcmd_mod_EXPORTS),no)
+def-extcmd.lst: pre-extcmd.o
+	$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 extcmd/' > $@
+endif
+
+und-extcmd.lst: pre-extcmd.o
+	echo 'extcmd' > $@
+	$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+extcmd_mod-commands_extcmd.o: commands/extcmd.c $(commands/extcmd.c_DEPENDENCIES)
+	$(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS)  $(TARGET_CFLAGS) $(extcmd_mod_CFLAGS) -MD -c -o $@ $<
+-include extcmd_mod-commands_extcmd.d
+
+CLEANFILES += cmd-extcmd_mod-commands_extcmd.lst fs-extcmd_mod-commands_extcmd.lst partmap-extcmd_mod-commands_extcmd.lst
+COMMANDFILES += cmd-extcmd_mod-commands_extcmd.lst
+FSFILES += fs-extcmd_mod-commands_extcmd.lst
+PARTMAPFILES += partmap-extcmd_mod-commands_extcmd.lst
+
+cmd-extcmd_mod-commands_extcmd.lst: commands/extcmd.c $(commands/extcmd.c_DEPENDENCIES) gencmdlist.sh
+	set -e; 	  $(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(extcmd_mod_CFLAGS) -E $< 	  | sh $(srcdir)/gencmdlist.sh extcmd > $@ || (rm -f $@; exit 1)
+
+fs-extcmd_mod-commands_extcmd.lst: commands/extcmd.c $(commands/extcmd.c_DEPENDENCIES) genfslist.sh
+	set -e; 	  $(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(extcmd_mod_CFLAGS) -E $< 	  | sh $(srcdir)/genfslist.sh extcmd > $@ || (rm -f $@; exit 1)
+
+partmap-extcmd_mod-commands_extcmd.lst: commands/extcmd.c $(commands/extcmd.c_DEPENDENCIES) genpartmaplist.sh
+	set -e; 	  $(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(extcmd_mod_CFLAGS) -E $< 	  | sh $(srcdir)/genpartmaplist.sh extcmd > $@ || (rm -f $@; exit 1)
+
+
+extcmd_mod-lib_arg.o: lib/arg.c $(lib/arg.c_DEPENDENCIES)
+	$(TARGET_CC) -Ilib -I$(srcdir)/lib $(TARGET_CPPFLAGS)  $(TARGET_CFLAGS) $(extcmd_mod_CFLAGS) -MD -c -o $@ $<
+-include extcmd_mod-lib_arg.d
+
+CLEANFILES += cmd-extcmd_mod-lib_arg.lst fs-extcmd_mod-lib_arg.lst partmap-extcmd_mod-lib_arg.lst
+COMMANDFILES += cmd-extcmd_mod-lib_arg.lst
+FSFILES += fs-extcmd_mod-lib_arg.lst
+PARTMAPFILES += partmap-extcmd_mod-lib_arg.lst
+
+cmd-extcmd_mod-lib_arg.lst: lib/arg.c $(lib/arg.c_DEPENDENCIES) gencmdlist.sh
+	set -e; 	  $(TARGET_CC) -Ilib -I$(srcdir)/lib $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(extcmd_mod_CFLAGS) -E $< 	  | sh $(srcdir)/gencmdlist.sh extcmd > $@ || (rm -f $@; exit 1)
+
+fs-extcmd_mod-lib_arg.lst: lib/arg.c $(lib/arg.c_DEPENDENCIES) genfslist.sh
+	set -e; 	  $(TARGET_CC) -Ilib -I$(srcdir)/lib $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(extcmd_mod_CFLAGS) -E $< 	  | sh $(srcdir)/genfslist.sh extcmd > $@ || (rm -f $@; exit 1)
+
+partmap-extcmd_mod-lib_arg.lst: lib/arg.c $(lib/arg.c_DEPENDENCIES) genpartmaplist.sh
+	set -e; 	  $(TARGET_CC) -Ilib -I$(srcdir)/lib $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(extcmd_mod_CFLAGS) -E $< 	  | sh $(srcdir)/genpartmaplist.sh extcmd > $@ || (rm -f $@; exit 1)
+
+
+extcmd_mod_CFLAGS = $(COMMON_CFLAGS)
+extcmd_mod_LDFLAGS = $(COMMON_LDFLAGS)
+
 # For hello.mod.
 hello_mod_SOURCES = hello/hello.c
 CLEANFILES += hello.mod mod-hello.o mod-hello.c pre-hello.o hello_mod-hello_hello.o und-hello.lst
@@ -2490,63 +2636,6 @@
 hello_mod_CFLAGS = $(COMMON_CFLAGS)
 hello_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
-# For boot.mod.
-boot_mod_SOURCES = commands/boot.c
-CLEANFILES += boot.mod mod-boot.o mod-boot.c pre-boot.o boot_mod-commands_boot.o und-boot.lst
-ifneq ($(boot_mod_EXPORTS),no)
-CLEANFILES += def-boot.lst
-DEFSYMFILES += def-boot.lst
-endif
-MOSTLYCLEANFILES += boot_mod-commands_boot.d
-UNDSYMFILES += und-boot.lst
-
-boot.mod: pre-boot.o mod-boot.o $(TARGET_OBJ2ELF)
-	-rm -f $@
-	$(TARGET_CC) $(boot_mod_LDFLAGS) $(TARGET_LDFLAGS) $(MODULE_LDFLAGS) -Wl,-r,-d -o $@ pre-boot.o mod-boot.o
-	if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
-	$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@
-
-pre-boot.o: $(boot_mod_DEPENDENCIES) boot_mod-commands_boot.o
-	-rm -f $@
-	$(TARGET_CC) $(boot_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ boot_mod-commands_boot.o
-
-mod-boot.o: mod-boot.c
-	$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(boot_mod_CFLAGS) -c -o $@ $<
-
-mod-boot.c: $(builddir)/moddep.lst $(srcdir)/genmodsrc.sh
-	sh $(srcdir)/genmodsrc.sh 'boot' $< > $@ || (rm -f $@; exit 1)
-
-ifneq ($(boot_mod_EXPORTS),no)
-def-boot.lst: pre-boot.o
-	$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 boot/' > $@
-endif
-
-und-boot.lst: pre-boot.o
-	echo 'boot' > $@
-	$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
-
-boot_mod-commands_boot.o: commands/boot.c $(commands/boot.c_DEPENDENCIES)
-	$(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS)  $(TARGET_CFLAGS) $(boot_mod_CFLAGS) -MD -c -o $@ $<
--include boot_mod-commands_boot.d
-
-CLEANFILES += cmd-boot_mod-commands_boot.lst fs-boot_mod-commands_boot.lst partmap-boot_mod-commands_boot.lst
-COMMANDFILES += cmd-boot_mod-commands_boot.lst
-FSFILES += fs-boot_mod-commands_boot.lst
-PARTMAPFILES += partmap-boot_mod-commands_boot.lst
-
-cmd-boot_mod-commands_boot.lst: commands/boot.c $(commands/boot.c_DEPENDENCIES) gencmdlist.sh
-	set -e; 	  $(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(boot_mod_CFLAGS) -E $< 	  | sh $(srcdir)/gencmdlist.sh boot > $@ || (rm -f $@; exit 1)
-
-fs-boot_mod-commands_boot.lst: commands/boot.c $(commands/boot.c_DEPENDENCIES) genfslist.sh
-	set -e; 	  $(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(boot_mod_CFLAGS) -E $< 	  | sh $(srcdir)/genfslist.sh boot > $@ || (rm -f $@; exit 1)
-
-partmap-boot_mod-commands_boot.lst: commands/boot.c $(commands/boot.c_DEPENDENCIES) genpartmaplist.sh
-	set -e; 	  $(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(boot_mod_CFLAGS) -E $< 	  | sh $(srcdir)/genpartmaplist.sh boot > $@ || (rm -f $@; exit 1)
-
-
-boot_mod_CFLAGS = $(COMMON_CFLAGS)
-boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
-
 # For handler.mod.
 handler_mod_SOURCES = commands/handler.c
 CLEANFILES += handler.mod mod-handler.o mod-handler.c pre-handler.o handler_mod-commands_handler.o und-handler.lst

Modified: trunk/grub2/conf/common.rmk
===================================================================
--- trunk/grub2/conf/common.rmk	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/conf/common.rmk	2009-03-21 08:39:59 UTC (rev 2036)
@@ -31,7 +31,8 @@
 util/grub-fstest.c_DEPENDENCIES = grub_fstest_init.h
 grub_fstest_SOURCES = util/grub-fstest.c util/hostfs.c util/misc.c 	\
 	kern/file.c kern/device.c kern/disk.c kern/err.c kern/misc.c	\
-	disk/host.c disk/loopback.c  normal/arg.c normal/misc.c		\
+	disk/host.c disk/loopback.c kern/list.c kern/command.c		\
+	lib/arg.c commands/extcmd.c normal/misc.c			\
 	lib/hexdump.c lib/crc.c commands/blocklist.c commands/ls.c 	\
 	\
 	fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c			\
@@ -330,22 +331,27 @@
 scsi_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
 # Commands.
-pkglib_MODULES += hello.mod boot.mod handler.mod ls.mod	\
-	cmp.mod cat.mod help.mod search.mod					\
+pkglib_MODULES += minicmd.mod extcmd.mod hello.mod handler.mod	\
+	 ls.mod	cmp.mod cat.mod help.mod search.mod		\
 	loopback.mod fs_uuid.mod configfile.mod echo.mod	\
 	terminfo.mod test.mod blocklist.mod hexdump.mod		\
 	read.mod sleep.mod loadenv.mod crc.mod
 
+# For minicmd.mod.
+minicmd_mod_SOURCES = commands/minicmd.c
+minicmd_mod_CFLAGS = $(COMMON_CFLAGS)
+minicmd_mod_LDFLAGS = $(COMMON_LDFLAGS)
+
+# For extcmd.mod.
+extcmd_mod_SOURCES = commands/extcmd.c lib/arg.c
+extcmd_mod_CFLAGS = $(COMMON_CFLAGS)
+extcmd_mod_LDFLAGS = $(COMMON_LDFLAGS)
+
 # For hello.mod.
 hello_mod_SOURCES = hello/hello.c
 hello_mod_CFLAGS = $(COMMON_CFLAGS)
 hello_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
-# For boot.mod.
-boot_mod_SOURCES = commands/boot.c
-boot_mod_CFLAGS = $(COMMON_CFLAGS)
-boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
-
 # For handler.mod.
 handler_mod_SOURCES = commands/handler.c
 handler_mod_CFLAGS = $(COMMON_CFLAGS)

Modified: trunk/grub2/conf/i386-coreboot.mk
===================================================================
--- trunk/grub2/conf/i386-coreboot.mk	2009-03-21 07:48:28 UTC (rev 2035)
+++ trunk/grub2/conf/i386-coreboot.mk	2009-03-21 08:39:59 UTC (rev 2036)
@@ -18,7 +18,7 @@
 	kern/main.c kern/device.c \
 	kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
 	kern/misc.c kern/mm.c kern/loader.c kern/rescue.c kern/term.c \
-	kern/time.c kern/list.c kern/handler.c \
+	kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
 	kern/i386/dl.c kern/parser.c kern/partition.c \
 	kern/i386/tsc.c kern/i386/pit.c \
 	kern/generic/rtc_get_time_ms.c \
@@ -27,11 +27,11 @@
 	term/i386/pc/vga_text.c term/i386/vga_common.c \
 	term/i386/pc/at_keyboard.c \
 	symlist.c
-CLEANFILES += kernel.elf kernel_elf-kern_i386_coreboot_startup.o kernel_elf-kern_i386_coreboot_init.o kernel_elf-kern_i386_multiboot_mmap.o kernel_elf-kern_main.o kernel_elf-kern_device.o kernel_elf-kern_disk.o kernel_elf-kern_dl.o kernel_elf-kern_file.o kernel_elf-kern_fs.o kernel_elf-kern_err.o kernel_elf-kern_misc.o kernel_elf-kern_mm.o kernel_elf-kern_loader.o kernel_elf-kern_rescue.o kernel_elf-kern_term.o kernel_elf-kern_time.o kernel_elf-kern_list.o kernel_elf-kern_handler.o kernel_elf-kern_i386_dl.o kernel_elf-kern_parser.o kernel_elf-kern_partition.o kernel_elf-kern_i386_tsc.o kernel_elf-kern_i386_pit.o kernel_elf-kern_generic_rtc_get_time_ms.o kernel_elf-kern_generic_millisleep.o kernel_elf-kern_env.o kernel_elf-term_i386_pc_vga_text.o kernel_elf-term_i386_vga_common.o kernel_el
 f-term_i386_pc_at_keyboard.o kernel_elf-symlist.o
-MOSTLYCLEANFILES += kernel_elf-kern_i386_coreboot_startup.d kernel_elf-kern_i386_coreboot_init.d kernel_elf-kern_i386_multiboot_mmap.d kernel_elf-kern_main.d kernel_elf-kern_device.d kernel_elf-kern_disk.d kernel_elf-kern_dl.d kernel_elf-kern_file.d kernel_elf-kern_fs.d kernel_elf-kern_err.d kernel_elf-kern_misc.d kernel_elf-kern_mm.d kernel_elf-kern_loader.d kernel_elf-kern_rescue.d kernel_elf-kern_term.d kernel_elf-kern_time.d kernel_elf-kern_list.d kernel_elf-kern_handler.d kernel_elf-kern_i386_dl.d kernel_elf-kern_parser.d kernel_elf-kern_partition.d kernel_elf-kern_i386_tsc.d kernel_elf-kern_i386_pit.d kernel_elf-kern_generic_rtc_get_time_ms.d kernel_elf-kern_generic_millisleep.d kernel_elf-kern_env.d kernel_elf-term_i386_pc_vga_text.d kernel_elf-term_i386_vga_common.d kernel_elf-ter
 m_i386_pc_at_keyboard.d kernel_elf-symlist.d
+CLEANFILES += kernel.elf kernel_elf-kern_i386_coreboot_startup.o kernel_elf-kern_i386_coreboot_init.o kernel_elf-kern_i386_multiboot_mmap.o kernel_elf-kern_main.o kernel_elf-kern_device.o kernel_elf-kern_disk.o kernel_elf-kern_dl.o kernel_elf-kern_file.o kernel_elf-kern_fs.o kernel_elf-kern_err.o kernel_elf-kern_misc.o kernel_elf-kern_mm.o kernel_elf-kern_loader.o kernel_elf-kern_rescue.o kernel_elf-kern_term.o kernel_elf-kern_time.o kernel_elf-kern_list.o kernel_elf-kern_handler.o kernel_elf-kern_command.o kernel_elf-kern_corecmd.o kernel_elf-kern_i386_dl.o kernel_elf-kern_parser.o kernel_elf-kern_partition.o kernel_elf-kern_i386_tsc.o kernel_elf-kern_i386_pit.o kernel_elf-kern_generic_rtc_get_time_ms.o kernel_elf-kern_generic_millisleep.o kernel_elf-kern_env.o kernel_elf-term_i386_pc_vg
 a_text.o kernel_elf-term_i386_vga_common.o kernel_elf-term_i386_pc_at_keyboard.o kernel_elf-symlist.o
+MOSTLYCLEANFILES += kernel_elf-kern_i386_coreboot_startup.d kernel_elf-kern_i386_coreboot_init.d kernel_elf-kern_i386_multiboot_mmap.d kernel_elf-kern_main.d kernel_elf-kern_device.d kernel_elf-kern_disk.d kernel_elf-kern_dl.d kernel_elf-kern_file.d kernel_elf-kern_fs.d kernel_elf-kern_err.d kernel_elf-kern_misc.d kernel_elf-kern_mm.d kernel_elf-kern_loader.d kernel_elf-kern_rescue.d kernel_elf-kern_term.d kernel_elf-kern_time.d kernel_elf-kern_list.d kernel_elf-kern_handler.d kernel_elf-kern_command.d kernel_elf-kern_corecmd.d kernel_elf-kern_i386_dl.d kernel_elf-kern_parser.d kernel_elf-kern_partition.d kernel_elf-kern_i386_tsc.d kernel_elf-kern_i386_pit.d kernel_elf-kern_generic_rtc_get_time_ms.d kernel_elf-kern_generic_millisleep.d kernel_elf-kern_env.d kernel_elf-term_i386_pc_vga_tex
 t.d kernel_elf-term_i386_vga_common.d kernel_elf-term_i386_pc_at_keyboard.d kernel_elf-symlist.d
 
-kernel.elf: $(kernel_elf_DEPENDENCIES) kernel_elf-kern_i386_coreboot_startup.o kernel_elf-kern_i386_coreboot_init.o kernel_elf-kern_i386_multiboot_mmap.o kernel_elf-kern_main.o kernel_elf-kern_device.o kernel_elf-kern_disk.o kernel_elf-kern_dl.o kernel_elf-kern_file.o kernel_elf-kern_fs.o kernel_elf-kern_err.o kernel_elf-kern_misc.o kernel_elf-kern_mm.o kernel_elf-kern_loader.o kernel_elf-kern_rescue.o kernel_elf-kern_term.o kernel_elf-kern_time.o kernel_elf-kern_list.o kernel_elf-kern_handler.o kernel_elf-kern_i386_dl.o kernel_elf-kern_parser.o kernel_elf-kern_partition.o kernel_elf-kern_i386_tsc.o kernel_elf-kern_i386_pit.o kernel_elf-kern_generic_rtc_get_time_ms.o kernel_elf-kern_generic_millisleep.o kernel_elf-kern_env.o kernel_elf-term_i386_pc_vga_text.o kernel_elf-term_i386_vga_comm
 on.o kernel_elf-term_i386_pc_at_keyboard.o kernel_elf-symlist.o
-	$(TARGET_CC) -o $@ kernel_elf-kern_i386_coreboot_startup.o kernel_elf-kern_i386_coreboot_init.o kernel_elf-kern_i386_multiboot_mmap.o kernel_elf-kern_main.o kernel_elf-kern_device.o kernel_elf-kern_disk.o kernel_elf-kern_dl.o kernel_elf-kern_file.o kernel_elf-kern_fs.o kernel_elf-kern_err.o kernel_elf-kern_misc.o kernel_elf-kern_mm.o kernel_elf-kern_loader.o kernel_elf-kern_rescue.o kernel_elf-kern_term.o kernel_elf-kern_time.o kernel_elf-kern_list.o kernel_elf-kern_handler.o kernel_elf-kern_i386_dl.o kernel_elf-kern_parser.o kernel_elf-kern_partition.o kernel_elf-kern_i386_tsc.o kernel_elf-kern_i386_pit.o kernel_elf-kern_generic_rtc_get_time_ms.o kernel_elf-kern_generic_millisleep.o kernel_elf-kern_env.o kernel_elf-term_i386_pc_vga_text.o kernel_elf-term_i386_vga_common.o kernel_elf-ter
 m_i386_pc_at_keyboard.o kernel_elf-symlist.o $(TARGET_LDFLAGS) $(kernel_elf_LDFLAGS)
+kernel.elf: $(kernel_elf_DEPENDENCIES) kernel_elf-kern_i386_coreboot_startup.o kernel_elf-kern_i386_coreboot_init.o kernel_elf-kern_i386_multiboot_mmap.o kernel_elf-kern_main.o kernel_elf-kern_device.o kernel_elf-kern_disk.o kernel_elf-kern_dl.o kernel_elf-kern_file.o kernel_elf-kern_fs.o kernel_elf-kern_err.o kernel_elf-kern_misc.o kernel_elf-kern_mm.o kernel_elf-kern_loader.o kernel_elf-kern_rescue.o kernel_elf-kern_term.o kernel_elf-kern_time.o kernel_elf-kern_list.o kernel_elf-kern_handler.o kernel_elf-kern_command.o kernel_elf-kern_corecmd.o kernel_elf-kern_i386_dl.o kernel_elf-kern_parser.o kernel_elf-kern_partition.o kernel_elf-kern_i386_tsc.o kernel_elf-kern_i386_pit.o kernel_elf-kern_generic_rtc_get_time_ms.o kernel_elf-kern_generic_millisleep.o kernel_elf-kern_env.o kernel_elf-t
 erm_i386_pc_vga_text.o kernel_elf-term_i386_vga_common.o kernel_elf-term_i386_pc_at_keyboard.o kernel_elf-symlist.o
+	$(TARGET_CC) -o $@ kernel_elf-kern_i386_coreboot_startup.o kernel_elf-kern_i386_coreboot_init.o kernel_elf-kern_i386_multiboot_mmap.o kernel_elf-kern_main.o kernel_elf-kern_device.o kernel_elf-kern_disk.o kernel_elf-kern_dl.o kernel_elf-kern_file.o kernel_elf-kern_fs.o kernel_elf-kern_err.o kernel_elf-kern_misc.o kernel_elf-kern_mm.o kernel_elf-kern_loader.o kernel_elf-kern_rescue.o kernel_elf-kern_term.o kernel_elf-kern_time.o kernel_elf-kern_list.o kernel_elf-kern_handler.o kernel_elf-kern_command.o kernel_elf-kern_corecmd.o kernel_elf-kern_i386_dl.o kernel_elf-kern_parser.o kernel_elf-kern_partition.o kernel_elf-kern_i386_tsc.o kernel_elf-kern_i386_pit.o kernel_elf-kern_generic_rtc_get_time_ms.o kernel_elf-kern_generic_millisleep.o kernel_elf-kern_env.o kernel_elf-term_i386_pc_vga_tex
 t.o kernel_elf-term_i386_vga_common.o kernel_elf-term_i386_pc_at_keyboard.o kernel_elf-symlist.o $(TARGET_LDFLAGS) $(kernel_elf_LDFLAGS)
 
 kernel_elf-kern_i386_coreboot_startup.o: kern/i386/coreboot/startup.S $(kern/i386/coreboot/startup.S_DEPENDENCIES)
 	$(TARGET_CC) -Ikern/i386/coreboot -I$(srcdir)/kern/i386/coreboot $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(kernel_elf_CFLAGS) -MD -c -o $@ $<
@@ -105,6 +105,14 @@
 	$(TARGET_CC) -Ikern -I$(srcdir)/kern $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(kernel_elf_CFLAGS) -MD -c -o $@ $<
 -include kernel_elf-kern_handler.d
 
+kernel_elf-kern_command.o: kern/command.c $(kern/command.c_DEPENDENCIES)
+	$(TARGET_CC) -Ikern -I$(srcdir)/kern $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(kernel_elf_CFLAGS) -MD -c -o $@ $<
+-include kernel_elf-kern_command.d
+
+kernel_elf-kern_corecmd.o: kern/corecmd.c $(kern/corecmd.c_DEPENDENCIES)
+	$(TARGET_CC) -Ikern -I$(srcdir)/kern $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(kernel_elf_CFLAGS) -MD -c -o $@ $<
+-include kernel_elf-kern_corecmd.d
+
 kernel_elf-kern_i386_dl.o: kern/i386/dl.c $(kern/i386/dl.c_DEPENDENCIES)
 	$(TARGET_CC) -Ikern/i386 -I$(srcdir)/kern/i386 $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(kernel_elf_CFLAGS) -MD -c -o $@ $<
 -include kernel_elf-kern_i386_dl.d
@@ -153,11 +161,11 @@
 	$(TARGET_CC) -I. -I$(srcdir)/. $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(kernel_elf_CFLAGS) -MD -c -o $@ $<
 -include kernel_elf-symlist.d
 
-kernel_elf_HEADERS = arg.h boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
+kernel_elf_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
 	env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
 	partition.h pc_partition.h rescue.h symbol.h term.h time.h types.h \
 	machine/boot.h machine/console.h machine/init.h \
-	machine/memory.h machine/loader.h list.h handler.h
+	machine/memory.h machine/loader.h list.h handler.h command.h
 kernel_elf_CFLAGS = $(COMMON_CFLAGS)
 kernel_elf_ASFLAGS = $(COMMON_ASFLAGS)
 kernel_elf_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,0x8200,-Bstatic
@@ -196,7 +204,7 @@
 
 # For grub-emu.
 util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
-grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c	\
+grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c	\
 	commands/configfile.c commands/echo.c commands/help.c		\
 	commands/handler.c commands/ls.c commands/test.c 		\
 	commands/search.c commands/blocklist.c commands/hexdump.c	\
@@ -212,10 +220,11 @@
 	io/gzio.c							\
 	kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c	\
 	kern/err.c kern/list.c kern/handler.c				\
+	kern/command.c kern/corecmd.c commands/extcmd.c			\
 	normal/execute.c kern/file.c kern/fs.c normal/lexer.c 		\
 	kern/loader.c kern/main.c kern/misc.c kern/parser.c		\
 	grub_script.tab.c kern/partition.c kern/rescue.c kern/term.c	\
-	normal/arg.c normal/cmdline.c normal/command.c normal/function.c\
+	lib/arg.c normal/cmdline.c normal/command.c normal/function.c\
 	normal/completion.c normal/main.c normal/menu_text.c		\
 	normal/menu.c normal/menu_entry.c normal/menu_viewer.c		\
 	normal/misc.c normal/script.c					\
@@ -229,15 +238,15 @@
 	disk/raid.c disk/raid5_recover.c disk/raid6_recover.c		\
 	disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c		\
 	grub_emu_init.c
-CLEANFILES += grub-emu$(EXEEXT) grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_echo.o grub_emu-commands_help.o grub_emu-commands_handler.o grub_emu-commands_ls.o grub_emu-commands_test.o grub_emu-commands_search.o grub_emu-commands_blocklist.o grub_emu-commands_hexdump.o grub_emu-lib_hexdump.o grub_emu-commands_i386_cpuid.o grub_emu-disk_host.o grub_emu-disk_loopback.o grub_emu-fs_affs.o grub_emu-fs_cpio.o grub_emu-fs_fat.o grub_emu-fs_ext2.o grub_emu-fs_hfs.o grub_emu-fs_hfsplus.o grub_emu-fs_iso9660.o grub_emu-fs_udf.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_ntfs.o grub_emu-fs_ntfscomp.o grub_emu-fs_reiserfs.o grub_emu-fs_sfs.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-fs_afs.o grub_emu-fs_tar.o grub
 _emu-fs_fshelp.o grub_emu-io_gzio.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_elf.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-kern_list.o grub_emu-kern_handler.o grub_emu-normal_execute.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-normal_lexer.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_parser.o grub_emu-grub_script_tab.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_function.o grub_emu-normal_completion.o grub_emu-normal_main.o grub_emu-normal_menu_text.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_menu_viewer.o grub_emu-normal_misc.o grub_emu-normal_script.o grub_emu
 -normal_color.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-partmap_acorn.o grub_emu-partmap_gpt.o grub_emu-util_console.o grub_emu-util_hostfs.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_hostdisk.o grub_emu-util_getroot.o grub_emu-util_i386_pc_misc.o grub_emu-disk_raid.o grub_emu-disk_raid5_recover.o grub_emu-disk_raid6_recover.o grub_emu-disk_mdraid_linux.o grub_emu-disk_dmraid_nvidia.o grub_emu-disk_lvm.o grub_emu-grub_emu_init.o
-MOSTLYCLEANFILES += grub_emu-commands_boot.d grub_emu-commands_cat.d grub_emu-commands_cmp.d grub_emu-commands_configfile.d grub_emu-commands_echo.d grub_emu-commands_help.d grub_emu-commands_handler.d grub_emu-commands_ls.d grub_emu-commands_test.d grub_emu-commands_search.d grub_emu-commands_blocklist.d grub_emu-commands_hexdump.d grub_emu-lib_hexdump.d grub_emu-commands_i386_cpuid.d grub_emu-disk_host.d grub_emu-disk_loopback.d grub_emu-fs_affs.d grub_emu-fs_cpio.d grub_emu-fs_fat.d grub_emu-fs_ext2.d grub_emu-fs_hfs.d grub_emu-fs_hfsplus.d grub_emu-fs_iso9660.d grub_emu-fs_udf.d grub_emu-fs_jfs.d grub_emu-fs_minix.d grub_emu-fs_ntfs.d grub_emu-fs_ntfscomp.d grub_emu-fs_reiserfs.d grub_emu-fs_sfs.d grub_emu-fs_ufs.d grub_emu-fs_xfs.d grub_emu-fs_afs.d grub_emu-fs_tar.d grub_emu-fs_fshe
 lp.d grub_emu-io_gzio.d grub_emu-kern_device.d grub_emu-kern_disk.d grub_emu-kern_dl.d grub_emu-kern_elf.d grub_emu-kern_env.d grub_emu-kern_err.d grub_emu-kern_list.d grub_emu-kern_handler.d grub_emu-normal_execute.d grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-normal_lexer.d grub_emu-kern_loader.d grub_emu-kern_main.d grub_emu-kern_misc.d grub_emu-kern_parser.d grub_emu-grub_script_tab.d grub_emu-kern_partition.d grub_emu-kern_rescue.d grub_emu-kern_term.d grub_emu-normal_arg.d grub_emu-normal_cmdline.d grub_emu-normal_command.d grub_emu-normal_function.d grub_emu-normal_completion.d grub_emu-normal_main.d grub_emu-normal_menu_text.d grub_emu-normal_menu.d grub_emu-normal_menu_entry.d grub_emu-normal_menu_viewer.d grub_emu-normal_misc.d grub_emu-normal_script.d grub_emu-normal_colo
 r.d grub_emu-partmap_amiga.d grub_emu-partmap_apple.d grub_emu-partmap_pc.d grub_emu-partmap_sun.d grub_emu-partmap_acorn.d grub_emu-partmap_gpt.d grub_emu-util_console.d grub_emu-util_hostfs.d grub_emu-util_grub_emu.d grub_emu-util_misc.d grub_emu-util_hostdisk.d grub_emu-util_getroot.d grub_emu-util_i386_pc_misc.d grub_emu-disk_raid.d grub_emu-disk_raid5_recover.d grub_emu-disk_raid6_recover.d grub_emu-disk_mdraid_linux.d grub_emu-disk_dmraid_nvidia.d grub_emu-disk_lvm.d grub_emu-grub_emu_init.d
+CLEANFILES += grub-emu$(EXEEXT) grub_emu-commands_minicmd.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_echo.o grub_emu-commands_help.o grub_emu-commands_handler.o grub_emu-commands_ls.o grub_emu-commands_test.o grub_emu-commands_search.o grub_emu-commands_blocklist.o grub_emu-commands_hexdump.o grub_emu-lib_hexdump.o grub_emu-commands_i386_cpuid.o grub_emu-disk_host.o grub_emu-disk_loopback.o grub_emu-fs_affs.o grub_emu-fs_cpio.o grub_emu-fs_fat.o grub_emu-fs_ext2.o grub_emu-fs_hfs.o grub_emu-fs_hfsplus.o grub_emu-fs_iso9660.o grub_emu-fs_udf.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_ntfs.o grub_emu-fs_ntfscomp.o grub_emu-fs_reiserfs.o grub_emu-fs_sfs.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-fs_afs.o grub_emu-fs_tar.o g
 rub_emu-fs_fshelp.o grub_emu-io_gzio.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_elf.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-kern_list.o grub_emu-kern_handler.o grub_emu-kern_command.o grub_emu-kern_corecmd.o grub_emu-commands_extcmd.o grub_emu-normal_execute.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-normal_lexer.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_parser.o grub_emu-grub_script_tab.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-lib_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_function.o grub_emu-normal_completion.o grub_emu-normal_main.o grub_emu-normal_menu_text.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-no
 rmal_menu_viewer.o grub_emu-normal_misc.o grub_emu-normal_script.o grub_emu-normal_color.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-partmap_acorn.o grub_emu-partmap_gpt.o grub_emu-util_console.o grub_emu-util_hostfs.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_hostdisk.o grub_emu-util_getroot.o grub_emu-util_i386_pc_misc.o grub_emu-disk_raid.o grub_emu-disk_raid5_recover.o grub_emu-disk_raid6_recover.o grub_emu-disk_mdraid_linux.o grub_emu-disk_dmraid_nvidia.o grub_emu-disk_lvm.o grub_emu-grub_emu_init.o
+MOSTLYCLEANFILES += grub_emu-commands_minicmd.d grub_emu-commands_cat.d grub_emu-commands_cmp.d grub_emu-commands_configfile.d grub_emu-commands_echo.d grub_emu-commands_help.d grub_emu-commands_handler.d grub_emu-commands_ls.d grub_emu-commands_test.d grub_emu-commands_search.d grub_emu-commands_blocklist.d grub_emu-commands_hexdump.d grub_emu-lib_hexdump.d grub_emu-commands_i386_cpuid.d grub_emu-disk_host.d grub_emu-disk_loopback.d grub_emu-fs_affs.d grub_emu-fs_cpio.d grub_emu-fs_fat.d grub_emu-fs_ext2.d grub_emu-fs_hfs.d grub_emu-fs_hfsplus.d grub_emu-fs_iso9660.d grub_emu-fs_udf.d grub_emu-fs_jfs.d grub_emu-fs_minix.d grub_emu-fs_ntfs.d grub_emu-fs_ntfscomp.d grub_emu-fs_reiserfs.d grub_emu-fs_sfs.d grub_emu-fs_ufs.d grub_emu-fs_xfs.d grub_emu-fs_afs.d grub_emu-fs_tar.d grub_emu-fs_f
 shelp.d grub_emu-io_gzio.d grub_emu-kern_device.d grub_emu-kern_disk.d grub_emu-kern_dl.d grub_emu-kern_elf.d grub_emu-kern_env.d grub_emu-kern_err.d grub_emu-kern_list.d grub_emu-kern_handler.d grub_emu-kern_command.d grub_emu-kern_corecmd.d grub_emu-commands_extcmd.d grub_emu-normal_execute.d grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-normal_lexer.d grub_emu-kern_loader.d grub_emu-kern_main.d grub_emu-kern_misc.d grub_emu-kern_parser.d grub_emu-grub_script_tab.d grub_emu-kern_partition.d grub_emu-kern_rescue.d grub_emu-kern_term.d grub_emu-lib_arg.d grub_emu-normal_cmdline.d grub_emu-normal_command.d grub_emu-normal_function.d grub_emu-normal_completion.d grub_emu-normal_main.d grub_emu-normal_menu_text.d grub_emu-normal_menu.d grub_emu-normal_menu_entry.d grub_emu-normal_menu_vi
 ewer.d grub_emu-normal_misc.d grub_emu-normal_script.d grub_emu-normal_color.d grub_emu-partmap_amiga.d grub_emu-partmap_apple.d grub_emu-partmap_pc.d grub_emu-partmap_sun.d grub_emu-partmap_acorn.d grub_emu-partmap_gpt.d grub_emu-util_console.d grub_emu-util_hostfs.d grub_emu-util_grub_emu.d grub_emu-util_misc.d grub_emu-util_hostdisk.d grub_emu-util_getroot.d grub_emu-util_i386_pc_misc.d grub_emu-disk_raid.d grub_emu-disk_raid5_recover.d grub_emu-disk_raid6_recover.d grub_emu-disk_mdraid_linux.d grub_emu-disk_dmraid_nvidia.d grub_emu-disk_lvm.d grub_emu-grub_emu_init.d
 
-grub-emu: $(grub_emu_DEPENDENCIES) grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_echo.o grub_emu-commands_help.o grub_emu-commands_handler.o grub_emu-commands_ls.o grub_emu-commands_test.o grub_emu-commands_search.o grub_emu-commands_blocklist.o grub_emu-commands_hexdump.o grub_emu-lib_hexdump.o grub_emu-commands_i386_cpuid.o grub_emu-disk_host.o grub_emu-disk_loopback.o grub_emu-fs_affs.o grub_emu-fs_cpio.o grub_emu-fs_fat.o grub_emu-fs_ext2.o grub_emu-fs_hfs.o grub_emu-fs_hfsplus.o grub_emu-fs_iso9660.o grub_emu-fs_udf.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_ntfs.o grub_emu-fs_ntfscomp.o grub_emu-fs_reiserfs.o grub_emu-fs_sfs.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-fs_afs.o grub_emu-fs_tar.o g
 rub_emu-fs_fshelp.o grub_emu-io_gzio.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_elf.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-kern_list.o grub_emu-kern_handler.o grub_emu-normal_execute.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-normal_lexer.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_parser.o grub_emu-grub_script_tab.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_function.o grub_emu-normal_completion.o grub_emu-normal_main.o grub_emu-normal_menu_text.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_menu_viewer.o grub_emu-normal_misc.o grub_emu-normal_script.o grub_
 emu-normal_color.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-partmap_acorn.o grub_emu-partmap_gpt.o grub_emu-util_console.o grub_emu-util_hostfs.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_hostdisk.o grub_emu-util_getroot.o grub_emu-util_i386_pc_misc.o grub_emu-disk_raid.o grub_emu-disk_raid5_recover.o grub_emu-disk_raid6_recover.o grub_emu-disk_mdraid_linux.o grub_emu-disk_dmraid_nvidia.o grub_emu-disk_lvm.o grub_emu-grub_emu_init.o
-	$(CC) -o $@ grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_echo.o grub_emu-commands_help.o grub_emu-commands_handler.o grub_emu-commands_ls.o grub_emu-commands_test.o grub_emu-commands_search.o grub_emu-commands_blocklist.o grub_emu-commands_hexdump.o grub_emu-lib_hexdump.o grub_emu-commands_i386_cpuid.o grub_emu-disk_host.o grub_emu-disk_loopback.o grub_emu-fs_affs.o grub_emu-fs_cpio.o grub_emu-fs_fat.o grub_emu-fs_ext2.o grub_emu-fs_hfs.o grub_emu-fs_hfsplus.o grub_emu-fs_iso9660.o grub_emu-fs_udf.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_ntfs.o grub_emu-fs_ntfscomp.o grub_emu-fs_reiserfs.o grub_emu-fs_sfs.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-fs_afs.o grub_emu-fs_tar.o grub_emu-fs_fshelp.o gr
 ub_emu-io_gzio.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_elf.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-kern_list.o grub_emu-kern_handler.o grub_emu-normal_execute.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-normal_lexer.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_parser.o grub_emu-grub_script_tab.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_function.o grub_emu-normal_completion.o grub_emu-normal_main.o grub_emu-normal_menu_text.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_menu_viewer.o grub_emu-normal_misc.o grub_emu-normal_script.o grub_emu-normal_color.o gru
 b_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-partmap_acorn.o grub_emu-partmap_gpt.o grub_emu-util_console.o grub_emu-util_hostfs.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_hostdisk.o grub_emu-util_getroot.o grub_emu-util_i386_pc_misc.o grub_emu-disk_raid.o grub_emu-disk_raid5_recover.o grub_emu-disk_raid6_recover.o grub_emu-disk_mdraid_linux.o grub_emu-disk_dmraid_nvidia.o grub_emu-disk_lvm.o grub_emu-grub_emu_init.o $(LDFLAGS) $(grub_emu_LDFLAGS)
+grub-emu: $(grub_emu_DEPENDENCIES) grub_emu-commands_minicmd.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_echo.o grub_emu-commands_help.o grub_emu-commands_handler.o grub_emu-commands_ls.o grub_emu-commands_test.o grub_emu-commands_search.o grub_emu-commands_blocklist.o grub_emu-commands_hexdump.o grub_emu-lib_hexdump.o grub_emu-commands_i386_cpuid.o grub_emu-disk_host.o grub_emu-disk_loopback.o grub_emu-fs_affs.o grub_emu-fs_cpio.o grub_emu-fs_fat.o grub_emu-fs_ext2.o grub_emu-fs_hfs.o grub_emu-fs_hfsplus.o grub_emu-fs_iso9660.o grub_emu-fs_udf.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_ntfs.o grub_emu-fs_ntfscomp.o grub_emu-fs_reiserfs.o grub_emu-fs_sfs.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-fs_afs.o grub_emu-fs_tar.
 o grub_emu-fs_fshelp.o grub_emu-io_gzio.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_elf.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-kern_list.o grub_emu-kern_handler.o grub_emu-kern_command.o grub_emu-kern_corecmd.o grub_emu-commands_extcmd.o grub_emu-normal_execute.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-normal_lexer.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_parser.o grub_emu-grub_script_tab.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-lib_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_function.o grub_emu-normal_completion.o grub_emu-normal_main.o grub_emu-normal_menu_text.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu
 -normal_menu_viewer.o grub_emu-normal_misc.o grub_emu-normal_script.o grub_emu-normal_color.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-partmap_acorn.o grub_emu-partmap_gpt.o grub_emu-util_console.o grub_emu-util_hostfs.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_hostdisk.o grub_emu-util_getroot.o grub_emu-util_i386_pc_misc.o grub_emu-disk_raid.o grub_emu-disk_raid5_recover.o grub_emu-disk_raid6_recover.o grub_emu-disk_mdraid_linux.o grub_emu-disk_dmraid_nvidia.o grub_emu-disk_lvm.o grub_emu-grub_emu_init.o
+	$(CC) -o $@ grub_emu-commands_minicmd.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_echo.o grub_emu-commands_help.o grub_emu-commands_handler.o grub_emu-commands_ls.o grub_emu-commands_test.o grub_emu-commands_search.o grub_emu-commands_blocklist.o grub_emu-commands_hexdump.o grub_emu-lib_hexdump.o grub_emu-commands_i386_cpuid.o grub_emu-disk_host.o grub_emu-disk_loopback.o grub_emu-fs_affs.o grub_emu-fs_cpio.o grub_emu-fs_fat.o grub_emu-fs_ext2.o grub_emu-fs_hfs.o grub_emu-fs_hfsplus.o grub_emu-fs_iso9660.o grub_emu-fs_udf.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_ntfs.o grub_emu-fs_ntfscomp.o grub_emu-fs_reiserfs.o grub_emu-fs_sfs.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-fs_afs.o grub_emu-fs_tar.o grub_emu-fs_fshelp.o
  grub_emu-io_gzio.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_elf.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-kern_list.o grub_emu-kern_handler.o grub_emu-kern_command.o grub_emu-kern_corecmd.o grub_emu-commands_extcmd.o grub_emu-normal_execute.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-normal_lexer.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_parser.o grub_emu-grub_script_tab.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-lib_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_function.o grub_emu-normal_completion.o grub_emu-normal_main.o grub_emu-normal_menu_text.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_menu_viewer.o 
 grub_emu-normal_misc.o grub_emu-normal_script.o grub_emu-normal_color.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-partmap_acorn.o grub_emu-partmap_gpt.o grub_emu-util_console.o grub_emu-util_hostfs.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_hostdisk.o grub_emu-util_getroot.o grub_emu-util_i386_pc_misc.o grub_emu-disk_raid.o grub_emu-disk_raid5_recover.o grub_emu-disk_raid6_recover.o grub_emu-disk_mdraid_linux.o grub_emu-disk_dmraid_nvidia.o grub_emu-disk_lvm.o grub_emu-grub_emu_init.o $(LDFLAGS) $(grub_emu_LDFLAGS)
 
-grub_emu-commands_boot.o: commands/boot.c $(commands/boot.c_DEPENDENCIES)
+grub_emu-commands_minicmd.o: commands/minicmd.c $(commands/minicmd.c_DEPENDENCIES)
 	$(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -MD -c -o $@ $<
--include grub_emu-commands_boot.d
+-include grub_emu-commands_minicmd.d
 
 grub_emu-commands_cat.o: commands/cat.c $(commands/cat.c_DEPENDENCIES)
 	$(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -MD -c -o $@ $<
@@ -411,6 +420,18 @@
 	$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -MD -c -o $@ $<
 -include grub_emu-kern_handler.d
 
+grub_emu-kern_command.o: kern/command.c $(kern/command.c_DEPENDENCIES)
+	$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -MD -c -o $@ $<
+-include grub_emu-kern_command.d
+
+grub_emu-kern_corecmd.o: kern/corecmd.c $(kern/corecmd.c_DEPENDENCIES)
+	$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -MD -c -o $@ $<
+-include grub_emu-kern_corecmd.d
+
+grub_emu-commands_extcmd.o: commands/extcmd.c $(commands/extcmd.c_DEPENDENCIES)
+	$(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -MD -c -o $@ $<
+-include grub_emu-commands_extcmd.d
+
 grub_emu-normal_execute.o: normal/execute.c $(normal/execute.c_DEPENDENCIES)
 	$(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -MD -c -o $@ $<
 -include grub_emu-normal_execute.d
@@ -459,9 +480,9 @@
 	$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -MD -c -o $@ $<
 -include grub_emu-kern_term.d
 
-grub_emu-normal_arg.o: normal/arg.c $(normal/arg.c_DEPENDENCIES)
-	$(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -MD -c -o $@ $<
--include grub_emu-normal_arg.d
+grub_emu-lib_arg.o: lib/arg.c $(lib/arg.c_DEPENDENCIES)
+	$(CC) -Ilib -I$(srcdir)/lib $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -MD -c -o $@ $<
+-include grub_emu-lib_arg.d
 
 grub_emu-normal_cmdline.o: normal/cmdline.c $(normal/cmdline.c_DEPENDENCIES)
 	$(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -MD -c -o $@ $<
@@ -604,78 +625,20 @@
 
 
 # Modules.
-pkglib_MODULES = _linux.mod linux.mod normal.mod	\
-	_multiboot.mod multiboot.mod aout.mod		\
-	play.mod serial.mod ata.mod			\
+pkglib_MODULES = linux.mod normal.mod multiboot.mod 	\
+	aout.mod play.mod serial.mod ata.mod		\
 	memdisk.mod pci.mod lspci.mod reboot.mod	\
 	halt.mod datetime.mod date.mod datehook.mod	\
 	lsmmap.mod
 
-# For _linux.mod.
-_linux_mod_SOURCES = loader/i386/linux.c
-CLEANFILES += _linux.mod mod-_linux.o mod-_linux.c pre-_linux.o _linux_mod-loader_i386_linux.o und-_linux.lst
-ifneq ($(_linux_mod_EXPORTS),no)
-CLEANFILES += def-_linux.lst
-DEFSYMFILES += def-_linux.lst
-endif
-MOSTLYCLEANFILES += _linux_mod-loader_i386_linux.d
-UNDSYMFILES += und-_linux.lst
-
-_linux.mod: pre-_linux.o mod-_linux.o $(TARGET_OBJ2ELF)
-	-rm -f $@
-	$(TARGET_CC) $(_linux_mod_LDFLAGS) $(TARGET_LDFLAGS) $(MODULE_LDFLAGS) -Wl,-r,-d -o $@ pre-_linux.o mod-_linux.o
-	if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
-	$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@
-
-pre-_linux.o: $(_linux_mod_DEPENDENCIES) _linux_mod-loader_i386_linux.o
-	-rm -f $@
-	$(TARGET_CC) $(_linux_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ _linux_mod-loader_i386_linux.o
-
-mod-_linux.o: mod-_linux.c
-	$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(_linux_mod_CFLAGS) -c -o $@ $<
-
-mod-_linux.c: $(builddir)/moddep.lst $(srcdir)/genmodsrc.sh
-	sh $(srcdir)/genmodsrc.sh '_linux' $< > $@ || (rm -f $@; exit 1)
-
-ifneq ($(_linux_mod_EXPORTS),no)
-def-_linux.lst: pre-_linux.o
-	$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 _linux/' > $@
-endif
-
-und-_linux.lst: pre-_linux.o
-	echo '_linux' > $@
-	$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
-
-_linux_mod-loader_i386_linux.o: loader/i386/linux.c $(loader/i386/linux.c_DEPENDENCIES)
-	$(TARGET_CC) -Iloader/i386 -I$(srcdir)/loader/i386 $(TARGET_CPPFLAGS)  $(TARGET_CFLAGS) $(_linux_mod_CFLAGS) -MD -c -o $@ $<
--include _linux_mod-loader_i386_linux.d
-
-CLEANFILES += cmd-_linux_mod-loader_i386_linux.lst fs-_linux_mod-loader_i386_linux.lst partmap-_linux_mod-loader_i386_linux.lst
-COMMANDFILES += cmd-_linux_mod-loader_i386_linux.lst
-FSFILES += fs-_linux_mod-loader_i386_linux.lst
-PARTMAPFILES += partmap-_linux_mod-loader_i386_linux.lst
-
-cmd-_linux_mod-loader_i386_linux.lst: loader/i386/linux.c $(loader/i386/linux.c_DEPENDENCIES) gencmdlist.sh
-	set -e; 	  $(TARGET_CC) -Iloader/i386 -I$(srcdir)/loader/i386 $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(_linux_mod_CFLAGS) -E $< 	  | sh $(srcdir)/gencmdlist.sh _linux > $@ || (rm -f $@; exit 1)
-
-fs-_linux_mod-loader_i386_linux.lst: loader/i386/linux.c $(loader/i386/linux.c_DEPENDENCIES) genfslist.sh
-	set -e; 	  $(TARGET_CC) -Iloader/i386 -I$(srcdir)/loader/i386 $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(_linux_mod_CFLAGS) -E $< 	  | sh $(srcdir)/genfslist.sh _linux > $@ || (rm -f $@; exit 1)
-
-partmap-_linux_mod-loader_i386_linux.lst: loader/i386/linux.c $(loader/i386/linux.c_DEPENDENCIES) genpartmaplist.sh
-	set -e; 	  $(TARGET_CC) -Iloader/i386 -I$(srcdir)/loader/i386 $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(_linux_mod_CFLAGS) -E $< 	  | sh $(srcdir)/genpartmaplist.sh _linux > $@ || (rm -f $@; exit 1)
-
-
-_linux_mod_CFLAGS = $(COMMON_CFLAGS)
-_linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
-
 # For linux.mod.
-linux_mod_SOURCES = loader/linux_normal.c
-CLEANFILES += linux.mod mod-linux.o mod-linux.c pre-linux.o linux_mod-loader_linux_normal.o und-linux.lst
+linux_mod_SOURCES = loader/i386/linux.c
+CLEANFILES += linux.mod mod-linux.o mod-linux.c pre-linux.o linux_mod-loader_i386_linux.o und-linux.lst
 ifneq ($(linux_mod_EXPORTS),no)
 CLEANFILES += def-linux.lst
 DEFSYMFILES += def-linux.lst
 endif
-MOSTLYCLEANFILES += linux_mod-loader_linux_normal.d
+MOSTLYCLEANFILES += linux_mod-loader_i386_linux.d
 UNDSYMFILES += und-linux.lst
 
 linux.mod: pre-linux.o mod-linux.o $(TARGET_OBJ2ELF)
@@ -684,9 +647,9 @@
 	if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
 	$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@
 
-pre-linux.o: $(linux_mod_DEPENDENCIES) linux_mod-loader_linux_normal.o
+pre-linux.o: $(linux_mod_DEPENDENCIES) linux_mod-loader_i386_linux.o
 	-rm -f $@
-	$(TARGET_CC) $(linux_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ linux_mod-loader_linux_normal.o
+	$(TARGET_CC) $(linux_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ linux_mod-loader_i386_linux.o
 
 mod-linux.o: mod-linux.c
 	$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(linux_mod_CFLAGS) -c -o $@ $<
@@ -703,23 +666,23 @@
 	echo 'linux' > $@
 	$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
 
-linux_mod-loader_linux_normal.o: loader/linux_normal.c $(loader/linux_normal.c_DEPENDENCIES)
-	$(TARGET_CC) -Iloader -I$(srcdir)/loader $(TARGET_CPPFLAGS)  $(TARGET_CFLAGS) $(linux_mod_CFLAGS) -MD -c -o $@ $<
--include linux_mod-loader_linux_normal.d
+linux_mod-loader_i386_linux.o: loader/i386/linux.c $(loader/i386/linux.c_DEPENDENCIES)
+	$(TARGET_CC) -Iloader/i386 -I$(srcdir)/loader/i386 $(TARGET_CPPFLAGS)  $(TARGET_CFLAGS) $(linux_mod_CFLAGS) -MD -c -o $@ $<
+-include linux_mod-loader_i386_linux.d
 
-CLEANFILES += cmd-linux_mod-loader_linux_normal.lst fs-linux_mod-loader_linux_normal.lst partmap-linux_mod-loader_linux_normal.lst
-COMMANDFILES += cmd-linux_mod-loader_linux_normal.lst
-FSFILES += fs-linux_mod-loader_linux_normal.lst
-PARTMAPFILES += partmap-linux_mod-loader_linux_normal.lst
+CLEANFILES += cmd-linux_mod-loader_i386_linux.lst fs-linux_mod-loader_i386_linux.lst partmap-linux_mod-loader_i386_linux.lst
+COMMANDFILES += cmd-linux_mod-loader_i386_linux.lst
+FSFILES += fs-linux_mod-loader_i386_linux.lst
+PARTMAPFILES += partmap-linux_mod-loader_i386_linux.lst
 
-cmd-linux_mod-loader_linux_normal.lst: loader/linux_normal.c $(loader/linux_normal.c_DEPENDENCIES) gencmdlist.sh
-	set -e; 	  $(TARGET_CC) -Iloader -I$(srcdir)/loader $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(linux_mod_CFLAGS) -E $< 	  | sh $(srcdir)/gencmdlist.sh linux > $@ || (rm -f $@; exit 1)
+cmd-linux_mod-loader_i386_linux.lst: loader/i386/linux.c $(loader/i386/linux.c_DEPENDENCIES) gencmdlist.sh
+	set -e; 	  $(TARGET_CC) -Iloader/i386 -I$(srcdir)/loader/i386 $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(linux_mod_CFLAGS) -E $< 	  | sh $(srcdir)/gencmdlist.sh linux > $@ || (rm -f $@; exit 1)
 
-fs-linux_mod-loader_linux_normal.lst: loader/linux_normal.c $(loader/linux_normal.c_DEPENDENCIES) genfslist.sh
-	set -e; 	  $(TARGET_CC) -Iloader -I$(srcdir)/loader $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(linux_mod_CFLAGS) -E $< 	  | sh $(srcdir)/genfslist.sh linux > $@ || (rm -f $@; exit 1)
+fs-linux_mod-loader_i386_linux.lst: loader/i386/linux.c $(loader/i386/linux.c_DEPENDENCIES) genfslist.sh
+	set -e; 	  $(TARGET_CC) -Iloader/i386 -I$(srcdir)/loader/i386 $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(linux_mod_CFLAGS) -E $< 	  | sh $(srcdir)/genfslist.sh linux > $@ || (rm -f $@; exit 1)
 
-partmap-linux_mod-loader_linux_normal.lst: loader/linux_normal.c $(loader/linux_normal.c_DEPENDENCIES) genpartmaplist.sh
-	set -e; 	  $(TARGET_CC) -Iloader -I$(srcdir)/loader $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(linux_mod_CFLAGS) -E $< 	  | sh $(srcdir)/genpartmaplist.sh linux > $@ || (rm -f $@; exit 1)
+partmap-linux_mod-loader_i386_linux.lst: loader/i386/linux.c $(loader/i386/linux.c_DEPENDENCIES) genpartmaplist.sh
+	set -e; 	  $(TARGET_CC) -Iloader/i386 -I$(srcdir)/loader/i386 $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(linux_mod_CFLAGS) -E $< 	  | sh $(srcdir)/genpartmaplist.sh linux > $@ || (rm -f $@; exit 1)
 
 
 linux_mod_CFLAGS = $(COMMON_CFLAGS)
@@ -733,7 +696,7 @@
 # Please put arch dependant part of normal.mod at the end of list to
 # keep it simpler to update to different architectures.
 #
-normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c	\
+normal_mod_SOURCES = normal/cmdline.c normal/command.c			\
 	normal/completion.c normal/execute.c		 		\
 	normal/function.c normal/lexer.c normal/main.c normal/menu.c	\
 	normal/menu_text.c						\
@@ -742,12 +705,12 @@
 	normal/misc.c grub_script.tab.c 				\
 	normal/script.c							\
 	normal/i386/setjmp.S
-CLEANFILES += normal.mod mod-normal.o mod-normal.c pre-normal.o normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_text.o normal_mod-normal_color.o normal_mod-normal_menu_viewer.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_i386_setjmp.o und-normal.lst
+CLEANFILES += normal.mod mod-normal.o mod-normal.c pre-normal.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_text.o normal_mod-normal_color.o normal_mod-normal_menu_viewer.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_i386_setjmp.o und-normal.lst
 ifneq ($(normal_mod_EXPORTS),no)
 CLEANFILES += def-normal.lst
 DEFSYMFILES += def-normal.lst
 endif
-MOSTLYCLEANFILES += normal_mod-normal_arg.d normal_mod-normal_cmdline.d normal_mod-normal_command.d normal_mod-normal_completion.d normal_mod-normal_execute.d normal_mod-normal_function.d normal_mod-normal_lexer.d normal_mod-normal_main.d normal_mod-normal_menu.d normal_mod-normal_menu_text.d normal_mod-normal_color.d normal_mod-normal_menu_viewer.d normal_mod-normal_menu_entry.d normal_mod-normal_misc.d normal_mod-grub_script_tab.d normal_mod-normal_script.d normal_mod-normal_i386_setjmp.d
+MOSTLYCLEANFILES += normal_mod-normal_cmdline.d normal_mod-normal_command.d normal_mod-normal_completion.d normal_mod-normal_execute.d normal_mod-normal_function.d normal_mod-normal_lexer.d normal_mod-normal_main.d normal_mod-normal_menu.d normal_mod-normal_menu_text.d normal_mod-normal_color.d normal_mod-normal_menu_viewer.d normal_mod-normal_menu_entry.d normal_mod-normal_misc.d normal_mod-grub_script_tab.d normal_mod-normal_script.d normal_mod-normal_i386_setjmp.d
 UNDSYMFILES += und-normal.lst
 
 normal.mod: pre-normal.o mod-normal.o $(TARGET_OBJ2ELF)
@@ -756,9 +719,9 @@
 	if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
 	$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@
 
-pre-normal.o: $(normal_mod_DEPENDENCIES) normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_text.o normal_mod-normal_color.o normal_mod-normal_menu_viewer.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_i386_setjmp.o
+pre-normal.o: $(normal_mod_DEPENDENCIES) normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_text.o normal_mod-normal_color.o normal_mod-normal_menu_viewer.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_i386_setjmp.o
 	-rm -f $@
-	$(TARGET_CC) $(normal_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ normal_mod-normal_arg.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_text.o normal_mod-normal_color.o normal_mod-normal_menu_viewer.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_i386_setjmp.o
+	$(TARGET_CC) $(normal_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_completion.o normal_mod-normal_execute.o normal_mod-normal_function.o normal_mod-normal_lexer.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_menu_text.o normal_mod-normal_color.o normal_mod-normal_menu_viewer.o normal_mod-normal_menu_entry.o normal_mod-normal_misc.o normal_mod-grub_script_tab.o normal_mod-normal_script.o normal_mod-normal_i386_setjmp.o
 
 mod-normal.o: mod-normal.c
 	$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $<
@@ -775,25 +738,6 @@
 	echo 'normal' > $@
 	$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
 
-normal_mod-normal_arg.o: normal/arg.c $(normal/arg.c_DEPENDENCIES)
-	$(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS)  $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -MD -c -o $@ $<
--include normal_mod-normal_arg.d
-
-CLEANFILES += cmd-normal_mod-normal_arg.lst fs-normal_mod-normal_arg.lst partmap-normal_mod-normal_arg.lst
-COMMANDFILES += cmd-normal_mod-normal_arg.lst
-FSFILES += fs-normal_mod-normal_arg.lst
-PARTMAPFILES += partmap-normal_mod-normal_arg.lst
-
-cmd-normal_mod-normal_arg.lst: normal/arg.c $(normal/arg.c_DEPENDENCIES) gencmdlist.sh
-	set -e; 	  $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< 	  | sh $(srcdir)/gencmdlist.sh normal > $@ || (rm -f $@; exit 1)
-
-fs-normal_mod-normal_arg.lst: normal/arg.c $(normal/arg.c_DEPENDENCIES) genfslist.sh
-	set -e; 	  $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< 	  | sh $(srcdir)/genfslist.sh normal > $@ || (rm -f $@; exit 1)
-
-partmap-normal_mod-normal_arg.lst: normal/arg.c $(normal/arg.c_DEPENDENCIES) genpartmaplist.sh
-	set -e; 	  $(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -E $< 	  | sh $(srcdir)/genpartmaplist.sh normal > $@ || (rm -f $@; exit 1)
-
-
 normal_mod-normal_cmdline.o: normal/cmdline.c $(normal/cmdline.c_DEPENDENCIES)
 	$(TARGET_CC) -Inormal -I$(srcdir)/normal $(TARGET_CPPFLAGS)  $(TARGET_CFLAGS) $(normal_mod_CFLAGS) -MD -c -o $@ $<
 -include normal_mod-normal_cmdline.d
@@ -1311,174 +1255,117 @@
 serial_mod_CFLAGS = $(COMMON_CFLAGS)
 serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
-# For _multiboot.mod.
-_multiboot_mod_SOURCES = loader/i386/multiboot.c \
+# For multiboot.mod.
+multiboot_mod_SOURCES = loader/i386/multiboot.c \
                          loader/i386/pc/multiboot2.c \
                          loader/multiboot2.c \
                          loader/multiboot_loader.c
-CLEANFILES += _multiboot.mod mod-_multiboot.o mod-_multiboot.c pre-_multiboot.o _multiboot_mod-loader_i386_multiboot.o _multiboot_mod-loader_i386_pc_multiboot2.o _multiboot_mod-loader_multiboot2.o _multiboot_mod-loader_multiboot_loader.o und-_multiboot.lst
-ifneq ($(_multiboot_mod_EXPORTS),no)
-CLEANFILES += def-_multiboot.lst
-DEFSYMFILES += def-_multiboot.lst
+CLEANFILES += multiboot.mod mod-multiboot.o mod-multiboot.c pre-multiboot.o multiboot_mod-loader_i386_multiboot.o multiboot_mod-loader_i386_pc_multiboot2.o multiboot_mod-loader_multiboot2.o multiboot_mod-loader_multiboot_loader.o und-multiboot.lst
+ifneq ($(multiboot_mod_EXPORTS),no)
+CLEANFILES += def-multiboot.lst
+DEFSYMFILES += def-multiboot.lst
 endif
-MOSTLYCLEANFILES += _multiboot_mod-loader_i386_multiboot.d _multiboot_mod-loader_i386_pc_multiboot2.d _multiboot_mod-loader_multiboot2.d _multiboot_mod-loader_multiboot_loader.d
-UNDSYMFILES += und-_multiboot.lst
+MOSTLYCLEANFILES += multiboot_mod-loader_i386_multiboot.d multiboot_mod-loader_i386_pc_multiboot2.d multiboot_mod-loader_multiboot2.d multiboot_mod-loader_multiboot_loader.d
+UNDSYMFILES += und-multiboot.lst
 
-_multiboot.mod: pre-_multiboot.o mod-_multiboot.o $(TARGET_OBJ2ELF)
+multiboot.mod: pre-multiboot.o mod-multiboot.o $(TARGET_OBJ2ELF)
 	-rm -f $@
-	$(TARGET_CC) $(_multiboot_mod_LDFLAGS) $(TARGET_LDFLAGS) $(MODULE_LDFLAGS) -Wl,-r,-d -o $@ pre-_multiboot.o mod-_multiboot.o
+	$(TARGET_CC) $(multiboot_mod_LDFLAGS) $(TARGET_LDFLAGS) $(MODULE_LDFLAGS) -Wl,-r,-d -o $@ pre-multiboot.o mod-multiboot.o
 	if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
 	$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@
 
-pre-_multiboot.o: $(_multiboot_mod_DEPENDENCIES) _multiboot_mod-loader_i386_multiboot.o _multiboot_mod-loader_i386_pc_multiboot2.o _multiboot_mod-loader_multiboot2.o _multiboot_mod-loader_multiboot_loader.o
+pre-multiboot.o: $(multiboot_mod_DEPENDENCIES) multiboot_mod-loader_i386_multiboot.o multiboot_mod-loader_i386_pc_multiboot2.o multiboot_mod-loader_multiboot2.o multiboot_mod-loader_multiboot_loader.o
 	-rm -f $@
-	$(TARGET_CC) $(_multiboot_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ _multiboot_mod-loader_i386_multiboot.o _multiboot_mod-loader_i386_pc_multiboot2.o _multiboot_mod-loader_multiboot2.o _multiboot_mod-loader_multiboot_loader.o
+	$(TARGET_CC) $(multiboot_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ multiboot_mod-loader_i386_multiboot.o multiboot_mod-loader_i386_pc_multiboot2.o multiboot_mod-loader_multiboot2.o multiboot_mod-loader_multiboot_loader.o
 
-mod-_multiboot.o: mod-_multiboot.c
-	$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(_multiboot_mod_CFLAGS) -c -o $@ $<
+mod-multiboot.o: mod-multiboot.c
+	$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(multiboot_mod_CFLAGS) -c -o $@ $<
 
-mod-_multiboot.c: $(builddir)/moddep.lst $(srcdir)/genmodsrc.sh
-	sh $(srcdir)/genmodsrc.sh '_multiboot' $< > $@ || (rm -f $@; exit 1)
+mod-multiboot.c: $(builddir)/moddep.lst $(srcdir)/genmodsrc.sh
+	sh $(srcdir)/genmodsrc.sh 'multiboot' $< > $@ || (rm -f $@; exit 1)
 
-ifneq ($(_multiboot_mod_EXPORTS),no)
-def-_multiboot.lst: pre-_multiboot.o
-	$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 _multiboot/' > $@
+ifneq ($(multiboot_mod_EXPORTS),no)
+def-multiboot.lst: pre-multiboot.o
+	$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 multiboot/' > $@
 endif
 
-und-_multiboot.lst: pre-_multiboot.o
-	echo '_multiboot' > $@
+und-multiboot.lst: pre-multiboot.o
+	echo 'multiboot' > $@
 	$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
 
-_multiboot_mod-loader_i386_multiboot.o: loader/i386/multiboot.c $(loader/i386/multiboot.c_DEPENDENCIES)
-	$(TARGET_CC) -Iloader/i386 -I$(srcdir)/loader/i386 $(TARGET_CPPFLAGS)  $(TARGET_CFLAGS) $(_multiboot_mod_CFLAGS) -MD -c -o $@ $<
--include _multiboot_mod-loader_i386_multiboot.d
+multiboot_mod-loader_i386_multiboot.o: loader/i386/multiboot.c $(loader/i386/multiboot.c_DEPENDENCIES)
+	$(TARGET_CC) -Iloader/i386 -I$(srcdir)/loader/i386 $(TARGET_CPPFLAGS)  $(TARGET_CFLAGS) $(multiboot_mod_CFLAGS) -MD -c -o $@ $<
+-include multiboot_mod-loader_i386_multiboot.d
 
-CLEANFILES += cmd-_multiboot_mod-loader_i386_multiboot.lst fs-_multiboot_mod-loader_i386_multiboot.lst partmap-_multiboot_mod-loader_i386_multiboot.lst
-COMMANDFILES += cmd-_multiboot_mod-loader_i386_multiboot.lst
-FSFILES += fs-_multiboot_mod-loader_i386_multiboot.lst
-PARTMAPFILES += partmap-_multiboot_mod-loader_i386_multiboot.lst
+CLEANFILES += cmd-multiboot_mod-loader_i386_multiboot.lst fs-multiboot_mod-loader_i386_multiboot.lst partmap-multiboot_mod-loader_i386_multiboot.lst
+COMMANDFILES += cmd-multiboot_mod-loader_i386_multiboot.lst
+FSFILES += fs-multiboot_mod-loader_i386_multiboot.lst
+PARTMAPFILES += partmap-multiboot_mod-loader_i386_multiboot.lst
 
-cmd-_multiboot_mod-loader_i386_multiboot.lst: loader/i386/multiboot.c $(loader/i386/multiboot.c_DEPENDENCIES) gencmdlist.sh
-	set -e; 	  $(TARGET_CC) -Iloader/i386 -I$(srcdir)/loader/i386 $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(_multiboot_mod_CFLAGS) -E $< 	  | sh $(srcdir)/gencmdlist.sh _multiboot > $@ || (rm -f $@; exit 1)
+cmd-multiboot_mod-loader_i386_multiboot.lst: loader/i386/multiboot.c $(loader/i386/multiboot.c_DEPENDENCIES) gencmdlist.sh
+	set -e; 	  $(TARGET_CC) -Iloader/i386 -I$(srcdir)/loader/i386 $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(multiboot_mod_CFLAGS) -E $< 	  | sh $(srcdir)/gencmdlist.sh multiboot > $@ || (rm -f $@; exit 1)
 
-fs-_multiboot_mod-loader_i386_multiboot.lst: loader/i386/multiboot.c $(loader/i386/multiboot.c_DEPENDENCIES) genfslist.sh
-	set -e; 	  $(TARGET_CC) -Iloader/i386 -I$(srcdir)/loader/i386 $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(_multiboot_mod_CFLAGS) -E $< 	  | sh $(srcdir)/genfslist.sh _multiboot > $@ || (rm -f $@; exit 1)
+fs-multiboot_mod-loader_i386_multiboot.lst: loader/i386/multiboot.c $(loader/i386/multiboot.c_DEPENDENCIES) genfslist.sh
+	set -e; 	  $(TARGET_CC) -Iloader/i386 -I$(srcdir)/loader/i386 $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(multiboot_mod_CFLAGS) -E $< 	  | sh $(srcdir)/genfslist.sh multiboot > $@ || (rm -f $@; exit 1)
 
-partmap-_multiboot_mod-loader_i386_multiboot.lst: loader/i386/multiboot.c $(loader/i386/multiboot.c_DEPENDENCIES) genpartmaplist.sh
-	set -e; 	  $(TARGET_CC) -Iloader/i386 -I$(srcdir)/loader/i386 $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(_multiboot_mod_CFLAGS) -E $< 	  | sh $(srcdir)/genpartmaplist.sh _multiboot > $@ || (rm -f $@; exit 1)
+partmap-multiboot_mod-loader_i386_multiboot.lst: loader/i386/multiboot.c $(loader/i386/multiboot.c_DEPENDENCIES) genpartmaplist.sh
+	set -e; 	  $(TARGET_CC) -Iloader/i386 -I$(srcdir)/loader/i386 $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(multiboot_mod_CFLAGS) -E $< 	  | sh $(srcdir)/genpartmaplist.sh multiboot > $@ || (rm -f $@; exit 1)
 
 
-_multiboot_mod-loader_i386_pc_multiboot2.o: loader/i386/pc/multiboot2.c $(loader/i386/pc/multiboot2.c_DEPENDENCIES)
-	$(TARGET_CC) -Iloader/i386/pc -I$(srcdir)/loader/i386/pc $(TARGET_CPPFLAGS)  $(TARGET_CFLAGS) $(_multiboot_mod_CFLAGS) -MD -c -o $@ $<
--include _multiboot_mod-loader_i386_pc_multiboot2.d
+multiboot_mod-loader_i386_pc_multiboot2.o: loader/i386/pc/multiboot2.c $(loader/i386/pc/multiboot2.c_DEPENDENCIES)
+	$(TARGET_CC) -Iloader/i386/pc -I$(srcdir)/loader/i386/pc $(TARGET_CPPFLAGS)  $(TARGET_CFLAGS) $(multiboot_mod_CFLAGS) -MD -c -o $@ $<
+-include multiboot_mod-loader_i386_pc_multiboot2.d
 
-CLEANFILES += cmd-_multiboot_mod-loader_i386_pc_multiboot2.lst fs-_multiboot_mod-loader_i386_pc_multiboot2.lst partmap-_multiboot_mod-loader_i386_pc_multiboot2.lst
-COMMANDFILES += cmd-_multiboot_mod-loader_i386_pc_multiboot2.lst
-FSFILES += fs-_multiboot_mod-loader_i386_pc_multiboot2.lst
-PARTMAPFILES += partmap-_multiboot_mod-loader_i386_pc_multiboot2.lst
+CLEANFILES += cmd-multiboot_mod-loader_i386_pc_multiboot2.lst fs-multiboot_mod-loader_i386_pc_multiboot2.lst partmap-multiboot_mod-loader_i386_pc_multiboot2.lst
+COMMANDFILES += cmd-multiboot_mod-loader_i386_pc_multiboot2.lst
+FSFILES += fs-multiboot_mod-loader_i386_pc_multiboot2.lst
+PARTMAPFILES += partmap-multiboot_mod-loader_i386_pc_multiboot2.lst
 
-cmd-_multiboot_mod-loader_i386_pc_multiboot2.lst: loader/i386/pc/multiboot2.c $(loader/i386/pc/multiboot2.c_DEPENDENCIES) gencmdlist.sh
-	set -e; 	  $(TARGET_CC) -Iloader/i386/pc -I$(srcdir)/loader/i386/pc $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(_multiboot_mod_CFLAGS) -E $< 	  | sh $(srcdir)/gencmdlist.sh _multiboot > $@ || (rm -f $@; exit 1)
+cmd-multiboot_mod-loader_i386_pc_multiboot2.lst: loader/i386/pc/multiboot2.c $(loader/i386/pc/multiboot2.c_DEPENDENCIES) gencmdlist.sh
+	set -e; 	  $(TARGET_CC) -Iloader/i386/pc -I$(srcdir)/loader/i386/pc $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(multiboot_mod_CFLAGS) -E $< 	  | sh $(srcdir)/gencmdlist.sh multiboot > $@ || (rm -f $@; exit 1)
 
-fs-_multiboot_mod-loader_i386_pc_multiboot2.lst: loader/i386/pc/multiboot2.c $(loader/i386/pc/multiboot2.c_DEPENDENCIES) genfslist.sh
-	set -e; 	  $(TARGET_CC) -Iloader/i386/pc -I$(srcdir)/loader/i386/pc $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(_multiboot_mod_CFLAGS) -E $< 	  | sh $(srcdir)/genfslist.sh _multiboot > $@ || (rm -f $@; exit 1)
+fs-multiboot_mod-loader_i386_pc_multiboot2.lst: loader/i386/pc/multiboot2.c $(loader/i386/pc/multiboot2.c_DEPENDENCIES) genfslist.sh
+	set -e; 	  $(TARGET_CC) -Iloader/i386/pc -I$(srcdir)/loader/i386/pc $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(multiboot_mod_CFLAGS) -E $< 	  | sh $(srcdir)/genfslist.sh multiboot > $@ || (rm -f $@; exit 1)
 
-partmap-_multiboot_mod-loader_i386_pc_multiboot2.lst: loader/i386/pc/multiboot2.c $(loader/i386/pc/multiboot2.c_DEPENDENCIES) genpartmaplist.sh
-	set -e; 	  $(TARGET_CC) -Iloader/i386/pc -I$(srcdir)/loader/i386/pc $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(_multiboot_mod_CFLAGS) -E $< 	  | sh $(srcdir)/genpartmaplist.sh _multiboot > $@ || (rm -f $@; exit 1)
+partmap-multiboot_mod-loader_i386_pc_multiboot2.lst: loader/i386/pc/multiboot2.c $(loader/i386/pc/multiboot2.c_DEPENDENCIES) genpartmaplist.sh
+	set -e; 	  $(TARGET_CC) -Iloader/i386/pc -I$(srcdir)/loader/i386/pc $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(multiboot_mod_CFLAGS) -E $< 	  | sh $(srcdir)/genpartmaplist.sh multiboot > $@ || (rm -f $@; exit 1)
 
 
-_multiboot_mod-loader_multiboot2.o: loader/multiboot2.c $(loader/multiboot2.c_DEPENDENCIES)
-	$(TARGET_CC) -Iloader -I$(srcdir)/loader $(TARGET_CPPFLAGS)  $(TARGET_CFLAGS) $(_multiboot_mod_CFLAGS) -MD -c -o $@ $<
--include _multiboot_mod-loader_multiboot2.d
+multiboot_mod-loader_multiboot2.o: loader/multiboot2.c $(loader/multiboot2.c_DEPENDENCIES)
+	$(TARGET_CC) -Iloader -I$(srcdir)/loader $(TARGET_CPPFLAGS)  $(TARGET_CFLAGS) $(multiboot_mod_CFLAGS) -MD -c -o $@ $<
+-include multiboot_mod-loader_multiboot2.d
 
-CLEANFILES += cmd-_multiboot_mod-loader_multiboot2.lst fs-_multiboot_mod-loader_multiboot2.lst partmap-_multiboot_mod-loader_multiboot2.lst
-COMMANDFILES += cmd-_multiboot_mod-loader_multiboot2.lst
-FSFILES += fs-_multiboot_mod-loader_multiboot2.lst
-PARTMAPFILES += partmap-_multiboot_mod-loader_multiboot2.lst
+CLEANFILES += cmd-multiboot_mod-loader_multiboot2.lst fs-multiboot_mod-loader_multiboot2.lst partmap-multiboot_mod-loader_multiboot2.lst
+COMMANDFILES += cmd-multiboot_mod-loader_multiboot2.lst
+FSFILES += fs-multiboot_mod-loader_multiboot2.lst
+PARTMAPFILES += partmap-multiboot_mod-loader_multiboot2.lst
 
-cmd-_multiboot_mod-loader_multiboot2.lst: loader/multiboot2.c $(loader/multiboot2.c_DEPENDENCIES) gencmdlist.sh
-	set -e; 	  $(TARGET_CC) -Iloader -I$(srcdir)/loader $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(_multiboot_mod_CFLAGS) -E $< 	  | sh $(srcdir)/gencmdlist.sh _multiboot > $@ || (rm -f $@; exit 1)
+cmd-multiboot_mod-loader_multiboot2.lst: loader/multiboot2.c $(loader/multiboot2.c_DEPENDENCIES) gencmdlist.sh
+	set -e; 	  $(TARGET_CC) -Iloader -I$(srcdir)/loader $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(multiboot_mod_CFLAGS) -E $< 	  | sh $(srcdir)/gencmdlist.sh multiboot > $@ || (rm -f $@; exit 1)
 

@@ Diff output truncated at 153600 characters. @@
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.