Add support for having a grub directory in a different drive. This
is still only the data handling part.
* kern/i386/pc/startup.S (multiboot_trampoline): Set %dh to 0xFF.
(codestart): Save %dh in GRUB_ROOT_DRIVE.
(grub_root_drive): New variable.
* kern/i386/pc/init.c (make_install_device): Use GRUB_ROOT_DRIVE
instead of GRUB_BOOT_DRIVE to construct a device name. Set
GRUB_ROOT_DRIVE to GRUB_BOOT_DRIVE if it is 0xFF, otherwise use it
as it was.
* include/grub/i386/pc/kernel.h (grub_root_drive): New prototype.
* include/grub/i386/pc/boot.h (GRUB_BOOT_MACHINE_ROOT_DRIVE): New
macro.
(GRUB_BOOT_MACHINE_DRIVE_CHECK): Set to 0x4f.
* boot/i386/pc/pxeboot.S (_start): Set %dh to 0xFF. For now, this
is bogus, because PXE booting does not specify any drive
correctly.
* boot/i386/pc/lnxboot.S (reg_edx): Set the second byte to 0xFF. I
am not sure if this is really correct.
* boot/i386/pc/cdboot.S: Set %dh to 0xFF, because the root drive
is always identical to the boot drive when booting from a CD.
* boot/i386/pc/boot.S (MOV_MEM_TO_AL): Removed. Not needed any
longer.
(root_drive): New variable.
(real_start): Unconditionally set %dh to ROOT_DRIVE.
(setup_sectors): Push %dx right after popping it, because %dh will
be modified later.
(copy_buffer): Restore %dx.
* a/kern/i386/pc/startup.S (grub_chainloader_real_boot): Pop
%edx and %esi from stack only after grub_gate_a20() is called.
grub_gate_a20() clobbers %edx.
* conf/i386-pc.rmk (pkglib_IMAGES): Add cdboot.img.
(cdboot_img_SOURCES): New variable.
(cdboot_img_ASFLAGS): New variable.
(cdboot_img_LDFLAGS): New variable.
* boot/i386/pc/cdboot.S: New file.
* disk/i386/pc/biosdisk.c (cd_start): New variable.
(cd_count): Likewise.
(grub_biosdisk_get_drive): Add support for cd device.
(grub_biosdisk_call_hook): Likewise.
(grub_biosdisk_iterate): Likewise.
(grub_biosdisk_open): Likewise.
(GRUB_BIOSDISK_CDROM_RETRY_COUNT): New macro.
(grub_biosdisk_rw): Support reading from cd device.
(GRUB_MOD_INIT): Iterate cd devices.
* include/grub/i386/pc/biosdisk.h (GRUB_BIOSDISK_FLAG_CDROM): New macro.
(GRUB_BIOSDISK_MACHINE_CDROM_START): Likewise.
(GRUB_BIOSDISK_MACHINE_CDROM_END): Likewise.
* kern/i386/pc/init.c (make_install_device): Check for cd device.
* fs/ufs.c (INODE_BLKSZ): Fix incorrect value.
(grub_ufs_get_file_block): Fix indirect block calculation problem.
* fs/xfs.c (grub_xfs_sblock): New member log2_dirblk.
(grub_xfs_btree_node): New structure.
(grub_xfs_btree_root): New structure.
(grub_xfs_inode): New members nblocks, extsize, nextents and btree.
(GRUB_XFS_EXTENT_OFFSET): Use exts instead of inode->data.extents.
(GRUB_XFS_EXTENT_BLOCK): Likewise.
(GRUB_XFS_EXTENT_SIZE): Likewise.
(grub_xfs_read_block): Support btree format type.
(grub_xfs_iterate_dir): Use NESTED_FUNC_ATTR in call_hook.
Use directory block as basic unit.
* fs/fshelp.c (grub_fshelp_read_file): Bug fix for sparse block.
* aclocal.m4 (grub_i386_CHECK_REGPARM_BUG): Define NESTED_FUNC_ATTR as
__attribute__ ((__regparm__ (1))).
Correct a mistake in previous commit.
* conf/i386-pc.rmk (normal/execute.c_DEPENDENCIES): Move to the
top.
(normal/command.c_DEPENDENCIES): New variable.
* util/powerpc/ieee1275/grub-mkrescue.in: New file.
* conf/powerpc-ieee1275.rmk: Add grub-mkrescue support for
PowerPC.
* DISTLIST: Add util/powerpc/ieee1275/grub-mkrescue.in.
to create a gap between _end and the modules added to the image
with grub-mkrescue. That fixes "CLAIM failed" on PowerMAC.
* kern/powerpc/ieee1275/init.c: Use GRUB_MOD_GAP.
* util/elf/grub-mkimage.c (add_segments): Likewise.
* fs/reiserfs.c (grub_fshelp_node): New member next_offset.
(grub_reiserfs_get_item): Save offset of the next item.
(grub_reiserfs_iterate_dir): Use next_offset to find next item.
that hang if GRUB tries to setup colors.
* term/ieee1275/ofconsole.c (grub_ofconsole_init): Don't set
colors for firmwares that don't support it.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_set_flag):
Recognize Open Hack'Ware, set flags to work around its
limitations.
* fs/ufs.c (GRUB_UFS_VOLNAME_LEN): New macro.
(grub_ufs_sblock): New member volume name.
(grub_ufs_find_file): Fix string copy bug.
(grub_ufs_label): Implement this function properly.
* fs/hfs.c (grub_hfs_cnid_type): New enum.
(grub_hfs_iterate_records): Use the correct file number for extents
and catalog file. Fix problem in next index calculation.
(grub_hfs_find_node): Replace recursive function call with loop.
(grub_hfs_iterate_dir): Replace recursive function call with loop.
* term/i386/pc/at_keyboard.c (grub_keyboard_isr): #ifdef out
grub_dprintf calls, since they make "debug=all" mode unusable.
(grub_console_checkkey): Likewise.
* kern/i386/pc/init.c (make_install_device): When memdisk image is
present, "(memdisk)/boot/grub" becomes the default prefix.
* util/i386/pc/grub-mkrescue.in: Switch to a minimal core.img plus
a memdisk tarball with all the modules. Add --overlay=DIR option that
allows users to overlay additional files into the image.
* conf/i386-ieee1275.rmk (kernel_elf_SOURCES): Add `machine/loader.h'
and `machine/memory.h'.
(pkglib_MODULES): Add `multiboot.mod' and `_multiboot.mod'.
(_multiboot_mod_SOURCES): New variable.
(_multiboot_mod_CFLAGS): Likewise.
(_multiboot_mod_LDFLAGS): Likewise.
(multiboot_mod_SOURCES): Likewise.
(multiboot_mod_CFLAGS): Likewise.
(multiboot_mod_LDFLAGS): Likewise.
* include/grub/i386/ieee1275/loader.h: New file.
* include/grub/i386/ieee1275/machine.h: Likewise.
* include/grub/i386/ieee1275/memory.h: Likewise.
* include/grub/i386/pc/init.h (grub_os_area_addr): Remove (redundant)
variable declaration.
(grub_os_area_size): Likewise.
* kern/i386/ieee1275/init.c (grub_os_area_addr, grub_os_area_size)
(grub_lower_mem, grub_upper_mem): New variables.
(grub_stop_floppy): New function (just to make
grub_multiboot2_real_boot() happy).
* kern/i386/ieee1275/startup.S: Include `<grub/machine/memory.h>',
`<grub/cpu/linux.h>', `<multiboot.h>' and `<multiboot2.h>'.
(grub_stop): New function.
Include `"../realmode.S"' and `"../loader.S"'.
* loader/multiboot_loader.c: Include `<grub/machine/machine.h>'.
Replace `__i386__' #ifdefs with `GRUB_MACHINE_PCBIOS'.
* loader/powerpc/ieee1275/multiboot2.c (grub_mb2_arch_boot): On i386,
rely on grub_multiboot2_real_boot() for final boot.
* disk/ieee1275/ofdisk.c (grub_ofdisk_iterate): When
`GRUB_IEEE1275_FLAG_OFDISK_SDCARD_ONLY' flag is set, skip any
device that doesn't look like an SD card.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_flag): Add
`GRUB_IEEE1275_FLAG_OFDISK_SDCARD_ONLY' flag.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_set_flag): Detect
OLPC laptop, and set `GRUB_IEEE1275_FLAG_OFDISK_SDCARD_ONLY' when
found.
* conf/i386-pc.rmk (GRUB_MEMORY_MACHINE_LINK_ADDR): New variable.
(kernel_img_LDFLAGS): Use `GRUB_MEMORY_MACHINE_LINK_ADDR' as link
address.
(grub_mkimage_CFLAGS): Propagate `GRUB_MEMORY_MACHINE_LINK_ADDR' as
a C macro.
* include/grub/i386/pc/memory.h (GRUB_MEMORY_MACHINE_UPPER): New macro.
Indicates start of upper memory.
* util/i386/pc/grub-mkimage.c: Include `<grub/machine/memory.h>'.
(generate_image): Abort when image size is big enough to corrupt
upper memory.
* include/grub/i386/pc/vga.h: Include `<grub/machine/memory.h>'.
(GRUB_MEMORY_MACHINE_VGA_ADDR): Alias for `GRUB_MEMORY_MACHINE_UPPER'.
* term/i386/pc/vga.c (VGA_MEM): Use `GRUB_MEMORY_MACHINE_VGA_ADDR'
instead of hardcoding 0xA0000.
* video/i386/pc/vbe.c: Include `<grub/machine/vga.h>'.
(grub_vbe_set_video_mode): Use `GRUB_MEMORY_MACHINE_VGA_ADDR'
instead of hardcoding 0xA0000.
Fix detection of very small filesystems (like tar).
* fs/reiserfs.c (grub_reiserfs_mount): When disk is too small to
contain a ReiserFS, abort with GRUB_ERR_BAD_FS rather than
GRUB_ERR_OUT_OF_RANGE (which made the upper layer think there's
a problem with this disk).