Skip to contentSkip to conversation

Fix for relocatable PowerPC kernels

PATCH In review Anton Blanchard 3 participants 5 messages Jul 13, 2010 – Jul 14, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix for relocatable PowerPC kernels

Hi,

PowerPC Linux kernels can now be built relocatable so we need to check for that in the loader.

Anton

--

2010-07-13 Anton Blanchard <[email protected]>

* loader/powerpc/ieee1275/linux.c (grub_cmd_linux): Do not reject ET_DYN files.

loader/powerpc/ieee1275/linux.c +1 -1
Index: grub/loader/powerpc/ieee1275/linux.c
===================================================================
@@ -220,7 +220,7 @@ grub_cmd_linux (grub_command_t cmd __att
   if (! elf)
     goto out;
 
-  if (elf->ehdr.ehdr32.e_type != ET_EXEC)
+  if (elf->ehdr.ehdr32.e_type != ET_EXEC && elf->ehdr.ehdr32.e_type != ET_DYN)
     {
       grub_error (GRUB_ERR_UNKNOWN_OS,
 		  "this ELF file is not of the right type");
#1 lore raw
Quoted 8 lines · Anton Blanchard

Hi,

PowerPC Linux kernels can now be built relocatable so we need to check for that in the loader.

Anton

Is building as ET_DYN supported upstream? We previously had reports of building system of some distros to be plainly borked and usualy the distro fixed their building system pretty fast. If upstream supports ET_DYN, then this patch is accepted with no further questions. But if it's a borked building system it may have subtle bugs and allowing it would probably just suppress an early symptom of other problems.

Quoted 27 lines

--

2010-07-13 Anton Blanchard <[email protected]>

* loader/powerpc/ieee1275/linux.c (grub_cmd_linux): Do not reject ET_DYN files.

Index: grub/loader/powerpc/ieee1275/linux.c
===================================================================

loader/powerpc/ieee1275/linux.c +1 -1
@@ -220,7 +220,7 @@ grub_cmd_linux (grub_command_t cmd __att
   if (! elf)
     goto out;
 
-  if (elf->ehdr.ehdr32.e_type != ET_EXEC)
+  if (elf->ehdr.ehdr32.e_type != ET_EXEC && elf->ehdr.ehdr32.e_type != ET_DYN)
     {
       grub_error (GRUB_ERR_UNKNOWN_OS,
 		  "this ELF file is not of the right type");

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
#2 lore raw

Hi,

Quoted 6 lines

Is building as ET_DYN supported upstream? We previously had reports of building system of some distros to be plainly borked and usualy the distro fixed their building system pretty fast. If upstream supports ET_DYN, then this patch is accepted with no further questions. But if it's a borked building system it may have subtle bugs and allowing it would probably just suppress an early symptom of other problems.

This is supported upstream on a number of architectures, for example the PowerPC configuration option is:

config RELOCATABLE
bool "Build a relocatable kernel"
help
This builds a kernel image that is capable of running anywhere in the RMA (real memory area) at any 16k-aligned base address. The kernel is linked as a position-independent executable (PIE) and contains dynamic relocations which are processed early in the bootup process.

One use is for the kexec on panic case where the recovery kernel must live at a different physical address than the primary kernel.

Regards,
Anton

Quoted 18 lines
Quoted 18 lines

2010-07-13 Anton Blanchard <[email protected]>

* loader/powerpc/ieee1275/linux.c (grub_cmd_linux): Do not reject ET_DYN files.

Index: grub/loader/powerpc/ieee1275/linux.c
===================================================================

loader/powerpc/ieee1275/linux.c +1 -1
@@ -220,7 +220,7 @@ grub_cmd_linux (grub_command_t cmd __att
   if (! elf)
     goto out;
 
-  if (elf->ehdr.ehdr32.e_type != ET_EXEC)
+  if (elf->ehdr.ehdr32.e_type != ET_EXEC && elf->ehdr.ehdr32.e_type != ET_DYN)
     {
       grub_error (GRUB_ERR_UNKNOWN_OS,
 		  "this ELF file is not of the right type");
#3 lore raw
Quoted 10 lines · Anton Blanchard

Hi,

Quoted 7 lines

Is building as ET_DYN supported upstream? We previously had reports of building system of some distros to be plainly borked and usualy the distro fixed their building system pretty fast. If upstream supports ET_DYN, then this patch is accepted with no further questions. But if it's a borked building system it may have subtle bugs and allowing it would probably just suppress an early symptom of other problems.

Quoted 4 lines

This is supported upstream on a number of architectures, for example the PowerPC configuration option is:

Then I'm ok with your patch but I'm on wacky connection and don't want to risk a stale lock (unfortunately bzr-ssh isn't supported on savannah). Could someone with good access commit it?

Quoted 42 lines

config RELOCATABLE
bool "Build a relocatable kernel"
help
This builds a kernel image that is capable of running anywhere in the RMA (real memory area) at any 16k-aligned base address. The kernel is linked as a position-independent executable (PIE) and contains dynamic relocations which are processed early in the bootup process.

One use is for the kexec on panic case where the recovery kernel must live at a different physical address than the primary kernel.

Regards,
Anton

Quoted 13 lines
Quoted 13 lines

2010-07-13 Anton Blanchard <[email protected]>

* loader/powerpc/ieee1275/linux.c (grub_cmd_linux): Do not reject ET_DYN files.

Index: grub/loader/powerpc/ieee1275/linux.c
===================================================================

loader/powerpc/ieee1275/linux.c +0 -0
@@ -220,7 +220,7 @@ grub_cmd_linux (grub_command_t cmd __att
   if (! elf)
     goto out;
 
Quoted 6 lines

loader/powerpc/ieee1275/linux.c grub_cmd_linux (grub_command_t cmd __att · line 226

Quoted 6 lines
loader/powerpc/ieee1275/linux.c +1 -1
-  if (elf->ehdr.ehdr32.e_type != ET_EXEC)
+  if (elf->ehdr.ehdr32.e_type != ET_EXEC && elf->ehdr.ehdr32.e_type != ET_DYN)
     {
       grub_error (GRUB_ERR_UNKNOWN_OS,
 		  "this ELF file is not of the right type");

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
#4 lore raw
Quoted 7 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 2 lines · Anton Blanchard

This is supported upstream on a number of architectures, for example the PowerPC configuration option is:

Then I'm ok with your patch but I'm on wacky connection and don't want to risk a stale lock (unfortunately bzr-ssh isn't supported on savannah). Could someone with good access commit it?

Committed. Thanks!

Signature · 1 line
Colin Watson                                       [[email protected]]