* 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.
Restructures early code path on ieee1275 to unify grub_main() as
the first C function that is executed in every platform.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_init): New prototype.
* kern/i386/ieee1275/startup.S (_start): Jump to grub_main() instead of
cmain().
* kern/powerpc/ieee1275/crt0.S (_start): Likewise.
* kern/ieee1275/cmain.c (cmain): Rename to ...
* kern/ieee1275/cmain.c (grub_ieee1275_init): ... this.
* kern/ieee1275/init.c (grub_machine_init): Call grub_ieee1275_init()
at the beginning.
* aclocal.m4 (grub_PROG_OBJCOPY_ABSOLUTE): take only .text
section into account, newer toolchains generate unique build ids
* configure.ac: remove the test for --build-id=none acceptance,
we want build ids to bre preserved
* genmk.rb: add -R .note.gnu.build-id to objcopy, so build id
far from other sections don't cause the raw binary images grow
size
* util/i386/pc/grub-mkrescue.in: Add --emulation=floppy
to create a floppy emulation boot CD when non emulation mode
does not work.
Enable Joliet CD filesystem extension.
Improve robustness when handling LVM.
* disk/lvm.c (grub_lvm_getvalue): Return 0 when `*p' is NULL
(and leave `*p' unmodified).
(grub_lvm_iterate): Don't assume `vg->lvs != NULL' when iterating
through it.
(grub_lvm_memberlist): Don't assume `lv->vg->pvs != NULL' when
iterating through it.
(grub_lvm_open): Don't assume `vg->lvs != NULL' when iterating
through it.
(grub_lvm_scan_device): Check the return value (and fail gracefuly
when due) on each grub_lvm_getvalue() or grub_strstr() call.
Don't assume `vg->pvs != NULL' when iterating through it.
* util/grub.d/30_os-prober.in: New script. Use `os-prober' and
`linux-boot-prober' (if installed) to detect other operating
systems which are installed on the computer and add them to
the boot menu.
* conf/common.rmk: Build and install 30_os-prober.
* kern/powerpc/ieee1275/init.c: Move from here ...
* kern/ieee1275/init.c: ... to here. Update all users.
* kern/powerpc/ieee1275/cmain.c: Move from here ...
* kern/ieee1275/cmain.c: ... to here. Update all users.
* kern/powerpc/ieee1275/openfw.c: Move from here ...
* kern/ieee1275/openfw.c: ... to here. Update all users.
* loader/powerpc/ieee1275/multiboot2.c: Move from here ...
* loader/ieee1275/multiboot2.c: ... to here. Update all users.
Revert grub/machine/init.h addition by Pavel (since it breaks on
i386-ieee1275 and others):
* util/i386/pc/misc.c: Remove grub/machine/init.h.
* util/powerpc/ieee1275/misc.c: Likewise.
* util/biosdisk.c: Include grub/util/biosdisk.h.
* util/grub-fstest.c (execute_command): Make static.
* util/grub-mkdevicemap.c (check_device): Likewise.
* util/i386/pc/misc.c: Include grub/machine/init.h.
* util/powerpc/ieee1275/misc.c: Likewise.
* util/lvm.c: Include grub/util/lvm.h.
* util/misc.c: Include grub/kernel.h, grub/misc.h and
grub/cache.h.
* util/raid.c: Include grub/util/raid.h.
(grub_util_getdiskname): Make static.
* util/grub-emu.c (main): Remove calls to grub_hostfs_init() and
grub_hostfs_fini(), as they are called from grub_init_all() and
grub_fini_all() respectively. This fixes an infinite loop in
grub-fstest due to double registration of hostfs.
Reported by Christian Franke <Christian.Franke@t-online.de>
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_find_options):
Fix signedness warnings.
* kern/powerpc/ieee1275/openfw.c (grub_available_iterate):
Likewise.
* util/ieee1275/get_disk_name.c: Include config.h so that
_GNU_SOURCE is defined and getline() is declared. Mark an
unused argument as such. Fix a signedness warning.
* genkernsyms.sh.in: Use more robust assignments for CC and
srcdir. Quote srcdir.
* gensymlist.sh.in: Likewise. Assert at the compile time that
the symbol table is not empty.
* disk/ata.c (grub_ata_open): Don't lose precision in disk->id.
* disk/host.c (grub_host_open): Likewise.
* disk/loopback.c (grub_loopback_open): Likewise.
* disk/memdisk.c (grub_memdisk_open): Use a string pointer for
disk->id as in disk/host.c, not a multi-character constant.
* util/grub-fstest.c (cmd_cmp): Use fseeko(), not fseek(). The
later is obsolete, potentially dangerous and sets a bad example.
* util/i386/efi/grub-mkimage.c (make_header): Likewise.
* util/misc.c (grub_util_get_image_size): Likewise.
* video/reader/png.c (grub_png_data): New member is_16bit and
image_data.
(grub_png_decode_image_header): Detect 16 bit png image.
(grub_png_convert_image): New function to convert 16 bit image to 8 bit.
(grub_png_decode_png): Call grub_png_convert_image for 16 bit image.
(grub_video_reader_png): Release memory occupied by image_data.
* fs/ntfs.c (find_attr): Handle non-resident attribute list larger than
4096 bytes.
(grub_nfs_mount): Skip the test for sector per cluster.
* include/grub/ntfs.h (MAX_SPC): Removed.