2008-01-21 Robert Millan <rmh@aybabtu.com>

* 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.
This commit is contained in:
robertmh 2008-01-21 15:48:27 +00:00
parent f970b55e43
commit 261bd4bc56
8 changed files with 48 additions and 8 deletions

View file

@ -1,7 +1,7 @@
/* grub-mkimage.c - make a bootable image */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
* Copyright (C) 2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -21,6 +21,7 @@
#include <grub/types.h>
#include <grub/machine/boot.h>
#include <grub/machine/kernel.h>
#include <grub/machine/memory.h>
#include <grub/kernel.h>
#include <grub/disk.h>
#include <grub/util/misc.h>
@ -180,6 +181,10 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[], char *me
= grub_cpu_to_le32 (memdisk_size);
*((grub_uint32_t *) (core_img + GRUB_KERNEL_MACHINE_COMPRESSED_SIZE))
= grub_cpu_to_le32 (core_size - GRUB_KERNEL_MACHINE_RAW_SIZE);
if (core_size > GRUB_MEMORY_MACHINE_UPPER - GRUB_MEMORY_MACHINE_LINK_ADDR)
grub_util_error ("Core image is too big (%p > %p)\n", core_size,
GRUB_MEMORY_MACHINE_UPPER - GRUB_MEMORY_MACHINE_LINK_ADDR);
grub_util_write_image (core_img, core_size, out);
free (kernel_img);