From 3f51de772d1e986a77e42a7f8089f2bab770ca7b Mon Sep 17 00:00:00 2001 From: proski Date: Sun, 27 Jan 2008 20:30:58 +0000 Subject: [PATCH] * include/grub/powerpc/ieee1275/kernel.h: Introduce GRUB_MOD_GAP 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. --- ChangeLog | 8 ++++++++ include/grub/powerpc/ieee1275/kernel.h | 5 +++++ kern/powerpc/ieee1275/init.c | 2 +- util/elf/grub-mkimage.c | 2 +- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 44d5887ea..81fbbfbc0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-01-27 Pavel Roskin + + * include/grub/powerpc/ieee1275/kernel.h: Introduce GRUB_MOD_GAP + 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. + 2008-01-26 Pavel Roskin * kern/dl.c (grub_dl_load): Don't abort if prefix is not set, diff --git a/include/grub/powerpc/ieee1275/kernel.h b/include/grub/powerpc/ieee1275/kernel.h index 107b9283a..129ee200d 100644 --- a/include/grub/powerpc/ieee1275/kernel.h +++ b/include/grub/powerpc/ieee1275/kernel.h @@ -23,6 +23,11 @@ #define GRUB_MOD_ALIGN 0x1000 +/* Minimal gap between _end and the start of the modules. It's a hack + for PowerMac to prevent "CLAIM failed" error. The real fix is to + rewrite grub-mkimage to generate valid ELF files. */ +#define GRUB_MOD_GAP 0x8000 + void EXPORT_FUNC (grub_reboot) (void); void EXPORT_FUNC (grub_halt) (void); diff --git a/kern/powerpc/ieee1275/init.c b/kern/powerpc/ieee1275/init.c index b38f01738..6d08140f0 100644 --- a/kern/powerpc/ieee1275/init.c +++ b/kern/powerpc/ieee1275/init.c @@ -242,5 +242,5 @@ grub_get_rtc (void) grub_addr_t grub_arch_modules_addr (void) { - return ALIGN_UP(_end, GRUB_MOD_ALIGN); + return ALIGN_UP(_end + GRUB_MOD_GAP, GRUB_MOD_ALIGN); } diff --git a/util/elf/grub-mkimage.c b/util/elf/grub-mkimage.c index 9e44af1d4..316169f2d 100644 --- a/util/elf/grub-mkimage.c +++ b/util/elf/grub-mkimage.c @@ -218,7 +218,7 @@ add_segments (char *dir, FILE *out, int chrp, char *mods[]) grub_addr_t modbase; /* Place modules just after grub segment. */ - modbase = ALIGN_UP(grub_end, GRUB_MOD_ALIGN); + modbase = ALIGN_UP(grub_end + GRUB_MOD_GAP, GRUB_MOD_ALIGN); /* Construct new segment header for modules. */ phdr = phdrs + grub_target_to_host16 (ehdr.e_phnum);