[OpenBIOS] [PATCH] Building OpenBIOS on Mac OS X

Andreas Färber afaerber at suse.de
Thu May 9 11:48:02 CEST 2013


Am 08.05.2013 01:54, schrieb Programmingkid:
> 
> This patch allows for building OpenBIOS on Mac OS X, but without the "Trying" output. It has been tested on Mac OS 10.6 and Debian Linux.
> 
> signed-off-by: John Arbuckle <programmingkidx at gmail.com>
> 
> Index: trunk/openbios-devel/config/scripts/switch-arch
> ===================================================================
> --- trunk/openbios-devel/config/scripts/switch-arch	(revision 1133)
> +++ trunk/openbios-devel/config/scripts/switch-arch	(working copy)
> @@ -89,15 +89,25 @@
>  
>  archname()
>  {
> -    HOSTARCH=`uname -m | sed -e s/i.86/x86/ -e s/i86pc/x86/ \
> -	-e s/sun4u/sparc64/ -e s/sparc$/sparc32/ \
> -	-e s/arm.*/arm/ -e s/sa110/arm/ -e s/x86_64/amd64/ \
> -	-e "s/Power Macintosh/ppc/"`
> + 	OS_NAME=`uname`
> +	if test "$OS_NAME" = "Darwin"; then     # Can't depend on uname -m on Mac OS X
> +		IS_64BIT=`sysctl hw.cpu64bit_capable`
> +		if test "$IS_64BIT" = "hw.cpu64bit_capable: 1"; then
> +			HOSTARCH="amd64"
> +		else
> +			HOSTARCH="x86"
> +		fi

This is clearly wrong, Segher already pointed you to that: You are
wrongly assuming Darwin to mean x86/amd64 exclusively!
"hw.cpu64bit_capable: 1" can mean ppc64 just as well on 10.5, so it
would be best to check for Darwin 64-bitness *after* the original `uname
-m` architecture sanitization.

> +	else
> +		 HOSTARCH=`uname -m | sed -e s/i.86/x86/ -e s/i86pc/x86/ \
> +		-e s/sun4u/sparc64/ -e s/sparc$/sparc32/ \
> +		-e s/arm.*/arm/ -e s/sa110/arm/ -e s/x86_64/amd64/ \
> +		-e "s/Power Macintosh/ppc/"`
> +	fi   
>  }
>  
>  select_prefix()
>  {
> -    for TARGET in ${1}-unknown-linux-gnu- ${1}-linux-gnu- ${1}-linux- ${1}-elf- ${1}-eabi-
> +    for TARGET in ${1}-unknown-linux-gnu- ${1}-linux-gnu- ${1}-linux- ${1}-elf- ${1}-eabi- ppc-elf-

This has nothing to do with Mac OS X and thus, if we want this at all,
belongs in a separate patch. git-svn can help with that.

I think it is wrong that you are hardcoding ppc here, so it will fall
back to ppc-elf- prefix for sparc, etc. as well. powerpc-elf- prefix is
covered by ${1}-elf- here, so you'd need to check the call sites of
select_prefix() instead.

Regards,
Andreas

>      do
>          if type ${TARGET}gcc > /dev/null 2>&1
>          then

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg



More information about the OpenBIOS mailing list