merge with mainline
This commit is contained in:
commit
2e1310bc7c
87 changed files with 830 additions and 1072 deletions
|
@ -2,6 +2,7 @@
|
||||||
10_*
|
10_*
|
||||||
30_os-prober
|
30_os-prober
|
||||||
40_custom
|
40_custom
|
||||||
|
41_custom
|
||||||
aclocal.m4
|
aclocal.m4
|
||||||
ascii.bitmaps
|
ascii.bitmaps
|
||||||
ascii.h
|
ascii.h
|
||||||
|
|
238
ChangeLog
238
ChangeLog
|
@ -1,3 +1,241 @@
|
||||||
|
2010-06-12 BVK Chaitanya <bvk.groups@gmail.com>
|
||||||
|
|
||||||
|
Add "-o grub.iso" like cmdline options support.
|
||||||
|
|
||||||
|
* util/grub-install.in: Improve cmdline option parsing.
|
||||||
|
* util/grub-mkconfig.in: Likewise.
|
||||||
|
* util/grub-mkrescue.in: Likewise.
|
||||||
|
* util/grub-reboot.in: Likewise.
|
||||||
|
* util/grub-set-default.in: Likewise.
|
||||||
|
* util/i386/efi/grub-install.in: Likewise.
|
||||||
|
* util/ieee1275/grub-install.in: Likewise.
|
||||||
|
* util/powerpc/ieee1275/grub-mkrescue.in: Likewise.
|
||||||
|
|
||||||
|
2010-06-12 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
* .bzrignore: Ignore 41_custom.
|
||||||
|
|
||||||
|
2010-06-12 Thomas Schmitt <scdbackup@gmx.net>
|
||||||
|
|
||||||
|
* util/grub-mkrescue.in: Pass unrecognized options to xorriso.
|
||||||
|
|
||||||
|
2010-06-12 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
Avoid false positives in fs.lst, partmap.lst, and video.lst due to
|
||||||
|
prototype declarations.
|
||||||
|
|
||||||
|
* genmk.rb (PModule::rule): Define GRUB_LST_GENERATOR when
|
||||||
|
generating fs, partmap, and video lists.
|
||||||
|
* include/grub/fs.h (grub_fs_register): Omit prototype if
|
||||||
|
GRUB_LST_GENERATOR is defined.
|
||||||
|
* include/grub/partition.h (grub_partition_map_register): Likewise.
|
||||||
|
* include/grub/video.h (grub_video_register): Likewise.
|
||||||
|
|
||||||
|
2010-06-12 Javier Martín <lordhabbit@gmail.com>
|
||||||
|
|
||||||
|
* include/grub/types.h: Check for GRUB_CPU_SIZEOF_LONG when appropriate.
|
||||||
|
|
||||||
|
2010-06-12 Thomas Schmitt <scdbackup@gmx.net>
|
||||||
|
|
||||||
|
* util/grub-mkrescue.in: Support --xorriso argument.
|
||||||
|
|
||||||
|
2010-06-12 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* util/grub-mkrescue.in: Use -graft-points instead of -pathspecs.
|
||||||
|
Suggested by: Thomas Schmitt.
|
||||||
|
|
||||||
|
2010-06-12 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* util/grub-mkrescue.in: Add --sort-weight arguments to xorriso.
|
||||||
|
Suggested by: Thomas Schmitt.
|
||||||
|
|
||||||
|
2010-06-12 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
custom.cfg support.
|
||||||
|
|
||||||
|
* conf/common.rmk (grub-mkconfig_SCRIPTS): Add 41_custom.
|
||||||
|
* util/grub.d/41_custom.in: New file.
|
||||||
|
|
||||||
|
2010-06-12 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
* util/grub-mkrescue.in (make_image): Remove sh module, which has
|
||||||
|
been merged back into normal.
|
||||||
|
|
||||||
|
2010-06-11 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
* include/grub/efi/uga_draw.h (GRUB_EFI_UGA_GLT_MAX): Rename to ...
|
||||||
|
(GRUB_EFI_UGA_BLT_MAX): ... this (typo fix).
|
||||||
|
|
||||||
|
2010-06-11 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
* Makefile.in (install-local): Include $(srcdir)/docs/man/$$dest.h2m
|
||||||
|
when generating manual pages.
|
||||||
|
* docs/man/grub-bin2h.h2m: New file.
|
||||||
|
* docs/man/grub-editenv.h2m: New file.
|
||||||
|
* docs/man/grub-fstest.h2m: New file.
|
||||||
|
* docs/man/grub-install.h2m: New file.
|
||||||
|
* docs/man/grub-macho2img.h2m: New file.
|
||||||
|
* docs/man/grub-mkconfig.h2m: New file.
|
||||||
|
* docs/man/grub-mkdevicemap.h2m: New file.
|
||||||
|
* docs/man/grub-mkfont.h2m: New file.
|
||||||
|
* docs/man/grub-mkimage.h2m: New file.
|
||||||
|
* docs/man/grub-mkpasswd-pbkdf2.h2m: New file.
|
||||||
|
* docs/man/grub-mkrelpath.h2m: New file.
|
||||||
|
* docs/man/grub-mkrescue.h2m: New file.
|
||||||
|
* docs/man/grub-ofpathname.h2m: New file.
|
||||||
|
* docs/man/grub-pe2elf.h2m: New file.
|
||||||
|
* docs/man/grub-probe.h2m: New file.
|
||||||
|
* docs/man/grub-reboot.h2m: New file.
|
||||||
|
* docs/man/grub-script-check.h2m: New file.
|
||||||
|
* docs/man/grub-set-default.h2m: New file.
|
||||||
|
* docs/man/grub-setup.h2m: New file.
|
||||||
|
|
||||||
|
2010-06-10 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Use FOR_* macros instead of *_iterate whenever possible.
|
||||||
|
|
||||||
|
* commands/handler.c: Removed.
|
||||||
|
* commands/help.c (grub_cmd_help): Use FOR_COMMANDS.
|
||||||
|
* commands/minicmd.c (grub_mini_cmd_lsmod): Use FOR_DL_MODULES.
|
||||||
|
* conf/any-emu.rmk (kernel_img_SOURCES): Remove kern/handler.c.
|
||||||
|
* conf/common.rmk (script/lexer.c_DEPENDENCIES): Add grub_script.yy.h.
|
||||||
|
(grub_probe_SOURCES): Remove kern/parser.c.
|
||||||
|
(util/grub-script-check.c_DEPENDENCIES): Removed.
|
||||||
|
(grub_script_check_SOURCES): Remove kern/handler.c, kern/parser.c
|
||||||
|
and grub_script_check_init.c.
|
||||||
|
(grub_script_check_init.lst): Removed.
|
||||||
|
(grub_script_check_init.h): Likewise.
|
||||||
|
(grub_script_check_init.c): Likewise.
|
||||||
|
(pkglib_MODULES): Remove handler.mod and sh.mod.
|
||||||
|
(handler_mod_SOURCES): Removed.
|
||||||
|
(handler_mod_CFLAGS): Likewise.
|
||||||
|
(handler_mod_LDFLAGS): Likewise.
|
||||||
|
(normal_mod_SOURCES): Remove normal/handler.c.
|
||||||
|
Add script/main.c, script/script.c, script/execute.c,
|
||||||
|
script/function.c, script/lexer.c, grub_script.tab.c
|
||||||
|
and grub_script.yy.c.
|
||||||
|
* conf/i386-coreboot.rmk (kernel_img_SOURCES): Remove kern/handler.c.
|
||||||
|
* conf/i386-ieee1275.rmk (kernel_img_SOURCES): Likewise.
|
||||||
|
* conf/i386-pc.rmk (kernel_img_SOURCES): Likewise.
|
||||||
|
(grub_setup_SOURCES): Remove kern/parser.c.
|
||||||
|
* conf/i386-qemu.rmk (kernel_img_SOURCES): Remove kern/handler.c.
|
||||||
|
* conf/mips-qemu-mips.rmk (kernel_img_SOURCES): Likewise.
|
||||||
|
* conf/mips-yeeloong.rmk (kernel_img_SOURCES): Likewise.
|
||||||
|
* conf/powerpc-ieee1275.rmk (kernel_img_SOURCES): Likewise.
|
||||||
|
* conf/sparc64-ieee1275.rmk (kernel_img_SOURCES): Likewise.
|
||||||
|
(grub_setup_SOURCES): Remove kern/parser.c.
|
||||||
|
* conf/x86-efi.rmk (kernel_img_SOURCES): Remove kern/handler.c.
|
||||||
|
* gettext/gettext.c (grub_gettext_delete_list): Don't use grub_list_pop.
|
||||||
|
* include/grub/command.h (grub_command_iterate): Removed.
|
||||||
|
(FOR_COMMANDS): New macro.
|
||||||
|
* include/grub/dl.h (grub_dl): New member next.
|
||||||
|
(grub_dl_iterate): Removed.
|
||||||
|
(grub_dl_head): New variable declaration.
|
||||||
|
(FOR_DL_MODULES): New macro.
|
||||||
|
* include/grub/fs.h: Include list.h.
|
||||||
|
(grub_fs): Make next first element.
|
||||||
|
(grub_fs_list): New variable declaration.
|
||||||
|
(grub_fs_register): Make inline.
|
||||||
|
(grub_fs_unregister): Likewise.
|
||||||
|
(grub_fs_iterate): Removed.
|
||||||
|
(FOR_FILESYSTEMS): New macro.
|
||||||
|
* include/grub/handler.h: Removed.
|
||||||
|
* include/grub/list.h (grub_list_hook_t): Removed.
|
||||||
|
(grub_list_test_t): Likewise.
|
||||||
|
(grub_list_pop): Likewise.
|
||||||
|
(grub_list_iterate): Likewise.
|
||||||
|
(grub_list_insert): Likewise.
|
||||||
|
(FOR_LIST_ELEMENTS): New macro.
|
||||||
|
* include/grub/parser.h (grub_parser_class): Removed.
|
||||||
|
(grub_parser_register): Likewise.
|
||||||
|
(grub_parser_unregister): Likewise.
|
||||||
|
(grub_parser_get_current): Likewise.
|
||||||
|
(grub_parser_set_current): Likewise.
|
||||||
|
(grub_register_rescue_parser): Likewise.
|
||||||
|
(grub_rescue_parse_line): New function.
|
||||||
|
* include/grub/partition.h (FOR_PARTITION_MAPS): Use FOR_LIST_ELEMENTS.
|
||||||
|
* include/grub/script_sh.h (grub_script_function_list): New variable
|
||||||
|
declaration.
|
||||||
|
(FOR_SCRIPT_FUNCTIONS): New macro.
|
||||||
|
(grub_script_function_iterate): Removed.
|
||||||
|
(grub_normal_parse_line): New prototype.
|
||||||
|
* include/grub/term.h (FOR_ACTIVE_TERM_INPUTS): Use FOR_LIST_ELEMENTS.
|
||||||
|
(FOR_DISABLED_TERM_INPUTS): Likewise.
|
||||||
|
(FOR_ACTIVE_TERM_OUTPUTS): Likewise.
|
||||||
|
(FOR_DISABLED_TERM_OUTPUTS): Likewise.
|
||||||
|
* include/grub/video.h (grub_video_adapter): Move 'next' to first
|
||||||
|
element.
|
||||||
|
(grub_video_register): Inline.
|
||||||
|
(grub_video_unregister): Likewise.
|
||||||
|
(grub_video_adapter_list): New variable declaration.
|
||||||
|
(grub_video_iterate): Removed.
|
||||||
|
(FOR_VIDEO_ADAPTERS): New macro.
|
||||||
|
* kern/dl.c (grub_dl_list): Removed. All users updated.
|
||||||
|
(grub_dl_iterate): Removed.
|
||||||
|
* kern/fs.c (grub_fs_list): Make global.
|
||||||
|
(grub_fs_register): Removed.
|
||||||
|
(grub_fs_unregister): Likewise.
|
||||||
|
(grub_fs_iterate): Likewise.
|
||||||
|
* kern/handler.c: Removed.
|
||||||
|
* kern/list.c (grub_list_pop): Removed.
|
||||||
|
(grub_list_iterate): Likewise.
|
||||||
|
(grub_list_insert): Likewise.
|
||||||
|
(grub_named_list_find): Use FOR_LIST_ELEMENTS.
|
||||||
|
(grub_prio_list_insert): Don't use grub_list_insert.
|
||||||
|
* kern/main.c (grub_register_rescue_parser): Don't call
|
||||||
|
grub_register_rescue_parser.
|
||||||
|
* kern/parser.c (grub_parser_class): Removed.
|
||||||
|
(grub_parser_execute): Use grub_rescue_parse_line.
|
||||||
|
* kern/rescue_parser.c (grub_rescue_parse_line): Make global.
|
||||||
|
(grub_rescue_parser): Removed.
|
||||||
|
(grub_register_rescue_parser): Likewise.
|
||||||
|
* kern/rescue_reader.c (grub_rescue_run): Use grub_rescue_parse_line.
|
||||||
|
* normal/auth.c (is_authenticated): Use FOR_LIST_ELEMENTS.
|
||||||
|
(grub_auth_check_authentication): Likewise.
|
||||||
|
* normal/completion.c (iterate_command): Removed.
|
||||||
|
(grub_normal_do_completion): Use FOR_COMMANDS.
|
||||||
|
* normal/handler.c: Removed.
|
||||||
|
* normal/main.c (read_config_file): Remove parser changing.
|
||||||
|
(grub_normal_execute): Don't call read_handler_list.
|
||||||
|
(grub_normal_read_line_real): Statically allocate prompt.
|
||||||
|
(grub_cmdline_run): Use grub_normal_parse_line.
|
||||||
|
(GRUB_MOD_FINI): Don't call free_handler_list.
|
||||||
|
* normal/menu_entry.c (run): Likewise.
|
||||||
|
* script/function.c (grub_script_function_list): Make global.
|
||||||
|
(grub_script_function_iterate): Removed.
|
||||||
|
* script/main.c (grub_normal_parse_line): Make global.
|
||||||
|
(grub_sh_parser): Removed.
|
||||||
|
(GRUB_MOD_INIT): Likewise.
|
||||||
|
(GRUB_MOD_FINI): Likewise.
|
||||||
|
* tests/lib/functional_test.c (grub_functional_test): Use
|
||||||
|
FOR_LIST_ELEMENTS.
|
||||||
|
* tests/lib/test.c (free_failures): Don't use grub_list_pop.
|
||||||
|
(grub_test_run): Use FOR_LIST_ELEMENTS.
|
||||||
|
* tests/lib/unit_test.c (main): Likewise.
|
||||||
|
* util/deviceiter.c (grub_util_iterate_devices): Don't use
|
||||||
|
grub_list_pop.
|
||||||
|
* util/grub-fstest.c (grub_term_input_class): Removed.
|
||||||
|
(grub_term_output_class): Likewise.
|
||||||
|
* util/grub-probe.c: Likewise.
|
||||||
|
* util/i386/pc/grub-setup.c: Likewise.
|
||||||
|
* util/sparc64/ieee1275/grub-setup.c: Likewise.
|
||||||
|
* util/grub-script-check.c (main): Don't call grub_init_all and
|
||||||
|
grub_fini_all.
|
||||||
|
* video/video.c (grub_video_adapter_list): Make global.
|
||||||
|
(grub_video_register): Removed.
|
||||||
|
(grub_video_unregister): Likewise.
|
||||||
|
(grub_video_iterate): Likewise.
|
||||||
|
|
||||||
|
2010-06-09 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* docs/grub.texi (Vendor power-on button): Add Asus EeePC 1005PE as
|
||||||
|
reported by Henrique Ferreiro.
|
||||||
|
|
||||||
|
2010-06-09 Robert Millan <rmh@gnu.org>
|
||||||
|
|
||||||
|
* util/grub.d/10_linux.in: Prefer compressed images over non-compressed
|
||||||
|
ones, when both are available.
|
||||||
|
|
||||||
2010-06-08 Grégoire Sutre <gregoire.sutre@gmail.com>
|
2010-06-08 Grégoire Sutre <gregoire.sutre@gmail.com>
|
||||||
|
|
||||||
Make --version uniform and avoid hard-coded program name.
|
Make --version uniform and avoid hard-coded program name.
|
||||||
|
|
|
@ -323,26 +323,26 @@ install-local: all
|
||||||
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
||||||
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
||||||
$(INSTALL_PROGRAM) $$dir$$file $(DESTDIR)$(bindir)/$$dest; \
|
$(INSTALL_PROGRAM) $$dir$$file $(DESTDIR)$(bindir)/$$dest; \
|
||||||
$(HELP2MAN) --section=1 -o $(DESTDIR)$(mandir)/man1/$$dest.1 $(builddir)/$$file; \
|
$(HELP2MAN) --section=1 -i $(srcdir)/docs/man/$$dest.h2m -o $(DESTDIR)$(mandir)/man1/$$dest.1 $(builddir)/$$file; \
|
||||||
done
|
done
|
||||||
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(mandir)/man8
|
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(mandir)/man8
|
||||||
@list='$(sbin_UTILITIES)'; for file in $$list; do \
|
@list='$(sbin_UTILITIES)'; for file in $$list; do \
|
||||||
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
||||||
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
||||||
$(INSTALL_PROGRAM) $$dir$$file $(DESTDIR)$(sbindir)/$$dest; \
|
$(INSTALL_PROGRAM) $$dir$$file $(DESTDIR)$(sbindir)/$$dest; \
|
||||||
$(HELP2MAN) --section=8 -o $(DESTDIR)$(mandir)/man8/$$dest.8 $(builddir)/$$file; \
|
$(HELP2MAN) --section=8 -i $(srcdir)/docs/man/$$dest.h2m -o $(DESTDIR)$(mandir)/man8/$$dest.8 $(builddir)/$$file; \
|
||||||
done
|
done
|
||||||
@list='$(bin_SCRIPTS)'; for file in $$list; do \
|
@list='$(bin_SCRIPTS)'; for file in $$list; do \
|
||||||
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
||||||
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
||||||
$(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(bindir)/$$dest; \
|
$(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(bindir)/$$dest; \
|
||||||
$(HELP2MAN) --section=1 -o $(DESTDIR)$(mandir)/man1/$$dest.1 $(builddir)/$$file; \
|
$(HELP2MAN) --section=1 -i $(srcdir)/docs/man/$$dest.h2m -o $(DESTDIR)$(mandir)/man1/$$dest.1 $(builddir)/$$file; \
|
||||||
done
|
done
|
||||||
@list='$(sbin_SCRIPTS)'; for file in $$list; do \
|
@list='$(sbin_SCRIPTS)'; for file in $$list; do \
|
||||||
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
||||||
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
||||||
$(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(sbindir)/$$dest; \
|
$(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(sbindir)/$$dest; \
|
||||||
$(HELP2MAN) --section=8 -o $(DESTDIR)$(mandir)/man8/$$dest.8 $(builddir)/$$file; \
|
$(HELP2MAN) --section=8 -i $(srcdir)/docs/man/$$dest.h2m -o $(DESTDIR)$(mandir)/man8/$$dest.8 $(builddir)/$$file; \
|
||||||
done
|
done
|
||||||
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/grub.d
|
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/grub.d
|
||||||
@list='$(grub-mkconfig_SCRIPTS)'; for file in $$list; do \
|
@list='$(grub-mkconfig_SCRIPTS)'; for file in $$list; do \
|
||||||
|
|
|
@ -1,101 +0,0 @@
|
||||||
/* handler.c - commands to list or select handlers */
|
|
||||||
/*
|
|
||||||
* 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/dl.h>
|
|
||||||
#include <grub/err.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/term.h>
|
|
||||||
#include <grub/handler.h>
|
|
||||||
#include <grub/command.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_handler (struct grub_command *cmd __attribute__ ((unused)),
|
|
||||||
int argc, char **args)
|
|
||||||
{
|
|
||||||
void *curr_item = 0;
|
|
||||||
grub_handler_class_t head;
|
|
||||||
|
|
||||||
auto int list_item (grub_named_list_t item);
|
|
||||||
int list_item (grub_named_list_t item)
|
|
||||||
{
|
|
||||||
if (item == curr_item)
|
|
||||||
grub_putchar ('*');
|
|
||||||
|
|
||||||
grub_printf ("%s\n", item->name);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
head = grub_handler_class_list;
|
|
||||||
if (argc == 0)
|
|
||||||
{
|
|
||||||
grub_list_iterate (GRUB_AS_LIST (head), (grub_list_hook_t) list_item);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
char *class_name;
|
|
||||||
grub_handler_class_t class;
|
|
||||||
|
|
||||||
class_name = args[0];
|
|
||||||
argc--;
|
|
||||||
args++;
|
|
||||||
|
|
||||||
class = grub_named_list_find (GRUB_AS_NAMED_LIST (head), class_name);
|
|
||||||
if (! class)
|
|
||||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "class not found");
|
|
||||||
|
|
||||||
if (argc == 0)
|
|
||||||
{
|
|
||||||
curr_item = class->cur_handler;
|
|
||||||
grub_list_iterate (GRUB_AS_LIST (class->handler_list),
|
|
||||||
(grub_list_hook_t) list_item);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
grub_handler_t handler;
|
|
||||||
|
|
||||||
handler =
|
|
||||||
grub_named_list_find (GRUB_AS_NAMED_LIST (class->handler_list),
|
|
||||||
args[0]);
|
|
||||||
|
|
||||||
if (! handler)
|
|
||||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "handler not found");
|
|
||||||
|
|
||||||
grub_handler_set_current (class, handler);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd_handler;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(handler)
|
|
||||||
{
|
|
||||||
cmd_handler =
|
|
||||||
grub_register_command ("handler", grub_cmd_handler,
|
|
||||||
N_("[class [handler]]"),
|
|
||||||
N_("List or select a handler."));
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(handler)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd_handler);
|
|
||||||
}
|
|
145
commands/help.c
145
commands/help.c
|
@ -33,94 +33,87 @@ grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc,
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
char *currarg;
|
char *currarg;
|
||||||
|
|
||||||
auto int print_command_info (grub_command_t cmd);
|
|
||||||
auto int print_command_help (grub_command_t cmd);
|
|
||||||
|
|
||||||
int print_command_info (grub_command_t cmd)
|
|
||||||
{
|
|
||||||
if ((cmd->prio & GRUB_PRIO_LIST_FLAG_ACTIVE) &&
|
|
||||||
(cmd->flags & GRUB_COMMAND_FLAG_CMDLINE))
|
|
||||||
{
|
|
||||||
struct grub_term_output *term;
|
|
||||||
const char *summary_translated = _(cmd->summary);
|
|
||||||
char *command_help;
|
|
||||||
grub_uint32_t *unicode_command_help;
|
|
||||||
grub_uint32_t *unicode_last_position;
|
|
||||||
|
|
||||||
command_help = grub_xasprintf ("%s %s", cmd->name, summary_translated);
|
|
||||||
if (!command_help)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
grub_utf8_to_ucs4_alloc (command_help, &unicode_command_help,
|
|
||||||
&unicode_last_position);
|
|
||||||
|
|
||||||
FOR_ACTIVE_TERM_OUTPUTS(term)
|
|
||||||
{
|
|
||||||
unsigned stringwidth;
|
|
||||||
grub_uint32_t *unicode_last_screen_position;
|
|
||||||
|
|
||||||
unicode_last_screen_position = unicode_command_help;
|
|
||||||
|
|
||||||
stringwidth = 0;
|
|
||||||
|
|
||||||
while (unicode_last_screen_position < unicode_last_position &&
|
|
||||||
stringwidth < ((grub_term_width (term) / 2) - 2))
|
|
||||||
{
|
|
||||||
stringwidth
|
|
||||||
+= grub_term_getcharwidth (term,
|
|
||||||
*unicode_last_screen_position);
|
|
||||||
unicode_last_screen_position++;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_print_ucs4 (unicode_command_help,
|
|
||||||
unicode_last_screen_position, term);
|
|
||||||
if (!(cnt % 2))
|
|
||||||
grub_print_spaces (term, grub_term_width (term) / 2
|
|
||||||
- stringwidth);
|
|
||||||
}
|
|
||||||
if (cnt % 2)
|
|
||||||
grub_printf ("\n");
|
|
||||||
cnt++;
|
|
||||||
|
|
||||||
grub_free (command_help);
|
|
||||||
grub_free (unicode_command_help);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int print_command_help (grub_command_t cmd)
|
|
||||||
{
|
|
||||||
if (cmd->prio & GRUB_PRIO_LIST_FLAG_ACTIVE)
|
|
||||||
{
|
|
||||||
if (! grub_strncmp (cmd->name, currarg, grub_strlen (currarg)))
|
|
||||||
{
|
|
||||||
if (cnt++ > 0)
|
|
||||||
grub_printf ("\n\n");
|
|
||||||
|
|
||||||
if (cmd->flags & GRUB_COMMAND_FLAG_EXTCMD)
|
|
||||||
grub_arg_show_help ((grub_extcmd_t) cmd->data);
|
|
||||||
else
|
|
||||||
grub_printf ("%s %s %s\n%s\n", _("Usage:"), cmd->name, _(cmd->summary),
|
|
||||||
_(cmd->description));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (argc == 0)
|
if (argc == 0)
|
||||||
{
|
{
|
||||||
grub_command_iterate (print_command_info);
|
grub_command_t cmd;
|
||||||
|
FOR_COMMANDS(cmd)
|
||||||
|
{
|
||||||
|
if ((cmd->prio & GRUB_PRIO_LIST_FLAG_ACTIVE) &&
|
||||||
|
(cmd->flags & GRUB_COMMAND_FLAG_CMDLINE))
|
||||||
|
{
|
||||||
|
struct grub_term_output *term;
|
||||||
|
const char *summary_translated = _(cmd->summary);
|
||||||
|
char *command_help;
|
||||||
|
grub_uint32_t *unicode_command_help;
|
||||||
|
grub_uint32_t *unicode_last_position;
|
||||||
|
|
||||||
|
command_help = grub_xasprintf ("%s %s", cmd->name, summary_translated);
|
||||||
|
if (!command_help)
|
||||||
|
break;
|
||||||
|
|
||||||
|
grub_utf8_to_ucs4_alloc (command_help, &unicode_command_help,
|
||||||
|
&unicode_last_position);
|
||||||
|
|
||||||
|
FOR_ACTIVE_TERM_OUTPUTS(term)
|
||||||
|
{
|
||||||
|
unsigned stringwidth;
|
||||||
|
grub_uint32_t *unicode_last_screen_position;
|
||||||
|
|
||||||
|
unicode_last_screen_position = unicode_command_help;
|
||||||
|
|
||||||
|
stringwidth = 0;
|
||||||
|
|
||||||
|
while (unicode_last_screen_position < unicode_last_position &&
|
||||||
|
stringwidth < ((grub_term_width (term) / 2) - 2))
|
||||||
|
{
|
||||||
|
stringwidth
|
||||||
|
+= grub_term_getcharwidth (term,
|
||||||
|
*unicode_last_screen_position);
|
||||||
|
unicode_last_screen_position++;
|
||||||
|
}
|
||||||
|
|
||||||
|
grub_print_ucs4 (unicode_command_help,
|
||||||
|
unicode_last_screen_position, term);
|
||||||
|
if (!(cnt % 2))
|
||||||
|
grub_print_spaces (term, grub_term_width (term) / 2
|
||||||
|
- stringwidth);
|
||||||
|
}
|
||||||
|
if (cnt % 2)
|
||||||
|
grub_printf ("\n");
|
||||||
|
cnt++;
|
||||||
|
|
||||||
|
grub_free (command_help);
|
||||||
|
grub_free (unicode_command_help);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!(cnt % 2))
|
if (!(cnt % 2))
|
||||||
grub_printf ("\n");
|
grub_printf ("\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
grub_command_t cmd;
|
||||||
|
|
||||||
for (i = 0; i < argc; i++)
|
for (i = 0; i < argc; i++)
|
||||||
{
|
{
|
||||||
currarg = args[i];
|
currarg = args[i];
|
||||||
grub_command_iterate (print_command_help);
|
FOR_COMMANDS(cmd)
|
||||||
|
{
|
||||||
|
if (cmd->prio & GRUB_PRIO_LIST_FLAG_ACTIVE)
|
||||||
|
{
|
||||||
|
if (! grub_strncmp (cmd->name, currarg, grub_strlen (currarg)))
|
||||||
|
{
|
||||||
|
if (cnt++ > 0)
|
||||||
|
grub_printf ("\n\n");
|
||||||
|
|
||||||
|
if (cmd->flags & GRUB_COMMAND_FLAG_EXTCMD)
|
||||||
|
grub_arg_show_help ((grub_extcmd_t) cmd->data);
|
||||||
|
else
|
||||||
|
grub_printf ("%s %s %s\n%s\b", _("Usage:"), cmd->name, _(cmd->summary),
|
||||||
|
_(cmd->description));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -301,27 +301,23 @@ grub_mini_cmd_lsmod (struct grub_command *cmd __attribute__ ((unused)),
|
||||||
int argc __attribute__ ((unused)),
|
int argc __attribute__ ((unused)),
|
||||||
char *argv[] __attribute__ ((unused)))
|
char *argv[] __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
auto int print_module (grub_dl_t mod);
|
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');
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_printf ("Name\tRef Count\tDependencies\n");
|
grub_printf ("Name\tRef Count\tDependencies\n");
|
||||||
grub_dl_iterate (print_module);
|
FOR_DL_MODULES (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');
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
kernel_img_RELOCATABLE = yes
|
kernel_img_RELOCATABLE = yes
|
||||||
pkglib_PROGRAMS = kernel.img
|
pkglib_PROGRAMS = kernel.img
|
||||||
kernel_img_SOURCES = kern/device.c kern/disk.c kern/dl.c kern/env.c \
|
kernel_img_SOURCES = kern/device.c kern/disk.c kern/dl.c kern/env.c \
|
||||||
kern/err.c kern/list.c kern/handler.c kern/command.c \
|
kern/err.c kern/list.c kern/command.c \
|
||||||
kern/corecmd.c kern/file.c kern/fs.c kern/main.c kern/misc.c \
|
kern/corecmd.c kern/file.c kern/fs.c kern/main.c kern/misc.c \
|
||||||
kern/parser.c kern/partition.c kern/term.c \
|
kern/parser.c kern/partition.c kern/term.c \
|
||||||
kern/rescue_reader.c kern/rescue_parser.c \
|
kern/rescue_reader.c kern/rescue_parser.c \
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# -*- makefile -*-
|
# -*- makefile -*-
|
||||||
|
|
||||||
# Used by various components. These rules need to precede them.
|
# Used by various components. These rules need to precede them.
|
||||||
script/lexer.c_DEPENDENCIES = grub_script.tab.h
|
script/lexer.c_DEPENDENCIES = grub_script.tab.h grub_script.yy.h
|
||||||
|
|
||||||
sbin_UTILITIES += grub-mkdevicemap
|
sbin_UTILITIES += grub-mkdevicemap
|
||||||
grub_mkdevicemap_SOURCES = gnulib/progname.c util/grub-mkdevicemap.c \
|
grub_mkdevicemap_SOURCES = gnulib/progname.c util/grub-mkdevicemap.c \
|
||||||
|
@ -27,7 +27,7 @@ util/grub-probe.c_DEPENDENCIES = grub_probe_init.h
|
||||||
grub_probe_SOURCES = gnulib/progname.c util/grub-probe.c \
|
grub_probe_SOURCES = gnulib/progname.c util/grub-probe.c \
|
||||||
kern/emu/hostdisk.c util/misc.c kern/emu/misc.c kern/emu/getroot.c kern/emu/mm.c \
|
kern/emu/hostdisk.c util/misc.c kern/emu/misc.c kern/emu/getroot.c kern/emu/mm.c \
|
||||||
kern/device.c kern/disk.c kern/err.c kern/misc.c \
|
kern/device.c kern/disk.c kern/err.c kern/misc.c \
|
||||||
kern/parser.c kern/partition.c kern/file.c kern/list.c \
|
kern/partition.c kern/file.c kern/list.c \
|
||||||
\
|
\
|
||||||
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
|
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
|
||||||
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
||||||
|
@ -88,12 +88,11 @@ DISTCLEANFILES += grub_script.yy.c grub_script.yy.h
|
||||||
|
|
||||||
# For grub-script-check.
|
# For grub-script-check.
|
||||||
bin_UTILITIES += grub-script-check
|
bin_UTILITIES += grub-script-check
|
||||||
util/grub-script-check.c_DEPENDENCIES = grub_script_check_init.h
|
|
||||||
grub_script_check_SOURCES = gnulib/progname.c gnulib/getdelim.c gnulib/getline.c \
|
grub_script_check_SOURCES = gnulib/progname.c gnulib/getdelim.c gnulib/getline.c \
|
||||||
util/grub-script-check.c util/misc.c kern/emu/misc.c kern/emu/mm.c \
|
util/grub-script-check.c util/misc.c kern/emu/misc.c kern/emu/mm.c \
|
||||||
script/main.c script/script.c script/function.c script/lexer.c \
|
script/main.c script/script.c script/function.c script/lexer.c \
|
||||||
kern/handler.c kern/err.c kern/parser.c kern/list.c \
|
kern/err.c kern/list.c \
|
||||||
kern/misc.c kern/env.c grub_script_check_init.c grub_script.tab.c \
|
kern/misc.c kern/env.c grub_script.tab.c \
|
||||||
grub_script.yy.c
|
grub_script.yy.c
|
||||||
grub_script_check_CFLAGS = $(GNULIB_UTIL_CFLAGS)
|
grub_script_check_CFLAGS = $(GNULIB_UTIL_CFLAGS)
|
||||||
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
||||||
|
@ -102,7 +101,7 @@ DEFSYMFILES += kernel_syms.lst
|
||||||
kernel_img_HEADERS += boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
kernel_img_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 \
|
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
|
||||||
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
||||||
list.h handler.h command.h i18n.h env_private.h libgcc.h
|
list.h command.h i18n.h env_private.h libgcc.h
|
||||||
|
|
||||||
ifneq ($(platform), emu)
|
ifneq ($(platform), emu)
|
||||||
kernel_img_HEADERS += machine/memory.h machine/loader.h
|
kernel_img_HEADERS += machine/memory.h machine/loader.h
|
||||||
|
@ -119,19 +118,6 @@ grub_script.tab.c grub_script.tab.h: script/parser.y
|
||||||
$(YACC) -d -p grub_script_yy -b grub_script $(srcdir)/script/parser.y
|
$(YACC) -d -p grub_script_yy -b grub_script $(srcdir)/script/parser.y
|
||||||
DISTCLEANFILES += grub_script.tab.c grub_script.tab.h
|
DISTCLEANFILES += grub_script.tab.c grub_script.tab.h
|
||||||
|
|
||||||
# For grub-script-check.
|
|
||||||
grub_script_check_init.lst: geninit.sh $(filter-out grub_script_check_init.c,$(grub_script_check_SOURCES))
|
|
||||||
rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@
|
|
||||||
DISTCLEANFILES += grub_script_check_init.lst
|
|
||||||
|
|
||||||
grub_script_check_init.h: grub_script_check_init.lst $(filter-out grub_script_check_init.c,$(grub_script_check_SOURCES)) geninitheader.sh
|
|
||||||
rm -f $@; sh $(srcdir)/geninitheader.sh $< > $@
|
|
||||||
DISTCLEANFILES += grub_script_check_init.h
|
|
||||||
|
|
||||||
grub_script_check_init.c: grub_script_check_init.lst $(filter-out grub_script_check_init.c,$(grub_script_check_SOURCES)) geninit.sh
|
|
||||||
rm -f $@; sh $(srcdir)/geninit.sh $< $(filter %.c,$^) > $@
|
|
||||||
DISTCLEANFILES += grub_script_check_init.c
|
|
||||||
|
|
||||||
# For grub-probe.
|
# For grub-probe.
|
||||||
grub_probe_init.lst: geninit.sh $(filter-out grub_probe_init.c,$(grub_probe_SOURCES))
|
grub_probe_init.lst: geninit.sh $(filter-out grub_probe_init.c,$(grub_probe_SOURCES))
|
||||||
rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@
|
rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@
|
||||||
|
@ -215,7 +201,7 @@ CLEANFILES += grub-gettext_lib
|
||||||
%: util/grub.d/%.in config.status
|
%: util/grub.d/%.in config.status
|
||||||
./config.status --file=$@:$<
|
./config.status --file=$@:$<
|
||||||
chmod +x $@
|
chmod +x $@
|
||||||
grub-mkconfig_SCRIPTS = 00_header 30_os-prober 40_custom
|
grub-mkconfig_SCRIPTS = 00_header 30_os-prober 40_custom 41_custom
|
||||||
ifneq (, $(host_kernel))
|
ifneq (, $(host_kernel))
|
||||||
grub-mkconfig_SCRIPTS += 10_$(host_kernel)
|
grub-mkconfig_SCRIPTS += 10_$(host_kernel)
|
||||||
endif
|
endif
|
||||||
|
@ -448,12 +434,12 @@ scsi_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
scsi_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
scsi_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# Commands.
|
# Commands.
|
||||||
pkglib_MODULES += minicmd.mod extcmd.mod hello.mod handler.mod \
|
pkglib_MODULES += minicmd.mod extcmd.mod hello.mod \
|
||||||
ls.mod cmp.mod cat.mod help.mod search.mod loopback.mod \
|
ls.mod cmp.mod cat.mod help.mod search.mod loopback.mod \
|
||||||
configfile.mod echo.mod \
|
configfile.mod echo.mod \
|
||||||
terminfo.mod test.mod blocklist.mod hexdump.mod \
|
terminfo.mod test.mod blocklist.mod hexdump.mod \
|
||||||
read.mod sleep.mod loadenv.mod crc.mod parttool.mod \
|
read.mod sleep.mod loadenv.mod crc.mod parttool.mod \
|
||||||
msdospart.mod memrw.mod normal.mod sh.mod \
|
msdospart.mod memrw.mod normal.mod \
|
||||||
gptsync.mod true.mod probe.mod password.mod \
|
gptsync.mod true.mod probe.mod password.mod \
|
||||||
keystatus.mod
|
keystatus.mod
|
||||||
|
|
||||||
|
@ -514,11 +500,6 @@ msdospart_mod_SOURCES = parttool/msdospart.c
|
||||||
msdospart_mod_CFLAGS = $(COMMON_CFLAGS)
|
msdospart_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
msdospart_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
msdospart_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For handler.mod.
|
|
||||||
handler_mod_SOURCES = commands/handler.c
|
|
||||||
handler_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
handler_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For ls.mod.
|
# For ls.mod.
|
||||||
ls_mod_SOURCES = commands/ls.c
|
ls_mod_SOURCES = commands/ls.c
|
||||||
ls_mod_CFLAGS = $(COMMON_CFLAGS)
|
ls_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
@ -638,18 +619,14 @@ keystatus_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For normal.mod.
|
# For normal.mod.
|
||||||
normal_mod_SOURCES = normal/main.c normal/cmdline.c normal/dyncmd.c \
|
normal_mod_SOURCES = normal/main.c normal/cmdline.c normal/dyncmd.c \
|
||||||
normal/auth.c normal/autofs.c normal/handler.c \
|
normal/auth.c normal/autofs.c \
|
||||||
normal/color.c normal/completion.c normal/datetime.c normal/menu.c \
|
normal/color.c normal/completion.c normal/datetime.c normal/menu.c \
|
||||||
normal/menu_entry.c normal/menu_text.c \
|
normal/menu_entry.c normal/menu_text.c \
|
||||||
normal/misc.c normal/crypto.c normal/term.c normal/context.c
|
normal/misc.c normal/crypto.c normal/term.c normal/context.c \
|
||||||
normal_mod_CFLAGS = $(COMMON_CFLAGS)
|
script/main.c script/script.c script/execute.c \
|
||||||
normal_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For sh.mod.
|
|
||||||
sh_mod_SOURCES = script/main.c script/script.c script/execute.c \
|
|
||||||
script/function.c script/lexer.c grub_script.tab.c grub_script.yy.c
|
script/function.c script/lexer.c grub_script.tab.c grub_script.yy.c
|
||||||
sh_mod_CFLAGS = $(COMMON_CFLAGS) $(POSIX_CFLAGS) -Wno-error
|
normal_mod_CFLAGS = $(COMMON_CFLAGS) $(POSIX_CFLAGS) -Wno-error
|
||||||
sh_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
normal_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
ifneq (, $(FONT_SOURCE))
|
ifneq (, $(FONT_SOURCE))
|
||||||
font/font.c_DEPENDENCIES = ascii.h
|
font/font.c_DEPENDENCIES = ascii.h
|
||||||
|
|
|
@ -14,7 +14,7 @@ kernel_img_SOURCES = kern/i386/coreboot/startup.S \
|
||||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||||
kern/misc.c kern/mm.c kern/term.c \
|
kern/misc.c kern/mm.c kern/term.c \
|
||||||
kern/rescue_parser.c kern/rescue_reader.c \
|
kern/rescue_parser.c kern/rescue_reader.c \
|
||||||
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
kern/time.c kern/list.c kern/command.c kern/corecmd.c \
|
||||||
kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
|
kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
|
||||||
kern/i386/tsc.c kern/i386/pit.c \
|
kern/i386/tsc.c kern/i386/pit.c \
|
||||||
kern/generic/rtc_get_time_ms.c \
|
kern/generic/rtc_get_time_ms.c \
|
||||||
|
|
|
@ -18,7 +18,7 @@ kernel_img_SOURCES = kern/i386/ieee1275/startup.S \
|
||||||
kern/rescue_parser.c kern/rescue_reader.c \
|
kern/rescue_parser.c kern/rescue_reader.c \
|
||||||
kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
|
kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
|
||||||
kern/env.c \
|
kern/env.c \
|
||||||
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
kern/time.c kern/list.c kern/command.c kern/corecmd.c \
|
||||||
kern/generic/millisleep.c \
|
kern/generic/millisleep.c \
|
||||||
kern/ieee1275/ieee1275.c \
|
kern/ieee1275/ieee1275.c \
|
||||||
term/ieee1275/ofconsole.c \
|
term/ieee1275/ofconsole.c \
|
||||||
|
|
|
@ -43,7 +43,7 @@ kernel_img_SOURCES = kern/i386/pc/startup.S \
|
||||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||||
kern/misc.c kern/mm.c kern/term.c \
|
kern/misc.c kern/mm.c kern/term.c \
|
||||||
kern/rescue_parser.c kern/rescue_reader.c \
|
kern/rescue_parser.c kern/rescue_reader.c \
|
||||||
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
kern/time.c kern/list.c kern/command.c kern/corecmd.c \
|
||||||
kern/$(target_cpu)/dl.c kern/i386/pc/init.c kern/i386/pc/mmap.c \
|
kern/$(target_cpu)/dl.c kern/i386/pc/init.c kern/i386/pc/mmap.c \
|
||||||
kern/parser.c kern/partition.c \
|
kern/parser.c kern/partition.c \
|
||||||
kern/i386/tsc.c kern/i386/pit.c \
|
kern/i386/tsc.c kern/i386/pit.c \
|
||||||
|
@ -66,7 +66,7 @@ util/i386/pc/grub-setup.c_DEPENDENCIES = grub_setup_init.h
|
||||||
grub_setup_SOURCES = gnulib/progname.c util/i386/pc/grub-setup.c \
|
grub_setup_SOURCES = gnulib/progname.c util/i386/pc/grub-setup.c \
|
||||||
util/misc.c kern/emu/misc.c kern/emu/getroot.c \
|
util/misc.c kern/emu/misc.c kern/emu/getroot.c \
|
||||||
kern/emu/hostdisk.c kern/device.c kern/disk.c kern/err.c \
|
kern/emu/hostdisk.c kern/device.c kern/disk.c kern/err.c \
|
||||||
kern/misc.c kern/parser.c kern/partition.c kern/file.c \
|
kern/misc.c kern/partition.c kern/file.c \
|
||||||
kern/emu/mm.c kern/fs.c kern/env.c kern/list.c fs/fshelp.c \
|
kern/emu/mm.c kern/fs.c kern/env.c kern/list.c fs/fshelp.c \
|
||||||
\
|
\
|
||||||
fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \
|
fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \
|
||||||
|
|
|
@ -23,7 +23,7 @@ kernel_img_SOURCES = kern/i386/qemu/startup.S \
|
||||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||||
kern/misc.c kern/mm.c kern/term.c \
|
kern/misc.c kern/mm.c kern/term.c \
|
||||||
kern/rescue_parser.c kern/rescue_reader.c \
|
kern/rescue_parser.c kern/rescue_reader.c \
|
||||||
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
kern/time.c kern/list.c kern/command.c kern/corecmd.c \
|
||||||
kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
|
kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
|
||||||
kern/i386/tsc.c kern/i386/pit.c \
|
kern/i386/tsc.c kern/i386/pit.c \
|
||||||
kern/generic/rtc_get_time_ms.c \
|
kern/generic/rtc_get_time_ms.c \
|
||||||
|
|
|
@ -12,7 +12,7 @@ kernel_img_SOURCES = kern/$(target_cpu)/startup.S \
|
||||||
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
|
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
|
||||||
kern/misc.c kern/mm.c kern/term.c \
|
kern/misc.c kern/mm.c kern/term.c \
|
||||||
kern/rescue_parser.c kern/rescue_reader.c \
|
kern/rescue_parser.c kern/rescue_reader.c \
|
||||||
kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
kern/list.c kern/command.c kern/corecmd.c \
|
||||||
kern/parser.c kern/partition.c kern/env.c kern/$(target_cpu)/dl.c \
|
kern/parser.c kern/partition.c kern/env.c kern/$(target_cpu)/dl.c \
|
||||||
kern/generic/millisleep.c kern/generic/rtc_get_time_ms.c kern/time.c \
|
kern/generic/millisleep.c kern/generic/rtc_get_time_ms.c kern/time.c \
|
||||||
symlist.c kern/$(target_cpu)/cache.S
|
symlist.c kern/$(target_cpu)/cache.S
|
||||||
|
|
|
@ -16,7 +16,7 @@ kernel_img_SOURCES = kern/$(target_cpu)/startup.S \
|
||||||
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
|
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
|
||||||
kern/misc.c kern/mm.c kern/term.c \
|
kern/misc.c kern/mm.c kern/term.c \
|
||||||
kern/rescue_parser.c kern/rescue_reader.c \
|
kern/rescue_parser.c kern/rescue_reader.c \
|
||||||
kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
kern/list.c kern/command.c kern/corecmd.c \
|
||||||
kern/parser.c kern/partition.c kern/env.c kern/$(target_cpu)/dl.c \
|
kern/parser.c kern/partition.c kern/env.c kern/$(target_cpu)/dl.c \
|
||||||
kern/generic/millisleep.c kern/generic/rtc_get_time_ms.c kern/time.c \
|
kern/generic/millisleep.c kern/generic/rtc_get_time_ms.c kern/time.c \
|
||||||
kern/$(target_cpu)/cache.S \
|
kern/$(target_cpu)/cache.S \
|
||||||
|
|
|
@ -13,7 +13,7 @@ kernel_img_SOURCES = kern/powerpc/ieee1275/startup.S kern/ieee1275/cmain.c \
|
||||||
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
|
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
|
||||||
kern/misc.c kern/mm.c kern/term.c \
|
kern/misc.c kern/mm.c kern/term.c \
|
||||||
kern/rescue_parser.c kern/rescue_reader.c \
|
kern/rescue_parser.c kern/rescue_reader.c \
|
||||||
kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
kern/list.c kern/command.c kern/corecmd.c \
|
||||||
kern/ieee1275/init.c \
|
kern/ieee1275/init.c \
|
||||||
kern/ieee1275/mmap.c \
|
kern/ieee1275/mmap.c \
|
||||||
term/ieee1275/ofconsole.c \
|
term/ieee1275/ofconsole.c \
|
||||||
|
|
|
@ -26,7 +26,7 @@ kernel_img_SOURCES = kern/sparc64/ieee1275/crt0.S kern/ieee1275/cmain.c \
|
||||||
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
|
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
|
||||||
kern/misc.c kern/mm.c kern/term.c \
|
kern/misc.c kern/mm.c kern/term.c \
|
||||||
kern/rescue_parser.c kern/rescue_reader.c \
|
kern/rescue_parser.c kern/rescue_reader.c \
|
||||||
kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
kern/list.c kern/command.c kern/corecmd.c \
|
||||||
kern/sparc64/ieee1275/ieee1275.c \
|
kern/sparc64/ieee1275/ieee1275.c \
|
||||||
kern/sparc64/ieee1275/init.c \
|
kern/sparc64/ieee1275/init.c \
|
||||||
kern/ieee1275/mmap.c \
|
kern/ieee1275/mmap.c \
|
||||||
|
@ -48,7 +48,7 @@ util/sparc64/ieee1275/grub-setup.c_DEPENDENCIES = grub_setup_init.h
|
||||||
grub_setup_SOURCES = util/sparc64/ieee1275/grub-setup.c \
|
grub_setup_SOURCES = util/sparc64/ieee1275/grub-setup.c \
|
||||||
util/ieee1275/ofpath.c util/misc.c kern/emu/hostdisk.c \
|
util/ieee1275/ofpath.c util/misc.c kern/emu/hostdisk.c \
|
||||||
kern/emu/misc.c kern/emu/getroot.c kern/emu/mm.c kern/device.c \
|
kern/emu/misc.c kern/emu/getroot.c kern/emu/mm.c kern/device.c \
|
||||||
kern/disk.c kern/err.c kern/misc.c kern/parser.c \
|
kern/disk.c kern/err.c kern/misc.c \
|
||||||
kern/partition.c kern/file.c kern/fs.c kern/env.c kern/list.c \
|
kern/partition.c kern/file.c kern/fs.c kern/env.c kern/list.c \
|
||||||
fs/fshelp.c \
|
fs/fshelp.c \
|
||||||
\
|
\
|
||||||
|
|
|
@ -25,7 +25,7 @@ kernel_img_SOURCES = kern/$(target_cpu)/efi/startup.S kern/main.c kern/device.c
|
||||||
kern/$(target_cpu)/dl.c kern/i386/efi/init.c kern/parser.c kern/partition.c \
|
kern/$(target_cpu)/dl.c kern/i386/efi/init.c kern/parser.c kern/partition.c \
|
||||||
kern/env.c symlist.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c \
|
kern/env.c symlist.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c \
|
||||||
term/efi/console.c disk/efi/efidisk.c \
|
term/efi/console.c disk/efi/efidisk.c \
|
||||||
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
kern/time.c kern/list.c kern/command.c kern/corecmd.c \
|
||||||
kern/i386/tsc.c kern/i386/pit.c \
|
kern/i386/tsc.c kern/i386/pit.c \
|
||||||
kern/generic/rtc_get_time_ms.c \
|
kern/generic/rtc_get_time_ms.c \
|
||||||
kern/generic/millisleep.c
|
kern/generic/millisleep.c
|
||||||
|
|
|
@ -1123,6 +1123,8 @@ Values known to GRUB team are:
|
||||||
@table @key
|
@table @key
|
||||||
@item Dell XPS M1530
|
@item Dell XPS M1530
|
||||||
85:3
|
85:3
|
||||||
|
@item Asus EeePC 1005PE
|
||||||
|
84:1 (unconfirmed)
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
To take full advantage of this function install GRUB into MBR.
|
To take full advantage of this function install GRUB into MBR.
|
||||||
|
|
2
docs/man/grub-bin2h.h2m
Normal file
2
docs/man/grub-bin2h.h2m
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[NAME]
|
||||||
|
grub-bin2h \- convert a binary file to a C header
|
2
docs/man/grub-editenv.h2m
Normal file
2
docs/man/grub-editenv.h2m
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[NAME]
|
||||||
|
grub-editenv \- edit GRUB environment block
|
2
docs/man/grub-fstest.h2m
Normal file
2
docs/man/grub-fstest.h2m
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[NAME]
|
||||||
|
grub-fstest \- debug tool for GRUB filesystem drivers
|
2
docs/man/grub-install.h2m
Normal file
2
docs/man/grub-install.h2m
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[NAME]
|
||||||
|
grub-install \- install GRUB to a device
|
2
docs/man/grub-macho2img.h2m
Normal file
2
docs/man/grub-macho2img.h2m
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[NAME]
|
||||||
|
grub-macho2img \- convert Mach-O to raw image
|
2
docs/man/grub-mkconfig.h2m
Normal file
2
docs/man/grub-mkconfig.h2m
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[NAME]
|
||||||
|
grub-mkconfig \- generate a GRUB configuration file
|
2
docs/man/grub-mkdevicemap.h2m
Normal file
2
docs/man/grub-mkdevicemap.h2m
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[NAME]
|
||||||
|
grub-mkdevicemap \- generate a GRUB device map file automatically
|
2
docs/man/grub-mkfont.h2m
Normal file
2
docs/man/grub-mkfont.h2m
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[NAME]
|
||||||
|
grub-mkfont \- make GRUB font files
|
2
docs/man/grub-mkimage.h2m
Normal file
2
docs/man/grub-mkimage.h2m
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[NAME]
|
||||||
|
grub-mkimage \- make a bootable image of GRUB
|
2
docs/man/grub-mkpasswd-pbkdf2.h2m
Normal file
2
docs/man/grub-mkpasswd-pbkdf2.h2m
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[NAME]
|
||||||
|
grub-mkpasswd-pbkdf2 \- generate hashed password for GRUB
|
2
docs/man/grub-mkrelpath.h2m
Normal file
2
docs/man/grub-mkrelpath.h2m
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[NAME]
|
||||||
|
grub-mkrelpath \- make a system path relative to its root
|
2
docs/man/grub-mkrescue.h2m
Normal file
2
docs/man/grub-mkrescue.h2m
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[NAME]
|
||||||
|
grub-mkrescue \- make a GRUB rescue image
|
2
docs/man/grub-ofpathname.h2m
Normal file
2
docs/man/grub-ofpathname.h2m
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[NAME]
|
||||||
|
grub-ofpathname \- find OpenBOOT path for a device
|
2
docs/man/grub-pe2elf.h2m
Normal file
2
docs/man/grub-pe2elf.h2m
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[NAME]
|
||||||
|
grub-pe2elf \- convert PE image to ELF
|
2
docs/man/grub-probe.h2m
Normal file
2
docs/man/grub-probe.h2m
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[NAME]
|
||||||
|
grub-probe \- probe device information for GRUB
|
2
docs/man/grub-reboot.h2m
Normal file
2
docs/man/grub-reboot.h2m
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[NAME]
|
||||||
|
grub-reboot \- set the default boot entry for GRUB, for the next boot only
|
2
docs/man/grub-script-check.h2m
Normal file
2
docs/man/grub-script-check.h2m
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[NAME]
|
||||||
|
grub-script-check \- check grub.cfg for syntax errors
|
2
docs/man/grub-set-default.h2m
Normal file
2
docs/man/grub-set-default.h2m
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[NAME]
|
||||||
|
grub-set-default \- set the default boot entry for GRUB
|
2
docs/man/grub-setup.h2m
Normal file
2
docs/man/grub-setup.h2m
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[NAME]
|
||||||
|
grub-setup \- set up a device to boot using GRUB
|
6
genmk.rb
6
genmk.rb
|
@ -228,7 +228,7 @@ VIDEOFILES += #{video}
|
||||||
|
|
||||||
#{fs}: #{src} $(#{src}_DEPENDENCIES) genfslist.sh
|
#{fs}: #{src} $(#{src}_DEPENDENCIES) genfslist.sh
|
||||||
set -e; \
|
set -e; \
|
||||||
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
|
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} -DGRUB_LST_GENERATOR $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
|
||||||
| sh $(srcdir)/genfslist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
|
| sh $(srcdir)/genfslist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
|
||||||
|
|
||||||
#{parttool}: #{src} $(#{src}_DEPENDENCIES) genparttoollist.sh
|
#{parttool}: #{src} $(#{src}_DEPENDENCIES) genparttoollist.sh
|
||||||
|
@ -238,7 +238,7 @@ VIDEOFILES += #{video}
|
||||||
|
|
||||||
#{partmap}: #{src} $(#{src}_DEPENDENCIES) genpartmaplist.sh
|
#{partmap}: #{src} $(#{src}_DEPENDENCIES) genpartmaplist.sh
|
||||||
set -e; \
|
set -e; \
|
||||||
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
|
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} -DGRUB_LST_GENERATOR $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
|
||||||
| sh $(srcdir)/genpartmaplist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
|
| sh $(srcdir)/genpartmaplist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
|
||||||
|
|
||||||
#{handler}: #{src} $(#{src}_DEPENDENCIES) genhandlerlist.sh
|
#{handler}: #{src} $(#{src}_DEPENDENCIES) genhandlerlist.sh
|
||||||
|
@ -253,7 +253,7 @@ VIDEOFILES += #{video}
|
||||||
|
|
||||||
#{video}: #{src} $(#{src}_DEPENDENCIES) genvideolist.sh
|
#{video}: #{src} $(#{src}_DEPENDENCIES) genvideolist.sh
|
||||||
set -e; \
|
set -e; \
|
||||||
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
|
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} -DGRUB_LST_GENERATOR $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
|
||||||
| sh $(srcdir)/genvideolist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
|
| sh $(srcdir)/genvideolist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
|
||||||
|
|
||||||
"
|
"
|
||||||
|
|
|
@ -309,14 +309,10 @@ grub_gettext_init_ext (const char *lang)
|
||||||
static void
|
static void
|
||||||
grub_gettext_delete_list (void)
|
grub_gettext_delete_list (void)
|
||||||
{
|
{
|
||||||
struct grub_gettext_msg *item;
|
while (grub_gettext_msg_list)
|
||||||
|
|
||||||
while ((item =
|
|
||||||
grub_list_pop (GRUB_AS_LIST_P (&grub_gettext_msg_list))) != 0)
|
|
||||||
{
|
{
|
||||||
char *original = (char *) ((struct grub_gettext_msg *) item)->name;
|
grub_free ((char *) grub_gettext_msg_list->name);
|
||||||
grub_free (original);
|
grub_gettext_msg_list = grub_gettext_msg_list->next;
|
||||||
|
|
||||||
/* Don't delete the translated message because could be in use. */
|
/* Don't delete the translated message because could be in use. */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,12 +115,7 @@ grub_command_execute (const char *name, int argc, char **argv)
|
||||||
return (cmd) ? cmd->func (cmd, argc, argv) : GRUB_ERR_FILE_NOT_FOUND;
|
return (cmd) ? cmd->func (cmd, argc, argv) : GRUB_ERR_FILE_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
#define FOR_COMMANDS(var) FOR_LIST_ELEMENTS((var), grub_command_list)
|
||||||
grub_command_iterate (int (*func) (grub_command_t))
|
|
||||||
{
|
|
||||||
return grub_list_iterate (GRUB_AS_LIST (grub_command_list),
|
|
||||||
(grub_list_hook_t) func);
|
|
||||||
}
|
|
||||||
|
|
||||||
void grub_register_core_commands (void);
|
void grub_register_core_commands (void);
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,7 @@ struct grub_dl
|
||||||
Elf_Sym *symtab;
|
Elf_Sym *symtab;
|
||||||
void (*init) (struct grub_dl *mod);
|
void (*init) (struct grub_dl *mod);
|
||||||
void (*fini) (void);
|
void (*fini) (void);
|
||||||
|
struct grub_dl *next;
|
||||||
};
|
};
|
||||||
typedef struct grub_dl *grub_dl_t;
|
typedef struct grub_dl *grub_dl_t;
|
||||||
|
|
||||||
|
@ -98,7 +99,10 @@ void grub_dl_unload_all (void);
|
||||||
#endif
|
#endif
|
||||||
int EXPORT_FUNC(grub_dl_ref) (grub_dl_t mod);
|
int EXPORT_FUNC(grub_dl_ref) (grub_dl_t mod);
|
||||||
int EXPORT_FUNC(grub_dl_unref) (grub_dl_t mod);
|
int EXPORT_FUNC(grub_dl_unref) (grub_dl_t mod);
|
||||||
void EXPORT_FUNC(grub_dl_iterate) (int (*hook) (grub_dl_t mod));
|
extern grub_dl_t EXPORT_VAR(grub_dl_head);
|
||||||
|
|
||||||
|
#define FOR_DL_MODULES(var) FOR_LIST_ELEMENTS ((var), (grub_dl_head))
|
||||||
|
|
||||||
grub_dl_t EXPORT_FUNC(grub_dl_get) (const char *name);
|
grub_dl_t EXPORT_FUNC(grub_dl_get) (const char *name);
|
||||||
grub_err_t grub_dl_register_symbol (const char *name, void *addr,
|
grub_err_t grub_dl_register_symbol (const char *name, void *addr,
|
||||||
grub_dl_t mod);
|
grub_dl_t mod);
|
||||||
|
|
|
@ -32,7 +32,7 @@ enum grub_efi_uga_blt_operation
|
||||||
GRUB_EFI_UGA_VIDEO_TO_BLT,
|
GRUB_EFI_UGA_VIDEO_TO_BLT,
|
||||||
GRUB_EFI_UGA_BLT_TO_VIDEO,
|
GRUB_EFI_UGA_BLT_TO_VIDEO,
|
||||||
GRUB_EFI_UGA_VIDEO_TO_VIDEO,
|
GRUB_EFI_UGA_VIDEO_TO_VIDEO,
|
||||||
GRUB_EFI_UGA_GLT_MAX
|
GRUB_EFI_UGA_BLT_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
struct grub_efi_uga_pixel
|
struct grub_efi_uga_pixel
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
#include <grub/symbol.h>
|
#include <grub/symbol.h>
|
||||||
#include <grub/types.h>
|
#include <grub/types.h>
|
||||||
|
|
||||||
|
#include <grub/list.h>
|
||||||
|
|
||||||
/* Forward declaration is required, because of mutual reference. */
|
/* Forward declaration is required, because of mutual reference. */
|
||||||
struct grub_file;
|
struct grub_file;
|
||||||
|
|
||||||
|
@ -38,6 +40,9 @@ struct grub_dirhook_info
|
||||||
/* Filesystem descriptor. */
|
/* Filesystem descriptor. */
|
||||||
struct grub_fs
|
struct grub_fs
|
||||||
{
|
{
|
||||||
|
/* The next filesystem. */
|
||||||
|
struct grub_fs *next;
|
||||||
|
|
||||||
/* My name. */
|
/* My name. */
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
||||||
|
@ -72,9 +77,6 @@ struct grub_fs
|
||||||
/* Whether this filesystem reserves first sector for DOS-style boot. */
|
/* Whether this filesystem reserves first sector for DOS-style boot. */
|
||||||
int reserved_first_sector;
|
int reserved_first_sector;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The next filesystem. */
|
|
||||||
struct grub_fs *next;
|
|
||||||
};
|
};
|
||||||
typedef struct grub_fs *grub_fs_t;
|
typedef struct grub_fs *grub_fs_t;
|
||||||
|
|
||||||
|
@ -87,10 +89,24 @@ extern struct grub_fs grub_fs_blocklist;
|
||||||
the linked list GRUB_FS_LIST through the function grub_fs_register. */
|
the linked list GRUB_FS_LIST through the function grub_fs_register. */
|
||||||
typedef int (*grub_fs_autoload_hook_t) (void);
|
typedef int (*grub_fs_autoload_hook_t) (void);
|
||||||
extern grub_fs_autoload_hook_t EXPORT_VAR(grub_fs_autoload_hook);
|
extern grub_fs_autoload_hook_t EXPORT_VAR(grub_fs_autoload_hook);
|
||||||
|
extern grub_fs_t EXPORT_VAR (grub_fs_list);
|
||||||
|
|
||||||
|
#ifndef GRUB_LST_GENERATOR
|
||||||
|
static inline void
|
||||||
|
grub_fs_register (grub_fs_t fs)
|
||||||
|
{
|
||||||
|
grub_list_push (GRUB_AS_LIST_P (&grub_fs_list), GRUB_AS_LIST (fs));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
grub_fs_unregister (grub_fs_t fs)
|
||||||
|
{
|
||||||
|
grub_list_remove (GRUB_AS_LIST_P (&grub_fs_list), GRUB_AS_LIST (fs));
|
||||||
|
}
|
||||||
|
|
||||||
|
#define FOR_FILESYSTEMS(var) FOR_LIST_ELEMENTS((var), (grub_fs_list))
|
||||||
|
|
||||||
void EXPORT_FUNC(grub_fs_register) (grub_fs_t fs);
|
|
||||||
void EXPORT_FUNC(grub_fs_unregister) (grub_fs_t fs);
|
|
||||||
void EXPORT_FUNC(grub_fs_iterate) (int (*hook) (const grub_fs_t fs));
|
|
||||||
grub_fs_t EXPORT_FUNC(grub_fs_probe) (grub_device_t device);
|
grub_fs_t EXPORT_FUNC(grub_fs_probe) (grub_device_t device);
|
||||||
|
|
||||||
#endif /* ! GRUB_FS_HEADER */
|
#endif /* ! GRUB_FS_HEADER */
|
||||||
|
|
|
@ -1,60 +0,0 @@
|
||||||
/* handler.h - header for grub handler */
|
|
||||||
/*
|
|
||||||
* 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/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef GRUB_HANDLER_HEADER
|
|
||||||
#define GRUB_HANDLER_HEADER 1
|
|
||||||
|
|
||||||
#include <grub/list.h>
|
|
||||||
#include <grub/err.h>
|
|
||||||
|
|
||||||
struct grub_handler
|
|
||||||
{
|
|
||||||
struct grub_handler *next;
|
|
||||||
const char *name;
|
|
||||||
grub_err_t (*init) (void);
|
|
||||||
grub_err_t (*fini) (void);
|
|
||||||
};
|
|
||||||
typedef struct grub_handler *grub_handler_t;
|
|
||||||
|
|
||||||
struct grub_handler_class
|
|
||||||
{
|
|
||||||
struct grub_handler_class *next;
|
|
||||||
const char *name;
|
|
||||||
grub_handler_t handler_list;
|
|
||||||
grub_handler_t cur_handler;
|
|
||||||
};
|
|
||||||
typedef struct grub_handler_class *grub_handler_class_t;
|
|
||||||
|
|
||||||
extern grub_handler_class_t EXPORT_VAR(grub_handler_class_list);
|
|
||||||
|
|
||||||
void EXPORT_FUNC(grub_handler_register) (grub_handler_class_t class,
|
|
||||||
grub_handler_t handler);
|
|
||||||
void EXPORT_FUNC(grub_handler_unregister) (grub_handler_class_t class,
|
|
||||||
grub_handler_t handler);
|
|
||||||
grub_err_t EXPORT_FUNC(grub_handler_set_current) (grub_handler_class_t class,
|
|
||||||
grub_handler_t handler);
|
|
||||||
|
|
||||||
#define GRUB_AS_HANDLER(ptr) \
|
|
||||||
((GRUB_FIELD_MATCH (ptr, grub_handler_t, next) && \
|
|
||||||
GRUB_FIELD_MATCH (ptr, grub_handler_t, name) && \
|
|
||||||
GRUB_FIELD_MATCH (ptr, grub_handler_t, init) && \
|
|
||||||
GRUB_FIELD_MATCH (ptr, grub_handler_t, fini)) ? \
|
|
||||||
(grub_handler_t) ptr : grub_bad_type_cast ())
|
|
||||||
|
|
||||||
#endif /* ! GRUB_HANDLER_HEADER */
|
|
|
@ -30,15 +30,10 @@ struct grub_list
|
||||||
};
|
};
|
||||||
typedef struct grub_list *grub_list_t;
|
typedef struct grub_list *grub_list_t;
|
||||||
|
|
||||||
typedef int (*grub_list_hook_t) (grub_list_t item);
|
|
||||||
typedef int (*grub_list_test_t) (grub_list_t new_item, grub_list_t item);
|
|
||||||
|
|
||||||
void EXPORT_FUNC(grub_list_push) (grub_list_t *head, grub_list_t item);
|
void EXPORT_FUNC(grub_list_push) (grub_list_t *head, grub_list_t item);
|
||||||
void * EXPORT_FUNC(grub_list_pop) (grub_list_t *head);
|
|
||||||
void EXPORT_FUNC(grub_list_remove) (grub_list_t *head, grub_list_t item);
|
void EXPORT_FUNC(grub_list_remove) (grub_list_t *head, grub_list_t item);
|
||||||
int EXPORT_FUNC(grub_list_iterate) (grub_list_t head, grub_list_hook_t hook);
|
|
||||||
void EXPORT_FUNC(grub_list_insert) (grub_list_t *head, grub_list_t item,
|
#define FOR_LIST_ELEMENTS(var, list) for ((var) = (list); (var); (var) = (var)->next)
|
||||||
grub_list_test_t test);
|
|
||||||
|
|
||||||
static inline void *
|
static inline void *
|
||||||
grub_bad_type_cast_real (int line, const char *file)
|
grub_bad_type_cast_real (int line, const char *file)
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
|
|
||||||
#include <grub/types.h>
|
#include <grub/types.h>
|
||||||
#include <grub/err.h>
|
#include <grub/err.h>
|
||||||
#include <grub/handler.h>
|
|
||||||
#include <grub/reader.h>
|
#include <grub/reader.h>
|
||||||
|
|
||||||
/* All the states for the command line. */
|
/* All the states for the command line. */
|
||||||
|
@ -84,36 +83,9 @@ struct grub_parser
|
||||||
};
|
};
|
||||||
typedef struct grub_parser *grub_parser_t;
|
typedef struct grub_parser *grub_parser_t;
|
||||||
|
|
||||||
extern struct grub_handler_class EXPORT_VAR(grub_parser_class);
|
|
||||||
grub_err_t EXPORT_FUNC(grub_parser_execute) (char *source);
|
grub_err_t EXPORT_FUNC(grub_parser_execute) (char *source);
|
||||||
|
|
||||||
static inline void
|
grub_err_t
|
||||||
grub_parser_register (const char *name __attribute__ ((unused)),
|
grub_rescue_parse_line (char *line, grub_reader_getline_t getline);
|
||||||
/* `name' is ignored here, but used by genhandlerlist.sh. */
|
|
||||||
grub_parser_t parser)
|
|
||||||
{
|
|
||||||
grub_handler_register (&grub_parser_class, GRUB_AS_HANDLER (parser));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
grub_parser_unregister (grub_parser_t parser)
|
|
||||||
{
|
|
||||||
grub_handler_unregister (&grub_parser_class, GRUB_AS_HANDLER (parser));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline grub_parser_t
|
|
||||||
grub_parser_get_current (void)
|
|
||||||
{
|
|
||||||
return (grub_parser_t) grub_parser_class.cur_handler;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline grub_err_t
|
|
||||||
grub_parser_set_current (grub_parser_t parser)
|
|
||||||
{
|
|
||||||
return grub_handler_set_current (&grub_parser_class,
|
|
||||||
GRUB_AS_HANDLER (parser));
|
|
||||||
}
|
|
||||||
|
|
||||||
void grub_register_rescue_parser (void);
|
|
||||||
|
|
||||||
#endif /* ! GRUB_PARSER_HEADER */
|
#endif /* ! GRUB_PARSER_HEADER */
|
||||||
|
|
|
@ -77,12 +77,14 @@ char *EXPORT_FUNC(grub_partition_get_name) (const grub_partition_t partition);
|
||||||
|
|
||||||
extern grub_partition_map_t EXPORT_VAR(grub_partition_map_list);
|
extern grub_partition_map_t EXPORT_VAR(grub_partition_map_list);
|
||||||
|
|
||||||
|
#ifndef GRUB_LST_GENERATOR
|
||||||
static inline void
|
static inline void
|
||||||
grub_partition_map_register (grub_partition_map_t partmap)
|
grub_partition_map_register (grub_partition_map_t partmap)
|
||||||
{
|
{
|
||||||
grub_list_push (GRUB_AS_LIST_P (&grub_partition_map_list),
|
grub_list_push (GRUB_AS_LIST_P (&grub_partition_map_list),
|
||||||
GRUB_AS_LIST (partmap));
|
GRUB_AS_LIST (partmap));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
grub_partition_map_unregister (grub_partition_map_t partmap)
|
grub_partition_map_unregister (grub_partition_map_t partmap)
|
||||||
|
@ -91,7 +93,7 @@ grub_partition_map_unregister (grub_partition_map_t partmap)
|
||||||
GRUB_AS_LIST (partmap));
|
GRUB_AS_LIST (partmap));
|
||||||
}
|
}
|
||||||
|
|
||||||
#define FOR_PARTITION_MAPS(var) for (var = grub_partition_map_list; var; var = var->next)
|
#define FOR_PARTITION_MAPS(var) FOR_LIST_ELEMENTS((var), (grub_partition_map_list))
|
||||||
|
|
||||||
|
|
||||||
static inline grub_disk_addr_t
|
static inline grub_disk_addr_t
|
||||||
|
|
|
@ -341,15 +341,22 @@ struct grub_script_function
|
||||||
};
|
};
|
||||||
typedef struct grub_script_function *grub_script_function_t;
|
typedef struct grub_script_function *grub_script_function_t;
|
||||||
|
|
||||||
|
extern grub_script_function_t grub_script_function_list;
|
||||||
|
|
||||||
|
#define FOR_SCRIPT_FUNCTIONS(var) for((var) = grub_script_function_list; \
|
||||||
|
(var); (var) = (var)->next)
|
||||||
|
|
||||||
grub_script_function_t grub_script_function_create (struct grub_script_arg *functionname,
|
grub_script_function_t grub_script_function_create (struct grub_script_arg *functionname,
|
||||||
struct grub_script *cmd);
|
struct grub_script *cmd);
|
||||||
void grub_script_function_remove (const char *name);
|
void grub_script_function_remove (const char *name);
|
||||||
grub_script_function_t grub_script_function_find (char *functionname);
|
grub_script_function_t grub_script_function_find (char *functionname);
|
||||||
int grub_script_function_iterate (int (*iterate) (grub_script_function_t));
|
|
||||||
int grub_script_function_call (grub_script_function_t func,
|
int grub_script_function_call (grub_script_function_t func,
|
||||||
int argc, char **args);
|
int argc, char **args);
|
||||||
|
|
||||||
char **
|
char **
|
||||||
grub_script_execute_arglist_to_argv (struct grub_script_arglist *arglist, int *count);
|
grub_script_execute_arglist_to_argv (struct grub_script_arglist *arglist, int *count);
|
||||||
|
|
||||||
|
grub_err_t
|
||||||
|
grub_normal_parse_line (char *line, grub_reader_getline_t getline);
|
||||||
|
|
||||||
#endif /* ! GRUB_NORMAL_PARSER_HEADER */
|
#endif /* ! GRUB_NORMAL_PARSER_HEADER */
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
#include <grub/err.h>
|
#include <grub/err.h>
|
||||||
#include <grub/symbol.h>
|
#include <grub/symbol.h>
|
||||||
#include <grub/types.h>
|
#include <grub/types.h>
|
||||||
#include <grub/handler.h>
|
#include <grub/list.h>
|
||||||
|
|
||||||
/* These are used to represent the various color states we use. */
|
/* These are used to represent the various color states we use. */
|
||||||
typedef enum
|
typedef enum
|
||||||
|
@ -245,10 +245,10 @@ grub_term_unregister_output (grub_term_output_t term)
|
||||||
GRUB_AS_LIST (term));
|
GRUB_AS_LIST (term));
|
||||||
}
|
}
|
||||||
|
|
||||||
#define FOR_ACTIVE_TERM_INPUTS(var) for (var = grub_term_inputs; var; var = var->next)
|
#define FOR_ACTIVE_TERM_INPUTS(var) FOR_LIST_ELEMENTS((var), (grub_term_inputs))
|
||||||
#define FOR_DISABLED_TERM_INPUTS(var) for (var = grub_term_inputs_disabled; var; var = var->next)
|
#define FOR_DISABLED_TERM_INPUTS(var) FOR_LIST_ELEMENTS((var), (grub_term_inputs_disabled))
|
||||||
#define FOR_ACTIVE_TERM_OUTPUTS(var) for (var = grub_term_outputs; var; var = var->next)
|
#define FOR_ACTIVE_TERM_OUTPUTS(var) FOR_LIST_ELEMENTS((var), (grub_term_outputs))
|
||||||
#define FOR_DISABLED_TERM_OUTPUTS(var) for (var = grub_term_outputs_disabled; var; var = var->next)
|
#define FOR_DISABLED_TERM_OUTPUTS(var) FOR_LIST_ELEMENTS((var), (grub_term_outputs_disabled))
|
||||||
|
|
||||||
void EXPORT_FUNC(grub_putchar) (int c);
|
void EXPORT_FUNC(grub_putchar) (int c);
|
||||||
void EXPORT_FUNC(grub_putcode) (grub_uint32_t code,
|
void EXPORT_FUNC(grub_putcode) (grub_uint32_t code,
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
typedef signed char grub_int8_t;
|
typedef signed char grub_int8_t;
|
||||||
typedef short grub_int16_t;
|
typedef short grub_int16_t;
|
||||||
typedef int grub_int32_t;
|
typedef int grub_int32_t;
|
||||||
#if GRUB_CPU_SIZEOF_VOID_P == 8
|
#if GRUB_CPU_SIZEOF_LONG == 8
|
||||||
typedef long grub_int64_t;
|
typedef long grub_int64_t;
|
||||||
#else
|
#else
|
||||||
typedef long long grub_int64_t;
|
typedef long long grub_int64_t;
|
||||||
|
@ -69,7 +69,7 @@ typedef long long grub_int64_t;
|
||||||
typedef unsigned char grub_uint8_t;
|
typedef unsigned char grub_uint8_t;
|
||||||
typedef unsigned short grub_uint16_t;
|
typedef unsigned short grub_uint16_t;
|
||||||
typedef unsigned grub_uint32_t;
|
typedef unsigned grub_uint32_t;
|
||||||
#if GRUB_CPU_SIZEOF_VOID_P == 8
|
#if GRUB_CPU_SIZEOF_LONG == 8
|
||||||
typedef unsigned long grub_uint64_t;
|
typedef unsigned long grub_uint64_t;
|
||||||
#else
|
#else
|
||||||
typedef unsigned long long grub_uint64_t;
|
typedef unsigned long long grub_uint64_t;
|
||||||
|
@ -98,7 +98,7 @@ typedef grub_uint32_t grub_size_t;
|
||||||
typedef grub_int32_t grub_ssize_t;
|
typedef grub_int32_t grub_ssize_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if GRUB_CPU_SIZEOF_VOID_P == 8
|
#if GRUB_CPU_SIZEOF_LONG == 8
|
||||||
# define GRUB_ULONG_MAX 18446744073709551615UL
|
# define GRUB_ULONG_MAX 18446744073709551615UL
|
||||||
# define GRUB_LONG_MAX 9223372036854775807L
|
# define GRUB_LONG_MAX 9223372036854775807L
|
||||||
# define GRUB_LONG_MIN (-9223372036854775807L - 1)
|
# define GRUB_LONG_MIN (-9223372036854775807L - 1)
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include <grub/err.h>
|
#include <grub/err.h>
|
||||||
#include <grub/types.h>
|
#include <grub/types.h>
|
||||||
|
#include <grub/list.h>
|
||||||
|
|
||||||
/* Video color in hardware dependent format. Users should not assume any
|
/* Video color in hardware dependent format. Users should not assume any
|
||||||
specific coding format. */
|
specific coding format. */
|
||||||
|
@ -187,6 +188,9 @@ typedef enum grub_video_driver_id
|
||||||
|
|
||||||
struct grub_video_adapter
|
struct grub_video_adapter
|
||||||
{
|
{
|
||||||
|
/* The next video adapter. */
|
||||||
|
struct grub_video_adapter *next;
|
||||||
|
|
||||||
/* The video adapter name. */
|
/* The video adapter name. */
|
||||||
const char *name;
|
const char *name;
|
||||||
grub_video_driver_id_t id;
|
grub_video_driver_id_t id;
|
||||||
|
@ -255,15 +259,30 @@ struct grub_video_adapter
|
||||||
grub_err_t (*set_active_render_target) (struct grub_video_render_target *target);
|
grub_err_t (*set_active_render_target) (struct grub_video_render_target *target);
|
||||||
|
|
||||||
grub_err_t (*get_active_render_target) (struct grub_video_render_target **target);
|
grub_err_t (*get_active_render_target) (struct grub_video_render_target **target);
|
||||||
|
|
||||||
/* The next video adapter. */
|
|
||||||
struct grub_video_adapter *next;
|
|
||||||
};
|
};
|
||||||
typedef struct grub_video_adapter *grub_video_adapter_t;
|
typedef struct grub_video_adapter *grub_video_adapter_t;
|
||||||
|
|
||||||
void EXPORT_FUNC (grub_video_register) (grub_video_adapter_t adapter);
|
extern grub_video_adapter_t EXPORT_VAR(grub_video_adapter_list);
|
||||||
void grub_video_unregister (grub_video_adapter_t adapter);
|
|
||||||
void grub_video_iterate (int (*hook) (grub_video_adapter_t adapter));
|
#ifndef GRUB_LST_GENERATOR
|
||||||
|
/* Register video driver. */
|
||||||
|
static inline void
|
||||||
|
grub_video_register (grub_video_adapter_t adapter)
|
||||||
|
{
|
||||||
|
grub_list_push (GRUB_AS_LIST_P (&grub_video_adapter_list),
|
||||||
|
GRUB_AS_LIST (adapter));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Unregister video driver. */
|
||||||
|
static inline void
|
||||||
|
grub_video_unregister (grub_video_adapter_t adapter)
|
||||||
|
{
|
||||||
|
grub_list_remove (GRUB_AS_LIST_P (&grub_video_adapter_list),
|
||||||
|
GRUB_AS_LIST (adapter));
|
||||||
|
}
|
||||||
|
|
||||||
|
#define FOR_VIDEO_ADAPTERS(var) FOR_LIST_ELEMENTS((var), (grub_video_adapter_list))
|
||||||
|
|
||||||
grub_err_t EXPORT_FUNC (grub_video_restore) (void);
|
grub_err_t EXPORT_FUNC (grub_video_restore) (void);
|
||||||
|
|
||||||
|
|
49
kern/dl.c
49
kern/dl.c
|
@ -39,31 +39,17 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct grub_dl_list
|
grub_dl_t grub_dl_head = 0;
|
||||||
{
|
|
||||||
struct grub_dl_list *next;
|
|
||||||
grub_dl_t mod;
|
|
||||||
};
|
|
||||||
typedef struct grub_dl_list *grub_dl_list_t;
|
|
||||||
|
|
||||||
static grub_dl_list_t grub_dl_head;
|
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_dl_add (grub_dl_t mod)
|
grub_dl_add (grub_dl_t mod)
|
||||||
{
|
{
|
||||||
grub_dl_list_t l;
|
|
||||||
|
|
||||||
if (grub_dl_get (mod->name))
|
if (grub_dl_get (mod->name))
|
||||||
return grub_error (GRUB_ERR_BAD_MODULE,
|
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||||
"`%s' is already loaded", mod->name);
|
"`%s' is already loaded", mod->name);
|
||||||
|
|
||||||
l = (grub_dl_list_t) grub_malloc (sizeof (*l));
|
mod->next = grub_dl_head;
|
||||||
if (! l)
|
grub_dl_head = mod;
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
l->mod = mod;
|
|
||||||
l->next = grub_dl_head;
|
|
||||||
grub_dl_head = l;
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
@ -71,13 +57,12 @@ grub_dl_add (grub_dl_t mod)
|
||||||
static void
|
static void
|
||||||
grub_dl_remove (grub_dl_t mod)
|
grub_dl_remove (grub_dl_t mod)
|
||||||
{
|
{
|
||||||
grub_dl_list_t *p, q;
|
grub_dl_t *p, q;
|
||||||
|
|
||||||
for (p = &grub_dl_head, q = *p; q; p = &q->next, q = *p)
|
for (p = &grub_dl_head, q = *p; q; p = &q->next, q = *p)
|
||||||
if (q->mod == mod)
|
if (q == mod)
|
||||||
{
|
{
|
||||||
*p = q->next;
|
*p = q->next;
|
||||||
grub_free (q);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,25 +70,15 @@ grub_dl_remove (grub_dl_t mod)
|
||||||
grub_dl_t
|
grub_dl_t
|
||||||
grub_dl_get (const char *name)
|
grub_dl_get (const char *name)
|
||||||
{
|
{
|
||||||
grub_dl_list_t l;
|
grub_dl_t l;
|
||||||
|
|
||||||
for (l = grub_dl_head; l; l = l->next)
|
for (l = grub_dl_head; l; l = l->next)
|
||||||
if (grub_strcmp (name, l->mod->name) == 0)
|
if (grub_strcmp (name, l->name) == 0)
|
||||||
return l->mod;
|
return l;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
grub_dl_iterate (int (*hook) (grub_dl_t mod))
|
|
||||||
{
|
|
||||||
grub_dl_list_t l;
|
|
||||||
|
|
||||||
for (l = grub_dl_head; l; l = l->next)
|
|
||||||
if (hook (l->mod))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct grub_symbol
|
struct grub_symbol
|
||||||
|
@ -694,11 +669,11 @@ grub_dl_unload_unneeded (void)
|
||||||
{
|
{
|
||||||
/* Because grub_dl_remove modifies the list of modules, this
|
/* Because grub_dl_remove modifies the list of modules, this
|
||||||
implementation is tricky. */
|
implementation is tricky. */
|
||||||
grub_dl_list_t p = grub_dl_head;
|
grub_dl_t p = grub_dl_head;
|
||||||
|
|
||||||
while (p)
|
while (p)
|
||||||
{
|
{
|
||||||
if (grub_dl_unload (p->mod))
|
if (grub_dl_unload (p))
|
||||||
{
|
{
|
||||||
p = grub_dl_head;
|
p = grub_dl_head;
|
||||||
continue;
|
continue;
|
||||||
|
@ -714,13 +689,13 @@ grub_dl_unload_all (void)
|
||||||
{
|
{
|
||||||
while (grub_dl_head)
|
while (grub_dl_head)
|
||||||
{
|
{
|
||||||
grub_dl_list_t p;
|
grub_dl_t p;
|
||||||
|
|
||||||
grub_dl_unload_unneeded ();
|
grub_dl_unload_unneeded ();
|
||||||
|
|
||||||
/* Force to decrement the ref count. This will purge pre-loaded
|
/* Force to decrement the ref count. This will purge pre-loaded
|
||||||
modules and manually inserted modules. */
|
modules and manually inserted modules. */
|
||||||
for (p = grub_dl_head; p; p = p->next)
|
for (p = grub_dl_head; p; p = p->next)
|
||||||
p->mod->ref_count--;
|
p->ref_count--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
32
kern/fs.c
32
kern/fs.c
|
@ -27,40 +27,10 @@
|
||||||
#include <grub/mm.h>
|
#include <grub/mm.h>
|
||||||
#include <grub/term.h>
|
#include <grub/term.h>
|
||||||
|
|
||||||
static grub_fs_t grub_fs_list;
|
grub_fs_t grub_fs_list = 0;
|
||||||
|
|
||||||
grub_fs_autoload_hook_t grub_fs_autoload_hook = 0;
|
grub_fs_autoload_hook_t grub_fs_autoload_hook = 0;
|
||||||
|
|
||||||
void
|
|
||||||
grub_fs_register (grub_fs_t fs)
|
|
||||||
{
|
|
||||||
fs->next = grub_fs_list;
|
|
||||||
grub_fs_list = fs;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
grub_fs_unregister (grub_fs_t fs)
|
|
||||||
{
|
|
||||||
grub_fs_t *p, q;
|
|
||||||
|
|
||||||
for (p = &grub_fs_list, q = *p; q; p = &(q->next), q = q->next)
|
|
||||||
if (q == fs)
|
|
||||||
{
|
|
||||||
*p = q->next;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
grub_fs_iterate (int (*hook) (const grub_fs_t fs))
|
|
||||||
{
|
|
||||||
grub_fs_t p;
|
|
||||||
|
|
||||||
for (p = grub_fs_list; p; p = p->next)
|
|
||||||
if (hook (p))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_fs_t
|
grub_fs_t
|
||||||
grub_fs_probe (grub_device_t device)
|
grub_fs_probe (grub_device_t device)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,64 +0,0 @@
|
||||||
/* handler.c - grub handler function */
|
|
||||||
/*
|
|
||||||
* 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/handler.h>
|
|
||||||
|
|
||||||
grub_handler_class_t grub_handler_class_list;
|
|
||||||
|
|
||||||
void
|
|
||||||
grub_handler_register (grub_handler_class_t class, grub_handler_t handler)
|
|
||||||
{
|
|
||||||
int first_handler = (class->handler_list == 0);
|
|
||||||
|
|
||||||
grub_list_push (GRUB_AS_LIST_P (&class->handler_list),
|
|
||||||
GRUB_AS_LIST (handler));
|
|
||||||
|
|
||||||
if (first_handler)
|
|
||||||
{
|
|
||||||
grub_list_push (GRUB_AS_LIST_P (&grub_handler_class_list),
|
|
||||||
GRUB_AS_LIST (class));
|
|
||||||
grub_handler_set_current (class, handler);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
grub_handler_unregister (grub_handler_class_t class, grub_handler_t handler)
|
|
||||||
{
|
|
||||||
grub_list_remove (GRUB_AS_LIST_P (&class->handler_list),
|
|
||||||
GRUB_AS_LIST (handler));
|
|
||||||
|
|
||||||
if (class->handler_list == 0)
|
|
||||||
grub_list_remove (GRUB_AS_LIST_P (&grub_handler_class_list),
|
|
||||||
GRUB_AS_LIST (class));
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_err_t
|
|
||||||
grub_handler_set_current (grub_handler_class_t class, grub_handler_t handler)
|
|
||||||
{
|
|
||||||
if (class->cur_handler && class->cur_handler->fini)
|
|
||||||
if ((class->cur_handler->fini) () != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
if (handler->init)
|
|
||||||
if ((handler->init) () != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
class->cur_handler = handler;
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
82
kern/list.c
82
kern/list.c
|
@ -28,18 +28,6 @@ grub_list_push (grub_list_t *head, grub_list_t item)
|
||||||
*head = item;
|
*head = item;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
|
||||||
grub_list_pop (grub_list_t *head)
|
|
||||||
{
|
|
||||||
grub_list_t item;
|
|
||||||
|
|
||||||
item = *head;
|
|
||||||
if (item)
|
|
||||||
*head = item->next;
|
|
||||||
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
grub_list_remove (grub_list_t *head, grub_list_t item)
|
grub_list_remove (grub_list_t *head, grub_list_t item)
|
||||||
{
|
{
|
||||||
|
@ -53,51 +41,16 @@ grub_list_remove (grub_list_t *head, grub_list_t item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
grub_list_iterate (grub_list_t head, grub_list_hook_t hook)
|
|
||||||
{
|
|
||||||
grub_list_t p;
|
|
||||||
|
|
||||||
for (p = head; p; p = p->next)
|
|
||||||
if (hook (p))
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
grub_list_insert (grub_list_t *head, grub_list_t item,
|
|
||||||
grub_list_test_t test)
|
|
||||||
{
|
|
||||||
grub_list_t *p, q;
|
|
||||||
|
|
||||||
for (p = head, q = *p; q; p = &(q->next), q = q->next)
|
|
||||||
if (test (item, q))
|
|
||||||
break;
|
|
||||||
|
|
||||||
*p = item;
|
|
||||||
item->next = q;
|
|
||||||
}
|
|
||||||
|
|
||||||
void *
|
void *
|
||||||
grub_named_list_find (grub_named_list_t head, const char *name)
|
grub_named_list_find (grub_named_list_t head, const char *name)
|
||||||
{
|
{
|
||||||
grub_named_list_t result = NULL;
|
grub_named_list_t item;
|
||||||
|
|
||||||
auto int list_find (grub_named_list_t item);
|
FOR_LIST_ELEMENTS (item, head)
|
||||||
int list_find (grub_named_list_t item)
|
if (grub_strcmp (item->name, name) == 0)
|
||||||
{
|
return item;
|
||||||
if (! grub_strcmp (item->name, name))
|
|
||||||
{
|
|
||||||
result = item;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return NULL;
|
||||||
}
|
|
||||||
|
|
||||||
grub_list_iterate (GRUB_AS_LIST (head), (grub_list_hook_t) list_find);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -105,27 +58,30 @@ grub_prio_list_insert (grub_prio_list_t *head, grub_prio_list_t nitem)
|
||||||
{
|
{
|
||||||
int inactive = 0;
|
int inactive = 0;
|
||||||
|
|
||||||
auto int test (grub_prio_list_t new_item, grub_prio_list_t item);
|
grub_prio_list_t *p, q;
|
||||||
int test (grub_prio_list_t new_item, grub_prio_list_t item)
|
|
||||||
|
for (p = head, q = *p; q; p = &(q->next), q = q->next)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
r = grub_strcmp (new_item->name, item->name);
|
r = grub_strcmp (nitem->name, q->name);
|
||||||
if (r)
|
if (r < 0)
|
||||||
return (r < 0);
|
break;
|
||||||
|
if (r > 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (new_item->prio >= (item->prio & GRUB_PRIO_LIST_PRIO_MASK))
|
if (nitem->prio >= (q->prio & GRUB_PRIO_LIST_PRIO_MASK))
|
||||||
{
|
{
|
||||||
item->prio &= ~GRUB_PRIO_LIST_FLAG_ACTIVE;
|
q->prio &= ~GRUB_PRIO_LIST_FLAG_ACTIVE;
|
||||||
return 1;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
inactive = 1;
|
inactive = 1;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_list_insert (GRUB_AS_LIST_P (head), GRUB_AS_LIST (nitem),
|
*p = nitem;
|
||||||
(grub_list_test_t) test);
|
nitem->next = q;
|
||||||
|
|
||||||
if (! inactive)
|
if (! inactive)
|
||||||
nitem->prio |= GRUB_PRIO_LIST_FLAG_ACTIVE;
|
nitem->prio |= GRUB_PRIO_LIST_FLAG_ACTIVE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,7 +191,6 @@ grub_main (void)
|
||||||
grub_set_root_dev ();
|
grub_set_root_dev ();
|
||||||
|
|
||||||
grub_register_core_commands ();
|
grub_register_core_commands ();
|
||||||
grub_register_rescue_parser ();
|
|
||||||
|
|
||||||
grub_load_config ();
|
grub_load_config ();
|
||||||
grub_load_normal_mode ();
|
grub_load_normal_mode ();
|
||||||
|
|
|
@ -230,10 +230,6 @@ grub_parser_split_cmdline (const char *cmdline, grub_reader_getline_t getline,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct grub_handler_class grub_parser_class = {
|
|
||||||
.name = "parser"
|
|
||||||
};
|
|
||||||
|
|
||||||
grub_err_t
|
grub_err_t
|
||||||
grub_parser_execute (char *source)
|
grub_parser_execute (char *source)
|
||||||
{
|
{
|
||||||
|
@ -261,11 +257,9 @@ grub_parser_execute (char *source)
|
||||||
while (source)
|
while (source)
|
||||||
{
|
{
|
||||||
char *line;
|
char *line;
|
||||||
grub_parser_t parser;
|
|
||||||
|
|
||||||
getline (&line, 0);
|
getline (&line, 0);
|
||||||
parser = grub_parser_get_current ();
|
grub_rescue_parse_line (line, getline);
|
||||||
parser->parse_line (line, getline);
|
|
||||||
grub_free (line);
|
grub_free (line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
|
|
||||||
static grub_err_t
|
grub_err_t
|
||||||
grub_rescue_parse_line (char *line, grub_reader_getline_t getline)
|
grub_rescue_parse_line (char *line, grub_reader_getline_t getline)
|
||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
|
@ -74,15 +74,3 @@ grub_rescue_parse_line (char *line, grub_reader_getline_t getline)
|
||||||
|
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct grub_parser grub_rescue_parser =
|
|
||||||
{
|
|
||||||
.name = "rescue",
|
|
||||||
.parse_line = grub_rescue_parse_line
|
|
||||||
};
|
|
||||||
|
|
||||||
void
|
|
||||||
grub_register_rescue_parser (void)
|
|
||||||
{
|
|
||||||
grub_parser_register ("rescue", &grub_rescue_parser);
|
|
||||||
}
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ grub_rescue_run (void)
|
||||||
if (! line || line[0] == '\0')
|
if (! line || line[0] == '\0')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
grub_parser_get_current ()->parse_line (line, grub_rescue_read_line);
|
grub_rescue_parse_line (line, grub_rescue_read_line);
|
||||||
grub_free (line);
|
grub_free (line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,25 +133,24 @@ static int
|
||||||
is_authenticated (const char *userlist)
|
is_authenticated (const char *userlist)
|
||||||
{
|
{
|
||||||
const char *superusers;
|
const char *superusers;
|
||||||
|
struct grub_auth_user *user;
|
||||||
auto int hook (grub_list_t item);
|
|
||||||
int hook (grub_list_t item)
|
|
||||||
{
|
|
||||||
const char *name;
|
|
||||||
if (!((struct grub_auth_user *) item)->authenticated)
|
|
||||||
return 0;
|
|
||||||
name = ((struct grub_auth_user *) item)->name;
|
|
||||||
|
|
||||||
return (userlist && grub_strword (userlist, name))
|
|
||||||
|| grub_strword (superusers, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
superusers = grub_env_get ("superusers");
|
superusers = grub_env_get ("superusers");
|
||||||
|
|
||||||
if (!superusers)
|
if (!superusers)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return grub_list_iterate (GRUB_AS_LIST (users), hook);
|
FOR_LIST_ELEMENTS (user, users)
|
||||||
|
{
|
||||||
|
if (!(user->authenticated))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if ((userlist && grub_strword (userlist, user->name))
|
||||||
|
|| grub_strword (superusers, user->name))
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -205,22 +204,7 @@ grub_auth_check_authentication (const char *userlist)
|
||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
static unsigned long punishment_delay = 1;
|
static unsigned long punishment_delay = 1;
|
||||||
char entered[GRUB_AUTH_MAX_PASSLEN];
|
char entered[GRUB_AUTH_MAX_PASSLEN];
|
||||||
|
struct grub_auth_user *user;
|
||||||
auto int hook (grub_list_t item);
|
|
||||||
int hook (grub_list_t item)
|
|
||||||
{
|
|
||||||
if (grub_strcmp (login, ((struct grub_auth_user *) item)->name) == 0)
|
|
||||||
cur = (struct grub_auth_user *) item;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto int hook_any (grub_list_t item);
|
|
||||||
int hook_any (grub_list_t item)
|
|
||||||
{
|
|
||||||
if (((struct grub_auth_user *) item)->callback)
|
|
||||||
cur = (struct grub_auth_user *) item;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_memset (login, 0, sizeof (login));
|
grub_memset (login, 0, sizeof (login));
|
||||||
|
|
||||||
|
@ -240,7 +224,11 @@ grub_auth_check_authentication (const char *userlist)
|
||||||
if (!grub_password_get (entered, GRUB_AUTH_MAX_PASSLEN))
|
if (!grub_password_get (entered, GRUB_AUTH_MAX_PASSLEN))
|
||||||
goto access_denied;
|
goto access_denied;
|
||||||
|
|
||||||
grub_list_iterate (GRUB_AS_LIST (users), hook);
|
FOR_LIST_ELEMENTS (user, users)
|
||||||
|
{
|
||||||
|
if (grub_strcmp (login, user->name) == 0)
|
||||||
|
cur = user;
|
||||||
|
}
|
||||||
|
|
||||||
if (!cur || ! cur->callback)
|
if (!cur || ! cur->callback)
|
||||||
goto access_denied;
|
goto access_denied;
|
||||||
|
|
|
@ -176,21 +176,6 @@ iterate_dev (const char *devname)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
iterate_command (grub_command_t cmd)
|
|
||||||
{
|
|
||||||
if (cmd->prio & GRUB_PRIO_LIST_FLAG_ACTIVE)
|
|
||||||
{
|
|
||||||
if (cmd->flags & GRUB_COMMAND_FLAG_CMDLINE)
|
|
||||||
{
|
|
||||||
if (add_completion (cmd->name, " ", GRUB_COMPLETION_TYPE_COMMAND))
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Complete a device. */
|
/* Complete a device. */
|
||||||
static int
|
static int
|
||||||
complete_device (void)
|
complete_device (void)
|
||||||
|
@ -429,8 +414,18 @@ grub_normal_do_completion (char *buf, int *restore,
|
||||||
if (argc == 1 || argc == 0)
|
if (argc == 1 || argc == 0)
|
||||||
{
|
{
|
||||||
/* Complete a command. */
|
/* Complete a command. */
|
||||||
if (grub_command_iterate (iterate_command))
|
grub_command_t cmd;
|
||||||
goto fail;
|
FOR_COMMANDS(cmd)
|
||||||
|
{
|
||||||
|
if (cmd->prio & GRUB_PRIO_LIST_FLAG_ACTIVE)
|
||||||
|
{
|
||||||
|
if (cmd->flags & GRUB_COMMAND_FLAG_CMDLINE)
|
||||||
|
{
|
||||||
|
if (add_completion (cmd->name, " ", GRUB_COMPLETION_TYPE_COMMAND))
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (*current_word == '-')
|
else if (*current_word == '-')
|
||||||
{
|
{
|
||||||
|
|
231
normal/handler.c
231
normal/handler.c
|
@ -1,231 +0,0 @@
|
||||||
/* handler.c - support handler loading */
|
|
||||||
/*
|
|
||||||
* 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/dl.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/err.h>
|
|
||||||
#include <grub/env.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/command.h>
|
|
||||||
#include <grub/handler.h>
|
|
||||||
#include <grub/normal.h>
|
|
||||||
|
|
||||||
struct grub_handler_list
|
|
||||||
{
|
|
||||||
struct grub_handler_list *next;
|
|
||||||
char *name;
|
|
||||||
grub_command_t cmd;
|
|
||||||
};
|
|
||||||
|
|
||||||
static grub_list_t handler_list;
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_handler_cmd (struct grub_command *cmd,
|
|
||||||
int argc __attribute__ ((unused)),
|
|
||||||
char **args __attribute__ ((unused)))
|
|
||||||
{
|
|
||||||
char *p;
|
|
||||||
grub_handler_class_t class;
|
|
||||||
grub_handler_t handler;
|
|
||||||
|
|
||||||
p = grub_strchr (cmd->name, '.');
|
|
||||||
if (! p)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid command name");
|
|
||||||
|
|
||||||
if (cmd->data)
|
|
||||||
{
|
|
||||||
if (! grub_dl_get (cmd->data))
|
|
||||||
{
|
|
||||||
grub_dl_t mod;
|
|
||||||
|
|
||||||
mod = grub_dl_load (cmd->data);
|
|
||||||
if (mod)
|
|
||||||
grub_dl_ref (mod);
|
|
||||||
else
|
|
||||||
return grub_errno;
|
|
||||||
}
|
|
||||||
grub_free (cmd->data);
|
|
||||||
cmd->data = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
*p = 0;
|
|
||||||
class = grub_named_list_find (GRUB_AS_NAMED_LIST (grub_handler_class_list),
|
|
||||||
cmd->name);
|
|
||||||
*p = '.';
|
|
||||||
|
|
||||||
if (! class)
|
|
||||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "class not found");
|
|
||||||
|
|
||||||
|
|
||||||
handler = grub_named_list_find (GRUB_AS_NAMED_LIST (class->handler_list),
|
|
||||||
p + 1);
|
|
||||||
if (! handler)
|
|
||||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "handler not found");
|
|
||||||
|
|
||||||
grub_handler_set_current (class, handler);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
insert_handler (char *name, char *module)
|
|
||||||
{
|
|
||||||
struct grub_handler_list *item;
|
|
||||||
char *data;
|
|
||||||
|
|
||||||
if (grub_command_find (name))
|
|
||||||
return;
|
|
||||||
|
|
||||||
item = grub_malloc (sizeof (*item));
|
|
||||||
if (! item)
|
|
||||||
return;
|
|
||||||
|
|
||||||
item->name = grub_strdup (name);
|
|
||||||
if (! item->name)
|
|
||||||
{
|
|
||||||
grub_free (item);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (module)
|
|
||||||
{
|
|
||||||
data = grub_strdup (module);
|
|
||||||
if (! data)
|
|
||||||
{
|
|
||||||
grub_free (item->name);
|
|
||||||
grub_free (item);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
data = 0;
|
|
||||||
|
|
||||||
item->cmd = grub_register_command (item->name, grub_handler_cmd, 0,
|
|
||||||
"Set active handler.");
|
|
||||||
if (! item->cmd)
|
|
||||||
{
|
|
||||||
grub_free (data);
|
|
||||||
grub_free (item->name);
|
|
||||||
grub_free (item);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
item->cmd->data = data;
|
|
||||||
grub_list_push (&handler_list, GRUB_AS_LIST (item));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Read the file handler.lst for auto-loading. */
|
|
||||||
void
|
|
||||||
read_handler_list (void)
|
|
||||||
{
|
|
||||||
const char *prefix;
|
|
||||||
static int first_time = 1;
|
|
||||||
const char *class_name;
|
|
||||||
|
|
||||||
auto int iterate_handler (grub_handler_t handler);
|
|
||||||
int iterate_handler (grub_handler_t handler)
|
|
||||||
{
|
|
||||||
char name[grub_strlen (class_name) + grub_strlen (handler->name) + 2];
|
|
||||||
|
|
||||||
grub_strcpy (name, class_name);
|
|
||||||
grub_strcat (name, ".");
|
|
||||||
grub_strcat (name, handler->name);
|
|
||||||
|
|
||||||
insert_handler (name, 0);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto int iterate_class (grub_handler_class_t class);
|
|
||||||
int iterate_class (grub_handler_class_t class)
|
|
||||||
{
|
|
||||||
class_name = class->name;
|
|
||||||
grub_list_iterate (GRUB_AS_LIST (class->handler_list),
|
|
||||||
(grub_list_hook_t) iterate_handler);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Make sure that this function does not get executed twice. */
|
|
||||||
if (! first_time)
|
|
||||||
return;
|
|
||||||
first_time = 0;
|
|
||||||
|
|
||||||
prefix = grub_env_get ("prefix");
|
|
||||||
if (prefix)
|
|
||||||
{
|
|
||||||
char *filename;
|
|
||||||
|
|
||||||
filename = grub_xasprintf ("%s/handler.lst", prefix);
|
|
||||||
if (filename)
|
|
||||||
{
|
|
||||||
grub_file_t file;
|
|
||||||
|
|
||||||
file = grub_file_open (filename);
|
|
||||||
if (file)
|
|
||||||
{
|
|
||||||
char *buf = NULL;
|
|
||||||
for (;; grub_free (buf))
|
|
||||||
{
|
|
||||||
char *p;
|
|
||||||
|
|
||||||
buf = grub_file_getline (file);
|
|
||||||
|
|
||||||
if (! buf)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (! grub_isgraph (buf[0]))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
p = grub_strchr (buf, ':');
|
|
||||||
if (! p)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
*p = '\0';
|
|
||||||
while (*++p == ' ')
|
|
||||||
;
|
|
||||||
|
|
||||||
insert_handler (buf, p);
|
|
||||||
}
|
|
||||||
grub_file_close (file);
|
|
||||||
}
|
|
||||||
grub_free (filename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_list_iterate (GRUB_AS_LIST (grub_handler_class_list),
|
|
||||||
(grub_list_hook_t) iterate_class);
|
|
||||||
|
|
||||||
/* Ignore errors. */
|
|
||||||
grub_errno = GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
free_handler_list (void)
|
|
||||||
{
|
|
||||||
struct grub_handler_list *item;
|
|
||||||
|
|
||||||
while ((item = grub_list_pop (&handler_list)) != 0)
|
|
||||||
{
|
|
||||||
grub_free (item->cmd->data);
|
|
||||||
grub_unregister_command (item->cmd);
|
|
||||||
grub_free (item->name);
|
|
||||||
grub_free (item);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include <grub/auth.h>
|
#include <grub/auth.h>
|
||||||
#include <grub/i18n.h>
|
#include <grub/i18n.h>
|
||||||
#include <grub/charset.h>
|
#include <grub/charset.h>
|
||||||
|
#include <grub/script_sh.h>
|
||||||
|
|
||||||
#define GRUB_DEFAULT_HISTORY_SIZE 50
|
#define GRUB_DEFAULT_HISTORY_SIZE 50
|
||||||
|
|
||||||
|
@ -347,7 +348,6 @@ static grub_menu_t
|
||||||
read_config_file (const char *config)
|
read_config_file (const char *config)
|
||||||
{
|
{
|
||||||
grub_file_t file;
|
grub_file_t file;
|
||||||
grub_parser_t old_parser = 0;
|
|
||||||
|
|
||||||
auto grub_err_t getline (char **line, int cont);
|
auto grub_err_t getline (char **line, int cont);
|
||||||
grub_err_t getline (char **line, int cont __attribute__ ((unused)))
|
grub_err_t getline (char **line, int cont __attribute__ ((unused)))
|
||||||
|
@ -361,36 +361,7 @@ read_config_file (const char *config)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
if (buf[0] == '#')
|
if (buf[0] == '#')
|
||||||
{
|
grub_free (*line);
|
||||||
if (buf[1] == '!')
|
|
||||||
{
|
|
||||||
grub_parser_t parser;
|
|
||||||
grub_named_list_t list;
|
|
||||||
|
|
||||||
buf += 2;
|
|
||||||
while (grub_isspace (*buf))
|
|
||||||
buf++;
|
|
||||||
|
|
||||||
if (! old_parser)
|
|
||||||
old_parser = grub_parser_get_current ();
|
|
||||||
|
|
||||||
list = GRUB_AS_NAMED_LIST (grub_parser_class.handler_list);
|
|
||||||
parser = grub_named_list_find (list, buf);
|
|
||||||
if (parser)
|
|
||||||
grub_parser_set_current (parser);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
char cmd_name[8 + grub_strlen (buf)];
|
|
||||||
|
|
||||||
/* Perhaps it's not loaded yet, try the autoload
|
|
||||||
command. */
|
|
||||||
grub_strcpy (cmd_name, "parser.");
|
|
||||||
grub_strcat (cmd_name, buf);
|
|
||||||
grub_command_execute (cmd_name, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
grub_free (*line);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -426,15 +397,12 @@ read_config_file (const char *config)
|
||||||
if ((getline (&line, 0)) || (! line))
|
if ((getline (&line, 0)) || (! line))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
grub_parser_get_current ()->parse_line (line, getline);
|
grub_normal_parse_line (line, getline);
|
||||||
grub_free (line);
|
grub_free (line);
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_file_close (file);
|
grub_file_close (file);
|
||||||
|
|
||||||
if (old_parser)
|
|
||||||
grub_parser_set_current (old_parser);
|
|
||||||
|
|
||||||
return newmenu;
|
return newmenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -499,7 +467,6 @@ grub_normal_execute (const char *config, int nested, int batch)
|
||||||
const char *prefix = grub_env_get ("prefix");
|
const char *prefix = grub_env_get ("prefix");
|
||||||
|
|
||||||
read_lists (prefix);
|
read_lists (prefix);
|
||||||
read_handler_list ();
|
|
||||||
grub_register_variable_hook ("prefix", NULL, read_lists_hook);
|
grub_register_variable_hook ("prefix", NULL, read_lists_hook);
|
||||||
grub_command_execute ("parser.grub", 0, 0);
|
grub_command_execute ("parser.grub", 0, 0);
|
||||||
|
|
||||||
|
@ -605,17 +572,15 @@ grub_normal_reader_init (int nested)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_normal_read_line_real (char **line, int cont, int nested)
|
grub_normal_read_line_real (char **line, int cont, int nested)
|
||||||
{
|
{
|
||||||
grub_parser_t parser = grub_parser_get_current ();
|
const char *prompt;
|
||||||
char *prompt;
|
|
||||||
|
|
||||||
if (cont)
|
if (cont)
|
||||||
prompt = grub_xasprintf (">");
|
prompt = ">";
|
||||||
else
|
else
|
||||||
prompt = grub_xasprintf ("%s>", parser->name);
|
prompt = "grub>";
|
||||||
|
|
||||||
if (!prompt)
|
if (!prompt)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
@ -629,14 +594,11 @@ grub_normal_read_line_real (char **line, int cont, int nested)
|
||||||
if (cont || nested)
|
if (cont || nested)
|
||||||
{
|
{
|
||||||
grub_free (*line);
|
grub_free (*line);
|
||||||
grub_free (prompt);
|
|
||||||
*line = 0;
|
*line = 0;
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_free (prompt);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -677,7 +639,7 @@ grub_cmdline_run (int nested)
|
||||||
if (! line)
|
if (! line)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
grub_parser_get_current ()->parse_line (line, grub_normal_read_line);
|
grub_normal_parse_line (line, grub_normal_read_line);
|
||||||
grub_free (line);
|
grub_free (line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -725,5 +687,4 @@ GRUB_MOD_FINI(normal)
|
||||||
grub_set_history (0);
|
grub_set_history (0);
|
||||||
grub_register_variable_hook ("pager", 0, 0);
|
grub_register_variable_hook ("pager", 0, 0);
|
||||||
grub_fs_autoload_hook = 0;
|
grub_fs_autoload_hook = 0;
|
||||||
free_handler_list ();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include <grub/loader.h>
|
#include <grub/loader.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
#include <grub/parser.h>
|
#include <grub/parser.h>
|
||||||
|
#include <grub/script_sh.h>
|
||||||
#include <grub/auth.h>
|
#include <grub/auth.h>
|
||||||
#include <grub/i18n.h>
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
|
@ -1189,7 +1190,7 @@ run (struct screen *screen)
|
||||||
while (currline < screen->num_lines)
|
while (currline < screen->num_lines)
|
||||||
{
|
{
|
||||||
editor_getline (&nextline, 0);
|
editor_getline (&nextline, 0);
|
||||||
if (grub_parser_get_current ()->parse_line (nextline, editor_getline))
|
if (grub_normal_parse_line (nextline, editor_getline))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <grub/parser.h>
|
#include <grub/parser.h>
|
||||||
#include <grub/mm.h>
|
#include <grub/mm.h>
|
||||||
|
|
||||||
static grub_script_function_t grub_script_function_list;
|
grub_script_function_t grub_script_function_list;
|
||||||
|
|
||||||
grub_script_function_t
|
grub_script_function_t
|
||||||
grub_script_function_create (struct grub_script_arg *functionname_arg,
|
grub_script_function_create (struct grub_script_arg *functionname_arg,
|
||||||
|
@ -104,18 +104,6 @@ grub_script_function_find (char *functionname)
|
||||||
return func;
|
return func;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
grub_script_function_iterate (int (*iterate) (grub_script_function_t))
|
|
||||||
{
|
|
||||||
grub_script_function_t func;
|
|
||||||
|
|
||||||
for (func = grub_script_function_list; func; func = func->next)
|
|
||||||
if (iterate (func))
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
grub_script_function_call (grub_script_function_t func,
|
grub_script_function_call (grub_script_function_t func,
|
||||||
int argc __attribute__((unused)),
|
int argc __attribute__((unused)),
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include <grub/parser.h>
|
#include <grub/parser.h>
|
||||||
#include <grub/script_sh.h>
|
#include <grub/script_sh.h>
|
||||||
|
|
||||||
static grub_err_t
|
grub_err_t
|
||||||
grub_normal_parse_line (char *line, grub_reader_getline_t getline)
|
grub_normal_parse_line (char *line, grub_reader_getline_t getline)
|
||||||
{
|
{
|
||||||
struct grub_script *parsed_script;
|
struct grub_script *parsed_script;
|
||||||
|
@ -39,19 +39,3 @@ grub_normal_parse_line (char *line, grub_reader_getline_t getline)
|
||||||
|
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct grub_parser grub_sh_parser =
|
|
||||||
{
|
|
||||||
.name = "grub",
|
|
||||||
.parse_line = grub_normal_parse_line
|
|
||||||
};
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(sh)
|
|
||||||
{
|
|
||||||
grub_parser_register ("grub", &grub_sh_parser);
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(sh)
|
|
||||||
{
|
|
||||||
grub_parser_unregister (&grub_sh_parser);
|
|
||||||
}
|
|
||||||
|
|
|
@ -26,15 +26,10 @@ grub_functional_test (struct grub_extcmd *cmd __attribute__ ((unused)),
|
||||||
int argc __attribute__ ((unused)),
|
int argc __attribute__ ((unused)),
|
||||||
char **args __attribute__ ((unused)))
|
char **args __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
auto int run_test (grub_test_t test);
|
grub_test_t test;
|
||||||
int run_test (grub_test_t test)
|
|
||||||
{
|
|
||||||
grub_test_run (test);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_list_iterate (GRUB_AS_LIST (grub_test_list),
|
FOR_LIST_ELEMENTS (test, grub_test_list)
|
||||||
(grub_list_hook_t) run_test);
|
grub_test_run (test);
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,8 +66,10 @@ free_failures (void)
|
||||||
{
|
{
|
||||||
grub_test_failure_t item;
|
grub_test_failure_t item;
|
||||||
|
|
||||||
while ((item = grub_list_pop (GRUB_AS_LIST_P (&failure_list))) != 0)
|
while (failure_list)
|
||||||
{
|
{
|
||||||
|
item = failure_list;
|
||||||
|
failure_list = item->next;
|
||||||
if (item->message)
|
if (item->message)
|
||||||
grub_free (item->message);
|
grub_free (item->message);
|
||||||
|
|
||||||
|
@ -134,23 +136,17 @@ grub_test_unregister (const char *name)
|
||||||
int
|
int
|
||||||
grub_test_run (grub_test_t test)
|
grub_test_run (grub_test_t test)
|
||||||
{
|
{
|
||||||
auto int print_failure (grub_test_failure_t item);
|
grub_test_failure_t failure;
|
||||||
int print_failure (grub_test_failure_t item)
|
|
||||||
{
|
|
||||||
grub_test_failure_t failure = (grub_test_failure_t) item;
|
|
||||||
|
|
||||||
grub_printf (" %s:%s:%u: %s\n",
|
|
||||||
(failure->file ? : "<unknown_file>"),
|
|
||||||
(failure->funp ? : "<unknown_function>"),
|
|
||||||
failure->line, (failure->message ? : "<no message>"));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
test->main ();
|
test->main ();
|
||||||
|
|
||||||
grub_printf ("%s:\n", test->name);
|
grub_printf ("%s:\n", test->name);
|
||||||
grub_list_iterate (GRUB_AS_LIST (failure_list),
|
FOR_LIST_ELEMENTS (failure, failure_list)
|
||||||
(grub_list_hook_t) print_failure);
|
grub_printf (" %s:%s:%u: %s\n",
|
||||||
|
(failure->file ? : "<unknown_file>"),
|
||||||
|
(failure->funp ? : "<unknown_function>"),
|
||||||
|
failure->line, (failure->message ? : "<no message>"));
|
||||||
|
|
||||||
if (!failure_list)
|
if (!failure_list)
|
||||||
grub_printf ("%s: PASS\n", test->name);
|
grub_printf ("%s: PASS\n", test->name);
|
||||||
else
|
else
|
||||||
|
|
|
@ -34,16 +34,12 @@ main (int argc __attribute__ ((unused)),
|
||||||
extern void grub_unit_test_init (void);
|
extern void grub_unit_test_init (void);
|
||||||
extern void grub_unit_test_fini (void);
|
extern void grub_unit_test_fini (void);
|
||||||
|
|
||||||
auto int run_test (grub_test_t test);
|
grub_test_t test;
|
||||||
int run_test (grub_test_t test)
|
|
||||||
{
|
|
||||||
status = grub_test_run (test) ? : status;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_unit_test_init ();
|
grub_unit_test_init ();
|
||||||
grub_list_iterate (GRUB_AS_LIST (grub_test_list),
|
FOR_LIST_ELEMENTS (test, grub_test_list)
|
||||||
(grub_list_hook_t) run_test);
|
status = grub_test_run (test) ? : status;
|
||||||
|
|
||||||
grub_unit_test_fini ();
|
grub_unit_test_fini ();
|
||||||
|
|
||||||
exit (status);
|
exit (status);
|
||||||
|
|
|
@ -750,8 +750,8 @@ grub_util_iterate_devices (int NESTED_FUNC_ATTR (*hook) (const char *, int),
|
||||||
free (name);
|
free (name);
|
||||||
while (seen)
|
while (seen)
|
||||||
{
|
{
|
||||||
struct dmraid_seen *seen_elt =
|
struct dmraid_seen *seen_elt = seen;
|
||||||
grub_list_pop (GRUB_AS_LIST_P (&seen));
|
seen = seen->next;
|
||||||
free (seen_elt);
|
free (seen_elt);
|
||||||
}
|
}
|
||||||
if (task)
|
if (task)
|
||||||
|
@ -776,7 +776,8 @@ dmraid_next_child:
|
||||||
dmraid_end:
|
dmraid_end:
|
||||||
while (seen)
|
while (seen)
|
||||||
{
|
{
|
||||||
struct dmraid_seen *seen_elt = grub_list_pop (GRUB_AS_LIST_P (&seen));
|
struct dmraid_seen *seen_elt = seen;
|
||||||
|
seen = seen->next;
|
||||||
free (seen_elt);
|
free (seen_elt);
|
||||||
}
|
}
|
||||||
if (task)
|
if (task)
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
#include <grub/types.h>
|
#include <grub/types.h>
|
||||||
#include <grub/util/misc.h>
|
#include <grub/util/misc.h>
|
||||||
#include <grub/lib/envblk.h>
|
#include <grub/lib/envblk.h>
|
||||||
#include <grub/handler.h>
|
|
||||||
#include <grub/i18n.h>
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
@ -55,9 +55,6 @@ grub_getkey (void)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct grub_handler_class grub_term_input_class;
|
|
||||||
struct grub_handler_class grub_term_output_class;
|
|
||||||
|
|
||||||
void
|
void
|
||||||
grub_refresh (void)
|
grub_refresh (void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -103,8 +103,23 @@ Report bugs to <bug-grub@gnu.org>.
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
argument () {
|
||||||
|
opt=$1
|
||||||
|
shift
|
||||||
|
|
||||||
|
if test $# -eq 0; then
|
||||||
|
echo "$0: option requires an argument -- '$opt'" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo $1
|
||||||
|
}
|
||||||
|
|
||||||
# Check the arguments.
|
# Check the arguments.
|
||||||
for option in "$@"; do
|
while test $# -gt 0
|
||||||
|
do
|
||||||
|
option=$1
|
||||||
|
shift
|
||||||
|
|
||||||
case "$option" in
|
case "$option" in
|
||||||
-h | --help)
|
-h | --help)
|
||||||
usage
|
usage
|
||||||
|
@ -112,33 +127,62 @@ for option in "$@"; do
|
||||||
-v | --version)
|
-v | --version)
|
||||||
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
|
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
|
||||||
|
--modules)
|
||||||
|
modules=`argument $option "$@"`; shift;;
|
||||||
--modules=*)
|
--modules=*)
|
||||||
modules=`echo "$option" | sed 's/--modules=//'` ;;
|
modules=`echo "$option" | sed 's/--modules=//'` ;;
|
||||||
|
|
||||||
|
--font)
|
||||||
|
font=`argument $option "$@"`; shift;;
|
||||||
--font=*)
|
--font=*)
|
||||||
font=`echo "$option" | sed 's/--font=//'` ;;
|
font=`echo "$option" | sed 's/--font=//'` ;;
|
||||||
|
|
||||||
|
--root-directory)
|
||||||
|
rootdir=`argument $option "$@"`; shift;;
|
||||||
--root-directory=*)
|
--root-directory=*)
|
||||||
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
|
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
|
||||||
|
|
||||||
|
--grub-setup)
|
||||||
|
grub_setup=`argument $option "$@"`; shift;;
|
||||||
--grub-setup=*)
|
--grub-setup=*)
|
||||||
grub_setup=`echo "$option" | sed 's/--grub-setup=//'` ;;
|
grub_setup=`echo "$option" | sed 's/--grub-setup=//'` ;;
|
||||||
|
|
||||||
|
--grub-mkimage)
|
||||||
|
grub_mkimage=`argument $option "$@"`; shift;;
|
||||||
--grub-mkimage=*)
|
--grub-mkimage=*)
|
||||||
grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
|
grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
|
||||||
|
|
||||||
|
--grub-mkdevicemap)
|
||||||
|
grub_mkdevicemap=`argument $option "$@"`; shift;;
|
||||||
--grub-mkdevicemap=*)
|
--grub-mkdevicemap=*)
|
||||||
grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;;
|
grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;;
|
||||||
|
|
||||||
|
--grub-probe)
|
||||||
|
grub_probe=`argument $option "$@"`; shift;;
|
||||||
--grub-probe=*)
|
--grub-probe=*)
|
||||||
grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;;
|
grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;;
|
||||||
|
|
||||||
--no-floppy)
|
--no-floppy)
|
||||||
no_floppy="--no-floppy" ;;
|
no_floppy="--no-floppy" ;;
|
||||||
--recheck)
|
--recheck)
|
||||||
recheck=yes ;;
|
recheck=yes ;;
|
||||||
|
|
||||||
|
--disk-module)
|
||||||
|
if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
|
||||||
|
disk_module=`argument $option "$@"`; shift;
|
||||||
|
fi ;;
|
||||||
--disk-module=*)
|
--disk-module=*)
|
||||||
if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
|
if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
|
||||||
disk_module=`echo "$option" | sed 's/--disk-module=//'`
|
disk_module=`echo "$option" | sed 's/--disk-module=//'`
|
||||||
fi ;;
|
fi ;;
|
||||||
|
|
||||||
# This is an undocumented feature...
|
# This is an undocumented feature...
|
||||||
--debug)
|
--debug)
|
||||||
debug=yes ;;
|
debug=yes ;;
|
||||||
-f | --force)
|
-f | --force)
|
||||||
setup_force="--force" ;;
|
setup_force="--force" ;;
|
||||||
|
|
||||||
-*)
|
-*)
|
||||||
echo "Unrecognized option \`$option'" 1>&2
|
echo "Unrecognized option \`$option'" 1>&2
|
||||||
usage
|
usage
|
||||||
|
|
|
@ -52,14 +52,23 @@ Report bugs to <bug-grub@gnu.org>.
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
argument () {
|
||||||
|
opt=$1
|
||||||
|
shift
|
||||||
|
|
||||||
|
if test $# -eq 0; then
|
||||||
|
echo "$0: option requires an argument -- '$opt'" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo $1
|
||||||
|
}
|
||||||
|
|
||||||
# Check the arguments.
|
# Check the arguments.
|
||||||
next_grub_cfg=false
|
while test $# -gt 0
|
||||||
for option in "$@"; do
|
do
|
||||||
if $next_grub_cfg; then
|
option=$1
|
||||||
grub_cfg=$option
|
shift
|
||||||
next_grub_cfg=false
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
case "$option" in
|
case "$option" in
|
||||||
-h | --help)
|
-h | --help)
|
||||||
usage
|
usage
|
||||||
|
@ -67,9 +76,8 @@ for option in "$@"; do
|
||||||
-v | --version)
|
-v | --version)
|
||||||
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
|
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
-o)
|
-o | --output)
|
||||||
next_grub_cfg=:
|
grub_cfg=`argument $option "$@"`; shift;;
|
||||||
;;
|
|
||||||
--output=*)
|
--output=*)
|
||||||
grub_cfg=`echo "$option" | sed 's/--output=//'`
|
grub_cfg=`echo "$option" | sed 's/--output=//'`
|
||||||
;;
|
;;
|
||||||
|
@ -78,6 +86,10 @@ for option in "$@"; do
|
||||||
usage
|
usage
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
|
*)
|
||||||
|
echo "Invalid parameter, $option" 1>&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
if $next_grub_cfg; then
|
if $next_grub_cfg; then
|
||||||
|
|
|
@ -42,6 +42,8 @@ rom_directory=
|
||||||
override_dir=
|
override_dir=
|
||||||
grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
|
grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
|
||||||
|
|
||||||
|
xorriso=xorriso
|
||||||
|
|
||||||
# Usage: usage
|
# Usage: usage
|
||||||
# Print the usage.
|
# Print the usage.
|
||||||
usage () {
|
usage () {
|
||||||
|
@ -51,19 +53,38 @@ Make GRUB rescue image.
|
||||||
|
|
||||||
-h, --help print this message and exit
|
-h, --help print this message and exit
|
||||||
-v, --version print the version information and exit
|
-v, --version print the version information and exit
|
||||||
--output=FILE save output in FILE [required]
|
-o, --output=FILE save output in FILE [required]
|
||||||
--modules=MODULES pre-load specified modules MODULES
|
--modules=MODULES pre-load specified modules MODULES
|
||||||
--rom-directory=DIR save rom images in DIR [optional]
|
--rom-directory=DIR save rom images in DIR [optional]
|
||||||
|
--xorriso=FILE use FILE as xorriso [optional]
|
||||||
--grub-mkimage=FILE use FILE as grub-mkimage
|
--grub-mkimage=FILE use FILE as grub-mkimage
|
||||||
|
|
||||||
$self generates a bootable rescue image with specified source files or directories.
|
$self generates a bootable rescue image with specified source files, source
|
||||||
|
directories, or mkisofs options listed by: xorriso -as mkisofs -help
|
||||||
|
Option -- switches to native xorriso command mode. or directories.
|
||||||
|
|
||||||
Report bugs to <bug-grub@gnu.org>.
|
Report bugs to <bug-grub@gnu.org>.
|
||||||
|
Mail xorriso support requests to <bug-xorriso@gnu.org>.
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
argument () {
|
||||||
|
opt=$1
|
||||||
|
shift
|
||||||
|
|
||||||
|
if test $# -eq 0; then
|
||||||
|
echo "$0: option requires an argument -- '$opt'" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo $1
|
||||||
|
}
|
||||||
|
|
||||||
# Check the arguments.
|
# Check the arguments.
|
||||||
for option in "$@"; do
|
while test $# -gt 0
|
||||||
|
do
|
||||||
|
option=$1
|
||||||
|
shift
|
||||||
|
|
||||||
case "$option" in
|
case "$option" in
|
||||||
-h | --help)
|
-h | --help)
|
||||||
usage
|
usage
|
||||||
|
@ -71,27 +92,47 @@ for option in "$@"; do
|
||||||
-v | --version)
|
-v | --version)
|
||||||
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
|
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
|
||||||
|
--modules)
|
||||||
|
modules=`argument $option "$@"`; shift ;;
|
||||||
--modules=*)
|
--modules=*)
|
||||||
modules=`echo "$option" | sed 's/--modules=//'` ;;
|
modules=`echo "$option" | sed 's/--modules=//'` ;;
|
||||||
|
|
||||||
|
-o | --output)
|
||||||
|
output_image=`argument $option "$@"`; shift ;;
|
||||||
--output=*)
|
--output=*)
|
||||||
output_image=`echo "$option" | sed 's/--output=//'` ;;
|
output_image=`echo "$option" | sed 's/--output=//'` ;;
|
||||||
|
|
||||||
|
--rom-directory)
|
||||||
|
rom_directory=`argument $option "$@"`; shift ;;
|
||||||
--rom-directory=*)
|
--rom-directory=*)
|
||||||
rom_directory=`echo "$option" | sed 's/--rom-directory=//'` ;;
|
rom_directory=`echo "$option" | sed 's/--rom-directory=//'` ;;
|
||||||
|
|
||||||
# Intentionally undocumented
|
# Intentionally undocumented
|
||||||
|
--override-directory)
|
||||||
|
override_dir=`argument $option "$@"`
|
||||||
|
shift
|
||||||
|
PATH=${override_dir}:$PATH
|
||||||
|
export PATH
|
||||||
|
;;
|
||||||
--override-directory=*)
|
--override-directory=*)
|
||||||
override_dir=`echo "${option}/" | sed 's/--override-directory=//'`
|
override_dir=`echo "${option}/" | sed 's/--override-directory=//'`
|
||||||
PATH=${override_dir}:$PATH
|
PATH=${override_dir}:$PATH
|
||||||
export PATH
|
export PATH
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
--grub-mkimage)
|
||||||
|
grub_mkimage=`argument $option "$@"`; shift ;;
|
||||||
--grub-mkimage=*)
|
--grub-mkimage=*)
|
||||||
grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
|
grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
|
||||||
-*)
|
|
||||||
echo "Unrecognized option \`$option'" 1>&2
|
--xorriso)
|
||||||
usage
|
xorriso=`argument $option "$@"`; shift ;;
|
||||||
exit 1
|
--xorriso=*)
|
||||||
;;
|
xorriso=`echo "${option}/" | sed 's/--xorriso=//'` ;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
source="${source} ${option}" ;;
|
source="${source} ${option} $@"; break ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -173,7 +214,7 @@ EOF
|
||||||
tar -C ${memdisk_dir} -cf ${memdisk_img} boot
|
tar -C ${memdisk_dir} -cf ${memdisk_img} boot
|
||||||
rm -rf ${memdisk_dir}
|
rm -rf ${memdisk_dir}
|
||||||
$grub_mkimage -O ${platform} -d "${source_directory}" -m "${memdisk_img}" -o "$3" --prefix='(memdisk)/boot/grub' \
|
$grub_mkimage -O ${platform} -d "${source_directory}" -m "${memdisk_img}" -o "$3" --prefix='(memdisk)/boot/grub' \
|
||||||
search iso9660 configfile normal sh memdisk tar $4
|
search iso9660 configfile normal memdisk tar $4
|
||||||
rm -rf ${memdisk_img}
|
rm -rf ${memdisk_img}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,7 +310,7 @@ if [ -e "${iso9660_dir}/boot/coreboot.elf" ] && [ -d "${rom_directory}" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# build iso image
|
# build iso image
|
||||||
xorriso -pathspecs on -as mkisofs ${grub_mkisofs_arguments} --protective-msdos-label -o ${output_image} -r ${iso9660_dir} ${source}
|
"${xorriso}" -as mkisofs -graft-points ${grub_mkisofs_arguments} --protective-msdos-label -o ${output_image} -r ${iso9660_dir} --sort-weight 0 / --sort-weight 1 /boot ${source}
|
||||||
rm -rf ${iso9660_dir}
|
rm -rf ${iso9660_dir}
|
||||||
|
|
||||||
rm -f ${embed_img}
|
rm -f ${embed_img}
|
||||||
|
|
|
@ -71,9 +71,6 @@ grub_getkey (void)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct grub_handler_class grub_term_input_class;
|
|
||||||
struct grub_handler_class grub_term_output_class;
|
|
||||||
|
|
||||||
void
|
void
|
||||||
grub_refresh (void)
|
grub_refresh (void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -48,8 +48,23 @@ Report bugs to <bug-grub@gnu.org>.
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
argument () {
|
||||||
|
opt=$1
|
||||||
|
shift
|
||||||
|
|
||||||
|
if test $# -eq 0; then
|
||||||
|
echo "$0: option requires an argument -- '$opt'" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo $1
|
||||||
|
}
|
||||||
|
|
||||||
# Check the arguments.
|
# Check the arguments.
|
||||||
for option in "$@"; do
|
while test $# -gt 0
|
||||||
|
do
|
||||||
|
option=$1
|
||||||
|
shift
|
||||||
|
|
||||||
case "$option" in
|
case "$option" in
|
||||||
-h | --help)
|
-h | --help)
|
||||||
usage
|
usage
|
||||||
|
@ -57,8 +72,12 @@ for option in "$@"; do
|
||||||
-v | --version)
|
-v | --version)
|
||||||
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
|
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
|
||||||
|
--root-directory)
|
||||||
|
rootdir=`argument $option "$@"`; shift ;;
|
||||||
--root-directory=*)
|
--root-directory=*)
|
||||||
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
|
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
|
||||||
|
|
||||||
-*)
|
-*)
|
||||||
echo "Unrecognized option \`$option'" 1>&2
|
echo "Unrecognized option \`$option'" 1>&2
|
||||||
usage
|
usage
|
||||||
|
|
|
@ -26,8 +26,6 @@
|
||||||
#include <grub/parser.h>
|
#include <grub/parser.h>
|
||||||
#include <grub/script_sh.h>
|
#include <grub/script_sh.h>
|
||||||
|
|
||||||
#include <grub_script_check_init.h>
|
|
||||||
|
|
||||||
#define _GNU_SOURCE 1
|
#define _GNU_SOURCE 1
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
@ -239,9 +237,6 @@ main (int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize all modules. */
|
|
||||||
grub_init_all ();
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
input = 0;
|
input = 0;
|
||||||
|
@ -260,8 +255,6 @@ main (int argc, char *argv[])
|
||||||
grub_free (input);
|
grub_free (input);
|
||||||
} while (script != 0);
|
} while (script != 0);
|
||||||
|
|
||||||
/* Free resources. */
|
|
||||||
grub_fini_all ();
|
|
||||||
if (file) fclose (file);
|
if (file) fclose (file);
|
||||||
|
|
||||||
return (found_input && script == 0);
|
return (found_input && script == 0);
|
||||||
|
|
|
@ -48,8 +48,23 @@ Report bugs to <bug-grub@gnu.org>.
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
argument () {
|
||||||
|
opt=$1
|
||||||
|
shift
|
||||||
|
|
||||||
|
if test $# -eq 0; then
|
||||||
|
echo "$0: option requires an argument -- '$opt'" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo $1
|
||||||
|
}
|
||||||
|
|
||||||
# Check the arguments.
|
# Check the arguments.
|
||||||
for option in "$@"; do
|
while test $# -gt 0
|
||||||
|
do
|
||||||
|
option=$1
|
||||||
|
shift
|
||||||
|
|
||||||
case "$option" in
|
case "$option" in
|
||||||
-h | --help)
|
-h | --help)
|
||||||
usage
|
usage
|
||||||
|
@ -57,8 +72,12 @@ for option in "$@"; do
|
||||||
-v | --version)
|
-v | --version)
|
||||||
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
|
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
|
||||||
|
--root-directory)
|
||||||
|
rootdir=`argument $option "$@"`; shift ;;
|
||||||
--root-directory=*)
|
--root-directory=*)
|
||||||
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
|
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
|
||||||
|
|
||||||
-*)
|
-*)
|
||||||
echo "Unrecognized option \`$option'" 1>&2
|
echo "Unrecognized option \`$option'" 1>&2
|
||||||
usage
|
usage
|
||||||
|
|
|
@ -97,7 +97,7 @@ EOF
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do
|
list=`for i in /boot/vmlinu[zx]-* /vmlinu[zx]-* ; do
|
||||||
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
|
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
|
||||||
done`
|
done`
|
||||||
prepare_boot_cache=
|
prepare_boot_cache=
|
||||||
|
|
7
util/grub.d/41_custom.in
Normal file
7
util/grub.d/41_custom.in
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/sh
|
||||||
|
cat <<EOF
|
||||||
|
if [ -f \$prefix/custom.cfg ]; then
|
||||||
|
source \$prefix/custom.cfg;
|
||||||
|
fi
|
||||||
|
EOF
|
||||||
|
|
|
@ -73,8 +73,23 @@ Report bugs to <bug-grub@gnu.org>.
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
argument () {
|
||||||
|
opt=$1
|
||||||
|
shift
|
||||||
|
|
||||||
|
if test $# -eq 0; then
|
||||||
|
echo "$0: option requires an argument -- '$opt'" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo $1
|
||||||
|
}
|
||||||
|
|
||||||
# Check the arguments.
|
# Check the arguments.
|
||||||
for option in "$@"; do
|
while test $# -gt 0
|
||||||
|
do
|
||||||
|
option=$1
|
||||||
|
shift
|
||||||
|
|
||||||
case "$option" in
|
case "$option" in
|
||||||
-h | --help)
|
-h | --help)
|
||||||
usage
|
usage
|
||||||
|
@ -82,16 +97,32 @@ for option in "$@"; do
|
||||||
-v | --version)
|
-v | --version)
|
||||||
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
|
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
|
||||||
|
--modules)
|
||||||
|
modules=`argument $option "$@"`; shift ;;
|
||||||
--modules=*)
|
--modules=*)
|
||||||
modules=`echo "$option" | sed 's/--modules=//'` ;;
|
modules=`echo "$option" | sed 's/--modules=//'` ;;
|
||||||
|
|
||||||
|
--root-directory)
|
||||||
|
rootdir=`argument $option "$@"`; shift ;;
|
||||||
--root-directory=*)
|
--root-directory=*)
|
||||||
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
|
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
|
||||||
|
|
||||||
|
--grub-mkimage)
|
||||||
|
grub_mkimage=`argument $option "$@"`; shift ;;
|
||||||
--grub-mkimage=*)
|
--grub-mkimage=*)
|
||||||
grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
|
grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
|
||||||
|
|
||||||
|
--grub-mkdevicemap)
|
||||||
|
grub_mkdevicemap=`argument $option "$@"`; shift ;;
|
||||||
--grub-mkdevicemap=*)
|
--grub-mkdevicemap=*)
|
||||||
grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;;
|
grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;;
|
||||||
|
|
||||||
|
--grub-probe)
|
||||||
|
grub_probe=`argument $option "$@"`; shift ;;
|
||||||
--grub-probe=*)
|
--grub-probe=*)
|
||||||
grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;;
|
grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;;
|
||||||
|
|
||||||
--no-floppy)
|
--no-floppy)
|
||||||
no_floppy="--no-floppy" ;;
|
no_floppy="--no-floppy" ;;
|
||||||
--recheck)
|
--recheck)
|
||||||
|
|
|
@ -76,9 +76,6 @@ grub_getkey (void)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct grub_handler_class grub_term_input_class;
|
|
||||||
struct grub_handler_class grub_term_output_class;
|
|
||||||
|
|
||||||
void
|
void
|
||||||
grub_refresh (void)
|
grub_refresh (void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -76,8 +76,23 @@ Report bugs to <bug-grub@gnu.org>.
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
argument () {
|
||||||
|
opt=$1
|
||||||
|
shift
|
||||||
|
|
||||||
|
if test $# -eq 0; then
|
||||||
|
echo "$0: option requires an argument -- '$opt'" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo $1
|
||||||
|
}
|
||||||
|
|
||||||
# Check the arguments.
|
# Check the arguments.
|
||||||
for option in "$@"; do
|
while test $# -gt 0
|
||||||
|
do
|
||||||
|
option=$1
|
||||||
|
shift
|
||||||
|
|
||||||
case "$option" in
|
case "$option" in
|
||||||
-h | --help)
|
-h | --help)
|
||||||
usage
|
usage
|
||||||
|
@ -85,16 +100,32 @@ for option in "$@"; do
|
||||||
-v | --version)
|
-v | --version)
|
||||||
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
|
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
|
||||||
|
--modules)
|
||||||
|
modules=`argument $option "$@"`; shift ;;
|
||||||
--modules=*)
|
--modules=*)
|
||||||
modules=`echo "$option" | sed 's/--modules=//'` ;;
|
modules=`echo "$option" | sed 's/--modules=//'` ;;
|
||||||
|
|
||||||
|
--root-directory)
|
||||||
|
rootdir=`argument $option "$@"`; shift ;;
|
||||||
--root-directory=*)
|
--root-directory=*)
|
||||||
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
|
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
|
||||||
|
|
||||||
|
--grub-mkdevicemap)
|
||||||
|
grub_mkdevicemap=`argument $option "$@"`; shift ;;
|
||||||
--grub-mkdevicemap=*)
|
--grub-mkdevicemap=*)
|
||||||
grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;;
|
grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;;
|
||||||
|
|
||||||
|
--grub-mkimage)
|
||||||
|
grub_mkimage=`argument $option "$@"`; shift ;;
|
||||||
--grub-mkimage=*)
|
--grub-mkimage=*)
|
||||||
grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
|
grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
|
||||||
|
|
||||||
|
--grub-probe)
|
||||||
|
grub_probe=`argument $option "$@"`; shift ;;
|
||||||
--grub-probe=*)
|
--grub-probe=*)
|
||||||
grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;;
|
grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;;
|
||||||
|
|
||||||
--no-nvram)
|
--no-nvram)
|
||||||
update_nvram=no ;;
|
update_nvram=no ;;
|
||||||
# This is an undocumented feature...
|
# This is an undocumented feature...
|
||||||
|
|
|
@ -54,10 +54,25 @@ Report bugs to <bug-grub@gnu.org>.
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
argument () {
|
||||||
|
opt=$1
|
||||||
|
shift
|
||||||
|
|
||||||
|
if test $# -eq 0; then
|
||||||
|
echo "$0: option requires an argument -- '$opt'" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo $1
|
||||||
|
}
|
||||||
|
|
||||||
input_dir=${pkglibdir}
|
input_dir=${pkglibdir}
|
||||||
|
|
||||||
# Check the arguments.
|
# Check the arguments.
|
||||||
for option in "$@"; do
|
while test $# -gt 0
|
||||||
|
do
|
||||||
|
option=$1
|
||||||
|
shift
|
||||||
|
|
||||||
case "$option" in
|
case "$option" in
|
||||||
-h | --help)
|
-h | --help)
|
||||||
usage
|
usage
|
||||||
|
@ -65,12 +80,22 @@ for option in "$@"; do
|
||||||
-v | --version)
|
-v | --version)
|
||||||
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
|
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
|
||||||
|
--modules)
|
||||||
|
modules=`argument $option "$@"`; shift ;;
|
||||||
--modules=*)
|
--modules=*)
|
||||||
modules=`echo "$option" | sed 's/--modules=//'` ;;
|
modules=`echo "$option" | sed 's/--modules=//'` ;;
|
||||||
|
|
||||||
|
--pkglibdir)
|
||||||
|
input_dir=`argument $option "$@"`; shift ;;
|
||||||
--pkglibdir=*)
|
--pkglibdir=*)
|
||||||
input_dir=`echo "$option" | sed 's/--pkglibdir=//'` ;;
|
input_dir=`echo "$option" | sed 's/--pkglibdir=//'` ;;
|
||||||
|
|
||||||
|
--grub-mkimage)
|
||||||
|
grub_mkimage=`argument $option "$@"`; shift ;;
|
||||||
--grub-mkimage=*)
|
--grub-mkimage=*)
|
||||||
grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
|
grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
|
||||||
|
|
||||||
-*)
|
-*)
|
||||||
echo "Unrecognized option \`$option'" 1>&2
|
echo "Unrecognized option \`$option'" 1>&2
|
||||||
usage
|
usage
|
||||||
|
|
|
@ -102,9 +102,6 @@ grub_getkey (void)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct grub_handler_class grub_term_input_class;
|
|
||||||
struct grub_handler_class grub_term_output_class;
|
|
||||||
|
|
||||||
void
|
void
|
||||||
grub_refresh (void)
|
grub_refresh (void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,44 +23,11 @@
|
||||||
#include <grub/mm.h>
|
#include <grub/mm.h>
|
||||||
|
|
||||||
/* The list of video adapters registered to system. */
|
/* The list of video adapters registered to system. */
|
||||||
static grub_video_adapter_t grub_video_adapter_list;
|
grub_video_adapter_t grub_video_adapter_list = NULL;
|
||||||
|
|
||||||
/* Active video adapter. */
|
/* Active video adapter. */
|
||||||
static grub_video_adapter_t grub_video_adapter_active;
|
static grub_video_adapter_t grub_video_adapter_active;
|
||||||
|
|
||||||
/* Register video driver. */
|
|
||||||
void
|
|
||||||
grub_video_register (grub_video_adapter_t adapter)
|
|
||||||
{
|
|
||||||
adapter->next = grub_video_adapter_list;
|
|
||||||
grub_video_adapter_list = adapter;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Unregister video driver. */
|
|
||||||
void
|
|
||||||
grub_video_unregister (grub_video_adapter_t adapter)
|
|
||||||
{
|
|
||||||
grub_video_adapter_t *p, q;
|
|
||||||
|
|
||||||
for (p = &grub_video_adapter_list, q = *p; q; p = &(q->next), q = q->next)
|
|
||||||
if (q == adapter)
|
|
||||||
{
|
|
||||||
*p = q->next;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Iterate thru all registered video drivers. */
|
|
||||||
void
|
|
||||||
grub_video_iterate (int (*hook) (grub_video_adapter_t adapter))
|
|
||||||
{
|
|
||||||
grub_video_adapter_t p;
|
|
||||||
|
|
||||||
for (p = grub_video_adapter_list; p; p = p->next)
|
|
||||||
if (hook (p))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Restore back to initial mode (where applicable). */
|
/* Restore back to initial mode (where applicable). */
|
||||||
grub_err_t
|
grub_err_t
|
||||||
grub_video_restore (void)
|
grub_video_restore (void)
|
||||||
|
|
Loading…
Reference in a new issue