Skip to contentSkip to conversation

Redefining GRUB_MOD_GAP in init.c

DISCUSSION Pavel Roskin 4 participants 29 messages Jan 28, 2008 – Jan 31, 2008

lore
Share & tools
lore
#0 lore raw

Hi Robert,

I'm concerned about your latest commit:

* kern/powerpc/ieee1275/init.c (grub_arch_modules_addr): Skip `GRUB_MOD_GAP' for platforms in which it's not defined.

The algorithm for calculating the start of the modules should be exactly the same in grub-mkimage and in the core. Any fallbacks should be coherent if possible. Therefore, I think it would be better to define GRUB_MOD_GAP only in header files.

It's hard for me to understand why kern/powerpc/ieee1275/init.c can be used on any platform other than PowerPC. I was assuming that my changes would not affect other platforms.

Also, I don't see how GRUB_MOD_GAP would not be defined to 0x8000 for i386-ieee1275 platform considering that include/grub/i386/ieee1275/kernel.h simply includes include/grub/powerpc/ieee1275/kernel.h

I suggest that i386-ieee1275 stops using any files for PowerPC. kernel.h is not big, so it shouldn't be a problem to copy it. As for init.c, it should be either copied or moved to a more suitable place.

Signature · 2 lines
Regards,
Pavel Roskin
#1 lore raw
Quoted 11 lines · Pavel Roskin

Hi Robert,

I'm concerned about your latest commit:

* kern/powerpc/ieee1275/init.c (grub_arch_modules_addr): Skip `GRUB_MOD_GAP' for platforms in which it's not defined.

The algorithm for calculating the start of the modules should be exactly the same in grub-mkimage and in the core. Any fallbacks should be coherent if possible. Therefore, I think it would be better to define GRUB_MOD_GAP only in header files.

Sorry, I should've really sent this for review; it wasn't such an obvious fix as you pointed out. I'll get that moved to headers as you suggest.

Quoted 4 lines

Also, I don't see how GRUB_MOD_GAP would not be defined to 0x8000 for i386-ieee1275 platform considering that include/grub/i386/ieee1275/kernel.h simply includes include/grub/powerpc/ieee1275/kernel.h

Sounds strange.. I'm wondering that myself. Will check..

Quoted 8 lines

It's hard for me to understand why kern/powerpc/ieee1275/init.c can be used on any platform other than PowerPC. I was assuming that my changes would not affect other platforms.

[...]
I suggest that i386-ieee1275 stops using any files for PowerPC. kernel.h is not big, so it shouldn't be a problem to copy it. As for init.c, it should be either copied or moved to a more suitable place.

I think it's safe to say that the only part of kern/powerpc/ieee1275/init.c that only works on PowerPC is its name ;-)

Maybe it's time we move out those generic files under powerpc directory. I propose moving the following:

kern/powerpc/ieee1275/init.c
kern/powerpc/ieee1275/cmain.c
kern/powerpc/ieee1275/openfw.c
loader/powerpc/ieee1275/multiboot2.c

Does that seem fine?

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
#2 lore raw

GRUB_MOD_GAP for non-ieee1275 ELF platforms

Quoted 6 lines · Robert Millan
Quoted 4 lines

Also, I don't see how GRUB_MOD_GAP would not be defined to 0x8000 for i386-ieee1275 platform considering that include/grub/i386/ieee1275/kernel.h simply includes include/grub/powerpc/ieee1275/kernel.h

Sounds strange.. I'm wondering that myself. Will check..

Ah, right. The problem is not on i386-ieee1275 but on i386-linuxbios, which uses util/elf/grub-mkimage.c.

So, we define GRUB_MOD_GAP for every port that wants to use ELF ? Or we put the fallback only in grub-mkimage.c ? I don't like either of the solutions very much :-(

What do you suggest?

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
#3 lore raw

Re: GRUB_MOD_GAP for non-ieee1275 ELF platforms

Quoted 10 lines · Robert Millan
Quoted 6 lines · Robert Millan
Quoted 4 lines

Also, I don't see how GRUB_MOD_GAP would not be defined to 0x8000 for i386-ieee1275 platform considering that include/grub/i386/ieee1275/kernel.h simply includes include/grub/powerpc/ieee1275/kernel.h

Sounds strange.. I'm wondering that myself. Will check..

Ah, right. The problem is not on i386-ieee1275 but on i386-linuxbios, which uses util/elf/grub-mkimage.c.

Sorry, I didn't realize that i386-linuxbios was affected by my patch.

Quoted 5 lines

So, we define GRUB_MOD_GAP for every port that wants to use ELF ? Or we put the fallback only in grub-mkimage.c ? I don't like either of the solutions very much :-(

What do you suggest?

I would prefer to have GRUB_MOD_GAP is all headers. Once it's not needed, it could be removed across the board.

Signature · 2 lines
Regards,
Pavel Roskin
#4 lore raw

Re: GRUB_MOD_GAP for non-ieee1275 ELF platforms

Quoted 4 lines · Pavel Roskin
Quoted 1 line

What do you suggest?

I would prefer to have GRUB_MOD_GAP is all headers. Once it's not needed, it could be removed across the board.

Ok, does this seem fine?

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)

2008-01-27 Robert Millan <[email protected]>

* include/grub/i386/linuxbios/kernel.h (GRUB_MOD_GAP): New macro.
* kern/powerpc/ieee1275/init.c (grub_arch_modules_addr): Remove `ifndef GRUB_MOD_GAP' hack.
* util/elf/grub-mkimage.c (add_segments): Likewise.

include/grub/i386/linuxbios/kernel.h renamed from grub2/include/grub/i386/linuxbios/kernel.h +4 -1
diff -x CVS -x '*~' -x '*.mk' -urp ../grub2/include/grub/i386/linuxbios/kernel.h ./include/grub/i386/linuxbios/kernel.h
@@ -1,6 +1,6 @@
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2005,2006,2007  Free Software Foundation, Inc.
+ *  Copyright (C) 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
@@ -23,4 +23,7 @@
 
 #define GRUB_MOD_ALIGN 0x1000
 
+/* Non-zero value is only needed for some IEEE-1275 platforms.  */
+#define GRUB_MOD_GAP 0
+
 #endif /* ! GRUB_KERNEL_MACHINE_HEADER */
kern/powerpc/ieee1275/init.c renamed from grub2/kern/powerpc/ieee1275/init.c +0 -5
diff -x CVS -x '*~' -x '*.mk' -urp ../grub2/kern/powerpc/ieee1275/init.c ./kern/powerpc/ieee1275/init.c
@@ -242,10 +242,5 @@ grub_get_rtc (void)
 grub_addr_t
 grub_arch_modules_addr (void)
 {
-/* Only needed for Apple hardware (therefore, powerpc).  */
-#ifndef GRUB_MOD_GAP
-#define GRUB_MOD_GAP 0
-#endif
-
   return ALIGN_UP(_end + GRUB_MOD_GAP, GRUB_MOD_ALIGN);
 }
util/elf/grub-mkimage.c renamed from grub2/util/elf/grub-mkimage.c +1 -6
diff -x CVS -x '*~' -x '*.mk' -urp ../grub2/util/elf/grub-mkimage.c ./util/elf/grub-mkimage.c
@@ -1,6 +1,6 @@
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2004,2005,2006,2007  Free Software Foundation, Inc.
+ *  Copyright (C) 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
@@ -217,11 +217,6 @@ add_segments (char *dir, FILE *out, int 
     {
       grub_addr_t modbase;
 
-/* Only needed for Apple hardware (therefore, powerpc).  */
-#ifndef GRUB_MOD_GAP
-#define GRUB_MOD_GAP 0
-#endif
-
       /* Place modules just after grub segment.  */
       modbase = ALIGN_UP(grub_end + GRUB_MOD_GAP, GRUB_MOD_ALIGN);
 
#5 lore raw

Re: GRUB_MOD_GAP for non-ieee1275 ELF platforms

Quoted 7 lines · Robert Millan
Quoted 4 lines · Pavel Roskin
Quoted 1 line

What do you suggest?

I would prefer to have GRUB_MOD_GAP is all headers. Once it's not needed, it could be removed across the board.

Ok, does this seem fine?

Looks good to me. Thanks!

Signature · 2 lines
Regards,
Pavel Roskin
#6 lore raw

Re: GRUB_MOD_GAP for non-ieee1275 ELF platforms

Quoted 11 lines · Pavel Roskin
Quoted 7 lines · Robert Millan
Quoted 4 lines · Pavel Roskin
Quoted 1 line

What do you suggest?

I would prefer to have GRUB_MOD_GAP is all headers. Once it's not needed, it could be removed across the board.

Ok, does this seem fine?

Looks good to me. Thanks!

Committed.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
#21 lore raw
In reply to Robert Millan
Quoted 35 lines · Robert Millan
Quoted 11 lines · Pavel Roskin

Hi Robert,

I'm concerned about your latest commit:

* kern/powerpc/ieee1275/init.c (grub_arch_modules_addr): Skip `GRUB_MOD_GAP' for platforms in which it's not defined.

The algorithm for calculating the start of the modules should be exactly the same in grub-mkimage and in the core. Any fallbacks should be coherent if possible. Therefore, I think it would be better to define GRUB_MOD_GAP only in header files.

Sorry, I should've really sent this for review; it wasn't such an obvious fix as you pointed out. I'll get that moved to headers as you suggest.

Quoted 4 lines

Also, I don't see how GRUB_MOD_GAP would not be defined to 0x8000 for i386-ieee1275 platform considering that include/grub/i386/ieee1275/kernel.h simply includes include/grub/powerpc/ieee1275/kernel.h

Sounds strange.. I'm wondering that myself. Will check..

Quoted 8 lines

It's hard for me to understand why kern/powerpc/ieee1275/init.c can be used on any platform other than PowerPC. I was assuming that my changes would not affect other platforms.

[...]
I suggest that i386-ieee1275 stops using any files for PowerPC. kernel.h is not big, so it shouldn't be a problem to copy it. As for init.c, it should be either copied or moved to a more suitable place.

I think it's safe to say that the only part of kern/powerpc/ieee1275/init.c that only works on PowerPC is its name ;-)

Quoted 7 lines

Maybe it's time we move out those generic files under powerpc directory. I propose moving the following:

kern/powerpc/ieee1275/init.c
kern/powerpc/ieee1275/cmain.c
kern/powerpc/ieee1275/openfw.c
loader/powerpc/ieee1275/multiboot2.c

Move it where?

--
Marco

#7 lore raw

Re: GRUB_MOD_GAP for non-ieee1275 ELF platforms

In reply to Robert Millan
Quoted 7 lines · Robert Millan
Quoted 4 lines · Pavel Roskin
Quoted 1 line

What do you suggest?

I would prefer to have GRUB_MOD_GAP is all headers. Once it's not needed, it could be removed across the board.

Ok, does this seem fine?

Am I missing something, or didn't you explain what GRUB_MOD_GAP is supposed to do...? To be honest, I do not know what it is about.

--
Marco

#22 lore raw
In reply to Marco Gerards
Quoted 10 lines · Marco Gerards
Quoted 8 lines

Maybe it's time we move out those generic files under powerpc directory. I propose moving the following:

kern/powerpc/ieee1275/init.c
kern/powerpc/ieee1275/cmain.c
kern/powerpc/ieee1275/openfw.c
loader/powerpc/ieee1275/multiboot2.c

Move it where?

To s,powerpc/,,g

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
#8 lore raw

Re: GRUB_MOD_GAP for non-ieee1275 ELF platforms

In reply to Marco Gerards
Quoted 5 lines · Marco Gerards
Quoted 3 lines · Robert Millan
Quoted 2 lines · Pavel Roskin
Quoted 1 line

What do you suggest?

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

I would prefer to have GRUB_MOD_GAP is all headers. Once it's not needed, it could be removed across the board.

Ok, does this seem fine?

Am I missing something, or didn't you explain what GRUB_MOD_GAP is supposed to do...? To be honest, I do not know what it is about.

Pavel did. Check previous mails.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
#23 lore raw
In reply to Robert Millan
Quoted 5 lines · Robert Millan
Quoted 4 lines · Marco Gerards
Quoted 4 lines

Maybe it's time we move out those generic files under powerpc directory. I propose moving the following:

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

kern/powerpc/ieee1275/init.c
kern/powerpc/ieee1275/cmain.c
kern/powerpc/ieee1275/openfw.c
loader/powerpc/ieee1275/multiboot2.c

Move it where?

To s,powerpc/,,g

Fine for me...

It would be nice if we could switch to SVN or so soon. SVN is available on savannah and works almost the same as CVS. I know there are better systems to work with, but this is a no brainer I hope. Moving files is no fun with CVS :-(

What was the outcome of the previous discussions on this? All these threads explode with mails on which system is the best, because of that I ignore the thread and nothing happens... :-)

--
Marco

#24 lore raw

CVS (Re: Redefining GRUB_MOD_GAP in init.c)

Quoted 14 lines · Marco Gerards
Quoted 12 lines · Robert Millan
Quoted 10 lines · Marco Gerards
Quoted 8 lines

Maybe it's time we move out those generic files under powerpc directory. I propose moving the following:

kern/powerpc/ieee1275/init.c
kern/powerpc/ieee1275/cmain.c
kern/powerpc/ieee1275/openfw.c
loader/powerpc/ieee1275/multiboot2.c

Move it where?

Quoted 8 lines
Quoted 1 line

To s,powerpc/,,g

Fine for me...

It would be nice if we could switch to SVN or so soon. SVN is available on savannah and works almost the same as CVS. I know there are better systems to work with, but this is a no brainer I hope. Moving files is no fun with CVS :-(

I thought SVN wasn't (properly) supported by Savannah.

Quoted 3 lines

What was the outcome of the previous discussions on this? All these threads explode with mails on which system is the best, because of that I ignore the thread and nothing happens... :-)

Some people wanted GIT, and Okuji objected, following a long, boring discussion about the advantages and disadvantages of GIT.

I personaly think we should just ditch CVS, because CVS has these annoying limitations, but not try to do something fancy. SVN is the logical evolution of CVS, so why not just do that.

We can always switch to GIT in the future if/when everybody agrees.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
#9 lore raw

Re: GRUB_MOD_GAP for non-ieee1275 ELF platforms

In reply to Robert Millan
Quoted 9 lines · Robert Millan
Quoted 8 lines · Marco Gerards
Quoted 6 lines · Robert Millan
Quoted 4 lines · Pavel Roskin
Quoted 1 line

What do you suggest?

I would prefer to have GRUB_MOD_GAP is all headers. Once it's not needed, it could be removed across the board.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Ok, does this seem fine?

Am I missing something, or didn't you explain what GRUB_MOD_GAP is supposed to do...? To be honest, I do not know what it is about.

Pavel did. Check previous mails.

I just see him raising his concerns. Or do I have to look at some other thread?

--
Marco

#10 lore raw

Re: GRUB_MOD_GAP for non-ieee1275 ELF platforms

Quoted 13 lines · Marco Gerards
Quoted 11 lines · Robert Millan
Quoted 10 lines · Marco Gerards
Quoted 7 lines · Robert Millan
Quoted 4 lines · Pavel Roskin
Quoted 1 line

What do you suggest?

I would prefer to have GRUB_MOD_GAP is all headers. Once it's not needed, it could be removed across the board.

Ok, does this seem fine?

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Am I missing something, or didn't you explain what GRUB_MOD_GAP is supposed to do...? To be honest, I do not know what it is about.

Pavel did. Check previous mails.

I just see him raising his concerns. Or do I have to look at some other thread?

"Testing on PowerMac G4" for the long explanation. A short explanation was committed in a C comment before GRUB_MOD_GAP definition.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
#25 lore raw

Re: CVS (Re: Redefining GRUB_MOD_GAP in init.c)

In reply to Robert Millan
Quoted 17 lines · Robert Millan
Quoted 16 lines · Marco Gerards
Quoted 13 lines · Robert Millan
Quoted 10 lines · Marco Gerards
Quoted 8 lines

Maybe it's time we move out those generic files under powerpc directory. I propose moving the following:

kern/powerpc/ieee1275/init.c
kern/powerpc/ieee1275/cmain.c
kern/powerpc/ieee1275/openfw.c
loader/powerpc/ieee1275/multiboot2.c

Move it where?

To s,powerpc/,,g

Quoted 8 lines
Quoted 6 lines

Fine for me...

It would be nice if we could switch to SVN or so soon. SVN is available on savannah and works almost the same as CVS. I know there are better systems to work with, but this is a no brainer I hope. Moving files is no fun with CVS :-(

I thought SVN wasn't (properly) supported by Savannah.

I am not sure: http://savannah.gnu.org/svn/?group=phpgroupware

They seem to use it...

Quoted 6 lines
Quoted 3 lines

What was the outcome of the previous discussions on this? All these threads explode with mails on which system is the best, because of that I ignore the thread and nothing happens... :-)

Some people wanted GIT, and Okuji objected, following a long, boring discussion about the advantages and disadvantages of GIT.

Yes, other people want bzr, others want bzr, etc, etc. I do not care. This way we never switch, which is even worse.

Quoted 3 lines

I personaly think we should just ditch CVS, because CVS has these annoying limitations, but not try to do something fancy. SVN is the logical evolution of CVS, so why not just do that.

That's exactly what I was thinking ;-). I was bothered by the limitation. And that we cannot discuss changing to svn first :-)

So what now?

Quoted 1 line

We can always switch to GIT in the future if/when everybody agrees.

Right!

--
Marco

#27 lore raw

Re: CVS (Re: Redefining GRUB_MOD_GAP in init.c)

In reply to Robert Millan

Robert Millan <[email protected]> writes:

[...]

Quoted 3 lines

I personaly think we should just ditch CVS, because CVS has these annoying limitations, but not try to do something fancy. SVN is the logical evolution of CVS, so why not just do that.

GNU Arch is supported already:
https://savannah.gnu.org/maintenance/GNUArch

It seems subversion is not officially supported yet:
https://savannah.gnu.org/maintenance/WhenSvN

--
Marco

#26 lore raw

Re: CVS (Re: Redefining GRUB_MOD_GAP in init.c)

In reply to Marco Gerards
Quoted 5 lines · Marco Gerards
Quoted 1 line

I thought SVN wasn't (properly) supported by Savannah.

I am not sure: http://savannah.gnu.org/svn/?group=phpgroupware

They seem to use it...

All I can say is that SVN does not appear in the feature list.

Quoted 2 lines

That's exactly what I was thinking ;-). I was bothered by the limitation. And that we cannot discuss changing to svn first :-)

I've never objected to SVN. The only problem is that Savannah does not still support it (officially, at least).

Okuji

#28 lore raw

Re: CVS (Re: Redefining GRUB_MOD_GAP in init.c)

In reply to Marco Gerards
Quoted 8 lines · Marco Gerards

Robert Millan <[email protected]> writes:

[...]

Quoted 3 lines

I personaly think we should just ditch CVS, because CVS has these annoying limitations, but not try to do something fancy. SVN is the logical evolution of CVS, so why not just do that.

Quoted 5 lines

GNU Arch is supported already:
https://savannah.gnu.org/maintenance/GNUArch

It seems subversion is not officially supported yet:
https://savannah.gnu.org/maintenance/WhenSvN

Sorry for being late to the discussion. Subversion is clearly superior to CVS, but the difference between CVS and Subversion in terms of project organization is insignificant, at least for a project like GRUB.

Considering that Subversion is not supported by Savannah, I think it's not worth it to move the repository to another site just to use Subversion.

A commit that moves a file from one place to another will be understood by the converters as a move.

As for git, I made a mirror at git://repo.or.cz/grub2.git that is
updated by a cron job every 2 hours. I make all my patches in my local
git repository.

git can import from Subversion too.

Signature · 2 lines
Regards,
Pavel Roskin
#11 lore raw

Re: GRUB_MOD_GAP for non-ieee1275 ELF platforms

In reply to Marco Gerards
Quoted 5 lines · Marco Gerards
Quoted 3 lines · Robert Millan
Quoted 2 lines · Pavel Roskin
Quoted 1 line

What do you suggest?

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

I would prefer to have GRUB_MOD_GAP is all headers. Once it's not needed, it could be removed across the board.

Ok, does this seem fine?

Am I missing something, or didn't you explain what GRUB_MOD_GAP is supposed to do...? To be honest, I do not know what it is about.

If it's not there, PowerMac OpenFirmware would not load the grub image made by grub-mkimage. Instead, it will report "CLAIM failed".

The modules use to be loaded at 3 Mb. Then they were moved directly after the core (kernel.elf), which created the problem. Search for the shortest gap that doesn't result in "CLAIM failed" indicated that it's 0x8000 (32k). I tried adding more code to kernel.elf, and the gap of 32k was still sufficient.

I assume that if the result of grub-mkimage is a valid ELF file, like kernel.elf, "CLAIM failed" would not happen.

Signature · 2 lines
Regards,
Pavel Roskin
#12 lore raw

Re: GRUB_MOD_GAP for non-ieee1275 ELF platforms

Quoted 3 lines · Pavel Roskin

I assume that if the result of grub-mkimage is a valid ELF file, like kernel.elf, "CLAIM failed" would not happen.

But you don't have to assume. Did you try booting kernel.elf directly?

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
#13 lore raw

Re: GRUB_MOD_GAP for non-ieee1275 ELF platforms

Quoted 6 lines · Robert Millan
Quoted 3 lines · Pavel Roskin

I assume that if the result of grub-mkimage is a valid ELF file, like kernel.elf, "CLAIM failed" would not happen.

But you don't have to assume. Did you try booting kernel.elf directly?

Yes. It was fine. No "CLAIM failed".

The only problem is that is was useless because it could not load any module without "apple" and "hfs".

I only said "I assume" because there is a subtle difference between a "valid ELF file" and "indistinguishable for kernel.elf". It should be valid and acceptable to the OpenFirmware, and the later is a black box to me.

Signature · 2 lines
Regards,
Pavel Roskin
#14 lore raw

Re: GRUB_MOD_GAP for non-ieee1275 ELF platforms

Quoted 11 lines · Pavel Roskin
Quoted 6 lines · Robert Millan
Quoted 3 lines · Pavel Roskin

I assume that if the result of grub-mkimage is a valid ELF file, like kernel.elf, "CLAIM failed" would not happen.

But you don't have to assume. Did you try booting kernel.elf directly?

Yes. It was fine. No "CLAIM failed".

Quoted 7 lines

The only problem is that is was useless because it could not load any module without "apple" and "hfs".

I only said "I assume" because there is a subtle difference between a "valid ELF file" and "indistinguishable for kernel.elf". It should be valid and acceptable to the OpenFirmware, and the later is a black box to me.

Uhm.. I wonder what'd happen if you pre-link all the stuff into kernel.elf.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
#15 lore raw

Re: GRUB_MOD_GAP for non-ieee1275 ELF platforms

Quoted 6 lines · Robert Millan
Quoted 4 lines

I only said "I assume" because there is a subtle difference between a "valid ELF file" and "indistinguishable for kernel.elf". It should be valid and acceptable to the OpenFirmware, and the later is a black box to me.

Uhm.. I wonder what'd happen if you pre-link all the stuff into kernel.elf.

I tried to prelink "apple" and "hfs" by changing the makefiles. The functionality wasn't available. It makes sense, because the core doesn't know that the modules are linked. The modules are never registered with the core.

It would be nice to have some linker trick to tell the code about the prelinked modules. That could make grub-mkimage a very thin wrapper around "ld -r", perhaps written as a shell script.

Signature · 2 lines
Regards,
Pavel Roskin
#16 lore raw

Re: GRUB_MOD_GAP for non-ieee1275 ELF platforms

Quoted 8 lines · Pavel Roskin
Quoted 6 lines · Robert Millan
Quoted 4 lines

I only said "I assume" because there is a subtle difference between a "valid ELF file" and "indistinguishable for kernel.elf". It should be valid and acceptable to the OpenFirmware, and the later is a black box to me.

Uhm.. I wonder what'd happen if you pre-link all the stuff into kernel.elf.

Quoted 8 lines

I tried to prelink "apple" and "hfs" by changing the makefiles. The functionality wasn't available. It makes sense, because the core doesn't know that the modules are linked. The modules are never registered with the core.

It would be nice to have some linker trick to tell the code about the prelinked modules. That could make grub-mkimage a very thin wrapper around "ld -r", perhaps written as a shell script.

We have a trick for grub-emu, a list of init functions that have to be called is created, a function that does this is created and it is called when grub-emu is started.

You could do this manually when testing.

--
Marco

#17 lore raw

Re: GRUB_MOD_GAP for non-ieee1275 ELF platforms

In reply to Pavel Roskin
Quoted 6 lines · Pavel Roskin
Quoted 5 lines · Robert Millan
Quoted 4 lines

I only said "I assume" because there is a subtle difference between a "valid ELF file" and "indistinguishable for kernel.elf". It should be valid and acceptable to the OpenFirmware, and the later is a black box to me.

Quoted 6 lines
Quoted 1 line

Uhm.. I wonder what'd happen if you pre-link all the stuff into kernel.elf.

I tried to prelink "apple" and "hfs" by changing the makefiles. The functionality wasn't available. It makes sense, because the core doesn't know that the modules are linked. The modules are never registered with the core.

You can easily work around that by removing the GRUB_MOD_INIT() wrap and calling the functions manually.

However, to determine if the "CLAIM failed" problem also affects "sane" elven, you don't need to initialize these modules, just link them in.

Quoted 3 lines

It would be nice to have some linker trick to tell the code about the prelinked modules. That could make grub-mkimage a very thin wrapper around "ld -r", perhaps written as a shell script.

Sure it would. Shouldn't be too hard, geninit.sh does half of what you want already.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
#18 lore raw

Re: GRUB_MOD_GAP for non-ieee1275 ELF platforms

Quoted 6 lines · Robert Millan
Quoted 3 lines

It would be nice to have some linker trick to tell the code about the prelinked modules. That could make grub-mkimage a very thin wrapper around "ld -r", perhaps written as a shell script.

Sure it would. Shouldn't be too hard, geninit.sh does half of what you want already.

What does it mean? Do you want to use ld from grub-mkimage?

Okuji

#19 lore raw

Re: GRUB_MOD_GAP for non-ieee1275 ELF platforms

Quoted 9 lines · Yoshinori K. Okuji
Quoted 6 lines · Robert Millan
Quoted 3 lines

It would be nice to have some linker trick to tell the code about the prelinked modules. That could make grub-mkimage a very thin wrapper around "ld -r", perhaps written as a shell script.

Sure it would. Shouldn't be too hard, geninit.sh does half of what you want already.

What does it mean? Do you want to use ld from grub-mkimage?

No, not grub-mkimage. We were talking about the possibility that a C file can be used as a module or linked in kernel.elf just by changing the makefiles, without need to modify the code itself (to get grub_foo_init() working).

(Note that, ia64 patch just submitted uses ld in grub-install; have a look if you're concerned about that)

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
#20 lore raw

Re: GRUB_MOD_GAP for non-ieee1275 ELF platforms

Quoted 11 lines · Robert Millan
Quoted 9 lines · Yoshinori K. Okuji
Quoted 6 lines · Robert Millan
Quoted 3 lines

It would be nice to have some linker trick to tell the code about the prelinked modules. That could make grub-mkimage a very thin wrapper around "ld -r", perhaps written as a shell script.

Sure it would. Shouldn't be too hard, geninit.sh does half of what you want already.

What does it mean? Do you want to use ld from grub-mkimage?

Quoted 7 lines

No, not grub-mkimage. We were talking about the possibility that a C file can be used as a module or linked in kernel.elf just by changing the makefiles, without need to modify the code itself (to get grub_foo_init() working).

(Note that, ia64 patch just submitted uses ld in grub-install; have a look if you're concerned about that)

Ah, ok. Understood. :)

Thanks,
Okuji