From: Anton Blanchard <anton@samba.org>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: [PATCH] Fix module relocation errors on PowerPC
Date: Tue, 18 Oct 2011 15:48:17 +1100 [thread overview]
Message-ID: <20111018154817.752a92f6@kryten> (raw)
[-- Attachment #1: Type: text/plain, Size: 445 bytes --]
Hi,
I tried grub2 on a POWER6 box and got:
Welcome to GRUB!
error: relocation overflow.
Entering rescue mode...
Modules (and therefore the heap) need to be close to the executable to
avoid requiring more complicated relocations. This patch uses the same
method sparc does and puts the heap directly above the executable.
We use the OF stack so we don't need to reserve any memory for it. Is
it time to create GRUB_MACHINE_POWERPC?
Anton
[-- Attachment #2: fix_module_relocation --]
[-- Type: application/octet-stream, Size: 1963 bytes --]
2011-10-18 Anton Blanchard <anton@samba.org>
* grub-core/kern/ieee1275/init.c: Use sparc version of grub_claim_heap
on powerpc.
* include/grub/powerpc/ieee1275/ieee1275.h: Define
GRUB_KERNEL_MACHINE_STACK_SIZE.
* grub-core/kern/main.c: Use grub_modules_get_end on powerpc.
Index: grub/grub-core/kern/ieee1275/init.c
===================================================================
--- grub.orig/grub-core/kern/ieee1275/init.c 2011-10-18 15:01:50.894652852 +1100
+++ grub/grub-core/kern/ieee1275/init.c 2011-10-18 15:02:14.659078404 +1100
@@ -135,7 +135,7 @@ grub_machine_get_bootlocation (char **de
}
/* Claim some available memory in the first /memory node. */
-#ifdef __sparc__
+#if defined(__sparc__) || defined(__powerpc__)
static void
grub_claim_heap (void)
{
Index: grub/include/grub/powerpc/ieee1275/ieee1275.h
===================================================================
--- grub.orig/include/grub/powerpc/ieee1275/ieee1275.h 2011-10-18 15:07:11.408488163 +1100
+++ grub/include/grub/powerpc/ieee1275/ieee1275.h 2011-10-18 15:07:13.924534216 +1100
@@ -20,6 +20,8 @@
#ifndef GRUB_IEEE1275_MACHINE_HEADER
#define GRUB_IEEE1275_MACHINE_HEADER 1
+#define GRUB_KERNEL_MACHINE_STACK_SIZE 0
+
#include <grub/types.h>
#define GRUB_IEEE1275_CELL_SIZEOF 4
Index: grub/grub-core/kern/main.c
===================================================================
--- grub.orig/grub-core/kern/main.c 2011-10-18 15:07:54.761281514 +1100
+++ grub/grub-core/kern/main.c 2011-10-18 15:08:37.114056304 +1100
@@ -31,7 +31,7 @@
#include <grub/parser.h>
/* This is actualy platform-independant but used only on loongson and sparc. */
-#if defined (GRUB_MACHINE_MIPS_LOONGSON) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS) || defined (GRUB_MACHINE_SPARC64)
+#if defined (GRUB_MACHINE_MIPS_LOONGSON) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS) || defined (GRUB_MACHINE_SPARC64) || defined (__powerpc__)
grub_addr_t
grub_modules_get_end (void)
{
next reply other threads:[~2011-10-18 4:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-18 4:48 Anton Blanchard [this message]
2011-10-18 5:49 ` [PATCH] Fix module relocation errors on PowerPC Anton Blanchard
2011-10-29 9:39 ` Vladimir 'φ-coder/phcoder' Serbinenko
2011-11-03 18:03 ` Vladimir 'φ-coder/phcoder' Serbinenko
2011-11-08 8:57 ` Anton Blanchard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111018154817.752a92f6@kryten \
--to=anton@samba.org \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.