Skip to contentSkip to conversation

grub2 multiboot for ppc and system initalization

PATCH Noah yan 3 participants 8 messages Dec 30, 2005 – Dec 31, 2005

lore
Share & tools
lore

Noah yan

author
#0 lore raw

Hi, All

I am glad that I have finally made the grub2 multiboot for ppc working. It is based on Hollis' earlier work (
http://lists.gnu.org/archive/html/grub-devel/2005-06/msg00049.html) . Hollis' hello world example works for my building environment and system, which is Mandrake Linux (2.6.11) on Power Mac G4. A patch is attached for grub 1.92 release. The patch also includes the util/powerpc/ieee1275/grub- install.in file, which is missed in 1.92 release (but in cvs checkout). I have trouble to create the patch by cvs diff, so to apply it, you may have to use "patch -p1" under the grub2 folder.

grub2 is really great and it is very easy to write a module that loads a kernel and jump to it for run.

As in x86 and sparc, the multiboot strap is basically not the real kernel, but a loader to load ramdisk and initializer of system before exitto unix module. Here comes several choices about the system initialization:

1. should the multiboot strap trust the multiboot_info passed from grub? x86 multiboot only use the cmdline of it and multiboot is changing as from grub developers. If use it, it may save some coding efforts.

2. if multiboot strap collect system information by itself, should it use GRUB ieee1275 functions or Solaris's own code(mainly in psm/promif/ieee1275, but would have to port to ppc). Using Grub2's code saves efforts to port Solaris code.

3. grub2 network is not available (Marco planned to work on it on Feb as posted from grub wiki), shall we port the solaris network stack (src/stand/lib) for grub or wait?

4. Finally, should the boot strap be independent from Grub? so that it can be loaded by other loaders, such as yaboot?

5. Does a user allowed to get back to open firmware prompt (like sparc Stop
+ A key), or grub prompt after system is up? this feature may be used for file system synchronization or core dumping after system hang. (this does not matter in current stage, doe it :)

In summary, what is the role the grub should play in booing and system initialization, only as a loader, or a loader and system utilities that help system booting and other purpose? In Solaris x86, I only found the cmdline of multiboot_info is used by the multiboot strap.

Thanks for reading through this and hope that some of them are important and worthwhile to discuss.
Noah Yan

conf/powerpc-ieee1275.rmk +11 -1
diff -r -u -p -N grub-1.92/conf/powerpc-ieee1275.rmk grub-1.92ppcmtb/conf/powerpc-ieee1275.rmk
@@ -86,7 +86,9 @@ pkgdata_MODULES = halt.mod \
 	linux.mod \
 	normal.mod \
 	reboot.mod \
-	suspend.mod
+	suspend.mod \
+	_multiboot.mod \
+	multiboot.mod
 
 # For _linux.mod.
 _linux_mod_SOURCES = loader/powerpc/ieee1275/linux.c
@@ -117,4 +119,12 @@ reboot_mod_CFLAGS = $(COMMON_CFLAGS)
 halt_mod_SOURCES = commands/ieee1275/halt.c
 halt_mod_CFLAGS = $(COMMON_CFLAGS)
 
+# For _mulitboot.mod
+_multiboot_mod_SOURCES = loader/powerpc/ieee1275/multiboot.c
+_multiboot_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For multiboot.mod
+multiboot_mod_SOURCES = loader/powerpc/ieee1275/multiboot_normal.c
+multiboot_mod_CFLAGS = $(COMMON_CFLAGS)
+
 include $(srcdir)/conf/common.mk
include/grub/powerpc/ieee1275/loader.h +4 -0
diff -r -u -p -N grub-1.92/include/grub/powerpc/ieee1275/loader.h grub-1.92ppcmtb/include/grub/powerpc/ieee1275/loader.h
@@ -30,4 +30,8 @@ void grub_linux_fini (void);
 void grub_linux_normal_init (void);
 void grub_linux_normal_fini (void);
 
+/* for multiboot powerpc */
+void grub_rescue_cmd_multiboot (int argc, char *argv[]);
+void grub_rescue_cmd_module (int argc, char *argv[]);
+
 #endif /* ! GRUB_LOADER_MACHINE_HEADER */
loader/powerpc/ieee1275/multiboot.c +397 -0

397 lines not on this page · raw message

loader/powerpc/ieee1275/multiboot_normal.c +65 -0

65 lines not on this page · raw message

util/powerpc/ieee1275/grub-install.in +189 -0

189 lines not on this page · raw message

#1 lore raw

Noah yan <[email protected]> writes:

Hi Noah,

Quoted 9 lines

I am glad that I have finally made the grub2 multiboot for ppc working. It is based on Hollis' earlier work (
http://lists.gnu.org/archive/html/grub-devel/2005-06/msg00049.html) . Hollis' hello world example works for my building environment and system, which is Mandrake Linux (2.6.11) on Power Mac G4. A patch is attached for grub 1.92 release. The patch also includes the util/powerpc/ieee1275/grub- install.in file, which is missed in 1.92 release (but in cvs checkout). I have trouble to create the patch by cvs diff, so to apply it, you may have to use "patch -p1" under the grub2 folder.

Cool, but I wonder if it can be applied. Mainly because it is most likely not multiboot compliant because multiboot is x86 only, or am I misunderstanding something?

Quoted 3 lines

As in x86 and sparc, the multiboot strap is basically not the real kernel, but a loader to load ramdisk and initializer of system before exitto unix module. Here comes several choices about the system initialization:

Can you explain that? Usually the kernel loaded by multiboot *is* a real kernel. So I don't understand what you mean. Perhaps you are confused by a single implementation.

Quoted 3 lines

1. should the multiboot strap trust the multiboot_info passed from grub? x86 multiboot only use the cmdline of it and multiboot is changing as from grub developers. If use it, it may save some coding efforts.

Can you please elaborate?

Quoted 4 lines

2. if multiboot strap collect system information by itself, should it use GRUB ieee1275 functions or Solaris's own code(mainly in psm/promif/ieee1275, but would have to port to ppc). Using Grub2's code saves efforts to port Solaris code.

Please explain what you mean with multiboot strap. It certainly isn't GRUB related terminology I have heard of.

Quoted 3 lines

3. grub2 network is not available (Marco planned to work on it on Feb as posted from grub wiki), shall we port the solaris network stack (src/stand/lib) for grub or wait?

Please wait and who is we?

Quoted 4 lines

In summary, what is the role the grub should play in booing and system initialization, only as a loader, or a loader and system utilities that help system booting and other purpose? In Solaris x86, I only found the cmdline of multiboot_info is used by the multiboot strap.

It's the loader. I am not sure about what you are saying, but GRUB certainly does not provide run time services to kernels or so.

Unfortunately I fail to understand a big part of your email. Can you please describe which project you are working on and what you are trying to accomplish? And please use the terminology we are used to, otherwise it is hard to understand you.

--
Marco

#2 lore raw
Quoted 8 lines
Quoted 4 lines

As in x86 and sparc, the multiboot strap is basically not the real kernel, but a loader to load ramdisk and initializer of system before exitto unix module. Here comes several choices about the system initialization:

Can you explain that? Usually the kernel loaded by multiboot *is* a real kernel. So I don't understand what you mean. Perhaps you are confused by a single implementation.

I think Noah is talking about Solaris x86. Indeed Solaris x86 provides multiboot compliant program which is not a real kernel, but rather an aux module which assembles the kernel from the archive loaded by GRUB. Anyway, that is a "single implementation" case.

Quoted 5 lines
Quoted 3 lines

3. grub2 network is not available (Marco planned to work on it on Feb as posted from grub wiki), shall we port the solaris network stack (src/stand/lib) for grub or wait?

Please wait and who is we?

I believe that "we" would be Solaris/PPC developers. Some of us are on this list.

--
Regards,
Cyril

#3 lore raw
Quoted 5 lines · Cyril Plisko
Quoted 5 lines
Quoted 4 lines

As in x86 and sparc, the multiboot strap is basically not the real kernel, but a loader to load ramdisk and initializer of system before exitto unix module. Here comes several choices about the system initialization:

Quoted 8 lines
Quoted 3 lines

Can you explain that? Usually the kernel loaded by multiboot *is* a real kernel. So I don't understand what you mean. Perhaps you are confused by a single implementation.

I think Noah is talking about Solaris x86. Indeed Solaris x86 provides multiboot compliant program which is not a real kernel, but rather an aux module which assembles the kernel from the archive loaded by GRUB. Anyway, that is a "single implementation" case.

Oh, I see. But this is not the case for other kernels. For example the Hurd loads GNU Mach as the kernel and passes some modules which are used as userspace servers. Most other multiboot kernels have a similar approach. But for example the Hurd on L4 takes a different approach.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

3. grub2 network is not available (Marco planned to work on it on Feb as posted from grub wiki), shall we port the solaris network stack (src/stand/lib) for grub or wait?

Please wait and who is we?

I believe that "we" would be Solaris/PPC developers. Some of us are on this list.

Oh, ok... Nice to have you folks around. :-)

--
Marco

author
#4 lore raw
In reply to Marco Gerards

Hi, Macro,

Sorry for some confusion, some clearification below.

Quoted 16 lines · Marco Gerards

Noah yan <[email protected]> writes:

Hi Noah,

Quoted 1 line

I am glad that I have finally made the grub2 multiboot for ppc working.

It

Quoted 3 lines

is based on Hollis' earlier work (
http://lists.gnu.org/archive/html/grub-devel/2005-06/msg00049.html) . Hollis' hello world example works for my building environment and

system,

Quoted 1 line

which is Mandrake Linux (2.6.11) on Power Mac G4. A patch is attached

for

Quoted 1 line

grub 1.92 release. The patch also includes the

util/powerpc/ieee1275/grub-

Quoted 1 line

install.in file, which is missed in 1.92 release (but in cvs checkout).

Quoted 8 lines

I

Quoted 1 line

have trouble to create the patch by cvs diff, so to apply it, you may

have

Quoted 1 line

to use "patch -p1" under the grub2 folder.

Cool, but I wonder if it can be applied. Mainly because it is most likely not multiboot compliant because multiboot is x86 only, or am I misunderstanding something?

Yes, you are right, multiboot for ppc is not exactly correct concerning about the multiboot specification.
What I mean something-compliant is mainly an agreement between a loader and the code being loaded(kernel in most cases). The patch is created mainly based on multiboot protocol, so we steal the term "multiboot compliant".

Quoted 8 lines

As in x86 and sparc, the multiboot strap is basically not the real kernel,

Quoted 1 line

but a loader to load ramdisk and initializer of system before exitto

unix

Quoted 1 line

module. Here comes several choices about the system initialization:

Can you explain that? Usually the kernel loaded by multiboot *is* a real kernel. So I don't understand what you mean. Perhaps you are confused by a single implementation.

I think Cyril explains this. I consider grub for solaris x86 is a (not good) solution to migrate current x86 solaris to use grub (other than chainloader). Thanks for providing the Hurd example.

Quoted 7 lines

1. should the multiboot strap trust the multiboot_info passed from grub? x86

Quoted 1 line

multiboot only use the cmdline of it and multiboot is changing as from

grub

Quoted 1 line

developers. If use it, it may save some coding efforts.

Can you please elaborate?

As specified in the multiboot spec, os can use or ignore the multiboot_info passed from the loader. So here should the Solaris/ppc use the multiboot-info or not. In current Solaris x86 multiboot, as far as I check out, the kernel code only use the cmdline field, and collect other info (such as mem region, etc) by itself. Use the loader info saves porting efforts.

Concerning about the multiboot, I just have such a impression that multiboot spec may be upgraded as I reading through the grub wiki and mailinglist as the progress towards ppc and sparc of grub.

Quoted 8 lines

2. if multiboot strap collect system information by itself, should it use

Quoted 1 line

GRUB ieee1275 functions or Solaris's own code(mainly in

psm/promif/ieee1275,

Quoted 2 lines

but would have to port to ppc). Using Grub2's code saves efforts to port Solaris code.

Please explain what you mean with multiboot strap. It certainly isn't GRUB related terminology I have heard of.

Hope that you already understand what I mean after Cyril's answer. It is a multiboot compliant code loaded by grub and it loads the real os kernel. It is a solution to migrate some os to use grub. It is strange to me too(why not just chainloader), but it is used in this way in some cases.

Quoted 8 lines

3. grub2 network is not available (Marco planned to work on it on Feb as

Quoted 2 lines

posted from grub wiki), shall we port the solaris network stack (src/stand/lib) for grub or wait?

Please wait and who is we?

In summary, what is the role the grub should play in booing and system

Quoted 8 lines
Quoted 1 line

initialization, only as a loader, or a loader and system utilities that

help

Quoted 1 line

system booting and other purpose? In Solaris x86, I only found the

cmdline

Quoted 1 line

of multiboot_info is used by the multiboot strap.

It's the loader. I am not sure about what you are saying, but GRUB certainly does not provide run time services to kernels or so.

Unfortunately I fail to understand a big part of your email. Can you

Quoted 3 lines

please describe which project you are working on and what you are trying to accomplish? And please use the terminology we are used to, otherwise it is hard to understand you.

I am working on porting solaris to ppc, and the loader is grub. I am sorry for any confusion and it is sometimes hard for me to find the right terms (my poor english). I wrote mainly for solaris-ppc port and CCed to grub mainly for people interested in ppc loader (the first part of the mail).

Noah

--
Marco

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

#5 lore raw
Quoted 9 lines · Noah yan
Quoted 3 lines

Cool, but I wonder if it can be applied. Mainly because it is most likely not multiboot compliant because multiboot is x86 only, or am I misunderstanding something?

Yes, you are right, multiboot for ppc is not exactly correct concerning about the multiboot specification.
What I mean something-compliant is mainly an agreement between a loader and the code being loaded(kernel in most cases). The patch is created mainly based on multiboot protocol, so we steal the term "multiboot compliant".

Right. Have you considered just waiting for multiboot 2 instead of using a standard that is not a standard? I assume multiboot 2 will be there in some months or so...

Quoted 9 lines
Quoted 7 lines

1. should the multiboot strap trust the multiboot_info passed from grub? x86

Quoted 1 line

multiboot only use the cmdline of it and multiboot is changing as from

grub

Quoted 1 line

developers. If use it, it may save some coding efforts.

Can you please elaborate?

Quoted 6 lines

As specified in the multiboot spec, os can use or ignore the multiboot_info passed from the loader. So here should the Solaris/ppc use the multiboot-info or not. In current Solaris x86 multiboot, as far as I check out, the kernel code only use the cmdline field, and collect other info (such as mem region, etc) by itself. Use the loader info saves porting efforts.

Oh, right. It is something we can think about for multiboot 2. The main idea behind multiboot is providing information the kernel can not get in another sane way or do things otherwise not really possible. So that is what you have to keep in mind.

Quoted 3 lines

Concerning about the multiboot, I just have such a impression that multiboot spec may be upgraded as I reading through the grub wiki and mailinglist as the progress towards ppc and sparc of grub.

The plan is to introduce a new multiboot. This new standard should be better and portable. It's something that is actively being worked on.

Quoted 6 lines
Quoted 6 lines

2. if multiboot strap collect system information by itself, should it use

Quoted 1 line

GRUB ieee1275 functions or Solaris's own code(mainly in

psm/promif/ieee1275,

Quoted 2 lines

but would have to port to ppc). Using Grub2's code saves efforts to port Solaris code.

Quoted 7 lines
Quoted 2 lines

Please explain what you mean with multiboot strap. It certainly isn't GRUB related terminology I have heard of.

Hope that you already understand what I mean after Cyril's answer. It is a multiboot compliant code loaded by grub and it loads the real os kernel. It is a solution to migrate some os to use grub. It is strange to me too(why not just chainloader), but it is used in this way in some cases.

Ok.

Quoted 9 lines

Unfortunately I fail to understand a big part of your email. Can you

Quoted 3 lines

please describe which project you are working on and what you are trying to accomplish? And please use the terminology we are used to, otherwise it is hard to understand you.

I am working on porting solaris to ppc, and the loader is grub. I am sorry for any confusion and it is sometimes hard for me to find the right terms (my poor english). I wrote mainly for solaris-ppc port and CCed to grub mainly for people interested in ppc loader (the first part of the mail).

Don't worry about your English. For most people on this list, including myself, English is not the native language.

If you really have requirements for the new multiboot or problems with GRUB 2, please tell us. :-)

--
Marco

author
#6 lore raw
Quoted 10 lines · Marco Gerards
Quoted 7 lines · Noah yan
Quoted 3 lines

Cool, but I wonder if it can be applied. Mainly because it is most likely not multiboot compliant because multiboot is x86 only, or am I misunderstanding something?

Yes, you are right, multiboot for ppc is not exactly correct concerning about the multiboot specification.
What I mean something-compliant is mainly an agreement between a loader

Quoted 7 lines

and

Quoted 2 lines

the code being loaded(kernel in most cases). The patch is created mainly based on multiboot protocol, so we steal the term "multiboot compliant".

Right. Have you considered just waiting for multiboot 2 instead of using a standard that is not a standard? I assume multiboot 2 will be there in some months or so...

currently, it is enough that grub2 can load a kernel and jump to it (whether multiboot or not), saving efforts for coding in low-level devices, fs and open firmware. When grub2 and multiboot is ready, we definitely want to make it multiboot compliant. we also hope that network support is available in grub2 soon.

This is just my thoughts, and other guys from polaris developers may have other comments.

Quoted 16 lines
Quoted 1 line
Quoted 1 line

1. should the multiboot strap trust the multiboot_info passed from

grub?

Quoted 2 lines
Quoted 2 lines

x86

Quoted 1 line

multiboot only use the cmdline of it and multiboot is changing as

from

Quoted 7 lines
Quoted 4 lines

grub

Quoted 1 line

developers. If use it, it may save some coding efforts.

Can you please elaborate?

As specified in the multiboot spec, os can use or ignore the

multiboot_info

Quoted 2 lines

passed from the loader. So here should the Solaris/ppc use the multiboot-info or not. In current Solaris x86 multiboot, as far as I

check

Quoted 8 lines
Quoted 3 lines

out, the kernel code only use the cmdline field, and collect other info (such as mem region, etc) by itself. Use the loader info saves porting efforts.

Oh, right. It is something we can think about for multiboot 2. The main idea behind multiboot is providing information the kernel can not get in another sane way or do things otherwise not really possible. So that is what you have to keep in mind.

That is good, but to use them will make the kernel not to be loaded by other non-multiboot loader (I am not 100% confident of this comment). So in multiboot standard, it would be great that the mulitboot-compliant kernel can be standardalone (if posibble).

Quoted 13 lines

Concerning about the multiboot, I just have such a impression that multiboot

Quoted 1 line

spec may be upgraded as I reading through the grub wiki and mailinglist

as

Quoted 1 line

the progress towards ppc and sparc of grub.

The plan is to introduce a new multiboot. This new standard should be better and portable. It's something that is actively being worked on.

Quoted 4 lines

2. if multiboot strap collect system information by itself, should it use

Quoted 1 line

GRUB ieee1275 functions or Solaris's own code(mainly in

psm/promif/ieee1275,

Quoted 1 line

but would have to port to ppc). Using Grub2's code saves efforts to

port

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Solaris code.

Please explain what you mean with multiboot strap. It certainly isn't GRUB related terminology I have heard of.

Hope that you already understand what I mean after Cyril's answer. It is a multiboot compliant code loaded by grub and it loads the real os kernel.

It

Quoted 2 lines

is a solution to migrate some os to use grub. It is strange to me too(why not just chainloader), but it is used in this way in some cases.

Ok.

Quoted 9 lines

Unfortunately I fail to understand a big part of your email. Can you

Quoted 3 lines

please describe which project you are working on and what you are trying to accomplish? And please use the terminology we are used to, otherwise it is hard to understand you.

I am working on porting solaris to ppc, and the loader is grub. I am sorry for any confusion and it is sometimes hard for me to find the right terms (my poor english). I wrote mainly for solaris-ppc port and CCed to grub mainly for people interested in ppc loader (the first part of the mail).

Don't worry about your English. For most people on this list, including myself, English is not the native language.

If you really have requirements for the new multiboot or problems with GRUB 2, please tell us. :-)

Hum, I do have problems and questions currently. I tried to cross-compile the grub2 on a solaris x86 for ppc architecture and cannot make it. It seems that some codes use standard system and libc headers that cause the compilig fail. I clean some of them (such as stdint.h to types.h, alloca.hto grub_alloca.h), but I cannot clean the code that is generated by yacc on
normal.py, so is grub2 going to clean up those usage?

On my mahcine(PowerMac G4) that have two IDE disks, the grub ls command lists some devices, such as ide@, (hd,0), ... (hd, 5), (ultra0,0), ... (ultra0, 5), (ultra1, 0), (ultra1, 1), .... and I can access the "hd" device and fs (they are ext2), but I cannot access the second one, which has a Solaris2 partiton with solaris disklabel, is the ultra1 the second disk in the list output? Is the solaris disk label supported currently so that I can access via something like (hd1, 0, a)?

Thanks very much
Noah

--
Marco

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

#7 lore raw
Quoted 9 lines · Noah yan
Quoted 3 lines

Right. Have you considered just waiting for multiboot 2 instead of using a standard that is not a standard? I assume multiboot 2 will be there in some months or so...

currently, it is enough that grub2 can load a kernel and jump to it (whether multiboot or not), saving efforts for coding in low-level devices, fs and open firmware. When grub2 and multiboot is ready, we definitely want to make it multiboot compliant. we also hope that network support is available in grub2 soon.

Both are actively being worked on. Both can take some time.

Quoted 2 lines

This is just my thoughts, and other guys from polaris developers may have other comments.

Sure, they can tell us. Although I have no idea what the differences between the projects are.

Quoted 9 lines
Quoted 4 lines

Oh, right. It is something we can think about for multiboot 2. The main idea behind multiboot is providing information the kernel can not get in another sane way or do things otherwise not really possible. So that is what you have to keep in mind.

That is good, but to use them will make the kernel not to be loaded by other non-multiboot loader (I am not 100% confident of this comment). So in multiboot standard, it would be great that the mulitboot-compliant kernel can be standardalone (if posibble).

Agreed, if something can be implemented according to the standard it should work on other implementations of the standard. If one portion of the standard can be interpreted in multiple ways, the section should be clarified. But for now we just have to wait for the standard because it does not exist yet. ;-)

Quoted 10 lines

If you really have requirements for the new multiboot or problems with GRUB 2, please tell us. :-)

Hum, I do have problems and questions currently. I tried to cross-compile the grub2 on a solaris x86 for ppc architecture and cannot make it. It seems that some codes use standard system and libc headers that cause the compilig fail. I clean some of them (such as stdint.h to types.h, alloca.hto grub_alloca.h), but I cannot clean the code that is generated by yacc on
normal.py, so is grub2 going to clean up those usage?

How did you cross-compile? If it is the bison code, I'll certainly have a look at it. I usually use cross-compiling myself, although I need to setup a new cross-compiler again...

Quoted 7 lines

On my mahcine(PowerMac G4) that have two IDE disks, the grub ls command lists some devices, such as ide@, (hd,0), ... (hd, 5), (ultra0,0), ... (ultra0, 5), (ultra1, 0), (ultra1, 1), .... and I can access the "hd" device and fs (they are ext2), but I cannot access the second one, which has a Solaris2 partiton with solaris disklabel, is the ultra1 the second disk in the list output? Is the solaris disk label supported currently so that I can access via something like (hd1, 0, a)?

Right, I see the issue. Solaris disk labels are supported AFAIK, but not recursively. I think there are many similar examples just like this one. I will add this to the todo list so we will not forget about this. It is important to do this in a generic way... I'll contact you about this later, but my todo is a bit full now. ;-)

--
Marco