merge mainline into butter

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-04-11 07:56:31 +02:00
commit c7ba1ba62e
94 changed files with 4056 additions and 789 deletions

View file

@ -133,3 +133,5 @@ grub-core/gnulib/wctype.h
grub-core/rs_decoder.S
widthspec.bin
widthspec.h
docs/stamp-1
docs/version-dev.texi

736
ChangeLog
View file

@ -1,3 +1,739 @@
2011-04-11 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-fstest.c (cmd_cmp): Check that sizes match.
2011-04-11 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-fstest.c (read_file): Report GRUB error if file opening
failed.
2011-04-11 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/file.c (grub_file_open): Don't take into account the
parenthesis in the middle of the filename.
2011-04-10 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/loader/mips/linux.c (grub_cmd_initrd): Use correct limits
rather than trying to put initrd way too high.
Reported by: Ryan Lortie <desrt@desrt.ca>
2011-04-10 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/boot/mips/yeeloong/fwstart.S (no_cs5536): Put back
improperly removed string.
2011-04-10 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_data): New member
is_disk.
(grub_util_biosdisk_open): Don't apply ioctl on non-disk devices.
(open_device) Likewise.
(grub_util_biosdisk_close): Likewise.
Reported by: Mark Korenberger.
2011-04-10 Alexander Kurtz <kurtz.alex@googlemail.com>
* util/grub-mkconfig_lib.in: Add missing quotes.
2011-04-10 Colin Watson <cjwatson@ubuntu.com>
* grub-core/gnulib/argp-parse.c (__argp_input): Don't crash if pstate
is NULL.
2011-04-10 Vladimir Serbinenko <phcoder@gmail.com>
Dynamically count the number of lines for the lower banner.
* grub-core/normal/menu_entry.c (per_term_screen): New member
num_entries.
(print_down): Use num_entries.
(update_screen): Likewise.
(grub_menu_entry_run): Set num_entries.
* grub-core/normal/menu_text.c (menu_viewer_data): New member
num_entries.
(grub_print_message_indented): Move real part to ...
(grub_print_message_indented_real): ... here. Additional argument
dry_run.
(draw_border): Additional argument num_entries.
(print_message): Additional argument dry_run.
(print_entries): Receive menu viewer data.
(grub_menu_init_page): New argment num_entries.
(menu_text_set_chosen_entry): Use num_entries.
(grub_menu_try_text): Likewise.
* grub-core/normal/term.c (print_ucs4_terminal): New argument dry_run.
All users updated.
(grub_ucs4_count_lines): New function.
* include/grub/term.h (grub_term_cursor_x): Moved from here ..
* grub-core/normal/menu_text.c (grub_term_cursor_x): ... to here.
* include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): Removed.
(grub_term_border_height): Likewise.
(grub_term_num_entries): Likewise.
2011-04-10 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/boot/mips/yeeloong/fwstart.S: Fix address to error message.
Remove now unused string.
2011-04-09 Colin Watson <cjwatson@ubuntu.com>
* docs/grub-dev.texi (Finding your way around): Update for 1.99
build system.
(Getting started): GRUB is developed in Bazaar now, not Subversion.
(Comment): Fix typo.
(Getting started): General copy-editing.
(Typical Development Experience): Likewise.
(Error Handling): Likewise.
(Video API): Likewise.
2011-04-09 Colin Watson <cjwatson@ubuntu.com>
* docs/grub-dev.texi: Replace MoinMoin syntax with Texinfo syntax
throughout.
2011-04-08 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-mkimage.c (main): Handle special naming of yeeloong
directory.
2011-04-08 Colin Watson <cjwatson@ubuntu.com>
* docs/grub-dev.texi: Fix spelling of "developer" throughout.
* grub-core/fs/i386/pc/pxe.c (parse_dhcp_vendor): Fix spelling of
"development".
2011-04-08 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/normal/menu_entry.c (run): Use grub_memcpy rather than
grub_strcpy since the lines aren't necessarily 0-terminated.
2011-04-08 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/lib/legacy_parse.c (legacy_commands): Find doesn't set
root on legacy.
2011-04-08 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/commands/probe.c (options): Argument to set isn't optional.
(GRUB_MOD_INIT): DEVICE isn't optional.
2011-04-08 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/normal/term.c (print_ucs4_terminal): Don't try to put the
word on new line if it's too long anyway. Fixes a hang.
2011-04-08 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/util/raid.h (grub_util_raid_getmembers): Make argument
const.
* util/grub-setup.c (main): Reuse md device name if available.
* util/raid.c (grub_util_raid_getmembers): Receive device name and
not GRUB name as argument.
Based on patch by: Florian Wagner <fwagner>.
2011-04-08 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/loader/i386/multiboot_mbi.c (grub_multiboot_make_mbi):
Place mbi on low memory for better compatibility.
2011-04-08 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/efiemu/efiemu.h: Use grub_memory_hook_t type.
2011-04-08 Vladimir Serbinenko <phcoder@gmail.com>
2011-04-08 Colin Watson <cjwatson@ubuntu.com>
* autogen.sh: Ensure that collate and ctype locale is C.
* conf/Makefile.common: Likewise.
2011-04-08 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/normal/menu.c: Add missing include.
2011-04-08 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/raid.c [GRUB_UTIL]: Add missing include.
2011-04-08 Martin Zuther <mzuther@mzuther.de>
* util/grub-mkconfig.in: Ignore emacsen backup.
2011-04-08 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/emu/hostdisk.c (open_device): Sync on close and not
on open.
(grub_util_biosdisk_close): Likewise.
2011-04-08 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/emu/getroot.c (grub_util_get_grub_dev): Add missing
const attribute and use grub_isdigit.
2011-04-06 Andrey <dev_null@ukr.net>
* grub-core/video/fb/video_fb.c (grub_video_fb_setup): Silence older
gcc warning.
2011-04-06 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/lib/relocator.c (grub_relocator_alloc_chunk_align): Add few
useful grub_dprintf's.
2011-04-06 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/fs.h (grub_dirhook_info): Use unsigned for 1-bit fields.
2011-04-06 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub.d/00_header.in: Don't use LANG unless unifont is available.
2011-04-06 Vladimir Serbinenko <phcoder@gmail.com>
Output errors if theme loading failed.
* grub-core/gfxmenu/gfxmenu.c (grub_gfxmenu_try): Move the call to
grub_gfxterm_fullscreen on error paths to ...
* grub-core/normal/menu.c (menu_init): ...here. Wait after showing
theme loading error.
2011-04-06 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/offsets.h (GRUB_KERNEL_I386_PC_RAW_SIZE): Let a bit more
space for older compilers.
(GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART): Likewise.
2011-04-06 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/mdraid1x_linux.c (grub_mdraid_detect): Detect spares
and report them as not RAID members since they are useless for GRUB.
* grub-core/disk/mdraid_linux.c (grub_mdraid_detect): Likewise.
2011-04-02 Vladimir Serbinenko <phcoder@gmail.com>
Increase LVM implementation robustness in order not to crash on
configurations like pvmove. Previously code assumed that in some places
only lvs or only pvs are used whereas it seems that they are used
interchangeably.
* grub-core/disk/lvm.c (read_node): New function.
(read_lv): Use read_node.
(grub_lvm_scan_device): Use only first mirror on pvmove'd lvs.
Match volumes only at the end when all lvs are found. Take both
pvs (first) and lvs (second) into account.
* include/grub/lvm.h (grub_lvm_segment): Merge fields stripe_* and
mirror_* into node_*. All users updated.
(grub_lvm_stripe): Merge this ...
(grub_lvm_mirror): ... and this ...
(grub_lvm_node): ... into this. All users updated.
2011-04-02 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/lvm.c (grub_lvm_scan_device): Print errors on the end
of function to allow further scanning for LVMs.
2011-04-02 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_read): Don't close
on failed seek as it breaks open fd reusage.
2011-04-02 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-install.in: Add a recommendation to use --recheck before
reporting bugs.
2011-04-02 Vladimir Serbinenko <phcoder@gmail.com>
* docs/grub.texi (Vendor power-on buttons): Explain how the numbers
are obtained.
2011-04-02 Vladimir Serbinenko <phcoder@gmail.com>
GRUB developper manual based on existing Internals section and
contributions by the various authors with active copyright assignment.
* docs/Makefile.am (info_TEXINFOS): Add grub-dev.texi.
* docs/font_char_metrics.png: New file.
* docs/font_char_metrics.txt: Likewise.
* docs/grub-dev.texi: Likewise.
* docs/grub.texi (Internals): Move from here ...
* docs/grub-dev.texi: ... here.
2011-04-01 Colin Watson <cjwatson@ubuntu.com>
Store the loopback device as data on loopback grub_disk structures,
rather than the file it points to. This fixes use of freed memory
if an existing loopback device is replaced.
* grub-core/disk/loopback.c (grub_loopback_open): Store dev in
disk->data, not dev->file.
(grub_loopback_read): Adjust file assignment to match.
Fixes Ubuntu bug #742967.
2011-04-01 Colin Watson <cjwatson@ubuntu.com>
* grub-core/disk/loopback.c (grub_cmd_loopback): Fix a memory leak
when replacing an existing device.
2011-04-01 Vladimir Serbinenko <phcoder@gmail.com>
Fix incorrect types in jfs.c. This enables >2TiB disks and fixes some
memory corruptions.
* grub-core/fs/jfs.c (struct grub_jfs_diropen): Interpret bytes as
unsigned.
(grub_jfs_lookup_symlink): Make ino a grub_uint32_t rather than int.
(grub_jfs_blkno): Use 64-bit quantities for block sectors.
(grub_jfs_read_inode): Likewise.
(grub_jfs_opendir): Likewise. Remove now useless casts.
(grub_jfs_getent): Likewise.
Make ino a grub_uint32_t rather than int.
(grub_jfs_mount): Ensure that blksize and log2_blksize are consistent.
(grub_jfs_read_file): Use 64-bit quantities when necessary. Replace
division and module with bit operations.
(grub_jfs_find_file): Make ino a grub_uint32_t.
(grub_jfs_lookup_symlink): Likewise. Use 64-bit quantities
2011-04-01 Colin Watson <cjwatson@ubuntu.com>
* grub-core/normal/menu_entry.c (run): Quieten uninitialised
warning. (This was in fact always initialised before use, but GCC
wasn't smart enough to prove that.)
* grub-core/script/lexer.c (grub_script_lexer_yywrap): Likewise.
2011-03-31 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/x86_64/efi/callwrap.S (efi_wrap_0): Preserve 16-byte
stack alignment.
(efi_wrap_1): Likewise.
(efi_wrap_2): Likewise.
(efi_wrap_3): Likewise.
(efi_wrap_4): Likewise.
(efi_wrap_5): Likewise.
(efi_wrap_6): Likewise.
(efi_wrap_10): Likewise.
Based on information by: Red Hat/Peter Jones.
2011-03-31 Colin Watson <cjwatson@ubuntu.com>
* grub-core/mmap/efi/mmap.c (grub_mmap_unregister): Remove
set-but-not-used variable.
2011-03-31 Colin Watson <cjwatson@ubuntu.com>
* docs/grub.texi (Simple configuration): Be more explicit about
GRUB_DEFAULT, and add an example.
Reported by: Leslie Rhorer.
2011-03-30 Colin Watson <cjwatson@ubuntu.com>
* docs/grub.texi (Commands): Link to "GRUB only offers a rescue
shell".
2011-03-30 Alexey Shvetsov <alexxy@gentoo.org>
* util/grub.d/10_linux.in: Add gentoo-specific config filename.
* util/grub.d/20_linux_xen.in: Likewise.
2011-03-30 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub.d/10_linux.in: Try alternative config filenames where
we parse config file.
* util/grub.d/20_linux_xen.in: Likewise.
2011-03-30 Alexey Shvetsov <alexxy@gentoo.org>
* util/grub.d/10_linux.in: Add gentoo-specific Linux and initrd names.
* util/grub.d/20_linux_xen.in: Likewise.
2011-03-30 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/raid.c (insert_array): Add few potentially
useful grub_util_info.
(grub_raid_register): Likewise.
2011-03-30 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/emu/getroot.c (grub_util_get_grub_dev) [__linux__]:
Preserve partition number in mdadm code path.
2011-03-30 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_get_grub_dev): Add
few potentially useful grub_util_info.
2011-03-30 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/lvm.c (grub_lvm_scan_device): Remove spurious \n.
2011-03-30 Colin Watson <cjwatson@ubuntu.com>
* docs/grub.texi (default): Use @example rather than nested
itemized lists to avoid breaking gendocs.
2011-03-30 Colin Watson <cjwatson@ubuntu.com>
* docs/grub.texi (Future): Update.
2011-03-30 Colin Watson <cjwatson@ubuntu.com>
* docs/grub.texi (Environment): New chapter.
(Changes from GRUB Legacy): Link to "Environment block" section for
details of limitations.
(Simple configuration): Likewise. Link to documentation of gfxmode
and gfxpayload variables from GRUB_GFXMODE and GRUB_GFXPAYLOAD
respectively.
(Shell-like scripting): Note that normal variables are stored in the
environment.
(gettext): Link to documentation of lang and locale_dir.
(list_env): New section.
(load_env): New section.
(save_env): New section.
(Reporting bugs): Fix typo.
2011-03-30 Vladimir Serbinenko <phcoder@gmail.com>
* docs/grub.texi: Correctly use "terminal_input" and not "terminal" in
the example.
2011-03-30 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/term/at_keyboard.c (set_scancodes)
[!GRUB_MACHINE_MIPS_YEELOONG && !GRUB_MACHINE_QEMU]: Use scancode set 1.
2011-03-30 Colin Watson <cjwatson@ubuntu.com>
* docs/grub.texi (Menu-specific commands): Remove some semantics
that were true in GRUB Legacy but not in GRUB 2.
(submenu): New section.
(false): New section.
(read): New section.
(true): New section.
2011-03-30 Colin Watson <cjwatson@ubuntu.com>
* docs/grub.texi (Changes from GRUB Legacy): Minor proofreading.
2011-03-30 Colin Watson <cjwatson@ubuntu.com>
* docs/grub.texi (Simple configuration): Explain some of the
current limitations of grub-mkconfig.
Reported by: Leslie Rhorer.
2011-03-29 Vladimir Serbinenko <phcoder@gmail.com>
Old macs search for boot.efi rather than for bootia32.efi.
* util/grub-install.in: Copy bootia32.efi to boot.efi.
* util/grub-mkrescue.in: Likewise.
Suggested by: Peter Jones.
2011-03-29 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub.d/20_linux_xen.in: Accept old-style xen kernels.
2011-03-29 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/lvm.h (grub_lvm_lv): New field 'visible'.
(grub_lvm_segment): New fields 'type', 'mirror_count' and 'mirrors'.
(grub_lvm_mirror): New struct.
* grub-core/disk/lvm.c (grub_lvm_checkvalue): Commented out.
(grub_lvm_iterate): Iterate only visible volumes.
(grub_lvm_read): Factor out to ..
(read_lv): ... this. Support mirrors.
(grub_lvm_read): New wrapper function.
(grub_lvm_scan_device): Parse mirrors. Skip everything that isn't
stripped or mirrored.
2011-03-29 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub.d/10_linux.in: Skip vmlinux-* on x86 platforms.
2011-03-29 Colin Watson <cjwatson@ubuntu.com>
* docs/grub.texi (loopback): New section.
2011-03-29 Colin Watson <cjwatson@ubuntu.com>
* grub-core/disk/loopback.c (GRUB_MOD_INIT): Stop documenting
removed -p option.
2011-03-29 Colin Watson <cjwatson@ubuntu.com>
* docs/grub.texi (BIOS installation): New section, partly based on
previous text in other sections.
(Installing GRUB using grub-install): Replace BIOS discussion with a
cross-reference.
(Images): Likewise.
2011-03-29 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/emu/hostdisk.c (find_partition_start)
[HAVE_DIOCGDINFO]: Add safety checks.
2011-03-29 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub.d/10_kfreebsd.in: Allow ufs.ko to be missing as it's
per default compiled in kernel and prior to 8.0 isn't shipped at all.
2011-03-29 Colin Watson <cjwatson@ubuntu.com>
* grub-core/disk/mdraid1x_linux.c (grub_mdraid_detect): If
real_sb->size is zero (e.g. RAID-0), get the disk size from
real_sb->data_size instead.
Fixes Ubuntu bug #743136.
2011-03-29 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/normal/misc.c (grub_normal_print_device_info): Use correct
printf clauses for printing size and start.
2011-03-29 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/ext2.c (grub_ext2_read_inode): Fix an overflow.
Reported and tested by: Timothy Nikkel.
2011-03-29 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/term/gfxterm.c (dirty_region_add): Move core part to ...
(dirty_region_add_real): ... this.
(dirty_region_add): Don't discard margin refresh when performing
scheduled repaint.
2011-03-29 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/lib/relocator.c (allocate_regstart)
[!DEBUG_RELOCATOR_NOMEM_DPRINTF]: Avoid grub_dprintf since not all
terminals are capabple of malloc-free operation.
(allocate_inreg) [!DEBUG_RELOCATOR_NOMEM_DPRINTF]: Likewise.
(malloc_in_range) [!DEBUG_RELOCATOR_NOMEM_DPRINTF]: Likewise.
2011-03-29 Mario Limonciello <Mario_Limonciello@Dell.com>
* util/grub-setup.c: Copy the partition table zone if floppy support
is disabled, even if no partition table is found.
Otherwise, the BIOS on Dell Latitude E series laptops will freeze
during POST if an invalid partition table is contained in the PBR
of the active partition when GRUB is installed to a partition.
2011-03-28 Colin Watson <cjwatson@debian.org>
* grub-core/disk/mdraid1x_linux.c (grub_mdraid_detect): Remove stale
comment.
2011-03-28 Colin Watson <cjwatson@debian.org>
* grub-core/disk/raid.c (grub_raid_register): Adjust debug message
to be specific about what kind of RAID device we're scanning for.
2011-03-26 Seth Goldberg <seth.goldberg@oracle.com>
* grub-core/kern/emu/getroot.c (find_root_device_from_libzfs): Don't
return freed string.
2011-03-26 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/iso9660.c (grub_iso9660_label): Rtrim the label.
2011-03-26 Vladimir Serbinenko <phcoder@gmail.com>
Use libgeom on FreeBSD to detect partitions.
* Makefile.util.def (grub-mkimage): Add LIBGEOM to ldadd.
(grub-mkrelpath): Likewise.
(grub-script-check): Likewise.
(grub-editenv): Likewise.
(grub-mkpasswd-pbkdf2): Likewise.
(grub-fstest): Likewise.
(grub-mkfont): Likewise.
(grub-mkdevicemap): Likewise.
(grub-probe): Likewise.
(grub-setup): Likewise.
(grub-ofpathname): Likewise.
(grub-mklayout): Likewise.
(example_unit_test): Likewise.
(grub-menulst2cfg): Likewise.
* grub-core/Makefile.core.def (grub-emu): Likewise.
(grub-emu-lite): Likewise.
* configure.ac: Check for -lgeom on FreeBSD and set LIBGEOM.
* grub-core/kern/emu/hostdisk.c [FreeBSD]: Include libgeom.h. Don't
define HAVE_DIOCGDINFO.
(follow_geom_up) [FreeBSD]: New function.
(find_partition_start) [FreeBSD]: Rewritten using follow_geom_up.
(convert_system_partition_to_system_disk) [FreeBSD]: Likewise.
(grub_util_biosdisk_get_grub_dev) [FreeBSD]: Use FreeBSD path
unconditionally of HAVE_DIOCGDINFO.
2011-03-26 Vladimir Serbinenko <phcoder@gmail.com>
Fix FreeBSD compilation problem.
* grub-core/kern/emu/hostdisk.c (MAJOR) [FreeBSD]: New definition.
(FLOPPY_MAJOR) [FreeBSD]: Likewise.
2011-03-24 Colin Watson <cjwatson@ubuntu.com>
* grub-core/video/fb/video_fb.c (grub_video_fb_get_info_and_fini):
Switch back to page zero before loading a kernel, since some kernel
drivers expect that.
Thanks to: Felix Kuehling.
2011-03-24 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/lib/relocator.c (grub_relocator_alloc_chunk_addr)
[DEBUG_RELOCATOR]: Reuse grub_mm_check.
(grub_relocator_alloc_chunk_align) [DEBUG_RELOCATOR]: Likewise.
2011-03-24 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/mm.h (GRUB_MM_CHECK): Rename to ...
(grub_mm_check): ... this. MAke a function-like macro and use GRUB_FILE.
2011-03-24 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/lib/relocator.c (allocate_inreg): Avoid dprintf unless
DEBUG_RELOCATOR is defined since gfxterm can't cope with output when
malloc is disabled.
2011-03-24 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/loader/i386/bsdXX.c (grub_freebsd_load_elfmodule): Account
for modules headers when counting the needed allocation size.
2011-03-23 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/term/gfxterm.c (calculate_normal_character_width): Return 8
if no ASCII character is found to prevent crash.
2011-03-23 Alexander Kurtz <kurtz.alex@googlemail.com>
* grub-core/video/bitmap.c (match_extension): Ignore case.
2011-03-23 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/normal/menu_entry.c (init_line): Fix off-by-one error.
2011-03-23 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/script/parser.y: Declare "time" as valid argument.
2011-03-23 Peter Jones <pjones@redhat.com>
Fix incorrect assert failure reporting.
* grub-core/tests/example_functional_test.c (example_test): Add
a failure comment.
* grub-core/tests/lib/test.c (add_failure): Renamed to ...
(failure_start): ...this. Check that malloc succeeded.
Don't call xvasprintf. Return failure struct.
(failure_append_vtext): New function.
(failure_append_text): Likewise.
(add_failure): Likewise.
(grub_test_assert_helper): Likewise.
* include/grub/test.h (grub_test_assert_helper): New declaration.
(grub_test_assert): Macro rewritten.
2011-03-23 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/normal/main.c (GRUB_MOD_INIT): Export pager variable.
2011-03-23 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/lib/i386/pc/biosnum.c: Add missing include.
2011-03-23 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/usbms.c (grub_usbms_reset): Transform USB-style error
into GRUB-style one.
2011-03-23 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/bus/usb/usbtrans.c (grub_usb_control_msg): Return usb-style
error and not grub_errno.
* grub-core/bus/usb/usbhub.c (grub_usb_add_hub): Likewise.
2011-03-23 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/bus/usb/uhci.c (grub_uhci_detect_dev): Return
GRUB_USB_SPEED_NONE in case of failure and not the error code.
2011-03-23 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/efiemu/i386/pc/cfgtables.c
(grub_machine_efiemu_init_tables): Make declaration a prototype.
* grub-core/loader/xnu.c (grub_xnu_lock): Likewise.
(grub_xnu_unlock): Likewise.
* grub-core/normal/cmdline.c (grub_cmdline_get/cl_set_pos_all): Likewise.
2011-03-23 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/bus/usb/usb.c (attach_hooks): Make static.
* grub-core/bus/usb/usbhub.c (hubs): Likewise.
* grub-core/commands/hashsum.c (aliases): Likewise.
* grub-core/commands/setpci.c (pci_registers): Likewise.
* grub-core/disk/usbms.c (attach_hook): Likewise.
* grub-core/fs/zfs/zfs.c (decomp_table): Likewise.
(zio_checksum_table): Likewise.
* grub-core/gettext/gettext.c (grub_gettext_msg_list): Likewise.
* grub-core/gfxmenu/gfxmenu.c (cached_view): Likewise.
* grub-core/lib/legacy_parse.c (legacy_commands): Likewise.
* grub-core/lib/relocator.c (leftovers): Likewise.
(extra_blocks): Likewise.
* grub-core/loader/i386/bsd.c (relocator): Likewise.
* grub-core/loader/i386/multiboot_mbi.c (modules): Likewise.
(modules_last): Likewise.
* grub-core/loader/i386/xnu.c (table_aliases): Likewise.
(devices): Likewise.
* grub-core/loader/multiboot_mbi2.c (modules): Likewise.
(modules_last): Likewise.
* grub-core/normal/auth.c (users): Likewise.
* grub-core/normal/context.c (initial_menu): Likewise.
(current_menu): Likewise.
* grub-core/normal/crypto.c (crypto_specs): Likewise.
* grub-core/term/serial.c (grub_serial_ports): Likewise.
(grub_serial_terminfo_input_template): Likewise.
(grub_serial_terminfo_output_template): Likewise.
(grub_serial_terminfo_input): Likewise.
(grub_serial_terminfo_output): Likewise.
(registered): Likewise.
* grub-core/term/usb_keyboard.c (attach_hook): Likewise.
2011-03-23 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/video/bochs.c (grub_video_bochs_setup): Use
grub_video_mode_type_t.
* grub-core/video/cirrus.c (grub_video_cirrus_setup): Likewise.
* grub-core/video/i386/pc/vbe.c (grub_video_vbe_setup): Likewise.
* grub-core/video/i386/pc/vga.c (grub_video_vga_setup): Likewise.
2011-03-23 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-install.in: Correct the x86-64 name as x86_64.
2011-03-11 Colin Watson <cjwatson@ubuntu.com>
* grub-core/boot/i386/pc/lnxboot.S (real_code_2): Ensure that the
initial chunk read from the kernel always includes GRUB's multiboot
header, which is now outside the first sector.
2011-03-09 Colin Watson <cjwatson@ubuntu.com>
* grub-core/loader/i386/linux.c (find_efi_mmap_size): Page-align
cached mmap_size, so that this works correctly when called multiple
times.
Reported by: Daniel Kahn Gillmor. Should fix Debian bug #616638.
2011-03-09 Colin Watson <cjwatson@ubuntu.com>
* docs/grub.texi (Simple configuration): Tidy up formatting.
2011-03-07 Szymon Janc <szymon@janc.net.pl>
* grub-core/fs/zfs/zfs.c (zap_leaf_lookup):
Set-but-not-used variable removed.
2011-02-12 Vladimir Serbinenko <phcoder@gmail.com>
Workaround yet another IEEE1275 bug.

View file

@ -124,7 +124,7 @@ program = {
ldadd = libgrubkern.a;
ldadd = grub-core/gnulib/libgnu.a;
ldadd = '$(LIBLZMA)';
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR)';
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
cppflags = '-DGRUB_PKGLIBROOTDIR=\"$(pkglibrootdir)\"';
};
@ -137,7 +137,7 @@ program = {
ldadd = libgrubmods.a;
ldadd = libgrubkern.a;
ldadd = grub-core/gnulib/libgnu.a;
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR)';
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
};
program = {
@ -149,7 +149,7 @@ program = {
ldadd = libgrubmods.a;
ldadd = libgrubkern.a;
ldadd = grub-core/gnulib/libgnu.a;
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR)';
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
};
program = {
@ -161,7 +161,7 @@ program = {
ldadd = libgrubmods.a;
ldadd = libgrubkern.a;
ldadd = grub-core/gnulib/libgnu.a;
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR)';
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
};
program = {
@ -173,7 +173,7 @@ program = {
ldadd = libgrubmods.a;
ldadd = libgrubkern.a;
ldadd = grub-core/gnulib/libgnu.a;
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR)';
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
};
@ -211,7 +211,7 @@ program = {
ldadd = libgrubmods.a;
ldadd = libgrubkern.a;
ldadd = grub-core/gnulib/libgnu.a;
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR)';
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
};
program = {
@ -226,7 +226,7 @@ program = {
ldadd = libgrubkern.a;
ldadd = grub-core/gnulib/libgnu.a;
ldadd = '$(freetype_libs)';
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR)';
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
condition = COND_GRUB_MKFONT;
};
@ -245,7 +245,7 @@ program = {
ldadd = libgrubmods.a;
ldadd = libgrubkern.a;
ldadd = grub-core/gnulib/libgnu.a;
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR)';
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
};
program = {
@ -257,7 +257,7 @@ program = {
ldadd = libgrubmods.a;
ldadd = libgrubkern.a;
ldadd = grub-core/gnulib/libgnu.a;
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR)';
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
};
program = {
@ -274,7 +274,7 @@ program = {
ldadd = libgrubmods.a;
ldadd = libgrubkern.a;
ldadd = grub-core/gnulib/libgnu.a;
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR)';
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
enable = i386_pc;
enable = sparc64_ieee1275;
@ -289,7 +289,7 @@ program = {
ldadd = libgrubmods.a;
ldadd = libgrubkern.a;
ldadd = grub-core/gnulib/libgnu.a;
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL)';
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBGEOM)';
enable = sparc64_ieee1275;
};
@ -303,7 +303,7 @@ program = {
ldadd = libgrubmods.a;
ldadd = libgrubkern.a;
ldadd = grub-core/gnulib/libgnu.a;
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR)';
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
};
data = {
@ -613,7 +613,7 @@ program = {
ldadd = libgrubmods.a;
ldadd = libgrubkern.a;
ldadd = grub-core/gnulib/libgnu.a;
ldadd = '$(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR)';
ldadd = '$(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
};
program = {
@ -626,5 +626,5 @@ program = {
ldadd = libgrubmods.a;
ldadd = libgrubkern.a;
ldadd = grub-core/gnulib/libgnu.a;
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR)';
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
};

View file

@ -2,6 +2,10 @@
set -e
export LC_CTYPE=C
export LC_COLLATE=C
unset LC_ALL
autogen --version >/dev/null || exit 1
echo "Importing unicode..."

View file

@ -2,6 +2,10 @@
CFLAGS_PLATFORM=
export LC_COLLATE := C
export LC_CTYPE := C
unexport LC_ALL
# Platform specific options
if COND_i386_pc
CFLAGS_PLATFORM += -mrtd -mregparm=3

View file

@ -890,6 +890,15 @@ fi
AC_SUBST([LIBDEVMAPPER])
LIBGEOM=
if test x$host_kernel = xkfreebsd; then
AC_CHECK_LIB([geom], [geom_gettree], [],
[AC_MSG_ERROR([Your platform requires libgeom])])
LIBGEOM="-lgeom"
fi
AC_SUBST([LIBGEOM])
AC_CHECK_LIB([lzma], [lzma_code],
[LIBLZMA="-llzma"
AC_DEFINE([HAVE_LIBLZMA], [1],

View file

@ -1,7 +1,7 @@
AUTOMAKE_OPTIONS = subdir-objects
# AM_MAKEINFOFLAGS = --no-split --no-validate
info_TEXINFOS = grub.texi
info_TEXINFOS = grub.texi grub-dev.texi
grub_TEXINFOS = fdl.texi

BIN
docs/font_char_metrics.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View file

@ -0,0 +1 @@
Please fill this in.

1533
docs/grub-dev.texi Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -200,7 +200,7 @@ program = {
ldadd = 'kernel.img$(EXEEXT)';
ldadd = '$(MODULE_FILES)';
ldadd = '$(LIBUTIL) $(LIBCURSES) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR)';
ldadd = '$(LIBUTIL) $(LIBCURSES) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
enable = emu;
};
@ -212,7 +212,7 @@ program = {
emu_nodist = symlist.c;
ldadd = 'kernel.img$(EXEEXT)';
ldadd = '$(LIBUTIL) $(LIBCURSES) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR)';
ldadd = '$(LIBUTIL) $(LIBCURSES) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
enable = emu;
};

View file

@ -178,8 +178,13 @@ real_code_2:
pushw %es
popw %ds
#if GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART + 4 < 0x200
movl $0x200, %ecx
addl %ecx, %esi
#else
movl $(GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART + 4), %ecx
addl $0x200, %esi
#endif
movl $DATA_ADDR, %edi
call LOCAL(move_memory)
@ -196,7 +201,11 @@ real_code_2:
1:
movl %ss:(DATA_ADDR + GRUB_KERNEL_MACHINE_COMPRESSED_SIZE), %ecx
#if GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART + 4 < 0x200
addl $(GRUB_KERNEL_MACHINE_RAW_SIZE - 0x200), %ecx
#else
addl $(GRUB_KERNEL_MACHINE_RAW_SIZE - (GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART + 4)), %ecx
#endif
2:
call LOCAL(move_memory)

View file

@ -120,7 +120,7 @@ __start:
ori $t0, $zero, GRUB_SMBUS_SPD_MEMORY_TYPE_DDR2
lui $a0, %hi(unimplemented_memory_type)
bne $t0, $v0, fatal
addiu $a0, $a0, %hi(unimplemented_memory_type)
addiu $a0, $a0, %lo(unimplemented_memory_type)
/* And here is our goal: DDR2 controller initialisation. */
lui $t0, %hi(GRUB_CPU_LOONGSON_CORECFG)

View file

@ -749,8 +749,7 @@ grub_uhci_detect_dev (grub_usb_controller_t dev, int port, int *changed)
else if (port == 1)
reg = GRUB_UHCI_REG_PORTSC2;
else
return grub_error (GRUB_ERR_OUT_OF_RANGE,
"UHCI Root Hub port does not exist");
return GRUB_USB_SPEED_NONE;
status = grub_uhci_readreg16 (u, reg);

View file

@ -25,7 +25,7 @@
#include <grub/term.h>
static grub_usb_controller_dev_t grub_usb_list;
struct grub_usb_attach_desc *attach_hooks;
static struct grub_usb_attach_desc *attach_hooks;
void
grub_usb_controller_dev_register (grub_usb_controller_dev_t usb)

View file

@ -39,7 +39,7 @@ struct grub_usb_hub
grub_usb_device_t dev;
};
struct grub_usb_hub *hubs;
static struct grub_usb_hub *hubs;
/* Add a device that currently has device number 0 and resides on
CONTROLLER, the Hub reported that the device speed is SPEED. */
@ -110,7 +110,7 @@ static grub_usb_err_t
grub_usb_add_hub (grub_usb_device_t dev)
{
struct grub_usb_usb_hubdesc hubdesc;
grub_err_t err;
grub_usb_err_t err;
int i;
err = grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_IN

View file

@ -97,7 +97,7 @@ grub_usb_control_msg (grub_usb_device_t dev,
if (! transfer)
{
grub_dma_free (data_chunk);
return grub_errno;
return GRUB_USB_ERR_INTERNAL;
}
setupdata_chunk = grub_memalign_dma32 (32, sizeof (*setupdata));
@ -105,7 +105,7 @@ grub_usb_control_msg (grub_usb_device_t dev,
{
grub_free (transfer);
grub_dma_free (data_chunk);
return grub_errno;
return GRUB_USB_ERR_INTERNAL;
}
setupdata = grub_dma_get_virt (setupdata_chunk);
@ -139,7 +139,7 @@ grub_usb_control_msg (grub_usb_device_t dev,
grub_free (transfer);
grub_dma_free (setupdata_chunk);
grub_dma_free (data_chunk);
return grub_errno;
return GRUB_USB_ERR_INTERNAL;
}
/* Build a Setup packet. XXX: Endianness. */

View file

@ -36,7 +36,7 @@ static const struct grub_arg_option options[] = {
{0, 0, 0, 0, 0, 0}
};
struct { const char *name; const char *hashname; } aliases[] =
static struct { const char *name; const char *hashname; } aliases[] =
{
{"sha256sum", "sha256"},
{"sha512sum", "sha512"},

View file

@ -34,7 +34,7 @@
static const struct grub_arg_option options[] =
{
{"set", 's', GRUB_ARG_OPTION_OPTIONAL,
{"set", 's', 0,
N_("Set a variable to return value."), "VAR", ARG_TYPE_STRING},
{"driver", 'd', 0, N_("Determine driver."), 0, 0},
{"partmap", 'p', 0, N_("Determine partition map type."), 0, 0},
@ -150,7 +150,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT (probe)
{
cmd = grub_register_extcmd ("probe", grub_cmd_probe, 0, N_("[DEVICE]"),
cmd = grub_register_extcmd ("probe", grub_cmd_probe, 0, N_("DEVICE"),
N_("Retrieve device info."), options);
}

View file

@ -32,7 +32,7 @@ struct pci_register
unsigned size;
};
struct pci_register pci_registers[] =
static struct pci_register pci_registers[] =
{
{"VENDOR_ID", GRUB_PCI_REG_VENDOR , 2},
{"DEVICE_ID", GRUB_PCI_REG_DEVICE , 2},

View file

@ -97,10 +97,6 @@ grub_cmd_loopback (grub_extcmd_context_t ctxt, int argc, char **args)
if (newdev)
{
char *newname = grub_strdup (args[1]);
if (! newname)
goto fail;
grub_file_close (newdev->file);
newdev->file = file;
@ -166,7 +162,7 @@ grub_loopback_open (const char *name, grub_disk_t disk)
disk->total_sectors = GRUB_DISK_SIZE_UNKNOWN;
disk->id = (unsigned long) dev;
disk->data = dev->file;
disk->data = dev;
return 0;
}
@ -175,7 +171,7 @@ static grub_err_t
grub_loopback_read (grub_disk_t disk, grub_disk_addr_t sector,
grub_size_t size, char *buf)
{
grub_file_t file = (grub_file_t) disk->data;
grub_file_t file = ((struct grub_loopback *) disk->data)->file;
grub_off_t pos;
grub_file_seek (file, sector << GRUB_DISK_SECTOR_BITS);
@ -222,7 +218,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(loopback)
{
cmd = grub_register_extcmd ("loopback", grub_cmd_loopback, 0,
N_("[-d|-p] DEVICENAME FILE."),
N_("[-d] DEVICENAME FILE."),
N_("Make a device of a file."), options);
grub_disk_dev_register (&grub_loopback_dev);
}

View file

@ -45,6 +45,7 @@ grub_lvm_getvalue (char **p, char *str)
return grub_strtoul (*p, NULL, 10);
}
#if 0
static int
grub_lvm_checkvalue (char **p, char *str, char *tmpl)
{
@ -57,6 +58,7 @@ grub_lvm_checkvalue (char **p, char *str, char *tmpl)
return 0;
return (grub_memcmp (*p + 1, tmpl, tmpllen) == 0 && (*p)[tmpllen + 1] == '"');
}
#endif
static int
grub_lvm_check_flag (char *p, char *str, char *flag)
@ -100,7 +102,7 @@ grub_lvm_iterate (int (*hook) (const char *name))
struct grub_lvm_lv *lv;
if (vg->lvs)
for (lv = vg->lvs; lv; lv = lv->next)
if (hook (lv->name))
if (lv->visible && hook (lv->name))
return 1;
}
@ -164,18 +166,45 @@ grub_lvm_close (grub_disk_t disk __attribute ((unused)))
}
static grub_err_t
grub_lvm_read (grub_disk_t disk, grub_disk_addr_t sector,
grub_size_t size, char *buf)
read_lv (struct grub_lvm_lv *lv, grub_disk_addr_t sector,
grub_size_t size, char *buf);
static grub_err_t
read_node (const struct grub_lvm_node *node, grub_disk_addr_t sector,
grub_size_t size, char *buf)
{
/* Check whether we actually know the physical volume we want to
read from. */
if (node->pv)
{
if (node->pv->disk)
return grub_disk_read (node->pv->disk, sector + node->pv->start, 0,
size << GRUB_DISK_SECTOR_BITS, buf);
else
return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
"physical volume %s not found", node->pv->name);
}
if (node->lv)
return read_lv (node->lv, sector, size, buf);
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "unknown node '%s'", node->name);
}
static grub_err_t
read_lv (struct grub_lvm_lv *lv, grub_disk_addr_t sector,
grub_size_t size, char *buf)
{
grub_err_t err = 0;
struct grub_lvm_lv *lv = disk->data;
struct grub_lvm_vg *vg = lv->vg;
struct grub_lvm_segment *seg = lv->segments;
struct grub_lvm_pv *pv;
struct grub_lvm_node *node;
grub_uint64_t offset;
grub_uint64_t extent;
unsigned int i;
if (!lv)
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "unknown volume");
extent = grub_divmod64 (sector, vg->extent_size, NULL);
/* Find the right segment. */
@ -190,59 +219,75 @@ grub_lvm_read (grub_disk_t disk, grub_disk_addr_t sector,
seg++;
}
if (seg->stripe_count == 1)
if (i == lv->segment_count)
return grub_error (GRUB_ERR_READ_ERROR, "incorrect segment");
switch (seg->type)
{
/* This segment is linear, so that's easy. We just need to find
out the offset in the physical volume and read SIZE bytes
from that. */
struct grub_lvm_stripe *stripe = seg->stripes;
grub_uint64_t seg_offset; /* Offset of the segment in PV device. */
case GRUB_LVM_STRIPED:
if (seg->node_count == 1)
{
/* This segment is linear, so that's easy. We just need to find
out the offset in the physical volume and read SIZE bytes
from that. */
struct grub_lvm_node *stripe = seg->nodes;
grub_uint64_t seg_offset; /* Offset of the segment in PV device. */
pv = stripe->pv;
seg_offset = ((grub_uint64_t) stripe->start
* (grub_uint64_t) vg->extent_size) + pv->start;
node = stripe;
seg_offset = ((grub_uint64_t) stripe->start
* (grub_uint64_t) vg->extent_size);
offset = sector - ((grub_uint64_t) seg->start_extent
* (grub_uint64_t) vg->extent_size) + seg_offset;
offset = sector - ((grub_uint64_t) seg->start_extent
* (grub_uint64_t) vg->extent_size) + seg_offset;
}
else
{
/* This is a striped segment. We have to find the right PV
similar to RAID0. */
struct grub_lvm_node *stripe = seg->nodes;
grub_uint32_t a, b;
grub_uint64_t seg_offset; /* Offset of the segment in PV device. */
unsigned int stripenr;
offset = sector - ((grub_uint64_t) seg->start_extent
* (grub_uint64_t) vg->extent_size);
a = grub_divmod64 (offset, seg->stripe_size, NULL);
grub_divmod64 (a, seg->node_count, &stripenr);
a = grub_divmod64 (offset, seg->stripe_size * seg->node_count, NULL);
grub_divmod64 (offset, seg->stripe_size, &b);
offset = a * seg->stripe_size + b;
stripe += stripenr;
node = stripe;
seg_offset = ((grub_uint64_t) stripe->start
* (grub_uint64_t) vg->extent_size);
offset += seg_offset;
}
return read_node (node, offset, size, buf);
case GRUB_LVM_MIRROR:
i = 0;
while (1)
{
err = read_node (&seg->nodes[i], sector, size, buf);
if (!err)
return err;
if (++i >= seg->node_count)
return err;
grub_errno = GRUB_ERR_NONE;
}
}
else
{
/* This is a striped segment. We have to find the right PV
similar to RAID0. */
struct grub_lvm_stripe *stripe = seg->stripes;
grub_uint32_t a, b;
grub_uint64_t seg_offset; /* Offset of the segment in PV device. */
unsigned int stripenr;
return grub_error (GRUB_ERR_IO, "unknown LVM segment");
}
offset = sector - ((grub_uint64_t) seg->start_extent
* (grub_uint64_t) vg->extent_size);
a = grub_divmod64 (offset, seg->stripe_size, NULL);
grub_divmod64 (a, seg->stripe_count, &stripenr);
a = grub_divmod64 (offset, seg->stripe_size * seg->stripe_count, NULL);
grub_divmod64 (offset, seg->stripe_size, &b);
offset = a * seg->stripe_size + b;
stripe += stripenr;
pv = stripe->pv;
seg_offset = ((grub_uint64_t) stripe->start
* (grub_uint64_t) vg->extent_size) + pv->start;
offset += seg_offset;
}
/* Check whether we actually know the physical volume we want to
read from. */
if (pv->disk)
err = grub_disk_read (pv->disk, offset, 0,
size << GRUB_DISK_SECTOR_BITS, buf);
else
err = grub_error (GRUB_ERR_UNKNOWN_DEVICE,
"physical volume %s not found", pv->name);
return err;
static grub_err_t
grub_lvm_read (grub_disk_t disk, grub_disk_addr_t sector,
grub_size_t size, char *buf)
{
return read_lv (disk->data, sector, size, buf);
}
static grub_err_t
@ -303,7 +348,7 @@ grub_lvm_scan_device (const char *name)
if (i == GRUB_LVM_LABEL_SCAN_SECTORS)
{
#ifdef GRUB_UTIL
grub_util_info ("no LVM signature found\n");
grub_util_info ("no LVM signature found");
#endif
goto fail;
}
@ -511,6 +556,7 @@ grub_lvm_scan_device (const char *name)
int skip_lv = 0;
struct grub_lvm_lv *lv;
struct grub_lvm_segment *seg;
int is_pvmove;
while (grub_isspace (*p))
p++;
@ -533,11 +579,8 @@ grub_lvm_scan_device (const char *name)
lv->size = 0;
if (!grub_lvm_check_flag (p, "status", "VISIBLE"))
{
skip_lv = 1;
goto lv_parsed;
}
lv->visible = grub_lvm_check_flag (p, "status", "VISIBLE");
is_pvmove = grub_lvm_check_flag (p, "status", "PVMOVE");
lv->segment_count = grub_lvm_getvalue (&p, "segment_count = ");
if (p == NULL)
@ -552,7 +595,6 @@ grub_lvm_scan_device (const char *name)
for (i = 0; i < lv->segment_count; i++)
{
struct grub_lvm_stripe *stripe;
p = grub_strstr (p, "segment");
if (p == NULL)
@ -580,90 +622,147 @@ grub_lvm_scan_device (const char *name)
goto lvs_segment_fail;
}
if (grub_lvm_checkvalue (&p, "type = ", "snapshot"))
{
/* Found a snapshot, give up and move on. */
skip_lv = 1;
break;
}
seg->stripe_count = grub_lvm_getvalue (&p, "stripe_count = ");
p = grub_strstr (p, "type = \"");
if (p == NULL)
{
#ifdef GRUB_UTIL
grub_util_info ("unknown stripe_count\n");
#endif
goto lvs_segment_fail;
}
goto lvs_segment_fail;
p += sizeof("type = \"") - 1;
lv->size += seg->extent_count * vg->extent_size;
if (seg->stripe_count != 1)
seg->stripe_size = grub_lvm_getvalue (&p, "stripe_size = ");
if (grub_memcmp (p, "striped\"",
sizeof ("striped\"") - 1) == 0)
{
struct grub_lvm_node *stripe;
seg->stripes = grub_malloc (sizeof (*stripe)
* seg->stripe_count);
stripe = seg->stripes;
seg->type = GRUB_LVM_STRIPED;
seg->node_count = grub_lvm_getvalue (&p, "stripe_count = ");
if (p == NULL)
{
#ifdef GRUB_UTIL
grub_util_info ("unknown stripe_count\n");
#endif
goto lvs_segment_fail;
}
p = grub_strstr (p, "stripes = [");
if (p == NULL)
if (seg->node_count != 1)
seg->stripe_size = grub_lvm_getvalue (&p, "stripe_size = ");
seg->nodes = grub_zalloc (sizeof (*stripe)
* seg->node_count);
stripe = seg->nodes;
p = grub_strstr (p, "stripes = [");
if (p == NULL)
{
#ifdef GRUB_UTIL
grub_util_info ("unknown stripes\n");
#endif
goto lvs_segment_fail2;
}
p += sizeof("stripes = [") - 1;
for (j = 0; j < seg->node_count; j++)
{
p = grub_strchr (p, '"');
if (p == NULL)
continue;
q = ++p;
while (*q != '"')
q++;
s = q - p;
stripe->name = grub_malloc (s + 1);
if (stripe->name == NULL)
goto lvs_segment_fail2;
grub_memcpy (stripe->name, p, s);
stripe->name[s] = '\0';
stripe->start = grub_lvm_getvalue (&p, ",");
if (p == NULL)
continue;
stripe++;
}
}
else if (grub_memcmp (p, "mirror\"", sizeof ("mirror\"") - 1)
== 0)
{
seg->type = GRUB_LVM_MIRROR;
seg->node_count = grub_lvm_getvalue (&p, "mirror_count = ");
if (p == NULL)
{
#ifdef GRUB_UTIL
grub_util_info ("unknown mirror_count\n");
#endif
goto lvs_segment_fail;
}
seg->nodes = grub_zalloc (sizeof (seg->nodes[0])
* seg->node_count);
p = grub_strstr (p, "mirrors = [");
if (p == NULL)
{
#ifdef GRUB_UTIL
grub_util_info ("unknown mirrors\n");
#endif
goto lvs_segment_fail2;
}
p += sizeof("mirrors = [") - 1;
for (j = 0; j < seg->node_count; j++)
{
char *lvname;
p = grub_strchr (p, '"');
if (p == NULL)
continue;
q = ++p;
while (*q != '"')
q++;
s = q - p;
lvname = grub_malloc (s + 1);
if (lvname == NULL)
goto lvs_segment_fail2;
grub_memcpy (lvname, p, s);
lvname[s] = '\0';
seg->nodes[j].name = lvname;
p = q + 1;
}
/* Only first (original) is ok with in progress pvmove. */
if (is_pvmove)
seg->node_count = 1;
}
else
{
#ifdef GRUB_UTIL
grub_util_info ("unknown stripes\n");
char *p2;
p2 = grub_strchr (p, '"');
if (p2)
*p2 = 0;
grub_util_info ("unknown LVM type %s\n", p);
if (p2)
*p2 ='"';
#endif
goto lvs_segment_fail2;
}
p += sizeof("stripes = [") - 1;
for (j = 0; j < seg->stripe_count; j++)
{
char *pvname;
p = grub_strchr (p, '"');
if (p == NULL)
continue;
q = ++p;
while (*q != '"')
q++;
s = q - p;
pvname = grub_malloc (s + 1);
if (pvname == NULL)
goto lvs_segment_fail2;
grub_memcpy (pvname, p, s);
pvname[s] = '\0';
if (vg->pvs)
for (pv = vg->pvs; pv; pv = pv->next)
{
if (! grub_strcmp (pvname, pv->name))
{
stripe->pv = pv;
break;
}
}
grub_free(pvname);
stripe->start = grub_lvm_getvalue (&p, ",");
if (p == NULL)
continue;
stripe++;
/* Found a non-supported type, give up and move on. */
skip_lv = 1;
break;
}
seg++;
continue;
lvs_segment_fail2:
grub_free (seg->stripes);
grub_free (seg->nodes);
lvs_segment_fail:
goto fail4;
}
lv_parsed:
if (p != NULL)
p = grub_strchr (p, '}');
if (p == NULL)
@ -690,6 +789,33 @@ grub_lvm_scan_device (const char *name)
}
}
/* Match lvs. */
{
struct grub_lvm_lv *lv1;
struct grub_lvm_lv *lv2;
for (lv1 = vg->lvs; lv1; lv1 = lv1->next)
for (i = 0; i < lv1->segment_count; i++)
for (j = 0; j < lv1->segments[i].node_count; j++)
{
if (vg->pvs)
for (pv = vg->pvs; pv; pv = pv->next)
{
if (! grub_strcmp (pv->name,
lv1->segments[i].nodes[j].name))
{
lv1->segments[i].nodes[j].pv = pv;
break;
}
}
if (lv1->segments[i].nodes[j].pv == NULL)
for (lv2 = vg->lvs; lv2; lv2 = lv2->next)
if (grub_strcmp (lv2->name + grub_strlen (vg->name) + 1,
lv1->segments[i].nodes[j].name) == 0)
lv1->segments[i].nodes[j].lv = lv2;
}
}
vg->next = vg_list;
vg_list = vg;
}
@ -728,6 +854,7 @@ grub_lvm_scan_device (const char *name)
grub_disk_close (disk);
if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
grub_errno = GRUB_ERR_NONE;
grub_print_error ();
return 0;
}

View file

@ -110,7 +110,6 @@ grub_mdraid_detect (grub_disk_t disk, struct grub_raid_array *array,
struct grub_raid_super_1x sb;
grub_uint8_t minor_version;
/* The sector where the mdraid 0.90 superblock is stored, if available. */
size = grub_disk_get_size (disk);
/* Check for an 1.x superblock.
@ -193,16 +192,22 @@ grub_mdraid_detect (grub_disk_t disk, struct grub_raid_array *array,
array->level = grub_le_to_cpu32 (real_sb->level);
array->layout = grub_le_to_cpu32 (real_sb->layout);
array->total_devs = grub_le_to_cpu32 (real_sb->raid_disks);
array->disk_size = grub_le_to_cpu64 (real_sb->size);
if (real_sb->size)
array->disk_size = grub_le_to_cpu64 (real_sb->size);
else
array->disk_size = grub_le_to_cpu64 (real_sb->data_size);
array->chunk_size = grub_le_to_cpu32 (real_sb->chunksize);
if (grub_le_to_cpu32 (real_sb->dev_number) >=
grub_le_to_cpu32 (real_sb->max_dev))
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
return grub_error (GRUB_ERR_OUT_OF_RANGE,
"spares aren't implemented");
array->index = grub_le_to_cpu16
(real_sb->dev_roles[grub_le_to_cpu32 (real_sb->dev_number)]);
if (array->index >= array->total_devs)
return grub_error (GRUB_ERR_OUT_OF_RANGE,
"spares aren't implemented");
array->uuid_len = 16;
array->uuid = grub_malloc (16);
if (!array->uuid)

View file

@ -202,7 +202,7 @@ grub_mdraid_detect (grub_disk_t disk, struct grub_raid_array *array,
"unsupported RAID level: %d", level);
if (grub_le_to_cpu32 (sb.this_disk.number) == 0xffff
|| grub_le_to_cpu32 (sb.this_disk.number) == 0xfffe)
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
return grub_error (GRUB_ERR_OUT_OF_RANGE,
"spares aren't implemented");
array->name = NULL;

View file

@ -23,6 +23,9 @@
#include <grub/err.h>
#include <grub/misc.h>
#include <grub/raid.h>
#ifdef GRUB_UTIL
#include <grub/util/misc.h>
#endif
/* Linked list of RAID arrays. */
static struct grub_raid_array *array_list;
@ -638,6 +641,10 @@ insert_array (grub_disk_t disk, struct grub_raid_array *new_array,
grub_dprintf ("raid", "Found array %s (%s)\n", array->name,
scanner_name);
#ifdef GRUB_UTIL
grub_util_info ("Found array %s (%s)", array->name,
scanner_name);
#endif
/* Add our new array to the list. */
array->next = array_list;
@ -696,7 +703,12 @@ grub_raid_register (grub_raid_t raid)
struct grub_raid_array array;
grub_disk_addr_t start_sector;
grub_dprintf ("raid", "Scanning for RAID devices on disk %s\n", name);
grub_dprintf ("raid", "Scanning for %s RAID devices on disk %s\n",
grub_raid_list->name, name);
#ifdef GRUB_UTIL
grub_util_info ("Scanning for %s RAID devices on disk %s",
grub_raid_list->name, name);
#endif
disk = grub_disk_open (name);
if (!disk)

View file

@ -70,7 +70,11 @@ static int first_available_slot = 0;
static grub_err_t
grub_usbms_reset (grub_usb_device_t dev, int interface)
{
return grub_usb_control_msg (dev, 0x21, 255, 0, interface, 0, 0);
grub_usb_err_t u;
u = grub_usb_control_msg (dev, 0x21, 255, 0, interface, 0, 0);
if (u)
return grub_error (GRUB_ERR_IO, "USB error %d", u);
return GRUB_ERR_NONE;
}
static void
@ -408,7 +412,7 @@ static struct grub_scsi_dev grub_usbms_dev =
.write = grub_usbms_write
};
struct grub_usb_attach_desc attach_hook =
static struct grub_usb_attach_desc attach_hook =
{
.class = GRUB_USB_CLASS_MASS_STORAGE,
.hook = grub_usbms_attach

View file

@ -24,7 +24,7 @@
#include <grub/acpi.h>
grub_err_t
grub_machine_efiemu_init_tables ()
grub_machine_efiemu_init_tables (void)
{
grub_uint8_t *ptr;
void *table;

View file

@ -555,7 +555,7 @@ grub_ext2_read_inode (struct grub_ext2_data *data,
/* Read the inode. */
if (grub_disk_read (data->disk,
((grub_le_to_cpu32 (blkgrp.inode_table_id) + blkno)
(((grub_disk_addr_t) grub_le_to_cpu32 (blkgrp.inode_table_id) + blkno)
<< LOG2_EXT2_BLOCK_SIZE (data)),
EXT2_INODE_SIZE (data) * blkoff,
sizeof (struct grub_ext2_inode), inode))

View file

@ -481,7 +481,7 @@ parse_dhcp_vendor (void *vend, int limit)
break;
/* If you need any other options please contact GRUB
developpement team. */
development team. */
}
ptr += taglength;

View file

@ -808,6 +808,15 @@ grub_iso9660_label (grub_device_t device, char **label)
((grub_uint16_t *) &data->voldesc.volname, 16);
else
*label = grub_strndup ((char *) data->voldesc.volname, 32);
if (*label)
{
char *ptr;
for (ptr = *label; *ptr;ptr++);
ptr--;
while (ptr >= *label && *ptr == ' ')
*ptr-- = 0;
}
grub_free (data);
}
else

View file

@ -217,12 +217,12 @@ struct grub_jfs_diropen
struct grub_jfs_tree_dir header;
struct grub_jfs_leaf_dirent dirent[0];
struct grub_jfs_leaf_next_dirent next_dirent[0];
char sorted[0];
grub_uint8_t sorted[0];
} *dirpage __attribute__ ((packed));
struct grub_jfs_data *data;
struct grub_jfs_inode *inode;
int count;
char *sorted;
grub_uint8_t *sorted;
struct grub_jfs_leaf_dirent *leaf;
struct grub_jfs_leaf_next_dirent *next_leaf;
@ -234,13 +234,13 @@ struct grub_jfs_diropen
static grub_dl_t my_mod;
static grub_err_t grub_jfs_lookup_symlink (struct grub_jfs_data *data, int ino);
static grub_err_t grub_jfs_lookup_symlink (struct grub_jfs_data *data, grub_uint32_t ino);
/* Get the block number for the block BLK in the node INODE in the
mounted filesystem DATA. */
static int
static grub_int64_t
grub_jfs_blkno (struct grub_jfs_data *data, struct grub_jfs_inode *inode,
unsigned int blk)
grub_uint64_t blk)
{
auto int getblk (struct grub_jfs_treehead *treehead,
struct grub_jfs_tree_extent *extents);
@ -294,15 +294,15 @@ grub_jfs_blkno (struct grub_jfs_data *data, struct grub_jfs_inode *inode,
static grub_err_t
grub_jfs_read_inode (struct grub_jfs_data *data, int ino,
grub_jfs_read_inode (struct grub_jfs_data *data, grub_uint32_t ino,
struct grub_jfs_inode *inode)
{
struct grub_jfs_iag iag;
int iagnum = ino / 4096;
int inoext = (ino % 4096) / 32;
int inonum = (ino % 4096) % 32;
grub_uint32_t iagblk;
grub_uint32_t inoblk;
grub_uint32_t iagnum = ino / 4096;
unsigned inoext = (ino % 4096) / 32;
unsigned inonum = (ino % 4096) % 32;
grub_uint64_t iagblk;
grub_uint64_t inoblk;
iagblk = grub_jfs_blkno (data, &data->fileset, iagnum + 1);
if (grub_errno)
@ -348,6 +348,13 @@ grub_jfs_mount (grub_disk_t disk)
goto fail;
}
if (grub_le_to_cpu32 (data->sblock.blksz)
!= (1U << grub_le_to_cpu16 (data->sblock.log2_blksz)))
{
grub_error (GRUB_ERR_BAD_FS, "not a JFS filesystem");
goto fail;
}
data->disk = disk;
data->pos = 0;
data->linknest = 0;
@ -374,7 +381,7 @@ grub_jfs_opendir (struct grub_jfs_data *data, struct grub_jfs_inode *inode)
{
struct grub_jfs_internal_dirent *de;
struct grub_jfs_diropen *diro;
int blk;
grub_disk_addr_t blk;
de = (struct grub_jfs_internal_dirent *) inode->dir.dirents;
@ -397,7 +404,7 @@ grub_jfs_opendir (struct grub_jfs_data *data, struct grub_jfs_inode *inode)
{
diro->leaf = inode->dir.dirents;
diro->next_leaf = (struct grub_jfs_leaf_next_dirent *) de;
diro->sorted = (char *) (inode->dir.header.sorted);
diro->sorted = inode->dir.header.sorted;
diro->count = inode->dir.header.count;
return diro;
@ -475,7 +482,7 @@ grub_jfs_getent (struct grub_jfs_diropen *diro)
/* The last node, read in more. */
if (diro->index == diro->count)
{
unsigned int next;
grub_disk_addr_t next;
/* If the inode contains the entry tree or if this was the last
node, there is nothing to read. */
@ -499,7 +506,7 @@ grub_jfs_getent (struct grub_jfs_diropen *diro)
diro->index = 0;
}
leaf = &diro->leaf[(int) diro->sorted[diro->index]];
leaf = &diro->leaf[diro->sorted[diro->index]];
next_leaf = &diro->next_leaf[diro->index];
len = leaf->len;
@ -540,21 +547,21 @@ static grub_ssize_t
grub_jfs_read_file (struct grub_jfs_data *data,
void NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t sector,
unsigned offset, unsigned length),
int pos, grub_size_t len, char *buf)
grub_uint64_t pos, grub_size_t len, char *buf)
{
int i;
int blockcnt;
grub_uint64_t i;
grub_uint64_t blockcnt;
blockcnt = ((len + pos + grub_le_to_cpu32 (data->sblock.blksz) - 1)
/ grub_le_to_cpu32 (data->sblock.blksz));
blockcnt = (len + pos + grub_le_to_cpu32 (data->sblock.blksz) - 1)
>> grub_le_to_cpu16 (data->sblock.log2_blksz);
for (i = pos / grub_le_to_cpu32 (data->sblock.blksz); i < blockcnt; i++)
for (i = pos >> grub_le_to_cpu16 (data->sblock.log2_blksz); i < blockcnt; i++)
{
int blknr;
int blockoff = pos % grub_le_to_cpu32 (data->sblock.blksz);
int blockend = grub_le_to_cpu32 (data->sblock.blksz);
grub_disk_addr_t blknr;
grub_uint32_t blockoff = pos & (grub_le_to_cpu32 (data->sblock.blksz) - 1);
grub_uint32_t blockend = grub_le_to_cpu32 (data->sblock.blksz);
int skipfirst = 0;
grub_uint64_t skipfirst = 0;
blknr = grub_jfs_blkno (data, &data->currinode, i);
if (grub_errno)
@ -563,14 +570,14 @@ grub_jfs_read_file (struct grub_jfs_data *data,
/* Last block. */
if (i == blockcnt - 1)
{
blockend = (len + pos) % grub_le_to_cpu32 (data->sblock.blksz);
blockend = (len + pos) & (grub_le_to_cpu32 (data->sblock.blksz) - 1);
if (!blockend)
blockend = grub_le_to_cpu32 (data->sblock.blksz);
}
/* First block. */
if (i == (pos / (int) grub_le_to_cpu32 (data->sblock.blksz)))
if (i == (pos >> grub_le_to_cpu16 (data->sblock.log2_blksz)))
{
skipfirst = blockoff;
blockend -= skipfirst;
@ -642,8 +649,8 @@ grub_jfs_find_file (struct grub_jfs_data *data, const char *path)
pathname. */
if (!grub_strcmp (name, diro->name))
{
int ino = diro->ino;
int dirino = grub_le_to_cpu32 (data->currinode.inode);
grub_uint32_t ino = diro->ino;
grub_uint32_t dirino = grub_le_to_cpu32 (data->currinode.inode);
grub_jfs_closedir (diro);
diro = 0;
@ -687,9 +694,9 @@ grub_jfs_find_file (struct grub_jfs_data *data, const char *path)
static grub_err_t
grub_jfs_lookup_symlink (struct grub_jfs_data *data, int ino)
grub_jfs_lookup_symlink (struct grub_jfs_data *data, grub_uint32_t ino)
{
int size = grub_le_to_cpu64 (data->currinode.size);
grub_uint64_t size = grub_le_to_cpu64 (data->currinode.size);
char symlink[size + 1];
if (++data->linknest > GRUB_JFS_MAX_SYMLNK_CNT)

View file

@ -161,7 +161,7 @@ struct grub_zfs_data
grub_disk_addr_t vdev_phys_sector;
};
decomp_entry_t decomp_table[ZIO_COMPRESS_FUNCTIONS] = {
static decomp_entry_t decomp_table[ZIO_COMPRESS_FUNCTIONS] = {
{"inherit", NULL}, /* ZIO_COMPRESS_INHERIT */
{"on", lzjb_decompress}, /* ZIO_COMPRESS_ON */
{"off", NULL}, /* ZIO_COMPRESS_OFF */
@ -201,7 +201,7 @@ zio_checksum_off (const void *buf __attribute__ ((unused)),
}
/* Checksum Table and Values */
zio_checksum_info_t zio_checksum_table[ZIO_CHECKSUM_FUNCTIONS] = {
static zio_checksum_info_t zio_checksum_table[ZIO_CHECKSUM_FUNCTIONS] = {
{NULL, 0, 0, "inherit"},
{NULL, 0, 0, "on"},
{zio_checksum_off, 0, 0, "off"},
@ -837,14 +837,12 @@ zap_leaf_lookup (zap_leaf_phys_t * l, grub_zfs_endian_t endian,
name))
{
struct zap_leaf_array *la;
grub_uint8_t *ip;
if (le->le_int_size != 8 || le->le_value_length != 1)
return grub_error (GRUB_ERR_BAD_FS, "invalid leaf chunk entry");
/* get the uint64_t property value */
la = &ZAP_LEAF_CHUNK (l, blksft, le->le_value_chunk).l_array;
ip = la->la_array;
*value = grub_be_to_cpu64 (la->la_array64);

View file

@ -49,7 +49,7 @@ struct grub_gettext_msg
const char *translated;
};
struct grub_gettext_msg *grub_gettext_msg_list = NULL;
static struct grub_gettext_msg *grub_gettext_msg_list = NULL;
#define GETTEXT_MAGIC_NUMBER 0
#define GETTEXT_FILE_FORMAT 4

View file

@ -37,7 +37,7 @@
#include <grub/gfxmenu_view.h>
#include <grub/time.h>
grub_gfxmenu_view_t cached_view;
static grub_gfxmenu_view_t cached_view;
static void
grub_gfxmenu_viewer_fini (void *data __attribute__ ((unused)))
@ -56,30 +56,15 @@ grub_gfxmenu_try (int entry, grub_menu_t menu, int nested)
theme_path = grub_env_get ("theme");
if (! theme_path)
{
grub_error_push ();
grub_gfxterm_fullscreen ();
grub_error_pop ();
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "no theme specified");
}
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "no theme specified");
instance = grub_zalloc (sizeof (*instance));
if (!instance)
{
grub_error_push ();
grub_gfxterm_fullscreen ();
grub_error_pop ();
return grub_errno;
}
return grub_errno;
err = grub_video_get_info (&mode_info);
if (err)
{
grub_error_push ();
grub_gfxterm_fullscreen ();
grub_error_pop ();
return err;
}
return err;
if (!cached_view || grub_strcmp (cached_view->theme_path, theme_path) != 0
|| cached_view->screen.width != mode_info.width
@ -94,9 +79,6 @@ grub_gfxmenu_try (int entry, grub_menu_t menu, int nested)
if (! cached_view)
{
grub_free (instance);
grub_error_push ();
grub_gfxterm_fullscreen ();
grub_error_pop ();
return grub_errno;
}

View file

@ -935,7 +935,7 @@ weak_alias (__argp_parse, argp_parse)
void *
__argp_input (const struct argp *argp, const struct argp_state *state)
{
if (state)
if (state && state->pstate)
{
struct group *group;
struct parser *parser = state->pstate;

View file

@ -178,7 +178,7 @@ grub_find_root_device_from_mountinfo (const char *dir, char **relroot)
static char *
find_root_device_from_libzfs (const char *dir)
{
char *device;
char *device = NULL;
char *poolname;
char *poolfs;
@ -219,7 +219,10 @@ find_root_device_from_libzfs (const char *dir)
struct stat st;
if (stat (device, &st) == 0)
break;
{
device = xstrdup (device);
break;
}
device = NULL;
}
@ -811,12 +814,30 @@ grub_util_get_grub_dev (const char *os_dev)
if (mdadm_name)
{
char *newname;
const char *q;
for (q = os_dev + strlen (os_dev) - 1; q >= os_dev
&& grub_isdigit (*q); q--);
if (q >= os_dev && *q == 'p')
{
newname = xasprintf ("/dev/md/%sp%s", mdadm_name, q + 1);
if (stat (newname, &st) == 0)
{
free (grub_dev);
grub_dev = xasprintf ("md/%s,%s", mdadm_name, q + 1);
goto done;
}
free (newname);
}
newname = xasprintf ("/dev/md/%s", mdadm_name);
if (stat (newname, &st) == 0)
{
free (grub_dev);
grub_dev = xasprintf ("md/%s", mdadm_name);
}
done:
free (newname);
free (mdadm_name);
}

View file

@ -92,6 +92,8 @@ struct hd_geometry
# include <sys/disk.h> /* DIOCGMEDIASIZE */
# include <sys/param.h>
# include <sys/sysctl.h>
# define MAJOR(dev) major(dev)
# define FLOPPY_MAJOR 2
#endif
#if defined(__APPLE__)
@ -102,7 +104,9 @@ struct hd_geometry
# include <libdevmapper.h>
#endif
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#include <libgeom.h>
#elif defined(__NetBSD__)
# define HAVE_DIOCGDINFO
# include <sys/ioctl.h>
# include <sys/disklabel.h> /* struct disklabel */
@ -134,6 +138,7 @@ struct grub_util_biosdisk_data
char *dev;
int access_mode;
int fd;
int is_disk;
};
#ifdef __linux__
@ -235,6 +240,7 @@ grub_util_biosdisk_open (const char *name, grub_disk_t disk)
data->dev = NULL;
data->access_mode = 0;
data->fd = -1;
data->is_disk = 0;
/* Get the size. */
#if defined(__MINGW32__)
@ -275,6 +281,7 @@ grub_util_biosdisk_open (const char *name, grub_disk_t disk)
close (fd);
goto fail;
}
data->is_disk = 1;
# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
if (ioctl (fd, DIOCGMEDIASIZE, &nr))
@ -337,7 +344,68 @@ device_is_mapped (const char *dev)
}
#endif /* HAVE_DEVICE_MAPPER */
#if defined(__linux__) || defined(__CYGWIN__) || defined(HAVE_DIOCGDINFO)
#if defined (__FreeBSD__) || defined(__FreeBSD_kernel__)
/* FIXME: geom actually gives us the whole container hierarchy.
It can be used more efficiently than this. */
static void
follow_geom_up (const char *name, grub_disk_addr_t *off_out, char **name_out)
{
struct gmesh mesh;
struct gclass *class;
int error;
struct ggeom *geom;
grub_util_info ("following geom '%s'", name);
error = geom_gettree (&mesh);
if (error != 0)
grub_util_error ("couldn't open geom");
LIST_FOREACH (class, &mesh.lg_class, lg_class)
if (strcasecmp (class->lg_name, "part") == 0)
break;
if (!class)
grub_util_error ("couldn't open geom part");
LIST_FOREACH (geom, &class->lg_geom, lg_geom)
{
struct gprovider *provider;
LIST_FOREACH (provider, &geom->lg_provider, lg_provider)
if (strcmp (provider->lg_name, name) == 0)
{
char *name_tmp = xstrdup (geom->lg_name);
grub_disk_addr_t off = 0;
struct gconfig *config;
grub_util_info ("geom '%s' has parent '%s'", name, geom->lg_name);
follow_geom_up (name_tmp, &off, name_out);
free (name_tmp);
LIST_FOREACH (config, &provider->lg_config, lg_config)
if (strcasecmp (config->lg_name, "start") == 0)
off += strtoull (config->lg_val, 0, 10);
if (off_out)
*off_out = off;
return;
}
}
grub_util_info ("geom '%s' has no parent", name);
if (name_out)
*name_out = xstrdup (name);
if (off_out)
*off_out = 0;
}
static grub_disk_addr_t
find_partition_start (const char *dev)
{
grub_disk_addr_t out;
if (strncmp (dev, "/dev/", sizeof ("/dev/") - 1) != 0)
return 0;
follow_geom_up (dev + sizeof ("/dev/") - 1, &out, NULL);
return out;
}
#elif defined(__linux__) || defined(__CYGWIN__) || defined(HAVE_DIOCGDINFO)
static grub_disk_addr_t
find_partition_start (const char *dev)
{
@ -453,9 +521,12 @@ devmapper_fail:
# if !defined(HAVE_DIOCGDINFO)
return hdg.start;
# else /* defined(HAVE_DIOCGDINFO) */
p_index = dev[strlen(dev) - 1] - 'a';
if (dev[0])
p_index = dev[strlen(dev) - 1] - 'a';
else
p_index = -1;
if (p_index >= label.d_npartitions)
if (p_index >= label.d_npartitions || p_index < 0)
{
grub_error (GRUB_ERR_BAD_DEVICE,
"no disk label entry for `%s'", dev);
@ -596,7 +667,18 @@ open_device (const grub_disk_t disk, grub_disk_addr_t sector, int flags)
{
free (data->dev);
if (data->fd != -1)
close (data->fd);
{
if (data->access_mode == O_RDWR || data->access_mode == O_WRONLY)
{
fsync (data->fd);
#ifdef __linux__
if (data->is_disk)
ioctl (data->fd, BLKFLSBUF, 0);
#endif
}
close (data->fd);
}
/* Open the partition. */
grub_dprintf ("hostdisk", "opening the device `%s' in open_device()\n", dev);
@ -607,10 +689,6 @@ open_device (const grub_disk_t disk, grub_disk_addr_t sector, int flags)
return -1;
}
/* Flush the buffer cache to the physical disk.
XXX: This also empties the buffer cache. */
ioctl (fd, BLKFLSBUF, 0);
data->dev = xstrdup (dev);
data->access_mode = (flags & O_ACCMODE);
data->fd = fd;
@ -648,7 +726,17 @@ open_device (const grub_disk_t disk, grub_disk_addr_t sector, int flags)
{
free (data->dev);
if (data->fd != -1)
close (data->fd);
{
if (data->access_mode == O_RDWR || data->access_mode == O_WRONLY)
{
fsync (data->fd);
#ifdef __linux__
if (data->is_disk)
ioctl (data->fd, BLKFLSBUF, 0);
#endif
}
close (data->fd);
}
fd = open (map[disk->id].device, flags);
if (fd >= 0)
@ -808,7 +896,6 @@ grub_util_biosdisk_read (grub_disk_t disk, grub_disk_addr_t sector,
if (nread (fd, buf, GRUB_DISK_SECTOR_SIZE) != GRUB_DISK_SECTOR_SIZE)
{
grub_error (GRUB_ERR_READ_ERROR, "cannot read `%s'", map[disk->id].device);
close (fd);
return grub_errno;
}
@ -865,7 +952,17 @@ grub_util_biosdisk_close (struct grub_disk *disk)
free (data->dev);
if (data->fd != -1)
close (data->fd);
{
if (data->access_mode == O_RDWR || data->access_mode == O_WRONLY)
{
fsync (data->fd);
#ifdef __linux__
if (data->is_disk)
ioctl (data->fd, BLKFLSBUF, 0);
#endif
}
close (data->fd);
}
free (data);
}
@ -1284,7 +1381,17 @@ devmapper_out:
path[8] = 0;
return path;
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__APPLE__)
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
char *out, *out2;
if (strncmp (os_dev, "/dev/", sizeof ("/dev/") - 1) != 0)
return xstrdup (os_dev);
follow_geom_up (os_dev + sizeof ("/dev/") - 1, NULL, &out);
out2 = xasprintf ("/dev/%s", out);
free (out);
return out2;
#elif defined(__APPLE__)
char *path = xstrdup (os_dev);
if (strncmp ("/dev/", path, 5) == 0)
{
@ -1440,6 +1547,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
if (stat (os_dev, &st) < 0)
{
grub_error (GRUB_ERR_BAD_DEVICE, "cannot stat `%s'", os_dev);
grub_util_info ("cannot stat `%s'", os_dev);
return 0;
}
@ -1448,6 +1556,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
{
grub_error (GRUB_ERR_UNKNOWN_DEVICE,
"no mapping exists for `%s'", os_dev);
grub_util_info ("no mapping exists for `%s'", os_dev);
return 0;
}
@ -1462,7 +1571,8 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
#endif
return make_device_name (drive, -1, -1);
#if defined(__linux__) || defined(__CYGWIN__) || defined(HAVE_DIOCGDINFO)
#if defined(__linux__) || defined(__CYGWIN__) || defined(HAVE_DIOCGDINFO) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
/* Linux counts partitions uniformly, whether a BSD partition or a DOS
partition, so mapping them to GRUB devices is not trivial.
Here, get the start sector of a partition by HDIO_GETGEO, and

View file

@ -68,7 +68,7 @@ grub_file_open (const char *name)
goto fail;
/* Get the file part of NAME. */
file_name = grub_strchr (name, ')');
file_name = (name[0] == '(') ? grub_strchr (name, ')') : NULL;
if (file_name)
file_name++;
else

View file

@ -37,80 +37,80 @@
.text
FUNCTION(efi_wrap_0)
subq $40, %rsp
subq $48, %rsp
call *%rdi
addq $40, %rsp
addq $48, %rsp
ret
FUNCTION(efi_wrap_1)
subq $40, %rsp
subq $48, %rsp
mov %rsi, %rcx
call *%rdi
addq $40, %rsp
addq $48, %rsp
ret
FUNCTION(efi_wrap_2)
subq $40, %rsp
subq $48, %rsp
mov %rsi, %rcx
call *%rdi
addq $40, %rsp
addq $48, %rsp
ret
FUNCTION(efi_wrap_3)
subq $40, %rsp
subq $48, %rsp
mov %rcx, %r8
mov %rsi, %rcx
call *%rdi
addq $40, %rsp
addq $48, %rsp
ret
FUNCTION(efi_wrap_4)
subq $40, %rsp
subq $48, %rsp
mov %r8, %r9
mov %rcx, %r8
mov %rsi, %rcx
call *%rdi
addq $40, %rsp
addq $48, %rsp
ret
FUNCTION(efi_wrap_5)
subq $40, %rsp
subq $48, %rsp
mov %r9, 32(%rsp)
mov %r8, %r9
mov %rcx, %r8
mov %rsi, %rcx
call *%rdi
addq $40, %rsp
addq $48, %rsp
ret
FUNCTION(efi_wrap_6)
subq $56, %rsp
mov 56+8(%rsp), %rax
subq $64, %rsp
mov 64+8(%rsp), %rax
mov %rax, 40(%rsp)
mov %r9, 32(%rsp)
mov %r8, %r9
mov %rcx, %r8
mov %rsi, %rcx
call *%rdi
addq $56, %rsp
addq $64, %rsp
ret
FUNCTION(efi_wrap_10)
subq $88, %rsp
mov 88+40(%rsp), %rax
subq $96, %rsp
mov 96+40(%rsp), %rax
mov %rax, 72(%rsp)
mov 88+32(%rsp), %rax
mov 96+32(%rsp), %rax
mov %rax, 64(%rsp)
mov 88+24(%rsp), %rax
mov 96+24(%rsp), %rax
mov %rax, 56(%rsp)
mov 88+16(%rsp), %rax
mov 96+16(%rsp), %rax
mov %rax, 48(%rsp)
mov 88+8(%rsp), %rax
mov 96+8(%rsp), %rax
mov %rax, 40(%rsp)
mov %r9, 32(%rsp)
mov %r8, %r9
mov %rcx, %r8
mov %rsi, %rcx
call *%rdi
addq $88, %rsp
addq $96, %rsp
ret

View file

@ -19,6 +19,7 @@
#include <grub/env.h>
#include <grub/misc.h>
#include <grub/disk.h>
#include <grub/machine/biosnum.h>
static int
grub_get_root_biosnumber_default (void)

View file

@ -58,7 +58,7 @@ struct legacy_command
const char *longdesc;
};
struct legacy_command legacy_commands[] =
static struct legacy_command legacy_commands[] =
{
{"blocklist", "blocklist '%s'\n", NULL, 0, 1, {TYPE_FILE}, 0, "FILE",
"Print the blocklist notation of the file FILE."},
@ -116,7 +116,7 @@ struct legacy_command legacy_commands[] =
" immediately starts over using the NUM entry (same numbering as the"
" `default' command). This obviously won't help if the machine"
" was rebooted by a kernel that GRUB loaded."},
{"find", "search -sf '%s'\n", NULL, 0, 1, {TYPE_FILE}, 0, "FILENAME",
{"find", "search -f '%s'\n", NULL, 0, 1, {TYPE_FILE}, 0, "FILENAME",
"Search for the filename FILENAME in all of partitions and print the list of"
" the devices which contain the file."},
/* FIXME: fstest unsupported. */

View file

@ -77,10 +77,10 @@ struct grub_relocator_fw_leftover
grub_uint8_t freebytes[GRUB_RELOCATOR_FIRMWARE_REQUESTS_QUANT / 8];
};
struct grub_relocator_fw_leftover *leftovers;
static struct grub_relocator_fw_leftover *leftovers;
#endif
struct grub_relocator_extra_block *extra_blocks;
static struct grub_relocator_extra_block *extra_blocks;
void *
get_virtual_current_address (grub_relocator_chunk_t in)
@ -135,8 +135,9 @@ allocate_regstart (grub_phys_addr_t addr, grub_size_t size, grub_mm_region_t rb,
grub_mm_header_t new_header;
grub_mm_header_t hb = (grub_mm_header_t) (rb + 1);
#ifdef DEBUG_RELOCATOR_NOMEM_DPRINTF
grub_dprintf ("relocator", "ra = %p, rb = %p\n", regancestor, rb);
#endif
newreg_start = ALIGN_UP (newreg_raw_start, GRUB_MM_ALIGN);
newreg_presize = newreg_start - newreg_raw_start;
newreg_size = rb->size - (newreg_start - (grub_addr_t) rb);
@ -179,11 +180,12 @@ allocate_regstart (grub_phys_addr_t addr, grub_size_t size, grub_mm_region_t rb,
if ((void *) h < (void *) (newreg + 1))
grub_fatal ("Failed to adjust memory region: %p, %p, %p, %p, %p",
newreg, newreg->first, h, hp, hb);
#ifdef DEBUG_RELOCATOR_NOMEM_DPRINTF
if ((void *) h == (void *) (newreg + 1))
grub_dprintf ("relocator",
"Free start memory region: %p, %p, %p, %p, %p",
newreg, newreg->first, h, hp, hb);
#endif
hp = h;
h = h->next;
}
@ -200,10 +202,12 @@ allocate_inreg (grub_phys_addr_t paddr, grub_size_t size,
struct grub_mm_header *foll = NULL;
grub_addr_t vaddr = (grub_addr_t) hb + (paddr - grub_vtop (hb));
#ifdef DEBUG_RELOCATOR_NOMEM_DPRINTF
grub_dprintf ("relocator", "inreg paddr = 0x%lx, size = %lu,"
" hb = %p, hbp = %p, rb = %p, vaddr = 0x%lx\n",
(unsigned long) paddr, (unsigned long) size, hb, hbp,
rb, (unsigned long) vaddr);
#endif
if (ALIGN_UP (vaddr + size, GRUB_MM_ALIGN) + GRUB_MM_ALIGN
<= (grub_addr_t) (hb + hb->size))
@ -211,8 +215,10 @@ allocate_inreg (grub_phys_addr_t paddr, grub_size_t size,
foll = (void *) ALIGN_UP (vaddr + size, GRUB_MM_ALIGN);
foll->magic = GRUB_MM_FREE_MAGIC;
foll->size = hb + hb->size - foll;
#ifdef DEBUG_RELOCATOR_NOMEM_DPRINTF
grub_dprintf ("relocator", "foll = %p, foll->size = %lu\n", foll,
(unsigned long) foll->size);
#endif
}
if (vaddr - (grub_addr_t) hb >= sizeof (*hb))
@ -819,9 +825,11 @@ malloc_in_range (struct grub_relocator *rel,
fend
= ALIGN_UP (alloc_end,
GRUB_RELOCATOR_FIRMWARE_REQUESTS_QUANT);
#ifdef DEBUG_RELOCATOR_NOMEM_DPRINTF
grub_dprintf ("relocator", "requesting %lx-%lx\n",
(unsigned long) fstart,
(unsigned long) fend);
#endif
/* The failure here can be very expensive. */
if (!grub_relocator_firmware_alloc_region (fstart,
fend - fstart))
@ -1282,23 +1290,8 @@ grub_relocator_alloc_chunk_addr (struct grub_relocator *rel,
chunk->srcv = grub_map_memory (chunk->src, chunk->size);
*out = chunk;
#ifdef DEBUG_RELOCATOR
{
grub_mm_region_t r;
grub_mm_header_t p;
grub_memset (chunk->srcv, 0xfa, chunk->size);
for (r = grub_mm_base; r; r = r->next)
{
p = r->first;
do
{
if ((grub_addr_t) p < (grub_addr_t) (r + 1)
|| (grub_addr_t) p >= (grub_addr_t) (r + 1) + r->size)
grub_fatal (__FILE__ ":%d: out of range pointer: %p\n", __LINE__, p);
p = p->next;
}
while (p != r->first);
}
}
grub_memset (chunk->srcv, 0xfa, chunk->size);
grub_mm_check ();
#endif
return GRUB_ERR_NONE;
}
@ -1423,11 +1416,17 @@ grub_relocator_alloc_chunk_align (struct grub_relocator *rel,
break;
}
grub_dprintf ("relocator", "relocators_size=%ld\n",
(unsigned long) rel->relocators_size);
if (chunk->src < chunk->target)
rel->relocators_size += grub_relocator_backward_size;
if (chunk->src > chunk->target)
rel->relocators_size += grub_relocator_forward_size;
grub_dprintf ("relocator", "relocators_size=%ld\n",
(unsigned long) rel->relocators_size);
chunk->size = size;
chunk->next = rel->chunks;
rel->chunks = chunk;
@ -1436,24 +1435,8 @@ grub_relocator_alloc_chunk_align (struct grub_relocator *rel,
chunk->srcv = grub_map_memory (chunk->src, chunk->size);
*out = chunk;
#ifdef DEBUG_RELOCATOR
{
grub_mm_region_t r;
grub_mm_header_t p;
grub_memset (chunk->srcv, 0xfa, chunk->size);
for (r = grub_mm_base; r; r = r->next)
{
p = r->first;
do
{
if ((grub_addr_t) p < (grub_addr_t) (r + 1)
|| (grub_addr_t) p >= (grub_addr_t) (r + 1) + r->size)
grub_fatal (__FILE__ "%d: out of range pointer: %p\n", __LINE__, p);
p = p->next;
}
while (p != r->first);
}
}
grub_memset (chunk->srcv, 0xfa, chunk->size);
grub_mm_check ();
#endif
return GRUB_ERR_NONE;
}

View file

@ -65,7 +65,7 @@ static void *kern_chunk_src;
static grub_uint32_t bootflags;
static int is_elf_kernel, is_64bit;
static grub_uint32_t openbsd_root;
struct grub_relocator *relocator = NULL;
static struct grub_relocator *relocator = NULL;
static struct grub_openbsd_ramdisk_descriptor openbsd_ramdisk;
struct bsd_tag

View file

@ -195,6 +195,11 @@ SUFFIX (grub_freebsd_load_elfmodule) (struct grub_relocator *relocator,
chunk_size = s->sh_addr + s->sh_size;
}
if (chunk_size < sizeof (e))
chunk_size = sizeof (e);
chunk_size += e.e_phnum * e.e_phentsize;
chunk_size += e.e_shnum * e.e_shentsize;
{
grub_relocator_chunk_t ch;

View file

@ -136,7 +136,8 @@ find_efi_mmap_size (void)
later, and EFI itself may allocate more. */
mmap_size += (1 << 12);
return page_align (mmap_size);
mmap_size = page_align (mmap_size);
return mmap_size;
}
#endif

View file

@ -46,7 +46,7 @@ struct module
int cmdline_size;
};
struct module *modules, *modules_last;
static struct module *modules, *modules_last;
static grub_size_t cmdline_size;
static grub_size_t total_modcmd;
static unsigned modcnt;
@ -435,7 +435,7 @@ grub_multiboot_make_mbi (grub_uint32_t *target)
bufsize = grub_multiboot_get_mbi_size ();
err = grub_relocator_alloc_chunk_align (grub_multiboot_relocator, &ch,
0, 0xffffffff - bufsize,
0x10000, 0x100000 - bufsize,
bufsize, 4,
GRUB_RELOCATOR_PREFERENCE_NONE);
if (err)

View file

@ -49,7 +49,7 @@ struct tbl_alias
char *name;
};
struct tbl_alias table_aliases[] =
static struct tbl_alias table_aliases[] =
{
{GRUB_EFI_ACPI_20_TABLE_GUID, "ACPI_20"},
{GRUB_EFI_ACPI_TABLE_GUID, "ACPI"},
@ -219,7 +219,7 @@ struct property_descriptor
void *data;
};
struct grub_xnu_devprop_device_descriptor *devices = 0;
static struct grub_xnu_devprop_device_descriptor *devices = 0;
grub_err_t
grub_xnu_devprop_remove_property (struct grub_xnu_devprop_device_descriptor *dev,

View file

@ -379,8 +379,9 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
grub_relocator_chunk_t ch;
err = grub_relocator_alloc_chunk_align (relocator, &ch,
target_addr + linux_size + 0x10000,
(0xffffffff - size) + 1,
(target_addr & 0x1fffffff)
+ linux_size + 0x10000,
(0x10000000 - size),
size, 0x10000,
GRUB_RELOCATOR_PREFERENCE_NONE);

View file

@ -54,7 +54,7 @@ struct module
int cmdline_size;
};
struct module *modules, *modules_last;
static struct module *modules, *modules_last;
static grub_size_t cmdline_size;
static grub_size_t total_modcmd;
static unsigned modcnt;

View file

@ -1429,7 +1429,7 @@ grub_cmd_xnu_resume (grub_command_t cmd __attribute__ ((unused)),
#endif
void
grub_xnu_lock ()
grub_xnu_lock (void)
{
if (!locked)
grub_dl_ref (my_mod);
@ -1437,7 +1437,7 @@ grub_xnu_lock ()
}
void
grub_xnu_unlock ()
grub_xnu_unlock (void)
{
if (locked)
grub_dl_unref (my_mod);

View file

@ -194,7 +194,6 @@ grub_mmap_unregister (int handle)
{
struct overlay *curover, *prevover;
grub_efi_boot_services_t *b;
grub_efi_status_t status;
b = grub_efi_system_table->boot_services;
@ -204,7 +203,7 @@ grub_mmap_unregister (int handle)
{
if (curover->handle == handle)
{
status = efi_call_2 (b->free_pages, curover->address, curover->pages);
efi_call_2 (b->free_pages, curover->address, curover->pages);
if (prevover != 0)
prevover->next = curover->next;
else

View file

@ -34,7 +34,7 @@ struct grub_auth_user
int authenticated;
};
struct grub_auth_user *users = NULL;
static struct grub_auth_user *users = NULL;
grub_err_t
grub_auth_register_authentication (const char *user,

View file

@ -240,7 +240,7 @@ grub_cmdline_get (const char *prompt)
grub_term_gotoxy (cl_term->term, cl_term->xpos, cl_term->ypos);
}
void cl_set_pos_all ()
void cl_set_pos_all (void)
{
unsigned i;
for (i = 0; i < nterms; i++)

View file

@ -31,8 +31,8 @@ struct menu_pointer
struct menu_pointer *prev;
};
struct menu_pointer initial_menu;
struct menu_pointer *current_menu = &initial_menu;
static struct menu_pointer initial_menu;
static struct menu_pointer *current_menu = &initial_menu;
void
grub_env_unset_menu (void)

View file

@ -31,7 +31,7 @@ struct load_spec
char *modname;
};
struct load_spec *crypto_specs = NULL;
static struct load_spec *crypto_specs = NULL;
static void
grub_crypto_autoload (const char *name)

View file

@ -496,6 +496,7 @@ GRUB_MOD_INIT(normal)
grub_set_history (GRUB_DEFAULT_HISTORY_SIZE);
grub_register_variable_hook ("pager", 0, grub_env_write_pager);
grub_env_export ("pager");
/* Register a command "normal" for the rescue mode. */
grub_register_command ("normal", grub_cmd_normal,

View file

@ -30,6 +30,8 @@
#include <grub/i18n.h>
#include <grub/term.h>
#include <grub/script_sh.h>
#include <grub/gfxterm.h>
#include <grub/dl.h>
/* Time to delay after displaying an error message about a default/fallback
entry failing to boot. */
@ -345,18 +347,44 @@ static void
menu_init (int entry, grub_menu_t menu, int nested)
{
struct grub_term_output *term;
int gfxmenu = 0;
FOR_ACTIVE_TERM_OUTPUTS(term)
if (grub_strcmp (term->name, "gfxterm") == 0)
{
if (grub_env_get ("theme"))
{
if (!grub_gfxmenu_try_hook)
{
grub_dl_load ("gfxmenu");
grub_print_error ();
}
if (grub_gfxmenu_try_hook)
{
grub_err_t err;
err = grub_gfxmenu_try_hook (entry, menu, nested);
if(!err)
{
gfxmenu = 1;
break;
}
}
else
grub_error (GRUB_ERR_BAD_MODULE, "no gfxmenu found");
grub_print_error ();
grub_wait_after_message ();
}
grub_errno = GRUB_ERR_NONE;
grub_gfxterm_fullscreen ();
break;
}
FOR_ACTIVE_TERM_OUTPUTS(term)
{
grub_err_t err;
if (grub_gfxmenu_try_hook && grub_strcmp (term->name, "gfxterm") == 0)
{
err = grub_gfxmenu_try_hook (entry, menu, nested);
if(!err)
continue;
grub_errno = GRUB_ERR_NONE;
}
if (grub_strcmp (term->name, "gfxterm") == 0 && gfxmenu)
break;
err = grub_menu_try_text (term, entry, menu, nested);
if(!err)

View file

@ -52,6 +52,8 @@ struct per_term_screen
int x;
/* The Y coordinate. */
int y;
/* Number of entries. */
int num_entries;
};
struct screen
@ -87,7 +89,7 @@ init_line (struct line *linep)
{
linep->len = 0;
linep->max_len = 80; /* XXX */
linep->buf = grub_malloc (linep->max_len);
linep->buf = grub_malloc (linep->max_len + 1);
if (! linep->buf)
return 0;
@ -188,7 +190,7 @@ print_down (int flag, struct per_term_screen *term_screen)
grub_term_gotoxy (term_screen->term, GRUB_TERM_LEFT_BORDER_X
+ grub_term_border_width (term_screen->term),
GRUB_TERM_TOP_BORDER_Y
+ grub_term_num_entries (term_screen->term));
+ term_screen->num_entries);
if (flag)
grub_putcode (GRUB_UNICODE_DOWNARROW, term_screen->term);
@ -209,13 +211,12 @@ update_screen (struct screen *screen, struct per_term_screen *term_screen,
struct line *linep;
/* Check if scrolling is necessary. */
if (term_screen->y < 0 || term_screen->y
>= grub_term_num_entries (term_screen->term))
if (term_screen->y < 0 || term_screen->y >= term_screen->num_entries)
{
if (term_screen->y < 0)
term_screen->y = 0;
else
term_screen->y = grub_term_num_entries (term_screen->term) - 1;
term_screen->y = term_screen->num_entries - 1;
region_start = 0;
region_column = 0;
@ -251,7 +252,7 @@ update_screen (struct screen *screen, struct per_term_screen *term_screen,
for (column = 0;
column <= linep->len
&& y < grub_term_num_entries (term_screen->term);
&& y < term_screen->num_entries;
column += grub_term_entry_width (term_screen->term), y++)
{
if (y < 0)
@ -272,7 +273,7 @@ update_screen (struct screen *screen, struct per_term_screen *term_screen,
print_line (linep, column, 0, y, term_screen);
}
if (y == grub_term_num_entries (term_screen->term))
if (y == term_screen->num_entries)
{
if (column <= linep->len || i + 1 < screen->num_lines)
down_flag = 1;
@ -282,11 +283,11 @@ update_screen (struct screen *screen, struct per_term_screen *term_screen,
i++;
if (mode == ALL_LINES && i == screen->num_lines)
for (; y < grub_term_num_entries (term_screen->term); y++)
for (; y < term_screen->num_entries; y++)
print_empty_line (y, term_screen);
}
while (y < grub_term_num_entries (term_screen->term));
while (y < term_screen->num_entries);
/* Draw up and down arrows. */
if (up)
@ -1165,7 +1166,7 @@ run (struct screen *screen)
{
char *script;
int errs_before;
grub_menu_t menu;
grub_menu_t menu = NULL;
char *dummy[1] = { NULL };
auto char * editor_getsource (void);
@ -1185,7 +1186,7 @@ run (struct screen *screen)
size = 0;
for (i = 0; i < screen->num_lines; i++)
{
grub_strcpy (source + size, screen->lines[i].buf);
grub_memcpy (source + size, screen->lines[i].buf, screen->lines[i].len);
size += screen->lines[i].len;
source[size++] = '\n';
}
@ -1290,7 +1291,8 @@ grub_menu_entry_run (grub_menu_entry_t entry)
}
/* Draw the screen. */
for (i = 0; i < screen->nterms; i++)
grub_menu_init_page (0, 1, screen->terms[i].term);
grub_menu_init_page (0, 1, &screen->terms[i].num_entries,
screen->terms[i].term);
update_screen_all (screen, 0, 0, 1, 1, ALL_LINES);
for (i = 0; i < screen->nterms; i++)
grub_term_setcursor (screen->terms[i].term, 1);

View file

@ -34,10 +34,19 @@ static grub_uint8_t grub_color_menu_highlight;
struct menu_viewer_data
{
int first, offset;
/* The number of entries shown at a time. */
int num_entries;
grub_menu_t menu;
struct grub_term_output *term;
};
static inline int
grub_term_cursor_x (struct grub_term_output *term)
{
return (GRUB_TERM_LEFT_BORDER_X + grub_term_border_width (term)
- GRUB_TERM_MARGIN - 1);
}
grub_ssize_t
grub_getstringwidth (grub_uint32_t * str, const grub_uint32_t * last_position,
struct grub_term_output *term)
@ -53,30 +62,45 @@ grub_getstringwidth (grub_uint32_t * str, const grub_uint32_t * last_position,
return width;
}
void
grub_print_message_indented (const char *msg, int margin_left, int margin_right,
struct grub_term_output *term)
static int
grub_print_message_indented_real (const char *msg, int margin_left,
int margin_right,
struct grub_term_output *term, int dry_run)
{
grub_uint32_t *unicode_msg;
grub_uint32_t *last_position;
int msg_len;
int ret = 0;
msg_len = grub_utf8_to_ucs4_alloc (msg, &unicode_msg, &last_position);
if (msg_len < 0)
{
return;
return 0;
}
grub_print_ucs4 (unicode_msg, last_position, margin_left, margin_right, term);
if (dry_run)
ret = grub_ucs4_count_lines (unicode_msg, last_position, margin_left,
margin_right, term);
else
grub_print_ucs4 (unicode_msg, last_position, margin_left,
margin_right, term);
grub_free (unicode_msg);
return ret;
}
void
grub_print_message_indented (const char *msg, int margin_left, int margin_right,
struct grub_term_output *term)
{
grub_print_message_indented_real (msg, margin_left, margin_right, term, 0);
}
static void
draw_border (struct grub_term_output *term)
draw_border (struct grub_term_output *term, int num_entries)
{
unsigned i;
@ -88,7 +112,7 @@ draw_border (struct grub_term_output *term)
grub_putcode (GRUB_UNICODE_HLINE, term);
grub_putcode (GRUB_UNICODE_CORNER_UR, term);
for (i = 0; i < (unsigned) grub_term_num_entries (term); i++)
for (i = 0; i < (unsigned) num_entries; i++)
{
grub_term_gotoxy (term, GRUB_TERM_MARGIN, GRUB_TERM_TOP_BORDER_Y + i + 1);
grub_putcode (GRUB_UNICODE_VLINE, term);
@ -99,7 +123,7 @@ draw_border (struct grub_term_output *term)
}
grub_term_gotoxy (term, GRUB_TERM_MARGIN,
GRUB_TERM_TOP_BORDER_Y + grub_term_num_entries (term) + 1);
GRUB_TERM_TOP_BORDER_Y + num_entries + 1);
grub_putcode (GRUB_UNICODE_CORNER_LL, term);
for (i = 0; i < (unsigned) grub_term_border_width (term) - 2; i++)
grub_putcode (GRUB_UNICODE_HLINE, term);
@ -108,22 +132,27 @@ draw_border (struct grub_term_output *term)
grub_term_setcolorstate (term, GRUB_TERM_COLOR_NORMAL);
grub_term_gotoxy (term, GRUB_TERM_MARGIN,
(GRUB_TERM_TOP_BORDER_Y + grub_term_num_entries (term)
(GRUB_TERM_TOP_BORDER_Y + num_entries
+ GRUB_TERM_MARGIN + 1));
}
static void
print_message (int nested, int edit, struct grub_term_output *term)
static int
print_message (int nested, int edit, struct grub_term_output *term, int dry_run)
{
int ret = 0;
grub_term_setcolorstate (term, GRUB_TERM_COLOR_NORMAL);
if (edit)
{
grub_putcode ('\n', term);
grub_print_message_indented (_("Minimum Emacs-like screen editing is \
if(dry_run)
ret++;
else
grub_putcode ('\n', term);
ret += grub_print_message_indented_real (_("Minimum Emacs-like screen editing is \
supported. TAB lists completions. Press Ctrl-x or F10 to boot, Ctrl-c or F2 for a \
command-line or ESC to discard edits and return to the GRUB menu."),
STANDARD_MARGIN, STANDARD_MARGIN, term);
STANDARD_MARGIN, STANDARD_MARGIN,
term, dry_run);
}
else
{
@ -134,30 +163,34 @@ command-line or ESC to discard edits and return to the GRUB menu."),
msg_translated = grub_xasprintf (msg, GRUB_UNICODE_UPARROW,
GRUB_UNICODE_DOWNARROW);
if (!msg_translated)
return;
grub_putcode ('\n', term);
grub_print_message_indented (msg_translated, STANDARD_MARGIN,
STANDARD_MARGIN, term);
return 0;
if(dry_run)
ret++;
else
grub_putcode ('\n', term);
ret += grub_print_message_indented_real (msg_translated, STANDARD_MARGIN,
STANDARD_MARGIN, term, dry_run);
grub_free (msg_translated);
if (nested)
{
grub_print_message_indented
ret += grub_print_message_indented_real
(_("Press enter to boot the selected OS, "
"\'e\' to edit the commands before booting "
"or \'c\' for a command-line. ESC to return previous menu.\n"),
STANDARD_MARGIN, STANDARD_MARGIN, term);
STANDARD_MARGIN, STANDARD_MARGIN, term, dry_run);
}
else
{
grub_print_message_indented
ret += grub_print_message_indented_real
(_("Press enter to boot the selected OS, "
"\'e\' to edit the commands before booting "
"or \'c\' for a command-line.\n"),
STANDARD_MARGIN, STANDARD_MARGIN, term);
STANDARD_MARGIN, STANDARD_MARGIN, term, dry_run);
}
}
return ret;
}
static void
@ -256,52 +289,56 @@ print_entry (int y, int highlight, grub_menu_entry_t entry,
}
static void
print_entries (grub_menu_t menu, int first, int offset,
struct grub_term_output *term)
print_entries (grub_menu_t menu, const struct menu_viewer_data *data)
{
grub_menu_entry_t e;
int i;
grub_term_gotoxy (term,
GRUB_TERM_LEFT_BORDER_X + grub_term_border_width (term),
grub_term_gotoxy (data->term,
GRUB_TERM_LEFT_BORDER_X + grub_term_border_width (data->term),
GRUB_TERM_FIRST_ENTRY_Y);
if (first)
grub_putcode (GRUB_UNICODE_UPARROW, term);
if (data->first)
grub_putcode (GRUB_UNICODE_UPARROW, data->term);
else
grub_putcode (' ', term);
grub_putcode (' ', data->term);
e = grub_menu_get_entry (menu, first);
e = grub_menu_get_entry (menu, data->first);
for (i = 0; i < grub_term_num_entries (term); i++)
for (i = 0; i < data->num_entries; i++)
{
print_entry (GRUB_TERM_FIRST_ENTRY_Y + i, offset == i, e, term);
print_entry (GRUB_TERM_FIRST_ENTRY_Y + i, data->offset == i,
e, data->term);
if (e)
e = e->next;
}
grub_term_gotoxy (term, GRUB_TERM_LEFT_BORDER_X
+ grub_term_border_width (term),
GRUB_TERM_TOP_BORDER_Y + grub_term_num_entries (term));
grub_term_gotoxy (data->term, GRUB_TERM_LEFT_BORDER_X
+ grub_term_border_width (data->term),
GRUB_TERM_TOP_BORDER_Y + data->num_entries);
if (e)
grub_putcode (GRUB_UNICODE_DOWNARROW, term);
grub_putcode (GRUB_UNICODE_DOWNARROW, data->term);
else
grub_putcode (' ', term);
grub_putcode (' ', data->term);
grub_term_gotoxy (term, grub_term_cursor_x (term),
GRUB_TERM_FIRST_ENTRY_Y + offset);
grub_term_gotoxy (data->term, grub_term_cursor_x (data->term),
GRUB_TERM_FIRST_ENTRY_Y + data->offset);
}
/* Initialize the screen. If NESTED is non-zero, assume that this menu
is run from another menu or a command-line. If EDIT is non-zero, show
a message for the menu entry editor. */
void
grub_menu_init_page (int nested, int edit,
grub_menu_init_page (int nested, int edit, int *num_entries,
struct grub_term_output *term)
{
grub_uint8_t old_color_normal, old_color_highlight;
/* 3 lines for timeout message and bottom margin. 2 lines for the border. */
*num_entries = grub_term_height (term) - GRUB_TERM_TOP_BORDER_Y
- (print_message (nested, edit, term, 1) + 3) - 2;
grub_term_getcolor (term, &old_color_normal, &old_color_highlight);
/* By default, use the same colors for the menu. */
@ -316,9 +353,9 @@ grub_menu_init_page (int nested, int edit,
grub_normal_init_page (term);
grub_term_setcolor (term, grub_color_menu_normal, grub_color_menu_highlight);
draw_border (term);
draw_border (term, *num_entries);
grub_term_setcolor (term, old_color_normal, old_color_highlight);
print_message (nested, edit, term);
print_message (nested, edit, term, 0);
}
static void
@ -359,10 +396,10 @@ menu_text_set_chosen_entry (int entry, void *dataptr)
int complete_redraw = 0;
data->offset = entry - data->first;
if (data->offset > grub_term_num_entries (data->term) - 1)
if (data->offset > data->num_entries - 1)
{
data->first = entry - (grub_term_num_entries (data->term) - 1);
data->offset = grub_term_num_entries (data->term) - 1;
data->first = entry - (data->num_entries - 1);
data->offset = data->num_entries - 1;
complete_redraw = 1;
}
if (data->offset < 0)
@ -372,7 +409,7 @@ menu_text_set_chosen_entry (int entry, void *dataptr)
complete_redraw = 1;
}
if (complete_redraw)
print_entries (data->menu, data->first, data->offset, data->term);
print_entries (data->menu, data);
else
{
print_entry (GRUB_TERM_FIRST_ENTRY_Y + oldoffset, 0,
@ -436,15 +473,17 @@ grub_menu_try_text (struct grub_term_output *term,
data->offset = entry;
data->first = 0;
if (data->offset > grub_term_num_entries (data->term) - 1)
{
data->first = data->offset - (grub_term_num_entries (data->term) - 1);
data->offset = grub_term_num_entries (data->term) - 1;
}
grub_term_setcursor (data->term, 0);
grub_menu_init_page (nested, 0, data->term);
print_entries (menu, data->first, data->offset, data->term);
grub_menu_init_page (nested, 0, &data->num_entries, data->term);
if (data->offset > data->num_entries - 1)
{
data->first = data->offset - (data->num_entries - 1);
data->offset = data->num_entries - 1;
}
print_entries (menu, data);
grub_term_refresh (data->term);
grub_menu_register_viewer (instance);

View file

@ -112,14 +112,13 @@ grub_normal_print_device_info (const char *name)
grub_printf ("%s", _("Not a known filesystem"));
if (dev->disk->partition)
grub_printf (_(" - Partition start at %u"),
grub_partition_get_start (dev->disk->partition));
grub_printf (_(" - Partition start at %llu"),
(unsigned long long) grub_partition_get_start (dev->disk->partition));
if (grub_disk_get_size (dev->disk) == GRUB_DISK_SIZE_UNKNOWN)
grub_printf (_(" - Total size unknown"),
grub_disk_get_size (dev->disk));
grub_puts_ (" - Total size unknown");
else
grub_printf (_(" - Total size %u sectors"),
grub_disk_get_size (dev->disk));
grub_printf (_(" - Total size %llu sectors"),
(unsigned long long) grub_disk_get_size (dev->disk));
grub_device_close (dev);
}

View file

@ -515,14 +515,16 @@ print_ucs4_terminal (const grub_uint32_t * str,
const grub_uint32_t * last_position,
int margin_left, int margin_right,
struct grub_term_output *term,
struct term_state *state)
struct term_state *state,
int dry_run)
{
const grub_uint32_t *ptr;
grub_ssize_t startwidth = get_startwidth (term, margin_left);
grub_ssize_t startwidth = dry_run ? 0 : get_startwidth (term, margin_left);
grub_ssize_t line_width = startwidth;
grub_ssize_t lastspacewidth = 0;
grub_ssize_t max_width = get_maxwidth (term, margin_left, margin_right);
const grub_uint32_t *line_start = str, *last_space = str - 1;
int lines = 0;
for (ptr = str; ptr < last_position; ptr++)
{
@ -552,7 +554,7 @@ print_ucs4_terminal (const grub_uint32_t * str,
if (line_width > max_width && last_space > line_start)
ptr = last_space;
else if (line_width > max_width
&& line_start == str && startwidth != 0)
&& line_start == str && line_width - lastspacewidth < max_width - 5)
{
ptr = str;
lastspacewidth = startwidth;
@ -560,50 +562,59 @@ print_ucs4_terminal (const grub_uint32_t * str,
else
lastspacewidth = line_width - last_width;
for (ptr2 = line_start; ptr2 < ptr; ptr2++)
{
/* Skip combining characters on non-UTF8 terminals. */
if ((term->flags & GRUB_TERM_CODE_TYPE_MASK)
!= GRUB_TERM_CODE_TYPE_UTF8_LOGICAL
&& grub_unicode_get_comb_type (*ptr2)
!= GRUB_UNICODE_COMB_NONE)
continue;
putcode_real (*ptr2, term);
}
lines++;
grub_print_spaces (term, margin_right);
grub_putcode ('\n', term);
if (state && ++state->num_lines
>= (grub_ssize_t) grub_term_height (term) - 2)
if (!dry_run)
{
state->backlog_ucs4 = (ptr == last_space || *ptr == '\n')
? ptr + 1 : ptr;
state->backlog_len = last_position - state->backlog_ucs4;
return 1;
for (ptr2 = line_start; ptr2 < ptr; ptr2++)
{
/* Skip combining characters on non-UTF8 terminals. */
if ((term->flags & GRUB_TERM_CODE_TYPE_MASK)
!= GRUB_TERM_CODE_TYPE_UTF8_LOGICAL
&& grub_unicode_get_comb_type (*ptr2)
!= GRUB_UNICODE_COMB_NONE)
continue;
putcode_real (*ptr2, term);
}
grub_print_spaces (term, margin_right);
grub_putcode ('\n', term);
if (state && ++state->num_lines
>= (grub_ssize_t) grub_term_height (term) - 2)
{
state->backlog_ucs4 = (ptr == last_space || *ptr == '\n')
? ptr + 1 : ptr;
state->backlog_len = last_position - state->backlog_ucs4;
return 1;
}
}
line_width -= lastspacewidth;
grub_print_spaces (term, margin_left);
if (!dry_run)
grub_print_spaces (term, margin_left);
if (ptr == last_space || *ptr == '\n')
ptr++;
line_start = ptr;
}
}
{
const grub_uint32_t *ptr2;
for (ptr2 = line_start; ptr2 < last_position; ptr2++)
{
/* Skip combining characters on non-UTF8 terminals. */
if ((term->flags & GRUB_TERM_CODE_TYPE_MASK)
!= GRUB_TERM_CODE_TYPE_UTF8_LOGICAL
&& grub_unicode_get_comb_type (*ptr2)
!= GRUB_UNICODE_COMB_NONE)
continue;
putcode_real (*ptr2, term);
}
}
return 0;
if (line_start < last_position)
lines++;
if (!dry_run)
{
const grub_uint32_t *ptr2;
for (ptr2 = line_start; ptr2 < last_position; ptr2++)
{
/* Skip combining characters on non-UTF8 terminals. */
if ((term->flags & GRUB_TERM_CODE_TYPE_MASK)
!= GRUB_TERM_CODE_TYPE_UTF8_LOGICAL
&& grub_unicode_get_comb_type (*ptr2)
!= GRUB_UNICODE_COMB_NONE)
continue;
putcode_real (*ptr2, term);
}
}
return dry_run ? lines : 0;
}
static struct term_state *
@ -672,7 +683,7 @@ print_backlog (struct grub_term_output *term,
int ret;
ret = print_ucs4_terminal (state->backlog_ucs4,
state->backlog_ucs4 + state->backlog_len,
margin_left, margin_right, term, state);
margin_left, margin_right, term, state, 0);
if (!ret)
{
grub_free (state->free);
@ -706,15 +717,19 @@ static int
print_ucs4_real (const grub_uint32_t * str,
const grub_uint32_t * last_position,
int margin_left, int margin_right,
struct grub_term_output *term, int backlog)
struct grub_term_output *term, int backlog,
int dry_run)
{
struct term_state *state = NULL;
if (backlog)
state = find_term_state (term);
if (!dry_run)
{
if (backlog)
state = find_term_state (term);
if (((term->getxy (term) >> 8) & 0xff) < margin_left)
grub_print_spaces (term, margin_left - ((term->getxy (term) >> 8) & 0xff));
if (((term->getxy (term) >> 8) & 0xff) < margin_left)
grub_print_spaces (term, margin_left - ((term->getxy (term) >> 8) & 0xff));
}
if ((term->flags & GRUB_TERM_CODE_TYPE_MASK)
== GRUB_TERM_CODE_TYPE_VISUAL_GLYPHS
@ -743,16 +758,30 @@ print_ucs4_real (const grub_uint32_t * str,
grub_print_error ();
return 0;
}
ret = put_glyphs_terminal (visual, visual_len, margin_left, margin_right,
term, state);
if (!ret)
grub_free (visual);
if (dry_run)
{
struct grub_unicode_glyph *vptr;
ret = 0;
for (vptr = visual; vptr < visual + visual_len; vptr++)
if (vptr->base == '\n')
ret++;
if (visual_len && visual[visual_len - 1].base != '\n')
ret++;
grub_free (visual);
}
else
state->free = visual;
{
ret = put_glyphs_terminal (visual, visual_len, margin_left,
margin_right, term, state);
if (!ret)
grub_free (visual);
else
state->free = visual;
}
return ret;
}
return print_ucs4_terminal (str, last_position, margin_left, margin_right,
term, state);
term, state, dry_run);
}
void
@ -762,9 +791,18 @@ grub_print_ucs4 (const grub_uint32_t * str,
struct grub_term_output *term)
{
print_ucs4_real (str, last_position, margin_left, margin_right,
term, 0);
term, 0, 0);
}
int
grub_ucs4_count_lines (const grub_uint32_t * str,
const grub_uint32_t * last_position,
int margin_left, int margin_right,
struct grub_term_output *term)
{
return print_ucs4_real (str, last_position, margin_left, margin_right,
term, 0, 1);
}
void
grub_xputs_normal (const char *str)
@ -813,7 +851,7 @@ grub_xputs_normal (const char *str)
{
int cur;
cur = print_ucs4_real (unicode_str, unicode_last_position, 0, 0,
term, grub_more);
term, grub_more, 0);
if (cur)
backlog = 1;
}

View file

@ -126,7 +126,7 @@ int
grub_script_lexer_yywrap (struct grub_parser_param *parserstate,
const char *input)
{
int len;
int len = 0;
char *p = 0;
char *line = 0;
YY_BUFFER_STATE buffer;

View file

@ -147,6 +147,7 @@ argument : "case" { $$ = grub_script_add_arglist (state, 0, $1); }
| "until" { $$ = grub_script_add_arglist (state, 0, $1); }
| "while" { $$ = grub_script_add_arglist (state, 0, $1); }
| "function" { $$ = grub_script_add_arglist (state, 0, $1); }
| "time" { $$ = grub_script_add_arglist (state, 0, $1); }
| word { $$ = $1; }
;

View file

@ -330,6 +330,11 @@ set_scancodes (void)
return;
}
#if !(defined (GRUB_MACHINE_MIPS_YEELOONG) || defined (GRUB_MACHINE_QEMU))
current_set = 1;
return;
#endif
grub_keyboard_controller_write (grub_keyboard_controller_orig
& ~KEYBOARD_AT_TRANSLATE);

View file

@ -532,21 +532,8 @@ dirty_region_is_empty (void)
}
static void
dirty_region_add (int x, int y, unsigned int width, unsigned int height)
dirty_region_add_real (int x, int y, unsigned int width, unsigned int height)
{
if ((width == 0) || (height == 0))
return;
if (repaint_scheduled)
{
x = virtual_screen.offset_x;
y = virtual_screen.offset_y;
width = virtual_screen.width;
height = virtual_screen.height;
repaint_scheduled = 0;
repaint_was_scheduled = 1;
}
if (dirty_region_is_empty ())
{
dirty_region.top_left_x = x;
@ -567,6 +554,22 @@ dirty_region_add (int x, int y, unsigned int width, unsigned int height)
}
}
static void
dirty_region_add (int x, int y, unsigned int width, unsigned int height)
{
if ((width == 0) || (height == 0))
return;
if (repaint_scheduled)
{
dirty_region_add_real (virtual_screen.offset_x, virtual_screen.offset_y,
virtual_screen.width, virtual_screen.height);
repaint_scheduled = 0;
repaint_was_scheduled = 1;
}
dirty_region_add_real (x, y, width, height);
}
static void
dirty_region_add_virtualscreen (void)
{
@ -945,6 +948,8 @@ calculate_normal_character_width (grub_font_t font)
if (glyph->device_width > width)
width = glyph->device_width;
}
if (!width)
return 8;
return width;
}

View file

@ -41,7 +41,7 @@ static const struct grub_arg_option options[] =
{0, 0, 0, 0, 0, 0}
};
struct grub_serial_port *grub_serial_ports;
static struct grub_serial_port *grub_serial_ports;
struct grub_serial_output_state
{
@ -69,7 +69,7 @@ serial_fetch (grub_term_input_t term)
return data->port->driver->fetch (data->port);
}
const struct grub_serial_input_state grub_serial_terminfo_input_template =
static const struct grub_serial_input_state grub_serial_terminfo_input_template =
{
.tinfo =
{
@ -77,7 +77,7 @@ const struct grub_serial_input_state grub_serial_terminfo_input_template =
}
};
const struct grub_serial_output_state grub_serial_terminfo_output_template =
static const struct grub_serial_output_state grub_serial_terminfo_output_template =
{
.tinfo =
{
@ -87,11 +87,11 @@ const struct grub_serial_output_state grub_serial_terminfo_output_template =
}
};
struct grub_serial_input_state grub_serial_terminfo_input;
static struct grub_serial_input_state grub_serial_terminfo_input;
struct grub_serial_output_state grub_serial_terminfo_output;
static struct grub_serial_output_state grub_serial_terminfo_output;
int registered = 0;
static int registered = 0;
static struct grub_term_input grub_serial_term_input =
{

View file

@ -435,7 +435,7 @@ grub_usb_keyboard_getkeystatus (struct grub_term_input *term)
return interpret_status (termdata->status) | termdata->mods;
}
struct grub_usb_attach_desc attach_hook =
static struct grub_usb_attach_desc attach_hook =
{
.class = GRUB_USB_CLASS_HID,
.hook = grub_usb_keyboard_attach

View file

@ -177,7 +177,7 @@ match_extension (const char *filename, const char *ext)
pos -= ext_len;
return grub_strcmp (filename + pos, ext) == 0;
return grub_strcasecmp (filename + pos, ext) == 0;
}
/* Loads bitmap using registered bitmap readers. */

View file

@ -199,7 +199,8 @@ grub_video_bochs_set_palette (unsigned int start, unsigned int count,
static grub_err_t
grub_video_bochs_setup (unsigned int width, unsigned int height,
unsigned int mode_type, unsigned int mode_mask)
grub_video_mode_type_t mode_type,
grub_video_mode_type_t mode_mask)
{
int depth;
grub_err_t err;

View file

@ -235,7 +235,8 @@ grub_video_cirrus_set_palette (unsigned int start, unsigned int count,
static grub_err_t
grub_video_cirrus_setup (unsigned int width, unsigned int height,
unsigned int mode_type, unsigned int mode_mask)
grub_video_mode_type_t mode_type,
grub_video_mode_type_t mode_mask)
{
int depth;
grub_err_t err;

View file

@ -1445,13 +1445,16 @@ grub_video_fb_setup (unsigned int mode_type, unsigned int mode_mask,
GRUB_VIDEO_MODE_TYPE_DOUBLE_BUFFERED,
0))
{
/* It was much nicer with the cast directly at function call but
some older gcc versions don't accept it properly.*/
void *tmp = (void *) page0_ptr;
mode_info->mode_type |= (GRUB_VIDEO_MODE_TYPE_DOUBLE_BUFFERED
| GRUB_VIDEO_MODE_TYPE_UPDATING_SWAP);
err = grub_video_fb_doublebuf_blit_init (&framebuffer.front_target,
&framebuffer.back_target,
*mode_info,
(void *) page0_ptr);
tmp);
if (!err)
{
@ -1505,6 +1508,20 @@ grub_video_fb_get_info_and_fini (struct grub_video_mode_info *mode_info,
{
grub_memcpy (mode_info, &(framebuffer.front_target->mode_info),
sizeof (*mode_info));
/* We are about to load a kernel. Switch back to page zero, since some
kernel drivers expect that. */
if ((mode_info->mode_type & GRUB_VIDEO_MODE_TYPE_DOUBLE_BUFFERED)
&& framebuffer.set_page && framebuffer.displayed_page != 0)
{
/* Ensure both pages are exactly in sync. */
grub_memcpy (framebuffer.back_target->data,
framebuffer.front_target->data,
framebuffer.back_target->mode_info.pitch
* framebuffer.back_target->mode_info.height);
grub_video_swap_buffers ();
}
*framebuf = framebuffer.front_target->data;
grub_video_fb_fini ();

View file

@ -688,7 +688,8 @@ grub_video_vbe_iterate (int (*hook) (const struct grub_video_mode_info *info))
static grub_err_t
grub_video_vbe_setup (unsigned int width, unsigned int height,
unsigned int mode_type, unsigned int mode_mask)
grub_video_mode_type_t mode_type,
grub_video_mode_type_t mode_mask)
{
grub_uint16_t *p;
struct grub_vbe_mode_info_block vbe_mode_info;

View file

@ -116,7 +116,8 @@ grub_video_vga_init (void)
static grub_err_t
grub_video_vga_setup (unsigned int width, unsigned int height,
unsigned int mode_type, unsigned int mode_mask)
grub_video_mode_type_t mode_type,
grub_video_mode_type_t mode_mask)
{
grub_err_t err;

View file

@ -21,6 +21,7 @@
#include <grub/efi/api.h>
#include <grub/file.h>
#include <grub/memory.h>
#define GRUB_EFIEMU_PAGESIZE 4096
@ -227,9 +228,7 @@ grub_efiemu_finish_boot_services (grub_efi_uintn_t *memory_map_size,
grub_efi_uint32_t *descriptor_version);
grub_err_t
grub_efiemu_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t,
grub_uint64_t,
grub_uint32_t));
grub_efiemu_mmap_iterate (grub_memory_hook_t hook);
int grub_efiemu_sizeof_uintn_t (void);
grub_err_t
grub_efiemu_get_lower_upper_memory (grub_uint64_t *lower, grub_uint64_t *upper);

View file

@ -31,9 +31,9 @@ struct grub_file;
struct grub_dirhook_info
{
int dir:1;
int mtimeset:1;
int case_insensitive:1;
unsigned dir:1;
unsigned mtimeset:1;
unsigned case_insensitive:1;
grub_int32_t mtime;
};

View file

@ -47,6 +47,9 @@ struct grub_lvm_lv {
unsigned int number;
unsigned int segment_count;
grub_uint64_t size;
int visible;
struct grub_lvm_segment *segments; /* Pointer to segment_count segments. */
struct grub_lvm_vg *vg;
struct grub_lvm_lv *next;
@ -55,14 +58,19 @@ struct grub_lvm_lv {
struct grub_lvm_segment {
unsigned int start_extent;
unsigned int extent_count;
unsigned int stripe_count;
enum { GRUB_LVM_STRIPED, GRUB_LVM_MIRROR } type;
unsigned int node_count;
struct grub_lvm_node *nodes;
unsigned int stripe_size;
struct grub_lvm_stripe *stripes; /* Pointer to stripe_count stripes. */
};
struct grub_lvm_stripe {
int start;
struct grub_lvm_node {
grub_disk_addr_t start;
char *name;
struct grub_lvm_pv *pv;
struct grub_lvm_lv *lv;
};
#define GRUB_LVM_LABEL_SIZE GRUB_DISK_SECTOR_SIZE

View file

@ -36,7 +36,7 @@ void *EXPORT_FUNC(grub_realloc) (void *ptr, grub_size_t size);
void *EXPORT_FUNC(grub_memalign) (grub_size_t align, grub_size_t size);
void grub_mm_check_real (char *file, int line);
#define GRUB_MM_CHECK grub_mm_check_real (__FILE__, __LINE__);
#define grub_mm_check() grub_mm_check_real (GRUB_FILE, __LINE__);
/* For debugging. */
#if defined(MM_DEBUG) && !defined(GRUB_UTIL) && !defined (GRUB_MACHINE_EMU)

View file

@ -51,7 +51,7 @@ extern int grub_normal_exit_level;
/* Defined in `main.c'. */
void grub_enter_normal_mode (const char *config);
void grub_normal_execute (const char *config, int nested, int batch);
void grub_menu_init_page (int nested, int edit,
void grub_menu_init_page (int nested, int edit, int *num_entries,
struct grub_term_output *term);
void grub_normal_init_page (struct grub_term_output *term);
char *grub_file_getline (grub_file_t file);
@ -80,6 +80,11 @@ grub_print_ucs4 (const grub_uint32_t * str,
const grub_uint32_t * last_position,
int margin_left, int margin_right,
struct grub_term_output *term);
int
grub_ucs4_count_lines (const grub_uint32_t * str,
const grub_uint32_t * last_position,
int margin_left, int margin_right,
struct grub_term_output *term);
grub_ssize_t grub_getstringwidth (grub_uint32_t * str,
const grub_uint32_t * last_position,
struct grub_term_output *term);

View file

@ -38,9 +38,9 @@
#define GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY 0x1c
/* The size of the first region which won't be compressed. */
#define GRUB_KERNEL_I386_PC_RAW_SIZE 0xca4
#define GRUB_KERNEL_I386_PC_RAW_SIZE 0xcd0
#define GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART 0x70c
#define GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART 0x730
/* The offset of GRUB_PREFIX. */
#define GRUB_KERNEL_I386_PC_PREFIX GRUB_KERNEL_I386_PC_RAW_SIZE

View file

@ -140,9 +140,6 @@ grub_term_color_state;
/* The X position of the left border. */
#define GRUB_TERM_LEFT_BORDER_X GRUB_TERM_MARGIN
/* The number of lines of messages at the bottom. */
#define GRUB_TERM_MESSAGE_HEIGHT 8
/* The Y position of the first entry. */
#define GRUB_TERM_FIRST_ENTRY_Y (GRUB_TERM_TOP_BORDER_Y + 1)
@ -339,29 +336,6 @@ grub_term_entry_width (struct grub_term_output *term)
return grub_term_border_width (term) - 2 - GRUB_TERM_MARGIN * 2 - 1;
}
/* The height of the border. */
static inline unsigned
grub_term_border_height (struct grub_term_output *term)
{
return grub_term_height (term) - GRUB_TERM_TOP_BORDER_Y
- GRUB_TERM_MESSAGE_HEIGHT;
}
/* The number of entries shown at a time. */
static inline int
grub_term_num_entries (struct grub_term_output *term)
{
return grub_term_border_height (term) - 2;
}
static inline int
grub_term_cursor_x (struct grub_term_output *term)
{
return (GRUB_TERM_LEFT_BORDER_X + grub_term_border_width (term)
- GRUB_TERM_MARGIN - 1);
}
static inline grub_uint16_t
grub_term_getxy (struct grub_term_output *term)
{

View file

@ -21,7 +21,7 @@
#define GRUB_RAID_UTIL_HEADER 1
#ifdef __linux__
char** grub_util_raid_getmembers (char *name);
char** grub_util_raid_getmembers (const char *name);
#endif
#endif /* ! GRUB_RAID_UTIL_HEADER */

View file

@ -111,7 +111,8 @@ read_file (char *pathname, int (*hook) (grub_off_t ofs, char *buf, int len))
file = grub_file_open (pathname);
if (!file)
{
grub_util_error (_("cannot open file %s"), pathname);
grub_util_error (_("cannot open file %s:%s"), pathname,
grub_errmsg);
return;
}
@ -221,6 +222,14 @@ cmd_cmp (char *src, char *dest)
grub_util_error (_("seek error"));
read_file (src, cmp_hook);
{
grub_uint64_t pre;
pre = ftell (ff);
fseek (ff, 0, SEEK_END);
if (pre != ftell (ff))
grub_util_error (_("unexpected end of file"));
}
fclose (ff);
}

View file

@ -367,7 +367,7 @@ if [ x"$platform" = xefi ]; then
case "$target_cpu" in
i386)
efi_file=BOOTIA32.EFI ;;
x86-64)
x86_64)
efi_file=BOOTX64.EFI ;;
# GRUB does not yet support these architectures, but they're defined
# by the specification so we include them here to ease future
@ -381,7 +381,7 @@ if [ x"$platform" = xefi ]; then
case "$target_cpu" in
i386)
efi_file=grubia32.efi ;;
x86-64)
x86_64)
efi_file=grubx64.efi ;;
# GRUB does not yet support these architectures, but they're defined
# by the specification so we include them here to ease future
@ -467,7 +467,8 @@ fi
fs_module="`"$grub_probe" --device-map="${device_map}" --target=fs --device "${grub_device}"`"
if test "x$fs_module" = x ; then
echo "Auto-detection of a filesystem of ${grub_device} failed." 1>&2
echo "Please report this together with the output of \"$grub_probe --device-map=\"${device_map}\" --target=fs -v ${grubdir}\" to <bug-grub@gnu.org>" 1>&2
echo "Try with --recheck." 1>&2
echo "If the problem persists please report this together with the output of \"$grub_probe --device-map=\"${device_map}\" --target=fs -v ${grubdir}\" to <bug-grub@gnu.org>" 1>&2
exit 1
fi
@ -620,6 +621,10 @@ elif [ "${target_cpu}-${platform}" = "i386-ieee1275" ] || [ "${target_cpu}-${pla
fi
elif [ x"$platform" = xefi ]; then
cp "${grubdir}/core.${imgext}" "${efidir}/${efi_file}"
# For old macs. Suggested by Peter Jones.
if [ x$target_cpu = xi386 ]; then
cp "${grubdir}/core.${imgext}" "${efidir}/boot.efi"
fi
# Try to make this image bootable using the EFI Boot Manager, if available.
efibootmgr="`which efibootmgr`"

View file

@ -280,6 +280,8 @@ for i in ${grub_mkconfig_dir}/* ; do
case "$i" in
# emacsen backup files. FIXME: support other editors
*~) ;;
# emacsen autosave files. FIXME: support other editors
\#*\#) ;;
*)
if grub_file_is_not_garbage "$i" && test -x "$i" ; then
echo

View file

@ -16,19 +16,19 @@
transform="@program_transform_name@"
prefix=@prefix@
exec_prefix=@exec_prefix@
datarootdir=@datarootdir@
datadir=@datadir@
bindir=@bindir@
sbindir=@sbindir@
pkgdatadir=${datadir}/`echo @PACKAGE_TARNAME@ | sed "${transform}"`
prefix="@prefix@"
exec_prefix="@exec_prefix@"
datarootdir="@datarootdir@"
datadir="@datadir@"
bindir="@bindir@"
sbindir="@sbindir@"
pkgdatadir="${datadir}/`echo "@PACKAGE_TARNAME@" | sed "${transform}"`"
if test "x$grub_probe" = x; then
grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
grub_probe="${sbindir}/`echo grub-probe | sed "${transform}"`"
fi
if test "x$grub_mkrelpath" = x; then
grub_mkrelpath=${bindir}/`echo grub-mkrelpath | sed ${transform}`
grub_mkrelpath="${bindir}/`echo grub-mkrelpath | sed "${transform}"`"
fi
if $(which gettext >/dev/null 2>/dev/null) ; then
@ -44,20 +44,20 @@ grub_warn ()
make_system_path_relative_to_its_root ()
{
${grub_mkrelpath} $1
"${grub_mkrelpath}" "$1"
}
is_path_readable_by_grub ()
{
path=$1
path="$1"
# abort if path doesn't exist
if test -e $path ; then : ;else
if test -e "$path" ; then : ;else
return 1
fi
# abort if file is in a filesystem we can't read
if ${grub_probe} -t fs $path > /dev/null 2>&1 ; then : ; else
if "${grub_probe}" -t fs "$path" > /dev/null 2>&1 ; then : ; else
return 1
fi
@ -72,24 +72,24 @@ is_path_readable_by_grub ()
convert_system_path_to_grub_path ()
{
path=$1
path="$1"
grub_warn "convert_system_path_to_grub_path() is deprecated. Use prepare_grub_to_access_device() instead."
# abort if GRUB can't access the path
if is_path_readable_by_grub ${path} ; then : ; else
if is_path_readable_by_grub "${path}" ; then : ; else
return 1
fi
if drive=`${grub_probe} -t drive $path` ; then : ; else
if drive="`"${grub_probe}" -t drive "$path"`" ; then : ; else
return 1
fi
if relative_path=`make_system_path_relative_to_its_root $path` ; then : ; else
if relative_path="`make_system_path_relative_to_its_root "$path"`" ; then : ; else
return 1
fi
echo ${drive}${relative_path}
echo "${drive}${relative_path}"
}
save_default_entry ()
@ -103,15 +103,15 @@ EOF
prepare_grub_to_access_device ()
{
device=$1
device="$1"
# Abstraction modules aren't auto-loaded.
abstraction="`${grub_probe} --device ${device} --target=abstraction`"
abstraction="`"${grub_probe}" --device "${device}" --target=abstraction`"
for module in ${abstraction} ; do
echo "insmod ${module}"
done
partmap="`${grub_probe} --device ${device} --target=partmap`"
partmap="`"${grub_probe}" --device "${device}" --target=partmap`"
for module in ${partmap} ; do
case "${module}" in
netbsd | openbsd)
@ -121,15 +121,15 @@ prepare_grub_to_access_device ()
esac
done
fs="`${grub_probe} --device ${device} --target=fs`"
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`'"
if fs_uuid="`${grub_probe} --device ${device} --target=fs_uuid 2> /dev/null`" ; then
echo "set root='`"${grub_probe}" --device "${device}" --target=drive`'"
if fs_uuid="`"${grub_probe}" --device "${device}" --target=fs_uuid 2> /dev/null`" ; then
echo "search --no-floppy --fs-uuid --set=root ${fs_uuid}"
fi
}
@ -149,21 +149,21 @@ grub_file_is_not_garbage ()
version_test_numeric ()
{
local a=$1
local cmp=$2
local b=$3
local a="$1"
local cmp="$2"
local b="$3"
if [ "$a" = "$b" ] ; then
case $cmp in
case "$cmp" in
ge|eq|le) return 0 ;;
gt|lt) return 1 ;;
esac
fi
if [ "$cmp" = "lt" ] ; then
c=$a
a=$b
b=$c
c="$a"
a="$b"
b="$c"
fi
if (echo $a ; echo $b) | sort -n | head -n 1 | grep -qx $b ; then
if (echo "$a" ; echo "$b") | sort -n | head -n 1 | grep -qx "$b" ; then
return 0
else
return 1
@ -172,25 +172,25 @@ version_test_numeric ()
version_test_gt ()
{
local a=`echo $1 | sed -e "s/[^-]*-//"`
local b=`echo $2 | sed -e "s/[^-]*-//"`
local a="`echo "$1" | sed -e "s/[^-]*-//"`"
local b="`echo "$2" | sed -e "s/[^-]*-//"`"
local cmp=gt
if [ "x$b" = "x" ] ; then
return 0
fi
case $a:$b in
case "$a:$b" in
*.old:*.old) ;;
*.old:*) a=`echo -n $a | sed -e s/\.old$//` ; cmp=gt ;;
*:*.old) b=`echo -n $b | sed -e s/\.old$//` ; cmp=ge ;;
*.old:*) a="`echo -n "$a" | sed -e 's/\.old$//'`" ; cmp=gt ;;
*:*.old) b="`echo -n "$b" | sed -e 's/\.old$//'`" ; cmp=ge ;;
esac
version_test_numeric $a $cmp $b
return $?
version_test_numeric "$a" "$cmp" "$b"
return "$?"
}
version_find_latest ()
{
local a=""
for i in $@ ; do
for i in "$@" ; do
if version_test_gt "$i" "$a" ; then
a="$i"
fi
@ -202,7 +202,7 @@ version_find_latest ()
# printf; so this turns ' into \'. Note that you must use the output of
# this function in a printf format string.
gettext_quoted () {
$gettext "$@" | sed "s/'/'\\\\\\\\''/g"
"$gettext" "$@" | sed "s/'/'\\\\\\\\''/g"
}
# Run the first argument through gettext_quoted, and then pass that and all
@ -215,9 +215,9 @@ gettext_printf () {
}
uses_abstraction () {
device=$1
device="$1"
abstraction="`${grub_probe} --device ${device} --target=abstraction`"
abstraction="`"${grub_probe}" --device "${device}" --target=abstraction`"
for module in ${abstraction}; do
if test "x${module}" = "x$2"; then
return 0

View file

@ -1588,9 +1588,19 @@ main (int argc, char *argv[])
+ 1);
memcpy (dir, GRUB_PKGLIBROOTDIR, sizeof (GRUB_PKGLIBROOTDIR) - 1);
*(dir + sizeof (GRUB_PKGLIBROOTDIR) - 1) = '/';
memcpy (dir + sizeof (GRUB_PKGLIBROOTDIR), image_target->name,
last - image_target->name);
*(dir + sizeof (GRUB_PKGLIBROOTDIR) + (last - image_target->name)) = 0;
if (strncmp (image_target->name, "mipsel-yeeloong",
last - image_target->name) == 0)
{
memcpy (dir + sizeof (GRUB_PKGLIBROOTDIR), "mips-yeeloong",
sizeof ("mips-yeeloong"));
}
else
{
memcpy (dir + sizeof (GRUB_PKGLIBROOTDIR), image_target->name,
last - image_target->name);
*(dir + sizeof (GRUB_PKGLIBROOTDIR) + (last - image_target->name))
= 0;
}
}
generate_image (dir, prefix ? : DEFAULT_DIRECTORY, fp,

View file

@ -286,6 +286,10 @@ if test -e "${efi64_dir}" || test -e "${efi32_dir}"; then
make_image "${efi64_dir}" x86_64-efi "${efi_dir}"/efi/boot/bootx64.efi ""
# build bootia32.efi
make_image "${efi32_dir}" i386-efi "${efi_dir}"/efi/boot/bootia32.efi ""
if [ -e "${efi_dir}"/efi/boot/bootia32.efi ]; then
# For old macs. Suggested by Peter Jones.
cp "${efi_dir}"/efi/boot/bootia32.efi "${efi_dir}"/efi/boot/boot.efi
fi
mformat -C -f 2880 -L 16 -i "${iso9660_dir}"/efi.img ::
mcopy -s -i "${iso9660_dir}"/efi.img ${efi_dir}/efi ::/

View file

@ -399,6 +399,15 @@ setup (const char *dir,
}
#endif
/* Copy the partition table. */
if (dest_partmap ||
(!allow_floppy && !grub_util_biosdisk_is_floppy (dest_dev->disk)))
memcpy (boot_img + GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC,
tmp_img + GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC,
GRUB_BOOT_MACHINE_PART_END - GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC);
free (tmp_img);
if (! dest_partmap)
{
grub_util_warn (_("Attempting to install GRUB to a partitionless disk or to a partition. This is a BAD idea."));
@ -410,14 +419,6 @@ setup (const char *dir,
goto unable_to_embed;
}
/* Copy the partition table. */
if (dest_partmap)
memcpy (boot_img + GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC,
tmp_img + GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC,
GRUB_BOOT_MACHINE_PART_END - GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC);
free (tmp_img);
if (!dest_partmap->embed)
{
grub_util_warn ("Partition style '%s' doesn't support embeding",
@ -972,7 +973,15 @@ main (int argc, char *argv[])
char **devicelist;
int i;
devicelist = grub_util_raid_getmembers (dest_dev);
if (arguments.device[0] == '/')
devicelist = grub_util_raid_getmembers (arguments.device);
else
{
char *devname;
devname = xasprintf ("/dev/%s", dest_dev);
devicelist = grub_util_raid_getmembers (dest_dev);
free (devname);
}
for (i = 0; devicelist[i]; i++)
{

View file

@ -132,6 +132,19 @@ if loadfont `make_system_path_relative_to_its_root "${GRUB_FONT_PATH}"` ; then
set gfxmode=${GRUB_GFXMODE}
load_video
insmod gfxterm
EOF
# Gettext variables and module
if [ "x${LANG}" != "xC" ] && [ -d "${locale_dir}" ] ; then
prepare_grub_to_access_device $(${grub_probe} --target=device ${locale_dir}) | sed -e "s/^/ /"
cat << EOF
set locale_dir=(\$root)$(make_system_path_relative_to_its_root ${locale_dir})
set lang=${grub_lang}
insmod gettext
EOF
fi
cat <<EOF
fi
EOF
fi
@ -210,16 +223,6 @@ EOF
fi
fi
# Gettext variables and module
if [ "x${LANG}" != "xC" ] && [ -d "${locale_dir}" ] ; then
prepare_grub_to_access_device $(${grub_probe} --target=device ${locale_dir})
cat << EOF
set locale_dir=(\$root)$(make_system_path_relative_to_its_root ${locale_dir})
set lang=${grub_lang}
insmod gettext
EOF
fi
make_timeout ()
{
if [ "x${1}" != "x" ] ; then

View file

@ -110,7 +110,11 @@ EOF
;;
esac
load_kfreebsd_module ${kfreebsd_fs} false
if [ x${kfreebsd_fs} = xufs ]; then
load_kfreebsd_module ${kfreebsd_fs} true
else
load_kfreebsd_module ${kfreebsd_fs} false
fi
cat << EOF
set kFreeBSD.vfs.root.mountfrom=${kfreebsd_fs}:${kfreebsd_device}

View file

@ -73,8 +73,8 @@ linux_entry ()
cat << EOF
load_video
EOF
if grep -qx "CONFIG_FB_EFI=y" /boot/config-${version} 2> /dev/null \
&& grep -qx "CONFIG_VT_HW_CONSOLE_BINDING=y" /boot/config-${version} 2> /dev/null; then
if grep -qx "CONFIG_FB_EFI=y" "${config}" 2> /dev/null \
&& grep -qx "CONFIG_VT_HW_CONSOLE_BINDING=y" "${config}" 2> /dev/null; then
cat << EOF
set gfxpayload=keep
EOF
@ -111,9 +111,17 @@ EOF
EOF
}
list=`for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* ; do
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
done`
case x`uname -m` in
xi?86 | xx86_64)
list=`for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
done` ;;
*)
list=`for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
done` ;;
esac
prepare_boot_cache=
while [ "x$list" != "x" ] ; do
@ -130,21 +138,28 @@ while [ "x$list" != "x" ] ; do
for i in "initrd.img-${version}" "initrd-${version}.img" \
"initrd-${version}" "initramfs-${version}.img" \
"initrd.img-${alt_version}" "initrd-${alt_version}.img" \
"initrd-${alt_version}" "initramfs-${alt_version}.img"; do
"initrd-${alt_version}" "initramfs-${alt_version}.img" \
"initramfs-genkernel-${version}" \
"initramfs-genkernel-${alt_version}"; do
if test -e "${dirname}/${i}" ; then
initrd="$i"
break
fi
done
initramfs=
for i in "config-${version}" "config-${alt_version}"; do
if test -e "${dirname}/${i}" ; then
initramfs=`grep CONFIG_INITRAMFS_SOURCE= "${dirname}/${i}" | cut -f2 -d= | tr -d \"`
config=
for i in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "/etc/kernels/kernel-config-${version}" ; do
if test -e "${i}" ; then
config="${i}"
break
fi
done
initramfs=
if test -n "${config}" ; then
initramfs=`grep CONFIG_INITRAMFS_SOURCE= "${config}" | cut -f2 -d= | tr -d \"`
fi
if test -n "${initrd}" ; then
echo "Found initrd image: ${dirname}/${initrd}" >&2
elif test -z "${initramfs}" ; then

View file

@ -93,11 +93,21 @@ EOF
EOF
}
linux_list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do
linux_list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* /boot/kernel-*; do
if grub_file_is_not_garbage "$i"; then
basename=$(basename $i)
version=$(echo $basename | sed -e "s,^[^0-9]*-,,g")
if grub_file_is_not_garbage "$i" && grep -qx "CONFIG_XEN_DOM0=y" /boot/config-${version} 2> /dev/null ; then echo -n "$i " ; fi
done`
dirname=$(dirname $i)
config=
for j in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "/etc/kernels/kernel-config-${version}" ; do
if test -e "${j}" ; then
config="${j}"
break
fi
done
if (grep -qx "CONFIG_XEN_DOM0=y" "${config}" 2> /dev/null || grep -qx "CONFIG_XEN_PRIVILEGED_GUEST=y" "${config}" 2> /dev/null); then echo -n "$i " ; fi
fi
done`
if [ "x${linux_list}" = "x" ] ; then
exit 0
fi
@ -127,7 +137,9 @@ while [ "x${xen_list}" != "x" ] ; do
initrd=
for i in "initrd.img-${version}" "initrd-${version}.img" \
"initrd-${version}" "initrd.img-${alt_version}" \
"initrd-${alt_version}.img" "initrd-${alt_version}"; do
"initrd-${alt_version}.img" "initrd-${alt_version}" \
"initramfs-genkernel-${version}" \
"initramfs-genkernel-${alt_version}" ; do
if test -e "${dirname}/${i}" ; then
initrd="$i"
break

View file

@ -36,25 +36,18 @@
#include <linux/raid/md_u.h>
char **
grub_util_raid_getmembers (char *name)
grub_util_raid_getmembers (const char *name)
{
int fd, ret, i, j;
char *devname;
char **devicelist;
mdu_version_t version;
mdu_array_info_t info;
mdu_disk_info_t disk;
devname = xmalloc (strlen (name) + 6);
strcpy (devname, "/dev/");
strcpy (devname+5, name);
fd = open (devname, O_RDONLY);
fd = open (name, O_RDONLY);
if (fd == -1)
grub_util_error ("can't open %s: %s", devname, strerror (errno));
free (devname);
grub_util_error ("can't open %s: %s", name, strerror (errno));
ret = ioctl (fd, RAID_VERSION, &version);
if (ret != 0)