* boot/i386/pc/boot.S (ERR): New macro.
(chs_mode): Use ERR.
(geometry_error): Likewise.
(hd_probe_error): Remove. This is only used once, so we wrwite
it inline instead.
(read_error): Instead of printing read_error_string, just set up
%si and fall through to ...
(error_message): ... this new function, also used by ERR.
Also-By: Colin Watson <cjwatson@ubuntu.com>
2010-02-10 Colin Watson <cjwatson@ubuntu.com>
Shrink the pre-partition-table part of boot.img by eight bytes.
* boot/i386/pc/boot.S (ERR): New macro.
(chs_mode): Use ERR.
(geometry_error): Likewise.
(hd_probe_error): Remove. This is only used once, so we wrwite
it inline instead.
(read_error): Instead of printing read_error_string, just set up
%si and fall through to ...
(error_message): ... this new function, also used by ERR.
* include/grub/i386/pc/boot.h (GRUB_BOOT_MACHINE_PXE_DL): New macro.
* boot/i386/pc/pxeboot.S: Include `<grub/machine/boot.h>'.
(_start): Macroify `0x7F'.
* kern/i386/pc/init.c: Include `<grub/machine/boot.h>'.
(make_install_device): Use "(pxe)" as fallback prefix when booting
via PXE.
* boot/i386/pc/diskboot.S: Fix inaccurate comment.
* util/i386/pc/grub-setup.c: Include `<assert.h>'.
(struct boot_blocklist): Move from here ...
* include/grub/i386/pc/boot.h [ASM_FILE]
(struct grub_boot_blocklist): ... to here. Update all users.
(setup): Only initialize `start' member of `first_block'
structure. Add assert() calls to verify the other members.
* util/i386/pc/grub-mkimage.c: Include `<assert.h>'.
(generate_image): Fix broken blocklist length initialization.
Add assert() call to verify blocklist `segment' field.
For consistency with [multiboot]/docs/boot.S.
* include/multiboot.h (MULTIBOOT_MAGIC): Rename from this ...
(MULTIBOOT_HEADER_MAGIC): ... to this. Update all users.
(MULTIBOOT_MAGIC2): Rename from this ...
(MULTIBOOT_BOOTLOADER_MAGIC): ... to this. Update all users.
* boot/i386/pc/cdboot.S: Use LOCAL for local labels. Eliminate
ABS and APPLE_CC.
* boot/i386/pc/diskboot.S: Likewise.
* boot/i386/pc/lnxboot.S: Likewise. Hardcode the number of code
sectors allow compilation on MacOSX.
* conf/i386-pc.rmk: Enable unconditional compilation of
lnxboot.img.
* boot/i386/pc/boot.S: Remove root_drive. Assert offset of
boot_drive_check by using GRUB_BOOT_MACHINE_DRIVE_CHECK. Don't
save %dx, we only need %dl and we never change it.
* boot/i386/pc/cdboot.S: Don't set the root drive.
* boot/i386/pc/pxeboot.S: Likewise.
* include/grub/i386/pc/boot.h: Remove
GRUB_BOOT_MACHINE_ROOT_DRIVE, adjust
GRUB_BOOT_MACHINE_DRIVE_CHECK.
* include/grub/i386/pc/kernel.h: Remove grub_root_drive.
* kern/i386/pc/init.c (make_install_device): Remove references
to grub_root_drive.
* kern/i386/pc/startup.S: Likewise.
* util/i386/pc/grub-setup.c (setup): Don't set root_drive.
Absolute addressing through constant with Apple's cc
* kern/i386/pc/startup.S: Define necessary constants
and address through it when using ABS with Apple's CC
* boot/i386/pc/diskboot.S: likewise
* boot/i386/pc/boot.S: likewise
* boot/i386/pc/lnxboot.S: likewise
* boot/i386/pc/cdboot.S: likewise
* mmap/i386/pc/mmap_helper.S: likewise
* commands/i386/pc/drivemap_int13h.S: likewise
* boot/i386/pc/diskboot.S (notification_string): Replace
"Loading kernel" with just "loading". This is shorter, less
confusing and saves a few bytes for possible future changes.
* loader/i386/pc/multiboot.c (grub_multiboot_get_bootdev): New function.
(grub_multiboot): Set boot device.
* boot/i386/pc/lnxboot.S (real_code_2): Set %dh to 0xFF.
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.
* 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.
* boot/i386/pc/boot.S (boot_drive_check): Add a comment indicating
which instruction is modified by grub-setup during installation
(since it wasn't obvious by only looking at this file).