[OpenBIOS] [PATCH] mac-parts.c: Fix auto-partition selection for the dir word.

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Sat Mar 16 14:24:41 CET 2013


Commit r1100 fixed the quik bootloader but broke automatic partition selection
for the dir word.

Differentiate between the package having no arguments (argstr == NULL) and
the package having empty arguments (argstr == ""), and alter the dir word
to use the latter version to invoke the automatic partition selection code
when required.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
CC: Alexander Graf <agraf at suse.de>
---
 openbios-devel/forth/debugging/client.fs |    2 +-
 openbios-devel/packages/mac-parts.c      |   10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/openbios-devel/forth/debugging/client.fs b/openbios-devel/forth/debugging/client.fs
index d454d22..24b1ec7 100644
--- a/openbios-devel/forth/debugging/client.fs
+++ b/openbios-devel/forth/debugging/client.fs
@@ -126,7 +126,7 @@ variable file-size
 
 : dir ( "{paths}<cr>" -- )
   linefeed parse
-  ascii , left-split
+  ascii , split-after
   2dup open-dev dup 0= if
     drop
     cr ." Unable to locate device " type
diff --git a/openbios-devel/packages/mac-parts.c b/openbios-devel/packages/mac-parts.c
index 12c94e5..85d53f8 100644
--- a/openbios-devel/packages/mac-parts.c
+++ b/openbios-devel/packages/mac-parts.c
@@ -79,6 +79,10 @@ macparts_open( macparts_info_t *di )
 		} else {
 		    argstr = str;
 		}
+
+		/* Make sure argstr is not null */
+		if (argstr == NULL)
+		    argstr = strdup("");	
 		
 		/* Convert the id to a partition number */
 		if (parstr && strlen(parstr))
@@ -89,10 +93,6 @@ macparts_open( macparts_info_t *di )
 		    want_bootcode = 1;
 	}
 
-	/* Make sure argstr is not null */
-	if (argstr == NULL)
-	    argstr = strdup("");	
-	
 	DPRINTF("parstr: %s  argstr: %s  parnum: %d\n", parstr, argstr, parnum);
 
 	DPRINTF("want_bootcode %d\n", want_bootcode);
@@ -126,7 +126,7 @@ macparts_open( macparts_info_t *di )
 	 * Implement partition selection as per the PowerPC Microprocessor CHRP bindings
 	 */
 
-	if (str == NULL || parnum == 0) {
+	if (argstr == NULL || parnum == 0) {
 		/* According to the spec, partition 0 as well as no arguments means the whole disk */
 		offs = (long long)0;
 		size = (long long)__be32_to_cpu(dmap.sbBlkCount) * bs;
-- 
1.7.10.4




More information about the OpenBIOS mailing list