Merge branch 'mainline' into relocator
This commit is contained in:
commit
8f2e29a2a3
99 changed files with 3333 additions and 732 deletions
684
ChangeLog
684
ChangeLog
|
@ -1,3 +1,683 @@
|
|||
2009-09-16 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* mmap/mmap.c (grub_cmd_badram): Fix off-by-one error.
|
||||
|
||||
2009-09-16 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
* aclocal.m4 (AC_LANG_PROGRAM): New macro. Overrides stock
|
||||
AC_LANG_PROGRAM from autoconf.
|
||||
(grub_ASM_USCORE, grub_PROG_OBJCOPY_ABSOLUTE): Add missing
|
||||
prototypes (fixes warning).
|
||||
|
||||
* configure.ac: Add `-Werror' to TARGET_CFLAGS unless
|
||||
`--disable-werror' was used.
|
||||
|
||||
2009-09-16 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
* partmap/msdos.c (pc_partition_map_iterate): Fix possible use of
|
||||
uninitialized `lastaddr'.
|
||||
|
||||
2009-09-15 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* partmap/msdos.c (pc_partition_map_iterate): Detect and break loops.
|
||||
|
||||
2009-09-14 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* commands/test.c (get_fileinfo): Return immediately if
|
||||
grub_fs_probe fails.
|
||||
|
||||
2009-09-14 José Martínez <xosemp@gmail.com>
|
||||
|
||||
* commands/acpi.c (grub_cmd_acpi): Fix loading ACPI tables from file.
|
||||
|
||||
2009-09-14 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/grub.d/30_os-prober.in: Cope with Windows 7 in os-prober
|
||||
output.
|
||||
|
||||
2009-09-13 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
* configure.ac: Remove --enable-grub-pe2elf. Only build
|
||||
grub-pe2elf when needed by the build system itself.
|
||||
* conf/common.rmk: Remove $(enable_grub_pe2elf) check.
|
||||
|
||||
2009-09-12 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
* configure.ac: Bump version to 1.97~beta3.
|
||||
* docs/version.texi: Likewise.
|
||||
|
||||
2009-09-12 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
* video/i386/pc/vbe.c (grub_vbe_get_video_mode_info): Move packed
|
||||
mode special handling (grub_vbe_bios_set_dac_palette_width() call)
|
||||
from here ...
|
||||
* loader/i386/linux.c [GRUB_MACHINE_PCBIOS]
|
||||
(grub_linux_setup_video): ... to here (with some adjustments).
|
||||
|
||||
2009-09-12 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
Fix memory corruption issue (spotted by Colin Watson).
|
||||
|
||||
* kern/i386/pc/startup.S (grub_vbe_bios_getset_dac_palette): Fix bug
|
||||
causing returned size to be stored in an incorrect memory location.
|
||||
Fix use of uninitialized value when storing the returned size.
|
||||
|
||||
2009-09-12 Yves Blusseau <blusseau@zetam.org>
|
||||
|
||||
Change clean rules to properly remove files
|
||||
|
||||
* genmk.rb: add new clean rules
|
||||
* Makefile.in (clean): add the new targets
|
||||
(mostlyclean): likewise
|
||||
|
||||
2009-09-11 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* include/grub/ntfs.h (struct grub_fshelp_node): Change `size'
|
||||
to grub_uint64_t.
|
||||
* fs/ntfs.c (init_file): Understand 64-bit sizes for
|
||||
non-resident files.
|
||||
|
||||
2009-09-11 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* configure.ac: Don't look for help2man when cross-compiling. Fixes
|
||||
part of bug #27349.
|
||||
|
||||
2009-09-10 Felix Zielcke <fzielcke@z-51.de>
|
||||
|
||||
* util/grub-mkconfig.in: Make the created config mode 400 and
|
||||
print a warning if it fails.
|
||||
|
||||
2009-09-10 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
* util/grub.d/40_custom.in: Ask user to type custom entries below
|
||||
comment, rather than below 'exec tail' line.
|
||||
|
||||
2009-09-10 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/grub.d/40_custom.in: Make sure that the explanatory text is
|
||||
visible in grub.cfg.
|
||||
|
||||
2009-09-10 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/grub.d/40_custom.in: Make it a little clearer how to use this
|
||||
file.
|
||||
|
||||
2009-09-10 Felix Zielcke <fzielcke@z-51.de>
|
||||
|
||||
* docs/grub.cfg: Add an example menu entry for memtest86+.
|
||||
|
||||
2009-09-09 Felix Zielcke <fzielcke@z-51.de>
|
||||
|
||||
* config.guess: Update to latest version from config git.
|
||||
* config.sub: Likewise.
|
||||
|
||||
2009-09-08 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* script/sh/execute.c (grub_script_execute_cmdline): Set "?" in
|
||||
unknown-command case. Fixes bug #27320.
|
||||
|
||||
2009-09-08 Felix Zielcke <fzielcke@z-51.de>
|
||||
|
||||
* kern/rescue_parser.c (grub_rescue_parse_line): Only suggest to try
|
||||
`help' if the command exists.
|
||||
|
||||
2009-09-06 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
* INSTALL: Require GCC 4.1.3 or later.
|
||||
|
||||
2009-09-06 Yves Blusseau <blusseau@zetam.org>
|
||||
|
||||
* Makefile.in (RMKFILES): add i386-qemu.rmk
|
||||
(MAINTAINER_CLEANFILES): add $(srcdir)/DISTLIST $(srcdir)/config.h.in
|
||||
$(srcdir)/stamp-h.in
|
||||
|
||||
2009-09-05 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
* util/grub-probe.c (probe): Comment out buggy codepath, which
|
||||
was unexpectedly enabled by Colin Watson's 2009-09-02 fix. This
|
||||
should be re-enabled after 1.97.
|
||||
|
||||
2009-09-05 Felix Zielcke <fzielcke@z-51.de>
|
||||
|
||||
* gendistlist.sh: Add `grub-dumpdevtree' and `*.lua' to the list
|
||||
find searches for.
|
||||
|
||||
2009-09-04 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* loader/i386/xnu.c (grub_cpu_xnu_fill_devicetree): Remove
|
||||
unnecessary calls to grub_error.
|
||||
|
||||
2009-09-04 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* NEWS: Mention `keystatus' and Unicode fonts.
|
||||
|
||||
2009-09-04 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
* configure.ac: Bump version to 1.97~beta2.
|
||||
* docs/version.texi: Likewise.
|
||||
|
||||
2009-09-03 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* configure.ac: By default, GCC 4.4 generates .eh_frame sections
|
||||
containing unwind information in some cases where it previously did
|
||||
not. Use -fno-dwarf2-cfi-asm if available to restore the old
|
||||
behaviour. See http://patchwork.kernel.org/patch/8555/ for related
|
||||
discussion.
|
||||
|
||||
2009-09-02 Yves BLUSSEAU <blusseau@zetam.org>
|
||||
|
||||
Embedding loadenv module into grub-emu
|
||||
|
||||
* conf/i386-pc.rmk (grub_emu_SOURCES): add lib/envblk.c and
|
||||
commands/loadenv.c
|
||||
* conf/i386-coreboot.rmk (grub_emu_SOURCES): Likewise
|
||||
* conf/i386-efi.rmk (grub_emu_SOURCES): Likewise
|
||||
* conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise
|
||||
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise
|
||||
* conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise
|
||||
* conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise
|
||||
|
||||
2009-09-03 Magnus Granberg <zorry@ume.nu>
|
||||
|
||||
* aclocal.m4: Add grub_CHECK_PIE. It check if the compiler
|
||||
include -fPIE in the default specs.
|
||||
* configure.ac: Check if pie_possible is yes and add -fno-PIE
|
||||
to TARGET_CFLAGS.
|
||||
|
||||
2009-09-03 Felix Zielcke <fzielcke@z-51.de>
|
||||
|
||||
* INSTALL: Note that GNU Bison 2.3 or later is required.
|
||||
|
||||
2009-09-03 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* kern/i386/pc/startup.S: Fix typo.
|
||||
|
||||
2009-09-02 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* efiemu/loadcore.c (SUFFIX (grub_efiemu_loadcore_load)): Fix style
|
||||
according to GCS.
|
||||
|
||||
2009-09-02 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* docs/grub.texi (Naming convention): Describe one-based partition
|
||||
numbering.
|
||||
(Device syntax): Likewise.
|
||||
(File name syntax): Likewise.
|
||||
(Block list syntax): Likewise.
|
||||
(Making a GRUB bootable CD-ROM): Talk about grub.cfg rather than
|
||||
menu.lst.
|
||||
(File name syntax): Likewise.
|
||||
(Command-line and menu entry commands): Document acpi, blocklist,
|
||||
crc, export, insmod, keystatus, ls, set, and unset commands.
|
||||
|
||||
2009-09-02 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* commands/keystatus.c (GRUB_MOD_INIT (keystatus)): Adjust summary
|
||||
to avoid implying that only one of --shift, --ctrl, or --alt may be
|
||||
used.
|
||||
|
||||
2009-09-02 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/grub-probe.c (probe): Test st.st_mode using S_ISREG macro
|
||||
rather than comparing against S_IFREG, which will almost never work.
|
||||
|
||||
2009-09-01 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* commands/loadenv.c (check_blocklists): Fix off-by-one error.
|
||||
(write_blocklists): Likewise.
|
||||
|
||||
2009-09-01 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* script/lua/grub_lua.h (fputs): Supply a format string as the first
|
||||
argument to grub_printf.
|
||||
|
||||
2009-09-01 Felix Zielcke <fzielcke@z-51.de>
|
||||
|
||||
* genmk.rb: Add quotes around $(TARGET_OBJ2ELF) to cope with
|
||||
non GNU test.
|
||||
|
||||
2009-08-30 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* kern/file.c (grub_file_read): Spelling fix
|
||||
|
||||
2009-08-30 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* loader/i386/bsdXX.c (SUFFIX (grub_freebsd_load_elfmodule)): Fix
|
||||
loading of headers in some cases.
|
||||
|
||||
2009-08-30 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
* configure.ac: Bump version to 1.97~beta1.
|
||||
* docs/version.texi: Likewise.
|
||||
|
||||
2009-08-29 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* include/grub/i386/xnu.h: Add license header.
|
||||
include grub/err.h explicitly.
|
||||
|
||||
2009-08-29 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
* util/grub.d/10_freebsd.in: Detect `ufs1' and `ufs2' and map them
|
||||
to `ufs' in the vfs.root.mountfrom kernel parameter.
|
||||
|
||||
2009-08-29 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
* term/i386/pc/serial.c: Include `<grub/machine/memory.h>'.
|
||||
|
||||
[GRUB_MACHINE_PCBIOS] (serial_hw_io_addr): Macroify initialization
|
||||
value (0x0400 -> GRUB_MEMORY_MACHINE_BIOS_DATA_AREA_ADDR).
|
||||
|
||||
[! GRUB_MACHINE_PCBIOS] (GRUB_SERIAL_PORT_NUM): Calculate using
|
||||
`ARRAY_SIZE' macro.
|
||||
|
||||
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* kern/file.c (grub_file_read): Check offset.
|
||||
* fs/hfs.c (grub_hfs_read_file): Remove unnecessary offset check.
|
||||
* fs/jfs.c (grub_jfs_read_file): Likewise.
|
||||
* fs/ntfs.c (grub_ntfs_read): Likewise.
|
||||
* fs/reiserfs.c (grub_reiserfs_read): Likewise.
|
||||
* fs/minix.c (grub_minix_read_file): Correct offset check.
|
||||
* fs/ufs.c (grub_ufs_read_file): Likewise.
|
||||
|
||||
2009-08-28 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* term/i386/pc/console.c (bios_data_area): Cast
|
||||
GRUB_MEMORY_MACHINE_BIOS_DATA_AREA_ADDR explicitly.
|
||||
|
||||
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
1-bit optimised blitters.
|
||||
|
||||
* include/grub/fbblit.h (grub_video_fbblit_replace_32bit_1bit): New
|
||||
prototype.
|
||||
(grub_video_fbblit_replace_24bit_1bit): Likewise.
|
||||
(grub_video_fbblit_replace_16bit_1bit): Likewise.
|
||||
(grub_video_fbblit_replace_8bit_1bit): Likewise.
|
||||
(grub_video_fbblit_blend_XXXA8888_1bit): Likewise.
|
||||
(grub_video_fbblit_blend_XXX888_1bit): Likewise.
|
||||
(grub_video_fbblit_blend_XXX565_1bit): Likewise.
|
||||
* video/fb/fbblit.c (grub_video_fbblit_replace_32bit_1bit): New
|
||||
function.
|
||||
(grub_video_fbblit_replace_24bit_1bit): Likewise.
|
||||
(grub_video_fbblit_replace_16bit_1bit): Likewise.
|
||||
(grub_video_fbblit_replace_8bit_1bit): Likewise.
|
||||
(grub_video_fbblit_blend_XXXA8888_1bit): Likewise.
|
||||
(grub_video_fbblit_blend_XXX888_1bit): Likewise.
|
||||
(grub_video_fbblit_blend_XXX565_1bit): Likewise.
|
||||
* video/fb/video_fb.c (common_blitter): Use 1-bit optimised blitters
|
||||
when possible.
|
||||
* video/video.c (grub_video_get_blit_format): Return
|
||||
GRUB_VIDEO_BLIT_FORMAT_1BIT_PACKED if bpp = 1.
|
||||
|
||||
2009-08-28 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* normal/cmdline.c (grub_cmdline_get): Supply a format string as
|
||||
the first argument to grub_printf.
|
||||
|
||||
2009-08-28 Colin Watson <cjwatson@ubuntu.com>
|
||||
2009-08-28 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
Add `getkeystatus' terminal method. Add a new `keystatus' command
|
||||
to query it.
|
||||
|
||||
* include/grub/term.h (GRUB_TERM_STATUS_SHIFT,
|
||||
GRUB_TERM_STATUS_CTRL, GRUB_TERM_STATUS_ALT): Definitions for
|
||||
modifier key bitmasks.
|
||||
(struct grub_term_input): Add `getkeystatus' member.
|
||||
(grub_getkeystatus): Add prototype.
|
||||
* kern/term.c (grub_getkeystatus): New function.
|
||||
|
||||
* include/grub/i386/pc/memory.h
|
||||
(GRUB_MEMORY_MACHINE_BIOS_DATA_AREA_ADDR): New macro.
|
||||
(struct grub_machine_bios_data_area): Define necessary parts of BIOS
|
||||
Data Area layout.
|
||||
* term/i386/pc/console.c (grub_console_getkeystatus): New function.
|
||||
(grub_console_term_input): Set `getkeystatus' member.
|
||||
* term/usb_keyboard.c (grub_usb_hid): Macroify HID protocol
|
||||
constants.
|
||||
(grub_usb_keyboard_getreport): Likewise.
|
||||
(grub_usb_keyboard_checkkey): Likewise.
|
||||
(grub_usb_keyboard_getkeystatus): New function.
|
||||
(grub_usb_keyboard_term): Set `getkeystatus' member.
|
||||
|
||||
* commands/keystatus.c: New file.
|
||||
* conf/common.rmk (pkglib_MODULES): Add keystatus.mod.
|
||||
(keystatus_mod_SOURCES): New variable.
|
||||
(keystatus_mod_CFLAGS): Likewise.
|
||||
(keystatus_mod_LDFLAGS): Likewise.
|
||||
* conf/i386-coreboot.rmk (grub_emu_SOURCES): Add
|
||||
commands/keystatus.c.
|
||||
* conf/i386-efi.rmk (grub_emu_SOURCES): Likewise.
|
||||
* conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise.
|
||||
* conf/i386-pc.rmk (grub_emu_SOURCES): Likewise.
|
||||
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise.
|
||||
* conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise.
|
||||
* conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise.
|
||||
|
||||
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Split befs.mod and afs.mod into *_be.mod and *.mod
|
||||
|
||||
* conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c.
|
||||
(grub_fstest_SOURCES): Likewise.
|
||||
(pkglib_MODULES): Add afs_be.mod and befs_be.mod.
|
||||
(afs_be_mod_SOURCES): New variable.
|
||||
(afs_be_mod_CFLAGS): Likewise.
|
||||
(afs_be_mod_LDFLAGS): Likewise.
|
||||
(befs_be_mod_SOURCES): Likewise.
|
||||
(befs_be_mod_CFLAGS): Likewise.
|
||||
(befs_be_mod_LDFLAGS): Likewise.
|
||||
* conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c.
|
||||
* conf/i386-efi.rmk (grub_emu_SOURCES): Likewise.
|
||||
* conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise.
|
||||
* conf/i386-pc.rmk (grub_setup_SOURCES): Likewise.
|
||||
(grub_emu_SOURCES): Likewise.
|
||||
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise.
|
||||
* conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise.
|
||||
* conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise.
|
||||
* fs/afs_be.c: New file.
|
||||
* fs/befs_be.c: New file.
|
||||
* fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition.
|
||||
(GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX.
|
||||
(U16): Replaced with ...
|
||||
(grub_afs_to_cpu16): ...this. All users updated.
|
||||
(U32): Replaced with ...
|
||||
(grub_afs_to_cpu32): ...this. All users updated.
|
||||
(U64): Replaced with ...
|
||||
(grub_afs_to_cpu64): ...this. All users updated.
|
||||
(GRUB_AFS_BO_LITTLE_ENDIAN): Remove.
|
||||
(GRUB_AFS_BO_BIG_ENDIAN): Likewise.
|
||||
(grub_afs_validate_sblock): Check only one endianness.
|
||||
(GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to ..
|
||||
(GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this.
|
||||
(GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to ..
|
||||
(GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
|
||||
(GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to ..
|
||||
(GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this.
|
||||
(GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to ..
|
||||
(GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
|
||||
|
||||
2009-08-26 Bean <bean123ch@gmail.com>
|
||||
|
||||
* fs/xfs.c (GRUB_XFS_INO_INOINAG): Replace 1L with 1LL to support
|
||||
64-bit number.
|
||||
(GRUB_XFS_FSB_TO_BLOCK): Likewise.
|
||||
(grub_xfs_inode_block): Change return type to grub_uint64_t.
|
||||
(grub_xfs_read_inode): Change type of block to grub_uint64_t.
|
||||
|
||||
2009-08-25 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
NetBSD memory map support.
|
||||
|
||||
* include/grub/i386/bsd.h (NETBSD_BTINFO_MEMMAP): New definition.
|
||||
(grub_netbsd_btinfo_mmap_header): New structure.
|
||||
(grub_netbsd_btinfo_mmap_entry): Likewise.
|
||||
* loader/i386/bsd.c (grub_netbsd_boot): Pass memory map.
|
||||
|
||||
2009-08-25 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Enable bsd.mod on coreboot.
|
||||
|
||||
* conf/i386-coreboot.rmk (pkglib_MODULES): Add bsd.mod.
|
||||
(bsd_mod_SOURCES): New variable.
|
||||
(bsd_mod_CFLAGS): Likewise.
|
||||
(bsd_mod_LDFLAGS): Likewise.
|
||||
(bsd_mod_ASFLAGS): Likewise.
|
||||
* loader/i386/bsd.c [!GRUB_MACHINE_PCBIOS]: Fix includes.
|
||||
(grub_bsd_get_device) [!GRUB_MACHINE_PCBIOS]: Set *biosdev to 0xff.
|
||||
|
||||
2009-08-25 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Cleanup NetBSD root support.
|
||||
|
||||
* loader/i386/bsd.c (grub_netbsd_boot): Remove call to
|
||||
grub_bsd_get_device.
|
||||
Fix typo.
|
||||
|
||||
2009-08-25 Felix Zielcke <fzielcke@z-51.de>
|
||||
|
||||
* util/grub.d/00_header.in: Move check for the video backend of
|
||||
gfxterm from here ...
|
||||
* util/grub-mkconfig.in: ... to here. Enable gfxterm if there's
|
||||
a suitable video backend.
|
||||
|
||||
2009-08-25 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Fix breakage in grub-setup.
|
||||
|
||||
* util/i386/pc/grub-setup.c (setup): Use "part_msdos" instead of
|
||||
"msdos_partition_map".
|
||||
|
||||
2009-08-25 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Fix breakage in normal/auth.c.
|
||||
|
||||
* normal/auth.c (grub_iswordseparator): New function.
|
||||
|
||||
2009-08-25 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Authentication support.
|
||||
|
||||
* commands/password.c: New file.
|
||||
* conf/common.rmk (pkglib_MODULES): Add password.mod.
|
||||
(password_mod_SOURCES): New variable.
|
||||
(password_mod_CFLAGS): Likewise.
|
||||
(password_mod_LDFLAGS): Likewise.
|
||||
(normal_mod_SOURCES): Add normal/auth.c.
|
||||
* conf/i386-coreboot.rmk (grub_emu_SOURCES): Add commands/password.c and
|
||||
normal/auth.c.
|
||||
* conf/i386-efi.rmk (grub_emu_SOURCES): Likewise.
|
||||
* conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise.
|
||||
* conf/i386-pc.rmk (grub_emu_SOURCES): Likewise.
|
||||
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise.
|
||||
* conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise.
|
||||
* conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise.
|
||||
* include/grub/auth.h: New file.
|
||||
* include/grub/err.h (grub_err_t): New enum value
|
||||
GRUB_ERR_ACCESS_DENIED.
|
||||
* include/grub/menu.h (grub_menu_entry): New fields 'restricted' and
|
||||
'users'.
|
||||
* include/grub/normal.h (grub_cmdline_get): New argument 'history'.
|
||||
* normal/cmdline.c (grub_cmdline_get): New argument 'history'. All
|
||||
users updated.
|
||||
* normal/auth.c: New file.
|
||||
* normal/main.c (grub_normal_add_menu_entry): Handle --users option.
|
||||
(grub_cmdline_run): Don't allow to go to command line without
|
||||
authentication.
|
||||
* normal/menu.c (grub_menu_execute_entry): Handle restricted entries.
|
||||
* normal/menu_entry.c (grub_menu_entry_run): Don't allow editing
|
||||
menuentry without superuser rights.
|
||||
* normal/menu_viewer.c (grub_menu_viewer_show_menu): Don't exit if
|
||||
user isn't a superuser.
|
||||
|
||||
2009-08-24 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Save space by inlining misc.c functions.
|
||||
|
||||
* kern/misc.c (grub_iswordseparator): Made static.
|
||||
* kern/misc.c (grub_strcat): Moved from here ...
|
||||
* include/grub/misc.h (grub_strcat): ... here. Inlined.
|
||||
* kern/misc.c (grub_strncat): Moved from here ...
|
||||
* include/grub/misc.h (grub_strncat): ... here. Inlined.
|
||||
* kern/misc.c (grub_strcasecmp): Moved from here ...
|
||||
* include/grub/misc.h (grub_strcasecmp): ... here. Inlined.
|
||||
* kern/misc.c (grub_strncasecmp): Moved from here ...
|
||||
* include/grub/misc.h (grub_strncasecmp): ... here. Inlined.
|
||||
* kern/misc.c (grub_isalpha): Moved from here ...
|
||||
* include/grub/misc.h (grub_isalpha): ... here. Inlined.
|
||||
* kern/misc.c (grub_isdigit): Moved from here ...
|
||||
* include/grub/misc.h (grub_isdigit): ... here. Inlined.
|
||||
* kern/misc.c (grub_isgraph): Moved from here ...
|
||||
* include/grub/misc.h (grub_isgraph): ... here. Inlined.
|
||||
* kern/misc.c (grub_tolower): Moved from here ...
|
||||
* include/grub/misc.h (grub_tolower): ... here. Inlined.
|
||||
|
||||
2009-08-24 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* script/sh/function.c (grub_script_function_find): Cut error message
|
||||
not to flood terminal.
|
||||
* script/sh/lexer.c (grub_script_yylex): Remove command line length
|
||||
limit.
|
||||
* script/sh/script.c (grub_script_arg_add): Duplicate string.
|
||||
|
||||
2009-08-24 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* term/usb_keyboard.c (grub_usb_keyboard_getreport): Make
|
||||
`report' grub_uint8_t *.
|
||||
(grub_usb_keyboard_checkkey): Make `data' elements grub_uint8_t.
|
||||
Use a 50-millisecond timeout rather than just repeating
|
||||
grub_usb_keyboard_getreport 50 times.
|
||||
(grub_usb_keyboard_getkey): Make `data' elements grub_uint8_t.
|
||||
|
||||
2009-08-24 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Rename *_partition_map to part_*
|
||||
|
||||
* partmap/acorn.c (grub_acorn_partition_map): Set name to 'part_acorn'.
|
||||
* partmap/amiga.c (grub_amiga_partition_map): Set name to 'part_amiga'.
|
||||
* partmap/apple.c (grub_apple_partition_map): Set name to 'part_apple'.
|
||||
* partmap/gpt.c (grub_gpt_partition_map): Set name to 'part_gpt'.
|
||||
All users updated.
|
||||
* partmap/msdos.c (grub_msdos_partition_map): Set name to 'part_msdos'.
|
||||
All users updated.
|
||||
* partmap/sun.c (grub_sun_partition_map): Set name to 'part_sun'.
|
||||
* util/grub-probe.c (probe_partmap): Don't transform partition name
|
||||
to get module name.
|
||||
|
||||
2009-08-24 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Fix OpenBSD and NetBSD support.
|
||||
|
||||
* include/grub/i386/bsd.h (GRUB_BSD_TEMP_BUFFER): Change to resolve
|
||||
memory address conflict.
|
||||
(OPENBSD_MMAP_ACPI): New definition.
|
||||
(OPENBSD_MMAP_NVS): Likewise.
|
||||
* loader/i386/bsd.c (grub_openbsd_boot): Support OPENBSD_MMAP_ACPI
|
||||
and OPENBSD_MMAP_NVS.
|
||||
Add memory map terminator
|
||||
Explicit cast when calling grub_unix_real_boot.
|
||||
(grub_netbsd_boot): Explicit cast when calling grub_unix_real_boot.
|
||||
|
||||
2009-08-24 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Let user specify NetBSD root device.
|
||||
|
||||
* loader/i386/bsd.c (netbsd_root): New variable.
|
||||
(netbsd_opts): New option 'root'.
|
||||
(NETBSD_ROOT_ARG): New macro.
|
||||
(grub_netbsd_boot): Use 'netbsd_root'.
|
||||
(grub_bsd_unload): Free 'netbsd_root'.
|
||||
(grub_cmd_netbsd): Fill 'netbsd_root'.
|
||||
|
||||
2009-08-24 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Support for 64-bit NetBSD.
|
||||
|
||||
* loader/i386/bsd.c (grub_bsd_load_elf): Apply correct mask to entry
|
||||
point when booting non-FreeBSD.
|
||||
|
||||
2009-08-24 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Support --no-smp and --no-acpi for NetBSD.
|
||||
|
||||
* include/grub/i386/bsd.h (NETBSD_AB_NOSMP): New definition.
|
||||
(NETBSD_AB_NOACPI): Likewise.
|
||||
* loader/i386/bsd.c (netbsd_opts): New entries no-smp and no-acpi.
|
||||
(netbsd_flags): Add NETBSD_AB_NOSMP, NETBSD_AB_NOACPI.
|
||||
|
||||
2009-08-23 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* fs/hfsplus.c (grub_hfsplus_mount): Don't ignore grub_hfsplus_read_file
|
||||
errors.
|
||||
(grub_hfsplus_btree_iterate_node): Don't ignore grub_hfsplus_read_file
|
||||
errors. Call grub_error when needed.
|
||||
|
||||
2009-08-23 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* commands/search.c (search_fs): Try searching without autoload first.
|
||||
* util/grub-mkconfig_lib.in (prepare_grub_to_access_device): Load
|
||||
filesystem module explicitly for faster booting.
|
||||
|
||||
2009-08-23 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/grub-mkconfig.in: Export GRUB_DISABLE_OS_PROBER.
|
||||
|
||||
2009-08-23 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/grub.d/30_os-prober.in: Disable os-prober if
|
||||
`GRUB_DISABLE_OS_PROBER' was set to true.
|
||||
|
||||
2009-08-23 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
* partmap/pc.c: Rename to ...
|
||||
* partmap/msdos.c: ... this. Update all users.
|
||||
(grub_pc_partition_map): Rename to ...
|
||||
(grub_msdos_partition_map): ... this. Update all users.
|
||||
|
||||
* parttool/pcpart.c: Rename to ...
|
||||
* parttool/msdospart.c: ... this. Update all users.
|
||||
|
||||
* include/grub/pc_partition.h: Rename to ...
|
||||
* include/grub/msdos_partition.h: ... this. Update all users.
|
||||
(grub_pc_partition_bsd_entry): Rename to ...
|
||||
(grub_msdos_partition_bsd_entry): ... this. Update all users.
|
||||
(grub_pc_partition_disk_label): Rename to ...
|
||||
(grub_msdos_partition_disk_label): ... this. Update all users.
|
||||
(grub_pc_partition_entry): Rename to ...
|
||||
(grub_msdos_partition_entry): ... this. Update all users.
|
||||
(grub_pc_partition_mbr): Rename to ...
|
||||
(grub_msdos_partition_mbr): ... this. Update all users.
|
||||
(grub_pc_partition): Rename to ...
|
||||
(grub_msdos_partition): ... this. Update all users.
|
||||
(grub_pc_partition_is_empty): Rename to ...
|
||||
(grub_msdos_partition_is_empty): ... this. Update all users.
|
||||
(grub_pc_partition_is_extended): Rename to ...
|
||||
(grub_msdos_partition_is_extended): ... this. Update all users.
|
||||
(grub_pc_partition_is_bsd): Rename to ...
|
||||
(grub_msdos_partition_is_bsd): ... this. Update all users.
|
||||
|
||||
* conf/common.rmk (amiga_mod_SOURCES, amiga_mod_CFLAGS)
|
||||
(amiga_mod_LDFLAGS, apple_mod_SOURCES, apple_mod_CFLAGS)
|
||||
(apple_mod_LDFLAGS, msdos_mod_SOURCES, msdos_mod_CFLAGS)
|
||||
(msdos_mod_LDFLAGS, sun_mod_SOURCES, sun_mod_CFLAGS)
|
||||
(sun_mod_LDFLAGS, acorn_mod_SOURCES, acorn_mod_CFLAGS)
|
||||
(acorn_mod_LDFLAGS, gpt_mod_SOURCES, gpt_mod_CFLAGS)
|
||||
(gpt_mod_LDFLAGS): Rename to ...
|
||||
(part_amiga_mod_SOURCES, part_amiga_mod_CFLAGS, part_amiga_mod_LDFLAGS)
|
||||
(part_apple_mod_SOURCES, part_apple_mod_CFLAGS, part_apple_mod_LDFLAGS)
|
||||
(part_msdos_mod_SOURCES, part_msdos_mod_CFLAGS, part_msdos_mod_LDFLAGS)
|
||||
(part_sun_mod_SOURCES, part_sun_mod_CFLAGS, part_sun_mod_LDFLAGS)
|
||||
(part_acorn_mod_SOURCES, part_acorn_mod_CFLAGS, part_acorn_mod_LDFLAGS)
|
||||
(part_gpt_mod_SOURCES, part_gpt_mod_CFLAGS)
|
||||
(part_gpt_mod_LDFLAGS): ... this.
|
||||
(pkglib_MODULES): Prefix partition modules with `part_'. Rename
|
||||
`pcpart.mod' to `msdospart.mod'.
|
||||
(pcpart_mod_SOURCES, pcpart_mod_CFLAGS, pcpart_mod_LDFLAGS): Rename
|
||||
to ...
|
||||
(msdospart_mod_SOURCES, msdospart_mod_CFLAGS)
|
||||
(msdospart_mod_LDFLAGS): ... this.
|
||||
|
||||
2009-08-23 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* loader/i386/bsd.c (freebsd_opts): Rewritten to use extcmd.
|
||||
(openbsd_opts): Likewise.
|
||||
(netbsd_opts): Likewise.
|
||||
(freebsd_flags): Added 0 terminator.
|
||||
(openbsd_flags): Likewise.
|
||||
(netbsd_flags): Likewise.
|
||||
(grub_bsd_parse_flags): Rewritten to use extcmd. All users updated.
|
||||
(grub_cmd_freebsd): Transformed into extended command.
|
||||
(grub_cmd_openbsd): Likewise.
|
||||
(grub_cmd_netbsd): Likewise.
|
||||
(cmd_freebsd): Changed type to grub_extcmd_t.
|
||||
(cmd_openbsd): Likewise.
|
||||
(cmd_netbsd): Likewise.
|
||||
(GRUB_MOD_INIT (bsd)): Register grub_cmd_freebsd, grub_cmd_netbsd and
|
||||
grub_cmd_openbsd as extended commands.
|
||||
(GRUB_MOD_FINI (bsd)): Use grub_unregister_extcmd for cmd_freebsd,
|
||||
cmd_netbsd and cmd_openbsd
|
||||
|
||||
2009-08-22 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* commands/xnu_uuid.c (transform): Use grub_memcpy instead of memcpy.
|
||||
|
@ -438,7 +1118,7 @@
|
|||
2009-07-30 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* util/i386/pc/grub-setup.c (setup): Check that no partition is in
|
||||
embeding zone, not only the first one.
|
||||
embedding zone, not only the first one.
|
||||
|
||||
2009-07-29 Joe Auricchio <jauricchio@gmail.com>
|
||||
|
||||
|
@ -511,7 +1191,7 @@
|
|||
instead of WORDS_BIGENDIAN. Use grub_le_to_cpu32(), so that the
|
||||
case of little endian words becomes just an optimization.
|
||||
Respect const modifier.
|
||||
(md5_final): Use code that doesn't depend on endianess.
|
||||
(md5_final): Use code that doesn't depend on endianness.
|
||||
|
||||
* include/grub/misc.h (ALIGN_UP): Cast align to the type of addr
|
||||
to avoid loss of upper bits if align is unsigned and shorter
|
||||
|
|
4
INSTALL
4
INSTALL
|
@ -11,9 +11,9 @@ GRUB depends on some software packages installed into your system. If
|
|||
you don't have any of them, please obtain and install them before
|
||||
configuring the GRUB.
|
||||
|
||||
* GCC 2.95 or later
|
||||
* GCC 4.1.3 or later
|
||||
* GNU Make
|
||||
* GNU Bison
|
||||
* GNU Bison 2.3 or later
|
||||
* GNU binutils 2.9.1.0.23 or later
|
||||
* Other standard GNU/Unix tools
|
||||
* Ruby 1.6 or later
|
||||
|
|
|
@ -111,7 +111,7 @@ enable_efiemu = @enable_efiemu@
|
|||
### General variables.
|
||||
|
||||
RMKFILES = $(addprefix conf/,common.rmk i386-coreboot.rmk i386-efi.rmk \
|
||||
i386-ieee1275.rmk i386-pc.rmk i386.rmk powerpc-ieee1275.rmk \
|
||||
i386-qemu.rmk i386-ieee1275.rmk i386-pc.rmk i386.rmk powerpc-ieee1275.rmk \
|
||||
sparc64-ieee1275.rmk x86_64-efi.rmk)
|
||||
|
||||
MKFILES = $(patsubst %.rmk,%.mk,$(RMKFILES))
|
||||
|
@ -128,7 +128,8 @@ MOSTLYCLEANFILES =
|
|||
DISTCLEANFILES = config.status config.cache config.log config.h \
|
||||
Makefile stamp-h include/grub/cpu include/grub/machine \
|
||||
gensymlist.sh genkernsyms.sh build_env.mk
|
||||
MAINTAINER_CLEANFILES = $(srcdir)/configure $(addprefix $(srcdir)/,$(MKFILES))
|
||||
MAINTAINER_CLEANFILES = $(srcdir)/configure $(addprefix $(srcdir)/,$(MKFILES)) \
|
||||
$(srcdir)/DISTLIST $(srcdir)/config.h.in $(srcdir)/stamp-h.in
|
||||
|
||||
# The default target.
|
||||
all: all-local
|
||||
|
@ -325,10 +326,10 @@ uninstall:
|
|||
rm -f $(DESTDIR)$(libdir)/grub/$$dest; \
|
||||
done
|
||||
|
||||
clean:
|
||||
clean: $(CLEAN_IMAGE_TARGETS) $(CLEAN_MODULE_TARGETS) $(CLEAN_UTILITY_TARGETS)
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
mostlyclean: clean
|
||||
mostlyclean: clean $(MOSTLYCLEAN_IMAGE_TARGETS) $(MOSTLYCLEAN_MODULE_TARGETS) $(MOSTLYCLEAN_UTILITY_TARGETS)
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
distclean: mostlyclean
|
||||
|
|
4
NEWS
4
NEWS
|
@ -1,5 +1,9 @@
|
|||
New in 1.97 - :
|
||||
|
||||
* Add `keystatus' command.
|
||||
|
||||
* Unicode fonts are now used by default.
|
||||
|
||||
* Add `hdparm' command.
|
||||
|
||||
* Add support for getting the current date and time from CMOS as variables.
|
||||
|
|
45
aclocal.m4
vendored
45
aclocal.m4
vendored
|
@ -1,3 +1,18 @@
|
|||
dnl Redefine AC_LANG_PROGRAM with a "-Wstrict-prototypes -Werror"-friendly
|
||||
dnl version. Patch submitted to bug-autoconf in 2009-09-16.
|
||||
m4_define([AC_LANG_PROGRAM(C)],
|
||||
[$1
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
dnl Do *not* indent the following line: there may be CPP directives.
|
||||
dnl Don't move the `;' right after for the same reason.
|
||||
$2
|
||||
;
|
||||
return 0;
|
||||
}])
|
||||
|
||||
|
||||
dnl Check whether target compiler is working
|
||||
AC_DEFUN(grub_PROG_TARGET_CC,
|
||||
[AC_MSG_CHECKING([whether target compiler is working])
|
||||
|
@ -26,6 +41,7 @@ AC_DEFUN(grub_ASM_USCORE,
|
|||
AC_MSG_CHECKING([if C symbols get an underscore after compilation])
|
||||
AC_CACHE_VAL(grub_cv_asm_uscore,
|
||||
[cat > conftest.c <<\EOF
|
||||
int func (int *);
|
||||
int
|
||||
func (int *list)
|
||||
{
|
||||
|
@ -63,6 +79,7 @@ AC_DEFUN(grub_PROG_OBJCOPY_ABSOLUTE,
|
|||
[AC_MSG_CHECKING([whether ${OBJCOPY} works for absolute addresses])
|
||||
AC_CACHE_VAL(grub_cv_prog_objcopy_absolute,
|
||||
[cat > conftest.c <<\EOF
|
||||
void cmain (void);
|
||||
void
|
||||
cmain (void)
|
||||
{
|
||||
|
@ -413,3 +430,31 @@ else
|
|||
[fi
|
||||
rm -rf testdir]
|
||||
])
|
||||
|
||||
dnl Check if the C compiler supports `-fPIE'.
|
||||
AC_DEFUN(grub_CHECK_PIE,[
|
||||
[# Position independent executable.
|
||||
pie_possible=yes]
|
||||
AC_MSG_CHECKING([whether `$CC' has `-fPIE' as default])
|
||||
# Is this a reliable test case?
|
||||
AC_LANG_CONFTEST([[
|
||||
#ifdef __PIE__
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#error NO __PIE__ DEFINED
|
||||
#endif
|
||||
]])
|
||||
|
||||
[# `$CC -c -o ...' might not be portable. But, oh, well... Is calling
|
||||
# `ac_compile' like this correct, after all?
|
||||
if eval "$ac_compile -S -o conftest.s" 2> /dev/null; then]
|
||||
AC_MSG_RESULT([yes])
|
||||
[# Should we clear up other files as well, having called `AC_LANG_CONFTEST'?
|
||||
rm -f conftest.s
|
||||
else
|
||||
pie_possible=no]
|
||||
AC_MSG_RESULT([no])
|
||||
[fi]
|
||||
])
|
||||
|
|
|
@ -74,7 +74,7 @@ grub_usb_control_msg (grub_usb_device_t dev,
|
|||
return grub_errno;
|
||||
}
|
||||
|
||||
/* Build a Setup packet. XXX: Endianess. */
|
||||
/* Build a Setup packet. XXX: Endianness. */
|
||||
setupdata.reqtype = reqtype;
|
||||
setupdata.request = request;
|
||||
setupdata.value = value;
|
||||
|
|
|
@ -681,6 +681,9 @@ grub_cmd_acpi (struct grub_extcmd *cmd,
|
|||
table->size = size;
|
||||
table->addr = buf;
|
||||
playground_size += table->size;
|
||||
|
||||
table->next = acpi_tables;
|
||||
acpi_tables = table;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include <grub/dl.h>
|
||||
#include <grub/device.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/pc_partition.h>
|
||||
#include <grub/msdos_partition.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
|
@ -60,7 +60,7 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)),
|
|||
int argc, char **args)
|
||||
{
|
||||
grub_device_t dev;
|
||||
struct grub_pc_partition_mbr mbr;
|
||||
struct grub_msdos_partition_mbr mbr;
|
||||
struct grub_partition *partition;
|
||||
grub_disk_addr_t first_sector;
|
||||
int numactive = 0;
|
||||
|
|
81
commands/keystatus.c
Normal file
81
commands/keystatus.c
Normal file
|
@ -0,0 +1,81 @@
|
|||
/* keystatus.c - Command to check key modifier status. */
|
||||
/*
|
||||
* 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/term.h>
|
||||
|
||||
static const struct grub_arg_option options[] =
|
||||
{
|
||||
{"shift", 's', 0, "check Shift key", 0, 0},
|
||||
{"ctrl", 'c', 0, "check Control key", 0, 0},
|
||||
{"alt", 'a', 0, "check Alt key", 0, 0},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
#define grub_cur_term_input grub_term_get_current_input ()
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_keystatus (grub_extcmd_t cmd,
|
||||
int argc __attribute__ ((unused)),
|
||||
char **args __attribute__ ((unused)))
|
||||
{
|
||||
struct grub_arg_list *state = cmd->state;
|
||||
int expect_mods = 0;
|
||||
int mods;
|
||||
|
||||
if (state[0].set)
|
||||
expect_mods |= GRUB_TERM_STATUS_SHIFT;
|
||||
if (state[1].set)
|
||||
expect_mods |= GRUB_TERM_STATUS_CTRL;
|
||||
if (state[2].set)
|
||||
expect_mods |= GRUB_TERM_STATUS_ALT;
|
||||
|
||||
/* Without arguments, just check whether getkeystatus is supported at
|
||||
all. */
|
||||
if (!grub_cur_term_input->getkeystatus)
|
||||
return grub_error (GRUB_ERR_TEST_FAILURE, "false");
|
||||
grub_dprintf ("keystatus", "expect_mods: %d\n", expect_mods);
|
||||
if (!expect_mods)
|
||||
return 0;
|
||||
|
||||
mods = grub_getkeystatus ();
|
||||
grub_dprintf ("keystatus", "mods: %d\n", mods);
|
||||
if (mods >= 0 && (mods & expect_mods) != 0)
|
||||
return 0;
|
||||
else
|
||||
return grub_error (GRUB_ERR_TEST_FAILURE, "false");
|
||||
}
|
||||
|
||||
static grub_extcmd_t cmd;
|
||||
|
||||
GRUB_MOD_INIT(keystatus)
|
||||
{
|
||||
cmd = grub_register_extcmd ("keystatus", grub_cmd_keystatus,
|
||||
GRUB_COMMAND_FLAG_BOTH,
|
||||
"keystatus [--shift] [--ctrl] [--alt]",
|
||||
"Check key modifier status",
|
||||
options);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(keystatus)
|
||||
{
|
||||
grub_unregister_extcmd (cmd);
|
||||
}
|
|
@ -242,7 +242,7 @@ check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
|
|||
part_start = 0;
|
||||
|
||||
buf = grub_envblk_buffer (envblk);
|
||||
for (p = blocklists, index = 0; p; p = p->next, index += p->length)
|
||||
for (p = blocklists, index = 0; p; index += p->length, p = p->next)
|
||||
{
|
||||
char blockbuf[GRUB_DISK_SECTOR_SIZE];
|
||||
|
||||
|
@ -278,7 +278,7 @@ write_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
|
|||
part_start = 0;
|
||||
|
||||
index = 0;
|
||||
for (p = blocklists; p; p = p->next, index += p->length)
|
||||
for (p = blocklists; p; index += p->length, p = p->next)
|
||||
{
|
||||
if (grub_disk_write (disk, p->sector - part_start,
|
||||
p->offset, p->length, buf + index))
|
||||
|
|
86
commands/password.c
Normal file
86
commands/password.c
Normal file
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* 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/auth.h>
|
||||
#include <grub/list.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/normal.h>
|
||||
#include <grub/dl.h>
|
||||
|
||||
static grub_dl_t my_mod;
|
||||
|
||||
static grub_err_t
|
||||
check_password (const char *user,
|
||||
void *password)
|
||||
{
|
||||
char entered[1024];
|
||||
|
||||
grub_memset (entered, 0, sizeof (entered));
|
||||
|
||||
if (!GRUB_GET_PASSWORD (entered, sizeof (entered) - 1))
|
||||
return GRUB_ACCESS_DENIED;
|
||||
|
||||
if (grub_auth_strcmp (entered, password) != 0)
|
||||
return GRUB_ACCESS_DENIED;
|
||||
|
||||
grub_auth_authenticate (user);
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_password (grub_command_t cmd __attribute__ ((unused)),
|
||||
int argc, char **args)
|
||||
{
|
||||
grub_err_t err;
|
||||
char *pass;
|
||||
|
||||
if (argc != 2)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Two arguments expected.");
|
||||
|
||||
pass = grub_strdup (args[1]);
|
||||
if (!pass)
|
||||
return grub_errno;
|
||||
|
||||
err = grub_auth_register_authentication (args[0], check_password, pass);
|
||||
if (err)
|
||||
{
|
||||
grub_free (pass);
|
||||
return err;
|
||||
}
|
||||
grub_dl_ref (my_mod);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_command_t cmd;
|
||||
|
||||
GRUB_MOD_INIT(password)
|
||||
{
|
||||
my_mod = mod;
|
||||
cmd = grub_register_command ("password", grub_cmd_password,
|
||||
"password USER PASSWORD",
|
||||
"Set user password (plaintext). "
|
||||
"Unrecommended and insecure.");
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(password)
|
||||
{
|
||||
grub_unregister_command (cmd);
|
||||
}
|
|
@ -51,6 +51,7 @@ search_fs (const char *key, const char *var, int no_floppy, enum options type)
|
|||
{
|
||||
int count = 0;
|
||||
char *buf = NULL;
|
||||
grub_fs_autoload_hook_t saved_autoload;
|
||||
|
||||
auto int iterate_device (const char *name);
|
||||
int iterate_device (const char *name)
|
||||
|
@ -131,7 +132,22 @@ search_fs (const char *key, const char *var, int no_floppy, enum options type)
|
|||
return (found && var);
|
||||
}
|
||||
|
||||
grub_device_iterate (iterate_device);
|
||||
/* First try without autoloading if we're setting variable. */
|
||||
if (var)
|
||||
{
|
||||
saved_autoload = grub_fs_autoload_hook;
|
||||
grub_fs_autoload_hook = 0;
|
||||
grub_device_iterate (iterate_device);
|
||||
|
||||
/* Restore autoload hook. */
|
||||
grub_fs_autoload_hook = saved_autoload;
|
||||
|
||||
/* Retry with autoload if nothing found. */
|
||||
if (grub_errno == GRUB_ERR_NONE && count == 0)
|
||||
grub_device_iterate (iterate_device);
|
||||
}
|
||||
else
|
||||
grub_device_iterate (iterate_device);
|
||||
|
||||
grub_free (buf);
|
||||
|
||||
|
|
|
@ -88,6 +88,13 @@ test_parse (char **args, int *argn, int argc)
|
|||
}
|
||||
|
||||
fs = grub_fs_probe (dev);
|
||||
if (! fs)
|
||||
{
|
||||
grub_free (device_name);
|
||||
grub_device_close (dev);
|
||||
return;
|
||||
}
|
||||
|
||||
pathname = grub_strchr (path, ')');
|
||||
if (! pathname)
|
||||
pathname = path;
|
||||
|
|
109
conf/common.rmk
109
conf/common.rmk
|
@ -17,9 +17,10 @@ grub_probe_SOURCES = util/grub-probe.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/befs.c fs/tar.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/pc.c partmap/apple.c partmap/sun.c partmap/gpt.c\
|
||||
partmap/msdos.c partmap/apple.c partmap/sun.c partmap/gpt.c\
|
||||
kern/fs.c kern/env.c fs/fshelp.c \
|
||||
disk/raid.c disk/mdraid_linux.c disk/lvm.c grub_probe_init.c
|
||||
|
||||
|
@ -38,9 +39,10 @@ grub_fstest_SOURCES = util/grub-fstest.c util/hostfs.c util/misc.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/befs.c fs/tar.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 \
|
||||
\
|
||||
kern/partition.c partmap/pc.c partmap/apple.c partmap/sun.c \
|
||||
kern/partition.c partmap/msdos.c partmap/apple.c partmap/sun.c \
|
||||
partmap/gpt.c \
|
||||
kern/fs.c kern/env.c fs/fshelp.c disk/raid.c \
|
||||
disk/raid5_recover.c disk/raid6_recover.c \
|
||||
|
@ -117,21 +119,14 @@ bin_UTILITIES += grub-editenv
|
|||
grub_editenv_SOURCES = util/grub-editenv.c lib/envblk.c util/misc.c kern/misc.c kern/err.c
|
||||
CLEANFILES += grub-editenv
|
||||
|
||||
# for grub-pe2elf
|
||||
ifeq ($(enable_grub_pe2elf), yes)
|
||||
bin_UTILITIES += grub-pe2elf
|
||||
# Needed for genmk.rb to work
|
||||
ifeq (0,1)
|
||||
bin_UTILITIES += grub-macho2img grub-pe2elf
|
||||
endif
|
||||
|
||||
grub_pe2elf_SOURCES = util/grub-pe2elf.c util/misc.c
|
||||
CLEANFILES += grub-pe2elf
|
||||
|
||||
# grub_macho2img assumes a lot about source file.
|
||||
# So installing it definitively is useless
|
||||
# But adding to bin_UTILITIES is needed for
|
||||
# genmk.rb to work
|
||||
ifeq (0,1)
|
||||
bin_UTILITIES += grub-macho2img
|
||||
endif
|
||||
grub_macho2img_SOURCES = util/grub-macho2img.c
|
||||
CLEANFILES += grub-macho2img
|
||||
|
||||
|
@ -177,7 +172,7 @@ CLEANFILES += grub-dumpbios
|
|||
pkglib_MODULES += fshelp.mod fat.mod ufs1.mod ufs2.mod ext2.mod ntfs.mod \
|
||||
ntfscomp.mod minix.mod hfs.mod jfs.mod iso9660.mod xfs.mod \
|
||||
affs.mod sfs.mod hfsplus.mod reiserfs.mod cpio.mod tar.mod \
|
||||
udf.mod afs.mod befs.mod
|
||||
udf.mod afs.mod afs_be.mod befs.mod befs_be.mod
|
||||
|
||||
# For fshelp.mod.
|
||||
fshelp_mod_SOURCES = fs/fshelp.c
|
||||
|
@ -279,43 +274,52 @@ afs_mod_SOURCES = fs/afs.c
|
|||
afs_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
afs_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For afs_be.mod.
|
||||
afs_be_mod_SOURCES = fs/afs_be.c
|
||||
afs_be_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
afs_be_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For befs.mod.
|
||||
befs_mod_SOURCES = fs/befs.c
|
||||
befs_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
befs_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For befs_be.mod.
|
||||
befs_be_mod_SOURCES = fs/befs_be.c
|
||||
befs_be_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
befs_be_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# Partition maps.
|
||||
pkglib_MODULES += amiga.mod apple.mod pc.mod sun.mod acorn.mod gpt.mod
|
||||
|
||||
# For amiga.mod
|
||||
amiga_mod_SOURCES = partmap/amiga.c
|
||||
amiga_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
amiga_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
pkglib_MODULES += part_amiga.mod
|
||||
part_amiga_mod_SOURCES = partmap/amiga.c
|
||||
part_amiga_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
part_amiga_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For apple.mod
|
||||
apple_mod_SOURCES = partmap/apple.c
|
||||
apple_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
apple_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
pkglib_MODULES += part_apple.mod
|
||||
part_apple_mod_SOURCES = partmap/apple.c
|
||||
part_apple_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
part_apple_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For pc.mod
|
||||
pc_mod_SOURCES = partmap/pc.c
|
||||
pc_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
pc_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
pkglib_MODULES += part_msdos.mod
|
||||
part_msdos_mod_SOURCES = partmap/msdos.c
|
||||
part_msdos_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
part_msdos_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For sun.mod
|
||||
sun_mod_SOURCES = partmap/sun.c
|
||||
sun_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
sun_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
pkglib_MODULES += part_sun.mod
|
||||
part_sun_mod_SOURCES = partmap/sun.c
|
||||
part_sun_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
part_sun_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For acorn.mod
|
||||
acorn_mod_SOURCES = partmap/acorn.c
|
||||
acorn_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
acorn_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
pkglib_MODULES += part_acorn.mod
|
||||
part_acorn_mod_SOURCES = partmap/acorn.c
|
||||
part_acorn_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
part_acorn_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For gpt.mod
|
||||
gpt_mod_SOURCES = partmap/gpt.c
|
||||
gpt_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
gpt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
pkglib_MODULES += part_gpt.mod
|
||||
part_gpt_mod_SOURCES = partmap/gpt.c
|
||||
part_gpt_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
part_gpt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# Special disk structures and generic drivers
|
||||
|
||||
|
@ -363,8 +367,14 @@ pkglib_MODULES += minicmd.mod extcmd.mod hello.mod handler.mod \
|
|||
fs_file.mod fs_uuid.mod configfile.mod echo.mod \
|
||||
terminfo.mod test.mod blocklist.mod hexdump.mod \
|
||||
read.mod sleep.mod loadenv.mod crc.mod parttool.mod \
|
||||
pcpart.mod memrw.mod normal.mod sh.mod lua.mod \
|
||||
gptsync.mod true.mod probe.mod
|
||||
msdospart.mod memrw.mod normal.mod sh.mod lua.mod \
|
||||
gptsync.mod true.mod probe.mod password.mod \
|
||||
keystatus.mod
|
||||
|
||||
# For password.mod.
|
||||
password_mod_SOURCES = commands/password.c
|
||||
password_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
password_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For gptsync.mod.
|
||||
gptsync_mod_SOURCES = commands/gptsync.c
|
||||
|
@ -391,10 +401,10 @@ parttool_mod_SOURCES = commands/parttool.c
|
|||
parttool_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
parttool_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For pcpart.mod.
|
||||
pcpart_mod_SOURCES = parttool/pcpart.c
|
||||
pcpart_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
pcpart_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
# For msdospart.mod.
|
||||
msdospart_mod_SOURCES = parttool/msdospart.c
|
||||
msdospart_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
msdospart_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For handler.mod.
|
||||
handler_mod_SOURCES = commands/handler.c
|
||||
|
@ -506,9 +516,14 @@ probe_mod_SOURCES = commands/probe.c
|
|||
probe_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
probe_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For keystatus.mod.
|
||||
keystatus_mod_SOURCES = commands/keystatus.c
|
||||
keystatus_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
keystatus_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For normal.mod.
|
||||
normal_mod_SOURCES = normal/main.c normal/cmdline.c normal/dyncmd.c \
|
||||
normal/autofs.c normal/handler.c \
|
||||
normal/auth.c normal/autofs.c normal/handler.c \
|
||||
normal/color.c normal/completion.c normal/datetime.c normal/menu.c \
|
||||
normal/menu_entry.c normal/menu_text.c normal/menu_viewer.c \
|
||||
normal/misc.c
|
||||
|
|
|
@ -32,7 +32,7 @@ kernel_img_SOURCES = kern/i386/coreboot/startup.S \
|
|||
symlist.c
|
||||
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 pc_partition.h reader.h symbol.h term.h time.h types.h \
|
||||
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
||||
machine/boot.h machine/console.h machine/init.h \
|
||||
machine/memory.h machine/loader.h list.h handler.h command.h
|
||||
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
@ -75,7 +75,7 @@ kernel_img_SOURCES = kern/i386/qemu/startup.S \
|
|||
symlist.c
|
||||
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 pc_partition.h reader.h symbol.h term.h time.h types.h \
|
||||
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
||||
machine/boot.h machine/console.h machine/init.h \
|
||||
machine/memory.h machine/loader.h list.h handler.h command.h
|
||||
kernel_img_CFLAGS = $(COMMON_CFLAGS) -DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)
|
||||
|
@ -110,13 +110,16 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
|
|||
commands/handler.c commands/ls.c commands/test.c \
|
||||
commands/search.c commands/blocklist.c commands/hexdump.c \
|
||||
commands/gptsync.c commands/probe.c commands/xnu_uuid.c \
|
||||
commands/password.c commands/keystatus.c \
|
||||
lib/hexdump.c commands/i386/cpuid.c \
|
||||
lib/envblk.c commands/loadenv.c \
|
||||
disk/host.c disk/loopback.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/befs.c fs/tar.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/fshelp.c \
|
||||
io/gzio.c \
|
||||
|
@ -127,21 +130,21 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
|
|||
kern/partition.c kern/reader.c kern/term.c \
|
||||
kern/rescue_reader.c kern/rescue_parser.c \
|
||||
lib/arg.c normal/cmdline.c normal/misc.c \
|
||||
normal/handler.c normal/autofs.c \
|
||||
normal/handler.c normal/auth.c normal/autofs.c \
|
||||
normal/completion.c normal/datetime.c normal/main.c \
|
||||
normal/menu_text.c \
|
||||
normal/menu.c normal/menu_entry.c normal/menu_viewer.c \
|
||||
normal/color.c \
|
||||
script/sh/main.c script/sh/execute.c script/sh/function.c \
|
||||
script/sh/lexer.c script/sh/script.c grub_script.tab.c \
|
||||
partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c \
|
||||
partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \
|
||||
partmap/acorn.c partmap/gpt.c \
|
||||
util/console.c util/hostfs.c util/grub-emu.c util/misc.c \
|
||||
util/hostdisk.c util/getroot.c \
|
||||
\
|
||||
disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \
|
||||
disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
|
||||
commands/parttool.c parttool/pcpart.c \
|
||||
commands/parttool.c parttool/msdospart.c \
|
||||
grub_emu_init.c
|
||||
|
||||
grub_emu_LDFLAGS = $(LIBCURSES)
|
||||
|
@ -203,6 +206,13 @@ 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 play.mod.
|
||||
play_mod_SOURCES = commands/i386/pc/play.c
|
||||
play_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
|
|
@ -23,7 +23,7 @@ util/i386/efi/grub-mkimage.c_DEPENDENCIES = Makefile
|
|||
#grub_setup_SOURCES = util/i386/pc/grub-setup.c util/hostdisk.c \
|
||||
# util/misc.c util/getroot.c kern/device.c kern/disk.c \
|
||||
# kern/err.c kern/misc.c fs/fat.c fs/ext2.c fs/xfs.c fs/affs.c \
|
||||
# fs/sfs.c kern/parser.c kern/partition.c partmap/pc.c \
|
||||
# fs/sfs.c kern/parser.c kern/partition.c partmap/msdos.c \
|
||||
# fs/ufs.c fs/ufs2.c fs/minix.c fs/hfs.c fs/jfs.c fs/hfsplus.c kern/file.c \
|
||||
# kern/fs.c kern/env.c fs/fshelp.c
|
||||
|
||||
|
@ -37,14 +37,17 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
|
|||
commands/configfile.c commands/help.c \
|
||||
commands/handler.c commands/ls.c commands/test.c \
|
||||
commands/search.c commands/hexdump.c lib/hexdump.c \
|
||||
commands/halt.c commands/reboot.c \
|
||||
commands/halt.c commands/reboot.c commands/keystatus.c \
|
||||
commands/i386/cpuid.c \
|
||||
commands/password.c \
|
||||
lib/envblk.c commands/loadenv.c \
|
||||
disk/loopback.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/befs.c fs/tar.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 \
|
||||
\
|
||||
io/gzio.c \
|
||||
kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \
|
||||
|
@ -54,21 +57,21 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
|
|||
kern/partition.c kern/reader.c kern/term.c \
|
||||
kern/rescue_reader.c kern/rescue_parser.c \
|
||||
lib/arg.c normal/cmdline.c normal/command.c normal/datetime.c \
|
||||
normal/autofs.c \
|
||||
normal/auth.c normal/autofs.c \
|
||||
normal/completion.c normal/context.c normal/main.c \
|
||||
normal/menu.c normal/menu_entry.c normal/menu_viewer.c \
|
||||
normal/menu_text.c \
|
||||
normal/color.c \
|
||||
script/sh/main.c script/sh/execute.c script/sh/function.c \
|
||||
script/sh/lexer.c script/sh/script.c grub_script.tab.c \
|
||||
partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c \
|
||||
partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \
|
||||
partmap/acorn.c partmap/gpt.c \
|
||||
util/console.c util/hostfs.c util/grub-emu.c util/misc.c \
|
||||
util/hostdisk.c util/getroot.c \
|
||||
\
|
||||
disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \
|
||||
disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
|
||||
commands/parttool.c parttool/pcpart.c \
|
||||
commands/parttool.c parttool/msdospart.c \
|
||||
grub_emu_init.c
|
||||
|
||||
grub_emu_LDFLAGS = $(LIBCURSES)
|
||||
|
@ -100,7 +103,7 @@ kernel_mod_SOURCES = kern/i386/efi/startup.S kern/main.c kern/device.c \
|
|||
kern/generic/millisleep.c
|
||||
kernel_mod_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
||||
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
|
||||
partition.h pc_partition.h reader.h symbol.h term.h time.h types.h \
|
||||
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
||||
efi/efi.h efi/time.h efi/disk.h i386/pit.h list.h handler.h command.h
|
||||
kernel_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
kernel_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
|
|
|
@ -31,7 +31,7 @@ kernel_img_SOURCES = kern/i386/ieee1275/startup.S \
|
|||
symlist.c
|
||||
kernel_img_HEADERS = cache.h device.h disk.h dl.h elf.h elfload.h \
|
||||
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
|
||||
partition.h pc_partition.h reader.h symbol.h term.h time.h types.h \
|
||||
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
||||
ieee1275/ieee1275.h machine/kernel.h machine/loader.h machine/memory.h \
|
||||
list.h handler.h command.h
|
||||
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
@ -64,14 +64,17 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
|
|||
commands/handler.c commands/ls.c commands/test.c \
|
||||
commands/search.c commands/blocklist.c commands/hexdump.c \
|
||||
lib/hexdump.c commands/halt.c commands/reboot.c \
|
||||
lib/envblk.c commands/loadenv.c \
|
||||
commands/gptsync.c commands/probe.c commands/xnu_uuid.c \
|
||||
commands/i386/cpuid.c \
|
||||
commands/password.c commands/keystatus.c \
|
||||
disk/host.c disk/loopback.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/befs.c fs/tar.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/fshelp.c \
|
||||
io/gzio.c \
|
||||
|
@ -82,13 +85,13 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
|
|||
kern/partition.c kern/reader.c kern/term.c \
|
||||
kern/rescue_reader.c kern/rescue_parser.c \
|
||||
lib/arg.c normal/cmdline.c normal/datetime.c normal/misc.c \
|
||||
normal/handler.c normal/autofs.c \
|
||||
normal/handler.c normal/auth.c normal/autofs.c \
|
||||
normal/completion.c normal/main.c normal/menu_text.c \
|
||||
normal/menu.c normal/menu_entry.c normal/menu_viewer.c \
|
||||
normal/color.c \
|
||||
script/sh/main.c script/sh/execute.c script/sh/function.c \
|
||||
script/sh/lexer.c script/sh/script.c grub_script.tab.c \
|
||||
partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c \
|
||||
partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \
|
||||
partmap/acorn.c partmap/gpt.c \
|
||||
util/console.c util/hostfs.c util/grub-emu.c util/misc.c \
|
||||
util/hostdisk.c util/getroot.c \
|
||||
|
|
|
@ -61,7 +61,7 @@ kernel_img_SOURCES = kern/i386/pc/startup.S \
|
|||
symlist.c
|
||||
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 pc_partition.h reader.h symbol.h term.h time.h types.h \
|
||||
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
||||
machine/biosdisk.h machine/boot.h machine/console.h machine/init.h \
|
||||
machine/memory.h machine/loader.h machine/vga.h machine/vbe.h \
|
||||
machine/kernel.h machine/pxe.h i386/pit.h list.h handler.h command.h
|
||||
|
@ -102,9 +102,10 @@ grub_setup_SOURCES = util/i386/pc/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/befs.c fs/tar.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/pc.c partmap/gpt.c \
|
||||
partmap/msdos.c partmap/gpt.c \
|
||||
\
|
||||
disk/raid.c disk/mdraid_linux.c disk/lvm.c \
|
||||
util/raid.c util/lvm.c \
|
||||
|
@ -121,8 +122,10 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
|
|||
commands/handler.c commands/ls.c commands/test.c \
|
||||
commands/search.c commands/blocklist.c commands/hexdump.c \
|
||||
lib/hexdump.c commands/i386/pc/halt.c commands/reboot.c \
|
||||
lib/envblk.c commands/loadenv.c \
|
||||
commands/gptsync.c commands/probe.c commands/xnu_uuid.c \
|
||||
commands/i386/cpuid.c \
|
||||
commands/password.c commands/keystatus.c \
|
||||
disk/host.c disk/loopback.c disk/scsi.c \
|
||||
fs/fshelp.c \
|
||||
\
|
||||
|
@ -134,26 +137,27 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
|
|||
kern/partition.c kern/reader.c kern/term.c \
|
||||
kern/rescue_reader.c kern/rescue_parser.c \
|
||||
lib/arg.c normal/cmdline.c normal/datetime.c normal/misc.c \
|
||||
normal/handler.c normal/autofs.c \
|
||||
normal/handler.c normal/auth.c normal/autofs.c \
|
||||
normal/completion.c normal/main.c normal/color.c \
|
||||
normal/menu.c normal/menu_entry.c normal/menu_viewer.c \
|
||||
normal/menu_text.c \
|
||||
script/sh/main.c script/sh/execute.c script/sh/function.c \
|
||||
script/sh/lexer.c script/sh/script.c grub_script.tab.c \
|
||||
partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c \
|
||||
partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \
|
||||
partmap/acorn.c partmap/gpt.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/befs.c fs/tar.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 \
|
||||
\
|
||||
util/console.c util/hostfs.c util/grub-emu.c util/misc.c \
|
||||
util/hostdisk.c util/getroot.c \
|
||||
\
|
||||
disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \
|
||||
disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
|
||||
commands/parttool.c parttool/pcpart.c \
|
||||
commands/parttool.c parttool/msdospart.c \
|
||||
grub_emu_init.c
|
||||
|
||||
grub_emu_LDFLAGS = $(LIBCURSES)
|
||||
|
|
|
@ -16,7 +16,7 @@ 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 misc.h mm.h net.h parser.h reader.h \
|
||||
symbol.h term.h time.h types.h powerpc/libgcc.h loader.h partition.h \
|
||||
pc_partition.h ieee1275/ieee1275.h machine/kernel.h handler.h list.h \
|
||||
msdos_partition.h ieee1275/ieee1275.h machine/kernel.h handler.h list.h \
|
||||
command.h
|
||||
|
||||
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
|
||||
|
@ -45,13 +45,16 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
|
|||
commands/search.c commands/handler.c commands/test.c \
|
||||
commands/ls.c commands/blocklist.c commands/hexdump.c \
|
||||
lib/hexdump.c commands/halt.c commands/reboot.c \
|
||||
lib/envblk.c commands/loadenv.c \
|
||||
commands/gptsync.c commands/probe.c commands/xnu_uuid.c \
|
||||
commands/password.c commands/keystatus.c \
|
||||
disk/loopback.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/befs.c fs/tar.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 \
|
||||
\
|
||||
io/gzio.c \
|
||||
kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \
|
||||
|
@ -62,21 +65,21 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
|
|||
kern/command.c kern/corecmd.c commands/extcmd.c \
|
||||
lib/arg.c normal/cmdline.c normal/datetime.c \
|
||||
normal/completion.c normal/misc.c \
|
||||
normal/handler.c normal/autofs.c normal/main.c \
|
||||
normal/handler.c normal/auth.c normal/autofs.c normal/main.c \
|
||||
normal/menu.c \
|
||||
normal/menu_text.c \
|
||||
normal/menu_entry.c normal/menu_viewer.c \
|
||||
normal/color.c \
|
||||
script/sh/main.c script/sh/execute.c script/sh/function.c \
|
||||
script/sh/lexer.c script/sh/script.c \
|
||||
partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c \
|
||||
partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \
|
||||
partmap/acorn.c \
|
||||
util/console.c util/hostfs.c util/grub-emu.c util/misc.c \
|
||||
util/hostdisk.c util/getroot.c \
|
||||
\
|
||||
disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \
|
||||
disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
|
||||
commands/parttool.c parttool/pcpart.c \
|
||||
commands/parttool.c parttool/msdospart.c \
|
||||
grub_script.tab.c grub_emu_init.c
|
||||
|
||||
grub_emu_LDFLAGS = $(LIBCURSES)
|
||||
|
|
|
@ -28,7 +28,7 @@ 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 pc_partition.h reader.h symbol.h term.h time.h types.h \
|
||||
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
||||
list.h handler.h command.h \
|
||||
sparc64/libgcc.h ieee1275/ieee1275.h machine/kernel.h \
|
||||
sparc64/ieee1275/ieee1275.h
|
||||
|
@ -78,9 +78,10 @@ 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/befs.c fs/tar.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/pc.c \
|
||||
partmap/amiga.c partmap/apple.c partmap/msdos.c \
|
||||
partmap/sun.c partmap/acorn.c \
|
||||
\
|
||||
disk/raid.c disk/mdraid_linux.c disk/lvm.c \
|
||||
|
@ -102,13 +103,16 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
|
|||
commands/search.c commands/handler.c commands/test.c \
|
||||
commands/ls.c commands/blocklist.c commands/hexdump.c \
|
||||
lib/hexdump.c commands/halt.c commands/reboot.c \
|
||||
lib/envblk.c commands/loadenv.c \
|
||||
commands/gptsync.c commands/probe.c commands/xnu_uuid.c \
|
||||
commands/password.c commands/keystatus.c \
|
||||
disk/loopback.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/befs.c fs/tar.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 \
|
||||
\
|
||||
io/gzio.c \
|
||||
kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \
|
||||
|
@ -119,21 +123,21 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
|
|||
kern/command.c kern/corecmd.c commands/extcmd.c \
|
||||
lib/arg.c normal/cmdline.c normal/datetime.c \
|
||||
normal/completion.c normal/misc.c \
|
||||
normal/handler.c normal/autofs.c normal/main.c \
|
||||
normal/handler.c normal/auth.c normal/autofs.c normal/main.c \
|
||||
normal/menu.c \
|
||||
normal/menu_text.c \
|
||||
normal/menu_entry.c normal/menu_viewer.c \
|
||||
normal/color.c \
|
||||
script/sh/main.c script/sh/execute.c script/sh/function.c \
|
||||
script/sh/lexer.c script/sh/script.c \
|
||||
partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c \
|
||||
partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \
|
||||
partmap/acorn.c \
|
||||
util/console.c util/hostfs.c util/grub-emu.c util/misc.c \
|
||||
util/hostdisk.c util/getroot.c \
|
||||
\
|
||||
disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \
|
||||
disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
|
||||
commands/parttool.c parttool/pcpart.c \
|
||||
commands/parttool.c parttool/msdospart.c \
|
||||
grub_script.tab.c grub_emu_init.c
|
||||
|
||||
grub_emu_LDFLAGS = $(LIBCURSES)
|
||||
|
|
|
@ -22,7 +22,7 @@ grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \
|
|||
#grub_setup_SOURCES = util/i386/pc/grub-setup.c util/hostdisk.c \
|
||||
# util/misc.c util/getroot.c kern/device.c kern/disk.c \
|
||||
# kern/err.c kern/misc.c fs/fat.c fs/ext2.c fs/xfs.c fs/affs.c \
|
||||
# fs/sfs.c kern/parser.c kern/partition.c partmap/pc.c \
|
||||
# fs/sfs.c kern/parser.c kern/partition.c partmap/msdos.c \
|
||||
# fs/ufs.c fs/ufs2.c fs/minix.c fs/hfs.c fs/jfs.c fs/hfsplus.c kern/file.c \
|
||||
# kern/fs.c kern/env.c fs/fshelp.c
|
||||
|
||||
|
@ -37,12 +37,14 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
|
|||
commands/search.c commands/hexdump.c lib/hexdump.c \
|
||||
commands/halt.c commands/reboot.c \
|
||||
commands/i386/cpuid.c \
|
||||
commands/password.c commands/keystatus.c \
|
||||
lib/envblk.c commands/loadenv.c \
|
||||
disk/loopback.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/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
|
||||
\
|
||||
io/gzio.c \
|
||||
kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \
|
||||
|
@ -50,7 +52,8 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
|
|||
kern/command.c kern/corecmd.c commands/extcmd.c kern/file.c \
|
||||
kern/fs.c commands/boot.c kern/main.c kern/misc.c kern/parser.c \
|
||||
kern/partition.c kern/readerescue.c kern/term.c \
|
||||
lib/arg.c normal/cmdline.c normal/misc.c normal/autofs.c \
|
||||
lib/arg.c normal/cmdline.c normal/misc.c normal/auth.c \
|
||||
normal/autofs.c \
|
||||
normal/completion.c normal/datetime.c normal/context.c \
|
||||
normal/main.c \
|
||||
normal/menu.c normal/menu_entry.c normal/menu_viewer.c \
|
||||
|
@ -58,14 +61,14 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
|
|||
normal/color.c \
|
||||
script/sh/main.c script/sh/execute.c script/sh/function.c \
|
||||
script/sh/lexer.c script/sh/script.c grub_script.tab.c \
|
||||
partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c \
|
||||
partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \
|
||||
partmap/acorn.c partmap/gpt.c \
|
||||
util/console.c util/hostfs.c util/grub-emu.c util/misc.c \
|
||||
util/hostdisk.c util/getroot.c \
|
||||
\
|
||||
disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \
|
||||
disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
|
||||
commands/parttool.c parttool/pcpart.c \
|
||||
commands/parttool.c parttool/msdospart.c \
|
||||
grub_emu_init.c
|
||||
|
||||
grub_emu_LDFLAGS = $(LIBCURSES)
|
||||
|
@ -97,7 +100,7 @@ kernel_mod_SOURCES = kern/x86_64/efi/startup.S kern/x86_64/efi/callwrap.S \
|
|||
term/efi/console.c disk/efi/efidisk.c
|
||||
kernel_mod_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
||||
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
|
||||
partition.h pc_partition.h reader.h symbol.h term.h time.h types.h \
|
||||
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
||||
efi/efi.h efi/time.h efi/disk.h machine/loader.h i386/pit.h list.h \
|
||||
handler.h command.h
|
||||
kernel_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
|
81
config.guess
vendored
81
config.guess
vendored
|
@ -1,10 +1,10 @@
|
|||
#! /bin/sh
|
||||
# Attempt to guess a canonical system name.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2008-12-19'
|
||||
timestamp='2009-08-19'
|
||||
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
|
@ -27,16 +27,16 @@ timestamp='2008-12-19'
|
|||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
|
||||
# Originally written by Per Bothner <per@bothner.com>.
|
||||
# Please send patches to <config-patches@gnu.org>. Submit a context
|
||||
# diff and a properly formatted ChangeLog entry.
|
||||
# Originally written by Per Bothner. Please send patches (context
|
||||
# diff format) to <config-patches@gnu.org> and include a ChangeLog
|
||||
# entry.
|
||||
#
|
||||
# This script attempts to guess a canonical system name similar to
|
||||
# config.sub. If it succeeds, it prints the system name on stdout, and
|
||||
# exits with 0. Otherwise, it exits with 1.
|
||||
#
|
||||
# The plan is that this can be called by configure scripts if you
|
||||
# don't specify an explicit build system type.
|
||||
# You can get the latest version of this script from:
|
||||
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
|
||||
|
||||
me=`echo "$0" | sed -e 's,.*/,,'`
|
||||
|
||||
|
@ -170,7 +170,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
|
||||
eval $set_cc_for_build
|
||||
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||
| grep __ELF__ >/dev/null
|
||||
| grep -q __ELF__
|
||||
then
|
||||
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
|
||||
# Return netbsd for either. FIX?
|
||||
|
@ -324,6 +324,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||
case `/usr/bin/uname -p` in
|
||||
sparc) echo sparc-icl-nx7; exit ;;
|
||||
esac ;;
|
||||
s390x:SunOS:*:*)
|
||||
echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit ;;
|
||||
sun4H:SunOS:5.*:*)
|
||||
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit ;;
|
||||
|
@ -653,7 +656,7 @@ EOF
|
|||
# => hppa64-hp-hpux11.23
|
||||
|
||||
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
|
||||
grep __LP64__ >/dev/null
|
||||
grep -q __LP64__
|
||||
then
|
||||
HP_ARCH="hppa2.0w"
|
||||
else
|
||||
|
@ -819,6 +822,9 @@ EOF
|
|||
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
|
||||
echo i${UNAME_MACHINE}-pc-mks
|
||||
exit ;;
|
||||
8664:Windows_NT:*)
|
||||
echo x86_64-pc-mks
|
||||
exit ;;
|
||||
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
|
||||
# How do we know it's Interix rather than the generic POSIX subsystem?
|
||||
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
|
||||
|
@ -879,40 +885,17 @@ EOF
|
|||
m68*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
mips:Linux:*:*)
|
||||
mips:Linux:*:* | mips64:Linux:*:*)
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
#undef CPU
|
||||
#undef mips
|
||||
#undef mipsel
|
||||
#undef ${UNAME_MACHINE}
|
||||
#undef ${UNAME_MACHINE}el
|
||||
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
|
||||
CPU=mipsel
|
||||
CPU=${UNAME_MACHINE}el
|
||||
#else
|
||||
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
|
||||
CPU=mips
|
||||
#else
|
||||
CPU=
|
||||
#endif
|
||||
#endif
|
||||
EOF
|
||||
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
|
||||
/^CPU/{
|
||||
s: ::g
|
||||
p
|
||||
}'`"
|
||||
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
|
||||
;;
|
||||
mips64:Linux:*:*)
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
#undef CPU
|
||||
#undef mips64
|
||||
#undef mips64el
|
||||
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
|
||||
CPU=mips64el
|
||||
#else
|
||||
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
|
||||
CPU=mips64
|
||||
CPU=${UNAME_MACHINE}
|
||||
#else
|
||||
CPU=
|
||||
#endif
|
||||
|
@ -944,7 +927,7 @@ EOF
|
|||
EV67) UNAME_MACHINE=alphaev67 ;;
|
||||
EV68*) UNAME_MACHINE=alphaev68 ;;
|
||||
esac
|
||||
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
|
||||
objdump --private-headers /bin/sh | grep -q ld.so.1
|
||||
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
|
||||
exit ;;
|
||||
|
@ -998,14 +981,6 @@ EOF
|
|||
elf32-i386)
|
||||
TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
|
||||
;;
|
||||
a.out-i386-linux)
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
|
||||
exit ;;
|
||||
"")
|
||||
# Either a pre-BFD a.out linker (linux-gnuoldld) or
|
||||
# one that does not give us useful --help.
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
|
||||
exit ;;
|
||||
esac
|
||||
# Determine whether the default compiler is a.out or elf
|
||||
eval $set_cc_for_build
|
||||
|
@ -1071,7 +1046,7 @@ EOF
|
|||
i*86:syllable:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-syllable
|
||||
exit ;;
|
||||
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
|
||||
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
|
||||
echo i386-unknown-lynxos${UNAME_RELEASE}
|
||||
exit ;;
|
||||
i*86:*DOS:*:*)
|
||||
|
@ -1115,8 +1090,11 @@ EOF
|
|||
pc:*:*:*)
|
||||
# Left here for compatibility:
|
||||
# uname -m prints for DJGPP always 'pc', but it prints nothing about
|
||||
# the processor, so we play safe by assuming i386.
|
||||
echo i386-pc-msdosdjgpp
|
||||
# the processor, so we play safe by assuming i586.
|
||||
# Note: whatever this is, it MUST be the same as what config.sub
|
||||
# prints for the "djgpp" host, or else GDB configury will decide that
|
||||
# this is a cross-build.
|
||||
echo i586-pc-msdosdjgpp
|
||||
exit ;;
|
||||
Intel:Mach:3*:*)
|
||||
echo i386-pc-mach3
|
||||
|
@ -1176,7 +1154,7 @@ EOF
|
|||
rs6000:LynxOS:2.*:*)
|
||||
echo rs6000-unknown-lynxos${UNAME_RELEASE}
|
||||
exit ;;
|
||||
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
|
||||
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
|
||||
echo powerpc-unknown-lynxos${UNAME_RELEASE}
|
||||
exit ;;
|
||||
SM[BE]S:UNIX_SV:*:*)
|
||||
|
@ -1350,6 +1328,9 @@ EOF
|
|||
i*86:rdos:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-rdos
|
||||
exit ;;
|
||||
i*86:AROS:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-aros
|
||||
exit ;;
|
||||
esac
|
||||
|
||||
#echo '(No uname command or uname output not recognized.)' 1>&2
|
||||
|
|
34
config.sub
vendored
34
config.sub
vendored
|
@ -1,10 +1,10 @@
|
|||
#! /bin/sh
|
||||
# Configuration validation subroutine script.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2009-01-19'
|
||||
timestamp='2009-08-19'
|
||||
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
|
@ -32,13 +32,16 @@ timestamp='2009-01-19'
|
|||
|
||||
|
||||
# Please send patches to <config-patches@gnu.org>. Submit a context
|
||||
# diff and a properly formatted ChangeLog entry.
|
||||
# diff and a properly formatted GNU ChangeLog entry.
|
||||
#
|
||||
# Configuration subroutine to validate and canonicalize a configuration type.
|
||||
# Supply the specified configuration type as an argument.
|
||||
# If it is invalid, we print an error message on stderr and exit with code 1.
|
||||
# Otherwise, we print the canonical config type on stdout and succeed.
|
||||
|
||||
# You can get the latest version of this script from:
|
||||
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
|
||||
|
||||
# This file is supposed to be the same for all GNU packages
|
||||
# and recognize all the CPU types, system types and aliases
|
||||
# that are meaningful with *any* GNU software.
|
||||
|
@ -149,10 +152,13 @@ case $os in
|
|||
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
||||
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
||||
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
||||
-apple | -axis | -knuth | -cray)
|
||||
-apple | -axis | -knuth | -cray | -microblaze)
|
||||
os=
|
||||
basic_machine=$1
|
||||
;;
|
||||
-bluegene*)
|
||||
os=-cnk
|
||||
;;
|
||||
-sim | -cisco | -oki | -wec | -winbond)
|
||||
os=
|
||||
basic_machine=$1
|
||||
|
@ -272,6 +278,7 @@ case $basic_machine in
|
|||
| mipsisa64sr71k | mipsisa64sr71kel \
|
||||
| mipstx39 | mipstx39el \
|
||||
| mn10200 | mn10300 \
|
||||
| moxie \
|
||||
| mt \
|
||||
| msp430 \
|
||||
| nios | nios2 \
|
||||
|
@ -336,7 +343,7 @@ case $basic_machine in
|
|||
| lm32-* \
|
||||
| m32c-* | m32r-* | m32rle-* \
|
||||
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
|
||||
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
|
||||
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
|
||||
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
|
||||
| mips16-* \
|
||||
| mips64-* | mips64el-* \
|
||||
|
@ -446,6 +453,10 @@ case $basic_machine in
|
|||
basic_machine=m68k-apollo
|
||||
os=-bsd
|
||||
;;
|
||||
aros)
|
||||
basic_machine=i386-pc
|
||||
os=-aros
|
||||
;;
|
||||
aux)
|
||||
basic_machine=m68k-apple
|
||||
os=-aux
|
||||
|
@ -462,6 +473,10 @@ case $basic_machine in
|
|||
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
os=-linux
|
||||
;;
|
||||
bluegene*)
|
||||
basic_machine=powerpc-ibm
|
||||
os=-cnk
|
||||
;;
|
||||
c90)
|
||||
basic_machine=c90-cray
|
||||
os=-unicos
|
||||
|
@ -714,6 +729,9 @@ case $basic_machine in
|
|||
basic_machine=ns32k-utek
|
||||
os=-sysv
|
||||
;;
|
||||
microblaze)
|
||||
basic_machine=microblaze-xilinx
|
||||
;;
|
||||
mingw32)
|
||||
basic_machine=i386-pc
|
||||
os=-mingw32
|
||||
|
@ -1255,11 +1273,11 @@ case $os in
|
|||
# Each alternative MUST END IN A *, to match a version number.
|
||||
# -sysv* is not here because it comes later, after sysvr4.
|
||||
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
||||
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
|
||||
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
|
||||
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
|
||||
| -kopensolaris* \
|
||||
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
|
||||
| -aos* \
|
||||
| -aos* | -aros* \
|
||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
|
||||
|
@ -1608,7 +1626,7 @@ case $basic_machine in
|
|||
-sunos*)
|
||||
vendor=sun
|
||||
;;
|
||||
-aix*)
|
||||
-cnk*|-aix*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-beos*)
|
||||
|
|
53
configure.ac
53
configure.ac
|
@ -31,7 +31,7 @@ dnl (such as TARGET_CC, TARGET_CFLAGS, etc.) are used for the target
|
|||
dnl type.
|
||||
|
||||
|
||||
AC_INIT([GRUB],[1.96],[bug-grub@gnu.org])
|
||||
AC_INIT([GRUB],[1.97~beta3],[bug-grub@gnu.org])
|
||||
AC_PREREQ(2.59)
|
||||
AC_CONFIG_SRCDIR([include/grub/dl.h])
|
||||
AC_CONFIG_HEADER([config.h])
|
||||
|
@ -147,7 +147,6 @@ AC_PROG_MAKE_SET
|
|||
|
||||
# These are not a "must".
|
||||
AC_PATH_PROG(RUBY, ruby)
|
||||
AC_PATH_PROG(HELP2MAN, help2man)
|
||||
|
||||
#
|
||||
# Checks for host programs.
|
||||
|
@ -171,6 +170,12 @@ if test x$grub_cv_apple_cc = xyes ; then
|
|||
ASFLAGS="$ASFLAGS -DAPPLE_CC=1"
|
||||
fi
|
||||
|
||||
if test "x$cross_compiling" = xyes; then
|
||||
AC_MSG_WARN([cannot generate manual pages while cross compiling])
|
||||
else
|
||||
AC_PATH_PROG(HELP2MAN, help2man)
|
||||
fi
|
||||
|
||||
# Check for functions.
|
||||
AC_CHECK_FUNCS(posix_memalign memalign asprintf)
|
||||
|
||||
|
@ -246,6 +251,23 @@ if test "x$TARGET_CFLAGS" = x; then
|
|||
TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
|
||||
fi
|
||||
fi
|
||||
|
||||
# By default, GCC 4.4 generates .eh_frame sections containing unwind
|
||||
# information in some cases where it previously did not. GRUB doesn't need
|
||||
# these and they just use up vital space. Restore the old compiler
|
||||
# behaviour.
|
||||
AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [
|
||||
SAVE_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||
[grub_cv_cc_fno_dwarf2_cfi_asm=yes],
|
||||
[grub_cv_cc_fno_dwarf2_cfi_asm=no])
|
||||
CFLAGS="$SAVE_CFLAGS"
|
||||
])
|
||||
|
||||
if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
|
||||
fi
|
||||
fi
|
||||
|
||||
grub_apple_target_cc
|
||||
|
@ -346,6 +368,14 @@ fi
|
|||
# Need __enable_execute_stack() for nested function trampolines?
|
||||
grub_CHECK_ENABLE_EXECUTE_STACK
|
||||
|
||||
# Position independent executable.
|
||||
grub_CHECK_PIE
|
||||
[# Need that, because some distributions ship compilers that include
|
||||
# `-fPIE' in the default specs.
|
||||
if [ x"$pie_possible" = xyes ]; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE"
|
||||
fi]
|
||||
|
||||
# Smashing stack protector.
|
||||
grub_CHECK_STACK_PROTECTOR
|
||||
# Need that, because some distributions ship compilers that include
|
||||
|
@ -360,6 +390,13 @@ if test x"$sap_possible" = xyes; then
|
|||
TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE([werror],
|
||||
[AS_HELP_STRING([--disable-werror],
|
||||
[do not use -Werror when building GRUB])])
|
||||
if test x"$enable_werror" != xno ; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -Werror"
|
||||
fi
|
||||
|
||||
AC_SUBST(TARGET_CFLAGS)
|
||||
AC_SUBST(TARGET_MODULE_FORMAT)
|
||||
AC_SUBST(OBJCONV)
|
||||
|
@ -527,11 +564,6 @@ enable_grub_fstest=no
|
|||
fi
|
||||
AC_SUBST([enable_grub_fstest])
|
||||
|
||||
AC_ARG_ENABLE([grub-pe2elf],
|
||||
[AS_HELP_STRING([--enable-grub-pe2elf],
|
||||
[build and install the `grub-pe2elf' conversion utility])])
|
||||
AC_SUBST([enable_grub_pe2elf])
|
||||
|
||||
AC_ARG_ENABLE([grub-mkfont],
|
||||
[AS_HELP_STRING([--enable-grub-mkfont],
|
||||
[build and install the `grub-mkfont' utility (default=guessed)])])
|
||||
|
@ -596,13 +628,6 @@ echo With memory debugging: Yes
|
|||
else
|
||||
echo With memory debugging: No
|
||||
fi
|
||||
if [ x"$enable_grub_pe2elf" = xyes ]; then
|
||||
echo grub-pe2elf will be built and installed
|
||||
elif [ x$TARGET_OBJ2ELF = xgrub-pe2elf ]; then
|
||||
echo grub-pe2elf will be built but not installed
|
||||
else
|
||||
echo grub-pe2elf will not be built
|
||||
fi
|
||||
if [ x"$efiemu_excuse" = x ]; then
|
||||
echo efiemu runtime: Yes
|
||||
else
|
||||
|
|
|
@ -62,6 +62,12 @@ menuentry "Microsoft Windows" {
|
|||
chainloader +1
|
||||
}
|
||||
|
||||
# For booting Memtest86+
|
||||
menuentry "Memtest86+" {
|
||||
set root=(hd0,1)
|
||||
linux16 /memtest86+.bin
|
||||
}
|
||||
|
||||
# Change the colors.
|
||||
menuentry "Change the colors" {
|
||||
set menu_color_normal=light-green/brown
|
||||
|
|
155
docs/grub.texi
155
docs/grub.texi
|
@ -20,7 +20,7 @@
|
|||
This manual is for GNU GRUB (version @value{VERSION},
|
||||
@value{UPDATED}).
|
||||
|
||||
Copyright @copyright{} 1999,2000,2001,2002,2004,2006,2008 Free Software Foundation, Inc.
|
||||
Copyright @copyright{} 1999,2000,2001,2002,2004,2006,2008,2009 Free Software Foundation, Inc.
|
||||
|
||||
@quotation
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
|
@ -356,25 +356,25 @@ disk. The number @samp{0} is the drive number, which is counted from
|
|||
disk.
|
||||
|
||||
@example
|
||||
(hd0,1)
|
||||
(hd0,2)
|
||||
@end example
|
||||
|
||||
Here, @samp{hd} means it is a hard disk drive. The first integer
|
||||
@samp{0} indicates the drive number, that is, the first hard disk, while
|
||||
the second integer, @samp{1}, indicates the partition number (or the
|
||||
@sc{pc} slice number in the BSD terminology). Once again, please note
|
||||
that the partition numbers are counted from @emph{zero}, not from
|
||||
one. This expression means the second partition of the first hard disk
|
||||
drive. In this case, GRUB uses one partition of the disk, instead of the
|
||||
whole disk.
|
||||
@sc{pc} slice number in the BSD terminology). The partition numbers are
|
||||
counted from @emph{one}, not from zero (as was the case in previous
|
||||
versions of GRUB). This expression means the second partition of the
|
||||
first hard disk drive. In this case, GRUB uses one partition of the
|
||||
disk, instead of the whole disk.
|
||||
|
||||
@example
|
||||
(hd0,4)
|
||||
(hd0,5)
|
||||
@end example
|
||||
|
||||
This specifies the first @dfn{extended partition} of the first hard disk
|
||||
drive. Note that the partition numbers for extended partitions are
|
||||
counted from @samp{4}, regardless of the actual number of primary
|
||||
counted from @samp{5}, regardless of the actual number of primary
|
||||
partitions on your hard disk.
|
||||
|
||||
@example
|
||||
|
@ -383,13 +383,13 @@ partitions on your hard disk.
|
|||
|
||||
This means the BSD @samp{a} partition of the second hard disk. If you
|
||||
need to specify which @sc{pc} slice number should be used, use something
|
||||
like this: @samp{(hd1,0,a)}. If the @sc{pc} slice number is omitted,
|
||||
like this: @samp{(hd1,1,a)}. If the @sc{pc} slice number is omitted,
|
||||
GRUB searches for the first @sc{pc} slice which has a BSD @samp{a}
|
||||
partition.
|
||||
|
||||
Of course, to actually access the disks or partitions with GRUB, you
|
||||
need to use the device specification in a command, like @samp{root
|
||||
(fd0)} or @samp{unhide (hd0,2)}. To help you find out which number
|
||||
(fd0)} or @samp{unhide (hd0,3)}. To help you find out which number
|
||||
specifies a partition you want, the GRUB command-line
|
||||
(@pxref{Command-line interface}) options have argument
|
||||
completion. This means that, for example, you only need to type
|
||||
|
@ -413,7 +413,7 @@ Now the question is, how to specify a file? Again, consider an
|
|||
example:
|
||||
|
||||
@example
|
||||
(hd0,0)/vmlinuz
|
||||
(hd0,1)/vmlinuz
|
||||
@end example
|
||||
|
||||
This specifies the file named @samp{vmlinuz}, found on the first
|
||||
|
@ -550,7 +550,7 @@ which can cause compatibility problems.
|
|||
For booting from a CD-ROM, GRUB uses a special Stage 2 called
|
||||
@file{stage2_eltorito}. The only GRUB files you need to have in your
|
||||
bootable CD-ROM are this @file{stage2_eltorito} and optionally a config file
|
||||
@file{menu.lst}. You don't need to use @file{stage1} or @file{stage2},
|
||||
@file{grub.cfg}. You don't need to use @file{stage1} or @file{stage2},
|
||||
because El Torito is quite different from the standard boot process.
|
||||
|
||||
Here is an example of procedures to make a bootable CD-ROM
|
||||
|
@ -573,7 +573,7 @@ Copy the file @file{stage2_eltorito}:
|
|||
$ @kbd{cp /usr/lib/grub/i386-pc/stage2_eltorito iso/boot/grub}
|
||||
@end example
|
||||
|
||||
If desired, make the config file @file{menu.lst} under @file{iso/boot/grub}
|
||||
If desired, make the config file @file{grub.cfg} under @file{iso/boot/grub}
|
||||
(@pxref{Configuration}), and copy any files and directories for the disc to the
|
||||
directory @file{iso/}.
|
||||
|
||||
|
@ -786,7 +786,7 @@ which is a BIOS drive number, so the following are equivalent:
|
|||
@end example
|
||||
|
||||
@var{part-num} represents the partition number of @var{device}, starting
|
||||
from zero for primary partitions and from four for extended partitions,
|
||||
from one for primary partitions and from five for extended partitions,
|
||||
and @var{bsd-subpart-letter} represents the BSD disklabel subpartition,
|
||||
such as @samp{a} or @samp{e}.
|
||||
|
||||
|
@ -800,7 +800,7 @@ finds the subpartition @var{bsd-subpart-letter}. Here is an example:
|
|||
@end example
|
||||
|
||||
The syntax @samp{(hd0)} represents using the entire disk (or the
|
||||
MBR when installing GRUB), while the syntax @samp{(hd0,0)}
|
||||
MBR when installing GRUB), while the syntax @samp{(hd0,1)}
|
||||
represents using the first partition of the disk (or the boot sector
|
||||
of the partition when installing GRUB).
|
||||
|
||||
|
@ -820,12 +820,12 @@ There are two ways to specify files, by @dfn{absolute file name} and by
|
|||
|
||||
An absolute file name resembles a Unix absolute file name, using
|
||||
@samp{/} for the directory separator (not @samp{\} as in DOS). One
|
||||
example is @samp{(hd0,0)/boot/grub/menu.lst}. This means the file
|
||||
@file{/boot/grub/menu.lst} in the first partition of the first hard
|
||||
example is @samp{(hd0,1)/boot/grub/grub.cfg}. This means the file
|
||||
@file{/boot/grub/grub.cfg} in the first partition of the first hard
|
||||
disk. If you omit the device name in an absolute file name, GRUB uses
|
||||
GRUB's @dfn{root device} implicitly. So if you set the root device to,
|
||||
say, @samp{(hd1,0)} by the command @command{root} (@pxref{root}), then
|
||||
@code{/boot/kernel} is the same as @code{(hd1,0)/boot/kernel}.
|
||||
say, @samp{(hd1,1)} by the command @command{root} (@pxref{root}), then
|
||||
@code{/boot/kernel} is the same as @code{(hd1,1)/boot/kernel}.
|
||||
|
||||
|
||||
@node Block list syntax
|
||||
|
@ -846,8 +846,8 @@ the offset is zero.
|
|||
|
||||
Like the file name syntax (@pxref{File name syntax}), if a blocklist
|
||||
does not contain a device name, then GRUB uses GRUB's @dfn{root
|
||||
device}. So @code{(hd0,1)+1} is the same as @code{+1} when the root
|
||||
device is @samp{(hd0,1)}.
|
||||
device}. So @code{(hd0,2)+1} is the same as @code{+1} when the root
|
||||
device is @samp{(hd0,2)}.
|
||||
|
||||
|
||||
@node Interface
|
||||
|
@ -1110,17 +1110,56 @@ you forget a command, you can run the command @command{help}
|
|||
(@pxref{help}).
|
||||
|
||||
@menu
|
||||
* acpi:: Load ACPI tables
|
||||
* blocklist:: Print a block list
|
||||
* boot:: Start up your operating system
|
||||
* cat:: Show the contents of a file
|
||||
* chainloader:: Chain-load another boot loader
|
||||
* cmp:: Compare two files
|
||||
* configfile:: Load a configuration file
|
||||
* crc:: Calculate CRC32 checksums
|
||||
* export:: Export an environment variable
|
||||
* halt:: Shut down your computer
|
||||
* help:: Show help messages
|
||||
* insmod:: Insert a module
|
||||
* keystatus:: Check key modifier status
|
||||
* ls:: List devices or files
|
||||
* reboot:: Reboot your computer
|
||||
* set:: Set an environment variable
|
||||
* unset:: Unset an environment variable
|
||||
@end menu
|
||||
|
||||
|
||||
@node acpi
|
||||
@subsection acpi
|
||||
|
||||
@deffn Command acpi [@option{-1}|@option{-2}] @
|
||||
[@option{--exclude=table1,@dots{}}|@option{--load-only=table1,@dots{}}] @
|
||||
[@option{--oemid=id}] [@option{--oemtable=table}] @
|
||||
[@option{--oemtablerev=rev}] [@option{--oemtablecreator=creator}] @
|
||||
[@option{--oemtablecreatorrev=rev}] [@option{--no-ebda}] @
|
||||
filename @dots{}
|
||||
Modern BIOS systems normally implement the Advanced Configuration and Power
|
||||
Interface (ACPI), and define various tables that describe the interface
|
||||
between an ACPI-compliant operating system and the firmware. In some cases,
|
||||
the tables provided by default only work well with certain operating
|
||||
systems, and it may be necessary to replace some of them.
|
||||
|
||||
Normally, this command will replace the Root System Description Pointer
|
||||
(RSDP) in the Extended BIOS Data Area to point to the new tables. If the
|
||||
@option{--no-ebda} option is used, the new tables will be known only to
|
||||
GRUB, but may be used by GRUB's EFI emulation.
|
||||
@end deffn
|
||||
|
||||
|
||||
@node blocklist
|
||||
@subsection blocklist
|
||||
|
||||
@deffn Command blocklist file
|
||||
Print a block list (@pxref{Block list syntax}) for @var{file}.
|
||||
@end deffn
|
||||
|
||||
|
||||
@node boot
|
||||
@subsection boot
|
||||
|
||||
|
@ -1187,6 +1226,23 @@ Load @var{file} as a configuration file.
|
|||
@end deffn
|
||||
|
||||
|
||||
@node crc
|
||||
@subsection crc
|
||||
|
||||
@deffn Command crc file
|
||||
Display the CRC32 checksum of @var{file}.
|
||||
@end deffn
|
||||
|
||||
|
||||
@node export
|
||||
@subsection export
|
||||
|
||||
@deffn Command export envvar
|
||||
Export the environment variable @var{envvar}. Exported variables are visible
|
||||
to subsidiary configuration files loaded using @command{configfile}.
|
||||
@end deffn
|
||||
|
||||
|
||||
@node halt
|
||||
@subsection halt
|
||||
|
||||
|
@ -1212,6 +1268,44 @@ about each of the commands which match those @var{patterns}.
|
|||
@end deffn
|
||||
|
||||
|
||||
@node insmod
|
||||
@subsection insmod
|
||||
|
||||
@deffn Command insmod module
|
||||
Insert the dynamic GRUB module called @var{module}.
|
||||
@end deffn
|
||||
|
||||
|
||||
@node keystatus
|
||||
@subsection keystatus
|
||||
|
||||
@deffn Command keystatus [@option{--shift}] [@option{--ctrl}] [@option{--alt}]
|
||||
Return true if the Shift, Control, or Alt modifier keys are held down, as
|
||||
requested by options. This is useful in scripting, to allow some user
|
||||
control over behaviour without having to wait for a keypress.
|
||||
|
||||
Checking key modifier status is only supported on some platforms. If invoked
|
||||
without any options, the @command{keystatus} command returns true if and
|
||||
only if checking key modifier status is supported.
|
||||
@end deffn
|
||||
|
||||
|
||||
@node ls
|
||||
@subsection ls
|
||||
|
||||
@deffn Command ls [arg]
|
||||
List devices or files.
|
||||
|
||||
With no arguments, print all devices known to GRUB.
|
||||
|
||||
If the argument is a device name enclosed in parentheses (@pxref{Device
|
||||
syntax}), then list all files at the root directory of that device.
|
||||
|
||||
If the argument is a directory given as an absolute file name (@pxref{File
|
||||
name syntax}), then list the contents of that directory.
|
||||
@end deffn
|
||||
|
||||
|
||||
@node reboot
|
||||
@subsection reboot
|
||||
|
||||
|
@ -1220,6 +1314,23 @@ Reboot the computer.
|
|||
@end deffn
|
||||
|
||||
|
||||
@node set
|
||||
@subsection set
|
||||
|
||||
@deffn Command set [envvar=value]
|
||||
Set the environment variable @var{envvar} to @var{value}. If invoked with no
|
||||
arguments, print all environment variables with their values.
|
||||
@end deffn
|
||||
|
||||
|
||||
@node unset
|
||||
@subsection unset
|
||||
|
||||
@deffn Command unset envvar
|
||||
Unset the environment variable @var{envvar}.
|
||||
@end deffn
|
||||
|
||||
|
||||
@node Invoking grub-install
|
||||
@chapter Invoking grub-install
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@set UPDATED 7 Ago 2009
|
||||
@set UPDATED-MONTH Ago 2009
|
||||
@set EDITION 1.97~snapshot
|
||||
@set VERSION 1.97~snapshot
|
||||
@set EDITION 1.97~beta3
|
||||
@set VERSION 1.97~beta3
|
||||
|
|
|
@ -352,13 +352,18 @@ SUFFIX (grub_efiemu_loadcore_load) (void *core,
|
|||
grub_efiemu_segment_t segments)
|
||||
{
|
||||
grub_err_t err;
|
||||
if ((err = grub_efiemu_load_segments (segments, core)))
|
||||
err = grub_efiemu_load_segments (segments, core);
|
||||
if (err)
|
||||
return err;
|
||||
if ((err = grub_efiemu_resolve_symbols (segments, core)))
|
||||
|
||||
err = grub_efiemu_resolve_symbols (segments, core);
|
||||
if (err)
|
||||
return err;
|
||||
if ((err = SUFFIX (grub_arch_efiemu_relocate_symbols) (segments,
|
||||
grub_efiemu_elfsyms,
|
||||
core)))
|
||||
|
||||
err = SUFFIX (grub_arch_efiemu_relocate_symbols) (segments,
|
||||
grub_efiemu_elfsyms,
|
||||
core);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
|
|
165
fs/afs.c
165
fs/afs.c
|
@ -26,10 +26,16 @@
|
|||
#include <grub/types.h>
|
||||
#include <grub/fshelp.h>
|
||||
|
||||
#ifdef MODE_BFS
|
||||
#define GRUB_AFS_FSNAME "befs"
|
||||
#ifdef MODE_BIGENDIAN
|
||||
#define GRUB_AFS_FSNAME_SUFFIX "_be"
|
||||
#else
|
||||
#define GRUB_AFS_FSNAME "afs"
|
||||
#define GRUB_AFS_FSNAME_SUFFIX ""
|
||||
#endif
|
||||
|
||||
#ifdef MODE_BFS
|
||||
#define GRUB_AFS_FSNAME "befs" GRUB_AFS_FSNAME_SUFFIX
|
||||
#else
|
||||
#define GRUB_AFS_FSNAME "afs" GRUB_AFS_FSNAME_SUFFIX
|
||||
#endif
|
||||
|
||||
#define GRUB_AFS_DIRECT_BLOCK_COUNT 12
|
||||
|
@ -65,14 +71,15 @@
|
|||
|
||||
#define GRUB_AFS_NULL_VAL ((grub_afs_bvalue_t)-1)
|
||||
|
||||
#define U16(sb, u) (((sb)->byte_order == GRUB_AFS_BO_LITTLE_ENDIAN) ? \
|
||||
grub_le_to_cpu16 (u) : grub_be_to_cpu16 (u))
|
||||
|
||||
#define U32(sb, u) (((sb)->byte_order == GRUB_AFS_BO_LITTLE_ENDIAN) ? \
|
||||
grub_le_to_cpu32 (u) : grub_be_to_cpu32 (u))
|
||||
|
||||
#define U64(sb, u) (((sb)->byte_order == GRUB_AFS_BO_LITTLE_ENDIAN) ? \
|
||||
grub_le_to_cpu64 (u) : grub_be_to_cpu64 (u))
|
||||
#ifdef MODE_BIGENDIAN
|
||||
#define grub_afs_to_cpu16(x) grub_be_to_cpu16 (x)
|
||||
#define grub_afs_to_cpu32(x) grub_be_to_cpu32 (x)
|
||||
#define grub_afs_to_cpu64(x) grub_be_to_cpu64 (x)
|
||||
#else
|
||||
#define grub_afs_to_cpu16(x) grub_le_to_cpu16 (x)
|
||||
#define grub_afs_to_cpu32(x) grub_le_to_cpu32 (x)
|
||||
#define grub_afs_to_cpu64(x) grub_le_to_cpu64 (x)
|
||||
#endif
|
||||
|
||||
#ifdef MODE_BFS
|
||||
#define B_KEY_INDEX_ALIGN 8
|
||||
|
@ -90,12 +97,6 @@
|
|||
((char *) B_KEY_INDEX_OFFSET (node) + \
|
||||
node->key_count * 2))
|
||||
|
||||
enum
|
||||
{
|
||||
GRUB_AFS_BO_LITTLE_ENDIAN,
|
||||
GRUB_AFS_BO_BIG_ENDIAN
|
||||
};
|
||||
|
||||
typedef grub_uint64_t grub_afs_off_t;
|
||||
typedef grub_uint64_t grub_afs_bigtime;
|
||||
typedef grub_uint64_t grub_afs_bvalue_t;
|
||||
|
@ -154,6 +155,9 @@ struct grub_afs_btree
|
|||
} __attribute__ ((packed));
|
||||
#endif
|
||||
|
||||
/* Beware that following structure describes AtheFS and if you write code
|
||||
which uses currently unused fields check it with both AtheFS and BeFS.
|
||||
*/
|
||||
struct grub_afs_sblock
|
||||
{
|
||||
char name[32];
|
||||
|
@ -227,8 +231,8 @@ static grub_afs_off_t
|
|||
grub_afs_run_to_num (struct grub_afs_sblock *sb,
|
||||
struct grub_afs_blockrun *run)
|
||||
{
|
||||
return ((grub_afs_off_t) U32 (sb, run->group) * sb->block_per_group +
|
||||
U16 (sb, run->start));
|
||||
return ((grub_afs_off_t) grub_afs_to_cpu32 (run->group)
|
||||
* sb->block_per_group + grub_afs_to_cpu16 (run->start));
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
|
@ -248,25 +252,25 @@ grub_afs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
|
|||
struct grub_afs_sblock *sb = &node->data->sblock;
|
||||
struct grub_afs_datastream *ds = &node->inode.stream;
|
||||
|
||||
if (fileblock < U64 (sb, ds->max_direct_range))
|
||||
if (fileblock < grub_afs_to_cpu64 (ds->max_direct_range))
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < GRUB_AFS_DIRECT_BLOCK_COUNT; i++)
|
||||
{
|
||||
if (fileblock < U16 (sb, ds->direct[i].len))
|
||||
if (fileblock < grub_afs_to_cpu16 (ds->direct[i].len))
|
||||
return grub_afs_run_to_num (sb, &ds->direct[i]) + fileblock;
|
||||
fileblock -= U16 (sb, ds->direct[i].len);
|
||||
fileblock -= grub_afs_to_cpu16 (ds->direct[i].len);
|
||||
}
|
||||
}
|
||||
else if (fileblock < U64 (sb, ds->max_indirect_range))
|
||||
else if (fileblock < grub_afs_to_cpu64 (ds->max_indirect_range))
|
||||
{
|
||||
int ptrs_per_blk = sb->block_size / sizeof (struct grub_afs_blockrun);
|
||||
struct grub_afs_blockrun indir[ptrs_per_blk];
|
||||
grub_afs_off_t blk = grub_afs_run_to_num (sb, &ds->indirect);
|
||||
int i;
|
||||
|
||||
fileblock -= U64 (sb, ds->max_direct_range);
|
||||
fileblock -= grub_afs_to_cpu64 (ds->max_direct_range);
|
||||
for (i = 0; i < ds->indirect.len; i++, blk++)
|
||||
{
|
||||
int j;
|
||||
|
@ -279,10 +283,10 @@ grub_afs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
|
|||
|
||||
for (j = 0; j < ptrs_per_blk; j++)
|
||||
{
|
||||
if (fileblock < U16 (sb, indir[j].len))
|
||||
if (fileblock < grub_afs_to_cpu16 (indir[j].len))
|
||||
return grub_afs_run_to_num (sb, &indir[j]) + fileblock;
|
||||
|
||||
fileblock -= U16 (sb, indir[j].len);
|
||||
fileblock -= grub_afs_to_cpu16 (indir[j].len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -292,7 +296,7 @@ grub_afs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
|
|||
struct grub_afs_blockrun indir[ptrs_per_blk];
|
||||
|
||||
/* ([idblk][idptr]) ([dblk][dptr]) [blk] */
|
||||
int cur_pos = fileblock - U64 (sb, ds->max_indirect_range);
|
||||
int cur_pos = fileblock - grub_afs_to_cpu64 (ds->max_indirect_range);
|
||||
|
||||
int dptr_size = GRUB_AFS_BLOCKS_PER_DI_RUN;
|
||||
int dblk_size = dptr_size * ptrs_per_blk;
|
||||
|
@ -334,8 +338,7 @@ grub_afs_read_file (grub_fshelp_node_t node,
|
|||
{
|
||||
return grub_fshelp_read_file (node->data->disk, node, read_hook,
|
||||
pos, len, buf, grub_afs_read_block,
|
||||
U64 (&node->data->sblock,
|
||||
node->inode.stream.size),
|
||||
grub_afs_to_cpu64 (node->inode.stream.size),
|
||||
node->data->sblock.block_shift
|
||||
- GRUB_DISK_SECTOR_BITS);
|
||||
}
|
||||
|
@ -344,8 +347,7 @@ static char *
|
|||
grub_afs_read_symlink (grub_fshelp_node_t node)
|
||||
{
|
||||
char *ret;
|
||||
struct grub_afs_sblock *sb = &node->data->sblock;
|
||||
grub_afs_off_t size = U64 (sb, node->inode.stream.size);
|
||||
grub_afs_off_t size = grub_afs_to_cpu64 (node->inode.stream.size);
|
||||
|
||||
if (size == 0)
|
||||
{
|
||||
|
@ -374,27 +376,27 @@ grub_afs_iterate_dir (grub_fshelp_node_t dir,
|
|||
struct grub_afs_btree head;
|
||||
char node_data [GRUB_AFS_BNODE_SIZE];
|
||||
struct grub_afs_bnode *node = (struct grub_afs_bnode *) node_data;
|
||||
struct grub_afs_sblock *sb = &dir->data->sblock;
|
||||
int i;
|
||||
|
||||
if ((dir->inode.stream.size == 0)
|
||||
|| ((U32 (sb, dir->inode.mode) & GRUB_AFS_S_IFMT) != GRUB_AFS_S_IFDIR))
|
||||
|| ((grub_afs_to_cpu32 (dir->inode.mode) & GRUB_AFS_S_IFMT)
|
||||
!= GRUB_AFS_S_IFDIR))
|
||||
return 0;
|
||||
|
||||
grub_afs_read_file (dir, 0, 0, sizeof (head), (char *) &head);
|
||||
if (grub_errno)
|
||||
return 0;
|
||||
|
||||
grub_afs_read_file (dir, 0, U64 (sb, head.root),
|
||||
grub_afs_read_file (dir, 0, grub_afs_to_cpu64 (head.root),
|
||||
GRUB_AFS_BNODE_SIZE, (char *) node);
|
||||
if (grub_errno)
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < (int) U32 (sb, head.tree_depth) - 1; i++)
|
||||
for (i = 0; i < (int) grub_afs_to_cpu32 (head.tree_depth) - 1; i++)
|
||||
{
|
||||
grub_afs_bvalue_t blk;
|
||||
|
||||
blk = U64(sb, B_KEY_VALUE_OFFSET (node) [0]);
|
||||
blk = grub_afs_to_cpu64(B_KEY_VALUE_OFFSET (node) [0]);
|
||||
grub_afs_read_file (dir, 0, blk, GRUB_AFS_BNODE_SIZE, (char *) node);
|
||||
if (grub_errno)
|
||||
return 0;
|
||||
|
@ -411,8 +413,9 @@ grub_afs_iterate_dir (grub_fshelp_node_t dir,
|
|||
|
||||
index = B_KEY_INDEX_OFFSET (node);
|
||||
|
||||
key_start = U16 (sb, (cur_key > 0) ? index[cur_key - 1] : 0);
|
||||
key_size = U16 (sb, index[cur_key]) - key_start;
|
||||
key_start = (cur_key > 0)
|
||||
? grub_afs_to_cpu16 (index[cur_key - 1]) : 0;
|
||||
key_size = grub_afs_to_cpu16 (index[cur_key]) - key_start;
|
||||
if (key_size > 0)
|
||||
{
|
||||
char filename [key_size + 1];
|
||||
|
@ -425,14 +428,15 @@ grub_afs_iterate_dir (grub_fshelp_node_t dir,
|
|||
|
||||
fdiro->data = dir->data;
|
||||
if (grub_afs_read_inode (dir->data,
|
||||
U64 (sb, B_KEY_VALUE_OFFSET (node) [cur_key]),
|
||||
grub_afs_to_cpu64
|
||||
(B_KEY_VALUE_OFFSET (node) [cur_key]),
|
||||
&fdiro->inode))
|
||||
return 0;
|
||||
|
||||
grub_memcpy (filename, &node->key_data[key_start], key_size);
|
||||
filename [key_size] = 0;
|
||||
|
||||
mode = (U32 (sb, fdiro->inode.mode) & GRUB_AFS_S_IFMT);
|
||||
mode = (grub_afs_to_cpu32 (fdiro->inode.mode) & GRUB_AFS_S_IFMT);
|
||||
if (mode == GRUB_AFS_S_IFDIR)
|
||||
type = GRUB_FSHELP_DIR;
|
||||
else if (mode == GRUB_AFS_S_IFREG)
|
||||
|
@ -447,12 +451,12 @@ grub_afs_iterate_dir (grub_fshelp_node_t dir,
|
|||
}
|
||||
|
||||
cur_key++;
|
||||
if (cur_key >= U32 (sb, node->key_count))
|
||||
if (cur_key >= grub_afs_to_cpu32 (node->key_count))
|
||||
{
|
||||
if (node->right == GRUB_AFS_NULL_VAL)
|
||||
break;
|
||||
|
||||
grub_afs_read_file (dir, 0, U64 (sb, node->right),
|
||||
grub_afs_read_file (dir, 0, grub_afs_to_cpu64 (node->right),
|
||||
GRUB_AFS_BNODE_SIZE, (char *) node);
|
||||
if (grub_errno)
|
||||
return 0;
|
||||
|
@ -468,47 +472,20 @@ grub_afs_iterate_dir (grub_fshelp_node_t dir,
|
|||
static int
|
||||
grub_afs_validate_sblock (struct grub_afs_sblock *sb)
|
||||
{
|
||||
if (grub_le_to_cpu32 (sb->magic1) == GRUB_AFS_SBLOCK_MAGIC1)
|
||||
if (grub_afs_to_cpu32 (sb->magic1) == GRUB_AFS_SBLOCK_MAGIC1)
|
||||
{
|
||||
#ifndef MODE_BFS
|
||||
if (grub_le_to_cpu32 (sb->byte_order) != GRUB_AFS_BO_LITTLE_ENDIAN)
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
sb->byte_order = GRUB_AFS_BO_LITTLE_ENDIAN;
|
||||
sb->magic2 = grub_le_to_cpu32 (sb->magic2);
|
||||
sb->magic3 = grub_le_to_cpu32 (sb->magic3);
|
||||
sb->block_shift = grub_le_to_cpu32 (sb->block_shift);
|
||||
sb->block_size = grub_le_to_cpu32 (sb->block_size);
|
||||
sb->used_blocks = grub_le_to_cpu64 (sb->used_blocks);
|
||||
sb->num_blocks = grub_le_to_cpu64 (sb->num_blocks);
|
||||
sb->inode_size = grub_le_to_cpu32 (sb->inode_size);
|
||||
sb->alloc_group_count = grub_le_to_cpu32 (sb->alloc_group_count);
|
||||
sb->alloc_group_shift = grub_le_to_cpu32 (sb->alloc_group_shift);
|
||||
sb->block_per_group = grub_le_to_cpu32 (sb->block_per_group);
|
||||
sb->alloc_group_count = grub_le_to_cpu32 (sb->alloc_group_count);
|
||||
sb->log_size = grub_le_to_cpu32 (sb->log_size);
|
||||
}
|
||||
else if (grub_be_to_cpu32 (sb->magic1) == GRUB_AFS_SBLOCK_MAGIC1)
|
||||
{
|
||||
#ifndef MODE_BFS
|
||||
if (grub_be_to_cpu32 (sb->byte_order) != GRUB_AFS_BO_BIG_ENDIAN)
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
sb->byte_order = GRUB_AFS_BO_BIG_ENDIAN;
|
||||
sb->magic2 = grub_be_to_cpu32 (sb->magic2);
|
||||
sb->magic3 = grub_be_to_cpu32 (sb->magic3);
|
||||
sb->block_shift = grub_be_to_cpu32 (sb->block_shift);
|
||||
sb->block_size = grub_be_to_cpu32 (sb->block_size);
|
||||
sb->used_blocks = grub_be_to_cpu64 (sb->used_blocks);
|
||||
sb->num_blocks = grub_be_to_cpu64 (sb->num_blocks);
|
||||
sb->inode_size = grub_be_to_cpu32 (sb->inode_size);
|
||||
sb->alloc_group_count = grub_be_to_cpu32 (sb->alloc_group_count);
|
||||
sb->alloc_group_shift = grub_be_to_cpu32 (sb->alloc_group_shift);
|
||||
sb->block_per_group = grub_be_to_cpu32 (sb->block_per_group);
|
||||
sb->alloc_group_count = grub_be_to_cpu32 (sb->alloc_group_count);
|
||||
sb->log_size = grub_be_to_cpu32 (sb->log_size);
|
||||
sb->magic2 = grub_afs_to_cpu32 (sb->magic2);
|
||||
sb->magic3 = grub_afs_to_cpu32 (sb->magic3);
|
||||
sb->block_shift = grub_afs_to_cpu32 (sb->block_shift);
|
||||
sb->block_size = grub_afs_to_cpu32 (sb->block_size);
|
||||
sb->used_blocks = grub_afs_to_cpu64 (sb->used_blocks);
|
||||
sb->num_blocks = grub_afs_to_cpu64 (sb->num_blocks);
|
||||
sb->inode_size = grub_afs_to_cpu32 (sb->inode_size);
|
||||
sb->alloc_group_count = grub_afs_to_cpu32 (sb->alloc_group_count);
|
||||
sb->alloc_group_shift = grub_afs_to_cpu32 (sb->alloc_group_shift);
|
||||
sb->block_per_group = grub_afs_to_cpu32 (sb->block_per_group);
|
||||
sb->alloc_group_count = grub_afs_to_cpu32 (sb->alloc_group_count);
|
||||
sb->log_size = grub_afs_to_cpu32 (sb->log_size);
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
|
@ -529,8 +506,8 @@ grub_afs_validate_sblock (struct grub_afs_sblock *sb)
|
|||
|| ((grub_uint32_t) (1 << sb->alloc_group_shift) !=
|
||||
sb->block_per_group * sb->block_size)
|
||||
|| (sb->alloc_group_count * sb->block_per_group < sb->num_blocks)
|
||||
|| (U16 (sb, sb->log_block.len) != sb->log_size)
|
||||
|| (U32 (sb, sb->valid_log_blocks) > sb->log_size)
|
||||
|| (grub_afs_to_cpu16 (sb->log_block.len) != sb->log_size)
|
||||
|| (grub_afs_to_cpu32 (sb->valid_log_blocks) > sb->log_size)
|
||||
#endif
|
||||
)
|
||||
return 0;
|
||||
|
@ -594,7 +571,7 @@ grub_afs_open (struct grub_file *file, const char *name)
|
|||
grub_memcpy (data->inode, &fdiro->inode, sizeof (struct grub_afs_inode));
|
||||
grub_free (fdiro);
|
||||
|
||||
file->size = U64 (&data->sblock, data->inode->stream.size);
|
||||
file->size = grub_afs_to_cpu64 (data->inode->stream.size);
|
||||
file->data = data;
|
||||
file->offset = 0;
|
||||
|
||||
|
@ -648,10 +625,10 @@ grub_afs_dir (grub_device_t device, const char *path,
|
|||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||
info.mtimeset = 1;
|
||||
#ifdef MODE_BFS
|
||||
info.mtime = U64 (&data->sblock, node->inode.modified_time) >> 16;
|
||||
info.mtime = grub_afs_to_cpu64 (node->inode.modified_time) >> 16;
|
||||
#else
|
||||
info.mtime = grub_divmod64 (U64 (&data->sblock,
|
||||
node->inode.modified_time), 1000000, 0);
|
||||
info.mtime = grub_divmod64 (grub_afs_to_cpu64 (node->inode.modified_time),
|
||||
1000000, 0);
|
||||
#endif
|
||||
grub_free (node);
|
||||
return hook (filename, &info);
|
||||
|
@ -713,8 +690,12 @@ static struct grub_fs grub_afs_fs = {
|
|||
.next = 0
|
||||
};
|
||||
|
||||
#ifdef MODE_BFS
|
||||
#if defined (MODE_BIGENDIAN) && defined (MODE_BFS)
|
||||
GRUB_MOD_INIT (befs_be)
|
||||
#elif defined (MODE_BFS)
|
||||
GRUB_MOD_INIT (befs)
|
||||
#elif defined (MODE_BIGENDIAN)
|
||||
GRUB_MOD_INIT (afs_be)
|
||||
#else
|
||||
GRUB_MOD_INIT (afs)
|
||||
#endif
|
||||
|
@ -723,8 +704,12 @@ GRUB_MOD_INIT (afs)
|
|||
my_mod = mod;
|
||||
}
|
||||
|
||||
#ifdef MODE_BFS
|
||||
#if defined (MODE_BIGENDIAN) && defined (MODE_BFS)
|
||||
GRUB_MOD_FINI (befs_be)
|
||||
#elif defined (MODE_BFS)
|
||||
GRUB_MOD_FINI (befs)
|
||||
#elif defined (MODE_BIGENDIAN)
|
||||
GRUB_MOD_FINI (afs_be)
|
||||
#else
|
||||
GRUB_MOD_FINI (afs)
|
||||
#endif
|
||||
|
|
2
fs/afs_be.c
Normal file
2
fs/afs_be.c
Normal file
|
@ -0,0 +1,2 @@
|
|||
#define MODE_BIGENDIAN 1
|
||||
#include "afs.c"
|
4
fs/befs_be.c
Normal file
4
fs/befs_be.c
Normal file
|
@ -0,0 +1,4 @@
|
|||
/* befs.c - The native BeOS/Haiku file-system. */
|
||||
#define MODE_BFS 1
|
||||
#define MODE_BIGENDIAN 1
|
||||
#include "afs.c"
|
4
fs/hfs.c
4
fs/hfs.c
|
@ -243,10 +243,6 @@ grub_hfs_read_file (struct grub_hfs_data *data,
|
|||
int i;
|
||||
int blockcnt;
|
||||
|
||||
/* Adjust len so it we can't read past the end of the file. */
|
||||
if (len > grub_le_to_cpu32 (data->size))
|
||||
len = grub_le_to_cpu32 (data->size);
|
||||
|
||||
blockcnt = ((len + pos)
|
||||
+ data->blksz - 1) / data->blksz;
|
||||
|
||||
|
|
32
fs/hfsplus.c
32
fs/hfsplus.c
|
@ -469,9 +469,9 @@ grub_hfsplus_mount (grub_disk_t disk)
|
|||
grub_be_to_cpu64 (data->volheader.extents_file.size);
|
||||
|
||||
/* Read the essential information about the trees. */
|
||||
if (! grub_hfsplus_read_file (&data->catalog_tree.file, 0,
|
||||
sizeof (struct grub_hfsplus_btnode),
|
||||
sizeof (header), (char *) &header))
|
||||
if (grub_hfsplus_read_file (&data->catalog_tree.file, 0,
|
||||
sizeof (struct grub_hfsplus_btnode),
|
||||
sizeof (header), (char *) &header) <= 0)
|
||||
goto fail;
|
||||
|
||||
data->catalog_tree.root = grub_be_to_cpu32 (header.root);
|
||||
|
@ -479,15 +479,15 @@ grub_hfsplus_mount (grub_disk_t disk)
|
|||
data->case_sensitive = ((magic == GRUB_HFSPLUSX_MAGIC) &&
|
||||
(header.key_compare == GRUB_HFSPLUSX_BINARYCOMPARE));
|
||||
|
||||
if (! grub_hfsplus_read_file (&data->extoverflow_tree.file, 0,
|
||||
sizeof (struct grub_hfsplus_btnode),
|
||||
sizeof (header), (char *) &header))
|
||||
if (grub_hfsplus_read_file (&data->extoverflow_tree.file, 0,
|
||||
sizeof (struct grub_hfsplus_btnode),
|
||||
sizeof (header), (char *) &header) <= 0)
|
||||
goto fail;
|
||||
|
||||
data->extoverflow_tree.root = grub_be_to_cpu32 (header.root);
|
||||
|
||||
if (! grub_hfsplus_read_file (&data->extoverflow_tree.file, 0, 0,
|
||||
sizeof (node), (char *) &node))
|
||||
if (grub_hfsplus_read_file (&data->extoverflow_tree.file, 0, 0,
|
||||
sizeof (node), (char *) &node) <= 0)
|
||||
goto fail;
|
||||
|
||||
data->extoverflow_tree.root = grub_be_to_cpu32 (header.root);
|
||||
|
@ -608,10 +608,10 @@ grub_hfsplus_btree_iterate_node (struct grub_hfsplus_btree *btree,
|
|||
if (! first_node->next)
|
||||
break;
|
||||
|
||||
if (! grub_hfsplus_read_file (&btree->file, 0,
|
||||
(grub_be_to_cpu32 (first_node->next)
|
||||
* btree->nodesize),
|
||||
btree->nodesize, cnode))
|
||||
if (grub_hfsplus_read_file (&btree->file, 0,
|
||||
(grub_be_to_cpu32 (first_node->next)
|
||||
* btree->nodesize),
|
||||
btree->nodesize, cnode) <= 0)
|
||||
return 1;
|
||||
|
||||
/* Don't skip any record in the next iteration. */
|
||||
|
@ -647,12 +647,12 @@ grub_hfsplus_btree_search (struct grub_hfsplus_btree *btree,
|
|||
int match = 0;
|
||||
|
||||
/* Read a node. */
|
||||
if (! grub_hfsplus_read_file (&btree->file, 0,
|
||||
(long)currnode * (long)btree->nodesize,
|
||||
btree->nodesize, (char *) node))
|
||||
if (grub_hfsplus_read_file (&btree->file, 0,
|
||||
(long)currnode * (long)btree->nodesize,
|
||||
btree->nodesize, (char *) node) <= 0)
|
||||
{
|
||||
grub_free (node);
|
||||
return grub_errno;
|
||||
return grub_error (GRUB_ERR_BAD_FS, "Couldn't read i-node.");
|
||||
}
|
||||
|
||||
nodedesc = (struct grub_hfsplus_btnode *) node;
|
||||
|
|
4
fs/jfs.c
4
fs/jfs.c
|
@ -544,10 +544,6 @@ grub_jfs_read_file (struct grub_jfs_data *data,
|
|||
int i;
|
||||
int blockcnt;
|
||||
|
||||
/* Adjust len so it we can't read past the end of the file. */
|
||||
if (len > data->currinode.size)
|
||||
len = data->currinode.size;
|
||||
|
||||
blockcnt = ((len + pos + grub_le_to_cpu32 (data->sblock.blksz) - 1)
|
||||
/ grub_le_to_cpu32 (data->sblock.blksz));
|
||||
|
||||
|
|
|
@ -193,8 +193,8 @@ grub_minix_read_file (struct grub_minix_data *data,
|
|||
int blockcnt;
|
||||
|
||||
/* Adjust len so it we can't read past the end of the file. */
|
||||
if (len > GRUB_MINIX_INODE_SIZE (data))
|
||||
len = GRUB_MINIX_INODE_SIZE (data);
|
||||
if (len + pos > GRUB_MINIX_INODE_SIZE (data))
|
||||
len = GRUB_MINIX_INODE_SIZE (data) - pos;
|
||||
|
||||
blockcnt = (len + pos + GRUB_MINIX_BSIZE - 1) / GRUB_MINIX_BSIZE;
|
||||
|
||||
|
|
11
fs/ntfs.c
11
fs/ntfs.c
|
@ -543,7 +543,7 @@ init_file (struct grub_ntfs_file *mft, grub_uint32_t mftno)
|
|||
if (!pa[8])
|
||||
mft->size = u32at (pa, 0x10);
|
||||
else
|
||||
mft->size = u32at (pa, 0x30);
|
||||
mft->size = u64at (pa, 0x30);
|
||||
|
||||
if ((mft->attr.flags & AF_ALST) == 0)
|
||||
mft->attr.attr_end = 0; /* Don't jump to attribute list */
|
||||
|
@ -970,15 +970,6 @@ grub_ntfs_read (grub_file_t file, char *buf, grub_size_t len)
|
|||
if (file->read_hook)
|
||||
mft->attr.save_pos = 1;
|
||||
|
||||
if (file->offset > file->size)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FS, "Bad offset");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (file->offset + len > file->size)
|
||||
len = file->size - file->offset;
|
||||
|
||||
read_attr (&mft->attr, buf, file->offset, len, 1, file->read_hook);
|
||||
return (grub_errno) ? 0 : len;
|
||||
}
|
||||
|
|
|
@ -1077,9 +1077,6 @@ grub_reiserfs_read (grub_file_t file, char *buf, grub_size_t len)
|
|||
grub_disk_addr_t block;
|
||||
grub_off_t offset;
|
||||
|
||||
if (file->offset >= file->size)
|
||||
return 0;
|
||||
|
||||
key.directory_id = node->header.key.directory_id;
|
||||
key.object_id = node->header.key.object_id;
|
||||
key.u.v2.offset_type = 0;
|
||||
|
|
4
fs/ufs.c
4
fs/ufs.c
|
@ -290,8 +290,8 @@ grub_ufs_read_file (struct grub_ufs_data *data,
|
|||
int blockcnt;
|
||||
|
||||
/* Adjust len so it we can't read past the end of the file. */
|
||||
if (len > INODE_SIZE (data))
|
||||
len = INODE_SIZE (data);
|
||||
if (len + pos > INODE_SIZE (data))
|
||||
len = INODE_SIZE (data) - pos;
|
||||
|
||||
blockcnt = (len + pos + UFS_BLKSZ (sblock) - 1) / UFS_BLKSZ (sblock);
|
||||
|
||||
|
|
8
fs/xfs.c
8
fs/xfs.c
|
@ -160,13 +160,13 @@ static grub_dl_t my_mod;
|
|||
#define GRUB_XFS_INO_AGBITS(data) \
|
||||
((data)->sblock.log2_agblk + (data)->sblock.log2_inop)
|
||||
#define GRUB_XFS_INO_INOINAG(data, ino) \
|
||||
(grub_be_to_cpu64 (ino) & ((1 << GRUB_XFS_INO_AGBITS (data)) - 1))
|
||||
(grub_be_to_cpu64 (ino) & ((1LL << GRUB_XFS_INO_AGBITS (data)) - 1))
|
||||
#define GRUB_XFS_INO_AG(data,ino) \
|
||||
(grub_be_to_cpu64 (ino) >> GRUB_XFS_INO_AGBITS (data))
|
||||
|
||||
#define GRUB_XFS_FSB_TO_BLOCK(data, fsb) \
|
||||
(((fsb) >> (data)->sblock.log2_agblk) * (data)->agsize \
|
||||
+ ((fsb) & ((1 << (data)->sblock.log2_agblk) - 1)))
|
||||
+ ((fsb) & ((1LL << (data)->sblock.log2_agblk) - 1)))
|
||||
|
||||
#define GRUB_XFS_EXTENT_OFFSET(exts,ex) \
|
||||
((grub_be_to_cpu32 (exts[ex][0]) & ~(1 << 31)) << 23 \
|
||||
|
@ -185,7 +185,7 @@ static grub_dl_t my_mod;
|
|||
#define GRUB_XFS_NEXT_DIRENT(pos,len) \
|
||||
(pos) + GRUB_XFS_ROUND_TO_DIRENT (8 + 1 + len + 2)
|
||||
|
||||
static inline int
|
||||
static inline grub_uint64_t
|
||||
grub_xfs_inode_block (struct grub_xfs_data *data,
|
||||
grub_uint64_t ino)
|
||||
{
|
||||
|
@ -213,7 +213,7 @@ static grub_err_t
|
|||
grub_xfs_read_inode (struct grub_xfs_data *data, grub_uint64_t ino,
|
||||
struct grub_xfs_inode *inode)
|
||||
{
|
||||
int block = grub_xfs_inode_block (data, ino);
|
||||
grub_uint64_t block = grub_xfs_inode_block (data, ino);
|
||||
int offset = grub_xfs_inode_offset (data, ino);
|
||||
|
||||
/* Read the inode. */
|
||||
|
|
2
gendistlist.sh
Normal file → Executable file
2
gendistlist.sh
Normal file → Executable file
|
@ -39,6 +39,6 @@ for dir in $DISTDIRS; do
|
|||
find $d -maxdepth 1 -name '*.[chSy]' -o -name '*.mk' -o -name '*.rmk' \
|
||||
-o -name '*.rb' -o -name '*.in' -o -name '*.tex' -o -name '*.texi' \
|
||||
-o -name 'grub.cfg' -o -name 'README' -o -name '*.sc' -o -name 'mdate-sh' \
|
||||
-o -name '*.sh' | sort
|
||||
-o -name '*.sh' -o -name 'grub-dumpdevtree' -o -name '*.lua' | sort
|
||||
done
|
||||
done
|
||||
|
|
57
genmk.rb
57
genmk.rb
|
@ -39,11 +39,13 @@ class Image
|
|||
def initialize(dir, name)
|
||||
@dir = dir
|
||||
@name = name
|
||||
@rule_count = 0
|
||||
end
|
||||
attr_reader :dir, :name
|
||||
|
||||
def rule(sources)
|
||||
prefix = @name.to_var
|
||||
@rule_count += 1
|
||||
exe = @name.suffix('exec')
|
||||
objs = sources.collect do |src|
|
||||
raise "unknown source file `#{src}'" if /\.[cS]$/ !~ src
|
||||
|
@ -53,8 +55,16 @@ class Image
|
|||
deps = objs.collect {|obj| obj.suffix('d')}
|
||||
deps_str = deps.join(' ')
|
||||
|
||||
"CLEANFILES += #{@name} #{exe} #{objs_str}
|
||||
MOSTLYCLEANFILES += #{deps_str}
|
||||
"
|
||||
clean-image-#{@name}.#{@rule_count}:
|
||||
rm -f #{@name} #{exe} #{objs_str}
|
||||
|
||||
CLEAN_IMAGE_TARGETS += clean-image-#{@name}.#{@rule_count}
|
||||
|
||||
mostlyclean-image-#{@name}.#{@rule_count}:
|
||||
rm -f #{deps_str}
|
||||
|
||||
MOSTLYCLEAN_IMAGE_TARGETS += mostlyclean-image-#{@name}.#{@rule_count}
|
||||
|
||||
ifneq ($(TARGET_APPLE_CC),1)
|
||||
#{@name}: #{exe}
|
||||
|
@ -94,11 +104,13 @@ class PModule
|
|||
def initialize(dir, name)
|
||||
@dir = dir
|
||||
@name = name
|
||||
@rule_count = 0
|
||||
end
|
||||
attr_reader :dir, :name
|
||||
|
||||
def rule(sources)
|
||||
prefix = @name.to_var
|
||||
@rule_count += 1
|
||||
objs = sources.collect do |src|
|
||||
raise "unknown source file `#{src}'" if /\.[cS]$/ !~ src
|
||||
prefix + '-' + src.to_obj
|
||||
|
@ -114,19 +126,30 @@ class PModule
|
|||
mod_name = File.basename(@name, '.mod')
|
||||
symbolic_name = mod_name.sub(/\.[^\.]*$/, '')
|
||||
|
||||
"CLEANFILES += #{@name} #{mod_obj} #{mod_src} #{pre_obj} #{objs_str} #{undsym}
|
||||
"
|
||||
clean-module-#{@name}.#{@rule_count}:
|
||||
rm -f #{@name} #{mod_obj} #{mod_src} #{pre_obj} #{objs_str} #{undsym}
|
||||
|
||||
CLEAN_MODULE_TARGETS += clean-module-#{@name}.#{@rule_count}
|
||||
|
||||
ifneq ($(#{prefix}_EXPORTS),no)
|
||||
CLEANFILES += #{defsym}
|
||||
clean-module-#{@name}-symbol.#{@rule_count}:
|
||||
rm -f #{defsym}
|
||||
|
||||
CLEAN_MODULE_TARGETS += clean-module-#{@name}-symbol.#{@rule_count}
|
||||
DEFSYMFILES += #{defsym}
|
||||
endif
|
||||
MOSTLYCLEANFILES += #{deps_str}
|
||||
mostlyclean-module-#{@name}.#{@rule_count}:
|
||||
rm -f #{deps_str}
|
||||
|
||||
MOSTLYCLEAN_MODULE_TARGETS += mostlyclean-module-#{@name}.#{@rule_count}
|
||||
UNDSYMFILES += #{undsym}
|
||||
|
||||
ifneq ($(TARGET_APPLE_CC),1)
|
||||
#{@name}: #{pre_obj} #{mod_obj} $(TARGET_OBJ2ELF)
|
||||
-rm -f $@
|
||||
$(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ #{pre_obj} #{mod_obj}
|
||||
if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
|
||||
if test ! -z \"$(TARGET_OBJ2ELF)\"; then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@
|
||||
else
|
||||
#{@name}: #{pre_obj} #{mod_obj} $(TARGET_OBJ2ELF)
|
||||
|
@ -164,6 +187,7 @@ endif
|
|||
" + objs.collect_with_index do |obj, i|
|
||||
src = sources[i]
|
||||
fake_obj = File.basename(src).suffix('o')
|
||||
extra_target = obj.sub(/\.[^\.]*$/, '') + '-extra'
|
||||
command = 'cmd-' + obj.suffix('lst')
|
||||
fs = 'fs-' + obj.suffix('lst')
|
||||
partmap = 'partmap-' + obj.suffix('lst')
|
||||
|
@ -178,7 +202,11 @@ endif
|
|||
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -MD -c -o $@ $<
|
||||
-include #{dep}
|
||||
|
||||
CLEANFILES += #{command} #{fs} #{partmap} #{handler} #{parttool}
|
||||
clean-module-#{extra_target}.#{@rule_count}:
|
||||
rm -f #{command} #{fs} #{partmap} #{handler} #{parttool}
|
||||
|
||||
CLEAN_MODULE_TARGETS += clean-module-#{extra_target}.#{@rule_count}
|
||||
|
||||
COMMANDFILES += #{command}
|
||||
FSFILES += #{fs}
|
||||
PARTTOOLFILES += #{parttool}
|
||||
|
@ -219,6 +247,7 @@ class Utility
|
|||
def initialize(dir, name)
|
||||
@dir = dir
|
||||
@name = name
|
||||
@rule_count = 0
|
||||
end
|
||||
def print_tail()
|
||||
prefix = @name.to_var
|
||||
|
@ -231,6 +260,7 @@ class Utility
|
|||
|
||||
def rule(sources)
|
||||
prefix = @name.to_var
|
||||
@rule_count += 1
|
||||
objs = sources.collect do |src|
|
||||
raise "unknown source file `#{src}'" if /\.[cS]$/ !~ src
|
||||
prefix + '-' + src.to_obj
|
||||
|
@ -239,8 +269,17 @@ class Utility
|
|||
deps = objs.collect {|obj| obj.suffix('d')}
|
||||
deps_str = deps.join(' ');
|
||||
|
||||
"CLEANFILES += #{@name}$(EXEEXT) #{objs_str}
|
||||
MOSTLYCLEANFILES += #{deps_str}
|
||||
"
|
||||
clean-utility-#{@name}.#{@rule_count}:
|
||||
rm -f #{@name}$(EXEEXT) #{objs_str}
|
||||
|
||||
CLEAN_UTILITY_TARGETS += clean-utility-#{@name}.#{@rule_count}
|
||||
|
||||
mostlyclean-utility-#{@name}.#{@rule_count}:
|
||||
rm -f #{deps_str}
|
||||
|
||||
MOSTLYCLEAN_UTILITY_TARGETS += mostlyclean-utility-#{@name}.#{@rule_count}
|
||||
|
||||
#{prefix}_OBJECTS += #{objs_str}
|
||||
|
||||
" + objs.collect_with_index do |obj, i|
|
||||
|
|
45
include/grub/auth.h
Normal file
45
include/grub/auth.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef GRUB_AURH_HEADER
|
||||
#define GRUB_AUTH_HEADER 1
|
||||
|
||||
#include <grub/err.h>
|
||||
|
||||
/* Macros for indistinguishibility. */
|
||||
#define GRUB_ACCESS_DENIED grub_error (GRUB_ERR_ACCESS_DENIED, "Access denied.")
|
||||
#define GRUB_GET_PASSWORD(string, len) grub_cmdline_get ("Enter password: ", \
|
||||
string, len, \
|
||||
'*', 0, 0)
|
||||
|
||||
/* Like strcmp but untimeable. Accepts NULL as second argument. */
|
||||
int grub_auth_strcmp (const char *user_input, const char *template);
|
||||
/* Like strcmp but untimeable and ignores commas in needle. */
|
||||
int grub_auth_strword (const char *haystack, const char *needle);
|
||||
|
||||
typedef grub_err_t (*grub_auth_callback_t) (const char*, void *);
|
||||
|
||||
grub_err_t grub_auth_register_authentication (const char *user,
|
||||
grub_auth_callback_t callback,
|
||||
void *arg);
|
||||
grub_err_t grub_auth_unregister_authentication (const char *user);
|
||||
|
||||
grub_err_t grub_auth_authenticate (const char *user);
|
||||
grub_err_t grub_auth_deauthenticate (const char *user);
|
||||
grub_err_t grub_auth_check_authentication (const char *userlist);
|
||||
|
||||
#endif /* ! GRUB_AUTH_HEADER */
|
|
@ -53,7 +53,8 @@ typedef enum
|
|||
GRUB_ERR_BAD_GZIP_DATA,
|
||||
GRUB_ERR_MENU,
|
||||
GRUB_ERR_TIMEOUT,
|
||||
GRUB_ERR_IO
|
||||
GRUB_ERR_IO,
|
||||
GRUB_ERR_ACCESS_DENIED
|
||||
}
|
||||
grub_err_t;
|
||||
|
||||
|
|
|
@ -131,4 +131,52 @@ grub_video_fbblit_blend_index_RGBA8888 (struct grub_video_fbblit_info *dst,
|
|||
int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_fbblit_replace_32bit_1bit (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_fbblit_replace_24bit_1bit (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_fbblit_replace_16bit_1bit (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_fbblit_replace_8bit_1bit (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_fbblit_blend_XXXA8888_1bit (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_fbblit_blend_XXX888_1bit (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
|
||||
void
|
||||
grub_video_fbblit_blend_XXX565_1bit (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y);
|
||||
#endif /* ! GRUB_FBBLIT_HEADER */
|
||||
|
|
|
@ -29,7 +29,7 @@ enum bsd_kernel_types
|
|||
KERNEL_TYPE_NETBSD,
|
||||
};
|
||||
|
||||
#define GRUB_BSD_TEMP_BUFFER 0x68000
|
||||
#define GRUB_BSD_TEMP_BUFFER 0x80000
|
||||
|
||||
#define FREEBSD_RB_ASKNAME (1 << 0) /* ask for file name to reboot from */
|
||||
#define FREEBSD_RB_SINGLE (1 << 1) /* reboot to single user only */
|
||||
|
@ -157,6 +157,8 @@ struct grub_openbsd_bios_mmap
|
|||
grub_uint64_t len;
|
||||
#define OPENBSD_MMAP_AVAILABLE 1
|
||||
#define OPENBSD_MMAP_RESERVED 2
|
||||
#define OPENBSD_MMAP_ACPI 3
|
||||
#define OPENBSD_MMAP_NVS 4
|
||||
grub_uint32_t type;
|
||||
};
|
||||
|
||||
|
@ -189,6 +191,8 @@ struct grub_openbsd_bootargs
|
|||
#define NETBSD_AB_VERBOSE (1 << 17) /* boot verbosely */
|
||||
#define NETBSD_AB_SILENT (1 << 18) /* boot silently */
|
||||
#define NETBSD_AB_DEBUG (1 << 19) /* boot with debug messages */
|
||||
#define NETBSD_AB_NOSMP (1 << 28) /* Boot without SMP support. */
|
||||
#define NETBSD_AB_NOACPI (1 << 29) /* Boot without ACPI support. */
|
||||
|
||||
struct grub_netbsd_bootinfo
|
||||
{
|
||||
|
@ -199,6 +203,7 @@ struct grub_netbsd_bootinfo
|
|||
#define NETBSD_BTINFO_BOOTPATH 0
|
||||
#define NETBSD_BTINFO_ROOTDEVICE 1
|
||||
#define NETBSD_BTINFO_BOOTDISK 3
|
||||
#define NETBSD_BTINFO_MEMMAP 9
|
||||
|
||||
struct grub_netbsd_btinfo_common
|
||||
{
|
||||
|
@ -206,6 +211,23 @@ struct grub_netbsd_btinfo_common
|
|||
int type;
|
||||
};
|
||||
|
||||
struct grub_netbsd_btinfo_mmap_header
|
||||
{
|
||||
struct grub_netbsd_btinfo_common common;
|
||||
grub_uint32_t count;
|
||||
};
|
||||
|
||||
struct grub_netbsd_btinfo_mmap_entry
|
||||
{
|
||||
grub_uint64_t addr;
|
||||
grub_uint64_t len;
|
||||
#define NETBSD_MMAP_AVAILABLE 1
|
||||
#define NETBSD_MMAP_RESERVED 2
|
||||
#define NETBSD_MMAP_ACPI 3
|
||||
#define NETBSD_MMAP_NVS 4
|
||||
grub_uint32_t type;
|
||||
};
|
||||
|
||||
struct grub_netbsd_btinfo_bootpath
|
||||
{
|
||||
struct grub_netbsd_btinfo_common common;
|
||||
|
|
|
@ -77,8 +77,19 @@
|
|||
/* The data segment of the pseudo real mode. */
|
||||
#define GRUB_MEMORY_MACHINE_PSEUDO_REAL_DSEG 0x20
|
||||
|
||||
#define GRUB_MEMORY_MACHINE_BIOS_DATA_AREA_ADDR 0x400
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
/* See http://heim.ifi.uio.no/~stanisls/helppc/bios_data_area.html for a
|
||||
description of the BIOS Data Area layout. */
|
||||
struct grub_machine_bios_data_area
|
||||
{
|
||||
grub_uint8_t unused1[0x17];
|
||||
grub_uint8_t keyboard_flag_lower; /* 0x17 */
|
||||
grub_uint8_t unused2[0xf0 - 0x18];
|
||||
};
|
||||
|
||||
struct grub_machine_mmap_entry
|
||||
{
|
||||
grub_uint32_t size;
|
||||
|
|
|
@ -1,6 +1,26 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_CPU_XNU_H
|
||||
#define GRUB_CPU_XNU_H 1
|
||||
|
||||
#include <grub/err.h>
|
||||
|
||||
#define GRUB_XNU_PAGESIZE 4096
|
||||
typedef grub_uint32_t grub_xnu_ptr_t;
|
||||
|
||||
|
|
|
@ -32,6 +32,12 @@ struct grub_menu_entry
|
|||
/* The title name. */
|
||||
const char *title;
|
||||
|
||||
/* If set means not everybody is allowed to boot this entry. */
|
||||
int restricted;
|
||||
|
||||
/* Allowed users. */
|
||||
const char *users;
|
||||
|
||||
/* The classes associated with the menu entry:
|
||||
used to choose an icon or other style attributes.
|
||||
This is a dummy head node for the linked list, so for an entry E,
|
||||
|
|
|
@ -37,8 +37,42 @@ void *EXPORT_FUNC(grub_memmove) (void *dest, const void *src, grub_size_t n);
|
|||
char *EXPORT_FUNC(grub_strcpy) (char *dest, const char *src);
|
||||
char *EXPORT_FUNC(grub_strncpy) (char *dest, const char *src, int c);
|
||||
char *EXPORT_FUNC(grub_stpcpy) (char *dest, const char *src);
|
||||
char *EXPORT_FUNC(grub_strcat) (char *dest, const char *src);
|
||||
char *EXPORT_FUNC(grub_strncat) (char *dest, const char *src, int c);
|
||||
|
||||
static inline char *
|
||||
grub_strcat (char *dest, const char *src)
|
||||
{
|
||||
char *p = dest;
|
||||
|
||||
while (*p)
|
||||
p++;
|
||||
|
||||
while ((*p = *src) != '\0')
|
||||
{
|
||||
p++;
|
||||
src++;
|
||||
}
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
static inline char *
|
||||
grub_strncat (char *dest, const char *src, int c)
|
||||
{
|
||||
char *p = dest;
|
||||
|
||||
while (*p)
|
||||
p++;
|
||||
|
||||
while ((*p = *src) != '\0' && c--)
|
||||
{
|
||||
p++;
|
||||
src++;
|
||||
}
|
||||
|
||||
*p = '\0';
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
/* Prototypes for aliases. */
|
||||
#if !defined (GRUB_UTIL) || !defined (APPLE_CC)
|
||||
|
@ -49,19 +83,41 @@ void *EXPORT_FUNC(memcpy) (void *dest, const void *src, grub_size_t n);
|
|||
int EXPORT_FUNC(grub_memcmp) (const void *s1, const void *s2, grub_size_t n);
|
||||
int EXPORT_FUNC(grub_strcmp) (const char *s1, const char *s2);
|
||||
int EXPORT_FUNC(grub_strncmp) (const char *s1, const char *s2, grub_size_t n);
|
||||
int EXPORT_FUNC(grub_strcasecmp) (const char *s1, const char *s2);
|
||||
int EXPORT_FUNC(grub_strncasecmp) (const char *s1, const char *s2, grub_size_t n);
|
||||
|
||||
char *EXPORT_FUNC(grub_strchr) (const char *s, int c);
|
||||
char *EXPORT_FUNC(grub_strrchr) (const char *s, int c);
|
||||
int EXPORT_FUNC(grub_strword) (const char *s, const char *w);
|
||||
char *EXPORT_FUNC(grub_strstr) (const char *haystack, const char *needle);
|
||||
int EXPORT_FUNC(grub_iswordseparator) (int c);
|
||||
int EXPORT_FUNC(grub_isspace) (int c);
|
||||
int EXPORT_FUNC(grub_isprint) (int c);
|
||||
int EXPORT_FUNC(grub_isalpha) (int c);
|
||||
int EXPORT_FUNC(grub_isgraph) (int c);
|
||||
int EXPORT_FUNC(grub_isdigit) (int c);
|
||||
int EXPORT_FUNC(grub_tolower) (int c);
|
||||
|
||||
static inline int
|
||||
grub_isalpha (int c)
|
||||
{
|
||||
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_isgraph (int c)
|
||||
{
|
||||
return (c >= '!' && c <= '~');
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_isdigit (int c)
|
||||
{
|
||||
return (c >= '0' && c <= '9');
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_tolower (int c)
|
||||
{
|
||||
if (c >= 'A' && c <= 'Z')
|
||||
return c - 'A' + 'a';
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_toupper (int c)
|
||||
{
|
||||
|
@ -71,6 +127,40 @@ grub_toupper (int c)
|
|||
return c;
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_strcasecmp (const char *s1, const char *s2)
|
||||
{
|
||||
while (*s1 && *s2)
|
||||
{
|
||||
if (grub_tolower (*s1) != grub_tolower (*s2))
|
||||
break;
|
||||
|
||||
s1++;
|
||||
s2++;
|
||||
}
|
||||
|
||||
return (int) grub_tolower (*s1) - (int) grub_tolower (*s2);
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_strncasecmp (const char *s1, const char *s2, grub_size_t n)
|
||||
{
|
||||
if (n == 0)
|
||||
return 0;
|
||||
|
||||
while (*s1 && *s2 && --n)
|
||||
{
|
||||
if (grub_tolower (*s1) != grub_tolower (*s2))
|
||||
break;
|
||||
|
||||
s1++;
|
||||
s2++;
|
||||
}
|
||||
|
||||
return (int) grub_tolower (*s1) - (int) grub_tolower (*s2);
|
||||
}
|
||||
|
||||
|
||||
unsigned long EXPORT_FUNC(grub_strtoul) (const char *str, char **end, int base);
|
||||
unsigned long long EXPORT_FUNC(grub_strtoull) (const char *str, char **end, int base);
|
||||
char *EXPORT_FUNC(grub_strdup) (const char *s);
|
||||
|
|
|
@ -99,7 +99,7 @@
|
|||
#define GRUB_PC_PARTITION_OPENBSD_TYPE_RAID 19
|
||||
|
||||
/* The BSD partition entry. */
|
||||
struct grub_pc_partition_bsd_entry
|
||||
struct grub_msdos_partition_bsd_entry
|
||||
{
|
||||
grub_uint32_t size;
|
||||
grub_uint32_t offset;
|
||||
|
@ -110,7 +110,7 @@ struct grub_pc_partition_bsd_entry
|
|||
} __attribute__ ((packed));
|
||||
|
||||
/* The BSD disk label. Only define members useful for GRUB. */
|
||||
struct grub_pc_partition_disk_label
|
||||
struct grub_msdos_partition_disk_label
|
||||
{
|
||||
grub_uint32_t magic;
|
||||
grub_uint8_t padding[128];
|
||||
|
@ -119,11 +119,11 @@ struct grub_pc_partition_disk_label
|
|||
grub_uint16_t num_partitions;
|
||||
grub_uint32_t boot_size;
|
||||
grub_uint32_t superblock_size;
|
||||
struct grub_pc_partition_bsd_entry entries[GRUB_PC_PARTITION_BSD_MAX_ENTRIES];
|
||||
struct grub_msdos_partition_bsd_entry entries[GRUB_PC_PARTITION_BSD_MAX_ENTRIES];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* The partition entry. */
|
||||
struct grub_pc_partition_entry
|
||||
struct grub_msdos_partition_entry
|
||||
{
|
||||
/* If active, 0x80, otherwise, 0x00. */
|
||||
grub_uint8_t flag;
|
||||
|
@ -155,20 +155,20 @@ struct grub_pc_partition_entry
|
|||
} __attribute__ ((packed));
|
||||
|
||||
/* The structure of MBR. */
|
||||
struct grub_pc_partition_mbr
|
||||
struct grub_msdos_partition_mbr
|
||||
{
|
||||
/* The code area (actually, including BPB). */
|
||||
grub_uint8_t code[446];
|
||||
|
||||
/* Four partition entries. */
|
||||
struct grub_pc_partition_entry entries[4];
|
||||
struct grub_msdos_partition_entry entries[4];
|
||||
|
||||
/* The signature 0xaa55. */
|
||||
grub_uint16_t signature;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
struct grub_pc_partition
|
||||
struct grub_msdos_partition
|
||||
{
|
||||
/* The DOS partition number. */
|
||||
int dos_part;
|
||||
|
@ -187,13 +187,13 @@ struct grub_pc_partition
|
|||
};
|
||||
|
||||
static inline int
|
||||
grub_pc_partition_is_empty (int type)
|
||||
grub_msdos_partition_is_empty (int type)
|
||||
{
|
||||
return (type == GRUB_PC_PARTITION_TYPE_NONE);
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_pc_partition_is_extended (int type)
|
||||
grub_msdos_partition_is_extended (int type)
|
||||
{
|
||||
return (type == GRUB_PC_PARTITION_TYPE_EXTENDED
|
||||
|| type == GRUB_PC_PARTITION_TYPE_WIN95_EXTENDED
|
||||
|
@ -201,7 +201,7 @@ grub_pc_partition_is_extended (int type)
|
|||
}
|
||||
|
||||
static inline int
|
||||
grub_pc_partition_is_bsd (int type)
|
||||
grub_msdos_partition_is_bsd (int type)
|
||||
{
|
||||
return (type == GRUB_PC_PARTITION_TYPE_FREEBSD
|
||||
|| type == GRUB_PC_PARTITION_TYPE_OPENBSD
|
|
@ -56,7 +56,7 @@ void grub_cmdline_run (int nested);
|
|||
|
||||
/* Defined in `cmdline.c'. */
|
||||
int grub_cmdline_get (const char *prompt, char cmdline[], unsigned max_len,
|
||||
int echo_char, int readline);
|
||||
int echo_char, int readline, int history);
|
||||
grub_err_t grub_set_history (int newsize);
|
||||
|
||||
/* Defined in `completion.c'. */
|
||||
|
|
|
@ -133,7 +133,7 @@ struct grub_fshelp_node
|
|||
{
|
||||
struct grub_ntfs_data *data;
|
||||
char *buf;
|
||||
grub_uint32_t size;
|
||||
grub_uint64_t size;
|
||||
grub_uint32_t ino;
|
||||
int inode_read;
|
||||
struct grub_ntfs_attr attr;
|
||||
|
|
|
@ -84,8 +84,8 @@ void EXPORT_FUNC(grub_partition_map_register) (grub_partition_map_t partmap);
|
|||
void EXPORT_FUNC(grub_partition_map_unregister) (grub_partition_map_t partmap);
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
void grub_pc_partition_map_init (void);
|
||||
void grub_pc_partition_map_fini (void);
|
||||
void grub_msdos_partition_map_init (void);
|
||||
void grub_msdos_partition_map_fini (void);
|
||||
void grub_amiga_partition_map_init (void);
|
||||
void grub_amiga_partition_map_fini (void);
|
||||
void grub_apple_partition_map_init (void);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003,2005,2007,2008 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2002,2003,2005,2007,2008,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
|
||||
|
@ -72,6 +72,12 @@ grub_term_color_state;
|
|||
#define GRUB_TERM_NEED_INIT (1 << 16)
|
||||
|
||||
|
||||
/* Bitmasks for modifier keys returned by grub_getkeystatus. */
|
||||
#define GRUB_TERM_STATUS_SHIFT (1 << 0)
|
||||
#define GRUB_TERM_STATUS_CTRL (1 << 1)
|
||||
#define GRUB_TERM_STATUS_ALT (1 << 2)
|
||||
|
||||
|
||||
/* Unicode characters for fancy graphics. */
|
||||
#define GRUB_TERM_DISP_LEFT 0x2190
|
||||
#define GRUB_TERM_DISP_UP 0x2191
|
||||
|
@ -157,6 +163,9 @@ struct grub_term_input
|
|||
|
||||
/* Get a character. */
|
||||
int (*getkey) (void);
|
||||
|
||||
/* Get keyboard modifier status. */
|
||||
int (*getkeystatus) (void);
|
||||
};
|
||||
typedef struct grub_term_input *grub_term_input_t;
|
||||
|
||||
|
@ -275,6 +284,7 @@ void EXPORT_FUNC(grub_putcode) (grub_uint32_t code);
|
|||
grub_ssize_t EXPORT_FUNC(grub_getcharwidth) (grub_uint32_t code);
|
||||
int EXPORT_FUNC(grub_getkey) (void);
|
||||
int EXPORT_FUNC(grub_checkkey) (void);
|
||||
int EXPORT_FUNC(grub_getkeystatus) (void);
|
||||
grub_uint16_t EXPORT_FUNC(grub_getwh) (void);
|
||||
grub_uint16_t EXPORT_FUNC(grub_getxy) (void);
|
||||
void EXPORT_FUNC(grub_gotoxy) (grub_uint8_t x, grub_uint8_t y);
|
||||
|
|
|
@ -112,6 +112,13 @@ grub_file_read (grub_file_t file, void *buf, grub_size_t len)
|
|||
{
|
||||
grub_ssize_t res;
|
||||
|
||||
if (file->offset > file->size)
|
||||
{
|
||||
grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
"Attempt to read past the end of file.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (len == 0 || len > file->size - file->offset)
|
||||
len = file->size - file->offset;
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
* Note: GRUB is compiled with the options -mrtd and -mregparm=3.
|
||||
* So the first three arguments are passed in %eax, %edx, and %ecx,
|
||||
* respectively, and if a function has a fixed number of arguments
|
||||
* and the number if greater than three, the function must return
|
||||
* and the number is greater than three, the function must return
|
||||
* with "ret $N" where N is ((the number of arguments) - 3) * 4.
|
||||
*/
|
||||
|
||||
|
@ -1761,18 +1761,18 @@ FUNCTION(grub_vbe_bios_getset_dac_palette_width)
|
|||
movw $0x4f08, %ax
|
||||
int $0x10
|
||||
|
||||
movw %ax, %dx /* real_to_prot destroys %eax. */
|
||||
movw %ax, %cx /* real_to_prot destroys %eax. */
|
||||
|
||||
DATA32 call real_to_prot
|
||||
.code32
|
||||
|
||||
/* Move result back to *dac_mask_size. */
|
||||
xorl %eax, %eax
|
||||
movb %bh, %al
|
||||
movl %eax, (%edx)
|
||||
|
||||
/* Return value in %eax. */
|
||||
xorl %eax, %eax
|
||||
movw %dx, %ax
|
||||
movw %cx, %ax
|
||||
|
||||
popl %ebx
|
||||
popl %ebp
|
||||
|
|
108
kern/misc.c
108
kern/misc.c
|
@ -24,6 +24,12 @@
|
|||
#include <grub/term.h>
|
||||
#include <grub/env.h>
|
||||
|
||||
static int
|
||||
grub_iswordseparator (int c)
|
||||
{
|
||||
return (grub_isspace (c) || c == ',' || c == ';' || c == '|' || c == '&');
|
||||
}
|
||||
|
||||
void *
|
||||
grub_memmove (void *dest, const void *src, grub_size_t n)
|
||||
{
|
||||
|
@ -97,42 +103,6 @@ grub_stpcpy (char *dest, const char *src)
|
|||
return d - 1;
|
||||
}
|
||||
|
||||
char *
|
||||
grub_strcat (char *dest, const char *src)
|
||||
{
|
||||
char *p = dest;
|
||||
|
||||
while (*p)
|
||||
p++;
|
||||
|
||||
while ((*p = *src) != '\0')
|
||||
{
|
||||
p++;
|
||||
src++;
|
||||
}
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
char *
|
||||
grub_strncat (char *dest, const char *src, int c)
|
||||
{
|
||||
char *p = dest;
|
||||
|
||||
while (*p)
|
||||
p++;
|
||||
|
||||
while ((*p = *src) != '\0' && c--)
|
||||
{
|
||||
p++;
|
||||
src++;
|
||||
}
|
||||
|
||||
*p = '\0';
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
int
|
||||
grub_printf (const char *fmt, ...)
|
||||
{
|
||||
|
@ -250,39 +220,6 @@ grub_strncmp (const char *s1, const char *s2, grub_size_t n)
|
|||
return (int) *s1 - (int) *s2;
|
||||
}
|
||||
|
||||
int
|
||||
grub_strcasecmp (const char *s1, const char *s2)
|
||||
{
|
||||
while (*s1 && *s2)
|
||||
{
|
||||
if (grub_tolower (*s1) != grub_tolower (*s2))
|
||||
break;
|
||||
|
||||
s1++;
|
||||
s2++;
|
||||
}
|
||||
|
||||
return (int) grub_tolower (*s1) - (int) grub_tolower (*s2);
|
||||
}
|
||||
|
||||
int
|
||||
grub_strncasecmp (const char *s1, const char *s2, grub_size_t n)
|
||||
{
|
||||
if (n == 0)
|
||||
return 0;
|
||||
|
||||
while (*s1 && *s2 && --n)
|
||||
{
|
||||
if (grub_tolower (*s1) != grub_tolower (*s2))
|
||||
break;
|
||||
|
||||
s1++;
|
||||
s2++;
|
||||
}
|
||||
|
||||
return (int) grub_tolower (*s1) - (int) grub_tolower (*s2);
|
||||
}
|
||||
|
||||
char *
|
||||
grub_strchr (const char *s, int c)
|
||||
{
|
||||
|
@ -394,12 +331,6 @@ grub_strword (const char *haystack, const char *needle)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
grub_iswordseparator (int c)
|
||||
{
|
||||
return (grub_isspace (c) || c == ',' || c == ';' || c == '|' || c == '&');
|
||||
}
|
||||
|
||||
int
|
||||
grub_isspace (int c)
|
||||
{
|
||||
|
@ -412,33 +343,6 @@ grub_isprint (int c)
|
|||
return (c >= ' ' && c <= '~');
|
||||
}
|
||||
|
||||
int
|
||||
grub_isalpha (int c)
|
||||
{
|
||||
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
|
||||
}
|
||||
|
||||
int
|
||||
grub_isdigit (int c)
|
||||
{
|
||||
return (c >= '0' && c <= '9');
|
||||
}
|
||||
|
||||
int
|
||||
grub_isgraph (int c)
|
||||
{
|
||||
return (c >= '!' && c <= '~');
|
||||
}
|
||||
|
||||
int
|
||||
grub_tolower (int c)
|
||||
{
|
||||
if (c >= 'A' && c <= 'Z')
|
||||
return c - 'A' + 'a';
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
unsigned long
|
||||
grub_strtoul (const char *str, char **end, int base)
|
||||
|
|
|
@ -61,7 +61,8 @@ grub_rescue_parse_line (char *line, grub_reader_getline_t getline)
|
|||
else
|
||||
{
|
||||
grub_printf ("Unknown command `%s'\n", name);
|
||||
grub_printf ("Try `help' for usage\n");
|
||||
if (grub_command_find ("help"))
|
||||
grub_printf ("Try `help' for usage\n");
|
||||
}
|
||||
|
||||
quit:
|
||||
|
|
|
@ -140,6 +140,15 @@ grub_checkkey (void)
|
|||
return (grub_cur_term_input->checkkey) ();
|
||||
}
|
||||
|
||||
int
|
||||
grub_getkeystatus (void)
|
||||
{
|
||||
if (grub_cur_term_input->getkeystatus)
|
||||
return (grub_cur_term_input->getkeystatus) ();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
grub_uint16_t
|
||||
grub_getxy (void)
|
||||
{
|
||||
|
|
|
@ -33,12 +33,14 @@
|
|||
#include <grub/gzio.h>
|
||||
#include <grub/aout.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/extcmd.h>
|
||||
|
||||
#ifdef GRUB_MACHINE_PCBIOS
|
||||
#include <grub/machine/biosnum.h>
|
||||
#endif
|
||||
#include <grub/disk.h>
|
||||
#include <grub/device.h>
|
||||
#include <grub/partition.h>
|
||||
#endif
|
||||
|
||||
#define ALIGN_DWORD(a) ALIGN_UP (a, 4)
|
||||
#define ALIGN_QWORD(a) ALIGN_UP (a, 8)
|
||||
|
@ -54,33 +56,80 @@ static grub_uint32_t bootflags;
|
|||
static char *mod_buf;
|
||||
static grub_uint32_t mod_buf_len, mod_buf_max, kern_end_mdofs;
|
||||
static int is_elf_kernel, is_64bit;
|
||||
static char *netbsd_root = NULL;
|
||||
|
||||
static const struct grub_arg_option freebsd_opts[] =
|
||||
{
|
||||
{"dual", 'D', 0, "Display output on all consoles.", 0, 0},
|
||||
{"serial", 'h', 0, "Use serial console.", 0, 0},
|
||||
{"askname", 'a', 0, "Ask for file name to reboot from.", 0, 0},
|
||||
{"cdrom", 'C', 0, "Use cdrom as root.", 0, 0},
|
||||
{"config", 'c', 0, "Invoke user configuration routing.", 0, 0},
|
||||
{"kdb", 'd', 0, "Enter in KDB on boot.", 0, 0},
|
||||
{"gdb", 'g', 0, "Use GDB remote debugger instead of DDB.", 0, 0},
|
||||
{"mute", 'm', 0, "Disable all boot output.", 0, 0},
|
||||
{"nointr", 'n', 0, "", 0, 0},
|
||||
{"pause", 'p', 0, "Wait for keypress after every line of output.", 0, 0},
|
||||
{"quiet", 'q', 0, "", 0, 0},
|
||||
{"dfltroot", 'r', 0, "Use compiled-in rootdev.", 0, 0},
|
||||
{"single", 's', 0, "Boot into single mode.", 0, 0},
|
||||
{"verbose", 'v', 0, "Boot with verbose messages.", 0, 0},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
static const char freebsd_opts[] = "DhaCcdgmnpqrsv";
|
||||
static const grub_uint32_t freebsd_flags[] =
|
||||
{
|
||||
FREEBSD_RB_DUAL, FREEBSD_RB_SERIAL, FREEBSD_RB_ASKNAME,
|
||||
FREEBSD_RB_CDROM, FREEBSD_RB_CONFIG, FREEBSD_RB_KDB,
|
||||
FREEBSD_RB_GDB, FREEBSD_RB_MUTE, FREEBSD_RB_NOINTR,
|
||||
FREEBSD_RB_PAUSE, FREEBSD_RB_QUIET, FREEBSD_RB_DFLTROOT,
|
||||
FREEBSD_RB_SINGLE, FREEBSD_RB_VERBOSE
|
||||
FREEBSD_RB_SINGLE, FREEBSD_RB_VERBOSE, 0
|
||||
};
|
||||
|
||||
static const char openbsd_opts[] = "abcsd";
|
||||
static const struct grub_arg_option openbsd_opts[] =
|
||||
{
|
||||
{"askname", 'a', 0, "Ask for file name to reboot from.", 0, 0},
|
||||
{"halt", 'b', 0, "Don't reboot, just halt.", 0, 0},
|
||||
{"config", 'c', 0, "Change configured devices.", 0, 0},
|
||||
{"single", 's', 0, "Boot into single mode.", 0, 0},
|
||||
{"kdb", 'd', 0, "Enter in KDB on boot.", 0, 0},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
static const grub_uint32_t openbsd_flags[] =
|
||||
{
|
||||
OPENBSD_RB_ASKNAME, OPENBSD_RB_HALT, OPENBSD_RB_CONFIG,
|
||||
OPENBSD_RB_SINGLE, OPENBSD_RB_KDB
|
||||
OPENBSD_RB_SINGLE, OPENBSD_RB_KDB, 0
|
||||
};
|
||||
|
||||
static const char netbsd_opts[] = "abcdmqsvxz";
|
||||
static const struct grub_arg_option netbsd_opts[] =
|
||||
{
|
||||
{"no-smp", '1', 0, "Disable SMP.", 0, 0},
|
||||
{"no-acpi", '2', 0, "Disable ACPI.", 0, 0},
|
||||
{"askname", 'a', 0, "Ask for file name to reboot from.", 0, 0},
|
||||
{"halt", 'b', 0, "Don't reboot, just halt.", 0, 0},
|
||||
{"config", 'c', 0, "Change configured devices.", 0, 0},
|
||||
{"kdb", 'd', 0, "Enter in KDB on boot.", 0, 0},
|
||||
{"miniroot", 'm', 0, "", 0, 0},
|
||||
{"quiet", 'q', 0, "Don't display boot diagnostic messages.", 0, 0},
|
||||
{"single", 's', 0, "Boot into single mode.", 0, 0},
|
||||
{"verbose", 'v', 0, "Boot with verbose messages.", 0, 0},
|
||||
{"debug", 'x', 0, "Boot with debug messages.", 0, 0},
|
||||
{"silent", 'z', 0, "Supress normal output (warnings remain).", 0, 0},
|
||||
{"root", 'r', 0, "Set root device.", "DEVICE", ARG_TYPE_STRING},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
static const grub_uint32_t netbsd_flags[] =
|
||||
{
|
||||
NETBSD_RB_ASKNAME, NETBSD_RB_HALT, NETBSD_RB_USERCONFIG,
|
||||
NETBSD_RB_KDB, NETBSD_RB_MINIROOT, NETBSD_AB_QUIET,
|
||||
NETBSD_RB_SINGLE, NETBSD_AB_VERBOSE, NETBSD_AB_DEBUG,
|
||||
NETBSD_AB_SILENT
|
||||
NETBSD_AB_NOSMP, NETBSD_AB_NOACPI, NETBSD_RB_ASKNAME,
|
||||
NETBSD_RB_HALT, NETBSD_RB_USERCONFIG, NETBSD_RB_KDB,
|
||||
NETBSD_RB_MINIROOT, NETBSD_AB_QUIET, NETBSD_RB_SINGLE,
|
||||
NETBSD_AB_VERBOSE, NETBSD_AB_DEBUG, NETBSD_AB_SILENT, 0
|
||||
};
|
||||
|
||||
#define NETBSD_ROOT_ARG (ARRAY_SIZE (netbsd_flags) - 1)
|
||||
|
||||
static void
|
||||
grub_bsd_get_device (grub_uint32_t * biosdev,
|
||||
grub_uint32_t * unit,
|
||||
|
@ -89,7 +138,11 @@ grub_bsd_get_device (grub_uint32_t * biosdev,
|
|||
char *p;
|
||||
grub_device_t dev;
|
||||
|
||||
#ifdef GRUB_MACHINE_PCBIOS
|
||||
*biosdev = grub_get_root_biosnumber () & 0xff;
|
||||
#else
|
||||
*biosdev = 0xff;
|
||||
#endif
|
||||
*unit = (*biosdev & 0x7f);
|
||||
*slice = 0xff;
|
||||
*part = 0xff;
|
||||
|
@ -525,6 +578,14 @@ grub_openbsd_boot (void)
|
|||
pm->type = OPENBSD_MMAP_AVAILABLE;
|
||||
break;
|
||||
|
||||
case GRUB_MACHINE_MEMORY_ACPI:
|
||||
pm->type = OPENBSD_MMAP_ACPI;
|
||||
break;
|
||||
|
||||
case GRUB_MACHINE_MEMORY_NVS:
|
||||
pm->type = OPENBSD_MMAP_NVS;
|
||||
break;
|
||||
|
||||
default:
|
||||
pm->type = OPENBSD_MMAP_RESERVED;
|
||||
break;
|
||||
|
@ -540,6 +601,12 @@ grub_openbsd_boot (void)
|
|||
pm = (struct grub_openbsd_bios_mmap *) (pa + 1);
|
||||
grub_mmap_iterate (hook);
|
||||
|
||||
/* Memory map terminator. */
|
||||
pm->addr = 0;
|
||||
pm->len = 0;
|
||||
pm->type = 0;
|
||||
pm++;
|
||||
|
||||
pa->ba_size = (char *) pm - (char *) pa;
|
||||
pa->ba_next = (struct grub_openbsd_bootargs *) pm;
|
||||
pa = pa->ba_next;
|
||||
|
@ -551,8 +618,8 @@ grub_openbsd_boot (void)
|
|||
(part << OPENBSD_B_PARTSHIFT));
|
||||
|
||||
grub_unix_real_boot (entry, bootflags, bootdev, OPENBSD_BOOTARG_APIVER,
|
||||
0, grub_mmap_get_upper () >> 10,
|
||||
grub_mmap_get_lower () >> 10,
|
||||
0, (grub_uint32_t) (grub_mmap_get_upper () >> 10),
|
||||
(grub_uint32_t) (grub_mmap_get_lower () >> 10),
|
||||
(char *) pa - buf, buf);
|
||||
|
||||
/* Not reached. */
|
||||
|
@ -562,26 +629,93 @@ grub_openbsd_boot (void)
|
|||
static grub_err_t
|
||||
grub_netbsd_boot (void)
|
||||
{
|
||||
struct grub_netbsd_btinfo_rootdevice *rootdev;
|
||||
struct grub_netbsd_bootinfo *bootinfo;
|
||||
grub_uint32_t biosdev, unit, slice, part;
|
||||
int count = 0;
|
||||
struct grub_netbsd_btinfo_mmap_header *mmap;
|
||||
struct grub_netbsd_btinfo_mmap_entry *pm;
|
||||
void *curarg;
|
||||
|
||||
grub_bsd_get_device (&biosdev, &unit, &slice, &part);
|
||||
auto int NESTED_FUNC_ATTR count_hook (grub_uint64_t, grub_uint64_t, grub_uint32_t);
|
||||
int NESTED_FUNC_ATTR count_hook (grub_uint64_t addr __attribute__ ((unused)),
|
||||
grub_uint64_t size __attribute__ ((unused)),
|
||||
grub_uint32_t type __attribute__ ((unused)))
|
||||
{
|
||||
count++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
rootdev = (struct grub_netbsd_btinfo_rootdevice *) GRUB_BSD_TEMP_BUFFER;
|
||||
auto int NESTED_FUNC_ATTR fill_hook (grub_uint64_t, grub_uint64_t, grub_uint32_t);
|
||||
int NESTED_FUNC_ATTR fill_hook (grub_uint64_t addr, grub_uint64_t size, grub_uint32_t type)
|
||||
{
|
||||
pm->addr = addr;
|
||||
pm->len = size;
|
||||
|
||||
rootdev->common.len = sizeof (struct grub_netbsd_btinfo_rootdevice);
|
||||
rootdev->common.type = NETBSD_BTINFO_ROOTDEVICE;
|
||||
grub_sprintf (rootdev->devname, "%cd%d%c", (biosdev & 0x80) ? 'w' : 'f',
|
||||
unit, 'a' + part);
|
||||
switch (type)
|
||||
{
|
||||
case GRUB_MACHINE_MEMORY_AVAILABLE:
|
||||
pm->type = NETBSD_MMAP_AVAILABLE;
|
||||
break;
|
||||
|
||||
bootinfo = (struct grub_netbsd_bootinfo *) (rootdev + 1);
|
||||
bootinfo->bi_count = 1;
|
||||
bootinfo->bi_data[0] = rootdev;
|
||||
case GRUB_MACHINE_MEMORY_ACPI:
|
||||
pm->type = NETBSD_MMAP_ACPI;
|
||||
break;
|
||||
|
||||
case GRUB_MACHINE_MEMORY_NVS:
|
||||
pm->type = NETBSD_MMAP_NVS;
|
||||
break;
|
||||
|
||||
default:
|
||||
pm->type = NETBSD_MMAP_RESERVED;
|
||||
break;
|
||||
}
|
||||
pm++;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
grub_mmap_iterate (count_hook);
|
||||
|
||||
if (kern_end + sizeof (struct grub_netbsd_btinfo_rootdevice)
|
||||
+ sizeof (struct grub_netbsd_bootinfo)
|
||||
+ sizeof (struct grub_netbsd_btinfo_mmap_header)
|
||||
+ count * sizeof (struct grub_netbsd_btinfo_mmap_entry)
|
||||
> grub_os_area_addr + grub_os_area_size)
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "No memory for boot info.");
|
||||
|
||||
curarg = mmap = (struct grub_netbsd_btinfo_mmap_header *) kern_end;
|
||||
pm = (struct grub_netbsd_btinfo_mmap_entry *) (mmap + 1);
|
||||
|
||||
grub_mmap_iterate (fill_hook);
|
||||
mmap->common.type = NETBSD_BTINFO_MEMMAP;
|
||||
mmap->common.len = (char *) pm - (char *) mmap;
|
||||
mmap->count = count;
|
||||
curarg = pm;
|
||||
|
||||
if (netbsd_root)
|
||||
{
|
||||
struct grub_netbsd_btinfo_rootdevice *rootdev;
|
||||
|
||||
rootdev = (struct grub_netbsd_btinfo_rootdevice *) curarg;
|
||||
|
||||
rootdev->common.len = sizeof (struct grub_netbsd_btinfo_rootdevice);
|
||||
rootdev->common.type = NETBSD_BTINFO_ROOTDEVICE;
|
||||
grub_strncpy (rootdev->devname, netbsd_root, sizeof (rootdev->devname));
|
||||
|
||||
bootinfo = (struct grub_netbsd_bootinfo *) (rootdev + 1);
|
||||
bootinfo->bi_count = 2;
|
||||
bootinfo->bi_data[0] = mmap;
|
||||
bootinfo->bi_data[1] = rootdev;
|
||||
}
|
||||
else
|
||||
{
|
||||
bootinfo = (struct grub_netbsd_bootinfo *) curarg;
|
||||
bootinfo->bi_count = 1;
|
||||
bootinfo->bi_data[0] = mmap;
|
||||
}
|
||||
|
||||
grub_unix_real_boot (entry, bootflags, 0, bootinfo,
|
||||
0, grub_mmap_get_upper () >> 10,
|
||||
grub_mmap_get_lower () >> 10);
|
||||
0, (grub_uint32_t) (grub_mmap_get_upper () >> 10),
|
||||
(grub_uint32_t) (grub_mmap_get_lower () >> 10));
|
||||
|
||||
/* Not reached. */
|
||||
return GRUB_ERR_NONE;
|
||||
|
@ -600,6 +734,9 @@ grub_bsd_unload (void)
|
|||
kernel_type = KERNEL_TYPE_NONE;
|
||||
grub_dl_unref (my_mod);
|
||||
|
||||
grub_free (netbsd_root);
|
||||
netbsd_root = NULL;
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
|
@ -733,8 +870,18 @@ grub_bsd_load_elf (grub_elf_t elf)
|
|||
else if (grub_elf_is_elf64 (elf))
|
||||
{
|
||||
is_64bit = 1;
|
||||
entry = elf->ehdr.ehdr64.e_entry & 0xffffffff;
|
||||
entry_hi = (elf->ehdr.ehdr64.e_entry >> 32) & 0xffffffff;
|
||||
|
||||
/* FreeBSD has 64-bit entry point. */
|
||||
if (kernel_type == KERNEL_TYPE_FREEBSD)
|
||||
{
|
||||
entry = elf->ehdr.ehdr64.e_entry & 0xffffffff;
|
||||
entry_hi = (elf->ehdr.ehdr64.e_entry >> 32) & 0xffffffff;
|
||||
}
|
||||
else
|
||||
{
|
||||
entry = elf->ehdr.ehdr64.e_entry & 0x0fffffff;
|
||||
entry_hi = 0;
|
||||
}
|
||||
return grub_elf64_load (elf, grub_bsd_elf64_hook, 0, 0);
|
||||
}
|
||||
else
|
||||
|
@ -785,41 +932,24 @@ fail:
|
|||
}
|
||||
|
||||
static grub_uint32_t
|
||||
grub_bsd_parse_flags (char *str, const char *opts,
|
||||
grub_bsd_parse_flags (const struct grub_arg_list *state,
|
||||
const grub_uint32_t * flags)
|
||||
{
|
||||
grub_uint32_t result = 0;
|
||||
unsigned i;
|
||||
|
||||
while (*str)
|
||||
{
|
||||
const char *po;
|
||||
const grub_uint32_t *pf;
|
||||
|
||||
po = opts;
|
||||
pf = flags;
|
||||
while (*po)
|
||||
{
|
||||
if (*str == *po)
|
||||
{
|
||||
result |= *pf;
|
||||
break;
|
||||
}
|
||||
po++;
|
||||
pf++;
|
||||
}
|
||||
str++;
|
||||
}
|
||||
for (i = 0; flags[i]; i++)
|
||||
if (state[i].set)
|
||||
result |= flags[i];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_freebsd (grub_command_t cmd __attribute__ ((unused)),
|
||||
int argc, char *argv[])
|
||||
grub_cmd_freebsd (grub_extcmd_t cmd, int argc, char *argv[])
|
||||
{
|
||||
kernel_type = KERNEL_TYPE_FREEBSD;
|
||||
bootflags = ((argc <= 1) ? 0 :
|
||||
grub_bsd_parse_flags (argv[1], freebsd_opts, freebsd_flags));
|
||||
bootflags = grub_bsd_parse_flags (cmd->state, freebsd_flags);
|
||||
|
||||
if (grub_bsd_load (argc, argv) == GRUB_ERR_NONE)
|
||||
{
|
||||
|
@ -879,12 +1009,10 @@ grub_cmd_freebsd (grub_command_t cmd __attribute__ ((unused)),
|
|||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_openbsd (grub_command_t cmd __attribute__ ((unused)),
|
||||
int argc, char *argv[])
|
||||
grub_cmd_openbsd (grub_extcmd_t cmd, int argc, char *argv[])
|
||||
{
|
||||
kernel_type = KERNEL_TYPE_OPENBSD;
|
||||
bootflags = ((argc <= 1) ? 0 :
|
||||
grub_bsd_parse_flags (argv[1], openbsd_opts, openbsd_flags));
|
||||
bootflags = grub_bsd_parse_flags (cmd->state, openbsd_flags);
|
||||
|
||||
if (grub_bsd_load (argc, argv) == GRUB_ERR_NONE)
|
||||
grub_loader_set (grub_openbsd_boot, grub_bsd_unload, 1);
|
||||
|
@ -893,15 +1021,17 @@ grub_cmd_openbsd (grub_command_t cmd __attribute__ ((unused)),
|
|||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_netbsd (grub_command_t cmd __attribute__ ((unused)),
|
||||
int argc, char *argv[])
|
||||
grub_cmd_netbsd (grub_extcmd_t cmd, int argc, char *argv[])
|
||||
{
|
||||
kernel_type = KERNEL_TYPE_NETBSD;
|
||||
bootflags = ((argc <= 1) ? 0 :
|
||||
grub_bsd_parse_flags (argv[1], netbsd_opts, netbsd_flags));
|
||||
bootflags = grub_bsd_parse_flags (cmd->state, netbsd_flags);
|
||||
|
||||
if (grub_bsd_load (argc, argv) == GRUB_ERR_NONE)
|
||||
grub_loader_set (grub_netbsd_boot, grub_bsd_unload, 1);
|
||||
{
|
||||
grub_loader_set (grub_netbsd_boot, grub_bsd_unload, 1);
|
||||
if (cmd->state[NETBSD_ROOT_ARG].set)
|
||||
netbsd_root = grub_strdup (cmd->state[NETBSD_ROOT_ARG].arg);
|
||||
}
|
||||
|
||||
return grub_errno;
|
||||
}
|
||||
|
@ -1112,21 +1242,24 @@ grub_cmd_freebsd_module_elf (grub_command_t cmd __attribute__ ((unused)),
|
|||
}
|
||||
|
||||
|
||||
static grub_command_t cmd_freebsd, cmd_openbsd, cmd_netbsd;
|
||||
static grub_extcmd_t cmd_freebsd, cmd_openbsd, cmd_netbsd;
|
||||
static grub_command_t cmd_freebsd_loadenv, cmd_freebsd_module;
|
||||
static grub_command_t cmd_freebsd_module_elf;
|
||||
|
||||
GRUB_MOD_INIT (bsd)
|
||||
{
|
||||
cmd_freebsd =
|
||||
grub_register_command ("freebsd", grub_cmd_freebsd,
|
||||
0, "load kernel of FreeBSD");
|
||||
cmd_openbsd =
|
||||
grub_register_command ("openbsd", grub_cmd_openbsd,
|
||||
0, "load kernel of OpenBSD");
|
||||
cmd_netbsd =
|
||||
grub_register_command ("netbsd", grub_cmd_netbsd,
|
||||
0, "load kernel of NetBSD");
|
||||
cmd_freebsd = grub_register_extcmd ("freebsd", grub_cmd_freebsd,
|
||||
GRUB_COMMAND_FLAG_BOTH,
|
||||
"freebsd FILE", "Load kernel of FreeBSD.",
|
||||
freebsd_opts);
|
||||
cmd_openbsd = grub_register_extcmd ("openbsd", grub_cmd_openbsd,
|
||||
GRUB_COMMAND_FLAG_BOTH,
|
||||
"openbsd FILE", "Load kernel of OpenBSD.",
|
||||
openbsd_opts);
|
||||
cmd_netbsd = grub_register_extcmd ("netbsd", grub_cmd_netbsd,
|
||||
GRUB_COMMAND_FLAG_BOTH,
|
||||
"netbsd FILE", "Load kernel of NetBSD.",
|
||||
netbsd_opts);
|
||||
cmd_freebsd_loadenv =
|
||||
grub_register_command ("freebsd_loadenv", grub_cmd_freebsd_loadenv,
|
||||
0, "load FreeBSD env");
|
||||
|
@ -1142,9 +1275,9 @@ GRUB_MOD_INIT (bsd)
|
|||
|
||||
GRUB_MOD_FINI (bsd)
|
||||
{
|
||||
grub_unregister_command (cmd_freebsd);
|
||||
grub_unregister_command (cmd_openbsd);
|
||||
grub_unregister_command (cmd_netbsd);
|
||||
grub_unregister_extcmd (cmd_freebsd);
|
||||
grub_unregister_extcmd (cmd_openbsd);
|
||||
grub_unregister_extcmd (cmd_netbsd);
|
||||
|
||||
grub_unregister_command (cmd_freebsd_loadenv);
|
||||
grub_unregister_command (cmd_freebsd_module);
|
||||
|
|
|
@ -197,15 +197,15 @@ SUFFIX (grub_freebsd_load_elfmodule) (grub_file_t file, int argc, char *argv[],
|
|||
if (curload < module + sizeof (e))
|
||||
curload = module + sizeof (e);
|
||||
|
||||
load (file, UINT_TO_PTR (module + e.e_shoff), e.e_shoff,
|
||||
load (file, UINT_TO_PTR (curload), e.e_shoff,
|
||||
e.e_shnum * e.e_shentsize);
|
||||
if (curload < module + e.e_shoff + e.e_shnum * e.e_shentsize)
|
||||
curload = module + e.e_shoff + e.e_shnum * e.e_shentsize;
|
||||
e.e_shoff = curload - module;
|
||||
curload += e.e_shnum * e.e_shentsize;
|
||||
|
||||
load (file, UINT_TO_PTR (module + e.e_phoff), e.e_phoff,
|
||||
load (file, UINT_TO_PTR (curload), e.e_phoff,
|
||||
e.e_phnum * e.e_phentsize);
|
||||
if (curload < module + e.e_phoff + e.e_phnum * e.e_phentsize)
|
||||
curload = module + e.e_phoff + e.e_phnum * e.e_phentsize;
|
||||
e.e_phoff = curload - module;
|
||||
curload += e.e_phnum * e.e_phentsize;
|
||||
|
||||
*kern_end = curload;
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <grub/video.h>
|
||||
#include <grub/video_fb.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i386/pc/vbe.h>
|
||||
|
||||
#define GRUB_LINUX_CL_OFFSET 0x1000
|
||||
#define GRUB_LINUX_CL_END_OFFSET 0x2000
|
||||
|
@ -416,6 +417,33 @@ grub_linux_setup_video (struct linux_kernel_params *params)
|
|||
params->reserved_mask_size = mode_info.reserved_mask_size;
|
||||
params->reserved_field_pos = mode_info.reserved_field_pos;
|
||||
|
||||
|
||||
#ifdef GRUB_MACHINE_PCBIOS
|
||||
/* VESA packed modes may come with zeroed mask sizes, which need
|
||||
to be set here according to DAC Palette width. If we don't,
|
||||
this results in Linux displaying a black screen. */
|
||||
if (mode_info.bpp <= 8)
|
||||
{
|
||||
struct grub_vbe_info_block controller_info;
|
||||
int status;
|
||||
int width = 8;
|
||||
|
||||
status = grub_vbe_bios_get_controller_info (&controller_info);
|
||||
|
||||
if (status == GRUB_VBE_STATUS_OK &&
|
||||
(controller_info.capabilities & GRUB_VBE_CAPABILITY_DACWIDTH))
|
||||
status = grub_vbe_bios_set_dac_palette_width (&width);
|
||||
|
||||
if (status != GRUB_VBE_STATUS_OK)
|
||||
/* 6 is default after mode reset. */
|
||||
width = 6;
|
||||
|
||||
params->red_mask_size = params->green_mask_size
|
||||
= params->blue_mask_size = width;
|
||||
params->reserved_mask_size = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -247,7 +247,7 @@ grub_cpu_xnu_fill_devicetree (void)
|
|||
curval->datasize = (SYSTEM_TABLE_SIZEOF (firmware_revision));
|
||||
curval->data = grub_malloc (curval->datasize);
|
||||
if (! curval->data)
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't create device tree");
|
||||
return grub_errno;
|
||||
grub_memcpy (curval->data, (SYSTEM_TABLE_VAR(firmware_revision)),
|
||||
curval->datasize);
|
||||
|
||||
|
@ -258,7 +258,7 @@ grub_cpu_xnu_fill_devicetree (void)
|
|||
2 * (utf16_strlen (SYSTEM_TABLE_PTR (firmware_vendor)) + 1);
|
||||
curval->data = grub_malloc (curval->datasize);
|
||||
if (! curval->data)
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't create device tree");
|
||||
return grub_errno;
|
||||
grub_memcpy (curval->data, SYSTEM_TABLE_PTR (firmware_vendor),
|
||||
curval->datasize);
|
||||
|
||||
|
@ -268,7 +268,7 @@ grub_cpu_xnu_fill_devicetree (void)
|
|||
curval->datasize = sizeof ("EFI32");
|
||||
curval->data = grub_malloc (curval->datasize);
|
||||
if (! curval->data)
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't create device tree");
|
||||
return grub_errno;
|
||||
if (SIZEOF_OF_UINTN == 4)
|
||||
grub_memcpy (curval->data, "EFI32", curval->datasize);
|
||||
else
|
||||
|
@ -287,7 +287,7 @@ grub_cpu_xnu_fill_devicetree (void)
|
|||
curval->datasize = sizeof (grub_uint64_t);
|
||||
curval->data = grub_malloc (curval->datasize);
|
||||
if (!curval->data)
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't create device tree");
|
||||
return grub_errno;
|
||||
|
||||
/* First see if user supplies the value. */
|
||||
char *fsbvar = grub_env_get ("fsb");
|
||||
|
@ -362,8 +362,7 @@ grub_cpu_xnu_fill_devicetree (void)
|
|||
curval->datasize = sizeof (guid);
|
||||
curval->data = grub_malloc (curval->datasize);
|
||||
if (! curval->data)
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||
"couldn't create device tree");
|
||||
return grub_errno;
|
||||
grub_memcpy (curval->data, &guid, curval->datasize);
|
||||
|
||||
/* The value "table". */
|
||||
|
@ -373,8 +372,7 @@ grub_cpu_xnu_fill_devicetree (void)
|
|||
curval->datasize = SIZEOF_OF_UINTN;
|
||||
curval->data = grub_malloc (curval->datasize);
|
||||
if (! curval->data)
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||
"couldn't create device tree");
|
||||
return grub_errno;
|
||||
if (SIZEOF_OF_UINTN == 4)
|
||||
*((grub_uint32_t *)curval->data) = PTR_TO_UINT32 (ptr);
|
||||
else
|
||||
|
@ -392,8 +390,7 @@ grub_cpu_xnu_fill_devicetree (void)
|
|||
curval->datasize = grub_strlen (table_aliases[j].name) + 1;
|
||||
curval->data = grub_malloc (curval->datasize);
|
||||
if (!curval->data)
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||
"couldn't create device tree");
|
||||
return grub_errno;
|
||||
grub_memcpy (curval->data, table_aliases[j].name, curval->datasize);
|
||||
}
|
||||
}
|
||||
|
@ -409,8 +406,7 @@ grub_cpu_xnu_fill_devicetree (void)
|
|||
curval->datasize = SIZEOF_OF_UINTN;
|
||||
curval->data = grub_malloc (curval->datasize);
|
||||
if (! curval->data)
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||
"couldn't create device tree");
|
||||
return grub_errno;
|
||||
if (SIZEOF_OF_UINTN == 4)
|
||||
*((grub_uint32_t *) curval->data)
|
||||
= PTR_TO_UINT32 (SYSTEM_TABLE_PTR (runtime_services));
|
||||
|
|
|
@ -368,8 +368,8 @@ grub_cmd_badram (grub_command_t cmd __attribute__ ((unused)),
|
|||
iterator++)
|
||||
{
|
||||
grub_dprintf ("badram", "%llx (size %llx) is a badram range\n",
|
||||
(long long) cur, (long long) (1ULL << tail) - 1);
|
||||
grub_mmap_register (cur, (1ULL << tail) - 1, GRUB_MACHINE_MEMORY_HOLE);
|
||||
(unsigned long long) cur, (1ULL << tail));
|
||||
grub_mmap_register (cur, (1ULL << tail), GRUB_MACHINE_MEMORY_HOLE);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
256
normal/auth.c
Normal file
256
normal/auth.c
Normal file
|
@ -0,0 +1,256 @@
|
|||
/*
|
||||
* 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/auth.h>
|
||||
#include <grub/list.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/normal.h>
|
||||
|
||||
struct grub_auth_user
|
||||
{
|
||||
struct grub_auth_user *next;
|
||||
char *name;
|
||||
grub_auth_callback_t callback;
|
||||
void *arg;
|
||||
int authenticated;
|
||||
};
|
||||
|
||||
struct grub_auth_user *users = NULL;
|
||||
|
||||
int
|
||||
grub_auth_strcmp (const char *user_input, const char *template)
|
||||
{
|
||||
int ok = 1;
|
||||
const char *ptr1, *ptr2;
|
||||
for (ptr1 = user_input, ptr2 = template; *ptr1; ptr1++)
|
||||
if (*ptr1 == (ptr2 ? *ptr2 : ptr1[1]) && ok && ptr2 != NULL)
|
||||
ptr2++;
|
||||
else
|
||||
ok = 0;
|
||||
|
||||
return !ok;
|
||||
}
|
||||
|
||||
static int
|
||||
grub_iswordseparator (int c)
|
||||
{
|
||||
return (grub_isspace (c) || c == ',' || c == ';' || c == '|' || c == '&');
|
||||
}
|
||||
|
||||
int
|
||||
grub_auth_strword (const char *haystack, const char *needle)
|
||||
{
|
||||
const char *n_pos = needle;
|
||||
int found = 0;
|
||||
|
||||
while (grub_iswordseparator (*haystack))
|
||||
haystack++;
|
||||
|
||||
while (*haystack)
|
||||
{
|
||||
int ok = 1;
|
||||
/* Crawl both the needle and the haystack word we're on. */
|
||||
while(*haystack && !grub_iswordseparator (*haystack))
|
||||
{
|
||||
if (*haystack == *n_pos && ok)
|
||||
n_pos++;
|
||||
else
|
||||
ok = 0;
|
||||
|
||||
haystack++;
|
||||
}
|
||||
|
||||
if (ok)
|
||||
found = 1;
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_auth_register_authentication (const char *user,
|
||||
grub_auth_callback_t callback,
|
||||
void *arg)
|
||||
{
|
||||
struct grub_auth_user *cur;
|
||||
|
||||
cur = grub_named_list_find (GRUB_AS_NAMED_LIST (users), user);
|
||||
if (!cur)
|
||||
cur = grub_zalloc (sizeof (*cur));
|
||||
if (!cur)
|
||||
return grub_errno;
|
||||
cur->callback = callback;
|
||||
cur->arg = arg;
|
||||
if (! cur->name)
|
||||
{
|
||||
cur->name = grub_strdup (user);
|
||||
if (!cur->name)
|
||||
{
|
||||
grub_free (cur);
|
||||
return grub_errno;
|
||||
}
|
||||
grub_list_push (GRUB_AS_LIST_P (&users), GRUB_AS_LIST (cur));
|
||||
}
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_auth_unregister_authentication (const char *user)
|
||||
{
|
||||
struct grub_auth_user *cur;
|
||||
cur = grub_named_list_find (GRUB_AS_NAMED_LIST (users), user);
|
||||
if (!cur)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "user '%s' not found", user);
|
||||
if (!cur->authenticated)
|
||||
{
|
||||
grub_free (cur->name);
|
||||
grub_list_remove (GRUB_AS_LIST_P (&users), GRUB_AS_LIST (cur));
|
||||
grub_free (cur);
|
||||
}
|
||||
else
|
||||
{
|
||||
cur->callback = NULL;
|
||||
cur->arg = NULL;
|
||||
}
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_auth_authenticate (const char *user)
|
||||
{
|
||||
struct grub_auth_user *cur;
|
||||
|
||||
cur = grub_named_list_find (GRUB_AS_NAMED_LIST (users), user);
|
||||
if (!cur)
|
||||
cur = grub_zalloc (sizeof (*cur));
|
||||
if (!cur)
|
||||
return grub_errno;
|
||||
|
||||
cur->authenticated = 1;
|
||||
|
||||
if (! cur->name)
|
||||
{
|
||||
cur->name = grub_strdup (user);
|
||||
if (!cur->name)
|
||||
{
|
||||
grub_free (cur);
|
||||
return grub_errno;
|
||||
}
|
||||
grub_list_push (GRUB_AS_LIST_P (&users), GRUB_AS_LIST (cur));
|
||||
}
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_auth_deauthenticate (const char *user)
|
||||
{
|
||||
struct grub_auth_user *cur;
|
||||
cur = grub_named_list_find (GRUB_AS_NAMED_LIST (users), user);
|
||||
if (!cur)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "user '%s' not found", user);
|
||||
if (!cur->callback)
|
||||
{
|
||||
grub_free (cur->name);
|
||||
grub_list_remove (GRUB_AS_LIST_P (&users), GRUB_AS_LIST (cur));
|
||||
grub_free (cur);
|
||||
}
|
||||
else
|
||||
cur->authenticated = 0;
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static int
|
||||
is_authenticated (const char *userlist)
|
||||
{
|
||||
const char *superusers;
|
||||
|
||||
auto int hook (grub_list_t item);
|
||||
int hook (grub_list_t item)
|
||||
{
|
||||
const char *name;
|
||||
if (!((struct grub_auth_user *) item)->authenticated)
|
||||
return 0;
|
||||
name = ((struct grub_auth_user *) item)->name;
|
||||
|
||||
return (userlist && grub_auth_strword (userlist, name))
|
||||
|| grub_auth_strword (superusers, name);
|
||||
}
|
||||
|
||||
superusers = grub_env_get ("superusers");
|
||||
|
||||
if (!superusers)
|
||||
return 1;
|
||||
|
||||
return grub_list_iterate (GRUB_AS_LIST (users), hook);
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_auth_check_authentication (const char *userlist)
|
||||
{
|
||||
char login[1024];
|
||||
struct grub_auth_user *cur = NULL;
|
||||
grub_err_t err;
|
||||
|
||||
auto int hook (grub_list_t item);
|
||||
int hook (grub_list_t item)
|
||||
{
|
||||
if (grub_auth_strcmp (login, ((struct grub_auth_user *) item)->name) == 0)
|
||||
cur = (struct grub_auth_user *) item;
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto int hook_any (grub_list_t item);
|
||||
int hook_any (grub_list_t item)
|
||||
{
|
||||
if (((struct grub_auth_user *) item)->callback)
|
||||
cur = (struct grub_auth_user *) item;
|
||||
return 0;
|
||||
}
|
||||
|
||||
grub_memset (login, 0, sizeof (login));
|
||||
|
||||
if (is_authenticated (userlist))
|
||||
return GRUB_ERR_NONE;
|
||||
|
||||
if (!grub_cmdline_get ("Enter username: ", login, sizeof (login) - 1,
|
||||
0, 0, 0))
|
||||
return GRUB_ACCESS_DENIED;
|
||||
|
||||
grub_list_iterate (GRUB_AS_LIST (users), hook);
|
||||
|
||||
if (!cur || ! cur->callback)
|
||||
{
|
||||
grub_list_iterate (GRUB_AS_LIST (users), hook_any);
|
||||
|
||||
/* No users present at all. */
|
||||
if (!cur)
|
||||
return GRUB_ACCESS_DENIED;
|
||||
|
||||
/* Display any of available authentication schemes. */
|
||||
err = cur->callback (login, 0);
|
||||
|
||||
return GRUB_ACCESS_DENIED;
|
||||
}
|
||||
err = cur->callback (login, cur->arg);
|
||||
if (is_authenticated (userlist))
|
||||
return GRUB_ERR_NONE;
|
||||
return GRUB_ACCESS_DENIED;
|
||||
}
|
|
@ -181,7 +181,7 @@ print_completion (const char *item, grub_completion_type_t type, int count)
|
|||
/* FIXME: The dumb interface is not supported yet. */
|
||||
int
|
||||
grub_cmdline_get (const char *prompt, char cmdline[], unsigned max_len,
|
||||
int echo_char, int readline)
|
||||
int echo_char, int readline, int history)
|
||||
{
|
||||
unsigned xpos, ypos, ystart;
|
||||
grub_size_t lpos, llen;
|
||||
|
@ -273,14 +273,14 @@ grub_cmdline_get (const char *prompt, char cmdline[], unsigned max_len,
|
|||
if ((grub_getxy () >> 8) != 0)
|
||||
grub_putchar ('\n');
|
||||
|
||||
grub_printf (prompt);
|
||||
grub_printf ("%s", prompt);
|
||||
|
||||
xpos = plen;
|
||||
ystart = ypos = (grub_getxy () & 0xFF);
|
||||
|
||||
cl_insert (cmdline);
|
||||
|
||||
if (hist_used == 0)
|
||||
if (history && hist_used == 0)
|
||||
grub_history_add (buf);
|
||||
|
||||
while ((key = GRUB_TERM_ASCII_CHAR (grub_getkey ())) != '\n' && key != '\r')
|
||||
|
@ -468,11 +468,14 @@ grub_cmdline_get (const char *prompt, char cmdline[], unsigned max_len,
|
|||
while (buf[lpos] == ' ')
|
||||
lpos++;
|
||||
|
||||
histpos = 0;
|
||||
if (grub_strlen (buf) > 0)
|
||||
if (history)
|
||||
{
|
||||
grub_history_replace (histpos, buf);
|
||||
grub_history_add ("");
|
||||
histpos = 0;
|
||||
if (grub_strlen (buf) > 0)
|
||||
{
|
||||
grub_history_replace (histpos, buf);
|
||||
grub_history_add ("");
|
||||
}
|
||||
}
|
||||
|
||||
grub_memcpy (cmdline, buf + lpos, llen - lpos + 1);
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <grub/parser.h>
|
||||
#include <grub/reader.h>
|
||||
#include <grub/menu_viewer.h>
|
||||
#include <grub/auth.h>
|
||||
|
||||
#define GRUB_DEFAULT_HISTORY_SIZE 50
|
||||
|
||||
|
@ -164,6 +165,7 @@ grub_normal_add_menu_entry (int argc, const char **args,
|
|||
int i;
|
||||
struct grub_menu_entry_class *classes_head; /* Dummy head node for list. */
|
||||
struct grub_menu_entry_class *classes_tail;
|
||||
char *users = NULL;
|
||||
|
||||
/* Allocate dummy head node for class list. */
|
||||
classes_head = grub_zalloc (sizeof (struct grub_menu_entry_class));
|
||||
|
@ -218,6 +220,18 @@ grub_normal_add_menu_entry (int argc, const char **args,
|
|||
classes_tail = new_class;
|
||||
continue;
|
||||
}
|
||||
else if (grub_strcmp(arg, "users") == 0)
|
||||
{
|
||||
i++;
|
||||
users = grub_strdup (args[i]);
|
||||
if (! users)
|
||||
{
|
||||
failed = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Handle invalid argument. */
|
||||
|
@ -275,6 +289,9 @@ grub_normal_add_menu_entry (int argc, const char **args,
|
|||
|
||||
(*last)->title = menutitle;
|
||||
(*last)->classes = classes_head;
|
||||
if (users)
|
||||
(*last)->restricted = 1;
|
||||
(*last)->users = users;
|
||||
(*last)->sourcecode = menusourcecode;
|
||||
|
||||
menu->size++;
|
||||
|
@ -465,7 +482,19 @@ quit:
|
|||
void
|
||||
grub_cmdline_run (int nested)
|
||||
{
|
||||
grub_reader_t reader = grub_reader_get_current ();
|
||||
grub_reader_t reader;
|
||||
grub_err_t err = GRUB_ERR_NONE;
|
||||
|
||||
err = grub_auth_check_authentication (NULL);
|
||||
|
||||
if (err)
|
||||
{
|
||||
grub_print_error ();
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
return;
|
||||
}
|
||||
|
||||
reader = grub_reader_get_current ();
|
||||
|
||||
reader_nested = nested;
|
||||
if (reader->init)
|
||||
|
@ -501,7 +530,7 @@ grub_normal_read_line (char **line, int cont)
|
|||
while (1)
|
||||
{
|
||||
cmdline[0] = 0;
|
||||
if (grub_cmdline_get (prompt, cmdline, sizeof (cmdline), 0, 1))
|
||||
if (grub_cmdline_get (prompt, cmdline, sizeof (cmdline), 0, 1, 1))
|
||||
break;
|
||||
|
||||
if ((reader_nested) || (cont))
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <grub/menu_viewer.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/parser.h>
|
||||
#include <grub/auth.h>
|
||||
|
||||
/* Get a menu entry by its index in the entry list. */
|
||||
grub_menu_entry_t
|
||||
|
@ -124,6 +125,18 @@ get_and_remove_first_entry_number (const char *name)
|
|||
void
|
||||
grub_menu_execute_entry(grub_menu_entry_t entry)
|
||||
{
|
||||
grub_err_t err = GRUB_ERR_NONE;
|
||||
|
||||
if (entry->restricted)
|
||||
err = grub_auth_check_authentication (entry->users);
|
||||
|
||||
if (err)
|
||||
{
|
||||
grub_print_error ();
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
return;
|
||||
}
|
||||
|
||||
grub_parser_execute ((char *) entry->sourcecode);
|
||||
|
||||
if (grub_errno == GRUB_ERR_NONE && grub_loader_is_loaded ())
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <grub/loader.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/parser.h>
|
||||
#include <grub/auth.h>
|
||||
|
||||
enum update_mode
|
||||
{
|
||||
|
@ -1026,6 +1027,16 @@ grub_menu_entry_run (grub_menu_entry_t entry)
|
|||
{
|
||||
struct screen *screen;
|
||||
int prev_c;
|
||||
grub_err_t err = GRUB_ERR_NONE;
|
||||
|
||||
err = grub_auth_check_authentication (NULL);
|
||||
|
||||
if (err)
|
||||
{
|
||||
grub_print_error ();
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
return;
|
||||
}
|
||||
|
||||
screen = make_screen (entry);
|
||||
if (! screen)
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <grub/env.h>
|
||||
#include <grub/menu_viewer.h>
|
||||
#include <grub/menu.h>
|
||||
#include <grub/auth.h>
|
||||
|
||||
/* The list of menu viewers. */
|
||||
static grub_menu_viewer_t menu_viewer_list;
|
||||
|
@ -55,9 +56,26 @@ grub_err_t
|
|||
grub_menu_viewer_show_menu (grub_menu_t menu, int nested)
|
||||
{
|
||||
grub_menu_viewer_t cur = get_current_menu_viewer ();
|
||||
grub_err_t err1, err2;
|
||||
if (!cur)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "No menu viewer available.");
|
||||
|
||||
return cur->show_menu (menu, nested);
|
||||
while (1)
|
||||
{
|
||||
err1 = cur->show_menu (menu, nested);
|
||||
grub_print_error ();
|
||||
|
||||
err2 = grub_auth_check_authentication (NULL);
|
||||
if (err2)
|
||||
{
|
||||
grub_print_error ();
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return err1;
|
||||
}
|
||||
|
||||
|
|
|
@ -189,7 +189,7 @@ acorn_partition_map_get_name (const grub_partition_t p)
|
|||
/* Partition map type. */
|
||||
static struct grub_partition_map grub_acorn_partition_map =
|
||||
{
|
||||
.name = "Linux/ADFS partition map",
|
||||
.name = "part_acorn",
|
||||
.iterate = acorn_partition_map_iterate,
|
||||
.probe = acorn_partition_map_probe,
|
||||
.get_name = acorn_partition_map_get_name
|
||||
|
|
|
@ -198,7 +198,7 @@ amiga_partition_map_get_name (const grub_partition_t p)
|
|||
/* Partition map type. */
|
||||
static struct grub_partition_map grub_amiga_partition_map =
|
||||
{
|
||||
.name = "amiga_partition_map",
|
||||
.name = "part_amiga",
|
||||
.iterate = amiga_partition_map_iterate,
|
||||
.probe = amiga_partition_map_probe,
|
||||
.get_name = amiga_partition_map_get_name
|
||||
|
|
|
@ -241,7 +241,7 @@ apple_partition_map_get_name (const grub_partition_t p)
|
|||
/* Partition map type. */
|
||||
static struct grub_partition_map grub_apple_partition_map =
|
||||
{
|
||||
.name = "apple_partition_map",
|
||||
.name = "part_apple",
|
||||
.iterate = apple_partition_map_iterate,
|
||||
.probe = apple_partition_map_probe,
|
||||
.get_name = apple_partition_map_get_name
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include <grub/mm.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/pc_partition.h>
|
||||
#include <grub/msdos_partition.h>
|
||||
#include <grub/gpt_partition.h>
|
||||
|
||||
static grub_uint8_t grub_gpt_magic[8] =
|
||||
|
@ -45,7 +45,7 @@ gpt_partition_map_iterate (grub_disk_t disk,
|
|||
struct grub_gpt_header gpt;
|
||||
struct grub_gpt_partentry entry;
|
||||
struct grub_disk raw;
|
||||
struct grub_pc_partition_mbr mbr;
|
||||
struct grub_msdos_partition_mbr mbr;
|
||||
grub_uint64_t entries;
|
||||
unsigned int i;
|
||||
int last_offset = 0;
|
||||
|
@ -176,7 +176,7 @@ gpt_partition_map_get_name (const grub_partition_t p)
|
|||
/* Partition map type. */
|
||||
static struct grub_partition_map grub_gpt_partition_map =
|
||||
{
|
||||
.name = "gpt_partition_map",
|
||||
.name = "part_gpt",
|
||||
.iterate = gpt_partition_map_iterate,
|
||||
.probe = gpt_partition_map_probe,
|
||||
.get_name = gpt_partition_map_get_name
|
||||
|
|
|
@ -18,13 +18,13 @@
|
|||
*/
|
||||
|
||||
#include <grub/partition.h>
|
||||
#include <grub/pc_partition.h>
|
||||
#include <grub/msdos_partition.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/dl.h>
|
||||
|
||||
static struct grub_partition_map grub_pc_partition_map;
|
||||
static struct grub_partition_map grub_msdos_partition_map;
|
||||
|
||||
|
||||
/* Parse the partition representation in STR and return a partition. */
|
||||
|
@ -32,7 +32,7 @@ static grub_partition_t
|
|||
grub_partition_parse (const char *str)
|
||||
{
|
||||
grub_partition_t p;
|
||||
struct grub_pc_partition *pcdata;
|
||||
struct grub_msdos_partition *pcdata;
|
||||
|
||||
char *s = (char *) str;
|
||||
|
||||
|
@ -40,12 +40,12 @@ grub_partition_parse (const char *str)
|
|||
if (! p)
|
||||
return 0;
|
||||
|
||||
pcdata = (struct grub_pc_partition *) grub_malloc (sizeof (*pcdata));
|
||||
pcdata = (struct grub_msdos_partition *) grub_malloc (sizeof (*pcdata));
|
||||
if (! pcdata)
|
||||
goto fail;
|
||||
|
||||
p->data = pcdata;
|
||||
p->partmap = &grub_pc_partition_map;
|
||||
p->partmap = &grub_msdos_partition_map;
|
||||
|
||||
/* Initialize some of the fields with invalid values. */
|
||||
pcdata->bsd_part = pcdata->dos_type = pcdata->bsd_type = p->index = -1;
|
||||
|
@ -93,10 +93,12 @@ pc_partition_map_iterate (grub_disk_t disk,
|
|||
const grub_partition_t partition))
|
||||
{
|
||||
struct grub_partition p;
|
||||
struct grub_pc_partition pcdata;
|
||||
struct grub_pc_partition_mbr mbr;
|
||||
struct grub_pc_partition_disk_label label;
|
||||
struct grub_msdos_partition pcdata;
|
||||
struct grub_msdos_partition_mbr mbr;
|
||||
struct grub_msdos_partition_disk_label label;
|
||||
struct grub_disk raw;
|
||||
int labeln = 0;
|
||||
grub_disk_addr_t lastaddr;
|
||||
|
||||
/* Enforce raw disk access. */
|
||||
raw = *disk;
|
||||
|
@ -106,17 +108,33 @@ pc_partition_map_iterate (grub_disk_t disk,
|
|||
pcdata.ext_offset = 0;
|
||||
pcdata.dos_part = -1;
|
||||
p.data = &pcdata;
|
||||
p.partmap = &grub_pc_partition_map;
|
||||
p.partmap = &grub_msdos_partition_map;
|
||||
|
||||
/* Any value different than `p.offset' will satisfy the check during
|
||||
first loop. */
|
||||
lastaddr = !p.offset;
|
||||
|
||||
while (1)
|
||||
{
|
||||
int i;
|
||||
struct grub_pc_partition_entry *e;
|
||||
struct grub_msdos_partition_entry *e;
|
||||
|
||||
/* Read the MBR. */
|
||||
if (grub_disk_read (&raw, p.offset, 0, sizeof (mbr), &mbr))
|
||||
goto finish;
|
||||
|
||||
/* This is our loop-detection algorithm. It works the following way:
|
||||
It saves last position which was a power of two. Then it compares the
|
||||
saved value with a current one. This way it's guaranteed that the loop
|
||||
will be broken by at most third walk.
|
||||
*/
|
||||
if (labeln && lastaddr == p.offset)
|
||||
return grub_error (GRUB_ERR_BAD_PART_TABLE, "loop detected");
|
||||
|
||||
labeln++;
|
||||
if ((labeln & (labeln - 1)) == 0)
|
||||
lastaddr = p.offset;
|
||||
|
||||
/* Check if it is valid. */
|
||||
if (mbr.signature != grub_cpu_to_le16 (GRUB_PC_PARTITION_SIGNATURE))
|
||||
return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature");
|
||||
|
@ -147,8 +165,8 @@ pc_partition_map_iterate (grub_disk_t disk,
|
|||
return grub_error (GRUB_ERR_BAD_PART_TABLE, "dummy mbr");
|
||||
|
||||
/* If this partition is a normal one, call the hook. */
|
||||
if (! grub_pc_partition_is_empty (e->type)
|
||||
&& ! grub_pc_partition_is_extended (e->type))
|
||||
if (! grub_msdos_partition_is_empty (e->type)
|
||||
&& ! grub_msdos_partition_is_extended (e->type))
|
||||
{
|
||||
pcdata.dos_part++;
|
||||
|
||||
|
@ -156,7 +174,7 @@ pc_partition_map_iterate (grub_disk_t disk,
|
|||
return 1;
|
||||
|
||||
/* Check if this is a BSD partition. */
|
||||
if (grub_pc_partition_is_bsd (e->type))
|
||||
if (grub_msdos_partition_is_bsd (e->type))
|
||||
{
|
||||
/* Check if the BSD label is within the DOS partition. */
|
||||
if (p.len <= GRUB_PC_PARTITION_BSD_LABEL_SECTOR)
|
||||
|
@ -186,7 +204,7 @@ pc_partition_map_iterate (grub_disk_t disk,
|
|||
pcdata.bsd_part < grub_cpu_to_le16 (label.num_partitions);
|
||||
pcdata.bsd_part++)
|
||||
{
|
||||
struct grub_pc_partition_bsd_entry *be
|
||||
struct grub_msdos_partition_bsd_entry *be
|
||||
= label.entries + pcdata.bsd_part;
|
||||
|
||||
p.start = grub_le_to_cpu32 (be->offset);
|
||||
|
@ -210,7 +228,7 @@ pc_partition_map_iterate (grub_disk_t disk,
|
|||
{
|
||||
e = mbr.entries + i;
|
||||
|
||||
if (grub_pc_partition_is_extended (e->type))
|
||||
if (grub_msdos_partition_is_extended (e->type))
|
||||
{
|
||||
p.offset = pcdata.ext_offset + grub_le_to_cpu32 (e->start);
|
||||
if (! pcdata.ext_offset)
|
||||
|
@ -234,14 +252,14 @@ static grub_partition_t
|
|||
pc_partition_map_probe (grub_disk_t disk, const char *str)
|
||||
{
|
||||
grub_partition_t p;
|
||||
struct grub_pc_partition *pcdata;
|
||||
struct grub_msdos_partition *pcdata;
|
||||
|
||||
auto int find_func (grub_disk_t d, const grub_partition_t partition);
|
||||
|
||||
int find_func (grub_disk_t d __attribute__ ((unused)),
|
||||
const grub_partition_t partition)
|
||||
{
|
||||
struct grub_pc_partition *partdata = partition->data;
|
||||
struct grub_msdos_partition *partdata = partition->data;
|
||||
|
||||
if ((pcdata->dos_part == partdata->dos_part || pcdata->dos_part == -1)
|
||||
&& pcdata->bsd_part == partdata->bsd_part)
|
||||
|
@ -283,7 +301,7 @@ static char *
|
|||
pc_partition_map_get_name (const grub_partition_t p)
|
||||
{
|
||||
char *name;
|
||||
struct grub_pc_partition *pcdata = p->data;
|
||||
struct grub_msdos_partition *pcdata = p->data;
|
||||
|
||||
name = grub_malloc (13);
|
||||
if (! name)
|
||||
|
@ -301,9 +319,9 @@ pc_partition_map_get_name (const grub_partition_t p)
|
|||
|
||||
|
||||
/* Partition map type. */
|
||||
static struct grub_partition_map grub_pc_partition_map =
|
||||
static struct grub_partition_map grub_msdos_partition_map =
|
||||
{
|
||||
.name = "pc_partition_map",
|
||||
.name = "part_msdos",
|
||||
.iterate = pc_partition_map_iterate,
|
||||
.probe = pc_partition_map_probe,
|
||||
.get_name = pc_partition_map_get_name
|
||||
|
@ -311,10 +329,10 @@ static struct grub_partition_map grub_pc_partition_map =
|
|||
|
||||
GRUB_MOD_INIT(pc_partition_map)
|
||||
{
|
||||
grub_partition_map_register (&grub_pc_partition_map);
|
||||
grub_partition_map_register (&grub_msdos_partition_map);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(pc_partition_map)
|
||||
{
|
||||
grub_partition_map_unregister (&grub_pc_partition_map);
|
||||
grub_partition_map_unregister (&grub_msdos_partition_map);
|
||||
}
|
|
@ -196,7 +196,7 @@ sun_partition_map_get_name (const grub_partition_t p)
|
|||
/* Partition map type. */
|
||||
static struct grub_partition_map grub_sun_partition_map =
|
||||
{
|
||||
.name = "sun_partition_map",
|
||||
.name = "part_sun",
|
||||
.iterate = sun_partition_map_iterate,
|
||||
.probe = sun_partition_map_probe,
|
||||
.get_name = sun_partition_map_get_name
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/pc_partition.h>
|
||||
#include <grub/msdos_partition.h>
|
||||
#include <grub/device.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/partition.h>
|
||||
|
@ -42,7 +42,7 @@ static grub_err_t grub_pcpart_boot (const grub_device_t dev,
|
|||
{
|
||||
int i, index;
|
||||
grub_partition_t part;
|
||||
struct grub_pc_partition_mbr mbr;
|
||||
struct grub_msdos_partition_mbr mbr;
|
||||
|
||||
if (dev->disk->partition->offset)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "not a primary partition");
|
||||
|
@ -92,7 +92,7 @@ static grub_err_t grub_pcpart_type (const grub_device_t dev,
|
|||
int index;
|
||||
grub_uint8_t type;
|
||||
grub_partition_t part;
|
||||
struct grub_pc_partition_mbr mbr;
|
||||
struct grub_msdos_partition_mbr mbr;
|
||||
|
||||
index = dev->disk->partition->index;
|
||||
part = dev->disk->partition;
|
||||
|
@ -119,8 +119,8 @@ static grub_err_t grub_pcpart_type (const grub_device_t dev,
|
|||
type &= ~GRUB_PC_PARTITION_TYPE_HIDDEN_FLAG;
|
||||
}
|
||||
|
||||
if (grub_pc_partition_is_empty (type)
|
||||
|| grub_pc_partition_is_extended (type))
|
||||
if (grub_msdos_partition_is_empty (type)
|
||||
|| grub_msdos_partition_is_extended (type))
|
||||
{
|
||||
dev->disk->partition = part;
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid type");
|
||||
|
@ -140,10 +140,10 @@ static grub_err_t grub_pcpart_type (const grub_device_t dev,
|
|||
|
||||
GRUB_MOD_INIT (pcpart)
|
||||
{
|
||||
activate_table_handle = grub_parttool_register ("pc_partition_map",
|
||||
activate_table_handle = grub_parttool_register ("part_msdos",
|
||||
grub_pcpart_boot,
|
||||
grub_pcpart_bootargs);
|
||||
type_table_handle = grub_parttool_register ("pc_partition_map",
|
||||
type_table_handle = grub_parttool_register ("part_msdos",
|
||||
grub_pcpart_type,
|
||||
grub_pcpart_typeargs);
|
||||
|
|
@ -58,7 +58,7 @@
|
|||
#define setjmp grub_setjmp
|
||||
#define longjmp grub_longjmp
|
||||
|
||||
#define fputs(s,f) grub_printf(s)
|
||||
#define fputs(s,f) grub_printf("%s", s)
|
||||
|
||||
#define isdigit grub_isdigit
|
||||
#define isalpha grub_isalpha
|
||||
|
|
|
@ -122,6 +122,10 @@ grub_script_execute_cmdline (struct grub_script_cmd *cmd)
|
|||
grub_errno = GRUB_ERR_NONE;
|
||||
}
|
||||
grub_free (assign);
|
||||
|
||||
grub_sprintf (errnobuf, "%d", grub_errno);
|
||||
grub_env_set ("?", errnobuf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ grub_script_function_find (char *functionname)
|
|||
break;
|
||||
|
||||
if (! func)
|
||||
grub_error (GRUB_ERR_UNKNOWN_COMMAND, "unknown command `%s'", functionname);
|
||||
grub_error (GRUB_ERR_UNKNOWN_COMMAND, "unknown command `%.20s'", functionname);
|
||||
|
||||
return func;
|
||||
}
|
||||
|
|
|
@ -134,8 +134,6 @@ grub_script_yylex (union YYSTYPE *yylval, struct grub_parser_param *parsestate)
|
|||
{
|
||||
grub_parser_state_t newstate;
|
||||
char use;
|
||||
char *buffer;
|
||||
char *bp;
|
||||
struct grub_lexer_param *state = parsestate->lexerstate;
|
||||
int firstrun = 1;
|
||||
|
||||
|
@ -212,6 +210,14 @@ grub_script_yylex (union YYSTYPE *yylval, struct grub_parser_param *parsestate)
|
|||
/* Check if it is a text. */
|
||||
if (check_textstate (newstate))
|
||||
{
|
||||
char *buffer = NULL;
|
||||
int bufpos = 0;
|
||||
/* Buffer is initially large enough to hold most commands
|
||||
but extends automatically when needed. */
|
||||
int bufsize = 128;
|
||||
|
||||
buffer = grub_malloc (bufsize);
|
||||
|
||||
/* In case the string is not quoted, this can be a one char
|
||||
length symbol. */
|
||||
if (newstate == GRUB_PARSER_STATE_TEXT)
|
||||
|
@ -254,16 +260,12 @@ grub_script_yylex (union YYSTYPE *yylval, struct grub_parser_param *parsestate)
|
|||
}
|
||||
}
|
||||
if (doexit)
|
||||
break;
|
||||
{
|
||||
grub_free (buffer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* XXX: Use a better size. */
|
||||
buffer = grub_script_malloc (parsestate, 2048);
|
||||
if (! buffer)
|
||||
return 0;
|
||||
|
||||
bp = buffer;
|
||||
|
||||
/* Read one token, possible quoted. */
|
||||
while (*state->script)
|
||||
{
|
||||
|
@ -295,32 +297,47 @@ grub_script_yylex (union YYSTYPE *yylval, struct grub_parser_param *parsestate)
|
|||
}
|
||||
if (breakout)
|
||||
break;
|
||||
if (use)
|
||||
*(bp++) = use;
|
||||
}
|
||||
else if (use)
|
||||
*(bp++) = use;
|
||||
|
||||
if (use)
|
||||
{
|
||||
if (bufsize <= bufpos + 1)
|
||||
{
|
||||
bufsize <<= 1;
|
||||
buffer = grub_realloc (buffer, bufsize);
|
||||
}
|
||||
buffer[bufpos++] = use;
|
||||
}
|
||||
|
||||
state->state = newstate;
|
||||
nextchar (state);
|
||||
}
|
||||
|
||||
/* A string of text was read in. */
|
||||
*bp = '\0';
|
||||
if (bufsize <= bufpos + 1)
|
||||
{
|
||||
bufsize <<= 1;
|
||||
buffer = grub_realloc (buffer, bufsize);
|
||||
}
|
||||
|
||||
buffer[bufpos++] = 0;
|
||||
|
||||
grub_dprintf ("scripting", "token=`%s'\n", buffer);
|
||||
yylval->arg = grub_script_arg_add (parsestate, yylval->arg,
|
||||
GRUB_SCRIPT_ARG_TYPE_STR, buffer);
|
||||
|
||||
grub_free (buffer);
|
||||
}
|
||||
else if (newstate == GRUB_PARSER_STATE_VAR
|
||||
|| newstate == GRUB_PARSER_STATE_QVAR)
|
||||
{
|
||||
/* XXX: Use a better size. */
|
||||
buffer = grub_script_malloc (parsestate, 2096);
|
||||
if (! buffer)
|
||||
return 0;
|
||||
char *buffer = NULL;
|
||||
int bufpos = 0;
|
||||
/* Buffer is initially large enough to hold most commands
|
||||
but extends automatically when needed. */
|
||||
int bufsize = 128;
|
||||
|
||||
bp = buffer;
|
||||
buffer = grub_malloc (bufsize);
|
||||
|
||||
/* This is a variable, read the variable name. */
|
||||
while (*state->script)
|
||||
|
@ -340,16 +357,33 @@ grub_script_yylex (union YYSTYPE *yylval, struct grub_parser_param *parsestate)
|
|||
}
|
||||
|
||||
if (use)
|
||||
*(bp++) = use;
|
||||
{
|
||||
if (bufsize <= bufpos + 1)
|
||||
{
|
||||
bufsize <<= 1;
|
||||
buffer = grub_realloc (buffer, bufsize);
|
||||
}
|
||||
buffer[bufpos++] = use;
|
||||
}
|
||||
|
||||
nextchar (state);
|
||||
state->state = newstate;
|
||||
}
|
||||
|
||||
*bp = '\0';
|
||||
if (bufsize <= bufpos + 1)
|
||||
{
|
||||
bufsize <<= 1;
|
||||
buffer = grub_realloc (buffer, bufsize);
|
||||
}
|
||||
|
||||
buffer[bufpos++] = 0;
|
||||
|
||||
state->state = newstate;
|
||||
yylval->arg = grub_script_arg_add (parsestate, yylval->arg,
|
||||
GRUB_SCRIPT_ARG_TYPE_VAR, buffer);
|
||||
grub_dprintf ("scripting", "vartoken=`%s'\n", buffer);
|
||||
|
||||
grub_free (buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -110,10 +110,13 @@ grub_script_arg_add (struct grub_parser_param *state, struct grub_script_arg *ar
|
|||
{
|
||||
struct grub_script_arg *argpart;
|
||||
struct grub_script_arg *ll;
|
||||
int len;
|
||||
|
||||
argpart = (struct grub_script_arg *) grub_script_malloc (state, sizeof (*arg));
|
||||
argpart->type = type;
|
||||
argpart->str = str;
|
||||
len = grub_strlen (str) + 1;
|
||||
argpart->str = grub_script_malloc (state, len);
|
||||
grub_memcpy (argpart->str, str, len);
|
||||
argpart->next = 0;
|
||||
|
||||
if (! arg)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003,2005,2007,2008 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2002,2003,2005,2007,2008,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
|
||||
|
@ -16,15 +16,41 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/machine/console.h>
|
||||
#include <grub/term.h>
|
||||
#include <grub/types.h>
|
||||
|
||||
static const struct grub_machine_bios_data_area *bios_data_area =
|
||||
(struct grub_machine_bios_data_area *) GRUB_MEMORY_MACHINE_BIOS_DATA_AREA_ADDR;
|
||||
|
||||
#define KEYBOARD_LEFT_SHIFT (1 << 0)
|
||||
#define KEYBOARD_RIGHT_SHIFT (1 << 1)
|
||||
#define KEYBOARD_CTRL (1 << 2)
|
||||
#define KEYBOARD_ALT (1 << 3)
|
||||
|
||||
static int
|
||||
grub_console_getkeystatus (void)
|
||||
{
|
||||
grub_uint8_t status = bios_data_area->keyboard_flag_lower;
|
||||
int mods = 0;
|
||||
|
||||
if (status & (KEYBOARD_LEFT_SHIFT | KEYBOARD_RIGHT_SHIFT))
|
||||
mods |= GRUB_TERM_STATUS_SHIFT;
|
||||
if (status & KEYBOARD_CTRL)
|
||||
mods |= GRUB_TERM_STATUS_CTRL;
|
||||
if (status & KEYBOARD_ALT)
|
||||
mods |= GRUB_TERM_STATUS_ALT;
|
||||
|
||||
return mods;
|
||||
}
|
||||
|
||||
static struct grub_term_input grub_console_term_input =
|
||||
{
|
||||
.name = "console",
|
||||
.checkkey = grub_console_checkkey,
|
||||
.getkey = grub_console_getkey,
|
||||
.getkeystatus = grub_console_getkeystatus,
|
||||
};
|
||||
|
||||
static struct grub_term_output grub_console_term_output =
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2000,2001,2002,2003,2004,2005,2007,2008 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2000,2001,2002,2003,2004,2005,2007,2008,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
|
||||
|
@ -17,6 +17,7 @@
|
|||
*/
|
||||
|
||||
#include <grub/machine/machine.h>
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/machine/serial.h>
|
||||
#include <grub/machine/console.h>
|
||||
#include <grub/term.h>
|
||||
|
@ -64,12 +65,11 @@ struct serial_port
|
|||
static struct serial_port serial_settings;
|
||||
|
||||
#ifdef GRUB_MACHINE_PCBIOS
|
||||
/* The BIOS data area. */
|
||||
static const unsigned short *serial_hw_io_addr = (const unsigned short *) 0x0400;
|
||||
static const unsigned short *serial_hw_io_addr = (const unsigned short *) GRUB_MEMORY_MACHINE_BIOS_DATA_AREA_ADDR;
|
||||
#define GRUB_SERIAL_PORT_NUM 4
|
||||
#else
|
||||
static const unsigned short serial_hw_io_addr[] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 };
|
||||
#define GRUB_SERIAL_PORT_NUM (sizeof(serial_hw_io_addr)/sizeof(serial_hw_io_addr[0]))
|
||||
#define GRUB_SERIAL_PORT_NUM (ARRAY_SIZE(serial_hw_io_addr))
|
||||
#endif
|
||||
|
||||
/* Return the port number for the UNITth serial device. */
|
||||
|
|
|
@ -58,6 +58,19 @@ static char keyboard_map_shift[128] =
|
|||
|
||||
static grub_usb_device_t usbdev;
|
||||
|
||||
/* Valid values for bmRequestType. See HID definition version 1.11 section
|
||||
7.2. */
|
||||
#define USB_HID_HOST_TO_DEVICE 0x21
|
||||
#define USB_HID_DEVICE_TO_HOST 0x61
|
||||
|
||||
/* Valid values for bRequest. See HID definition version 1.11 section 7.2. */
|
||||
#define USB_HID_GET_REPORT 0x01
|
||||
#define USB_HID_GET_IDLE 0x02
|
||||
#define USB_HID_GET_PROTOCOL 0x03
|
||||
#define USB_HID_SET_REPORT 0x09
|
||||
#define USB_HID_SET_IDLE 0x0A
|
||||
#define USB_HID_SET_PROTOCOL 0x0B
|
||||
|
||||
static void
|
||||
grub_usb_hid (void)
|
||||
{
|
||||
|
@ -90,17 +103,19 @@ grub_usb_hid (void)
|
|||
grub_usb_iterate (usb_iterate);
|
||||
|
||||
/* Place the device in boot mode. */
|
||||
grub_usb_control_msg (usbdev, 0x21, 0x0B, 0, 0, 0, 0);
|
||||
grub_usb_control_msg (usbdev, USB_HID_HOST_TO_DEVICE, USB_HID_SET_PROTOCOL,
|
||||
0, 0, 0, 0);
|
||||
|
||||
/* Reports every time an event occurs and not more often than that. */
|
||||
grub_usb_control_msg (usbdev, 0x21, 0x0A, 0<<8, 0, 0, 0);
|
||||
grub_usb_control_msg (usbdev, USB_HID_HOST_TO_DEVICE, USB_HID_SET_IDLE,
|
||||
0<<8, 0, 0, 0);
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_usb_keyboard_getreport (grub_usb_device_t dev, unsigned char *report)
|
||||
grub_usb_keyboard_getreport (grub_usb_device_t dev, grub_uint8_t *report)
|
||||
{
|
||||
return grub_usb_control_msg (dev, (1 << 7) | (1 << 5) | 1, 0x01, 0, 0,
|
||||
8, (char *) report);
|
||||
return grub_usb_control_msg (dev, USB_HID_DEVICE_TO_HOST, USB_HID_GET_REPORT,
|
||||
0, 0, 8, (char *) report);
|
||||
}
|
||||
|
||||
|
||||
|
@ -108,20 +123,24 @@ grub_usb_keyboard_getreport (grub_usb_device_t dev, unsigned char *report)
|
|||
static int
|
||||
grub_usb_keyboard_checkkey (void)
|
||||
{
|
||||
unsigned char data[8];
|
||||
grub_uint8_t data[8];
|
||||
int key;
|
||||
int i;
|
||||
grub_err_t err;
|
||||
grub_uint64_t currtime;
|
||||
int timeout = 50;
|
||||
|
||||
data[2] = 0;
|
||||
for (i = 0; i < 50; i++)
|
||||
currtime = grub_get_time_ms ();
|
||||
do
|
||||
{
|
||||
/* Get_Report. */
|
||||
err = grub_usb_keyboard_getreport (usbdev, data);
|
||||
|
||||
if (! err && data[2])
|
||||
/* Implement a timeout. */
|
||||
if (grub_get_time_ms () > currtime + timeout)
|
||||
break;
|
||||
}
|
||||
while (err || !data[2]);
|
||||
|
||||
if (err || !data[2])
|
||||
return -1;
|
||||
|
@ -147,7 +166,8 @@ grub_usb_keyboard_checkkey (void)
|
|||
/* Wait until the key is released. */
|
||||
while (!err && data[2])
|
||||
{
|
||||
err = grub_usb_control_msg (usbdev, (1 << 7) | (1 << 5) | 1, 0x01, 0, 0,
|
||||
err = grub_usb_control_msg (usbdev, USB_HID_DEVICE_TO_HOST,
|
||||
USB_HID_GET_REPORT, 0, 0,
|
||||
sizeof (data), (char *) data);
|
||||
grub_dprintf ("usb_keyboard",
|
||||
"report2: 0x%02x 0x%02x 0x%02x 0x%02x"
|
||||
|
@ -174,7 +194,7 @@ grub_usb_keyboard_getkey (void)
|
|||
{
|
||||
int key;
|
||||
grub_err_t err;
|
||||
unsigned char data[8];
|
||||
grub_uint8_t data[8];
|
||||
grub_uint64_t currtime;
|
||||
int timeout;
|
||||
static grub_usb_keyboard_repeat_t repeat = GRUB_HIDBOOT_REPEAT_NONE;
|
||||
|
@ -234,11 +254,67 @@ grub_usb_keyboard_getkey (void)
|
|||
return key;
|
||||
}
|
||||
|
||||
static int
|
||||
grub_usb_keyboard_getkeystatus (void)
|
||||
{
|
||||
grub_uint8_t data[8];
|
||||
int mods = 0;
|
||||
grub_err_t err;
|
||||
grub_uint64_t currtime;
|
||||
int timeout = 50;
|
||||
|
||||
/* Set idle time to the minimum offered by the spec (4 milliseconds) so
|
||||
that we can find out the current state. */
|
||||
grub_usb_control_msg (usbdev, USB_HID_HOST_TO_DEVICE, USB_HID_SET_IDLE,
|
||||
0<<8, 0, 0, 0);
|
||||
|
||||
currtime = grub_get_time_ms ();
|
||||
do
|
||||
{
|
||||
/* Get_Report. */
|
||||
err = grub_usb_keyboard_getreport (usbdev, data);
|
||||
|
||||
/* Implement a timeout. */
|
||||
if (grub_get_time_ms () > currtime + timeout)
|
||||
break;
|
||||
}
|
||||
while (err || !data[0]);
|
||||
|
||||
/* Go back to reporting every time an event occurs and not more often than
|
||||
that. */
|
||||
grub_usb_control_msg (usbdev, USB_HID_HOST_TO_DEVICE, USB_HID_SET_IDLE,
|
||||
0<<8, 0, 0, 0);
|
||||
|
||||
/* We allowed a while for modifiers to show up in the report, but it is
|
||||
not an error if they never did. */
|
||||
if (err)
|
||||
return -1;
|
||||
|
||||
grub_dprintf ("usb_keyboard",
|
||||
"report: 0x%02x 0x%02x 0x%02x 0x%02x"
|
||||
" 0x%02x 0x%02x 0x%02x 0x%02x\n",
|
||||
data[0], data[1], data[2], data[3],
|
||||
data[4], data[5], data[6], data[7]);
|
||||
|
||||
/* Check Shift, Control, and Alt status. */
|
||||
if (data[0] & 0x02 || data[0] & 0x20)
|
||||
mods |= GRUB_TERM_STATUS_SHIFT;
|
||||
if (data[0] & 0x01 || data[0] & 0x10)
|
||||
mods |= GRUB_TERM_STATUS_CTRL;
|
||||
if (data[0] & 0x04 || data[0] & 0x40)
|
||||
mods |= GRUB_TERM_STATUS_ALT;
|
||||
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
|
||||
return mods;
|
||||
}
|
||||
|
||||
static struct grub_term_input grub_usb_keyboard_term =
|
||||
{
|
||||
.name = "usb_keyboard",
|
||||
.checkkey = grub_usb_keyboard_checkkey,
|
||||
.getkey = grub_usb_keyboard_getkey,
|
||||
.getkeystatus = grub_usb_keyboard_getkeystatus,
|
||||
.next = 0
|
||||
};
|
||||
|
||||
|
|
|
@ -141,7 +141,24 @@ if [ "x${GRUB_TERMINAL}" != "x" ] ; then
|
|||
fi
|
||||
|
||||
case x${GRUB_TERMINAL_OUTPUT} in
|
||||
x | xconsole | xserial | xofconsole | xgfxterm) ;;
|
||||
x | xgfxterm)
|
||||
# If this platform supports gfxterm, try to use it.
|
||||
if test -e ${grub_prefix}/gfxterm.mod ; then
|
||||
GRUB_VIDEO_BACKEND=
|
||||
for i in vbe ; do
|
||||
if test -e ${grub_prefix}/$i.mod ; then
|
||||
GRUB_VIDEO_BACKEND=$i
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ -n "${GRUB_VIDEO_BACKEND}" ] ; then
|
||||
GRUB_TERMINAL_OUTPUT=gfxterm
|
||||
elif [ "${GRUB_TERMINAL_OUTPUT}" = "gfxterm" ] ; then
|
||||
echo "No suitable backend could be found for gfxterm." >&2 ; exit 1
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
xconsole | xserial | xofconsole) ;;
|
||||
*) echo "Invalid output terminal \"${GRUB_TERMINAL_OUTPUT}\"" >&2 ; exit 1 ;;
|
||||
esac
|
||||
|
||||
|
@ -190,7 +207,8 @@ export GRUB_DEVICE \
|
|||
GRUB_DEVICE_BOOT_UUID \
|
||||
GRUB_FS \
|
||||
GRUB_FONT_PATH \
|
||||
GRUB_PRELOAD_MODULES
|
||||
GRUB_PRELOAD_MODULES \
|
||||
GRUB_VIDEO_BACKEND
|
||||
|
||||
# These are optional, user-defined variables.
|
||||
export GRUB_DEFAULT \
|
||||
|
@ -205,7 +223,8 @@ export GRUB_DEFAULT \
|
|||
GRUB_SERIAL_COMMAND \
|
||||
GRUB_DISABLE_LINUX_UUID \
|
||||
GRUB_DISABLE_LINUX_RECOVERY \
|
||||
GRUB_GFXMODE
|
||||
GRUB_GFXMODE \
|
||||
GRUB_DISABLE_OS_PROBER
|
||||
|
||||
if test "x${grub_cfg}" != "x"; then
|
||||
rm -f ${grub_cfg}.new
|
||||
|
@ -213,7 +232,8 @@ if test "x${grub_cfg}" != "x"; then
|
|||
|
||||
# Allow this to fail, since /boot/grub/ might need to be fatfs to support some
|
||||
# firmware implementations (e.g. OFW or EFI).
|
||||
chmod 444 ${grub_cfg}.new || true
|
||||
chmod 400 ${grub_cfg}.new || grub_warn "Could not make ${grub_cfg}.new readable by only root.\
|
||||
This means that if the generated config contains a password it is readable by everyone"
|
||||
fi
|
||||
echo "Generating grub.cfg ..." >&2
|
||||
|
||||
|
|
|
@ -140,6 +140,11 @@ prepare_grub_to_access_device ()
|
|||
echo "insmod ${module}"
|
||||
done
|
||||
|
||||
fs="`${grub_probe} --device ${device} --target=fs`"
|
||||
for module in ${fs} ; do
|
||||
echo "insmod ${module}"
|
||||
done
|
||||
|
||||
# If there's a filesystem UUID that GRUB is capable of identifying, use it;
|
||||
# otherwise set root as per value in device.map.
|
||||
echo "set root=`${grub_probe} --device ${device} --target=drive`"
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <grub/file.h>
|
||||
#include <grub/fs.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/pc_partition.h>
|
||||
#include <grub/msdos_partition.h>
|
||||
#include <grub/util/hostdisk.h>
|
||||
#include <grub/util/getroot.h>
|
||||
#include <grub/term.h>
|
||||
|
@ -79,26 +79,13 @@ grub_refresh (void)
|
|||
static void
|
||||
probe_partmap (grub_disk_t disk)
|
||||
{
|
||||
char *name;
|
||||
char *underscore;
|
||||
|
||||
if (disk->partition == NULL)
|
||||
{
|
||||
grub_util_info ("No partition map found for %s", disk->name);
|
||||
return;
|
||||
}
|
||||
|
||||
name = strdup (disk->partition->partmap->name);
|
||||
if (! name)
|
||||
grub_util_error ("Not enough memory");
|
||||
|
||||
underscore = strchr (name, '_');
|
||||
if (! underscore)
|
||||
grub_util_error ("Invalid partition map %s", name);
|
||||
|
||||
*underscore = '\0';
|
||||
printf ("%s\n", name);
|
||||
free (name);
|
||||
printf ("%s\n", disk->partition->partmap->name);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -248,11 +235,14 @@ probe (const char *path, char *device_name)
|
|||
|
||||
if (print == PRINT_FS)
|
||||
{
|
||||
/* FIXME: `path' can't be used to read a file via GRUB facilities,
|
||||
because it's not relative to its root. */
|
||||
#if 0
|
||||
struct stat st;
|
||||
|
||||
stat (path, &st);
|
||||
|
||||
if (st.st_mode == S_IFREG)
|
||||
if (S_ISREG (st.st_mode))
|
||||
{
|
||||
/* Regular file. Verify that we can read it properly. */
|
||||
|
||||
|
@ -271,6 +261,8 @@ probe (const char *path, char *device_name)
|
|||
if (memcmp (filebuf_via_grub, filebuf_via_sys, file->size))
|
||||
grub_util_error ("files differ");
|
||||
}
|
||||
#endif
|
||||
|
||||
printf ("%s\n", fs->name);
|
||||
}
|
||||
|
||||
|
|
|
@ -73,23 +73,11 @@ case x${GRUB_TERMINAL_OUTPUT} in
|
|||
# Make the font accessible
|
||||
prepare_grub_to_access_device `${grub_probe} --target=device ${GRUB_FONT_PATH}`
|
||||
|
||||
# Pick a video backend
|
||||
video_backend=
|
||||
for i in vbe ; do
|
||||
if test -e ${grub_prefix}/$i.mod ; then
|
||||
video_backend=$i
|
||||
break
|
||||
fi
|
||||
done
|
||||
if ! [ "${video_backend}" ] ; then
|
||||
echo "No suitable backend could be found for gfxterm." >&2 ; exit 1
|
||||
fi
|
||||
|
||||
cat << EOF
|
||||
if loadfont `make_system_path_relative_to_its_root ${GRUB_FONT_PATH}` ; then
|
||||
set gfxmode=${GRUB_GFXMODE}
|
||||
insmod gfxterm
|
||||
insmod ${video_backend}
|
||||
insmod ${GRUB_VIDEO_BACKEND}
|
||||
if terminal_output gfxterm ; then true ; else
|
||||
# For backward compatibility with versions of terminal.mod that don't
|
||||
# understand terminal_output
|
||||
|
|
|
@ -50,8 +50,10 @@ if [ "x$kfreebsd" != "x" ] ; then
|
|||
devices_rel_dirname=`make_system_path_relative_to_its_root $devices_dirname`
|
||||
fi
|
||||
|
||||
# For "ufs" it's the same. Do we care about the others?
|
||||
kfreebsd_fs=${GRUB_FS}
|
||||
case ${GRUB_FS} in
|
||||
ufs1 | ufs2) kfreebsd_fs=ufs ;;
|
||||
*) kfreebsd_fs=${GRUB_FS} ;;
|
||||
esac
|
||||
|
||||
cat << EOF
|
||||
menuentry "${OS}" {
|
||||
|
|
|
@ -22,6 +22,10 @@ libdir=@libdir@
|
|||
|
||||
. ${libdir}/grub/grub-mkconfig_lib
|
||||
|
||||
if [ "x${GRUB_DISABLE_OS_PROBER}" = "xtrue" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -z "`which os-prober 2> /dev/null`" -o -z "`which linux-boot-prober 2> /dev/null`" ] ; then
|
||||
# missing os-prober and/or linux-boot-prober
|
||||
exit 0
|
||||
|
@ -53,11 +57,16 @@ menuentry "${LONGNAME} (on ${DEVICE})" {
|
|||
EOF
|
||||
prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
|
||||
|
||||
if [ "${LONGNAME}" != "Windows Vista (loader)" ] ; then
|
||||
cat << EOF
|
||||
case ${LONGNAME} in
|
||||
Windows\ Vista*|Windows\ 7*)
|
||||
;;
|
||||
*)
|
||||
cat << EOF
|
||||
drivemap -s (hd0) \${root}
|
||||
EOF
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
cat <<EOF
|
||||
chainloader +1
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#!/bin/sh
|
||||
exec tail -n +3 $0
|
||||
# This file is an example on how to add custom entries
|
||||
# This file provides an easy way to add custom menu entries. Simply type the
|
||||
# menu entries you want to add after this comment. Be careful not to change
|
||||
# the 'exec tail' line above.
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include <grub/disk.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/pc_partition.h>
|
||||
#include <grub/msdos_partition.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/util/misc.h>
|
||||
|
@ -947,9 +947,9 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
|
|||
int find_partition (grub_disk_t disk __attribute__ ((unused)),
|
||||
const grub_partition_t partition)
|
||||
{
|
||||
struct grub_pc_partition *pcdata = NULL;
|
||||
struct grub_msdos_partition *pcdata = NULL;
|
||||
|
||||
if (strcmp (partition->partmap->name, "pc_partition_map") == 0)
|
||||
if (strcmp (partition->partmap->name, "part_msdos") == 0)
|
||||
pcdata = partition->data;
|
||||
|
||||
if (pcdata)
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <grub/file.h>
|
||||
#include <grub/fs.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/pc_partition.h>
|
||||
#include <grub/msdos_partition.h>
|
||||
#include <grub/gpt_partition.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/util/hostdisk.h>
|
||||
|
@ -121,14 +121,14 @@ setup (const char *dir,
|
|||
int NESTED_FUNC_ATTR find_usable_region_msdos (grub_disk_t disk __attribute__ ((unused)),
|
||||
const grub_partition_t p)
|
||||
{
|
||||
struct grub_pc_partition *pcdata = p->data;
|
||||
struct grub_msdos_partition *pcdata = p->data;
|
||||
|
||||
/* There's always an embed region, and it starts right after the MBR. */
|
||||
embed_region.start = 1;
|
||||
|
||||
/* For its end offset, include as many dummy partitions as we can. */
|
||||
if (! grub_pc_partition_is_empty (pcdata->dos_type)
|
||||
&& ! grub_pc_partition_is_bsd (pcdata->dos_type)
|
||||
if (! grub_msdos_partition_is_empty (pcdata->dos_type)
|
||||
&& ! grub_msdos_partition_is_bsd (pcdata->dos_type)
|
||||
&& embed_region.end > p->start)
|
||||
embed_region.end = p->start;
|
||||
|
||||
|
@ -279,15 +279,15 @@ setup (const char *dir,
|
|||
if (root_dev->disk->partition)
|
||||
{
|
||||
if (strcmp (root_dev->disk->partition->partmap->name,
|
||||
"pc_partition_map") == 0)
|
||||
"part_msdos") == 0)
|
||||
{
|
||||
struct grub_pc_partition *pcdata =
|
||||
struct grub_msdos_partition *pcdata =
|
||||
root_dev->disk->partition->data;
|
||||
dos_part = pcdata->dos_part;
|
||||
bsd_part = pcdata->bsd_part;
|
||||
}
|
||||
else if (strcmp (root_dev->disk->partition->partmap->name,
|
||||
"gpt_partition_map") == 0)
|
||||
"part_gpt") == 0)
|
||||
{
|
||||
dos_part = root_dev->disk->partition->index;
|
||||
bsd_part = -1;
|
||||
|
@ -338,12 +338,12 @@ setup (const char *dir,
|
|||
goto unable_to_embed;
|
||||
}
|
||||
|
||||
grub_partition_iterate (dest_dev->disk, (strcmp (dest_partmap, "pc_partition_map") ?
|
||||
grub_partition_iterate (dest_dev->disk, (strcmp (dest_partmap, "part_msdos") ?
|
||||
find_usable_region_gpt : find_usable_region_msdos));
|
||||
|
||||
if (embed_region.end == embed_region.start)
|
||||
{
|
||||
if (! strcmp (dest_partmap, "pc_partition_map"))
|
||||
if (! strcmp (dest_partmap, "part_msdos"))
|
||||
grub_util_warn ("This msdos-style partition label has no post-MBR gap; embedding won't be possible!");
|
||||
else
|
||||
grub_util_warn ("This GPT partition label has no BIOS Boot Partition; embedding won't be possible!");
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <grub/file.h>
|
||||
#include <grub/fs.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/pc_partition.h>
|
||||
#include <grub/msdos_partition.h>
|
||||
#include <grub/gpt_partition.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/util/hostdisk.h>
|
||||
|
|
|
@ -90,6 +90,302 @@ grub_video_fbblit_replace_directN (struct grub_video_fbblit_info *dst,
|
|||
}
|
||||
}
|
||||
|
||||
/* Optimized replacing blitter for 1-bit to 32bit. */
|
||||
void
|
||||
grub_video_fbblit_replace_32bit_1bit (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
grub_uint8_t *srcptr;
|
||||
grub_uint8_t *dstptr;
|
||||
grub_uint8_t srcmask;
|
||||
unsigned int dstrowskip;
|
||||
unsigned int srcrowskipbyte, srcrowskipbit;
|
||||
grub_uint32_t fgcolor, bgcolor;
|
||||
int bit_index;
|
||||
|
||||
/* Calculate the number of bytes to advance from the end of one line
|
||||
to the beginning of the next line. */
|
||||
dstrowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width;
|
||||
srcrowskipbyte = (src->mode_info->width - width) >> 3;
|
||||
srcrowskipbit = (src->mode_info->width - width) & 7;
|
||||
|
||||
bit_index = offset_y * src->mode_info->width + offset_x;
|
||||
srcptr = (grub_uint8_t *) src->data + (bit_index >> 3);
|
||||
srcmask = 1 << (~bit_index & 7);
|
||||
dstptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (dst, x, y);
|
||||
|
||||
fgcolor = grub_video_fb_map_rgba (src->mode_info->fg_red,
|
||||
src->mode_info->fg_green,
|
||||
src->mode_info->fg_blue,
|
||||
src->mode_info->fg_alpha);
|
||||
|
||||
bgcolor = grub_video_fb_map_rgba (src->mode_info->bg_red,
|
||||
src->mode_info->bg_green,
|
||||
src->mode_info->bg_blue,
|
||||
src->mode_info->bg_alpha);
|
||||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
for (i = 0; i < width; i++)
|
||||
{
|
||||
if (*srcptr & srcmask)
|
||||
*(grub_uint32_t *) dstptr = fgcolor;
|
||||
else
|
||||
*(grub_uint32_t *) dstptr = bgcolor;
|
||||
srcmask >>= 1;
|
||||
if (!srcmask)
|
||||
{
|
||||
srcptr++;
|
||||
srcmask = 0x80;
|
||||
}
|
||||
|
||||
dstptr += 4;
|
||||
}
|
||||
|
||||
srcptr += srcrowskipbyte;
|
||||
if (srcmask >> srcrowskipbit)
|
||||
srcmask >>= srcrowskipbit;
|
||||
else
|
||||
{
|
||||
srcptr++;
|
||||
srcmask <<= 8 - srcrowskipbit;
|
||||
}
|
||||
dstptr += dstrowskip;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Optimized replacing blitter for 1-bit to 24-bit. */
|
||||
void
|
||||
grub_video_fbblit_replace_24bit_1bit (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
grub_uint8_t *srcptr;
|
||||
grub_uint8_t *dstptr;
|
||||
grub_uint8_t srcmask;
|
||||
unsigned int dstrowskip;
|
||||
unsigned int srcrowskipbyte, srcrowskipbit;
|
||||
grub_uint32_t fgcolor, bgcolor;
|
||||
int bit_index;
|
||||
|
||||
/* Calculate the number of bytes to advance from the end of one line
|
||||
to the beginning of the next line. */
|
||||
dstrowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width;
|
||||
srcrowskipbyte = (src->mode_info->width - width) >> 3;
|
||||
srcrowskipbit = (src->mode_info->width - width) & 7;
|
||||
|
||||
bit_index = offset_y * src->mode_info->width + offset_x;
|
||||
srcptr = (grub_uint8_t *) src->data + (bit_index >> 3);
|
||||
srcmask = 1 << (~bit_index & 7);
|
||||
dstptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (dst, x, y);
|
||||
|
||||
fgcolor = grub_video_fb_map_rgba (src->mode_info->fg_red,
|
||||
src->mode_info->fg_green,
|
||||
src->mode_info->fg_blue,
|
||||
src->mode_info->fg_alpha);
|
||||
|
||||
bgcolor = grub_video_fb_map_rgba (src->mode_info->bg_red,
|
||||
src->mode_info->bg_green,
|
||||
src->mode_info->bg_blue,
|
||||
src->mode_info->bg_alpha);
|
||||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
for (i = 0; i < width - 1; i++)
|
||||
{
|
||||
if (*srcptr & srcmask)
|
||||
*(grub_uint32_t *) dstptr = fgcolor;
|
||||
else
|
||||
*(grub_uint32_t *) dstptr = bgcolor;
|
||||
srcmask >>= 1;
|
||||
if (!srcmask)
|
||||
{
|
||||
srcptr++;
|
||||
srcmask = 0x80;
|
||||
}
|
||||
|
||||
dstptr += 3;
|
||||
}
|
||||
|
||||
if (*srcptr & srcmask)
|
||||
{
|
||||
*dstptr++ = fgcolor & 0xff;
|
||||
*dstptr++ = (fgcolor & 0xff00) >> 8;
|
||||
*dstptr++ = (fgcolor & 0xff0000) >> 16;
|
||||
}
|
||||
else
|
||||
{
|
||||
*dstptr++ = bgcolor & 0xff;
|
||||
*dstptr++ = (bgcolor & 0xff00) >> 8;
|
||||
*dstptr++ = (bgcolor & 0xff0000) >> 16;
|
||||
}
|
||||
srcmask >>= 1;
|
||||
if (!srcmask)
|
||||
{
|
||||
srcptr++;
|
||||
srcmask = 0x80;
|
||||
}
|
||||
|
||||
srcptr += srcrowskipbyte;
|
||||
if (srcmask >> srcrowskipbit)
|
||||
srcmask >>= srcrowskipbit;
|
||||
else
|
||||
{
|
||||
srcptr++;
|
||||
srcmask <<= 8 - srcrowskipbit;
|
||||
}
|
||||
dstptr += dstrowskip;
|
||||
}
|
||||
}
|
||||
|
||||
/* Optimized replacing blitter for 1-bit to 16-bit. */
|
||||
void
|
||||
grub_video_fbblit_replace_16bit_1bit (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
grub_uint8_t *srcptr;
|
||||
grub_uint8_t *dstptr;
|
||||
grub_uint8_t srcmask;
|
||||
unsigned int dstrowskip;
|
||||
unsigned int srcrowskipbyte, srcrowskipbit;
|
||||
grub_uint16_t fgcolor, bgcolor;
|
||||
int bit_index;
|
||||
|
||||
/* Calculate the number of bytes to advance from the end of one line
|
||||
to the beginning of the next line. */
|
||||
dstrowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width;
|
||||
srcrowskipbyte = (src->mode_info->width - width) >> 3;
|
||||
srcrowskipbit = (src->mode_info->width - width) & 7;
|
||||
|
||||
bit_index = offset_y * src->mode_info->width + offset_x;
|
||||
srcptr = (grub_uint8_t *) src->data + (bit_index >> 3);
|
||||
srcmask = 1 << (~bit_index & 7);
|
||||
dstptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (dst, x, y);
|
||||
|
||||
fgcolor = grub_video_fb_map_rgba (src->mode_info->fg_red,
|
||||
src->mode_info->fg_green,
|
||||
src->mode_info->fg_blue,
|
||||
src->mode_info->fg_alpha);
|
||||
|
||||
bgcolor = grub_video_fb_map_rgba (src->mode_info->bg_red,
|
||||
src->mode_info->bg_green,
|
||||
src->mode_info->bg_blue,
|
||||
src->mode_info->bg_alpha);
|
||||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
for (i = 0; i < width; i++)
|
||||
{
|
||||
if (*srcptr & srcmask)
|
||||
*(grub_uint16_t *) dstptr = fgcolor;
|
||||
else
|
||||
*(grub_uint16_t *) dstptr = bgcolor;
|
||||
srcmask >>= 1;
|
||||
if (!srcmask)
|
||||
{
|
||||
srcptr++;
|
||||
srcmask = 0x80;
|
||||
}
|
||||
|
||||
dstptr += 2;
|
||||
}
|
||||
|
||||
srcptr += srcrowskipbyte;
|
||||
if (srcmask >> srcrowskipbit)
|
||||
srcmask >>= srcrowskipbit;
|
||||
else
|
||||
{
|
||||
srcptr++;
|
||||
srcmask <<= 8 - srcrowskipbit;
|
||||
}
|
||||
dstptr += dstrowskip;
|
||||
}
|
||||
}
|
||||
|
||||
/* Optimized replacing blitter for 1-bit to 8-bit. */
|
||||
void
|
||||
grub_video_fbblit_replace_8bit_1bit (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
grub_uint8_t *srcptr;
|
||||
grub_uint8_t *dstptr;
|
||||
grub_uint8_t srcmask;
|
||||
unsigned int dstrowskip;
|
||||
unsigned int srcrowskipbyte, srcrowskipbit;
|
||||
grub_uint8_t fgcolor, bgcolor;
|
||||
int bit_index;
|
||||
|
||||
/* Calculate the number of bytes to advance from the end of one line
|
||||
to the beginning of the next line. */
|
||||
dstrowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width;
|
||||
srcrowskipbyte = (src->mode_info->width - width) >> 3;
|
||||
srcrowskipbit = (src->mode_info->width - width) & 7;
|
||||
|
||||
bit_index = offset_y * src->mode_info->width + offset_x;
|
||||
srcptr = (grub_uint8_t *) src->data + (bit_index >> 3);
|
||||
srcmask = 1 << (~bit_index & 7);
|
||||
dstptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (dst, x, y);
|
||||
|
||||
fgcolor = grub_video_fb_map_rgba (src->mode_info->fg_red,
|
||||
src->mode_info->fg_green,
|
||||
src->mode_info->fg_blue,
|
||||
src->mode_info->fg_alpha);
|
||||
|
||||
bgcolor = grub_video_fb_map_rgba (src->mode_info->bg_red,
|
||||
src->mode_info->bg_green,
|
||||
src->mode_info->bg_blue,
|
||||
src->mode_info->bg_alpha);
|
||||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
for (i = 0; i < width; i++)
|
||||
{
|
||||
if (*srcptr & srcmask)
|
||||
*(grub_uint8_t *) dstptr = fgcolor;
|
||||
else
|
||||
*(grub_uint8_t *) dstptr = bgcolor;
|
||||
srcmask >>= 1;
|
||||
if (!srcmask)
|
||||
{
|
||||
srcptr++;
|
||||
srcmask = 0x80;
|
||||
}
|
||||
|
||||
dstptr++;
|
||||
}
|
||||
|
||||
srcptr += srcrowskipbyte;
|
||||
if (srcmask >> srcrowskipbit)
|
||||
srcmask >>= srcrowskipbit;
|
||||
else
|
||||
{
|
||||
srcptr++;
|
||||
srcmask <<= 8 - srcrowskipbit;
|
||||
}
|
||||
dstptr += dstrowskip;
|
||||
}
|
||||
}
|
||||
|
||||
/* Optimized replacing blitter for RGBX8888 to BGRX8888. */
|
||||
void
|
||||
grub_video_fbblit_replace_BGRX8888_RGBX8888 (struct grub_video_fbblit_info *dst,
|
||||
|
@ -826,3 +1122,294 @@ grub_video_fbblit_blend_index_RGBA8888 (struct grub_video_fbblit_info *dst,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Optimized blending blitter for 1-bit to XXXA8888. */
|
||||
void
|
||||
grub_video_fbblit_blend_XXXA8888_1bit (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
grub_uint8_t *srcptr;
|
||||
grub_uint8_t *dstptr;
|
||||
grub_uint8_t srcmask;
|
||||
unsigned int dstrowskip;
|
||||
unsigned int srcrowskipbyte, srcrowskipbit;
|
||||
grub_uint32_t fgcolor, bgcolor;
|
||||
int bit_index;
|
||||
|
||||
/* Calculate the number of bytes to advance from the end of one line
|
||||
to the beginning of the next line. */
|
||||
dstrowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width;
|
||||
srcrowskipbyte = (src->mode_info->width - width) >> 3;
|
||||
srcrowskipbit = (src->mode_info->width - width) & 7;
|
||||
|
||||
bit_index = offset_y * src->mode_info->width + offset_x;
|
||||
srcptr = (grub_uint8_t *) src->data + (bit_index >> 3);
|
||||
srcmask = 1 << (~bit_index & 7);
|
||||
dstptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (dst, x, y);
|
||||
|
||||
fgcolor = grub_video_fb_map_rgba (src->mode_info->fg_red,
|
||||
src->mode_info->fg_green,
|
||||
src->mode_info->fg_blue,
|
||||
src->mode_info->fg_alpha);
|
||||
|
||||
bgcolor = grub_video_fb_map_rgba (src->mode_info->bg_red,
|
||||
src->mode_info->bg_green,
|
||||
src->mode_info->bg_blue,
|
||||
src->mode_info->bg_alpha);
|
||||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
for (i = 0; i < width; i++)
|
||||
{
|
||||
grub_uint32_t color;
|
||||
grub_uint8_t a;
|
||||
|
||||
if (*srcptr & srcmask)
|
||||
color = fgcolor;
|
||||
else
|
||||
color = bgcolor;
|
||||
a = (color >> 24) & 0xff;
|
||||
|
||||
if (a == 255)
|
||||
*(grub_uint32_t *) dstptr = color;
|
||||
else if (a != 0)
|
||||
{
|
||||
grub_uint8_t s1 = (color >> 0) & 0xFF;
|
||||
grub_uint8_t s2 = (color >> 8) & 0xFF;
|
||||
grub_uint8_t s3 = (color >> 16) & 0xFF;
|
||||
|
||||
grub_uint8_t d1 = (*(grub_uint32_t *) dstptr >> 0) & 0xFF;
|
||||
grub_uint8_t d2 = (*(grub_uint32_t *) dstptr >> 8) & 0xFF;
|
||||
grub_uint8_t d3 = (*(grub_uint32_t *) dstptr >> 16) & 0xFF;
|
||||
|
||||
d1 = (d1 * (255 - a) + s1 * a) / 255;
|
||||
d2 = (d2 * (255 - a) + s2 * a) / 255;
|
||||
d3 = (d3 * (255 - a) + s3 * a) / 255;
|
||||
|
||||
*(grub_uint32_t *) dstptr = (a << 24) | (d3 << 16) | (d2 << 8)
|
||||
| d1;
|
||||
}
|
||||
|
||||
srcmask >>= 1;
|
||||
if (!srcmask)
|
||||
{
|
||||
srcptr++;
|
||||
srcmask = 0x80;
|
||||
}
|
||||
|
||||
dstptr += 4;
|
||||
}
|
||||
|
||||
srcptr += srcrowskipbyte;
|
||||
if (srcmask >> srcrowskipbit)
|
||||
srcmask >>= srcrowskipbit;
|
||||
else
|
||||
{
|
||||
srcptr++;
|
||||
srcmask <<= 8 - srcrowskipbit;
|
||||
}
|
||||
dstptr += dstrowskip;
|
||||
}
|
||||
}
|
||||
|
||||
/* Optimized blending blitter for 1-bit to XXX888. */
|
||||
void
|
||||
grub_video_fbblit_blend_XXX888_1bit (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
grub_uint8_t *srcptr;
|
||||
grub_uint8_t *dstptr;
|
||||
grub_uint8_t srcmask;
|
||||
unsigned int dstrowskip;
|
||||
unsigned int srcrowskipbyte, srcrowskipbit;
|
||||
grub_uint32_t fgcolor, bgcolor;
|
||||
int bit_index;
|
||||
|
||||
/* Calculate the number of bytes to advance from the end of one line
|
||||
to the beginning of the next line. */
|
||||
dstrowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width;
|
||||
srcrowskipbyte = (src->mode_info->width - width) >> 3;
|
||||
srcrowskipbit = (src->mode_info->width - width) & 7;
|
||||
|
||||
bit_index = offset_y * src->mode_info->width + offset_x;
|
||||
srcptr = (grub_uint8_t *) src->data + (bit_index >> 3);
|
||||
srcmask = 1 << (~bit_index & 7);
|
||||
dstptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (dst, x, y);
|
||||
|
||||
fgcolor = grub_video_fb_map_rgba (src->mode_info->fg_red,
|
||||
src->mode_info->fg_green,
|
||||
src->mode_info->fg_blue,
|
||||
src->mode_info->fg_alpha);
|
||||
|
||||
bgcolor = grub_video_fb_map_rgba (src->mode_info->bg_red,
|
||||
src->mode_info->bg_green,
|
||||
src->mode_info->bg_blue,
|
||||
src->mode_info->bg_alpha);
|
||||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
for (i = 0; i < width; i++)
|
||||
{
|
||||
grub_uint32_t color;
|
||||
grub_uint8_t a;
|
||||
if (*srcptr & srcmask)
|
||||
{
|
||||
color = fgcolor;
|
||||
a = src->mode_info->fg_alpha;
|
||||
}
|
||||
else
|
||||
{
|
||||
color = bgcolor;
|
||||
a = src->mode_info->bg_alpha;
|
||||
}
|
||||
|
||||
if (a == 255)
|
||||
{
|
||||
((grub_uint8_t *) dstptr)[0] = color & 0xff;
|
||||
((grub_uint8_t *) dstptr)[1] = (color & 0xff00) >> 8;
|
||||
((grub_uint8_t *) dstptr)[2] = (color & 0xff0000) >> 16;
|
||||
}
|
||||
else if (a != 0)
|
||||
{
|
||||
grub_uint8_t s1 = (color >> 0) & 0xFF;
|
||||
grub_uint8_t s2 = (color >> 8) & 0xFF;
|
||||
grub_uint8_t s3 = (color >> 16) & 0xFF;
|
||||
|
||||
grub_uint8_t d1 = (*(grub_uint32_t *) dstptr >> 0) & 0xFF;
|
||||
grub_uint8_t d2 = (*(grub_uint32_t *) dstptr >> 8) & 0xFF;
|
||||
grub_uint8_t d3 = (*(grub_uint32_t *) dstptr >> 16) & 0xFF;
|
||||
|
||||
((grub_uint8_t *) dstptr)[0] = (d1 * (255 - a) + s1 * a) / 255;
|
||||
((grub_uint8_t *) dstptr)[1] = (d2 * (255 - a) + s2 * a) / 255;
|
||||
((grub_uint8_t *) dstptr)[2] = (d3 * (255 - a) + s3 * a) / 255;
|
||||
}
|
||||
|
||||
srcmask >>= 1;
|
||||
if (!srcmask)
|
||||
{
|
||||
srcptr++;
|
||||
srcmask = 0x80;
|
||||
}
|
||||
|
||||
dstptr += 3;
|
||||
}
|
||||
|
||||
srcptr += srcrowskipbyte;
|
||||
if (srcmask >> srcrowskipbit)
|
||||
srcmask >>= srcrowskipbit;
|
||||
else
|
||||
{
|
||||
srcptr++;
|
||||
srcmask <<= 8 - srcrowskipbit;
|
||||
}
|
||||
dstptr += dstrowskip;
|
||||
}
|
||||
}
|
||||
|
||||
/* Optimized blending blitter for 1-bit to XXX888. */
|
||||
void
|
||||
grub_video_fbblit_blend_XXX565_1bit (struct grub_video_fbblit_info *dst,
|
||||
struct grub_video_fbblit_info *src,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int offset_x, int offset_y)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
grub_uint8_t *srcptr;
|
||||
grub_uint8_t *dstptr;
|
||||
grub_uint8_t srcmask;
|
||||
unsigned int dstrowskip;
|
||||
unsigned int srcrowskipbyte, srcrowskipbit;
|
||||
grub_uint16_t fgcolor, bgcolor;
|
||||
int bit_index;
|
||||
|
||||
/* Calculate the number of bytes to advance from the end of one line
|
||||
to the beginning of the next line. */
|
||||
dstrowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width;
|
||||
srcrowskipbyte = (src->mode_info->width - width) >> 3;
|
||||
srcrowskipbit = (src->mode_info->width - width) & 7;
|
||||
|
||||
bit_index = offset_y * src->mode_info->width + offset_x;
|
||||
srcptr = (grub_uint8_t *) src->data + (bit_index >> 3);
|
||||
srcmask = 1 << (~bit_index & 7);
|
||||
dstptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (dst, x, y);
|
||||
|
||||
fgcolor = grub_video_fb_map_rgba (src->mode_info->fg_red,
|
||||
src->mode_info->fg_green,
|
||||
src->mode_info->fg_blue,
|
||||
src->mode_info->fg_alpha);
|
||||
|
||||
bgcolor = grub_video_fb_map_rgba (src->mode_info->bg_red,
|
||||
src->mode_info->bg_green,
|
||||
src->mode_info->bg_blue,
|
||||
src->mode_info->bg_alpha);
|
||||
|
||||
for (j = 0; j < height; j++)
|
||||
{
|
||||
for (i = 0; i < width; i++)
|
||||
{
|
||||
grub_uint32_t color;
|
||||
grub_uint8_t a;
|
||||
if (*srcptr & srcmask)
|
||||
{
|
||||
color = fgcolor;
|
||||
a = src->mode_info->fg_alpha;
|
||||
}
|
||||
else
|
||||
{
|
||||
color = bgcolor;
|
||||
a = src->mode_info->bg_alpha;
|
||||
}
|
||||
|
||||
if (a == 255)
|
||||
*(grub_uint16_t *) dstptr = color;
|
||||
else if (a != 0)
|
||||
{
|
||||
grub_uint8_t s1 = (color >> 0) & 0x1F;
|
||||
grub_uint8_t s2 = (color >> 5) & 0x3F;
|
||||
grub_uint8_t s3 = (color >> 11) & 0x1F;
|
||||
|
||||
grub_uint8_t d1 = (*(grub_uint16_t *) dstptr >> 0) & 0x1F;
|
||||
grub_uint8_t d2 = (*(grub_uint16_t *) dstptr >> 5) & 0x3F;
|
||||
grub_uint8_t d3 = (*(grub_uint16_t *) dstptr >> 11) & 0x1F;
|
||||
|
||||
d1 = (d1 * (255 - a) + s1 * a) / 255;
|
||||
d2 = (d2 * (255 - a) + s2 * a) / 255;
|
||||
d3 = (d3 * (255 - a) + s3 * a) / 255;
|
||||
|
||||
*(grub_uint16_t *) dstptr = (d1 & 0x1f) | ((d2 & 0x3f) << 5)
|
||||
| ((d3 & 0x1f) << 11);
|
||||
}
|
||||
|
||||
srcmask >>= 1;
|
||||
if (!srcmask)
|
||||
{
|
||||
srcptr++;
|
||||
srcmask = 0x80;
|
||||
}
|
||||
|
||||
dstptr += 2;
|
||||
}
|
||||
|
||||
srcptr += srcrowskipbyte;
|
||||
if (srcmask >> srcrowskipbit)
|
||||
srcmask >>= srcrowskipbit;
|
||||
else
|
||||
{
|
||||
srcptr++;
|
||||
srcmask <<= 8 - srcrowskipbit;
|
||||
}
|
||||
dstptr += dstrowskip;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -587,6 +587,37 @@ common_blitter (struct grub_video_fbblit_info *target,
|
|||
return;
|
||||
}
|
||||
}
|
||||
else if (source->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_1BIT_PACKED)
|
||||
{
|
||||
if (target->mode_info->bpp == 32)
|
||||
{
|
||||
grub_video_fbblit_replace_32bit_1bit (target, source,
|
||||
x, y, width, height,
|
||||
offset_x, offset_y);
|
||||
return;
|
||||
}
|
||||
else if (target->mode_info->bpp == 24)
|
||||
{
|
||||
grub_video_fbblit_replace_24bit_1bit (target, source,
|
||||
x, y, width, height,
|
||||
offset_x, offset_y);
|
||||
return;
|
||||
}
|
||||
else if (target->mode_info->bpp == 16)
|
||||
{
|
||||
grub_video_fbblit_replace_16bit_1bit (target, source,
|
||||
x, y, width, height,
|
||||
offset_x, offset_y);
|
||||
return;
|
||||
}
|
||||
else if (target->mode_info->bpp == 8)
|
||||
{
|
||||
grub_video_fbblit_replace_8bit_1bit (target, source,
|
||||
x, y, width, height,
|
||||
offset_x, offset_y);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* No optimized replace operator found, use default (slow) blitter. */
|
||||
grub_video_fbblit_replace (target, source, x, y, width, height,
|
||||
|
@ -674,6 +705,41 @@ common_blitter (struct grub_video_fbblit_info *target,
|
|||
return;
|
||||
}
|
||||
}
|
||||
else if (source->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_1BIT_PACKED)
|
||||
{
|
||||
if (target->mode_info->blit_format
|
||||
== GRUB_VIDEO_BLIT_FORMAT_BGRA_8888
|
||||
|| target->mode_info->blit_format
|
||||
== GRUB_VIDEO_BLIT_FORMAT_RGBA_8888)
|
||||
{
|
||||
grub_video_fbblit_blend_XXXA8888_1bit (target, source,
|
||||
x, y, width, height,
|
||||
offset_x, offset_y);
|
||||
return;
|
||||
}
|
||||
else if (target->mode_info->blit_format
|
||||
== GRUB_VIDEO_BLIT_FORMAT_BGR_888
|
||||
|| target->mode_info->blit_format
|
||||
== GRUB_VIDEO_BLIT_FORMAT_RGB_888)
|
||||
{
|
||||
grub_video_fbblit_blend_XXX888_1bit (target, source,
|
||||
x, y, width, height,
|
||||
offset_x, offset_y);
|
||||
return;
|
||||
}
|
||||
else if (target->mode_info->blit_format
|
||||
== GRUB_VIDEO_BLIT_FORMAT_BGR_565
|
||||
|| target->mode_info->blit_format
|
||||
== GRUB_VIDEO_BLIT_FORMAT_RGB_565)
|
||||
{
|
||||
grub_video_fbblit_blend_XXX565_1bit (target, source,
|
||||
x, y, width, height,
|
||||
offset_x, offset_y);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* No optimized blend operation found, use default (slow) blitter. */
|
||||
grub_video_fbblit_blend (target, source, x, y, width, height,
|
||||
|
|
|
@ -286,24 +286,6 @@ grub_vbe_get_video_mode_info (grub_uint32_t mode,
|
|||
|
||||
/* Make copy of mode info block. */
|
||||
grub_memcpy (mode_info, mi_tmp, sizeof (*mode_info));
|
||||
|
||||
/* Packed mode. Query DAC Palette width for color sizes. */
|
||||
if (mode_info->bits_per_pixel <= 8)
|
||||
{
|
||||
int width = 8;
|
||||
status = 0;
|
||||
|
||||
if (controller_info.capabilities & GRUB_VBE_CAPABILITY_DACWIDTH)
|
||||
status = grub_vbe_bios_set_dac_palette_width (& width);
|
||||
|
||||
if (status != GRUB_VBE_STATUS_OK)
|
||||
/* 6 is default after mode reset. */
|
||||
width = 6;
|
||||
|
||||
mode_info->red_mask_size = mode_info->green_mask_size
|
||||
= mode_info->blue_mask_size = width;
|
||||
mode_info->rsvd_mask_size = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
/* Just clear mode info block if it isn't a VESA mode. */
|
||||
|
|
|
@ -181,6 +181,8 @@ grub_video_get_blit_format (struct grub_video_mode_info *mode_info)
|
|||
return GRUB_VIDEO_BLIT_FORMAT_RGB_565;
|
||||
}
|
||||
}
|
||||
else if (mode_info->bpp == 1)
|
||||
return GRUB_VIDEO_BLIT_FORMAT_1BIT_PACKED;
|
||||
|
||||
/* Backup route. Unknown format. */
|
||||
|
||||
|
|
Loading…
Reference in a new issue