grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix module relocation errors on PowerPC
@ 2011-10-18  4:48 Anton Blanchard
  2011-10-18  5:49 ` Anton Blanchard
  2011-11-03 18:03 ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 2 replies; 5+ messages in thread
From: Anton Blanchard @ 2011-10-18  4:48 UTC (permalink / raw)
  To: The development of GNU GRUB

[-- 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)
 {

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-11-08  8:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-18  4:48 [PATCH] Fix module relocation errors on PowerPC Anton Blanchard
2011-10-18  5:49 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).