I see there are functions for accessing partition info in modules/mac-parts.[ch] among others. I do not see any of the code using any of these functions however.
I am trying to fix booting on powermac's under qemu so that it actually looks at each partition entry and determines if it is flagged as bootable, and if so looks at the load size and load address specified there and boots that.
The idea is to replace the broken quik boot code, with something that actually does what the boot loader says to do, not what the openbios assumes it wants to do.
Does anyone have any hint as to how to actually use these nice partition access functions so I can look at each partition table entry until I find the bootable one (if any)?
On 2/9/09, Lennart Sorensen lsorense@csclub.uwaterloo.ca wrote:
I see there are functions for accessing partition info in modules/mac-parts.[ch] among others. I do not see any of the code using any of these functions however.
macparts_init is called from modules_init, called from arch/ppc/qemu/init.c.
macparts_init registers a node, the NULL name specifies the initializer (macparts_initialize). I suppose register-partition-package does what the name says.
I am trying to fix booting on powermac's under qemu so that it actually looks at each partition entry and determines if it is flagged as bootable, and if so looks at the load size and load address specified there and boots that.
Great!
The idea is to replace the broken quik boot code, with something that actually does what the boot loader says to do, not what the openbios assumes it wants to do.
Does anyone have any hint as to how to actually use these nice partition access functions so I can look at each partition table entry until I find the bootable one (if any)?
_probe method should detect the presence of partition, _open registers the offsets.
Hi,
look at CHRP System binding, http://www.openfirmware.info/data/docs/CHRP.ps , p. 56:
11.1.2. Open Method Algorithm ...
11.1.2.7.6. CHECK_FOR_MAC_DISK 11.1.2.7.7. If this is a Mac partitioned disk 11.1.2.7.7.1. Search the Mac partition table for the first "bootable" partition. A partition is "bootable" when the pmPartStatus flags indicate that this is a valid, allocated, readable and bootable partition and the pmProcessor field contains "powerpc" (using case-insensitive matching). 11.1.2.7.7.2. If a Mac "bootable" partition is found 11.1.2.7.7.2.1. If FILENAME$ is "%BOOT" 11.1.2.7.7.2.1.1. If the Nth partition is marked bootable 11.1.2.7.7.2.1.1.1. Set D.OFFSET to the byte offset from the beginning of the disk to the beginning of the boot area, as given by the pmLgBootStart field. 11.1.2.7.7.2.1.1.2. Set D.SIZE to the size of the partition in bytes denoted by pmBootSize. 11.1.2.7.7.2.1.1.3. Return OKAY 11.1.2.7.7.2.2. Else 11.1.2.7.7.2.2.1. If the FILENAME$ is the null string 11.1.2.7.7.2.2.1.1. Set D.OFFSET to the byte offset of the "real" partition data 11.1.2.7.7.2.2.1.2. Set D.SIZE to the size of the "real" partition data 11.1.2.7.7.2.2.2. Else 11.1.2.7.7.2.2.2.1. INTERPOSE_BY_TYPE 11.1.2.7.7.2.2.3. Return OKAY 11.1.2.7.7.3. Else ...
Le 9 févr. 09 à 17:40, Lennart Sorensen a écrit :
I see there are functions for accessing partition info in modules/mac-parts.[ch] among others. I do not see any of the code using any of these functions however.
I am trying to fix booting on powermac's under qemu so that it actually looks at each partition entry and determines if it is flagged as bootable, and if so looks at the load size and load address specified there and boots that.
The idea is to replace the broken quik boot code, with something that actually does what the boot loader says to do, not what the openbios assumes it wants to do.
Does anyone have any hint as to how to actually use these nice partition access functions so I can look at each partition table entry until I find the bootable one (if any)?
-- Len Sorensen
-- OpenBIOS http://openbios.org/ Mailinglist: http://lists.openbios.org/mailman/listinfo Free your System - May the Forth be with you
On Mon, Feb 09, 2009 at 06:25:16PM +0100, Laurent Vivier wrote:
Hi,
look at CHRP System binding, http://www.openfirmware.info/data/docs/CHRP.ps , p. 56:
11.1.2. Open Method Algorithm ...
11.1.2.7.6. CHECK_FOR_MAC_DISK 11.1.2.7.7. If this is a Mac partitioned disk 11.1.2.7.7.1. Search the Mac partition table for the first "bootable" partition. A partition is "bootable" when the pmPartStatus flags indicate that this is a valid, allocated, readable and bootable partition and the pmProcessor field contains "powerpc" (using case-insensitive matching). 11.1.2.7.7.2. If a Mac "bootable" partition is found 11.1.2.7.7.2.1. If FILENAME$ is "%BOOT" 11.1.2.7.7.2.1.1. If the Nth partition is marked bootable 11.1.2.7.7.2.1.1.1. Set D.OFFSET to the byte offset from the beginning of the disk to the beginning of the boot area, as given by the pmLgBootStart field. 11.1.2.7.7.2.1.1.2. Set D.SIZE to the size of the partition in bytes denoted by pmBootSize. 11.1.2.7.7.2.1.1.3. Return OKAY 11.1.2.7.7.2.2. Else 11.1.2.7.7.2.2.1. If the FILENAME$ is the null string 11.1.2.7.7.2.2.1.1. Set D.OFFSET to the byte offset of the "real" partition data 11.1.2.7.7.2.2.1.2. Set D.SIZE to the size of the "real" partition data 11.1.2.7.7.2.2.2. Else 11.1.2.7.7.2.2.2.1. INTERPOSE_BY_TYPE 11.1.2.7.7.2.2.3. Return OKAY 11.1.2.7.7.3. Else
That looks pretty much like what I was planning to do, based on the structure and how quik fills it in. At least something like it.
Now I just have to figure out how to check the values of the mac partiton table structure from arch/ppc/qemu/main.c
Le 9 févr. 09 à 19:04, Lennart Sorensen a écrit :
On Mon, Feb 09, 2009 at 06:25:16PM +0100, Laurent Vivier wrote:
Hi,
look at CHRP System binding, http://www.openfirmware.info/data/docs/CHRP.ps , p. 56:
11.1.2. Open Method Algorithm ...
11.1.2.7.6. CHECK_FOR_MAC_DISK 11.1.2.7.7. If this is a Mac partitioned disk 11.1.2.7.7.1. Search the Mac partition table for the first "bootable" partition. A partition is "bootable" when the pmPartStatus flags indicate that this is a valid, allocated, readable and bootable partition and the pmProcessor field contains "powerpc" (using case-insensitive matching). 11.1.2.7.7.2. If a Mac "bootable" partition is found 11.1.2.7.7.2.1. If FILENAME$ is "%BOOT" 11.1.2.7.7.2.1.1. If the Nth partition is marked bootable 11.1.2.7.7.2.1.1.1. Set D.OFFSET to the byte offset from the beginning of the disk to the beginning of the boot area, as given by the pmLgBootStart field. 11.1.2.7.7.2.1.1.2. Set D.SIZE to the size of the partition in bytes denoted by pmBootSize. 11.1.2.7.7.2.1.1.3. Return OKAY 11.1.2.7.7.2.2. Else 11.1.2.7.7.2.2.1. If the FILENAME$ is the null string 11.1.2.7.7.2.2.1.1. Set D.OFFSET to the byte offset of the "real" partition data 11.1.2.7.7.2.2.1.2. Set D.SIZE to the size of the "real" partition data 11.1.2.7.7.2.2.2. Else 11.1.2.7.7.2.2.2.1. INTERPOSE_BY_TYPE 11.1.2.7.7.2.2.3. Return OKAY 11.1.2.7.7.3. Else
That looks pretty much like what I was planning to do, based on the structure and how quik fills it in. At least something like it.
Now I just have to figure out how to check the values of the mac partiton table structure from arch/ppc/qemu/main.c
I think you don't have to do this from qemu/main.c but from modules/ mac-parts.c.
In m acparts_open(), if partnum is missing, you have to search for a bootable partition.
Regards, Laurent
On Mon, Feb 09, 2009 at 07:11:26PM +0100, Laurent Vivier wrote:
I think you don't have to do this from qemu/main.c but from modules/ mac-parts.c.
In m acparts_open(), if partnum is missing, you have to search for a bootable partition.
I thought qemu/main.c was in charge of doing the boot selection. Have I misunderstood something there? I am finding no way to get mac specific partition data from qemu/main.c though.
Looking at macparts_open, it dpes appear one can pass in a partition to open, but I don't see how that has anything to do with making it select a partition to boot from, or even doing this boot.
After all I want to detect a mac partition table, check if it has a bootable partition flagged, and then check the boot parameters of that partition, and load the specified boot code and execute it if found. I just can't quite tell yet if qemu/main.c is in charge of looking at partitions and deciding what to boot, or if the act of doing an open on the hd is what should cause booting to happen.
Le 9 févr. 09 à 19:44, Lennart Sorensen a écrit :
On Mon, Feb 09, 2009 at 07:11:26PM +0100, Laurent Vivier wrote:
I think you don't have to do this from qemu/main.c but from modules/ mac-parts.c.
In m acparts_open(), if partnum is missing, you have to search for a bootable partition.
I thought qemu/main.c was in charge of doing the boot selection. Have I misunderstood something there? I am finding no way to get mac specific partition data from qemu/main.c though.
Looking at macparts_open, it dpes appear one can pass in a partition to open, but I don't see how that has anything to do with making it select a partition to boot from, or even doing this boot.
"boot hd:%BOOT" should boot from the first bootable partition by loading the boot sector, given by pmLgBootStart. (see specification I gave).
After all I want to detect a mac partition table, check if it has a bootable partition flagged, and then check the boot parameters of that partition, and load the specified boot code and execute it if found. I just can't quite tell yet if qemu/main.c is in charge of looking at partitions and deciding what to boot, or if the act of doing an open on the hd is what should cause booting to happen.
Perhaps you should also look at "load" command.
Regards, Laurent