merge mainline into bidi

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-05-05 16:28:52 +02:00
commit 99bfe57386
109 changed files with 3099 additions and 839 deletions

470
ChangeLog
View file

@ -1,3 +1,473 @@
2010-05-03 Vladimir Serbinenko <phcoder@gmail.com>
* commands/parttool.c (grub_cmd_parttool): Fix #if !GRUB_NO_MODULES
condition.
2010-05-03 Vladimir Serbinenko <phcoder@gmail.com>
* kern/mm.c (grub_real_malloc): Put magic and size assignment in common
part.
2010-05-03 Vladimir Serbinenko <phcoder@gmail.com>
* kern/mm.c (grub_mm_init_region): Check for region size after aligning
pointers.
2010-05-03 Vladimir Serbinenko <phcoder@gmail.com>
* kern/mm.c (grub_real_malloc): Fix size calculation when extra == 0.
2010-05-01 Christian Franke <franke@computer.org>
* util/grub-mkconfig_lib.in (make_system_path_relative_to_its_root):
Remove broken Cygwin path conversion.
* util/misc.c: [__CYGWIN__] Add include and define.
[__CYGWIN__] (get_win32_path): Copy function from getroot.c, modify
for Cygwin 1.7.
(make_system_path_relative_to_its_root): Simplify loop, replace early
return by break.
[__CYGWIN__] Add conversion to win32 path.
Include "/" case in trailing slash removal.
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
* kern/main.c (grub_load_config): Fix copy-pasted comment.
Reported by: Seth Goldberg
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
* commands/help.c (grub_cmd_help): Fix a typo.
Reported by: Seth Goldberg
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
* commands/hashsum.c (GRUB_MOD_INIT): Remove duplication of command
name and add N_.
* commands/i386/pc/drivemap.c (GRUB_MOD_INIT): Likewise.
* commands/iorw.c (GRUB_MOD_INIT): Likewise.
* commands/password_pbkdf2.c (GRUB_MOD_INIT): Likewise.
* commands/regexp.c (GRUB_MOD_INIT): Likewise.
* commands/setpci.c (GRUB_MOD_INIT): Likewise.
* commands/terminal.c (GRUB_MOD_INIT): Likewise.
* efiemu/main.c (GRUB_MOD_INIT): Likewise.
* font/font_cmd.c (GRUB_MOD_INIT): Likewise.
* kern/corecmd.c (GRUB_MOD_INIT): Likewise.
* mmap/mmap.c (GRUB_MOD_INIT): Likewise.
* normal/context.c (GRUB_MOD_INIT): Likewise.
* normal/main.c (GRUB_MOD_INIT): Likewise.
* term/gfxterm.c (GRUB_MOD_INIT): Likewise.
* term/serial.c (GRUB_MOD_INIT): Likewise.
* term/terminfo.c (GRUB_MOD_INIT): Likewise.
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
* kern/mm.c (grub_real_malloc): Satisfy alignment requirement when
extra == 0.
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
* commands/iorw.c: New file.
* conf/i386.rmk (pkglib_MODULES): Add iorw.mod.
(iorw_mod_SOURCES): New variable.
(iorw_mod_CFLAGS): Likewise.
(iorw_mod_LDFLAGS): Likewise.
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
Hotkey support
* include/grub/menu.h (grub_menu_entry): New field 'hotkey'.
* normal/main.c (hotkey_aliases): New variable.
(grub_normal_add_menu_entry): Parse "--hotkey".
* normal/menu_text.c (run_menu): Handle hotkeys.
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
* kern/i386/coreboot/init.c (grub_machine_init): Call
grub_machine_mmap_init on qemu.
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
* boot/i386/qemu/boot.S: Add a missing .code16.
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
Use LBIO on coreboot.
* conf/i386-coreboot.rmk (kernel_img_SOURCES): Change
kern/i386/multiboot_mmap.c to kern/i386/coreboot/mmap.c.
* include/grub/i386/coreboot/memory.h (GRUB_LINUXBIOS_MEMBER_LINK):
New declaration.
* kern/i386/coreboot/init.c (grub_machine_init): Don't call
grub_machine_mmap_init on coreboot.
* kern/i386/coreboot/mmap.c (grub_linuxbios_table_iterate): Handle
GRUB_LINUXBIOS_MEMBER_LINK.
(grub_machine_mmap_iterate): Fix declaration.
* kern/i386/coreboot/startup.S: Don't save mbi location on coreboot.
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
Split coreboot and multiboot ports.
* conf/i386-multiboot.rmk: New file.
* configure.ac: Add multiboot port.
* include/grub/i386/multiboot/boot.h: New file.
* include/grub/i386/multiboot/console.h: Likewise.
* include/grub/i386/multiboot/init.h: Likewise.
* include/grub/i386/multiboot/kernel.h: Likewise.
* include/grub/i386/multiboot/loader.h: Likewise.
* include/grub/i386/multiboot/memory.h: Likewise.
* include/grub/i386/multiboot/serial.h: Likewise.
* include/grub/i386/multiboot/time.h: Likewise.
* include/grub/multiboot.h: Add GRUB_MACHINE_MULTIBOOT to ifdef.
* loader/multiboot.c: Likewise.
* loader/multiboot_mbi2.c: Likewise.
* util/grub-mkrescue.in: Generate multiboot rescue.
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
* kern/parser.c (grub_parser_execute): Cope with read-only config.
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
Merge handling of input and output terminals. Fix a hang.
* commands/terminal.c (abstract_terminal): New struct.
(handle_command): New function. Based on grub_cmd_terminal_input.
(grub_cmd_terminal_input): Use handle_command.
(grub_cmd_terminal_output): Use handle_command.
2010-05-01 BVK Chaitanya <bvk.groups@gmail.com>
Fix comment handling.
* tests/grub_script_comments.in: New testcase.
* conf/tests.rmk: Rules for new testcase.
* script/yylex.l: Updated flex rules.
2010-04-28 Samuel Thibault <samuel.thibault@ens-lyon.org>
* docs/grub.texi (play): Document that zero pitches produce rests.
* commands/i386/pc/play.c (grub_cmd_play): Call 'grub_file_open' only
if argc is 1.
2010-04-27 Vladimir Serbinenko <phcoder@gmail.com>
* conf/x86-efi.rmk (linux_mod_SOURCES): Write explicitly to avoid
autogen issues.
2010-04-26 Christian Franke <franke@computer.org>
* include/grub/util/getroot.h (grub_get_prefix): Remove prototype.
* util/getroot.c [__CYGWIN__] (get_win32_path): Remove function.
(grub_get_prefix): Remove function.
* util/grub-emu.c (main): Replace grub_get_prefix () call by
make_system_path_relative_to_its_root ().
* util/sparc64/ieee1275/grub-setup.c (main): Likewise.
2010-04-24 Christian Franke <franke@computer.org>
* Makefile.in (TARGET_LDFLAGS): Add -static-libgcc.
(kernel_img_LDFLAGS): Remove -static-libgcc.
2010-04-24 Christian Franke <franke@computer.org>
* configure.ac: Do not CHECK_BSS_START_SYMBOL
and CHECK_END_SYMBOL if grub-emu is built.
Unset TARGET_OBJ2ELF if grub-emu is built
without module support.
2010-04-24 Jiro SEKIBA <jir@unicus.jp>
Nilfs2 support.
* conf/common.rmk (grub_probe_SOURCES): Add fs/nilfs2.c.
(grub_fstest_SOURCES): Likewise.
(pkglib_MODULES): Add nilfs2.mod.
(nilfs2_mod_SOURCES): New variable.
(nilfs2_mod_CFLAGS): Likewise.
(nilfs2_mod_LDFLAGS): Likewise.
* conf/i386-pc.rmk (grub_setup_SOURCES): Add fs/nilfs2.c.
* conf/sparc64-ieee1275.rmk (grub_setup_SOURCES): Add fs/nilfs2.c.
* fs/nilfs2.c: New file.
2010-04-21 Vladimir Serbinenko <phcoder@gmail.com>
* configure.ac: Refuse to compile for x86_64-efi is mcmodel=large
is not supported.
2010-04-19 Grégoire Sutre <gregoire.sutre@gmail.com>
Add grub-mkconfig support for NetBSD.
* util/grub.d/10_netbsd.in: grub-mkconfig helper script for NetBSD.
* util/grub-mkconfig.in: export new NetBSD specific variables.
* po/POTFILES-shell: added 10_netbsd.in.
* util/grub-mkconfig_lib.in: check for gettext binary, default to echo.
2010-04-19 BVK Chaitanya <bvk.groups@gmail.com>
Fix emu build with grub-emu-pci and grub-emu-modules.
* include/grub/util/misc.h: Export grub_util_{info,error,warn}
functions.
* include/grub/libpciaccess.h: New file.
* conf/any-emu.rmk: Update kernel headers for emu build.
2010-04-19 Vladimir Serbinenko <phcoder@gmail.com>
* fs/udf.c (grub_udf_iterate_dir): Silence a spurious warning.
2010-04-19 Vladimir Serbinenko <phcoder@gmail.com>
* fs/udf.c (grub_udf_iterate_dir): Decode the Unicode filenames.
2010-04-18 Vladimir Serbinenko <phcoder@gmail.com>
* boot/sparc64/ieee1275/boot.S: Various size-reducing changes.
Retrieve chosen/bootpath if bootpath isn't hardcoded.
* conf/sparc64-ieee1275.rmk (grub_setup_SOURCES): Add
util/ieee1275/ofpath.c.
* util/sparc64/ieee1275/grub-ofpathname.c: Renamed to ...
* util/ieee1275/grub-ofpathname.c: ... this. All users updated
* include/grub/sparc64/ieee1275/boot.h
(GRUB_BOOT_MACHINE_KERNEL_SECTOR): Renamed to ...
(GRUB_BOOT_MACHINE_KERNEL_BYTE): ...this. Moved 8 bytes lower.
* util/hostdisk.c (grub_util_biosdisk_get_osdev): New function.
* util/ieee1275/ofpath.c (grub_util_devname_to_ofpath): Make argument
const char *.
* util/sparc64/ieee1275/grub-setup.c (compute_dest_ofpath): Removed.
(setup): Use KERNEL_BYTE instead of KERNEL_SECTOR.
Use grub_util_devname_to_ofpath. Zero-fill boot_devpath on same disk
install.
2010-04-18 Grégoire Sutre <gregoire.sutre@gmail.com>
* util/grub-mkconfig.in: Corrected two == equality tests.
Set grub_prefix as in grub-install for NetBSD and OpenBSD.
* configure.ac: All definitions and uses of TARGET_IMG_LDFLAGS_AC now
expect a number appended to it.
* acinclude.m4 (grub_PROG_OBJCOPY_ABSOLUTE): ${TARGET_IMG_LDFLAGS_AC}
expects a number appended to it.
2010-04-18 Vladimir Serbinenko <phcoder@gmail.com>
* po/POTFILES: Renamed multiboot_loader.c to multiboot.c
2010-04-18 Vladimir Serbinenko <phcoder@gmail.com>
* util/hostdisk.c (make_device_name): Change to new partition naming.
2010-04-17 Vladimir Serbinenko <phcoder@gmail.com>
* disk/lvm.c (grub_lvm_memberlist): Issue an error if pv->disk = 0.
2010-04-17 Christian Franke <franke@computer.org>
* Makefile.in: Add missing localedir setting.
2010-04-14 Colin Watson <cjwatson@ubuntu.com>
Restore TEXTDOMAINDIR correction from r1889, lost apparently by
mistake in r2156. Noticed by Anthony Fok.
* util/grub.d/10_kfreebsd.in (TEXTDOMAINDIR): Set to lowercased
@localedir@.
* util/grub.d/10_linux.in (TEXTDOMAINDIR): Likewise.
2010-04-14 BVK Chaitanya <bvk.groups@gmail.com>
Fix a spurious, uninitialized variable warning.
* loader/i386/bsdXX.c (grub_freebsd_load_elfmodule_obj):
Initialize variable, shdr.
(grub_freebsd_load_elfmodule): Likewise.
(grub_freebsd_load_elf_meta): Likewise.
2010-04-13 BVK Chaitanya <bvk.groups@gmail.com>
Fix for escaped dollar in double quoted strings.
* script/yylex.l: Updated flex rules.
* conf/tests.rmk: Rule for new testcase.
* tests/grub_script_dollar.in: New testcase.
2010-04-13 Carles Pina i Estany <carles@pina.cat>
2010-04-13 Colin Watson <cjwatson@ubuntu.com>
Enclose all translated strings in grub.cfg in single quotes, and
escape them appropriately (Ubuntu bug #552921).
* util/grub-mkconfig_lib.in (gettext_quoted): New function.
* util/grub.d/10_hurd.in: Use it.
* util/grub.d/10_kfreebsd.in (kfreebsd_entry): Likewise.
* util/grub.d/10_linux.in (linux_entry): Likewise.
2010-04-11 Vladimir Serbinenko <phcoder@gmail.com>
Fix cygwin compilation.
* configure.ac: Define NEED_REGISTER_FRAME_INFO.
* include/grub/misc.h (__register_frame_info)
[NEED_REGISTER_FRAME_INFO && !UTIL]: New export.
(__deregister_frame_info) [NEED_REGISTER_FRAME_INFO && !UTIL]: Likewise.
* kern/misc.c (__register_frame_info)
[NEED_REGISTER_FRAME_INFO && !UTIL]: New empty function.
(__deregister_frame_info) [NEED_REGISTER_FRAME_INFO && !UTIL]: Likewise.
2010-04-11 Vladimir Serbinenko <phcoder@gmail.com>
* configure.ac: Respect grub_cv_asm_uscore when defining dummy symbols.
2010-04-11 Vladimir Serbinenko <phcoder@gmail.com>
Unify libgcc processing.
* Makefile.in (kernel_img_LDFLAGS): New variable.
* conf/common.rmk (kernel_img_HEADERS): Add libgcc.h.
* conf/i386-coreboot.rmk (kernel_img_LDFLAGS): Append instead of
overwriting.
* conf/i386-ieee1275.rmk (kernel_img_LDFLAGS): Likewise.
* conf/i386-pc.rmk (kernel_img_LDFLAGS): Likewise.
* conf/i386-qemu.rmk (kernel_img_LDFLAGS): Likewise.
* conf/x86-efi.rmk (kernel_img_LDFLAGS): Likewise.
* conf/mips-qemu-mips.rmk (kernel_img_LDFLAGS): Append instead of
overwriting. Remove -lgcc and -static-libgcc
* conf/mips-yeeloong.rmk (kernel_img_LDFLAGS): Likewise.
* conf/mips.rmk (kernel_img_HEADERS): Remove cpu/libgcc.h
* conf/powerpc-ieee1275.rmk (kernel_img_HEADERS): Remove cpu/libgcc.h
(kernel_img_LDFLAGS): Append instead of overwriting.
Remove -lgcc and -static-libgcc
* conf/sparc64-ieee1275.rmk: Likewise.
* include/grub/powerpc/libgcc.h: Move to ...
* include/grub/libgcc.h: .. this.
* include/grub/libgcc.h: Don't export most of the function on x86.
(__bswapsi2): New export.
(__bswapdi2): Likewise.
* include/grub/mips/libgcc.h: Removed.
* include/grub/sparc64/libgcc.h: Likewise.
2010-04-10 Vladimir Serbinenko <phcoder@gmail.com>
* util/hostdisk.c (grub_util_biosdisk_get_grub_dev): Remove
disk_info_msg (conflicts with gettexting into languages with cases).
2010-04-10 Grégoire Sutre <gregoire.sutre@gmail.com>
Add grub-probe support for NetBSD.
* util/getroot.c (find_root_device): Convert block device to
character device on NetBSD.
* util/probe.c (probe): Require character device on NetBSD.
* util/hostdisk.c: NetBSD specific headers.
(configure_device_driver): new function to tune device driver
parameters (currently only for NetBSD floppy driver).
(grub_util_biosdisk_open): NetBSD specific code (get disk size
via disklabel ioctl).
(open_device): call configure_device_driver on NetBSD.
(convert_system_partition_to_system_disk): NetBSD specific code.
(device_is_wholedisk): Likewise.
(grub_util_biosdisk_get_grub_dev): Likewise.
(make_device_name): Fixed a typo in bsd_part_str.
* configure.ac: check for opendisk() and getrawpartition() on
NetBSD and set LIBUTIL.
* Makefile.in: add LIBUTIL to LIBS.
2010-04-10 BVK Chaitanya <bvk.groups@gmail.com>
Documentation fix.
* util/grub-script-check.c: Better help message.
2010-04-10 BVK Chaitanya <bvk.groups@gmail.com>
Fix FreeBSD build.
* configure.ac: Flex version check.
* conf/common.rmk: Add -Wno-error to sh.mod.
* script/yylex.l: Remove all #pragma.
2010-04-10 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/util/misc.h (canonicalise_file_name): Add missing
prototype.
Reported by: Seth Goldberg.
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.

View file

@ -35,6 +35,7 @@ sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
localedir = @localedir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
@ -43,6 +44,10 @@ pkglibdir = $(libdir)/`echo @PACKAGE_TARNAME@/$(target_cpu)-$(platform) | sed '
# Internationalization library.
LIBINTL = @LIBINTL@
TARGET_NO_MODULES = @TARGET_NO_MODULES@
# Util library.
LIBUTIL = @LIBUTIL@
XGETTEXT = @XGETTEXT@
MSGMERGE = @MSGMERGE@
@ -75,7 +80,7 @@ MKDIR_P = @MKDIR_P@
mkinstalldirs = $(srcdir)/mkinstalldirs
LIBS = @LIBS@ $(LIBINTL)
LIBS = @LIBS@ $(LIBINTL) $(LIBUTIL)
CC = @CC@
CFLAGS = @CFLAGS@
@ -94,11 +99,12 @@ TARGET_APPLE_CC = @TARGET_APPLE_CC@
OBJCONV = @OBJCONV@
TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -I$(srcdir)/include -I$(builddir) -I$(builddir)/include \
-Wall -W
TARGET_LDFLAGS = -nostdlib @TARGET_LDFLAGS@
TARGET_LDFLAGS = -nostdlib -static-libgcc @TARGET_LDFLAGS@
TARGET_IMG_LDSCRIPT = @TARGET_IMG_LDSCRIPT@
TARGET_IMG_LDFLAGS = -nostdlib @TARGET_IMG_LDFLAGS@
TARGET_IMG_CFLAGS = @TARGET_IMG_CFLAGS@
TARGET_OBJ2ELF = @TARGET_OBJ2ELF@
kernel_img_LDFLAGS = -lgcc
EXEEXT = @EXEEXT@
OBJCOPY = @OBJCOPY@
STRIP = @STRIP@
@ -136,7 +142,7 @@ enable_efiemu = @enable_efiemu@
### General variables.
RMKFILES = $(wildcard conf/*.rmk)
RMKFILES = $(wildcard $(srcdir)/conf/*.rmk)
MKFILES = $(patsubst %.rmk,%.mk,$(RMKFILES))
@ -155,7 +161,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 +187,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
@ -433,6 +446,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:

View file

@ -93,7 +93,7 @@ else
fi
grub_cv_prog_objcopy_absolute=yes
for link_addr in 0x2000 0x8000 0x7C00; do
if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -nostdlib ${TARGET_IMG_LDFLAGS_AC} -Wl,-Ttext -Wl,$link_addr conftest.o -o conftest.exec]); then :
if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -nostdlib ${TARGET_IMG_LDFLAGS_AC}$link_addr conftest.o -o conftest.exec]); then :
else
AC_MSG_ERROR([${CC-cc} cannot link at address $link_addr])
fi

View file

@ -63,5 +63,8 @@ VARIABLE(grub_core_entry_addr)
*right here* and this is why we need this kludge. */
. = GRUB_BOOT_MACHINE_SIZE - 16
.code16
jmp _start
. = GRUB_BOOT_MACHINE_SIZE

View file

@ -45,8 +45,9 @@ boot_version: .byte GRUB_BOOT_VERSION_MAJOR, GRUB_BOOT_VERSION_MINOR
* load address plus the size of the prepended A.OUT header (32 bytes).
*/
boot_path:
. = _start + GRUB_BOOT_MACHINE_KERNEL_SECTOR
kernel_sector: .xword 2
. = _start + GRUB_BOOT_MACHINE_KERNEL_BYTE
boot_path_end:
kernel_byte: .xword (2 << 9)
kernel_address: .word GRUB_BOOT_MACHINE_KERNEL_ADDR
prom_finddev_name: .asciz "finddevice"
@ -77,10 +78,22 @@ prom_error:
/* %o0: OF call name
* %o1: input arg 1
*/
prom_call_1_1:
mov 1, %g1
ba prom_call
mov 1, %o5
prom_call_1_1_o2:
clr %o2
ba prom_call_x_1
mov 1, %g1
prom_call_getprop:
mov 4, %g1
stx %g1, [%l1 + 256]
mov CHOSEN_NODE_REG, %o1
ba prom_call_x_1
GET_ABS(prom_getprop_name, %o0)
prom_call_3_1_o1:
ba prom_call_3_1
mov BOOTDEV_REG, %o1
/* %o2: message string
* %o3: message length
@ -97,6 +110,7 @@ console_write:
*/
prom_call_3_1:
mov 3, %g1
prom_call_x_1:
mov 1, %o5
/* fallthru */
@ -126,23 +140,17 @@ boot_continue:
* chosen_node = prom_finddevice("/chosen")
*/
GET_ABS(prom_finddev_name, %o0)
GET_ABS(prom_chosen_path, %o1)
call prom_call_1_1
clr %o2
call prom_call_1_1_o2
GET_ABS(prom_chosen_path, %o1)
ldx [%l1 + 0x20], CHOSEN_NODE_REG
brz CHOSEN_NODE_REG, prom_error
/* getprop(chosen_node, "stdout", &buffer, buffer_size) */
GET_ABS(prom_getprop_name, %o0)
mov 4, %g1
mov 1, %o5
mov CHOSEN_NODE_REG, %o1
GET_ABS(prom_stdout_name, %o2)
GET_ABS(prom_stdout_name, %o2)
add %l1, 256, %o3
mov 1024, %o4
call prom_call
stx %g1, [%l1 + 256]
call prom_call_getprop
mov 1024, %o4
lduw [%l1 + 256], STDOUT_NODE_REG
brz,pn STDOUT_NODE_REG, prom_error
@ -152,15 +160,25 @@ boot_continue:
call console_write
mov GRUB_NAME_LEN, %o3
GET_ABS(boot_path, %o3)
ldub [%o3], %o1
brnz,pn %o1, bootpath_known
/* getprop(chosen_node, "bootpath", &buffer, buffer_size) */
GET_ABS(prom_bootpath_name, %o2)
call prom_call_getprop
mov (boot_path_end - boot_path), %o4
bootpath_known:
/* Open up the boot_path, and use that handle to read the
* first block of the GRUB kernel image.
*
* bootdev_handle = open(boot_path)
*/
GET_ABS(prom_open_name, %o0)
GET_ABS(boot_path, %o1)
call prom_call_1_1
clr %o2
call prom_call_1_1_o2
GET_ABS(boot_path, %o1)
ldx [%l1 + 0x20], BOOTDEV_REG
brz,pn BOOTDEV_REG, prom_open_error
@ -168,28 +186,23 @@ boot_continue:
/* Since we have 64-bit cells, the high cell of the seek offset
* is zero and the low cell is the entire value.
*
* seek(bootdev, 0, *kernel_sector << 9)
* seek(bootdev, 0, *kernel_byte)
*/
GET_ABS(prom_seek_name, %o0)
mov BOOTDEV_REG, %o1
clr %o2
LDX_ABS(kernel_sector, 0x00, %o3)
call prom_call_3_1
sllx %o3, 9, %o3
call prom_call_3_1_o1
LDX_ABS(kernel_byte, 0x00, %o3)
/* read(bootdev, *kernel_address, 512) */
GET_ABS(prom_read_name, %o0)
mov BOOTDEV_REG, %o1
LDUW_ABS(kernel_address, 0x00, %o2)
call prom_call_3_1
call prom_call_3_1_o1
mov 512, %o3
LDUW_ABS(kernel_address, 0x00, %o2)
jmpl %o2, %o7
nop
1: ba,a 1b
. = _start + GRUB_BOOT_MACHINE_CODE_END
/* the last 4 bytes in the sector 0 contain the signature */

View file

@ -24,13 +24,14 @@
#include <grub/misc.h>
#include <grub/crypto.h>
#include <grub/normal.h>
#include <grub/i18n.h>
static const struct grub_arg_option options[] = {
{"hash", 'h', 0, "Specify hash to use.", "HASH", ARG_TYPE_STRING},
{"check", 'c', 0, "Check hash list file.", "FILE", ARG_TYPE_STRING},
{"prefix", 'p', 0, "Base directory for hash list.", "DIRECTORY",
{"hash", 'h', 0, N_("Specify hash to use."), N_("HASH"), ARG_TYPE_STRING},
{"check", 'c', 0, N_("Check hash list file."), N_("FILE"), ARG_TYPE_STRING},
{"prefix", 'p', 0, N_("Base directory for hash list."), N_("DIRECTORY"),
ARG_TYPE_STRING},
{"keep-going", 'k', 0, "Don't stop after first error.", 0, 0},
{"keep-going", 'k', 0, N_("Don't stop after first error."), 0, 0},
{0, 0, 0, 0, 0, 0}
};
@ -249,21 +250,21 @@ GRUB_MOD_INIT(hashsum)
options);
cmd_md5 = grub_register_extcmd ("md5sum", grub_cmd_hashsum,
GRUB_COMMAND_FLAG_BOTH,
"md5sum [-c FILE [-p PREFIX]] "
"[FILE1 [FILE2 ...]]",
"Compute or check hash checksum.",
N_("[-c FILE [-p PREFIX]] "
"[FILE1 [FILE2 ...]]"),
N_("Compute or check hash checksum."),
options);
cmd_sha256 = grub_register_extcmd ("sha256sum", grub_cmd_hashsum,
GRUB_COMMAND_FLAG_BOTH,
"sha256sum [-c FILE [-p PREFIX]] "
"[FILE1 [FILE2 ...]]",
N_("[-c FILE [-p PREFIX]] "
"[FILE1 [FILE2 ...]]"),
"Compute or check hash checksum.",
options);
cmd_sha512 = grub_register_extcmd ("sha512sum", grub_cmd_hashsum,
GRUB_COMMAND_FLAG_BOTH,
"sha512sum [-c FILE [-p PREFIX]] "
"[FILE1 [FILE2 ...]]",
"Compute or check hash checksum.",
N_("[-c FILE [-p PREFIX]] "
"[FILE1 [FILE2 ...]]"),
N_("Compute or check hash checksum."),
options);
}

View file

@ -105,7 +105,7 @@ grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc,
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),
grub_printf ("%s %s %s\n%s\n", _("Usage:"), cmd->name, _(cmd->summary),
_(cmd->description));
}
}

View file

@ -402,11 +402,10 @@ GRUB_MOD_INIT (drivemap)
grub_get_root_biosnumber_saved = grub_get_root_biosnumber;
grub_get_root_biosnumber = grub_get_root_biosnumber_drivemap;
cmd = grub_register_extcmd ("drivemap", grub_cmd_drivemap,
GRUB_COMMAND_FLAG_BOTH,
"drivemap"
N_("-l | -r | [-s] grubdev osdisk."),
N_("Manage the BIOS drive mappings."),
options);
GRUB_COMMAND_FLAG_BOTH,
N_("-l | -r | [-s] grubdev osdisk."),
N_("Manage the BIOS drive mappings."),
options);
drivemap_hook =
grub_loader_register_preboot_hook (&install_int13_handler,
&uninstall_int13_handler,

View file

@ -177,16 +177,20 @@ static grub_err_t
grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
int argc, char **args)
{
grub_file_t file;
if (argc < 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name or tempo and notes required");
file = grub_file_open (args[0]);
if (file)
if (argc == 1)
{
struct note buf;
grub_uint32_t tempo;
grub_file_t file;
file = grub_file_open (args[0]);
if (! file)
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file not found");
if (grub_file_read (file, &tempo, sizeof (tempo)) != sizeof (tempo))
{

150
commands/iorw.c Normal file
View file

@ -0,0 +1,150 @@
/* memrw.c - command to read / write physical memory */
/*
* 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/misc.h>
#include <grub/extcmd.h>
#include <grub/env.h>
#include <grub/cpu/io.h>
#include <grub/i18n.h>
static grub_extcmd_t cmd_read_byte, cmd_read_word, cmd_read_dword;
static grub_command_t cmd_write_byte, cmd_write_word, cmd_write_dword;
static const struct grub_arg_option options[] =
{
{0, 'v', 0, N_("Save read value into variable VARNAME."),
N_("VARNAME"), ARG_TYPE_STRING},
{0, 0, 0, 0, 0, 0}
};
static grub_err_t
grub_cmd_read (grub_extcmd_t cmd, int argc, char **argv)
{
grub_target_addr_t addr;
grub_uint32_t value = 0;
char buf[sizeof ("XXXXXXXX")];
if (argc != 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid number of arguments");
addr = grub_strtoul (argv[0], 0, 0);
switch (cmd->cmd->name[sizeof ("in") - 1])
{
case 'l':
value = grub_inl (addr);
break;
case 'w':
value = grub_inw (addr);
break;
case 'b':
value = grub_inb (addr);
break;
}
if (cmd->state[0].set)
{
grub_snprintf (buf, sizeof (buf), "%x", value);
grub_env_set (cmd->state[0].arg, buf);
}
else
grub_printf ("0x%x\n", value);
return 0;
}
static grub_err_t
grub_cmd_write (grub_command_t cmd, int argc, char **argv)
{
grub_target_addr_t addr;
grub_uint32_t value;
grub_uint32_t mask = 0xffffffff;
if (argc != 2 && argc != 3)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid number of arguments");
addr = grub_strtoul (argv[0], 0, 0);
value = grub_strtoul (argv[1], 0, 0);
if (argc == 3)
mask = grub_strtoul (argv[2], 0, 0);
value &= mask;
switch (cmd->name[sizeof ("out") - 1])
{
case 'l':
if (mask != 0xffffffff)
grub_outl ((grub_inl (addr) & ~mask) | value, addr);
else
grub_outl (value, addr);
break;
case 'w':
if ((mask & 0xffff) != 0xffff)
grub_outw ((grub_inw (addr) & ~mask) | value, addr);
else
grub_outw (value, addr);
break;
case 'b':
if ((mask & 0xff) != 0xff)
grub_outb ((grub_inb (addr) & ~mask) | value, addr);
else
grub_outb (value, addr);
break;
}
return 0;
}
GRUB_MOD_INIT(memrw)
{
cmd_read_byte =
grub_register_extcmd ("inb", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
N_("PORT"), N_("Read byte from PORT."), options);
cmd_read_word =
grub_register_extcmd ("inw", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
N_("PORT"), N_("Read word from PORT."), options);
cmd_read_dword =
grub_register_extcmd ("inl", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
N_("PORT"), N_("Read dword from PORT."), options);
cmd_write_byte =
grub_register_command ("outb", grub_cmd_write,
N_("PORT VALUE [MASK]"),
N_("Write byte VALUE to PORT."));
cmd_write_word =
grub_register_command ("outw", grub_cmd_write,
N_("PORT VALUE [MASK]"),
N_("Write word VALUE to PORT."));
cmd_write_dword =
grub_register_command ("outl", grub_cmd_write,
N_("ADDR VALUE [MASK]"),
N_("Write dword VALUE to PORT."));
}
GRUB_MOD_FINI(memrw)
{
grub_unregister_extcmd (cmd_read_byte);
grub_unregister_extcmd (cmd_read_word);
grub_unregister_extcmd (cmd_read_dword);
grub_unregister_command (cmd_write_byte);
grub_unregister_command (cmd_write_word);
grub_unregister_command (cmd_write_dword);
}

View file

@ -175,7 +175,7 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)),
}
/* Load modules. */
#if GRUB_NO_MODULES
#if !GRUB_NO_MODULES
{
const char *prefix;
prefix = grub_env_get ("prefix");

View file

@ -24,6 +24,7 @@
#include <grub/env.h>
#include <grub/normal.h>
#include <grub/dl.h>
#include <grub/i18n.h>
static grub_dl_t my_mod;
@ -186,8 +187,8 @@ GRUB_MOD_INIT(password_pbkdf2)
{
my_mod = mod;
cmd = grub_register_command ("password_pbkdf2", grub_cmd_password,
"password_pbkdf2 USER PBKDF2_PASSWORD",
"Set user password (PBKDF2). ");
N_("USER PBKDF2_PASSWORD"),
N_("Set user password (PBKDF2). "));
}
GRUB_MOD_FINI(password_pbkdf2)

View file

@ -21,6 +21,7 @@
#include <grub/misc.h>
#include <grub/mm.h>
#include <grub/command.h>
#include <grub/i18n.h>
#include <regex.h>
static grub_err_t
@ -69,8 +70,8 @@ static grub_command_t cmd;
GRUB_MOD_INIT(regexp)
{
cmd = grub_register_command ("regexp", grub_cmd_regexp,
"REGEXP STRING",
"Test if REGEXP matches STRING.");
N_("REGEXP STRING"),
N_("Test if REGEXP matches STRING."));
}
GRUB_MOD_FINI(regexp)

View file

@ -23,6 +23,7 @@
#include <grub/extcmd.h>
#include <grub/env.h>
#include <grub/mm.h>
#include <grub/i18n.h>
struct pci_register
{
@ -329,9 +330,9 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(setpci)
{
cmd = grub_register_extcmd ("setpci", grub_cmd_setpci, GRUB_COMMAND_FLAG_BOTH,
"setpci [-s POSITION] [-d DEVICE] [-v VAR] "
"[REGISTER][=VALUE[:MASK]]",
"Manipulate PCI devices.", options);
N_("[-s POSITION] [-d DEVICE] [-v VAR] "
"[REGISTER][=VALUE[:MASK]]"),
N_("Manipulate PCI devices."), options);
}
GRUB_MOD_FINI(setpci)

View file

@ -26,37 +26,48 @@
struct grub_term_autoload *grub_term_input_autoload = NULL;
struct grub_term_autoload *grub_term_output_autoload = NULL;
struct abstract_terminal
{
struct abstract_terminal *next;
const char *name;
grub_err_t (*init) (void);
grub_err_t (*fini) (void);
};
static grub_err_t
grub_cmd_terminal_input (grub_command_t cmd __attribute__ ((unused)),
int argc, char **args)
handle_command (int argc, char **args, struct abstract_terminal **enabled,
struct abstract_terminal **disabled,
struct grub_term_autoload *autoloads,
const char *active_str,
const char *available_str)
{
int i;
grub_term_input_t term;
struct abstract_terminal *term;
struct grub_term_autoload *aut;
if (argc == 0)
{
grub_puts_ (N_ ("Active input terminals:"));
FOR_ACTIVE_TERM_INPUTS(term)
grub_printf ("%s ", term->name);
grub_puts_ (active_str);
for (term = *enabled; term; term = term->next)
grub_printf ("%s ", term->name);
grub_printf ("\n");
grub_puts_ (N_ ("Available input terminals:"));
FOR_DISABLED_TERM_INPUTS(term)
grub_printf ("%s ", term->name);
grub_puts_ (available_str);
for (term = *disabled; term; term = term->next)
grub_printf ("%s ", term->name);
/* This is quadratic but we don't expect mode than 30 terminal
modules ever. */
for (aut = grub_term_input_autoload; aut; aut = aut->next)
{
FOR_DISABLED_TERM_INPUTS(term)
if (grub_strcmp (term->name, aut->name) == 0)
break;
if (!term)
FOR_ACTIVE_TERM_INPUTS(term)
if (grub_strcmp (term->name, aut->name) == 0)
break;
if (!term)
grub_printf ("%s ", aut->name);
}
modules ever. */
for (aut = autoloads; aut; aut = aut->next)
{
for (term = *disabled; term; term = term->next)
if (grub_strcmp (term->name, aut->name) == 0)
break;
if (!term)
for (term = *enabled; term; term = term->next)
if (grub_strcmp (term->name, aut->name) == 0)
break;
if (!term)
grub_printf ("%s ", aut->name);
}
grub_printf ("\n");
return GRUB_ERR_NONE;
}
@ -73,112 +84,108 @@ grub_cmd_terminal_input (grub_command_t cmd __attribute__ ((unused)),
{
int again = 0;
while (1)
{
FOR_DISABLED_TERM_INPUTS(term)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term == 0)
FOR_ACTIVE_TERM_INPUTS(term)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term)
break;
if (again)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
args[i]);
for (aut = grub_term_input_autoload; aut; aut = aut->next)
if (grub_strcmp (args[i], aut->name) == 0)
{
grub_dl_t mod;
mod = grub_dl_load (aut->modname);
if (mod)
grub_dl_ref (mod);
grub_errno = GRUB_ERR_NONE;
break;
}
if (!aut)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
args[i]);
again = 1;
}
{
for (term = *disabled; term; term = term->next)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term == 0)
for (term = *enabled; term; term = term->next)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term)
break;
if (again)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
args[i]);
for (aut = autoloads; aut; aut = aut->next)
if (grub_strcmp (args[i], aut->name) == 0)
{
grub_dl_t mod;
mod = grub_dl_load (aut->modname);
if (mod)
grub_dl_ref (mod);
grub_errno = GRUB_ERR_NONE;
break;
}
if (!aut)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
args[i]);
again = 1;
}
}
if (grub_strcmp (args[0], "--append") == 0)
{
for (i = 1; i < argc; i++)
{
FOR_DISABLED_TERM_INPUTS(term)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term)
{
{
for (term = *disabled; term; term = term->next)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term)
{
if (term->init && term->init () != GRUB_ERR_NONE)
return grub_errno;
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs_disabled)),
GRUB_AS_LIST (term));
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs),
GRUB_AS_LIST (term));
}
}
grub_list_remove (GRUB_AS_LIST_P (disabled), GRUB_AS_LIST (term));
grub_list_push (GRUB_AS_LIST_P (enabled), GRUB_AS_LIST (term));
}
}
return GRUB_ERR_NONE;
}
if (grub_strcmp (args[0], "--remove") == 0)
{
for (i = 1; i < argc; i++)
{
FOR_ACTIVE_TERM_INPUTS(term)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term)
{
if (!term->next && term == grub_term_inputs)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"can't remove the last terminal");
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs)),
GRUB_AS_LIST (term));
if (term->fini)
term->fini ();
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs_disabled),
GRUB_AS_LIST (term));
}
}
{
for (term = *enabled; term; term = term->next)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term)
{
if (!term->next && term == *enabled)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"can't remove the last terminal");
grub_list_remove (GRUB_AS_LIST_P (enabled), GRUB_AS_LIST (term));
if (term->fini)
term->fini ();
grub_list_push (GRUB_AS_LIST_P (disabled), GRUB_AS_LIST (term));
}
}
return GRUB_ERR_NONE;
}
for (i = 0; i < argc; i++)
{
FOR_DISABLED_TERM_INPUTS(term)
if (grub_strcmp (args[i], term->name) == 0)
break;
for (term = *disabled; term; term = term->next)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term)
{
if (term->init && term->init () != GRUB_ERR_NONE)
return grub_errno;
{
if (term->init && term->init () != GRUB_ERR_NONE)
return grub_errno;
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs_disabled)),
GRUB_AS_LIST (term));
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs),
GRUB_AS_LIST (term));
}
grub_list_remove (GRUB_AS_LIST_P (disabled), GRUB_AS_LIST (term));
grub_list_push (GRUB_AS_LIST_P (enabled), GRUB_AS_LIST (term));
}
}
FOR_ACTIVE_TERM_INPUTS(term)
{
for (i = 0; i < argc; i++)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (i == argc)
struct abstract_terminal *next;
for (term = *enabled; term; term = next)
{
if (!term->next && term == grub_term_inputs)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"can't remove the last terminal");
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs)),
GRUB_AS_LIST (term));
if (term->fini)
term->fini ();
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs_disabled),
GRUB_AS_LIST (term));
next = term->next;
for (i = 0; i < argc; i++)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (i == argc)
{
if (!term->next && term == *enabled)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"can't remove the last terminal");
grub_list_remove (GRUB_AS_LIST_P (enabled), GRUB_AS_LIST (term));
if (term->fini)
term->fini ();
grub_list_push (GRUB_AS_LIST_P (disabled), GRUB_AS_LIST (term));
}
}
}
@ -186,163 +193,34 @@ grub_cmd_terminal_input (grub_command_t cmd __attribute__ ((unused)),
}
static grub_err_t
grub_cmd_terminal_output (grub_command_t cmd __attribute__ ((unused)),
grub_cmd_terminal_input (grub_command_t cmd __attribute__ ((unused)),
int argc, char **args)
{
int i;
grub_term_output_t term;
struct grub_term_autoload *aut;
(void) GRUB_FIELD_MATCH (grub_term_inputs, struct abstract_terminal *, next);
(void) GRUB_FIELD_MATCH (grub_term_inputs, struct abstract_terminal *, name);
(void) GRUB_FIELD_MATCH (grub_term_inputs, struct abstract_terminal *, init);
(void) GRUB_FIELD_MATCH (grub_term_inputs, struct abstract_terminal *, fini);
return handle_command (argc, args,
(struct abstract_terminal **) &grub_term_inputs,
(struct abstract_terminal **) &grub_term_inputs_disabled,
grub_term_input_autoload,
N_ ("Active input terminals:"),
N_ ("Available input terminals:"));
}
if (argc == 0)
{
grub_puts_ (N_ ("Active output terminals:"));
FOR_ACTIVE_TERM_OUTPUTS(term)
grub_printf ("%s ", term->name);
grub_printf ("\n");
grub_puts_ (N_ ("Available output terminals:"));
FOR_DISABLED_TERM_OUTPUTS(term)
grub_printf ("%s ", term->name);
/* This is quadratic but we don't expect mode than 30 terminal
modules ever. */
for (aut = grub_term_output_autoload; aut; aut = aut->next)
{
FOR_DISABLED_TERM_OUTPUTS(term)
if (grub_strcmp (term->name, aut->name) == 0)
break;
if (!term)
FOR_ACTIVE_TERM_OUTPUTS(term)
if (grub_strcmp (term->name, aut->name) == 0)
break;
if (!term)
grub_printf ("%s ", aut->name);
}
grub_printf ("\n");
return GRUB_ERR_NONE;
}
i = 0;
if (grub_strcmp (args[0], "--append") == 0
|| grub_strcmp (args[0], "--remove") == 0)
i++;
if (i == argc)
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_ ("no terminal specified"));
for (; i < argc; i++)
{
int again = 0;
while (1)
{
FOR_DISABLED_TERM_OUTPUTS(term)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term == 0)
FOR_ACTIVE_TERM_OUTPUTS(term)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term)
break;
if (again)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
args[i]);
for (aut = grub_term_output_autoload; aut; aut = aut->next)
if (grub_strcmp (args[i], aut->name) == 0)
{
grub_dl_t mod;
mod = grub_dl_load (aut->modname);
if (mod)
grub_dl_ref (mod);
grub_errno = GRUB_ERR_NONE;
break;
}
if (!aut)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
args[i]);
again = 1;
}
}
if (grub_strcmp (args[0], "--append") == 0)
{
for (i = 1; i < argc; i++)
{
FOR_DISABLED_TERM_OUTPUTS(term)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term)
{
if (term->init && term->init () != GRUB_ERR_NONE)
return grub_errno;
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs_disabled)),
GRUB_AS_LIST (term));
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs),
GRUB_AS_LIST (term));
}
}
return GRUB_ERR_NONE;
}
if (grub_strcmp (args[0], "--remove") == 0)
{
for (i = 1; i < argc; i++)
{
FOR_ACTIVE_TERM_OUTPUTS(term)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term)
{
if (!term->next && term == grub_term_outputs)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"can't remove the last terminal");
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs)),
GRUB_AS_LIST (term));
if (term->fini)
term->fini ();
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs_disabled),
GRUB_AS_LIST (term));
}
}
return GRUB_ERR_NONE;
}
for (i = 0; i < argc; i++)
{
FOR_DISABLED_TERM_OUTPUTS(term)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term)
{
if (term->init && term->init () != GRUB_ERR_NONE)
return grub_errno;
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs_disabled)),
GRUB_AS_LIST (term));
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs),
GRUB_AS_LIST (term));
}
}
FOR_ACTIVE_TERM_OUTPUTS(term)
{
for (i = 0; i < argc; i++)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (i == argc)
{
if (!term->next && term == grub_term_outputs)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"can't remove the last terminal");
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs)),
GRUB_AS_LIST (term));
if (term->fini)
term->fini ();
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs_disabled),
GRUB_AS_LIST (term));
}
}
return GRUB_ERR_NONE;
static grub_err_t
grub_cmd_terminal_output (grub_command_t cmd __attribute__ ((unused)),
int argc, char **args)
{
(void) GRUB_FIELD_MATCH (grub_term_outputs, struct abstract_terminal *, next);
(void) GRUB_FIELD_MATCH (grub_term_outputs, struct abstract_terminal *, name);
(void) GRUB_FIELD_MATCH (grub_term_outputs, struct abstract_terminal *, init);
(void) GRUB_FIELD_MATCH (grub_term_outputs, struct abstract_terminal *, fini);
return handle_command (argc, args, (struct abstract_terminal **) &grub_term_outputs,
(struct abstract_terminal **) &grub_term_outputs_disabled,
grub_term_output_autoload,
N_ ("Active output terminals:"),
N_ ("Available output terminals:"));
}
static grub_command_t cmd_terminal_input, cmd_terminal_output;
@ -351,14 +229,14 @@ GRUB_MOD_INIT(terminal)
{
cmd_terminal_input =
grub_register_command ("terminal_input", grub_cmd_terminal_input,
"[--append|--remove] "
"[TERMINAL1] [TERMINAL2] ...",
"List or select an input terminal.");
N_("[--append|--remove] "
"[TERMINAL1] [TERMINAL2] ..."),
N_("List or select an input terminal."));
cmd_terminal_output =
grub_register_command ("terminal_output", grub_cmd_terminal_output,
"[--append|--remove] "
"[TERMINAL1] [TERMINAL2] ...",
"List or select an output terminal.");
N_("[--append|--remove] "
"[TERMINAL1] [TERMINAL2] ..."),
N_("List or select an output terminal."));
}
GRUB_MOD_FINI(terminal)

View file

@ -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 \
@ -11,15 +9,26 @@ kernel_img_SOURCES = kern/device.c kern/disk.c kern/dl.c kern/env.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/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 \
\
grub_emu_init.c gnulib/progname.c util/hostfs.c disk/host.c
\
util/console.c util/grub-emu.c util/misc.c \
util/hostdisk.c util/getroot.c util/mm.c util/time.c \
\
gnulib/progname.c util/hostfs.c disk/host.c
kernel_img_HEADERS += datetime.h util/misc.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)
@ -76,6 +88,7 @@ pkglib_MODULES += pci.mod
pci_mod_SOURCES = util/pci.c commands/lspci.c
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
grub_emu_LDFLAGS += $(LIBPCIACCESS)
kernel_img_HEADERS += libpciaccess.h
endif
include $(srcdir)/conf/common.mk
@ -84,12 +97,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

View file

@ -25,15 +25,15 @@ 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 \
\
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/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
fs/befs.c fs/befs_be.c fs/tar.c \
fs/nilfs2.c fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c \
fs/sfs.c fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c \
fs/afs_be.c fs/befs.c fs/befs_be.c fs/tar.c \
\
partmap/msdos.c partmap/bsdlabel.c partmap/apple.c \
partmap/sun.c partmap/sunpc.c partmap/gpt.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 \
@ -69,7 +69,7 @@ grub_fstest_SOURCES = gnulib/progname.c util/grub-fstest.c util/hostfs.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/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
fs/nilfs2.c fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c fs/befs.c \
fs/befs_be.c fs/tar.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,8 +116,11 @@ 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
list.h handler.h command.h i18n.h env_private.h libgcc.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
@ -295,6 +298,12 @@ minix_mod_SOURCES = fs/minix.c
minix_mod_CFLAGS = $(COMMON_CFLAGS)
minix_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For nilfs2.mod.
pkglib_MODULES += nilfs2.mod
nilfs2_mod_SOURCES = fs/nilfs2.c
nilfs2_mod_CFLAGS = $(COMMON_CFLAGS)
nilfs2_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For hfs.mod.
hfs_mod_SOURCES = fs/hfs.c
hfs_mod_CFLAGS = $(COMMON_CFLAGS)
@ -659,7 +668,7 @@ 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
sh_mod_CFLAGS = $(COMMON_CFLAGS) $(POSIX_CFLAGS)
sh_mod_CFLAGS = $(COMMON_CFLAGS) $(POSIX_CFLAGS) -Wno-error
sh_mod_LDFLAGS = $(COMMON_LDFLAGS)
ifneq (, $(FONT_SOURCE))
@ -852,7 +861,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

View file

@ -10,7 +10,7 @@ pkglib_PROGRAMS += kernel.img
kernel_img_SOURCES = kern/i386/coreboot/startup.S \
kern/i386/misc.S \
kern/i386/coreboot/init.c \
kern/i386/multiboot_mmap.c \
kern/i386/coreboot/mmap.c \
kern/i386/halt.c \
kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
@ -26,7 +26,7 @@ kernel_img_SOURCES = kern/i386/coreboot/startup.S \
symlist.c
kernel_img_CFLAGS = $(COMMON_CFLAGS)
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,$(GRUB_KERNEL_MACHINE_LINK_ADDR),-Bstatic
kernel_img_LDFLAGS += $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,$(GRUB_KERNEL_MACHINE_LINK_ADDR),-Bstatic
sbin_SCRIPTS += grub-install
grub_install_SOURCES = util/grub-install.in

View file

@ -27,7 +27,7 @@ kernel_img_SOURCES = kern/i386/ieee1275/startup.S \
kernel_img_HEADERS += ieee1275/ieee1275.h
kernel_img_CFLAGS = $(COMMON_CFLAGS)
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,0x10000,-Bstatic
kernel_img_LDFLAGS += $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,0x10000,-Bstatic
# Scripts.
sbin_SCRIPTS = grub-install

74
conf/i386-multiboot.rmk Normal file
View file

@ -0,0 +1,74 @@
# -*- makefile -*-
COMMON_CFLAGS = -mrtd -mregparm=3
# Images.
GRUB_KERNEL_MACHINE_LINK_ADDR = 0x8200
pkglib_PROGRAMS += kernel.img
kernel_img_SOURCES = kern/i386/coreboot/startup.S \
kern/i386/misc.S \
kern/i386/coreboot/init.c \
kern/i386/multiboot_mmap.c \
kern/i386/halt.c \
kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
kern/misc.c kern/mm.c kern/term.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/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
kern/i386/tsc.c kern/i386/pit.c \
kern/generic/rtc_get_time_ms.c \
kern/generic/millisleep.c \
kern/env.c \
term/i386/pc/vga_text.c term/i386/vga_common.c \
symlist.c
kernel_img_CFLAGS = $(COMMON_CFLAGS)
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
kernel_img_LDFLAGS += $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,$(GRUB_KERNEL_MACHINE_LINK_ADDR),-Bstatic
sbin_SCRIPTS += grub-install
grub_install_SOURCES = util/grub-install.in
bin_SCRIPTS += grub-mkrescue
grub_mkrescue_SOURCES = util/grub-mkrescue.in
# Modules.
pkglib_MODULES = linux.mod aout.mod halt.mod datetime.mod mmap.mod
# For mmap.mod.
mmap_mod_SOURCES = mmap/mmap.c mmap/i386/uppermem.c mmap/i386/mmap.c
mmap_mod_CFLAGS = $(COMMON_CFLAGS)
mmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
mmap_mod_ASFLAGS = $(COMMON_ASFLAGS)
# For linux.mod.
linux_mod_SOURCES = loader/i386/linux.c
linux_mod_CFLAGS = $(COMMON_CFLAGS)
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For halt.mod.
halt_mod_SOURCES = commands/halt.c
halt_mod_CFLAGS = $(COMMON_CFLAGS)
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For aout.mod.
aout_mod_SOURCES = loader/aout.c
aout_mod_CFLAGS = $(COMMON_CFLAGS)
aout_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For bsd.mod
pkglib_MODULES += bsd.mod
bsd_mod_SOURCES = loader/i386/bsd.c loader/i386/bsd32.c loader/i386/bsd64.c loader/i386/bsd_helper.S loader/i386/bsd_trampoline.S
bsd_mod_CFLAGS = $(COMMON_CFLAGS)
bsd_mod_LDFLAGS = $(COMMON_LDFLAGS)
bsd_mod_ASFLAGS = $(COMMON_ASFLAGS)
# For datetime.mod
datetime_mod_SOURCES = lib/cmos_datetime.c
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
include $(srcdir)/conf/i386.mk
include $(srcdir)/conf/common.mk

View file

@ -58,7 +58,7 @@ kernel_img_HEADERS += machine/biosdisk.h machine/vga.h machine/vbe.h \
machine/pxe.h i386/pit.h
kernel_img_CFLAGS = $(COMMON_CFLAGS) $(TARGET_IMG_CFLAGS)
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR) $(COMMON_CFLAGS)
kernel_img_LDFLAGS += $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR) $(COMMON_CFLAGS)
kernel_img_FORMAT = binary
# Utilities.
@ -82,15 +82,15 @@ grub_setup_SOURCES = gnulib/progname.c \
\
fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
fs/befs.c fs/befs_be.c fs/tar.c \
fs/nilfs2.c fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c \
fs/sfs.c fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c \
fs/afs_be.c fs/befs.c fs/befs_be.c fs/tar.c \
\
partmap/msdos.c partmap/bsdlabel.c partmap/sunpc.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

View file

@ -39,7 +39,7 @@ kernel_img_SOURCES = kern/i386/qemu/startup.S \
symlist.c
kernel_img_CFLAGS = $(COMMON_CFLAGS) -DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)
kernel_img_ASFLAGS = $(COMMON_ASFLAGS) -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR)
kernel_img_LDFLAGS += $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR)
kernel_img_FORMAT = binary
sbin_SCRIPTS += grub-install

View file

@ -68,3 +68,8 @@ play_mod_SOURCES = commands/i386/pc/play.c
play_mod_CFLAGS = $(COMMON_CFLAGS)
play_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For iorw.mod.
pkglib_MODULES += iorw.mod
iorw_mod_SOURCES = commands/iorw.c
iorw_mod_CFLAGS = $(COMMON_CFLAGS)
iorw_mod_LDFLAGS = $(COMMON_LDFLAGS)

View file

@ -18,6 +18,5 @@ kernel_img_SOURCES = kern/$(target_cpu)/startup.S \
symlist.c kern/$(target_cpu)/cache.S
kernel_img_CFLAGS = $(COMMON_CFLAGS)
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -static-libgcc -lgcc \
-Wl,-N,-S,-Ttext,$(LINK_BASE),-Bstatic
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,$(LINK_BASE),-Bstatic
kernel_img_FORMAT = binary

View file

@ -29,8 +29,7 @@ kernel_img_SOURCES = kern/$(target_cpu)/startup.S \
symlist.c
kernel_img_CFLAGS = $(COMMON_CFLAGS) -DUSE_ASCII_FAILBACK
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -static-libgcc -lgcc \
-Wl,-N,-S,-Ttext,$(LINK_BASE),-Bstatic
kernel_img_LDFLAGS += $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,$(LINK_BASE),-Bstatic
kernel_img_FORMAT = binary
# For ata.mod.

View file

@ -4,7 +4,7 @@
COMMON_CFLAGS += -mexplicit-relocs -mflush-func=grub_cpu_flush_cache
# Images.
kernel_img_HEADERS += cpu/libgcc.h cpu/cache.h
kernel_img_HEADERS += cpu/cache.h
# Scripts.
sbin_SCRIPTS =

View file

@ -3,7 +3,7 @@
# Images.
kernel_img_HEADERS += cpu/libgcc.h ieee1275/ieee1275.h
kernel_img_HEADERS += ieee1275/ieee1275.h
# Programs
pkglib_PROGRAMS = kernel.img
@ -23,8 +23,7 @@ kernel_img_SOURCES = kern/powerpc/ieee1275/startup.S kern/ieee1275/cmain.c \
symlist.c kern/$(target_cpu)/cache.S
kernel_img_CFLAGS = $(COMMON_CFLAGS)
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -static-libgcc -lgcc \
-Wl,-N,-S,-Ttext,0x200000,-Bstatic
kernel_img_LDFLAGS += $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,0x200000,-Bstatic
# Scripts.
sbin_SCRIPTS = grub-install

View file

@ -19,7 +19,7 @@ diskboot_img_ASFLAGS = $(COMMON_ASFLAGS)
diskboot_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-Ttext,0x4200
diskboot_img_FORMAT = binary
kernel_img_HEADERS += cpu/libgcc.h ieee1275/ieee1275.h cpu/ieee1275/ieee1275.h
kernel_img_HEADERS += ieee1275/ieee1275.h cpu/ieee1275/ieee1275.h
kernel_img_SOURCES = kern/sparc64/ieee1275/crt0.S kern/ieee1275/cmain.c \
kern/ieee1275/ieee1275.c kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
@ -36,7 +36,7 @@ kernel_img_SOURCES = kern/sparc64/ieee1275/crt0.S kern/ieee1275/cmain.c \
symlist.c kern/$(target_cpu)/cache.S
kernel_img_CFLAGS = $(COMMON_CFLAGS)
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
kernel_img_LDFLAGS = -nostdlib -Wl,-N,-Ttext,0x4400,-Bstatic,-melf64_sparc -static-libgcc -lgcc
kernel_img_LDFLAGS += -nostdlib -Wl,-N,-Ttext,0x4400,-Bstatic,-melf64_sparc
kernel_img_FORMAT = binary
# Utilities.
@ -50,6 +50,7 @@ grub_mkimage_SOURCES = util/grub-mkrawimage.c util/misc.c \
# For grub-setup.
util/sparc64/ieee1275/grub-setup.c_DEPENDENCIES = grub_setup_init.h
grub_setup_SOURCES = util/sparc64/ieee1275/grub-setup.c util/hostdisk.c \
util/ieee1275/ofpath.c \
util/misc.c util/getroot.c kern/device.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 \
@ -57,19 +58,19 @@ grub_setup_SOURCES = util/sparc64/ieee1275/grub-setup.c util/hostdisk.c \
\
fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
fs/befs.c fs/befs_be.c fs/tar.c \
fs/nilfs2.c fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c \
fs/sfs.c fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c \
fs/afs_be.c fs/befs.c fs/befs_be.c fs/tar.c \
\
partmap/amiga.c partmap/apple.c partmap/msdos.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.
grub_ofpathname_SOURCES = util/sparc64/ieee1275/grub-ofpathname.c \
grub_ofpathname_SOURCES = util/ieee1275/grub-ofpathname.c \
util/ieee1275/ofpath.c util/misc.c gnulib/progname.c
# Scripts.

View file

@ -65,6 +65,12 @@ grub_script_blanklines_SOURCES = tests/grub_script_blanklines.in
check_SCRIPTS += grub_script_final_semicolon
grub_script_final_semicolon_SOURCES = tests/grub_script_final_semicolon.in
check_SCRIPTS += grub_script_dollar
grub_script_dollar_SOURCES = tests/grub_script_dollar.in
check_SCRIPTS += grub_script_comments
grub_script_comments_SOURCES = tests/grub_script_comments.in
# List of tests to execute on "make check"
# SCRIPTED_TESTS = example_scripted_test
# SCRIPTED_TESTS += example_grub_script_test
@ -79,7 +85,8 @@ SCRIPTED_TESTS += grub_script_while1
SCRIPTED_TESTS += grub_script_if
SCRIPTED_TESTS += grub_script_blanklines
SCRIPTED_TESTS += grub_script_final_semicolon
SCRIPTED_TESTS += grub_script_dollar
SCRIPTED_TESTS += grub_script_comments
# dependencies between tests and testing-tools
$(SCRIPTED_TESTS): grub-shell grub-shell-tester

View file

@ -40,7 +40,7 @@ endif
kernel_img_HEADERS += efi/efi.h efi/time.h efi/disk.h i386/pit.h
kernel_img_CFLAGS = $(COMMON_CFLAGS)
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
kernel_img_LDFLAGS = $(COMMON_LDFLAGS)
kernel_img_LDFLAGS += $(COMMON_LDFLAGS)
# For acpi.mod.
acpi_mod_SOURCES = commands/acpi.c commands/efi/acpi.c
@ -64,13 +64,17 @@ appleldr_mod_CFLAGS = $(COMMON_CFLAGS)
appleldr_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For linux.mod.
linux_mod_SOURCES = loader/i386/efi/linux.c
ifeq ($(target_cpu), x86_64)
linux_mod_SOURCES += loader/i386/linux_trampoline.S
endif
linux_mod_SOURCES = loader/i386/efi/linux.c loader/i386/linux_trampoline.S
linux_mod_CFLAGS = $(COMMON_CFLAGS)
linux_mod_ASFLAGS = $(COMMON_ASFLAGS)
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
else
linux_mod_SOURCES = loader/i386/efi/linux.c
linux_mod_CFLAGS = $(COMMON_CFLAGS)
linux_mod_ASFLAGS = $(COMMON_ASFLAGS)
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
endif
# For halt.mod.
halt_mod_SOURCES = commands/halt.c

View file

@ -102,6 +102,7 @@ case "$target_cpu"-"$platform" in
i386-efi) ;;
x86_64-efi) ;;
i386-pc) ;;
i386-multiboot) ;;
i386-coreboot) ;;
i386-linuxbios) platform=coreboot ;;
i386-ieee1275) ;;
@ -130,11 +131,13 @@ case "$host_os" in
gnu*) host_kernel=hurd ;;
linux*) host_kernel=linux ;;
freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;;
netbsd*) host_kernel=netbsd ;;
cygwin) host_kernel=windows ;;
esac
case "$platform" in
coreboot) machine_CFLAGS="-DGRUB_MACHINE_COREBOOT=1" ;;
multiboot) machine_CFLAGS="-DGRUB_MACHINE_MULTIBOOT=1" ;;
efi) machine_CFLAGS="-DGRUB_MACHINE_EFI=1" ;;
ieee1275) machine_CFLAGS="-DGRUB_MACHINE_IEEE1275=1" ;;
qemu) machine_CFLAGS="-DGRUB_MACHINE_QEMU=1" ;;
@ -170,11 +173,6 @@ if test "x$CMP" = x; then
AC_MSG_ERROR([cmp is not found])
fi
AC_CHECK_PROGS([LEX], [flex])
if test "x$LEX" = x; then
AC_MSG_ERROR([flex is not found])
fi
AC_CHECK_PROGS([YACC], [bison])
if test "x$YACC" = x; then
AC_MSG_ERROR([bison is not found])
@ -189,9 +187,21 @@ done
AC_PROG_INSTALL
AC_PROG_AWK
AC_PROG_LEX
AC_PROG_MAKE_SET
AC_PROG_MKDIR_P
if test "x$LEX" = x; then
AC_MSG_ERROR([flex is not found])
else
version=`$LEX --version | $AWK '{ split($NF,x,"."); print x[[1]]*10000+x[[2]]*100+x[[3]]; }'`
if test -n "$version" -a "$version" -ge 20535; then
:
else
AC_MSG_ERROR([flex is too old. GRUB requires 2.5.35 or above])
fi
fi
# These are not a "must".
AC_PATH_PROG(RUBY, ruby)
AC_PATH_PROG(MAKEINFO, makeinfo)
@ -235,6 +245,20 @@ AC_CHECK_FUNCS(memmove sbrk strdup lstat getuid getgid)
AC_CHECK_HEADERS(sys/mkdev.h sys/sysmacros.h malloc.h termios.h sys/types.h)
AC_CHECK_HEADERS(unistd.h string.h strings.h sys/stat.h sys/fcntl.h limits.h)
# For opendisk() and getrawpartition() on NetBSD.
# Used in util/deviceiter.c and in util/hostdisk.c.
AC_CHECK_HEADER([util.h], [
AC_CHECK_LIB([util], [opendisk], [
LIBUTIL="-lutil"
AC_DEFINE(HAVE_OPENDISK, 1, [Define if opendisk() in -lutil can be used])
])
AC_CHECK_LIB([util], [getrawpartition], [
LIBUTIL="-lutil"
AC_DEFINE(HAVE_GETRAWPARTITION, 1, [Define if getrawpartition() in -lutil can be used])
])
])
AC_SUBST([LIBUTIL])
#
# Check for target programs.
#
@ -338,7 +362,7 @@ else
if test -f "${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"; then
TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT} -Wl,-Ttext,"
TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc -Wl,-Ttext,"
else
TARGET_IMG_LDSCRIPT=
TARGET_IMG_LDFLAGS='-Wl,-N -Wl,-Ttext,'
@ -354,7 +378,11 @@ AC_SUBST(TARGET_IMG_CFLAGS)
# For platforms where ELF is not the default link format.
AC_MSG_CHECKING([for command to convert module to ELF format])
case "${host_os}" in
cygwin) TARGET_OBJ2ELF='grub-pe2elf' ;;
cygwin) TARGET_OBJ2ELF='grub-pe2elf';
# FIXME: put proper test here
AC_DEFINE([NEED_REGISTER_FRAME_INFO], 1,
[Define to 1 if GCC generates calls to __register_frame_info()])
;;
*) ;;
esac
AC_SUBST(TARGET_OBJ2ELF)
@ -387,9 +415,7 @@ if test "$target_cpu"-"$platform" = x86_64-efi; then
[grub_cv_cc_mcmodel=no])
])
if test "x$grub_cv_cc_mcmodel" = xno; then
CFLAGS="$SAVED_CFLAGS -m64 -DMCMODEL_SMALL=1"
TARGET_CFLAGS="$TARGET_CFLAGS -DMCMODEL_SMALL=1"
AC_MSG_WARN([-mcmodel=large not supported. You won't be able to use the memory over 4GiB. Upgrade your gcc])
AC_MSG_ERROR([-mcmodel=large not supported. Upgrade your gcc.])
else
TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
fi
@ -457,12 +483,19 @@ CC="$TARGET_CC"
if test "x$TARGET_APPLE_CC" = x1 ; then
CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error"
else
CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100 -Wl,--defsym,abort=main -Wno-error"
CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100 -Wno-error"
fi
CPPFLAGS="$TARGET_CPPFLAGS"
LDFLAGS="$TARGET_LDFLAGS"
LIBS=-lgcc
grub_ASM_USCORE
if test x$grub_cv_asm_uscore = xyes; then
CFLAGS="$CFLAGS -Wl,--defsym,_abort=_main"
else
CFLAGS="$CFLAGS -Wl,--defsym,abort=main"
fi
# Check for libgcc symbols
AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __trampoline_setup __ucmpdi2 _restgpr_14_x)
@ -479,13 +512,12 @@ if test "x$TARGET_APPLE_CC" != x1 ; then
grub_PROG_OBJCOPY_ABSOLUTE
fi
grub_PROG_LD_BUILD_ID_NONE
grub_ASM_USCORE
if test "x$target_cpu" = xi386; then
if test ! -z "$TARGET_IMG_LDSCRIPT"; then
# Check symbols provided by linker script.
CFLAGS="$TARGET_CFLAGS -nostdlib $TARGET_IMG_LDFLAGS_AC -Wl,-Ttext,8000,--defsym,___main=0x8100"
fi
if test "x$TARGET_APPLE_CC" != x1 ; then
if test "$platform" != emu && test "x$TARGET_APPLE_CC" != x1 ; then
if test ! -z "$TARGET_IMG_LDSCRIPT"; then
# Check symbols provided by linker script.
CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC}8000 -Wl,--defsym,___main=0x8100"
fi
grub_CHECK_BSS_START_SYMBOL
grub_CHECK_END_SYMBOL
fi
@ -576,6 +608,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.]
@ -594,6 +630,19 @@ 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 "$TARGET_NO_MODULES" = yes ; then
# Do not convert modules, otherwise linkage may fail (Cygwin only).
# FIXME: Should be checked above before TARGET_OBJ2ELF is set first.
TARGET_OBJ2ELF=
fi
if test x"$enable_grub_emu_usb" = xno ; then
grub_emu_usb_excuse="explicitly disabled"
fi
@ -771,6 +820,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

View file

@ -24,6 +24,10 @@
#include <grub/misc.h>
#include <grub/lvm.h>
#ifdef GRUB_UTIL
#include <grub/util/misc.h>
#endif
static struct grub_lvm_vg *vg_list;
static int lv_count;
@ -68,6 +72,9 @@ grub_lvm_memberlist (grub_disk_t disk)
if (lv->vg->pvs)
for (pv = lv->vg->pvs; pv; pv = pv->next)
{
if (!pv->disk)
grub_util_error ("Couldn't find PV %s. Check your device.map",
pv->name);
tmp = grub_malloc (sizeof (*tmp));
tmp->disk = pv->disk;
tmp->next = list;

View file

@ -1379,7 +1379,8 @@ pitch and duration pairs.
If the arguments are a series of numbers, play the inline tune.
The tempo is the base for all note durations. 60 gives a 1-second base, 120
gives a half-second base, etc. Pitches are Hz.
gives a half-second base, etc. Pitches are Hz. Set pitch to 0 to produce
a rest.
@end deffn

View file

@ -31,6 +31,7 @@
#include <grub/efiemu/efiemu.h>
#include <grub/machine/efiemu.h>
#include <grub/command.h>
#include <grub/i18n.h>
/* System table. Two version depending on mode */
grub_efi_system_table32_t *grub_efiemu_system_table32 = 0;
@ -327,15 +328,15 @@ GRUB_MOD_INIT(efiemu)
{
cmd_loadcore = grub_register_command ("efiemu_loadcore",
grub_cmd_efiemu_load,
"FILE",
"Load and initialize EFI emulator.");
N_("FILE"),
N_("Load and initialize EFI emulator."));
cmd_prepare = grub_register_command ("efiemu_prepare",
grub_cmd_efiemu_prepare,
0,
"Finalize loading of EFI emulator.");
N_("Finalize loading of EFI emulator."));
cmd_unload = grub_register_command ("efiemu_unload", grub_cmd_efiemu_unload,
0,
"Unload EFI emulator.");
N_("Unload EFI emulator."));
}
GRUB_MOD_FINI(efiemu)

View file

@ -21,6 +21,7 @@
#include <grub/dl.h>
#include <grub/misc.h>
#include <grub/command.h>
#include <grub/i18n.h>
static grub_err_t
loadfont_command (grub_command_t cmd __attribute__ ((unused)),
@ -62,11 +63,11 @@ GRUB_MOD_INIT(font)
cmd_loadfont =
grub_register_command ("loadfont", loadfont_command,
"FILE...",
"Specify one or more font files to load.");
N_("FILE..."),
N_("Specify one or more font files to load."));
cmd_lsfonts =
grub_register_command ("lsfonts", lsfonts_command,
0, "List the loaded fonts.");
0, N_("List the loaded fonts."));
}
GRUB_MOD_FINI(font)

1133
fs/nilfs2.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -25,6 +25,7 @@
#include <grub/dl.h>
#include <grub/types.h>
#include <grub/fshelp.h>
#include <grub/charset.h>
#define GRUB_UDF_MAX_PDS 2
#define GRUB_UDF_MAX_PMS 6
@ -745,19 +746,41 @@ grub_udf_iterate_dir (grub_fshelp_node_t dir,
else
{
enum grub_fshelp_filetype type;
char filename[dirent.file_ident_length + 1];
grub_uint8_t raw[dirent.file_ident_length];
grub_uint16_t utf16[dirent.file_ident_length - 1];
grub_uint8_t filename[dirent.file_ident_length * 2];
grub_size_t utf16len = 0;
type = ((dirent.characteristics & GRUB_UDF_FID_CHAR_DIRECTORY) ?
(GRUB_FSHELP_DIR) : (GRUB_FSHELP_REG));
if ((grub_udf_read_file (dir, 0, offset,
dirent.file_ident_length, filename))
dirent.file_ident_length,
(char *) raw))
!= dirent.file_ident_length)
return 0;
filename[dirent.file_ident_length] = 0;
if (hook (&filename[1], type, child))
return 1;
if (raw[0] == 8)
{
unsigned i;
utf16len = dirent.file_ident_length - 1;
for (i = 0; i < utf16len; i++)
utf16[i] = raw[i + 1];
}
if (raw[0] == 16)
{
unsigned i;
utf16len = (dirent.file_ident_length - 1) / 2;
for (i = 0; i < utf16len; i++)
utf16[i] = (raw[2 * i + 1] << 8) | raw[2*i + 2];
}
if (raw[0] == 8 || raw[0] == 16)
{
*grub_utf16_to_utf8 (filename, utf16, utf16len) = '\0';
if (hook ((char *) filename, type, child))
return 1;
}
}
/* Align to dword boundary. */

View file

@ -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()}

View file

@ -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

View file

@ -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);

View file

@ -44,8 +44,9 @@ typedef struct grub_linuxbios_table_header *grub_linuxbios_table_header_t;
struct grub_linuxbios_table_item
{
#define GRUB_LINUXBIOS_MEMBER_UNUSED 0
#define GRUB_LINUXBIOS_MEMBER_MEMORY 1
#define GRUB_LINUXBIOS_MEMBER_UNUSED 0x00
#define GRUB_LINUXBIOS_MEMBER_MEMORY 0x01
#define GRUB_LINUXBIOS_MEMBER_LINK 0x11
grub_uint32_t tag;
grub_uint32_t size;
};

View file

@ -0,0 +1 @@
#include <grub/i386/coreboot/boot.h>

View file

@ -0,0 +1 @@
#include <grub/i386/coreboot/console.h>

View file

@ -0,0 +1 @@
#include <grub/i386/coreboot/init.h>

View file

@ -0,0 +1 @@
#include <grub/i386/coreboot/kernel.h>

View file

@ -0,0 +1 @@
#include <grub/i386/coreboot/loader.h>

View file

@ -0,0 +1 @@
#include <grub/i386/coreboot/memory.h>

View file

@ -0,0 +1 @@
#include <grub/i386/coreboot/serial.h>

View file

@ -0,0 +1 @@
#include <grub/i386/coreboot/time.h>

View file

@ -18,21 +18,31 @@
#include <config.h>
#ifdef HAVE___ASHLDI3
/* On x86 these functions aren't really needed. Save some space. */
#if !defined (__i386__) && !defined (__x86_64__)
# ifdef HAVE___ASHLDI3
void EXPORT_FUNC (__ashldi3) (void);
#endif
#ifdef HAVE___ASHRDI3
# endif
# ifdef HAVE___ASHRDI3
void EXPORT_FUNC (__ashrdi3) (void);
#endif
#ifdef HAVE___LSHRDI3
# endif
# ifdef HAVE___LSHRDI3
void EXPORT_FUNC (__lshrdi3) (void);
# endif
# ifdef HAVE___UCMPDI2
void EXPORT_FUNC (__ucmpdi2) (void);
# endif
# ifdef HAVE___BSWAPSI2
void EXPORT_FUNC (__bswapsi2) (void);
# endif
# ifdef HAVE___BSWAPDI2
void EXPORT_FUNC (__bswapdi2) (void);
# endif
#endif
#ifdef HAVE___TRAMPOLINE_SETUP
void EXPORT_FUNC (__trampoline_setup) (void);
#endif
#ifdef HAVE___UCMPDI2
void EXPORT_FUNC (__ucmpdi2) (void);
#endif
#ifdef HAVE__RESTGPR_14_X
void EXPORT_FUNC (_restgpr_14_x) (void);

View file

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2004,2007,2009 Free Software Foundation, Inc.
* 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
@ -16,23 +16,11 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#ifdef HAVE___ASHLDI3
void EXPORT_FUNC (__ashldi3) (void);
#endif
#ifdef HAVE___ASHRDI3
void EXPORT_FUNC (__ashrdi3) (void);
#endif
#ifdef HAVE___LSHRDI3
void EXPORT_FUNC (__lshrdi3) (void);
#endif
#ifdef HAVE___UCMPDI2
void EXPORT_FUNC (__ucmpdi2) (void);
#endif
#ifdef HAVE___BSWAPSI2
void EXPORT_FUNC (__bswapsi2) (void);
#endif
#ifdef HAVE___BSWAPDI2
void EXPORT_FUNC (__bswapdi2) (void);
#endif
void EXPORT_FUNC (pci_slot_match_iterator_create) (void);
void EXPORT_FUNC (pci_system_cleanup) (void);
void EXPORT_FUNC (pci_device_unmap_range) (void);
void EXPORT_FUNC (pci_iterator_destroy) (void);
void EXPORT_FUNC (pci_device_map_range) (void);
void EXPORT_FUNC (pci_device_cfg_read_u32) (void);
void EXPORT_FUNC (pci_device_next) (void);
void EXPORT_FUNC (pci_system_init) (void);

29
include/grub/libusb.h Normal file
View 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);

View file

@ -47,6 +47,8 @@ struct grub_menu_entry
/* The sourcecode of the menu entry, used by the editor. */
const char *sourcecode;
int hotkey;
/* The next element. */
struct grub_menu_entry *next;
};

View file

@ -272,6 +272,11 @@ grub_uint64_t EXPORT_FUNC(grub_divmod64) (grub_uint64_t n,
void EXPORT_FUNC(__enable_execute_stack) (void *addr);
#endif
#if defined (NEED_REGISTER_FRAME_INFO) && !defined(GRUB_UTIL)
void EXPORT_FUNC (__register_frame_info) (void);
void EXPORT_FUNC (__deregister_frame_info) (void);
#endif
/* Inline functions. */
static inline unsigned int

View file

@ -49,7 +49,7 @@ void grub_multiboot_set_bootdev (void);
grub_uint32_t grub_get_multiboot_mmap_count (void);
grub_err_t grub_multiboot_set_video_mode (void);
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU)
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_MULTIBOOT) || defined (GRUB_MACHINE_QEMU)
#include <grub/i386/pc/vbe.h>
#define GRUB_MACHINE_HAS_VGA_TEXT 1
#else

View file

@ -98,17 +98,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);

View file

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2004,2007,2009 Free Software Foundation, Inc.
* 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
@ -16,14 +16,9 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#ifdef HAVE___BSWAPSI2
typedef int SItype __attribute__ ((mode (SI)));
SItype EXPORT_FUNC (__bswapsi2) (SItype);
#endif
#ifdef HAVE___BSWAPDI2
typedef int DItype __attribute__ ((mode (DI)));
DItype EXPORT_FUNC (__bswapdi2) (DItype);
#endif
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);

View file

@ -45,7 +45,7 @@
#define GRUB_BOOT_MACHINE_BOOT_DEVPATH_END 0x80
#define GRUB_BOOT_MACHINE_KERNEL_SECTOR 0x88
#define GRUB_BOOT_MACHINE_KERNEL_BYTE 0x80
#define GRUB_BOOT_MACHINE_CODE_END \
(0x1fc - GRUB_BOOT_AOUT_HEADER_SIZE)

View file

@ -26,7 +26,6 @@ enum grub_dev_abstraction_types {
};
char *grub_guess_root_device (const char *dir);
char *grub_get_prefix (const char *dir);
int grub_util_get_dev_abstraction (const char *os_dev);
char *grub_util_get_grub_dev (const char *os_dev);
const char *grub_util_check_block_device (const char *blk_dev);

View file

@ -20,8 +20,11 @@
#ifndef GRUB_BIOSDISK_MACHINE_UTIL_HEADER
#define GRUB_BIOSDISK_MACHINE_UTIL_HEADER 1
#include <grub/disk.h>
void grub_util_biosdisk_init (const char *dev_map);
void grub_util_biosdisk_fini (void);
char *grub_util_biosdisk_get_grub_dev (const char *os_dev);
const char *grub_util_biosdisk_get_osdev (grub_disk_t disk);
#endif /* ! GRUB_BIOSDISK_MACHINE_UTIL_HEADER */

View file

@ -27,6 +27,7 @@
#include <config.h>
#include <grub/types.h>
#include <grub/symbol.h>
#ifdef __NetBSD__
/* NetBSD uses /boot for its boot block. */
@ -40,9 +41,9 @@
extern char *progname;
extern int verbosity;
void grub_util_warn (const char *fmt, ...);
void grub_util_info (const char *fmt, ...);
void grub_util_error (const char *fmt, ...) __attribute__ ((noreturn));
void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...);
void EXPORT_FUNC(grub_util_info) (const char *fmt, ...);
void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((noreturn));
void *xmalloc (size_t size);
void *xrealloc (void *ptr, size_t size);
@ -88,6 +89,8 @@ grub_int64_t grub_util_get_disk_size (char *name);
char *make_system_path_relative_to_its_root (const char *path);
char *canonicalize_file_name (const char *path);
void grub_util_init_nls (void);
#endif /* ! GRUB_UTIL_MISC_HEADER */

View file

@ -1,6 +1,6 @@
#ifndef GRUB_OFPATH_MACHINE_UTIL_HEADER
#define GRUB_OFPATH_MACHINE_UTIL_HEADER 1
char *grub_util_devname_to_ofpath (char *devname);
char *grub_util_devname_to_ofpath (const char *devname);
#endif /* ! GRUB_OFPATH_MACHINE_UTIL_HEADER */

View file

@ -26,6 +26,7 @@
#include <grub/file.h>
#include <grub/device.h>
#include <grub/command.h>
#include <grub/i18n.h>
/* set ENVVAR=VALUE */
static grub_err_t
@ -178,11 +179,13 @@ void
grub_register_core_commands (void)
{
grub_register_command ("set", grub_core_cmd_set,
"[ENVVAR=VALUE]", "Set an environment variable.");
N_("[ENVVAR=VALUE]"),
N_("Set an environment variable."));
grub_register_command ("unset", grub_core_cmd_unset,
"ENVVAR", "Remove an environment variable.");
N_("ENVVAR"),
N_("Remove an environment variable."));
grub_register_command ("ls", grub_core_cmd_ls,
"[ARG]", "List devices or files.");
N_("[ARG]"), N_("List devices or files."));
grub_register_command ("insmod", grub_core_cmd_insmod,
"MODULE", "Insert a module.");
N_("MODULE"), N_("Insert a module."));
}

View file

@ -117,7 +117,9 @@ grub_machine_init (void)
return 0;
}
#if defined (GRUB_MACHINE_MULTIBOOT) || defined (GRUB_MACHINE_QEMU)
grub_machine_mmap_init ();
#endif
grub_machine_mmap_iterate (heap_init);
grub_tsc_init ();

View file

@ -57,13 +57,23 @@ signature_found:
(long) table_header->size);
for (; table_item->size;
table_item = (grub_linuxbios_table_item_t) ((long) table_item + (long) table_item->size))
if (hook (table_item))
return 1;
{
if (table_item->tag == GRUB_LINUXBIOS_MEMBER_LINK
&& check_signature ((grub_linuxbios_table_header_t) (grub_addr_t)
*(grub_uint64_t *) (table_item + 1)))
{
table_header = (grub_linuxbios_table_header_t) (grub_addr_t)
*(grub_uint64_t *) (table_item + 1);
goto signature_found;
}
if (hook (table_item))
return 1;
}
return 0;
}
void
grub_err_t
grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t))
{
mem_region_t mem_region;

View file

@ -66,10 +66,12 @@ multiboot_header:
.long -0x1BADB002 - MULTIBOOT_MEMORY_INFO
codestart:
#ifdef GRUB_MACHINE_MULTIBOOT
cmpl $MULTIBOOT_BOOTLOADER_MAGIC, %eax
jne 0f
movl %ebx, EXT_C(startup_multiboot_info)
0:
#endif
/* initialize the stack */
movl $GRUB_MEMORY_MACHINE_PROT_STACK, %esp

View file

@ -102,7 +102,7 @@ grub_load_config (void)
auto int hook (struct grub_module_header *);
int hook (struct grub_module_header *header)
{
/* Not an ELF module, skip. */
/* Not an embedded config, skip. */
if (header->type != OBJ_TYPE_CONFIG)
return 0;

View file

@ -975,3 +975,12 @@ void __enable_execute_stack (void *addr __attribute__ ((unused)))
}
#endif
#if defined (NEED_REGISTER_FRAME_INFO) && !defined(GRUB_UTIL)
void __register_frame_info (void)
{
}
void __deregister_frame_info (void)
{
}
#endif

View file

@ -148,15 +148,14 @@ grub_mm_init_region (void *addr, grub_size_t size)
grub_printf ("Using memory for heap: start=%p, end=%p\n", addr, addr + (unsigned int) size);
#endif
/* If this region is too small, ignore it. */
if (size < GRUB_MM_ALIGN * 2)
return;
/* Allocate a region from the head. */
r = (grub_mm_region_t) (((grub_addr_t) addr + GRUB_MM_ALIGN - 1)
& (~(GRUB_MM_ALIGN - 1)));
r = (grub_mm_region_t) ALIGN_UP ((grub_addr_t) addr, GRUB_MM_ALIGN);
size -= (char *) r - (char *) addr + sizeof (*r);
/* If this region is too small, ignore it. */
if (size < GRUB_MM_ALIGN)
return;
h = (grub_mm_header_t) ((char *) r + GRUB_MM_ALIGN);
h->next = h;
h->magic = GRUB_MM_FREE_MAGIC;
@ -221,9 +220,8 @@ grub_real_malloc (grub_mm_header_t *first, grub_size_t n, grub_size_t align)
+---------------+ v
*/
q->next = p->next;
p->magic = GRUB_MM_ALLOC_MAGIC;
}
else if (extra == 0 || p->size == n + extra)
else if (align == 1 || p->size == n + extra)
{
/* There might be alignment requirement, when taking it into
account memory block fits in.
@ -240,10 +238,25 @@ grub_real_malloc (grub_mm_header_t *first, grub_size_t n, grub_size_t align)
| alloc, size=n | |
+---------------+ v
*/
p->size -= n;
p += p->size;
p->size = n;
p->magic = GRUB_MM_ALLOC_MAGIC;
}
else if (extra == 0)
{
grub_mm_header_t r;
r = p + extra + n;
r->magic = GRUB_MM_FREE_MAGIC;
r->size = p->size - extra - n;
r->next = p->next;
q->next = r;
if (q == p)
{
q = r;
r->next = r;
}
}
else
{
@ -276,10 +289,11 @@ grub_real_malloc (grub_mm_header_t *first, grub_size_t n, grub_size_t align)
p->size = extra;
p->next = r;
p += extra;
p->size = n;
p->magic = GRUB_MM_ALLOC_MAGIC;
}
p->magic = GRUB_MM_ALLOC_MAGIC;
p->size = n;
/* Mark find as a start marker for next allocation to fasten it.
This will have side effect of fragmenting memory as small
pieces before this will be un-used. */

View file

@ -249,12 +249,11 @@ grub_parser_execute (char *source)
}
p = grub_strchr (source, '\n');
if (p)
*p = 0;
*line = grub_strdup (source);
if (p)
*p = '\n';
*line = grub_strndup (source, p - source);
else
*line = grub_strdup (source);
source = p ? p + 1 : 0;
return 0;
}

0
lib/posix_wrap/locale.h Normal file
View file

View file

@ -80,7 +80,7 @@ SUFFIX (grub_freebsd_load_elfmodule_obj) (grub_file_t file, int argc,
{
Elf_Ehdr e;
Elf_Shdr *s;
char *shdr;
char *shdr = 0;
grub_addr_t curload, module;
grub_err_t err;
@ -148,7 +148,7 @@ SUFFIX (grub_freebsd_load_elfmodule) (grub_file_t file, int argc, char *argv[],
{
Elf_Ehdr e;
Elf_Shdr *s;
char *shdr;
char *shdr = 0;
grub_addr_t curload, module;
grub_err_t err;
@ -223,7 +223,7 @@ SUFFIX (grub_freebsd_load_elf_meta) (grub_file_t file, grub_addr_t *kern_end)
grub_err_t err;
Elf_Ehdr e;
Elf_Shdr *s;
char *shdr;
char *shdr = 0;
unsigned symoff, stroff, symsize, strsize;
grub_addr_t curload;
grub_freebsd_addr_t symstart, symend, symentsize, dynamic;

View file

@ -50,7 +50,7 @@
#include <grub/efi/efi.h>
#endif
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU)
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_MULTIBOOT) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU)
#define DEFAULT_VIDEO_MODE "text"
#else
#define DEFAULT_VIDEO_MODE "auto"
@ -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;
}

View file

@ -32,7 +32,7 @@
#include <grub/env.h>
#include <grub/video.h>
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU)
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_MULTIBOOT) || defined (GRUB_MACHINE_QEMU)
#include <grub/i386/pc/vbe.h>
#define HAS_VGA_TEXT 1
#else

View file

@ -24,6 +24,7 @@
#include <grub/mm.h>
#include <grub/command.h>
#include <grub/dl.h>
#include <grub/i18n.h>
#ifndef GRUB_MMAP_REGISTER_BY_FIRMWARE
@ -414,8 +415,8 @@ static grub_command_t cmd;
GRUB_MOD_INIT(mmap)
{
cmd = grub_register_command ("badram", grub_cmd_badram,
"ADDR1,MASK1[,ADDR2,MASK2[,...]]",
"Declare memory regions as badram.");
N_("ADDR1,MASK1[,ADDR2,MASK2[,...]]"),
N_("Declare memory regions as badram."));
}
GRUB_MOD_FINI(mmap)

View file

@ -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;

View file

@ -23,6 +23,7 @@
#include <grub/mm.h>
#include <grub/command.h>
#include <grub/normal.h>
#include <grub/i18n.h>
struct menu_pointer
{
@ -172,7 +173,7 @@ grub_context_init (void)
grub_env_export ("prefix");
export_cmd = grub_register_command ("export", grub_cmd_export,
"export ENVVAR", "Export a variable.");
N_("ENVVAR"), N_("Export a variable."));
}
void

View file

@ -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;

View file

@ -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;

View file

@ -155,6 +155,17 @@ free_menu_entry_classes (struct grub_menu_entry_class *head)
}
}
static struct
{
char *name;
int key;
} hotkey_aliases[] =
{
{"backspace", '\b'},
{"tab", '\t'},
{"delete", GRUB_TERM_DC}
};
/* Add a menu entry to the current menu context (as given by the environment
variable data slot `menu'). As the configuration file is read, the script
parser calls this when a menu entry is to be created. */
@ -171,6 +182,7 @@ grub_normal_add_menu_entry (int argc, const char **args,
struct grub_menu_entry_class *classes_head; /* Dummy head node for list. */
struct grub_menu_entry_class *classes_tail;
char *users = NULL;
int hotkey = 0;
/* Allocate dummy head node for class list. */
classes_head = grub_zalloc (sizeof (struct grub_menu_entry_class));
@ -237,6 +249,32 @@ grub_normal_add_menu_entry (int argc, const char **args,
continue;
}
else if (grub_strcmp(arg, "hotkey") == 0)
{
unsigned j;
i++;
if (args[i][1] == 0)
{
hotkey = args[i][0];
continue;
}
for (j = 0; j < ARRAY_SIZE (hotkey_aliases); j++)
if (grub_strcmp (args[i], hotkey_aliases[j].name) == 0)
{
hotkey = hotkey_aliases[j].key;
break;
}
if (j < ARRAY_SIZE (hotkey_aliases))
continue;
failed = 1;
grub_error (GRUB_ERR_MENU,
"Invalid hotkey: '%s'.", args[i]);
break;
}
else
{
/* Handle invalid argument. */
@ -293,6 +331,7 @@ grub_normal_add_menu_entry (int argc, const char **args,
}
(*last)->title = menutitle;
(*last)->hotkey = hotkey;
(*last)->classes = classes_head;
if (users)
(*last)->restricted = 1;
@ -435,14 +474,20 @@ grub_normal_init_page (struct grub_term_output *term)
grub_free (unicode_msg);
}
static char *
read_lists (struct grub_env_var *var __attribute__ ((unused)),
const char *val)
static void
read_lists (const char *val)
{
read_command_list ();
read_fs_list ();
read_crypto_list ();
read_terminal_list ();
read_command_list (val);
read_fs_list (val);
read_crypto_list (val);
read_terminal_list (val);
}
static char *
read_lists_hook (struct grub_env_var *var __attribute__ ((unused)),
const char *val)
{
read_lists (val);
return val ? grub_strdup (val) : NULL;
}
@ -452,10 +497,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)
@ -665,9 +711,9 @@ GRUB_MOD_INIT(normal)
/* Register a command "normal" for the rescue mode. */
grub_register_command ("normal", grub_cmd_normal,
0, "Enter normal mode.");
0, N_("Enter normal mode."));
grub_register_command ("normal_exit", grub_cmd_normal_exit,
0, "Exit from normal mode.");
0, N_("Exit from normal mode."));
/* Reload terminal colors when these variables are written to. */
grub_register_variable_hook ("color_normal", NULL, grub_env_write_color_normal);

View file

@ -477,6 +477,18 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
goto refresh;
default:
{
grub_menu_entry_t entry;
int i;
for (i = 0, entry = menu->entry_list; i < menu->size;
i++, entry = entry->next)
if (entry->hotkey == c)
{
menu_fini ();
*auto_boot = 0;
return i;
}
}
break;
}
}

View file

@ -120,10 +120,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
{

View file

@ -252,14 +252,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;

View file

@ -62,7 +62,7 @@ loader/i386/linux.c
loader/i386/pc/chainloader.c
loader/i386/pc/linux.c
loader/i386/xnu.c
loader/multiboot_loader.c
loader/multiboot.c
loader/powerpc/ieee1275/linux.c
loader/sparc64/ieee1275/linux.c
loader/xnu.c

View file

@ -2,3 +2,4 @@
# Shell language are included here.
util/grub.d/10_kfreebsd.in
util/grub.d/10_linux.in
util/grub.d/10_netbsd.in

View file

@ -86,12 +86,6 @@ typedef size_t yy_size_t;
#define exit(...)
#endif
#pragma GCC diagnostic warning "-Wunused-variable"
#pragma GCC diagnostic warning "-Wunused-function"
#pragma GCC diagnostic warning "-Wunused-parameter"
#pragma GCC diagnostic warning "-Wstrict-prototypes"
#pragma GCC diagnostic warning "-Wmissing-prototypes"
}
%option ecs
@ -118,9 +112,9 @@ typedef size_t yy_size_t;
%option extra-type="struct grub_parser_param*"
BLANK [ \t]
COMMENT ^[ \t]*#.*$
COMMENT #.*$
CHAR [^|&$;<> \t\n\'\"\\]
CHAR [^{}|&$;<> \t\n\'\"\\]
DIGITS [[:digit:]]+
NAME [[:alpha:]_][[:alnum:][:digit:]_]*
@ -217,7 +211,7 @@ WORD ({CHAR}|{DQSTR}|{SQSTR}|{ESC}|{VARIABLE})+
ARG (GRUB_SCRIPT_ARG_TYPE_TEXT);
}
\\ |
[^\"\'$\\]+ { COPY (yytext, yyleng); }
[^\"\'\$\\]+ { COPY (yytext, yyleng); }
<<EOF>> {
yy_pop_state (yyscanner);
yypop_buffer_state (yyscanner);
@ -260,6 +254,11 @@ WORD ({CHAR}|{DQSTR}|{SQSTR}|{ESC}|{VARIABLE})+
}
<DQUOTE>{
\\\$ { COPY ("$", 1); }
\\\\ { COPY ("\\", 1); }
\\\" { COPY ("\"", 1); }
\\\n { /* ignore */ }
[^\"\$\\\n]+ { COPY (yytext, yyleng); }
\" {
yy_pop_state (yyscanner);
ARG (GRUB_SCRIPT_ARG_TYPE_DQSTR);
@ -268,10 +267,6 @@ WORD ({CHAR}|{DQSTR}|{SQSTR}|{ESC}|{VARIABLE})+
yy_push_state (VAR, yyscanner);
ARG (GRUB_SCRIPT_ARG_TYPE_DQSTR);
}
\\\\ { COPY ("\\", 1); }
\\\" { COPY ("\"", 1); }
\\\n { /* ignore */ }
[^\"$\\\n]+ { COPY (yytext, yyleng); }
(.|\n) { COPY (yytext, yyleng); }
}

View file

@ -158,27 +158,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;
@ -193,6 +193,9 @@ grub_console_checkkey (void)
case 0x0d:
read_key = 5;
break;
case 0x0e:
read_key = 3;
break;
case 0x17:
read_key = '\e';
break;

View file

@ -29,6 +29,7 @@
#include <grub/command.h>
#include <grub/extcmd.h>
#include <grub/bitmap_scale.h>
#include <grub/i18n.h>
#define DEFAULT_VIDEO_MODE "auto"
#define DEFAULT_BORDER_WIDTH 10
@ -1219,8 +1220,8 @@ GRUB_MOD_INIT(gfxterm)
grub_register_extcmd ("background_image",
grub_gfxterm_background_image_cmd,
GRUB_COMMAND_FLAG_BOTH,
"[-m (stretch|normal)] FILE",
"Load background image for active terminal.",
N_("[-m (stretch|normal)] FILE"),
N_("Load background image for active terminal."),
background_image_cmd_options);
}

View file

@ -583,8 +583,8 @@ GRUB_MOD_INIT(serial)
{
cmd = grub_register_extcmd ("serial", grub_cmd_serial,
GRUB_COMMAND_FLAG_BOTH,
"serial [OPTIONS...]",
"Configure serial port.", options);
N_("[OPTIONS...]"),
N_("Configure serial port."), options);
/* Set default settings. */
serial_settings.port = serial_hw_get_port (0);

View file

@ -31,6 +31,7 @@
#include <grub/terminfo.h>
#include <grub/tparm.h>
#include <grub/command.h>
#include <grub/i18n.h>
struct terminfo
{
@ -188,7 +189,7 @@ static grub_command_t cmd;
GRUB_MOD_INIT(terminfo)
{
cmd = grub_register_command ("terminfo", grub_cmd_terminfo,
"[TERM]", "Set terminfo type.");
N_("[TERM]"), N_("Set terminfo type."));
grub_terminfo_set_current ("vt100");
}

View file

@ -0,0 +1,28 @@
#! @builddir@/grub-shell-tester
#
# 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/>.
echo a###b
echo a# #b
echo #
echo \#
echo '#'
echo "#"
echo '\#'
echo "\#"

View file

@ -0,0 +1,5 @@
#! /bin/sh -e
@builddir@/grub-script-check << EOF
echo "\\\$"
EOF

View file

@ -79,103 +79,6 @@ xgetcwd (void)
return path;
}
#ifdef __CYGWIN__
/* Convert POSIX path to Win32 path,
remove drive letter, replace backslashes. */
static char *
get_win32_path (const char *path)
{
char winpath[PATH_MAX];
cygwin_conv_to_full_win32_path (path, winpath);
int len = strlen (winpath);
if (len > 2 && winpath[1] == ':')
{
len -= 2;
memmove (winpath, winpath + 2, len + 1);
}
int i;
for (i = 0; i < len; i++)
if (winpath[i] == '\\')
winpath[i] = '/';
return xstrdup (winpath);
}
#endif
char *
grub_get_prefix (const char *dir)
{
char *saved_cwd;
char *abs_dir, *prev_dir;
char *prefix;
struct stat st, prev_st;
/* Save the current directory. */
saved_cwd = xgetcwd ();
if (chdir (dir) < 0)
grub_util_error ("cannot change directory to `%s'", dir);
abs_dir = xgetcwd ();
strip_extra_slashes (abs_dir);
prev_dir = xstrdup (abs_dir);
if (stat (".", &prev_st) < 0)
grub_util_error ("cannot stat `%s'", dir);
if (! S_ISDIR (prev_st.st_mode))
grub_util_error ("`%s' is not a directory", dir);
while (1)
{
if (chdir ("..") < 0)
grub_util_error ("cannot change directory to the parent");
if (stat (".", &st) < 0)
grub_util_error ("cannot stat current directory");
if (! S_ISDIR (st.st_mode))
grub_util_error ("current directory is not a directory???");
if (prev_st.st_dev != st.st_dev || prev_st.st_ino == st.st_ino)
break;
free (prev_dir);
prev_dir = xgetcwd ();
prev_st = st;
}
strip_extra_slashes (prev_dir);
prefix = xmalloc (strlen (abs_dir) - strlen (prev_dir) + 2);
prefix[0] = '/';
strcpy (prefix + 1, abs_dir + strlen (prev_dir));
strip_extra_slashes (prefix);
if (chdir (saved_cwd) < 0)
grub_util_error ("cannot change directory to `%s'", dir);
#ifdef __CYGWIN__
if (st.st_dev != (DEV_CYGDRIVE_MAJOR << 16))
{
/* Reached some mount point not below /cygdrive.
GRUB does not know Cygwin's emulated mounts,
convert to Win32 path. */
grub_util_info ("Cygwin prefix = %s", prefix);
char * wprefix = get_win32_path (prefix);
free (prefix);
prefix = wprefix;
}
#endif
free (saved_cwd);
free (abs_dir);
free (prev_dir);
grub_util_info ("prefix = %s", prefix);
return prefix;
}
#ifdef __MINGW32__
static char *
@ -264,10 +167,17 @@ find_root_device (const char *dir, dev_t dev)
/* Found! */
char *res;
char *cwd;
#if defined(__NetBSD__)
/* Convert this block device to its character (raw) device. */
const char *template = "%s/r%s";
#else
/* Keep the device name as it is. */
const char *template = "%s/%s";
#endif
cwd = xgetcwd ();
res = xmalloc (strlen (cwd) + strlen (ent->d_name) + 2);
sprintf (res, "%s/%s", cwd, ent->d_name);
res = xmalloc (strlen (cwd) + strlen (ent->d_name) + 3);
sprintf (res, template, cwd, ent->d_name);
strip_extra_slashes (res);
free (cwd);

View file

@ -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,7 +239,10 @@ main (int argc, char *argv[])
}
}
dir = grub_get_prefix (dir);
if (strcmp (root_dev, "host") == 0)
dir = xstrdup (dir);
else
dir = make_system_path_relative_to_its_root (dir);
prefix = xmalloc (strlen (root_dev) + 2 + strlen (dir) + 1);
sprintf (prefix, "(%s)%s", root_dev, dir);
free (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 ();

View file

@ -24,10 +24,10 @@ sbindir=@sbindir@
libdir=@libdir@
sysconfdir=@sysconfdir@
package_version=@PACKAGE_VERSION@
host_os=@host_os@
datarootdir=@datarootdir@
datadir=@datadir@
pkgdatadir=${datadir}/`echo @PACKAGE_TARNAME@ | sed "${transform}"`
grub_prefix=`echo /boot/grub | sed ${transform}`
grub_cfg=""
grub_mkconfig_dir=${sysconfdir}/grub.d
@ -75,6 +75,18 @@ done
. ${libdir}/grub/grub-mkconfig_lib
case "$host_os" in
netbsd* | openbsd*)
# Because /boot is used for the boot block in NetBSD and OpenBSD, use /grub
# instead of /boot/grub.
grub_prefix=`echo /grub | sed ${transform}`
;;
*)
# Use /boot/grub by default.
grub_prefix=`echo /boot/grub | sed ${transform}`
;;
esac
if [ "x$EUID" = "x" ] ; then
EUID=`id -u`
fi
@ -141,13 +153,13 @@ if [ "x${GRUB_TERMINAL}" != "x" ] ; then
fi
termoutdefault=0
if [ "x${GRUB_TERMINAL_OUTPUT}" == x ]; then
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 [ "x${x}" = "xgfxterm" ]; then
# If this platform supports gfxterm, try to use it.
if ! test -e ${grub_prefix}/gfxterm.mod ; then
if [ "x$termoutdefault" != "x1" ]; then
@ -227,11 +239,14 @@ export GRUB_DEFAULT \
GRUB_DISTRIBUTOR \
GRUB_CMDLINE_LINUX \
GRUB_CMDLINE_LINUX_DEFAULT \
GRUB_CMDLINE_NETBSD \
GRUB_CMDLINE_NETBSD_DEFAULT \
GRUB_TERMINAL_INPUT \
GRUB_TERMINAL_OUTPUT \
GRUB_SERIAL_COMMAND \
GRUB_DISABLE_LINUX_UUID \
GRUB_DISABLE_LINUX_RECOVERY \
GRUB_DISABLE_NETBSD_RECOVERY \
GRUB_GFXMODE \
GRUB_BACKGROUND \
GRUB_THEME \

View file

@ -1,5 +1,5 @@
# Helper library for grub-mkconfig
# Copyright (C) 2007,2008,2009 Free Software Foundation, Inc.
# Copyright (C) 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
@ -31,6 +31,12 @@ if test "x$grub_mkrelpath" = x; then
grub_mkrelpath=${bindir}/`echo grub-mkrelpath | sed ${transform}`
fi
if $(which gettext >/dev/null 2>/dev/null) ; then
gettext="gettext"
else
gettext="echo"
fi
grub_warn ()
{
echo "Warning: $@" >&2
@ -38,21 +44,7 @@ grub_warn ()
make_system_path_relative_to_its_root ()
{
path="`${grub_mkrelpath} $1`"
case "`uname 2>/dev/null`" in
CYGWIN*)
# Cygwin: Check if regular or emulated mount.
if [ -z "$dir" ] || [ "`stat -c %D "$dir/.."`" != 620000 ] ; then
# Reached some mount point not below /cygdrive.
# GRUB does not know Cygwin's emulated mounts,
# convert to Win32 path and remove drive letter.
path=`cygpath -m "$path" | sed -n 's,^[A-Za-z]:,,p'`
test ! -z "$path" || return 1
fi ;;
esac
echo "$path"
${grub_mkrelpath} $1
}
is_path_readable_by_grub ()
@ -188,3 +180,7 @@ version_find_latest ()
done
echo "$a"
}
gettext_quoted () {
$gettext "$@" | sed "s/'/'\\\\''/g"
}

View file

@ -30,7 +30,7 @@ target_cpu=@target_cpu@
native_platform=@platform@
pkglib_DATA="@pkglib_DATA@"
coreboot_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-coreboot
multiboot_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-multiboot
pc_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-pc
# Usage: usage
@ -122,45 +122,45 @@ process_input_dir ()
}
if [ "${override_dir}" = "" ] ; then
if test -e "${coreboot_dir}" ; then
process_input_dir ${coreboot_dir} coreboot
if test -e "${multiboot_dir}" ; then
process_input_dir ${multiboot_dir} multiboot
fi
if test -e "${pc_dir}" ; then
process_input_dir ${pc_dir} pc
fi
else
process_input_dir ${override_dir} ${native_platform}
coreboot_dir=
multiboot_dir=
pc_dir=
case "${native_platform}" in
coreboot) coreboot_dir=${override_dir} ;;
multiboot) multiboot_dir=${override_dir} ;;
pc) pc_dir=${override_dir} ;;
esac
fi
# build coreboot core.img
if test -e "${coreboot_dir}" ; then
echo "Enabling coreboot support ..."
# build multiboot core.img
if test -e "${multiboot_dir}" ; then
echo "Enabling multiboot support ..."
memdisk_img=`mktemp "$MKTEMP_TEMPLATE"`
memdisk_dir=`mktemp -d "$MKTEMP_TEMPLATE"`
mkdir -p ${memdisk_dir}/boot/grub
# obtain date-based UUID
iso_uuid=$(date -u +%Y-%m-%d-%H-%M-%S-00)
modules="$(cat ${coreboot_dir}/partmap.lst) ${modules}"
modules="$(cat ${multiboot_dir}/partmap.lst) ${modules}"
cat << EOF > ${memdisk_dir}/boot/grub/grub.cfg
search --fs-uuid --set ${iso_uuid}
set prefix=(\${root})/boot/grub/${target_cpu}-coreboot
set prefix=(\${root})/boot/grub/${target_cpu}-multiboot
EOF
(for i in ${modules} ; do
echo "insmod $i"
done ; \
echo "source /boot/grub/grub.cfg") \
> ${iso9660_dir}/boot/grub/i386-pc/grub.cfg
> ${iso9660_dir}/boot/grub/i386-multiboot/grub.cfg
tar -C ${memdisk_dir} -cf ${memdisk_img} boot
rm -rf ${memdisk_dir}
grub-mkelfimage -d ${coreboot_dir}/ -m ${memdisk_img} -o ${iso9660_dir}/boot/multiboot.img \
grub-mkelfimage -d ${multiboot_dir}/ -m ${memdisk_img} -o ${iso9660_dir}/boot/multiboot.img \
memdisk tar search iso9660 configfile sh \
ata at_keyboard
rm -f ${memdisk_img}
@ -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

View file

@ -121,7 +121,7 @@ probe (const char *path, char *device_name)
if (path == NULL)
{
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
if (! grub_util_check_char_device (device_name))
grub_util_error ("%s is not a character device", device_name);
#else

View file

@ -132,7 +132,7 @@ Checks GRUB script configuration file for syntax errors.\n\
\n\
-h, --help display this message and exit\n\
-V, --version print version information and exit\n\
-v, --verbose print script being processed\n\
-v, --verbose print the script as it is being processed\n\
\n\
Report bugs to <%s>.\n\
", program_name,

View file

@ -76,13 +76,13 @@ menuentry "${OS}" ${CLASS} {
EOF
prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/"
cat << EOF
echo $(gettext "Loading GNU Mach ...")
echo '$(gettext_quoted "Loading GNU Mach ...")'
multiboot ${kernel} root=device:${GRUB_DEVICE#/dev/}
EOF
save_default_entry | sed -e "s/^/\t/"
prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/"
cat << EOF
echo $(gettext "Loading the Hurd ...")
echo '$(gettext_quoted "Loading the Hurd ...")'
module /hurd/${hurd_fs}.static ${hurd_fs} --readonly \\
--multiboot-command-line='\${kernel-command-line}' \\
--host-priv-port='\${host-port}' \\
@ -98,13 +98,13 @@ menuentry "${OS} (recovery mode)" {
EOF
prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/"
cat << EOF
echo $(gettext "Loading GNU Mach ...")
echo '$(gettext_quoted "Loading GNU Mach ...")'
multiboot ${kernel} root=device:${GRUB_DEVICE#/dev/} -s
EOF
save_default_entry | sed -e "s/^/\t/"
prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/"
cat << EOF
echo $(gettext "Loading the Hurd ...")
echo '$(gettext_quoted "Loading the Hurd ...")'
module /hurd/${hurd_fs}.static ${hurd_fs} \\
--multiboot-command-line='\${kernel-command-line}' \\
--host-priv-port='\${host-port}' \\

Some files were not shown because too many files have changed in this diff Show more