* util/biosdisk.c (open_device): Revert last change to the
function, it broke installation. The sector needs to be
different dependent on which device is opened.
Ensure GRUB_KERNEL_MACHINE_DATA_END is always consistent with the
rest of GRUB, and breakage doesn't happen if its value were modified.
* include/grub/i386/pc/kernel.h (GRUB_KERNEL_MACHINE_RAW_SIZE):
Redefine as an offset from `GRUB_KERNEL_MACHINE_DATA_END' instead of
a constant (same value).
* kern/i386/pc/startup.S: Replace hardcoded `0x50' with
`GRUB_KERNEL_MACHINE_DATA_END' (same value).
* util/grub-emu.c (grub_machine_init): Move code in this function from
here ...
(main): ... to here (before grub_util_biosdisk_init() call, to prevent
segfault in case grub_printf() is called).
* util/i386/pc/grub-install.in: Append `--device-map=${device_map}' to
grub_probe. Update all users not to explicitly add it again.
(grub_device): New variable; contains corresponding device for grubdir.
(fs_module, partmap_module, devabstraction_module): Pass
`--device ${grub_device}' to grub_probe to avoid traversing /dev
every time.
* util/biosdisk.c (get_drive): Verify that `map[i].drive' is non-NULL
before dereferencing it.
* fs/fat.c (struct grub_fat_bpb): Move fat32-specific fields into a
union with fat12/fat16-specific ones. Add some new fields, including
`num_serial' for both versions.
(struct grub_fat_data): Add `uuid' member.
(grub_fat_mount): Refer to fat32-specific fields in `bpb' by their new
names. Initialize `data->uuid' using `num_serial'.
(grub_fat_uuid): New function.
(grub_fat_fs): Reference grub_fat_uuid() in `uuid' struct member.
* fs/reiserfs.c (grub_reiserfs_superblock): Add `uuid' field.
(grub_reiserfs_uuid): New function.
(grub_reiserfs_fs): Reference grub_reiserfs_uuid() in `uuid' struct
member.
* fs/xfs.c (grub_xfs_sblock): Add `uuid' field.
(grub_xfs_uuid): New function.
(grub_xfs_fs): Reference grub_reiserfs_uuid() in `uuid' struct member.
* disk/i386/pc/biosdisk.c (grub_biosdisk_iterate): Iterate through
floppies after everything else, to ensure floppy drive isn't accessed
unnecessarily (patch from Bean).
* term/ieee1275/ofconsole.c (grub_ofconsole_setcursor): Implement
using "cursor-on" and "cursor-off" commands (understood at least by
the Open Firmware flavour on OLPC).
* util/biosdisk.c (linux_find_partition): Simplify logic and
make the code more universal. Keep special processing for
devfs, but use a simple rule for all other devices. If the
device ends with a number, append 'p' and the partition number.
Otherwise, append only the partition number.
* util/update-grub.in (GRUB_DISABLE_LINUX_UUID): Export variable.
* util/grub.d/10_linux.in: If GRUB_DEVICE_UUID is set, and
GRUB_DISABLE_LINUX_UUID isn't true, use the filesystem UUIDs as
the `root' parameter to Linux.
* commands/search.c (options): Rename --fs_uuid to --fs-uuid.
* util/update-grub_lib.in (prepare_grub_to_access_device): Replace
--fs_uuid with --fs-uuid.
* util/update-grub.in: Allow filesystem UUID probes to fail (since not
all filesystems support them).
* util/grub.d/00_header.in: Remove obsolete comment referencing
convert_system_path_to_grub_path().
* util/update-grub.in: Likewise.
* util/update-grub_lib.in (is_path_readable_by_grub): New function.
(convert_system_path_to_grub_path): Add a warning message explaining
that this function is deprecated. Rely on is_path_readable_by_grub()
for the readability checks.
(font_path): Use is_path_readable_by_grub() for the readability
check rather than convert_system_path_to_grub_path().
* util/update-grub_lib.in (prepare_grub_to_access_device): New function.
* util/update-grub.in: Set `GRUB_FONT_PATH' to the system path, without
converting it first.
* util/grub.d/00_header.in: Use prepare_grub_to_access_device() to setup
grub.cfg for access to font file, and afterwards call it again to set
the root device.
* commands/search.c (options): Add --fs_uuid option.
(search_fs_uuid): New function.
(grub_cmd_search): Fix --set argument passing.
Use search_fs_uuid() when requested via --fs_uuid.
(grub_search_init): Update help message.
* fs/ext2.c (struct grub_ext2_sblock): Rename `unique_id' to `uuid'
and redeclare it as an array of 16-bit words.
(grub_ext2_uuid): New function.
(grub_ext2_fs): Reference grub_ext2_uuid() in `uuid' struct member.
* include/grub/fs.h (struct grub_fs): Add `uuid' struct member.
* util/update-grub.in (GRUB_DEVICE_UUID, GRUB_DEVICE_BOOT)
(GRUB_DEVICE_BOOT_UUID): New variables.
(GRUB_DRIVE. GRUB_DRIVE_BOOT. GRUB_DRIVE_BOOT_GRUB): Remove.
* util/grub.d/00_header.in: Set root using `search --fs_uuid' command
whenever possible.
* util/grub.d/10_hurd.in: Avoid explicit use of root drive. Instead,
just assume `root' variable has the right value.
* util/grub.d/10_linux.in: Likewise.
* util/grub-probe.c (probe): Probe for filesystem UUID when requested
via PRINT_FS_UUID.
(main): Recognise `-t fs_uuid' argument.
* util/biosdisk.c (map): Redefine structure to hold information
about GRUB drive name.
(get_drive): Reimplement without assuming (and verifiing) BIOS-like
drive names.
(call_hook): Remove.
(grub_util_biosdisk_iterate): Access drive names via `.drive' struct
member. Assume drive has partitions.
(grub_util_biosdisk_open): Access device names via `.device' struct
member.
(open_device): Likewise.
(find_drive): Likewise.
(read_device_map): Adjust map[] usage to match the new struct
definition. Don't check for duplicates (still possible, but not cheap
anymore).
(grub_util_biosdisk_fini): Free malloced buffers referenced by map[].
(make_device_name): Remove assumption of BIOS-like drive names.
* include/grub/script.h: Don't include grub_script.tab.h. It's
a generated file, which may only be included from the files with
DEPENDENCIES rules in the makefile. Don't use typedef YYSTYPE,
use union YYSTYPE, as the later allows forward declaration.
* normal/lexer.c: Don't use typedef YYSTYPE, use union YYSTYPE.
* fs/fshelp.c (grub_fshelp_map_block): New function.
(grub_fshelp_find_file): Use 64-bit type for pos and block address.
Use `>>' and `&' operator to avoid 64-bit divide and modulo.
* include/grub/fshelp.h (grub_fshelp_journal_type): New enum.
(GRUB_FSHELP_JOURNAL_UNUSED_MAPPING): New macro.
(grub_fshelp_journal): New structure.
(grub_fshelp_map_block): New function prototype.
(grub_fshelp_read_file): Use grub_disk_addr_t as block type.
(grub_fshelp_map_block): Likewise.
* fs/ext2.c (EXT3_FEATURE_COMPAT_HAS_JOURNAL): New macro.
(EXT3_JOURNAL_MAGIC_NUMBER): Likewise.
(EXT3_JOURNAL_DESCRIPTOR_BLOCK): Likewise.
(EXT3_JOURNAL_COMMIT_BLOCK): Likewise.
(EXT3_JOURNAL_SUPERBLOCK_V1): Likewise.
(EXT3_JOURNAL_SUPERBLOCK_V2): Likewise.
(EXT3_JOURNAL_REVOKE_BLOCK): Likewise.
(EXT3_JOURNAL_FLAG_ESCAPE): Likewise.
(EXT3_JOURNAL_FLAG_SAME_UUID): Likewise.
(EXT3_JOURNAL_FLAG_DELETED): Likewise.
(EXT3_JOURNAL_FLAG_LAST_TAG): Likewise.
(grub_ext2_sblock): New members for journal support.
(grub_ext3_journal_header): New structure.
(grub_ext3_journal_revoke_header): Likewise.
(grub_ext3_journal_block_tag): Likewise.
(grub_ext3_journal_sblock): Likewise.
(grub_fshelp_node): New members logfile and journal.
(grub_ext2_read_block): Change block type to grub_disk_addr_t. Use
grub_fshelp_map_block to get real block number.
(grub_ext2_blockgroup): Use grub_fshelp_map_block to get real block
number.
(grub_ext2_read_inode): Likewise.
(grub_ext3_get_journal): New function.
(grub_read_inode): Initialize journal using grub_ext3_get_journal.
(grub_ext2_close): Release memory used by journal.
* fs/reiserfs.c (REISERFS_MAGIC_STRING): Changed to "ReIsEr".
(REISERFS_MAGIC_DESC_BLOCK): New macro.
(grub_reiserfs_transaction_header): Renamed to
grub_reiserfs_description_block, replace field data with real_blocks.
(grub_reiserfs_commit_block): New structure.
(grub_reiserfs_data): New member journal.
(grub_reiserfs_get_item): Use grub_fshelp_map_block to get real block
number.
(grub_reiserfs_read_symlink): Likewise.
(grub_reiserfs_iterate_dir): Likewise.
(grub_reiserfs_open): Likewise.
(grub_reiserfs_read): Likewise.
(grub_reiserfs_get_journal): New function.
(grub_reiserfs_mount): Use "ReIsEr" as super block magic, as there are
three varieties ReIsErFs, ReIsEr2Fs and ReIsEr3Fs. Initialize journal
using grub_reiserfs_get_journal.
(grub_reiserfs_close): Release memory used by journal.
* fs/affs.c (grub_affs_read_block): Change block type to
grub_disk_addr_t. Use grub_divmod64 to do 64-bit division.
* fs/afs.c (grub_afs_read_block): Change block type to grub_disk_addr_t.
* fs/hfsplus.c (grub_hfsplus_read_block): Likewise.
* fs/ntfs.c (grub_ntfs_read_block): Likewise.
* fs/udf.c (grub_udf_read_block): Change block type to
grub_disk_addr_t. Use type cast to avoid warning.
* fs/xfs.c (grub_xfs_read_block): Likewise.
* commands/cat.c (grub_cmd_cat): Remove non-ESC keys from keyboard queue
to ensure that break with ESC will always work.
* commands/sleep.c (grub_interruptible_millisleep): Likewise.
Remove ESC from keyboard queue.
* util/biosdisk.c: [__CYGWIN__] Add includes.
(grub_util_biosdisk_open): Use Linux code also for Cygwin.
(get_os_disk): Move variable declarations to OS specific
parts to avoid warning.
[__GNU__] (get_os_disk): Fix /dev/sdXsN case.
[__CYGWIN__] (get_os_disk): Add Cygwin /dev/sdXN device names.
(grub_util_biosdisk_get_grub_dev): Use Linux code also for
Cygwin.
* util/getroot.c: [__CYGWIN__] Add includes.
(strip_extra_slashes): Fix "/" case.
[__CYGWIN__] (get_win32_path): New function.
[__CYGWIN__] (grub_get_prefix): Add conversion to win32 path.
[__CYGWIN__] (find_root_device): Disable.
[__CYGWIN__] (get_bootsec_serial): New function.
[__CYGWIN__] (find_cygwin_root_device): Likewise.
[__linux__] (grub_guess_root_device): Add early returns to simplify
structure.
[__CYGWIN__] (grub_guess_root_device): Call find_cygwin_root_device.
[__linux__] (grub_util_get_dev_abstraction): Enable LVM and RAID
check for Linux only.
* util/biosdisk.c (get_os_disk): Recognise xvd type disks.
* util/grub-mkdevicemap.c (get_xvd_disk_name): New function.
(make_device_map): Output entries for xvd type disks.
* util/update-grub_lib.in (make_system_path_relative_to_its_root):
Do not print a trailing slash (therefore, the root directory is an
empty string).
(convert_system_path_to_grub_path): Do not remove trailing slash
from make_system_path_relative_to_its_root() output.
* util/i386/pc/grub-install.in: Add trailing slash to output from
make_system_path_relative_to_its_root().
* util/grub-fstest.c (grub_refresh): Call `fflush (stdout)'. This
ensures that output lines aren't intermangled with those sent to
stderr (via grub_util_info()).
* util/grub-probe.c (grub_refresh): Likewise.
* util/i386/pc/grub-setup.c (grub_refresh): Likewise.
Based on patch from Fabian Greffrath <greffrath@leat.rub.de>
* util/grub.d/10_linux.in: Add ${GRUB_CMDLINE_LINUX_DEFAULT} to the
first boot option.
* util/update-grub.in: Export GRUB_CMDLINE_LINUX_DEFAULT.
* Makefile.in (RMKFILES): Add missing arch i386-ieee1275 and
i386-linuxbios.
* commands/hexdump.c (grub_cmd_hexdump): Support dumping of device,
change the buffer size to 4096 for cdrom device.
* conf/i386-ieee1275.rmk (pkglib_MODULES): Add _linux.mod, linux.mod
and nand.mod.
(_linux_mod_SOURCES): New variable.
(_linux_mod_CFLAGS): Likewise.
(_linux_mod_LDFLAGS): Likewise.
(linux_mod_SOURCES): Likewise.
(linux_mod_CFLAGS): Likewise.
(linux_mod_LDFLAGS): Likewise.
(nand_mod_SOURCES): Likewise.
(nand_mod_CFLAGS): Likewise.
(nand_mod_LDFLAGS): Likewise.
* disk/ieee1275/ofdisk.c (grub_ofdisk_open): Return
GRUB_ERR_UNKNOWN_DEVICE instead of GRUB_ERR_BAD_DEVICE if no device
type property. (nand device in olpc don't have this property)
* include/grub/disk.h (grub_disk_dev_id): New macro
GRUB_DISK_DEVICE_NAND_ID.
* include/grub/i386/ieee1275/loader.h (grub_rescue_cmd_linux): New
function prototype.
(grub_rescue_cmd_initrd): Likewise.
* include/grub/i386/linux.h (GRUB_LINUX_OFW_SIGNATURE): New macro.
(linux_kernel_params): Add new member ofw_signature, ofw_num_items,
ofw_cif_handler and ofw_idt, adjust padding number.
* include/grub/i386/pc/memory.h (grub_upper_mem): Export it if
GRUB_MACHINE_IEEE1275 is defined.
* include/grub/ieee1275/ieee1275.h (grub_available_iterate):
Use NESTED_FUNC_ATTR attribute on the hook parameter.
* kern/powerpc/ieee1275/init.c (grub_claim_heap): Use NESTED_FUNC_ATTR
on nested function heap_init.
(grub_upper_mem): New variable for i386-ieee1275.
(grub_get_extended_memory): New function for i386-ieee1275.
(grub_machine_init): Call grub_get_extended_memory for i386-ieee1275.
* kern/powerpc/ieee1275/openfw.c (grub_available_iterate): Use
NESTED_FUNC_ATTR on the hook parameter. Don't quit if no device type
property.
* loader/i386/ieee1275/linux.c: New file.
* loader/i386/ieee1275/linux_normal.c: New file.
* disk/ieee1275/nand.c: New file.