Skip to contentSkip to conversation

set prefix on PPC

PATCH Hollis Blanchard 2 participants 5 messages Apr 14, 2005 – Apr 17, 2005

lore
Share & tools
lore
#0 lore raw

Marco, I believe I addressed all your comments in my mail on 23 Feb 2005. I have implemented your suggestions, with the exception of checking the device node property lengths, as this requires modifying many callers elsewhere in the code.

I will commit this in a couple days if I don't hear any complaints.

-Hollis

2005-02-13 Hollis Blanchard <[email protected]>

	* include/grub/powerpc/ieee1275/ieee1275.h
	(grub_ieee1275_get_dev_encoding): New prototype.
	(grub_ieee1275_get_filename): Likewise.
	* kern/powerpc/ieee1275/init.c (grub_translate_ieee175_path): New
	function.
	(grub_set_prefix): Likewise.
	(grub_machine_init): Call grub_set_prefix.
	* kern/powerpc/ieee1275/openfw.c (grub_parse_type): New
	enum.
	(grub_ieee1275_get_devargs): New function.
	(grub_ieee1275_get_devname): Likewise.
	(grub_ieee1275_parse_args): Likewise.
	(grub_ieee1275_get_filename): Likewise.
	(grub_ieee1275_get_dev_encoding): Likewise.

Index: include/grub/powerpc/ieee1275/ieee1275.h
===================================================================
RCS file: /cvsroot/grub/grub2/include/grub/powerpc/ieee1275/ieee1275.h,v retrieving revision 1.15

grub/powerpc/ieee1275/ieee1275.h +2 -0
diff -u -p -r1.15 ieee1275.h
@@ -134,5 +134,7 @@ void EXPORT_FUNC(abort) (void);
 void EXPORT_FUNC (grub_reboot) (void);
 void EXPORT_FUNC (grub_halt) (void);
 
+char *EXPORT_FUNC(grub_ieee1275_get_dev_encoding) (const char *path);
+char *EXPORT_FUNC(grub_ieee1275_get_filename) (const char *path);
 
 #endif /* ! GRUB_IEEE1275_MACHINE_HEADER */

Index: kern/powerpc/ieee1275/init.c
===================================================================
RCS file: /cvsroot/grub/grub2/kern/powerpc/ieee1275/init.c,v retrieving revision 1.14

powerpc/ieee1275/init.c +63 -1

76 lines not on this page · raw message

Index: kern/powerpc/ieee1275/openfw.c
===================================================================
RCS file: /cvsroot/grub/grub2/kern/powerpc/ieee1275/openfw.c,v retrieving revision 1.8

powerpc/ieee1275/openfw.c +139 -1

158 lines not on this page · raw message

Index: loader/powerpc/ieee1275/linux.c
===================================================================
RCS file: /cvsroot/grub/grub2/loader/powerpc/ieee1275/linux.c,v retrieving revision 1.6

powerpc/ieee1275/linux.c +1 -1
diff -u -p -r1.6 linux.c
@@ -55,7 +55,7 @@ grub_linux_boot (void)
   /* Set the command line arguments.  */
   grub_ieee1275_set_property (chosen, "bootargs", linux_args,
 			      grub_strlen (linux_args) + 1, &actual);
-  
+
   /* Boot the kernel.  */
   linuxmain = (kernel_entry_t) linux_addr;
   linuxmain ((void *) initrd_addr, initrd_size, grub_ieee1275_entry_fn, 0, 0);
#1 lore raw
Quoted 4 lines · Hollis Blanchard

Marco, I believe I addressed all your comments in my mail on 23 Feb 2005. I have implemented your suggestions, with the exception of checking the device node property lengths, as this requires modifying many callers elsewhere in the code.

Ok. I will test the patch on both of my machines to see if it works for me.

Quoted 1 line

I will commit this in a couple days if I don't hear any complaints.

Ok.

Quoted 8 lines

Index: loader/powerpc/ieee1275/linux.c
===================================================================
RCS file: /cvsroot/grub/grub2/loader/powerpc/ieee1275/linux.c,v retrieving revision 1.6
diff -u -p -r1.6 linux.c

powerpc/ieee1275/linux.c grub_linux_boot (void) · line 61

Quoted 8 lines
powerpc/ieee1275/linux.c +1 -1
@@ -55,7 +55,7 @@ grub_linux_boot (void)
   /* Set the command line arguments.  */
   grub_ieee1275_set_property (chosen, "bootargs", linux_args,
 			      grub_strlen (linux_args) + 1, &actual);
-  
+
   /* Boot the kernel.  */
   linuxmain = (kernel_entry_t) linux_addr;
   linuxmain ((void *) initrd_addr, initrd_size, grub_ieee1275_entry_fn, 0, 0);

Can you fix this? :)

--
Marco

#2 lore raw
In reply to Hollis Blanchard
Quoted 6 lines · Hollis Blanchard

Marco, I believe I addressed all your comments in my mail on 23 Feb 2005. I have implemented your suggestions, with the exception of checking the device node property lengths, as this requires modifying many callers elsewhere in the code.

I will commit this in a couple days if I don't hear any complaints.

There is a problem with the patch, so please don't. When booting on the pegasosII I see the following problem:

grub> set
prefix=(/pci@80000000/ide@C,1/disk@0,0,3)

That is when I am booting using `boot hd:4 grub)'.

The prefix contains an OF device name which will not work in GRUB, mainly because of the comma's. Would it be possible to lookup the OF path in /aliases and set the prefix to the alias? That will be something that will work and is more user friendly I think.

Another thing we could do, but which is a bit more ugly, is creating an alias. I am not sure if it is possible to create an OF alias from GRUB, but I assume it will be.

Shouldn't the prefix end with a `/' like you mentioned in one of your other emails. So in this case:

prefix=(/pci@80000000/ide@C,1/disk@0,0,3)/

Thanks,
Marco

#3 lore raw
Quoted 9 lines · Marco Gerards

When booting on the pegasosII I see the following problem:

grub> set
prefix=(/pci@80000000/ide@C,1/disk@0,0,3)

That is when I am booting using `boot hd:4 grub)'.

The prefix contains an OF device name which will not work in GRUB, mainly because of the comma's.

What, a disk name with a comma in it?! Gee, I wish somebody had realized this would be a problem.</sarcasm>

Quoted 3 lines

Would it be possible to lookup the OF
path in /aliases and set the prefix to the alias? That will be something that will work and is more user friendly I think.

I agree, using the alias is much more user-friendly, and that's the only reason I'm comfortable doing it. I will send the revised patch in a moment.

Interestingly, as Nico mentioned before, there are often multiple aliases to the same device. In my case, when I boot from "hd", prefix is set to "ultra0", because that comes first in the /aliases property list. Everything works, but it could be a source of user confusion.

Quoted 3 lines

Another thing we could do, but which is a bit more ugly, is creating an alias. I am not sure if it is possible to create an OF alias from GRUB, but I assume it will be.

It is quite rude to unexpectedly clobber a user's devalias. With that in mind, what is the exact algorithm you're proposing?

Quoted 4 lines

Shouldn't the prefix end with a `/' like you mentioned in one of your other emails. So in this case:

prefix=(/pci@80000000/ide@C,1/disk@0,0,3)/

The slash was removed when the path was truncated to the directory.

-Hollis

#4 lore raw
Quoted 4 lines · Hollis Blanchard

Interestingly, as Nico mentioned before, there are often multiple aliases to the same device. In my case, when I boot from "hd", prefix is set to "ultra0", because that comes first in the /aliases property list. Everything works, but it could be a source of user confusion.

Right. This sucks, I agree.

Quoted 6 lines
Quoted 3 lines

Another thing we could do, but which is a bit more ugly, is creating an alias. I am not sure if it is possible to create an OF alias from GRUB, but I assume it will be.

It is quite rude to unexpectedly clobber a user's devalias. With that in mind, what is the exact algorithm you're proposing?

Is this a problem if you do not store it?

--
Marco