[OpenBIOS] Mac OS X support

Programmingkid programmingkidx at gmail.com
Thu Nov 15 23:31:45 CET 2012


On Nov 15, 2012, at 4:44 PM, Amadeusz Sławiński wrote:

> Seeing as there are people who want work on Max OS X (ppc) support and
> to speed up their work, so they won't redundantly search for stuff which needs
> to get implemented and so they can spend time on implementing it further.
> 
> There was some work done already during GSOC 2011,
> which didn't get applied (due to not being finished? / missing signed-offs).

I so wish these patches were committed. It would have saved me so much time. I do already know about them and work with them. I've even talked to the guy who made them. He became sick of waiting around forever. A feeling I know too well. 

> 
> Anyway some time ago I tried to apply those patches and got Mac OS X
> to start booting, you can see description and some screenshots at this address:
> http://www.emaculation.com/forum/viewtopic.php?f=1&t=7047

Thank you for uploading the images. They give me hope. I was wondering what operating system you where using. It looks like NeXtStep. 

> 
> Links to those patches with my comments here:
> I tried them with latest tree, mixing some current stuff from mailing
> list (mainly trying some filesystem things).
> 
> http://lists.openbios.org/pipermail/openbios/2011-August/006653.html
> dummy get-key-map
> 
> http://lists.openbios.org/pipermail/openbios/2011-August/006615.html
> http://lists.openbios.org/pipermail/openbios/2011-August/006616.html
> http://lists.openbios.org/pipermail/openbios/2011-August/006618.html
> file-system / partitioning stuff - may need some changes due to recent
> patches
> 
> http://lists.openbios.org/pipermail/openbios/2011-August/006617.html
> after "Call kernel!" it stops drawing to screen
> 
> http://lists.openbios.org/pipermail/openbios/2011-August/006619.html
> local forth variables, I tested new implementation (from few days ago) and it also works
> 
> http://lists.openbios.org/pipermail/openbios/2011-August/006620.html
> I think I stumbled upon it not booting without this one, but currently
> can't reproduce
> 
> http://lists.openbios.org/pipermail/openbios/2011-August/006651.html
> 0 > boot cd:\\:tbxi >> openbios panic: Unexpected exception fff26500
> 
> http://lists.openbios.org/pipermail/openbios/2011-August/006623.html
> for drawing apple logo (from my tests it seems badly positioned but it
> may just want some other -g option to qemu)
> 
> https://lists.nongnu.org/archive/html/qemu-devel/2011-08/msg01418.html
> I can confirm that it stops after "COLOR video console at 0x80000000 (800x600x32) without this

Thank you for all your help. I will continue to work with these patches. 


> I will certainly test any new patches that appear ;)

Could you test this one?

This patch adds an feature to OpenBIOS that automatically selects the correct partition to use. You can see this code in action when you use these commands: "dir cd:,\" and "boot cd:,\\:tbxi". 

signed-off-by: John Arbuckle <programmingkidx at gmail.com>

---
 packages/mac-parts.c |   69 +++++++++++++++++++++++++++++++------------------
 1 files changed, 44 insertions(+), 25 deletions(-)

diff --git a/packages/mac-parts.c b/packages/mac-parts.c
index 18e4aa3..956ae58 100644
--- a/packages/mac-parts.c
+++ b/packages/mac-parts.c
@@ -108,7 +108,6 @@ macparts_open( macparts_info_t *di )
 	}
 
 	DPRINTF("parstr: %s  argstr: %s  parnum: %d\n", parstr, argstr, parnum);
-
 	DPRINTF("want_bootcode %d\n", want_bootcode);
 	DPRINTF("macparts_open %d\n", parnum);
 
@@ -136,12 +135,10 @@ macparts_open( macparts_info_t *di )
         if (__be16_to_cpu(par.pmSig) != DESC_PART_SIGNATURE)
 		goto out;
 
-	/*
-	 * Implement partition selection as per the PowerPC Microprocessor CHRP bindings
-	 */
-
-	if (str == NULL || parnum == 0) {
-		/* According to the spec, partition 0 as well as no arguments means the whole disk */
+	
+   // Partition 0 means the whole disk 
+	if (parnum == 0) 
+   {
 		offs = (long long)0;
 		size = (long long)__be32_to_cpu(dmap.sbBlkCount) * bs;
 
@@ -155,36 +152,37 @@ macparts_open( macparts_info_t *di )
 
 		ret = -1;
 		goto out;
-
-	} else if (parnum == -1 && strlen(argstr)) {
-
+	} 
+   
+   // if no partition, but a file was specified - example: boot cd:,\\:tbxi
+   else if (parnum == -1 && strlen(argstr)) 
+   {
 		DPRINTF("mac-parts: counted %d partitions\n", __be32_to_cpu(par.pmMapBlkCnt));
 
 		/* No partition was explicitly requested, but an argstr was passed in.
 		   So let's find a suitable partition... */
-		for (parnum = 1; parnum <= __be32_to_cpu(par.pmMapBlkCnt); parnum++) {
+		for (parnum = 1; parnum <= __be32_to_cpu(par.pmMapBlkCnt); parnum++) 
+      {
 			SEEK( bs * parnum );
 			READ( &par, sizeof(par) );
-			if( __be16_to_cpu(par.pmSig) != DESC_PART_SIGNATURE ||
-                            !__be32_to_cpu(par.pmPartBlkCnt) )
-				break;
-
 			DPRINTF("found partition type: %s with status %x\n", par.pmPartType, __be32_to_cpu(par.pmPartStatus));
 
-			/* If we have a valid, allocated and readable partition... */
-			if( (__be32_to_cpu(par.pmPartStatus) & kPartitionAUXIsValid) &&
-			(__be32_to_cpu(par.pmPartStatus) & kPartitionAUXIsAllocated) &&
-			(__be32_to_cpu(par.pmPartStatus) & kPartitionAUXIsReadable) ) {
+			// If an Apple_HFS or Apple_HFSX partition was found
+         if(strcmp(par.pmPartType, "Apple_HFS") == 0 || strcmp(par.pmPartType, "Apple_HFSX") == 0)
+         {
 				offs = (long long)__be32_to_cpu(par.pmPyPartStart) * bs;
 				size = (long long)__be32_to_cpu(par.pmPartBlkCnt) * bs;
 
 				/* If the filename was set to %BOOT, we actually want the bootcode */
-				if (want_bootcode && (__be32_to_cpu(par.pmPartStatus) & kPartitionAUXIsBootValid)) {
+				if (want_bootcode && (__be32_to_cpu(par.pmPartStatus) & kPartitionAUXIsBootValid)) 
+            {
 					offs += (long long)__be32_to_cpu(par.pmLgBootStart) * bs;
 					size = (long long)__be32_to_cpu(par.pmBootSize);
-
 					goto found;
-				} else {
+				} 
+            
+            else 
+            {
 					/* Otherwise we were passed a filename and path. So let's
 					   choose the first partition with a valid filesystem */
 					DPUSH( offs );
@@ -197,9 +195,30 @@ macparts_open( macparts_info_t *di )
 				}
 			}
 		}
-
-	} else {
-		/* Another partition was explicitly requested */
+	} 
+   
+   // if no partition and no file was selected - example: "dir cd:,\"
+   else if (parnum == -1)  
+   {
+      // search for the first partition of type Apple_HFS or Apple_HFSX
+      for(parnum = 1; parnum <= __be32_to_cpu(par.pmMapBlkCnt); parnum++)
+      {
+         SEEK( bs * parnum );
+         READ( &par, sizeof(par) );
+         DPRINTF("found partition type: %s with status %x\n", par.pmPartType, __be32_to_cpu(par.pmPartStatus));
+         if(strcmp(par.pmPartType, "Apple_HFS") == 0 || strcmp(par.pmPartType, "Apple_HFSX") == 0)
+         {
+               offs = (long long)__be32_to_cpu(par.pmPyPartStart) * bs;
+               size = (long long)__be32_to_cpu(par.pmPartBlkCnt) * bs;
+               goto found; 
+               break;
+         }
+      }
+   }
+   
+   // Another partition was explicitly requested
+   else 
+   {
 		SEEK( bs * parnum );
 		READ( &par, sizeof(par) );
 
-- 
1.7.5.4





More information about the OpenBIOS mailing list