merged with mainline
This commit is contained in:
commit
20072d3ad5
42 changed files with 1037 additions and 480 deletions
150
ChangeLog
150
ChangeLog
|
@ -1,3 +1,153 @@
|
|||
2010-04-10 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* loader/multiboot.c (GRUB_MOD_INIT) [GRUB_USE_MULTIBOOT2]:
|
||||
Rename "module" to "module2".
|
||||
Reported by: Seth Goldberg.
|
||||
|
||||
2010-04-10 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* include/grub/efi/memory.h (grub_machine_mmap_iterate): Remove
|
||||
EXPORT_FUNC.
|
||||
Reported by: Seth Goldberg.
|
||||
|
||||
2010-04-10 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* lib/posix_wrap/locale.h: Add missing file.
|
||||
Reported by: Seth Goldberg.
|
||||
|
||||
2010-04-10 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
grub-emu module load support.
|
||||
|
||||
* Makefile.in (TARGET_NO_MODULES): New variable. All users of
|
||||
NO_DYNAMIC_MODULES switched to this.
|
||||
(TARGET_CFLAGS): Add -DGRUB_TARGET_NO_MODULES=1 if applicable.
|
||||
(CFLAGS): Likewise.
|
||||
* conf/any-emu.rmk: Generate symlist.
|
||||
(kernel_img_HEADERS): Add util/datetime.h.
|
||||
(kernel_img_HEADERS) [sdl]: Add sdl.h.
|
||||
(kernel_img_HEADERS) [libusb]: Add libusb.h.
|
||||
(kernel_img_SOURCES) [TARGET_NO_MODULES = no && !x86]: Add
|
||||
kern/$(target_cpu)/cache.S.
|
||||
* configure.ac (grub-emu-modules): New option.
|
||||
* genmk.rb: Handle multiple source lists.
|
||||
* include/grub/sdl.h: New file.
|
||||
* include/grub/libusb.h: Likewise.
|
||||
* util/grub-emu.c (main): Hanle (host) root.
|
||||
* util/hostdisk.c (grub_util_biosdisk_get_grub_dev): Error with
|
||||
GRUB_ERR_UNKNOWN_DEVICE.
|
||||
* util/misc.c: Move mm functions to ...
|
||||
* util/mm.c: ... here. All users updated.
|
||||
|
||||
2010-04-09 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* Makefile.in (RMKFILES): Search in srcdir and not current directory.
|
||||
(MAINTAINER_CLEANFILES): Don't add $(srcdir) to MKFILES. Add few
|
||||
missing files.
|
||||
(maintainer-clean): Remove libgcrypt-grub.
|
||||
|
||||
2010-04-09 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* term/efi/console.c (grub_console_checkkey): Macroify key contants.
|
||||
|
||||
2010-04-09 EFI Coder <eficoder@hotmail.com>
|
||||
|
||||
* normal/menu_text.c (print_message): Clean up the message and show
|
||||
the Fn information when on EFI
|
||||
* term/efi/console.c (grub_console_checkkey): Add F4 support.
|
||||
|
||||
2010-04-09 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* normal/autofs.c (read_fs_list): New parameter 'prefix'.
|
||||
All users updated.
|
||||
* normal/crypto.c (read_crypto_list): Likewise.
|
||||
* normal/dyncmd.c (read_command_list): Likewise.
|
||||
* normal/term.c (read_terminal_list): Likewise.
|
||||
* normal/main.c (read_lists): Use explicit prefix.
|
||||
(read_lists_hook): Use read_lists.
|
||||
(grub_normal_execute): Likewise.
|
||||
|
||||
2010-04-09 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* util/grub-mkrescue.in: Fix incorrect path in coreboot part.
|
||||
Reported by: Thomas Schmitt.
|
||||
Add -no-emul-boot to grub-mkisofs parameters.
|
||||
|
||||
2010-04-09 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* font/font.c: Indented.
|
||||
|
||||
2010-04-09 BVK Chaitanya <bvk.groups@gmail.com>
|
||||
|
||||
Elif support to GRUB script (by Deepak Vankadaru).
|
||||
|
||||
* tests/grub_script_if.in: New testcase.
|
||||
* conf/tests.rmk: Rule for new testcase.
|
||||
* script/parser.y: Grammar rules for elif.
|
||||
|
||||
2010-04-09 BVK Chaitanya <bvk.groups@gmail.com>
|
||||
|
||||
While and until loops support to GRUB script.
|
||||
|
||||
* include/grub/script_sh.h (grub_script_cmdwhile): New struct.
|
||||
(grub_script_create_cmdwhile): New function prototype.
|
||||
(grub_script_execute_cmdwhile): New function prototype.
|
||||
* script/execute.c (grub_script_execute_cmdwhile): New function.
|
||||
* script/parser.y (command): New commands.
|
||||
(whilecmd): New grammar rule.
|
||||
(untilcmd): New grammar rule.
|
||||
* script/script.c (grub_script_create_cmdwhile): New function.
|
||||
* util/grub-script-check.c (grub_script_execute_cmdwhile): New
|
||||
function.
|
||||
|
||||
* tests/grub_script_while1.in: New testcase.
|
||||
* conf/tests.rmk: Rule for new testcase.
|
||||
|
||||
2010-04-09 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* util/grub.d/00_header.in: Add few missing quotes. Recognise *.jpeg
|
||||
as *.jpg.
|
||||
|
||||
2010-04-09 Mario Vazquez <mariovazq@gmail.com>
|
||||
|
||||
GRUB_BACKGROUND support.
|
||||
|
||||
* util/grub-mkconfig.in: Export GRUB_BACKGROUND.
|
||||
* util/grub.d/00_header.in: Parse GRUB_BACKGROUND.
|
||||
|
||||
2010-04-09 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Load fonts and modules for gfxmenu in grub-mkconfig.
|
||||
Idea by: Mario Vazquez
|
||||
|
||||
* util/grub.d/00_header.in: Load pf2 and image modules.
|
||||
|
||||
2010-04-09 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
grub-mkconfig multiple terminal support.
|
||||
|
||||
* util/grub-mkconfig.in: Handle multiple terminals correctly.
|
||||
* util/grub.d/00_header.in: Likewise.
|
||||
|
||||
2010-04-09 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* Makefile.in: Specify files explicitly instead of using $< and $@ since
|
||||
we use cd $(srcdir).
|
||||
|
||||
2010-04-08 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/grub.d/10_linux.in: Only use the first word of
|
||||
GRUB_DISTRIBUTOR for --class, to avoid problems if somebody puts
|
||||
spaces in GRUB_DISTRIBUTOR.
|
||||
* util/grub.d/10_kfreebsd.in: Likewise.
|
||||
* util/grub.d/10_hurd.in: Likewise.
|
||||
|
||||
2010-04-06 BVK Chaitanya <bvk.groups@gmail.com>
|
||||
|
||||
Fix unit testing framework for Qemu 0.12.
|
||||
|
||||
* tests/util/grub-shell.in: Remove -serial stdio option.
|
||||
|
||||
2010-04-06 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
POSIX header file wrappers.
|
||||
|
|
20
Makefile.in
20
Makefile.in
|
@ -43,6 +43,7 @@ pkglibdir = $(libdir)/`echo @PACKAGE_TARNAME@/$(target_cpu)-$(platform) | sed '
|
|||
|
||||
# Internationalization library.
|
||||
LIBINTL = @LIBINTL@
|
||||
TARGET_NO_MODULES = @TARGET_NO_MODULES@
|
||||
|
||||
XGETTEXT = @XGETTEXT@
|
||||
MSGMERGE = @MSGMERGE@
|
||||
|
@ -136,7 +137,7 @@ enable_efiemu = @enable_efiemu@
|
|||
|
||||
### General variables.
|
||||
|
||||
RMKFILES = $(wildcard conf/*.rmk)
|
||||
RMKFILES = $(wildcard $(srcdir)/conf/*.rmk)
|
||||
|
||||
MKFILES = $(patsubst %.rmk,%.mk,$(RMKFILES))
|
||||
|
||||
|
@ -155,7 +156,9 @@ DISTCLEANFILES = config.status config.cache config.log config.h \
|
|||
gensymlist.sh genkernsyms.sh build_env.mk \
|
||||
docs/grub.info docs/version.texi docs/stamp-vti
|
||||
|
||||
MAINTAINER_CLEANFILES = $(srcdir)/configure $(addprefix $(srcdir)/,$(MKFILES)) \
|
||||
MAINTAINER_CLEANFILES = $(srcdir)/configure $(srcdir)/aclocal.m4 \
|
||||
$(MKFILES) $(srcdir)/config.guess \
|
||||
$(srcdir)/config.sub $(srcdir)/install-sh $(srcdir)/missing \
|
||||
$(srcdir)/DISTLIST $(srcdir)/config.h.in $(srcdir)/stamp-h.in $(INFOS)
|
||||
|
||||
# The default target.
|
||||
|
@ -179,10 +182,15 @@ include $(srcdir)/conf/tests.mk
|
|||
-include $(wildcard $(GRUB_CONTRIB)/*/conf/common.mk)
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_NO_MODULES), yes)
|
||||
TARGET_CFLAGS += -DGRUB_TARGET_NO_MODULES=1
|
||||
CFLAGS += -DGRUB_TARGET_NO_MODULES=1
|
||||
endif
|
||||
|
||||
### General targets.
|
||||
|
||||
CLEANFILES += $(pkglib_DATA) $(pkgdata_DATA) po/*.mo
|
||||
ifneq ($(platform), emu)
|
||||
ifneq ($(TARGET_NO_MODULES), yes)
|
||||
pkglib_DATA += moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst video.lst crypto.lst terminal.lst
|
||||
endif
|
||||
moddep.lst: $(DEFSYMFILES) $(UNDSYMFILES) genmoddep.awk
|
||||
|
@ -427,6 +435,8 @@ distclean: mostlyclean
|
|||
|
||||
maintainer-clean: distclean
|
||||
-test -z "$(MAINTAINER_CLEANFILES)" || rm -f $(MAINTAINER_CLEANFILES)
|
||||
-rmdir $(srcdir)/lib/libgcrypt-grub/cipher
|
||||
-rmdir $(srcdir)/lib/libgcrypt-grub
|
||||
|
||||
info:
|
||||
|
||||
|
@ -530,8 +540,8 @@ genkernsyms.sh: genkernsyms.sh.in config.status
|
|||
$(SHELL) ./config.status
|
||||
|
||||
$(srcdir)/po/$(PACKAGE).pot: po/POTFILES po/POTFILES-shell
|
||||
cd $(srcdir) && $(XGETTEXT) -ctranslate --from-code=utf-8 -o $@ -f $< --keyword=_ --keyword=N_
|
||||
cd $(srcdir) && $(XGETTEXT) -ctranslate --from-code=utf-8 -o $@ -f po/POTFILES-shell -j --language=Shell
|
||||
cd $(srcdir) && $(XGETTEXT) -ctranslate --from-code=utf-8 -o po/$(PACKAGE).pot -f po/POTFILES --keyword=_ --keyword=N_
|
||||
cd $(srcdir) && $(XGETTEXT) -ctranslate --from-code=utf-8 -o po/$(PACKAGE).pot -f po/POTFILES-shell -j --language=Shell
|
||||
|
||||
$(foreach lang, $(LINGUAS), $(srcdir)/po/$(lang).po): po/$(PACKAGE).pot
|
||||
$(MSGMERGE) -U $@ $^
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
# -*- makefile -*-
|
||||
|
||||
COMMON_LDFLAGS += -nostdlib
|
||||
COMMON_CFLAGS += -nostdinc -isystem $(shell $(TARGET_CC) -print-file-name=include) -fno-builtin
|
||||
COMMON_CFLAGS += -nostdinc -isystem $(shell $(TARGET_CC) -print-file-name=include)
|
||||
|
||||
util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
|
||||
kernel_img_RELOCATABLE = yes
|
||||
pkglib_PROGRAMS = kernel.img
|
||||
kernel_img_SOURCES = kern/device.c kern/disk.c kern/dl.c kern/env.c \
|
||||
|
@ -12,14 +10,25 @@ kernel_img_SOURCES = kern/device.c kern/disk.c kern/dl.c kern/env.c \
|
|||
kern/parser.c kern/partition.c kern/term.c \
|
||||
kern/rescue_reader.c kern/rescue_parser.c \
|
||||
\
|
||||
util/console.c util/grub-emu.c util/misc.c util/hostdisk.c \
|
||||
util/getroot.c util/time.c \
|
||||
util/console.c util/grub-emu.c util/misc.c \
|
||||
util/hostdisk.c util/getroot.c util/mm.c util/time.c \
|
||||
\
|
||||
grub_emu_init.c gnulib/progname.c util/hostfs.c disk/host.c
|
||||
gnulib/progname.c util/hostfs.c disk/host.c
|
||||
kernel_img_HEADERS += datetime.h
|
||||
kernel_img_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Wno-undef -I$(srcdir)/gnulib
|
||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
TARGET_NO_STRIP = yes
|
||||
TARGET_NO_DYNAMIC_MODULES = yes
|
||||
|
||||
ifneq ($(TARGET_NO_MODULES), yes)
|
||||
kernel_img_SOURCES += symlist.c kern/$(target_cpu)/dl.c
|
||||
ifneq ($(target_cpu), i386)
|
||||
ifneq ($(target_cpu), x86_64)
|
||||
kernel_img_SOURCES += kern/$(target_cpu)/cache.S
|
||||
endif
|
||||
endif
|
||||
else
|
||||
kernel_img_SOURCES += grub_emu_init.c
|
||||
endif
|
||||
|
||||
# For halt.mod.
|
||||
pkglib_MODULES += halt.mod
|
||||
|
@ -37,6 +46,8 @@ endif
|
|||
grub_emu_LDFLAGS = $(LIBCURSES)
|
||||
|
||||
ifeq ($(enable_grub_emu_usb), yes)
|
||||
kernel_img_HEADERS += libusb.h
|
||||
|
||||
pkglib_MODULES += libusb.mod
|
||||
libusb_mod_SOURCES = util/usb.c
|
||||
libusb_mod_CFLAGS =
|
||||
|
@ -69,6 +80,7 @@ sdl_mod_SOURCES = util/sdl.c
|
|||
sdl_mod_CFLAGS =
|
||||
sdl_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
grub_emu_LDFLAGS += $(LIBSDL)
|
||||
kernel_img_HEADERS += sdl.h
|
||||
endif
|
||||
|
||||
ifeq ($(enable_grub_emu_pci), yes)
|
||||
|
@ -84,12 +96,17 @@ grub_emu_init.h: genemuinitheader.sh $(pkglib_MODULES)
|
|||
rm -f $@; echo $(pkglib_MODULES) | sh $(srcdir)/genemuinitheader.sh $(NM) > $@
|
||||
DISTCLEANFILES += grub_emu_init.h
|
||||
|
||||
grub_emu_init.c: genemuinit.sh $(pkglib_MODULES)
|
||||
grub_emu_init.c: genemuinit.sh $(pkglib_MODULES) grub_emu_init.h
|
||||
rm -f $@; echo $(pkglib_MODULES) | sh $(srcdir)/genemuinit.sh $(NM) > $@
|
||||
DISTCLEANFILES += grub_emu_init.c
|
||||
|
||||
CLEANFILES += grub-emu
|
||||
ifneq ($(TARGET_NO_MODULES), yes)
|
||||
grub-emu: $(pkglib_PROGRAMS)
|
||||
$(CC) -o $@ $(pkglib_PROGRAMS) $(grub_emu_LDFLAGS) $(LDFLAGS)
|
||||
else
|
||||
grub-emu: $(pkglib_MODULES) $(pkglib_PROGRAMS)
|
||||
$(CC) -o $@ $(pkglib_MODULES) $(pkglib_PROGRAMS) $(grub_emu_LDFLAGS) $(LDFLAGS)
|
||||
endif
|
||||
GRUB_EMU=grub-emu
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ util/elf/grub-mkimage.c_DEPENDENCIES = Makefile
|
|||
sbin_UTILITIES += grub-probe
|
||||
util/grub-probe.c_DEPENDENCIES = grub_probe_init.h
|
||||
grub_probe_SOURCES = gnulib/progname.c util/grub-probe.c \
|
||||
util/hostdisk.c util/misc.c util/getroot.c \
|
||||
util/hostdisk.c util/misc.c util/getroot.c util/mm.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 \
|
||||
\
|
||||
|
@ -61,7 +61,7 @@ grub_mkisofs_CFLAGS = -D_FILE_OFFSET_BITS=64 \
|
|||
# For grub-fstest.
|
||||
util/grub-fstest.c_DEPENDENCIES = grub_fstest_init.h
|
||||
grub_fstest_SOURCES = gnulib/progname.c util/grub-fstest.c util/hostfs.c \
|
||||
util/misc.c \
|
||||
util/misc.c util/mm.c \
|
||||
kern/file.c kern/device.c kern/disk.c kern/err.c kern/misc.c \
|
||||
disk/host.c disk/loopback.c kern/list.c kern/command.c \
|
||||
lib/arg.c commands/extcmd.c normal/datetime.c normal/misc.c \
|
||||
|
@ -104,7 +104,7 @@ DISTCLEANFILES += grub_script.yy.c grub_script.yy.h
|
|||
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 \
|
||||
util/grub-script-check.c util/misc.c \
|
||||
util/grub-script-check.c util/misc.c util/mm.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/misc.c kern/env.c grub_script_check_init.c grub_script.tab.c \
|
||||
|
@ -116,9 +116,12 @@ DEFSYMFILES += kernel_syms.lst
|
|||
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 \
|
||||
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
||||
machine/memory.h machine/loader.h machine/kernel.h \
|
||||
list.h handler.h command.h i18n.h env_private.h
|
||||
|
||||
ifneq ($(platform), emu)
|
||||
kernel_img_HEADERS += machine/memory.h machine/loader.h machine/kernel.h
|
||||
endif
|
||||
|
||||
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
|
||||
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
||||
|
||||
|
@ -184,7 +187,7 @@ DISTCLEANFILES += grub_fstest_init.c
|
|||
|
||||
# for grub-editenv
|
||||
bin_UTILITIES += grub-editenv
|
||||
grub_editenv_SOURCES = gnulib/progname.c util/grub-editenv.c lib/envblk.c util/misc.c kern/misc.c kern/err.c
|
||||
grub_editenv_SOURCES = gnulib/progname.c util/grub-editenv.c lib/envblk.c util/misc.c util/mm.c kern/misc.c kern/err.c
|
||||
CLEANFILES += grub-editenv
|
||||
|
||||
# Needed for genmk.rb to work
|
||||
|
@ -852,7 +855,7 @@ boot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|||
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
bin_UTILITIES += grub-mkpasswd-pbkdf2
|
||||
grub_mkpasswd_pbkdf2_SOURCES = gnulib/progname.c gnulib/getdelim.c gnulib/getline.c util/grub-mkpasswd-pbkdf2.c lib/crypto.c lib/libgcrypt-grub/cipher/sha512.c lib/pbkdf2.c util/misc.c kern/err.c
|
||||
grub_mkpasswd_pbkdf2_SOURCES = gnulib/progname.c gnulib/getdelim.c gnulib/getline.c util/grub-mkpasswd-pbkdf2.c lib/crypto.c lib/libgcrypt-grub/cipher/sha512.c lib/pbkdf2.c util/misc.c util/mm.c kern/err.c
|
||||
grub_mkpasswd_pbkdf2_CFLAGS += -Wno-missing-field-initializers -Wno-error -I$(srcdir)/lib/libgcrypt_wrap -DGRUB_MKPASSWD=1
|
||||
|
||||
include $(srcdir)/conf/gcry.mk
|
||||
|
|
|
@ -90,7 +90,7 @@ grub_setup_SOURCES = gnulib/progname.c \
|
|||
partmap/gpt.c \
|
||||
\
|
||||
disk/raid.c disk/mdraid_linux.c disk/lvm.c \
|
||||
util/raid.c util/lvm.c \
|
||||
util/raid.c util/lvm.c util/mm.c \
|
||||
grub_setup_init.c
|
||||
|
||||
sbin_SCRIPTS += grub-install
|
||||
|
|
|
@ -65,7 +65,7 @@ grub_setup_SOURCES = util/sparc64/ieee1275/grub-setup.c util/hostdisk.c \
|
|||
partmap/bsdlabel.c partmap/sun.c partmap/acorn.c \
|
||||
\
|
||||
disk/raid.c disk/mdraid_linux.c disk/lvm.c \
|
||||
util/raid.c util/lvm.c gnulib/progname.c \
|
||||
util/raid.c util/lvm.c util/mm.c gnulib/progname.c \
|
||||
grub_setup_init.c
|
||||
|
||||
# For grub-ofpathname.
|
||||
|
|
|
@ -53,6 +53,12 @@ grub_script_vars1_SOURCES = tests/grub_script_vars1.in
|
|||
check_SCRIPTS += grub_script_for1
|
||||
grub_script_for1_SOURCES = tests/grub_script_for1.in
|
||||
|
||||
check_SCRIPTS += grub_script_while1
|
||||
grub_script_while1_SOURCES = tests/grub_script_while1.in
|
||||
|
||||
check_SCRIPTS += grub_script_if
|
||||
grub_script_if_SOURCES = tests/grub_script_if.in
|
||||
|
||||
check_SCRIPTS += grub_script_blanklines
|
||||
grub_script_blanklines_SOURCES = tests/grub_script_blanklines.in
|
||||
|
||||
|
@ -69,9 +75,12 @@ SCRIPTED_TESTS = grub_script_echo1
|
|||
SCRIPTED_TESTS += grub_script_echo_keywords
|
||||
SCRIPTED_TESTS += grub_script_vars1
|
||||
SCRIPTED_TESTS += grub_script_for1
|
||||
SCRIPTED_TESTS += grub_script_while1
|
||||
SCRIPTED_TESTS += grub_script_if
|
||||
SCRIPTED_TESTS += grub_script_blanklines
|
||||
SCRIPTED_TESTS += grub_script_final_semicolon
|
||||
|
||||
|
||||
# dependencies between tests and testing-tools
|
||||
$(SCRIPTED_TESTS): grub-shell grub-shell-tester
|
||||
$(FUNCTIONAL_TESTS): functional_test.mod
|
||||
|
|
16
configure.ac
16
configure.ac
|
@ -584,6 +584,10 @@ AC_ARG_ENABLE([grub-emu-pci],
|
|||
[AS_HELP_STRING([--enable-grub-emu-pci],
|
||||
[build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])])
|
||||
|
||||
AC_ARG_ENABLE([grub-emu-modules],
|
||||
[AS_HELP_STRING([--enable-grub-emu-modules],
|
||||
[Support module loading in `grub-emu' debugging utility (default=no)])])
|
||||
|
||||
if test "$platform" = emu; then
|
||||
missing_ncurses=
|
||||
[# Check for curses libraries.]
|
||||
|
@ -602,6 +606,13 @@ if test x"$missing_ncurses" = xtrue ; then
|
|||
AC_MSG_ERROR([grub-emu can't be compiled without ncurses])
|
||||
fi
|
||||
|
||||
if test x"$enable_grub_emu_modules" = xyes ; then
|
||||
TARGET_NO_MODULES=no
|
||||
else
|
||||
TARGET_NO_MODULES=yes
|
||||
fi
|
||||
AC_SUBST(TARGET_NO_MODULES)
|
||||
|
||||
if test x"$enable_grub_emu_usb" = xno ; then
|
||||
grub_emu_usb_excuse="explicitly disabled"
|
||||
fi
|
||||
|
@ -779,6 +790,11 @@ echo PCI support for grub-emu: Yes
|
|||
else
|
||||
echo PCI support for grub-emu: No "($grub_emu_pci_excuse)"
|
||||
fi
|
||||
if [ x"$TARGET_NO_MODULES" = xno ]; then
|
||||
echo Module support for grub-emu: Yes
|
||||
else
|
||||
echo Module support for grub-emu: No
|
||||
fi
|
||||
fi
|
||||
if [ x"$enable_mm_debug" = xyes ]; then
|
||||
echo With memory debugging: Yes
|
||||
|
|
60
font/font.c
60
font/font.c
|
@ -91,8 +91,7 @@ struct font_file_section
|
|||
};
|
||||
|
||||
/* Replace unknown glyphs with a rounded question mark. */
|
||||
static grub_uint8_t unknown_glyph_bitmap[] =
|
||||
{
|
||||
static grub_uint8_t unknown_glyph_bitmap[] = {
|
||||
/* 76543210 */
|
||||
0x7C, /* ooooo */
|
||||
0x82, /* o o */
|
||||
|
@ -141,8 +140,8 @@ ascii_glyph_lookup (grub_uint32_t code)
|
|||
int current;
|
||||
for (current = 0; current < 0x80; current++)
|
||||
{
|
||||
ascii_font_glyph[current] = grub_malloc(sizeof(struct grub_font_glyph)
|
||||
+ ASCII_BITMAP_SIZE);
|
||||
ascii_font_glyph[current] =
|
||||
grub_malloc (sizeof (struct grub_font_glyph) + ASCII_BITMAP_SIZE);
|
||||
|
||||
ascii_font_glyph[current]->width = 8;
|
||||
ascii_font_glyph[current]->height = 16;
|
||||
|
@ -398,7 +397,8 @@ read_section_as_string (struct font_file_section *section)
|
|||
which is stored into *VALUE.
|
||||
Returns 0 upon success, nonzero upon failure. */
|
||||
static int
|
||||
read_section_as_short (struct font_file_section *section, grub_int16_t *value)
|
||||
read_section_as_short (struct font_file_section *section,
|
||||
grub_int16_t * value)
|
||||
{
|
||||
grub_uint16_t raw_value;
|
||||
|
||||
|
@ -408,8 +408,7 @@ read_section_as_short (struct font_file_section *section, grub_int16_t *value)
|
|||
"font file format error: section %c%c%c%c length "
|
||||
"is %d but should be 2",
|
||||
section->name[0], section->name[1],
|
||||
section->name[2], section->name[3],
|
||||
section->length);
|
||||
section->name[2], section->name[3], section->length);
|
||||
return 1;
|
||||
}
|
||||
if (grub_file_read (section->file, &raw_value, 2) != 2)
|
||||
|
@ -527,13 +526,15 @@ grub_font_load (const char *filename)
|
|||
}
|
||||
else if (grub_memcmp (section.name,
|
||||
FONT_FORMAT_SECTION_NAMES_POINT_SIZE,
|
||||
sizeof(FONT_FORMAT_SECTION_NAMES_POINT_SIZE) - 1) == 0)
|
||||
sizeof (FONT_FORMAT_SECTION_NAMES_POINT_SIZE) -
|
||||
1) == 0)
|
||||
{
|
||||
if (read_section_as_short (§ion, &font->point_size) != 0)
|
||||
goto fail;
|
||||
}
|
||||
else if (grub_memcmp (section.name, FONT_FORMAT_SECTION_NAMES_WEIGHT,
|
||||
sizeof(FONT_FORMAT_SECTION_NAMES_WEIGHT) - 1) == 0)
|
||||
sizeof (FONT_FORMAT_SECTION_NAMES_WEIGHT) - 1)
|
||||
== 0)
|
||||
{
|
||||
char *wt;
|
||||
wt = read_section_as_string (§ion);
|
||||
|
@ -548,34 +549,39 @@ grub_font_load (const char *filename)
|
|||
}
|
||||
else if (grub_memcmp (section.name,
|
||||
FONT_FORMAT_SECTION_NAMES_MAX_CHAR_WIDTH,
|
||||
sizeof(FONT_FORMAT_SECTION_NAMES_MAX_CHAR_WIDTH) - 1) == 0)
|
||||
sizeof (FONT_FORMAT_SECTION_NAMES_MAX_CHAR_WIDTH)
|
||||
- 1) == 0)
|
||||
{
|
||||
if (read_section_as_short (§ion, &font->max_char_width) != 0)
|
||||
goto fail;
|
||||
}
|
||||
else if (grub_memcmp (section.name,
|
||||
FONT_FORMAT_SECTION_NAMES_MAX_CHAR_HEIGHT,
|
||||
sizeof(FONT_FORMAT_SECTION_NAMES_MAX_CHAR_HEIGHT) - 1) == 0)
|
||||
sizeof (FONT_FORMAT_SECTION_NAMES_MAX_CHAR_HEIGHT)
|
||||
- 1) == 0)
|
||||
{
|
||||
if (read_section_as_short (§ion, &font->max_char_height) != 0)
|
||||
goto fail;
|
||||
}
|
||||
else if (grub_memcmp (section.name,
|
||||
FONT_FORMAT_SECTION_NAMES_ASCENT,
|
||||
sizeof(FONT_FORMAT_SECTION_NAMES_ASCENT) - 1) == 0)
|
||||
sizeof (FONT_FORMAT_SECTION_NAMES_ASCENT) - 1)
|
||||
== 0)
|
||||
{
|
||||
if (read_section_as_short (§ion, &font->ascent) != 0)
|
||||
goto fail;
|
||||
}
|
||||
else if (grub_memcmp (section.name, FONT_FORMAT_SECTION_NAMES_DESCENT,
|
||||
sizeof(FONT_FORMAT_SECTION_NAMES_DESCENT) - 1) == 0)
|
||||
sizeof (FONT_FORMAT_SECTION_NAMES_DESCENT) - 1)
|
||||
== 0)
|
||||
{
|
||||
if (read_section_as_short (§ion, &font->descent) != 0)
|
||||
goto fail;
|
||||
}
|
||||
else if (grub_memcmp (section.name,
|
||||
FONT_FORMAT_SECTION_NAMES_CHAR_INDEX,
|
||||
sizeof(FONT_FORMAT_SECTION_NAMES_CHAR_INDEX) - 1) == 0)
|
||||
sizeof (FONT_FORMAT_SECTION_NAMES_CHAR_INDEX) -
|
||||
1) == 0)
|
||||
{
|
||||
if (load_font_index (file, section.length, font) != 0)
|
||||
goto fail;
|
||||
|
@ -609,16 +615,13 @@ grub_font_load (const char *filename)
|
|||
"Ascent=%d Descent=%d MaxW=%d MaxH=%d Number of characters=%d.\n",
|
||||
font->name,
|
||||
font->ascent, font->descent,
|
||||
font->max_char_width, font->max_char_height,
|
||||
font->num_chars);
|
||||
font->max_char_width, font->max_char_height, font->num_chars);
|
||||
#endif
|
||||
|
||||
if (font->max_char_width == 0
|
||||
|| font->max_char_height == 0
|
||||
|| font->num_chars == 0
|
||||
|| font->char_index == 0
|
||||
|| font->ascent == 0
|
||||
|| font->descent == 0)
|
||||
|| font->char_index == 0 || font->ascent == 0 || font->descent == 0)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FONT,
|
||||
"invalid font file: missing some required data");
|
||||
|
@ -822,8 +825,7 @@ remove_font (grub_font_t font)
|
|||
struct grub_font_node **nextp, *cur;
|
||||
|
||||
for (nextp = &grub_font_list, cur = *nextp;
|
||||
cur;
|
||||
nextp = &cur->next, cur = cur->next)
|
||||
cur; nextp = &cur->next, cur = cur->next)
|
||||
{
|
||||
if (cur->value == font)
|
||||
{
|
||||
|
@ -1053,8 +1055,7 @@ grub_font_get_glyph_with_fallback (grub_font_t font, grub_uint32_t code)
|
|||
side location of the character. */
|
||||
grub_err_t
|
||||
grub_font_draw_glyph (struct grub_font_glyph * glyph,
|
||||
grub_video_color_t color,
|
||||
int left_x, int baseline_y)
|
||||
grub_video_color_t color, int left_x, int baseline_y)
|
||||
{
|
||||
struct grub_video_bitmap glyph_bitmap;
|
||||
|
||||
|
@ -1065,8 +1066,7 @@ grub_font_draw_glyph (struct grub_font_glyph *glyph,
|
|||
glyph_bitmap.mode_info.width = glyph->width;
|
||||
glyph_bitmap.mode_info.height = glyph->height;
|
||||
glyph_bitmap.mode_info.mode_type =
|
||||
(1 << GRUB_VIDEO_MODE_TYPE_DEPTH_POS)
|
||||
| GRUB_VIDEO_MODE_TYPE_1BIT_BITMAP;
|
||||
(1 << GRUB_VIDEO_MODE_TYPE_DEPTH_POS) | GRUB_VIDEO_MODE_TYPE_1BIT_BITMAP;
|
||||
glyph_bitmap.mode_info.blit_format = GRUB_VIDEO_BLIT_FORMAT_1BIT_PACKED;
|
||||
glyph_bitmap.mode_info.bpp = 1;
|
||||
|
||||
|
@ -1094,8 +1094,7 @@ grub_font_draw_glyph (struct grub_font_glyph *glyph,
|
|||
|
||||
return grub_video_blit_bitmap (&glyph_bitmap, GRUB_VIDEO_BLIT_BLEND,
|
||||
bitmap_left, bitmap_top,
|
||||
0, 0,
|
||||
glyph->width, glyph->height);
|
||||
0, 0, glyph->width, glyph->height);
|
||||
}
|
||||
|
||||
/* Draw a UTF-8 string of text on the current video render target.
|
||||
|
@ -1105,8 +1104,7 @@ grub_font_draw_glyph (struct grub_font_glyph *glyph,
|
|||
a glyph from another loaded font may be used instead. */
|
||||
grub_err_t
|
||||
grub_font_draw_string (const char *str, grub_font_t font,
|
||||
grub_video_color_t color,
|
||||
int left_x, int baseline_y)
|
||||
grub_video_color_t color, int left_x, int baseline_y)
|
||||
{
|
||||
int x;
|
||||
struct grub_font_glyph *glyph;
|
||||
|
@ -1117,12 +1115,10 @@ grub_font_draw_string (const char *str, grub_font_t font,
|
|||
grub_utf8_to_ucs4 (&code, 1, ptr, -1, &ptr) > 0;)
|
||||
{
|
||||
glyph = grub_font_get_glyph_with_fallback (font, code);
|
||||
if (grub_font_draw_glyph (glyph, color, x, baseline_y)
|
||||
!= GRUB_ERR_NONE)
|
||||
if (grub_font_draw_glyph (glyph, color, x, baseline_y) != GRUB_ERR_NONE)
|
||||
return grub_errno;
|
||||
x += glyph->device_width;
|
||||
}
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
|
|
34
genmk.rb
34
genmk.rb
|
@ -143,7 +143,7 @@ mostlyclean-module-#{@name}.#{@rule_count}:
|
|||
MOSTLYCLEAN_MODULE_TARGETS += mostlyclean-module-#{@name}.#{@rule_count}
|
||||
UNDSYMFILES += #{undsym}
|
||||
|
||||
ifeq ($(TARGET_NO_DYNAMIC_MODULES), yes)
|
||||
ifeq ($(TARGET_NO_MODULES), yes)
|
||||
#{@name}: #{pre_obj} $(TARGET_OBJ2ELF)
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ #{pre_obj}
|
||||
|
@ -322,28 +322,32 @@ class Program
|
|||
end
|
||||
attr_reader :dir, :name
|
||||
|
||||
def print_tail()
|
||||
prefix = @name.to_var
|
||||
print "CLEANFILES += #{@name} $(#{prefix}_OBJECTS)
|
||||
ifeq ($(#{prefix}_RELOCATABLE),yes)
|
||||
#{@name}: $(#{prefix}_DEPENDENCIES) $(#{prefix}_OBJECTS)
|
||||
$(TARGET_CC) -Wl,-r,-d -o $@ $(#{prefix}_OBJECTS) $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS)
|
||||
if test x$(TARGET_NO_STRIP) != xyes ; then $(STRIP) --strip-unneeded -K start -R .note -R .comment $@; fi
|
||||
else
|
||||
#{@name}: $(#{prefix}_DEPENDENCIES) $(#{prefix}_OBJECTS)
|
||||
$(TARGET_CC) -o $@ $(#{prefix}_OBJECTS) $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS)
|
||||
if test x$(TARGET_NO_STRIP) != xyes ; then $(STRIP) -R .rel.dyn -R .reginfo -R .note -R .comment $@; fi
|
||||
endif
|
||||
|
||||
"
|
||||
end
|
||||
|
||||
def rule(sources)
|
||||
prefix = @name.to_var
|
||||
objs = sources.collect do |src|
|
||||
raise "unknown source file `#{src}'" if /\.[cS]$/ !~ src
|
||||
prefix + '-' + src.to_obj
|
||||
end
|
||||
objs_str = objs.join(' ');
|
||||
deps = objs.collect {|obj| obj.suffix('d')}
|
||||
deps_str = deps.join(' ');
|
||||
|
||||
"CLEANFILES += #{@name} #{objs_str}
|
||||
MOSTLYCLEANFILES += #{deps_str}
|
||||
|
||||
ifeq ($(#{prefix}_RELOCATABLE),yes)
|
||||
#{@name}: $(#{prefix}_DEPENDENCIES) #{objs_str}
|
||||
$(TARGET_CC) -Wl,-r,-d -o $@ #{objs_str} $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS)
|
||||
if test x$(TARGET_NO_STRIP) != xyes ; then $(STRIP) --strip-unneeded -K start -R .note -R .comment $@; fi
|
||||
else
|
||||
#{@name}: $(#{prefix}_DEPENDENCIES) #{objs_str}
|
||||
$(TARGET_CC) -o $@ #{objs_str} $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS)
|
||||
if test x$(TARGET_NO_STRIP) != xyes ; then $(STRIP) -R .rel.dyn -R .reginfo -R .note -R .comment $@; fi
|
||||
endif
|
||||
"MOSTLYCLEANFILES += #{deps_str}
|
||||
|
||||
" + objs.collect_with_index do |obj, i|
|
||||
src = sources[i]
|
||||
|
@ -358,6 +362,7 @@ endif
|
|||
|
||||
-include #{dep}
|
||||
|
||||
#{prefix}_OBJECTS += #{obj}
|
||||
"
|
||||
end.join('')
|
||||
end
|
||||
|
@ -466,4 +471,5 @@ while l = gets
|
|||
|
||||
end
|
||||
utils.each {|util| util.print_tail()}
|
||||
programs.each {|program| program.print_tail()}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ grub_dl_t grub_dl_load_core (void *addr, grub_size_t size);
|
|||
int EXPORT_FUNC(grub_dl_unload) (grub_dl_t mod);
|
||||
void grub_dl_unload_unneeded (void);
|
||||
void grub_dl_unload_all (void);
|
||||
#if defined (GRUB_MACHINE_EMU) || defined (GRUB_UTIL)
|
||||
#if defined (GRUB_UTIL) || defined (GRUB_TARGET_NO_MODULES)
|
||||
#define GRUB_NO_MODULES 1
|
||||
#else
|
||||
#define GRUB_NO_MODULES 0
|
||||
|
@ -121,7 +121,7 @@ grub_err_t grub_dl_register_symbol (const char *name, void *addr,
|
|||
grub_err_t grub_arch_dl_check_header (void *ehdr);
|
||||
grub_err_t grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr);
|
||||
|
||||
#if defined (_mips) && ! defined (GRUB_UTIL) && !defined (GRUB_MACHINE_EMU)
|
||||
#if defined (_mips) && ! GRUB_NO_MODULES
|
||||
#define GRUB_LINKER_HAVE_INIT 1
|
||||
void grub_arch_dl_init_linker (void);
|
||||
#endif
|
||||
|
|
|
@ -34,9 +34,9 @@
|
|||
by firmware. */
|
||||
#define GRUB_MACHINE_MEMORY_HOLE 6
|
||||
|
||||
|
||||
grub_err_t EXPORT_FUNC(grub_machine_mmap_iterate)
|
||||
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
|
||||
grub_err_t grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t,
|
||||
grub_uint64_t,
|
||||
grub_uint32_t));
|
||||
grub_err_t grub_machine_mmap_register (grub_uint64_t start, grub_uint64_t size,
|
||||
int type, int handle);
|
||||
grub_err_t grub_machine_mmap_unregister (int handle);
|
||||
|
|
29
include/grub/libusb.h
Normal file
29
include/grub/libusb.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2010 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/>.
|
||||
*/
|
||||
|
||||
void EXPORT_FUNC (usb_bulk_write) (void);
|
||||
void EXPORT_FUNC (usb_find_busses) (void);
|
||||
void EXPORT_FUNC (usb_init) (void);
|
||||
void EXPORT_FUNC (usb_find_devices) (void);
|
||||
void EXPORT_FUNC (usb_open) (void);
|
||||
void EXPORT_FUNC (usb_get_busses) (void);
|
||||
void EXPORT_FUNC (usb_control_msg) (void);
|
||||
void EXPORT_FUNC (usb_release_interface) (void);
|
||||
void EXPORT_FUNC (usb_close) (void);
|
||||
void EXPORT_FUNC (usb_bulk_read) (void);
|
||||
void EXPORT_FUNC (usb_claim_interface) (void);
|
|
@ -96,17 +96,17 @@ void read_handler_list (void);
|
|||
void free_handler_list (void);
|
||||
|
||||
/* Defined in `dyncmd.c'. */
|
||||
void read_command_list (void);
|
||||
void read_command_list (const char *prefix);
|
||||
|
||||
/* Defined in `autofs.c'. */
|
||||
void read_fs_list (void);
|
||||
void read_fs_list (const char *prefix);
|
||||
|
||||
void grub_context_init (void);
|
||||
void grub_context_fini (void);
|
||||
|
||||
void read_crypto_list (void);
|
||||
void read_crypto_list (const char *prefix);
|
||||
|
||||
void read_terminal_list (void);
|
||||
void read_terminal_list (const char *prefix);
|
||||
|
||||
void grub_set_more (int onoff);
|
||||
|
||||
|
|
|
@ -121,6 +121,21 @@ struct grub_script_cmdfor
|
|||
struct grub_script_cmd *list;
|
||||
};
|
||||
|
||||
/* A while/until command. */
|
||||
struct grub_script_cmdwhile
|
||||
{
|
||||
struct grub_script_cmd cmd;
|
||||
|
||||
/* The command list used as condition. */
|
||||
struct grub_script_cmd *cond;
|
||||
|
||||
/* The command list executed in each loop. */
|
||||
struct grub_script_cmd *list;
|
||||
|
||||
/* The flag to indicate this as "until" loop. */
|
||||
int until;
|
||||
};
|
||||
|
||||
/* A menu entry generate statement. */
|
||||
struct grub_script_cmd_menuentry
|
||||
{
|
||||
|
@ -234,6 +249,12 @@ grub_script_create_cmdfor (struct grub_parser_param *state,
|
|||
struct grub_script_arglist *words,
|
||||
struct grub_script_cmd *list);
|
||||
|
||||
struct grub_script_cmd *
|
||||
grub_script_create_cmdwhile (struct grub_parser_param *state,
|
||||
struct grub_script_cmd *cond,
|
||||
struct grub_script_cmd *list,
|
||||
int is_an_until_loop);
|
||||
|
||||
struct grub_script_cmd *
|
||||
grub_script_create_cmdmenu (struct grub_parser_param *state,
|
||||
struct grub_script_arglist *arglist,
|
||||
|
@ -283,6 +304,7 @@ grub_err_t grub_script_execute_cmdline (struct grub_script_cmd *cmd);
|
|||
grub_err_t grub_script_execute_cmdblock (struct grub_script_cmd *cmd);
|
||||
grub_err_t grub_script_execute_cmdif (struct grub_script_cmd *cmd);
|
||||
grub_err_t grub_script_execute_cmdfor (struct grub_script_cmd *cmd);
|
||||
grub_err_t grub_script_execute_cmdwhile (struct grub_script_cmd *cmd);
|
||||
grub_err_t grub_script_execute_menuentry (struct grub_script_cmd *cmd);
|
||||
|
||||
/* Execute any GRUB pre-parsed command or script. */
|
||||
|
|
24
include/grub/sdl.h
Normal file
24
include/grub/sdl.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2010 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/>.
|
||||
*/
|
||||
|
||||
void EXPORT_FUNC (SDL_Quit) (void);
|
||||
void EXPORT_FUNC (SDL_SetColors) (void);
|
||||
void EXPORT_FUNC (SDL_Init) (void);
|
||||
void EXPORT_FUNC (SDL_GetError) (void);
|
||||
void EXPORT_FUNC (SDL_Flip) (void);
|
||||
void EXPORT_FUNC (SDL_SetVideoMode) (void);
|
0
lib/posix_wrap/locale.h
Normal file
0
lib/posix_wrap/locale.h
Normal file
|
@ -335,14 +335,16 @@ GRUB_MOD_INIT(multiboot)
|
|||
#ifdef GRUB_USE_MULTIBOOT2
|
||||
grub_register_command ("multiboot2", grub_cmd_multiboot,
|
||||
0, N_("Load a multiboot 2 kernel."));
|
||||
cmd_module =
|
||||
grub_register_command ("module2", grub_cmd_module,
|
||||
0, N_("Load a multiboot 2 module."));
|
||||
#else
|
||||
grub_register_command ("multiboot", grub_cmd_multiboot,
|
||||
0, N_("Load a multiboot kernel."));
|
||||
#endif
|
||||
|
||||
cmd_module =
|
||||
grub_register_command ("module", grub_cmd_module,
|
||||
0, N_("Load a multiboot module."));
|
||||
#endif
|
||||
|
||||
my_mod = mod;
|
||||
}
|
||||
|
|
|
@ -51,11 +51,8 @@ autoload_fs_module (void)
|
|||
|
||||
/* Read the file fs.lst for auto-loading. */
|
||||
void
|
||||
read_fs_list (void)
|
||||
read_fs_list (const char *prefix)
|
||||
{
|
||||
const char *prefix;
|
||||
|
||||
prefix = grub_env_get ("prefix");
|
||||
if (prefix)
|
||||
{
|
||||
char *filename;
|
||||
|
|
|
@ -66,14 +66,12 @@ grub_crypto_spec_free (void)
|
|||
|
||||
/* Read the file crypto.lst for auto-loading. */
|
||||
void
|
||||
read_crypto_list (void)
|
||||
read_crypto_list (const char *prefix)
|
||||
{
|
||||
const char *prefix;
|
||||
char *filename;
|
||||
grub_file_t file;
|
||||
char *buf = NULL;
|
||||
|
||||
prefix = grub_env_get ("prefix");
|
||||
if (!prefix)
|
||||
{
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
|
|
|
@ -60,11 +60,8 @@ grub_dyncmd_dispatcher (struct grub_command *cmd,
|
|||
|
||||
/* Read the file command.lst for auto-loading. */
|
||||
void
|
||||
read_command_list (void)
|
||||
read_command_list (const char *prefix)
|
||||
{
|
||||
const char *prefix;
|
||||
|
||||
prefix = grub_env_get ("prefix");
|
||||
if (prefix)
|
||||
{
|
||||
char *filename;
|
||||
|
|
|
@ -434,14 +434,20 @@ grub_normal_init_page (struct grub_term_output *term)
|
|||
grub_free (unicode_msg);
|
||||
}
|
||||
|
||||
static void
|
||||
read_lists (const char *val)
|
||||
{
|
||||
read_command_list (val);
|
||||
read_fs_list (val);
|
||||
read_crypto_list (val);
|
||||
read_terminal_list (val);
|
||||
}
|
||||
|
||||
static char *
|
||||
read_lists (struct grub_env_var *var __attribute__ ((unused)),
|
||||
read_lists_hook (struct grub_env_var *var __attribute__ ((unused)),
|
||||
const char *val)
|
||||
{
|
||||
read_command_list ();
|
||||
read_fs_list ();
|
||||
read_crypto_list ();
|
||||
read_terminal_list ();
|
||||
read_lists (val);
|
||||
return val ? grub_strdup (val) : NULL;
|
||||
}
|
||||
|
||||
|
@ -451,10 +457,11 @@ void
|
|||
grub_normal_execute (const char *config, int nested, int batch)
|
||||
{
|
||||
grub_menu_t menu = 0;
|
||||
const char *prefix = grub_env_get ("prefix");
|
||||
|
||||
read_lists (NULL, NULL);
|
||||
read_lists (prefix);
|
||||
read_handler_list ();
|
||||
grub_register_variable_hook ("prefix", NULL, read_lists);
|
||||
grub_register_variable_hook ("prefix", NULL, read_lists_hook);
|
||||
grub_command_execute ("parser.grub", 0, 0);
|
||||
|
||||
if (config)
|
||||
|
|
|
@ -176,10 +176,17 @@ print_message (int nested, int edit, struct grub_term_output *term)
|
|||
if (edit)
|
||||
{
|
||||
grub_putcode ('\n', term);
|
||||
#ifdef GRUB_MACHINE_EFI
|
||||
grub_print_message_indented (_("Minimum Emacs-like screen editing is \
|
||||
supported. TAB lists completions. Press F1 to boot, F2=Ctrl-a, F3=Ctrl-e, \
|
||||
F4 for a command-line or ESC to discard edits and return to the GRUB menu."),
|
||||
STANDARD_MARGIN, STANDARD_MARGIN, term);
|
||||
#else
|
||||
grub_print_message_indented (_("Minimum Emacs-like screen editing is \
|
||||
supported. TAB lists completions. Press Ctrl-x to boot, Ctrl-c for a \
|
||||
command-line or ESC to return menu."), STANDARD_MARGIN, STANDARD_MARGIN,
|
||||
term);
|
||||
command-line or ESC to discard edits and return to the GRUB menu."),
|
||||
STANDARD_MARGIN, STANDARD_MARGIN, term);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -167,14 +167,12 @@ grub_terminal_autoload_free (void)
|
|||
|
||||
/* Read the file terminal.lst for auto-loading. */
|
||||
void
|
||||
read_terminal_list (void)
|
||||
read_terminal_list (const char *prefix)
|
||||
{
|
||||
const char *prefix;
|
||||
char *filename;
|
||||
grub_file_t file;
|
||||
char *buf = NULL;
|
||||
|
||||
prefix = grub_env_get ("prefix");
|
||||
if (!prefix)
|
||||
{
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
|
|
|
@ -26,13 +26,24 @@
|
|||
#include <grub/lib/arg.h>
|
||||
#include <grub/normal.h>
|
||||
|
||||
/* Max digits for a char is 3 (0xFF is 255), similarly for an int it
|
||||
is sizeof (int) * 3, and one extra for a possible -ve sign. */
|
||||
#define ERRNO_DIGITS_MAX (sizeof (int) * 3 + 1)
|
||||
|
||||
static grub_err_t
|
||||
grub_script_execute_cmd (struct grub_script_cmd *cmd)
|
||||
{
|
||||
int ret;
|
||||
char errnobuf[ERRNO_DIGITS_MAX + 1];
|
||||
|
||||
if (cmd == 0)
|
||||
return 0;
|
||||
|
||||
return cmd->exec (cmd);
|
||||
ret = cmd->exec (cmd);
|
||||
|
||||
grub_snprintf (errnobuf, sizeof (errnobuf), "%d", ret);
|
||||
grub_env_set ("?", errnobuf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define ARG_ALLOCATION_UNIT (32 * sizeof (char))
|
||||
|
@ -260,13 +271,14 @@ grub_script_execute_cmdline (struct grub_script_cmd *cmd)
|
|||
grub_err_t
|
||||
grub_script_execute_cmdblock (struct grub_script_cmd *cmd)
|
||||
{
|
||||
int ret = 0;
|
||||
struct grub_script_cmdblock *cmdblock = (struct grub_script_cmdblock *) cmd;
|
||||
|
||||
/* Loop over every command and execute it. */
|
||||
for (cmd = cmdblock->cmdlist; cmd; cmd = cmd->next)
|
||||
grub_script_execute_cmd (cmd);
|
||||
ret = grub_script_execute_cmd (cmd);
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Execute an if statement. */
|
||||
|
@ -317,6 +329,26 @@ grub_script_execute_cmdfor (struct grub_script_cmd *cmd)
|
|||
return result;
|
||||
}
|
||||
|
||||
/* Execute a "while" or "until" command. */
|
||||
grub_err_t
|
||||
grub_script_execute_cmdwhile (struct grub_script_cmd *cmd)
|
||||
{
|
||||
int cond;
|
||||
int result;
|
||||
struct grub_script_cmdwhile *cmdwhile = (struct grub_script_cmdwhile *) cmd;
|
||||
|
||||
result = 0;
|
||||
do {
|
||||
cond = grub_script_execute_cmd (cmdwhile->cond);
|
||||
if (cmdwhile->until ? !cond : cond)
|
||||
break;
|
||||
|
||||
result = grub_script_execute_cmd (cmdwhile->list);
|
||||
} while (1); /* XXX Put a check for ^C here */
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Execute the menu entry generate statement. */
|
||||
grub_err_t
|
||||
grub_script_execute_menuentry (struct grub_script_cmd *cmd)
|
||||
|
|
|
@ -74,8 +74,10 @@
|
|||
%token <arg> GRUB_PARSER_TOKEN_WORD "word"
|
||||
|
||||
%type <arglist> word argument arguments0 arguments1
|
||||
%type <cmd> script_init script grubcmd ifcmd forcmd command
|
||||
%type <cmd> commands1 menuentry statement
|
||||
|
||||
%type <cmd> script_init script
|
||||
%type <cmd> grubcmd ifclause ifcmd forcmd whilecmd untilcmd
|
||||
%type <cmd> command commands1 menuentry statement
|
||||
|
||||
%pure-parser
|
||||
%lex-param { struct grub_parser_param *state };
|
||||
|
@ -174,6 +176,8 @@ grubcmd: word arguments0
|
|||
command: grubcmd { $$ = $1; }
|
||||
| ifcmd { $$ = $1; }
|
||||
| forcmd { $$ = $1; }
|
||||
| whilecmd { $$ = $1; }
|
||||
| untilcmd { $$ = $1; }
|
||||
;
|
||||
|
||||
/* A list of commands. */
|
||||
|
@ -224,17 +228,27 @@ menuentry: "menuentry"
|
|||
}
|
||||
;
|
||||
|
||||
if: "if" { grub_script_lexer_ref (state->lexerstate); }
|
||||
;
|
||||
ifcmd: if commands1 delimiters1 "then" commands1 delimiters1 "fi"
|
||||
ifcmd: "if"
|
||||
{
|
||||
$$ = grub_script_create_cmdif (state, $2, $5, 0);
|
||||
grub_script_lexer_ref (state->lexerstate);
|
||||
}
|
||||
ifclause "fi"
|
||||
{
|
||||
$$ = $3;
|
||||
grub_script_lexer_deref (state->lexerstate);
|
||||
}
|
||||
| if commands1 delimiters1 "then" commands1 delimiters1 "else" commands1 delimiters1 "fi"
|
||||
;
|
||||
ifclause: commands1 delimiters1 "then" commands1 delimiters1
|
||||
{
|
||||
$$ = grub_script_create_cmdif (state, $2, $5, $8);
|
||||
grub_script_lexer_deref (state->lexerstate);
|
||||
$$ = grub_script_create_cmdif (state, $1, $4, 0);
|
||||
}
|
||||
| commands1 delimiters1 "then" commands1 delimiters1 "else" commands1 delimiters1
|
||||
{
|
||||
$$ = grub_script_create_cmdif (state, $1, $4, $7);
|
||||
}
|
||||
| commands1 delimiters1 "then" commands1 delimiters1 "elif" ifclause
|
||||
{
|
||||
$$ = grub_script_create_cmdif (state, $1, $4, $7);
|
||||
}
|
||||
;
|
||||
|
||||
|
@ -248,3 +262,25 @@ forcmd: "for" "name"
|
|||
grub_script_lexer_deref (state->lexerstate);
|
||||
}
|
||||
;
|
||||
|
||||
whilecmd: "while"
|
||||
{
|
||||
grub_script_lexer_ref (state->lexerstate);
|
||||
}
|
||||
commands1 delimiters1 "do" commands1 delimiters1 "done"
|
||||
{
|
||||
$$ = grub_script_create_cmdwhile (state, $3, $6, 0);
|
||||
grub_script_lexer_deref (state->lexerstate);
|
||||
}
|
||||
;
|
||||
|
||||
untilcmd: "until"
|
||||
{
|
||||
grub_script_lexer_ref (state->lexerstate);
|
||||
}
|
||||
commands1 delimiters1 "do" commands1 delimiters1 "done"
|
||||
{
|
||||
$$ = grub_script_create_cmdwhile (state, $3, $6, 1);
|
||||
grub_script_lexer_deref (state->lexerstate);
|
||||
}
|
||||
;
|
||||
|
|
|
@ -245,6 +245,28 @@ grub_script_create_cmdfor (struct grub_parser_param *state,
|
|||
return (struct grub_script_cmd *) cmd;
|
||||
}
|
||||
|
||||
/* Create a "while" or "until" command. */
|
||||
struct grub_script_cmd *
|
||||
grub_script_create_cmdwhile (struct grub_parser_param *state,
|
||||
struct grub_script_cmd *cond,
|
||||
struct grub_script_cmd *list,
|
||||
int is_an_until_loop)
|
||||
{
|
||||
struct grub_script_cmdwhile *cmd;
|
||||
|
||||
cmd = grub_script_malloc (state, sizeof (*cmd));
|
||||
if (! cmd)
|
||||
return 0;
|
||||
|
||||
cmd->cmd.exec = grub_script_execute_cmdwhile;
|
||||
cmd->cmd.next = 0;
|
||||
cmd->cond = cond;
|
||||
cmd->list = list;
|
||||
cmd->until = is_an_until_loop;
|
||||
|
||||
return (struct grub_script_cmd *) cmd;
|
||||
}
|
||||
|
||||
/* Create a command that adds a menu entry to the menu. Title is an
|
||||
argument that is parsed to generate a string that can be used as
|
||||
the title. The sourcecode for this entry is passed in SOURCECODE.
|
||||
|
|
|
@ -159,27 +159,27 @@ grub_console_checkkey (void)
|
|||
read_key = key.unicode_char;
|
||||
break;
|
||||
case 0x01:
|
||||
read_key = 16;
|
||||
read_key = GRUB_TERM_UP;
|
||||
break;
|
||||
case 0x02:
|
||||
read_key = 14;
|
||||
read_key = GRUB_TERM_DOWN;
|
||||
break;
|
||||
case 0x03:
|
||||
read_key = 6;
|
||||
read_key = GRUB_TERM_RIGHT;
|
||||
break;
|
||||
case 0x04:
|
||||
read_key = 2;
|
||||
read_key = GRUB_TERM_LEFT;
|
||||
break;
|
||||
case 0x05:
|
||||
read_key = 1;
|
||||
read_key = GRUB_TERM_HOME;
|
||||
break;
|
||||
case 0x06:
|
||||
read_key = 5;
|
||||
read_key = GRUB_TERM_END;
|
||||
break;
|
||||
case 0x07:
|
||||
break;
|
||||
case 0x08:
|
||||
read_key = 4;
|
||||
read_key = GRUB_TERM_DC;
|
||||
break;
|
||||
case 0x09:
|
||||
break;
|
||||
|
@ -194,6 +194,9 @@ grub_console_checkkey (void)
|
|||
case 0x0d:
|
||||
read_key = 5;
|
||||
break;
|
||||
case 0x0e:
|
||||
read_key = 3;
|
||||
break;
|
||||
case 0x17:
|
||||
read_key = '\e';
|
||||
break;
|
||||
|
|
31
tests/grub_script_if.in
Normal file
31
tests/grub_script_if.in
Normal file
|
@ -0,0 +1,31 @@
|
|||
#! @builddir@/grub-shell-tester
|
||||
|
||||
#basic if, execute
|
||||
if true; then echo yes; fi
|
||||
|
||||
#basic if, no execution
|
||||
if false; then echo no; fi
|
||||
|
||||
#if else, execute if path
|
||||
if true; then echo yes; else echo no; fi
|
||||
|
||||
#if else, execute else path
|
||||
if false; then echo no; else echo yes; fi
|
||||
|
||||
#if elif, execute elif
|
||||
if false; then echo no; elif true; then echo yes; fi
|
||||
|
||||
#if elif else, execute else
|
||||
if false; then echo no; elif false; then echo no; else echo yes; fi
|
||||
|
||||
#if elif(1) elif(2), execute elif(2)
|
||||
if false; then echo no; elif false; then echo no; elif true; then echo yes; fi
|
||||
|
||||
#if elif(1) elif(2) else, execute else
|
||||
if false; then echo no; elif false; then echo no; elif false; then echo no; else echo yes; fi
|
||||
|
||||
#if {if elif else}, execute elif
|
||||
if true; then if false; then echo no; elif true; then echo yes; else echo no; fi; fi
|
||||
|
||||
#if {if elif} else, execute elif. ofcourse no dangling-else problem due to "fi"
|
||||
if true; then if false; then echo no; elif true; then echo yes; fi; else echo no; fi
|
32
tests/grub_script_while1.in
Normal file
32
tests/grub_script_while1.in
Normal file
|
@ -0,0 +1,32 @@
|
|||
#! @builddir@/grub-shell-tester
|
||||
|
||||
echo one
|
||||
foo=""
|
||||
while test "$foo" != "1111"; do foo="${foo}1"; echo "$foo"; done
|
||||
|
||||
echo two
|
||||
foo=""
|
||||
while test "$foo" != "aaaa"
|
||||
do
|
||||
foo="${foo}a"
|
||||
echo $foo
|
||||
done
|
||||
|
||||
foo=""
|
||||
until test "$foo" = "1111"; do foo="${foo}1"; echo $foo; done
|
||||
foo=""
|
||||
until test "$foo" = "aaaa"
|
||||
do
|
||||
foo="${foo}a"
|
||||
echo $foo
|
||||
done
|
||||
|
||||
# check "$?" in condition gets its value from while body commands
|
||||
foo=""
|
||||
false
|
||||
while test "$?" != "0"
|
||||
do
|
||||
echo $foo
|
||||
foo="${foo}1"
|
||||
test "$foo" = "111111"
|
||||
done
|
|
@ -135,7 +135,7 @@ fdafile=`mktemp`
|
|||
cp ${isofile} ${fdafile}
|
||||
|
||||
outfile=`mktemp`
|
||||
qemu-system-i386 ${qemuopts} -nographic -serial stdio -hda ${hdafile} -fda ${fdafile} -cdrom ${isofile} -boot ${bootdev} | tr -d "\r" >${outfile}
|
||||
qemu-system-i386 ${qemuopts} -nographic -hda ${hdafile} -fda ${fdafile} -cdrom ${isofile} -boot ${bootdev} | tr -d "\r" >${outfile}
|
||||
|
||||
cat $outfile
|
||||
|
||||
|
|
|
@ -38,8 +38,6 @@
|
|||
#include <grub/partition.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
#include <grub_emu_init.h>
|
||||
|
||||
#define ENABLE_RELOCATABLE 0
|
||||
#include "progname.h"
|
||||
|
||||
|
@ -55,6 +53,7 @@ grub_arch_modules_addr (void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if GRUB_NO_MODULES
|
||||
grub_err_t
|
||||
grub_arch_dl_check_header (void *ehdr)
|
||||
{
|
||||
|
@ -71,6 +70,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
|||
|
||||
return GRUB_ERR_BAD_MODULE;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
grub_reboot (void)
|
||||
|
@ -150,6 +150,10 @@ void grub_hostfs_init (void);
|
|||
void grub_hostfs_fini (void);
|
||||
void grub_host_init (void);
|
||||
void grub_host_fini (void);
|
||||
#if GRUB_NO_MODULES
|
||||
void grub_init_all (void);
|
||||
void grub_fini_all (void);
|
||||
#endif
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
|
@ -215,7 +219,9 @@ main (int argc, char *argv[])
|
|||
/* XXX: This is a bit unportable. */
|
||||
grub_util_biosdisk_init (dev_map);
|
||||
|
||||
#if GRUB_NO_MODULES
|
||||
grub_init_all ();
|
||||
#endif
|
||||
|
||||
/* Make sure that there is a root device. */
|
||||
if (! root_dev)
|
||||
|
@ -233,6 +239,9 @@ main (int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
if (strcmp (root_dev, "host") == 0)
|
||||
dir = xstrdup (dir);
|
||||
else
|
||||
dir = grub_get_prefix (dir);
|
||||
prefix = xmalloc (strlen (root_dev) + 2 + strlen (dir) + 1);
|
||||
sprintf (prefix, "(%s)%s", root_dev, dir);
|
||||
|
@ -242,7 +251,9 @@ main (int argc, char *argv[])
|
|||
if (setjmp (main_env) == 0)
|
||||
grub_main ();
|
||||
|
||||
#if GRUB_NO_MODULES
|
||||
grub_fini_all ();
|
||||
#endif
|
||||
grub_hostfs_fini ();
|
||||
grub_host_fini ();
|
||||
|
||||
|
|
|
@ -140,27 +140,31 @@ if [ "x${GRUB_TERMINAL}" != "x" ] ; then
|
|||
GRUB_TERMINAL_OUTPUT="${GRUB_TERMINAL}"
|
||||
fi
|
||||
|
||||
case x${GRUB_TERMINAL_OUTPUT} in
|
||||
x | xgfxterm)
|
||||
termoutdefault=0
|
||||
if [ "x${GRUB_TERMINAL_OUTPUT}" == x ]; then
|
||||
GRUB_TERMINAL_OUTPUT=gfxterm;
|
||||
termoutdefault=1;
|
||||
fi
|
||||
|
||||
for x in ${GRUB_TERMINAL_OUTPUT}; do
|
||||
if [ x${x} == xgfxterm ]; then
|
||||
# If this platform supports gfxterm, try to use it.
|
||||
if test -e ${grub_prefix}/gfxterm.mod ; then
|
||||
if ! test -e ${grub_prefix}/gfxterm.mod ; then
|
||||
if [ "x$termoutdefault" != "x1" ]; then
|
||||
echo "gfxterm isn't available on your platform" >&2 ; exit 1
|
||||
fi
|
||||
GRUB_TERMINAL_OUTPUT=
|
||||
break;
|
||||
fi
|
||||
# FIXME: this should do something smarter than just loading first
|
||||
# video backend.
|
||||
GRUB_VIDEO_BACKEND=$(head -n 1 ${grub_prefix}/video.lst || true)
|
||||
if [ -n "${GRUB_VIDEO_BACKEND}" ] ; then
|
||||
GRUB_TERMINAL_OUTPUT=gfxterm
|
||||
elif [ "${GRUB_TERMINAL_OUTPUT}" = "gfxterm" ] ; then
|
||||
if [ -z "${GRUB_VIDEO_BACKEND}" ] ; then
|
||||
if [ "x$termoutdefault" != "x1" ]; then
|
||||
echo "No suitable backend could be found for gfxterm." >&2 ; exit 1
|
||||
fi
|
||||
GRUB_TERMINAL_OUTPUT=
|
||||
fi
|
||||
;;
|
||||
xconsole | xserial | xofconsole) ;;
|
||||
*) echo "Invalid output terminal \"${GRUB_TERMINAL_OUTPUT}\"" >&2 ; exit 1 ;;
|
||||
esac
|
||||
|
||||
# check for terminals that require fonts
|
||||
case ${GRUB_TERMINAL_OUTPUT} in
|
||||
gfxterm)
|
||||
if [ -n "$GRUB_FONT" ] ; then
|
||||
if is_path_readable_by_grub ${GRUB_FONT} > /dev/null ; then
|
||||
GRUB_FONT_PATH=${GRUB_FONT}
|
||||
|
@ -186,14 +190,23 @@ case ${GRUB_TERMINAL_OUTPUT} in
|
|||
done
|
||||
fi
|
||||
if [ -z "${GRUB_FONT_PATH}" ] ; then
|
||||
# fallback to the native terminal for this platform
|
||||
unset GRUB_TERMINAL_OUTPUT
|
||||
if [ "x$termoutdefault" != "x1" ]; then
|
||||
echo "No font for gfxterm found." >&2 ; exit 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
GRUB_TERMINAL_OUTPUT=
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
for x in ${GRUB_TERMINAL_OUTPUT}; do
|
||||
case "x${x}" in
|
||||
xgfxterm) ;;
|
||||
xconsole | xserial | xofconsole)
|
||||
# make sure all our children behave in conformance with ascii..
|
||||
export LANG=C
|
||||
export LANG=C;;
|
||||
*) echo "Invalid output terminal \"${GRUB_TERMINAL_OUTPUT}\"" >&2 ; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# These are defined in this script, export them here so that user can
|
||||
# override them.
|
||||
|
@ -220,6 +233,7 @@ export GRUB_DEFAULT \
|
|||
GRUB_DISABLE_LINUX_UUID \
|
||||
GRUB_DISABLE_LINUX_RECOVERY \
|
||||
GRUB_GFXMODE \
|
||||
GRUB_BACKGROUND \
|
||||
GRUB_THEME \
|
||||
GRUB_GFXPAYLOAD_LINUX \
|
||||
GRUB_DISABLE_OS_PROBER \
|
||||
|
|
|
@ -156,7 +156,7 @@ EOF
|
|||
echo "insmod $i"
|
||||
done ; \
|
||||
echo "source /boot/grub/grub.cfg") \
|
||||
> ${iso9660_dir}/boot/grub/i386-pc/grub.cfg
|
||||
> ${iso9660_dir}/boot/grub/i386-coreboot/grub.cfg
|
||||
|
||||
tar -C ${memdisk_dir} -cf ${memdisk_img} boot
|
||||
rm -rf ${memdisk_dir}
|
||||
|
@ -187,7 +187,7 @@ if test -e "${pc_dir}" ; then
|
|||
echo "source /boot/grub/grub.cfg") \
|
||||
> ${iso9660_dir}/boot/grub/i386-pc/grub.cfg
|
||||
|
||||
grub_mkisofs_arguments="${grub_mkisofs_arguments} -b boot/grub/i386-pc/eltorito.img -boot-info-table \
|
||||
grub_mkisofs_arguments="${grub_mkisofs_arguments} -b boot/grub/i386-pc/eltorito.img -no-emul-boot -boot-info-table \
|
||||
--embedded-boot ${embed_img}"
|
||||
fi
|
||||
|
||||
|
|
|
@ -87,6 +87,12 @@ grub_script_execute_cmdfor (struct grub_script_cmd *cmd __attribute__ ((unused))
|
|||
return 0;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_script_execute_cmdwhile (struct grub_script_cmd *cmd __attribute__ ((unused)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_script_execute_menuentry (struct grub_script_cmd *cmd __attribute__ ((unused)))
|
||||
{
|
||||
|
|
|
@ -59,8 +59,18 @@ function savedefault {
|
|||
}
|
||||
EOF
|
||||
|
||||
case ${GRUB_TERMINAL_INPUT}:${GRUB_TERMINAL_OUTPUT} in
|
||||
serial:* | *:serial)
|
||||
serial=0;
|
||||
gfxterm=0;
|
||||
for x in ${GRUB_TERMINAL_INPUT} ${GRUB_TERMINAL_OUTPUT}; do
|
||||
if [ xserial = "x$x" ]; then
|
||||
serial=1;
|
||||
fi
|
||||
if [ xgfxterm = "x$x" ]; then
|
||||
gfxterm=1;
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "x$serial" = x1 ]; then
|
||||
if ! test -e ${grub_prefix}/serial.mod ; then
|
||||
echo "Serial terminal not available on this platform." >&2 ; exit 1
|
||||
fi
|
||||
|
@ -70,8 +80,71 @@ case ${GRUB_TERMINAL_INPUT}:${GRUB_TERMINAL_OUTPUT} in
|
|||
GRUB_SERIAL_COMMAND=serial
|
||||
fi
|
||||
echo "${GRUB_SERIAL_COMMAND}"
|
||||
;;
|
||||
fi
|
||||
|
||||
if [ "x$gfxterm" = x1 ]; then
|
||||
# Make the font accessible
|
||||
prepare_grub_to_access_device `${grub_probe} --target=device "${GRUB_FONT_PATH}"`
|
||||
|
||||
cat << EOF
|
||||
if loadfont `make_system_path_relative_to_its_root "${GRUB_FONT_PATH}"` ; then
|
||||
set gfxmode=${GRUB_GFXMODE}
|
||||
insmod gfxterm
|
||||
insmod ${GRUB_VIDEO_BACKEND}
|
||||
EOF
|
||||
if [ "x$GRUB_THEME" != x ] && [ -f "$GRUB_THEME" ] \
|
||||
&& is_path_readable_by_grub "$GRUB_THEME"; then
|
||||
echo "Found theme: $GRUB_THEME" >&2
|
||||
prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_THEME"` | sed -e "s/^/ /"
|
||||
cat << EOF
|
||||
insmod gfxmenu
|
||||
EOF
|
||||
themedir="`dirname "$GRUB_THEME"`"
|
||||
for x in "$themedir"/*.pf2 "$themedir"/f/*.pf2; do
|
||||
if [ -f "$x" ]; then
|
||||
cat << EOF
|
||||
loadfont (\$root)`make_system_path_relative_to_its_root $x`
|
||||
EOF
|
||||
fi
|
||||
done
|
||||
if [ x"`echo "$themedir"/*.jpg`" != x"$themedir/*.jpg" ] || [ x"`echo "$themedir"/*.jpeg`" != x"$themedir/*.jpeg" ]; then
|
||||
cat << EOF
|
||||
insmod jpeg
|
||||
EOF
|
||||
fi
|
||||
if [ x"`echo "$themedir"/*.png`" != x"$themedir/*.png" ]; then
|
||||
cat << EOF
|
||||
insmod png
|
||||
EOF
|
||||
fi
|
||||
if [ x"`echo "$themedir"/*.tga`" != x"$themedir/*.tga" ]; then
|
||||
cat << EOF
|
||||
insmod tga
|
||||
EOF
|
||||
fi
|
||||
|
||||
cat << EOF
|
||||
set theme=(\$root)`make_system_path_relative_to_its_root $GRUB_THEME`
|
||||
EOF
|
||||
elif [ "x$GRUB_BACKGROUND" != x ] && [ -f "$GRUB_BACKGROUND" ] \
|
||||
&& is_path_readable_by_grub "$GRUB_BACKGROUND"; then
|
||||
echo "Found background: $GRUB_BACKGROUND" >&2
|
||||
case "$GRUB_BACKGROUND" in
|
||||
*.png) reader=png ;;
|
||||
*.tga) reader=tga ;;
|
||||
*.jpg|*.jpeg) reader=jpeg ;;
|
||||
*) echo "Unsupported image format" >&2; exit 1 ;;
|
||||
esac
|
||||
prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_BACKGROUND"` | sed -e "s/^/ /"
|
||||
cat << EOF
|
||||
insmod $reader
|
||||
background_image -m stretch `make_system_path_relative_to_its_root "$GRUB_BACKGROUND"`
|
||||
EOF
|
||||
fi
|
||||
cat << EOF
|
||||
fi
|
||||
EOF
|
||||
fi
|
||||
|
||||
case x${GRUB_TERMINAL_INPUT} in
|
||||
x)
|
||||
|
@ -89,35 +162,6 @@ EOF
|
|||
esac
|
||||
|
||||
case x${GRUB_TERMINAL_OUTPUT} in
|
||||
xgfxterm)
|
||||
# Make the font accessible
|
||||
prepare_grub_to_access_device `${grub_probe} --target=device ${GRUB_FONT_PATH}`
|
||||
|
||||
cat << EOF
|
||||
if loadfont `make_system_path_relative_to_its_root ${GRUB_FONT_PATH}` ; then
|
||||
set gfxmode=${GRUB_GFXMODE}
|
||||
insmod gfxterm
|
||||
insmod ${GRUB_VIDEO_BACKEND}
|
||||
if terminal_output gfxterm ; then true ; else
|
||||
# For backward compatibility with versions of terminal.mod that don't
|
||||
# understand terminal_output
|
||||
terminal gfxterm
|
||||
fi
|
||||
EOF
|
||||
if [ x$GRUB_THEME != x ] && [ -f $GRUB_THEME ] \
|
||||
&& is_path_readable_by_grub $GRUB_THEME; then
|
||||
echo "Found theme: $GRUB_THEME" >&2
|
||||
prepare_grub_to_access_device `${grub_probe} --target=device $GRUB_THEME` | sed -e "s/^/ /"
|
||||
cat << EOF
|
||||
insmod gfxmenu
|
||||
set theme=(\$root)`make_system_path_relative_to_its_root $GRUB_THEME`
|
||||
set menuviewer=gfxmenu
|
||||
EOF
|
||||
fi
|
||||
cat << EOF
|
||||
fi
|
||||
EOF
|
||||
;;
|
||||
x)
|
||||
# Just use the native terminal
|
||||
;;
|
||||
|
|
|
@ -27,7 +27,7 @@ if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
|
|||
OS=GNU
|
||||
else
|
||||
OS="${GRUB_DISTRIBUTOR} GNU/Hurd"
|
||||
CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr '[A-Z]' '[a-z]') ${CLASS}"
|
||||
CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr '[A-Z]' '[a-z]' | cut -d' ' -f1) ${CLASS}"
|
||||
fi
|
||||
|
||||
at_least_one=false
|
||||
|
|
|
@ -30,7 +30,7 @@ CLASS="--class os"
|
|||
case "${GRUB_DISTRIBUTOR}" in
|
||||
Debian)
|
||||
OS="${GRUB_DISTRIBUTOR} GNU/kFreeBSD"
|
||||
CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr '[A-Z]' '[a-z]') --class gnu-kfreebsd --class gnu ${CLASS}"
|
||||
CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr '[A-Z]' '[a-z]' | cut -d' ' -f1) --class gnu-kfreebsd --class gnu ${CLASS}"
|
||||
;;
|
||||
*)
|
||||
OS="FreeBSD"
|
||||
|
|
|
@ -31,7 +31,7 @@ if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
|
|||
OS=GNU/Linux
|
||||
else
|
||||
OS="${GRUB_DISTRIBUTOR} GNU/Linux"
|
||||
CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr '[A-Z]' '[a-z]') ${CLASS}"
|
||||
CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr '[A-Z]' '[a-z]' | cut -d' ' -f1) ${CLASS}"
|
||||
fi
|
||||
|
||||
# loop-AES arranges things so that /dev/loop/X can be our root device, but
|
||||
|
|
|
@ -1042,7 +1042,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
|
|||
drive = find_system_device (os_dev);
|
||||
if (drive < 0)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_DEVICE,
|
||||
grub_error (GRUB_ERR_UNKNOWN_DEVICE,
|
||||
"no mapping exists for `%s'", os_dev);
|
||||
return 0;
|
||||
}
|
||||
|
|
55
util/misc.c
55
util/misc.c
|
@ -35,6 +35,7 @@
|
|||
#endif
|
||||
|
||||
#include <grub/kernel.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/cache.h>
|
||||
#include <grub/util/misc.h>
|
||||
|
@ -262,56 +263,6 @@ grub_util_write_image (const char *img, size_t size, FILE *out)
|
|||
grub_util_error ("write failed");
|
||||
}
|
||||
|
||||
void *
|
||||
grub_malloc (grub_size_t size)
|
||||
{
|
||||
return xmalloc (size);
|
||||
}
|
||||
|
||||
void *
|
||||
grub_zalloc (grub_size_t size)
|
||||
{
|
||||
void *ret;
|
||||
|
||||
ret = xmalloc (size);
|
||||
memset (ret, 0, size);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
grub_free (void *ptr)
|
||||
{
|
||||
free (ptr);
|
||||
}
|
||||
|
||||
void *
|
||||
grub_realloc (void *ptr, grub_size_t size)
|
||||
{
|
||||
return xrealloc (ptr, size);
|
||||
}
|
||||
|
||||
void *
|
||||
grub_memalign (grub_size_t align, grub_size_t size)
|
||||
{
|
||||
void *p;
|
||||
|
||||
#if defined(HAVE_POSIX_MEMALIGN)
|
||||
if (posix_memalign (&p, align, size) != 0)
|
||||
p = 0;
|
||||
#elif defined(HAVE_MEMALIGN)
|
||||
p = memalign (align, size);
|
||||
#else
|
||||
(void) align;
|
||||
(void) size;
|
||||
grub_util_error ("grub_memalign is not supported");
|
||||
#endif
|
||||
|
||||
if (! p)
|
||||
grub_util_error ("out of memory");
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
/* Some functions that we don't use. */
|
||||
void
|
||||
grub_mm_init_region (void *addr __attribute__ ((unused)),
|
||||
|
@ -319,10 +270,12 @@ grub_mm_init_region (void *addr __attribute__ ((unused)),
|
|||
{
|
||||
}
|
||||
|
||||
#if GRUB_NO_MODULES
|
||||
void
|
||||
grub_register_exported_symbols (void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
grub_exit (void)
|
||||
|
@ -374,7 +327,7 @@ grub_millisleep (grub_uint32_t ms)
|
|||
|
||||
#endif
|
||||
|
||||
#if !(defined (__i386__) || defined (__x86_64__))
|
||||
#if !(defined (__i386__) || defined (__x86_64__)) && GRUB_NO_MODULES
|
||||
void
|
||||
grub_arch_sync_caches (void *address __attribute__ ((unused)),
|
||||
grub_size_t len __attribute__ ((unused)))
|
||||
|
|
85
util/mm.c
Normal file
85
util/mm.c
Normal file
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003,2005,2006,2007,2008,2009,2010 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/types.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/mm.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
void *
|
||||
grub_malloc (grub_size_t size)
|
||||
{
|
||||
void *ret;
|
||||
ret = malloc (size);
|
||||
if (!ret)
|
||||
grub_error (GRUB_ERR_OUT_OF_MEMORY, "out of memory");
|
||||
return ret;
|
||||
}
|
||||
|
||||
void *
|
||||
grub_zalloc (grub_size_t size)
|
||||
{
|
||||
void *ret;
|
||||
|
||||
ret = grub_malloc (size);
|
||||
if (!ret)
|
||||
return NULL;
|
||||
memset (ret, 0, size);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
grub_free (void *ptr)
|
||||
{
|
||||
free (ptr);
|
||||
}
|
||||
|
||||
void *
|
||||
grub_realloc (void *ptr, grub_size_t size)
|
||||
{
|
||||
void *ret;
|
||||
ret = realloc (ptr, size);
|
||||
if (!ret)
|
||||
grub_error (GRUB_ERR_OUT_OF_MEMORY, "out of memory");
|
||||
return ret;
|
||||
}
|
||||
|
||||
void *
|
||||
grub_memalign (grub_size_t align, grub_size_t size)
|
||||
{
|
||||
void *p;
|
||||
|
||||
#if defined(HAVE_POSIX_MEMALIGN)
|
||||
if (align < sizeof (void *))
|
||||
align = sizeof (void *);
|
||||
if (posix_memalign (&p, align, size) != 0)
|
||||
p = 0;
|
||||
#elif defined(HAVE_MEMALIGN)
|
||||
p = memalign (align, size);
|
||||
#else
|
||||
(void) align;
|
||||
(void) size;
|
||||
grub_util_error ("grub_memalign is not supported");
|
||||
#endif
|
||||
|
||||
if (!p)
|
||||
grub_error (GRUB_ERR_OUT_OF_MEMORY, "out of memory");
|
||||
|
||||
return p;
|
||||
}
|
Loading…
Reference in a new issue