[OpenBIOS] Patch that allows for building OpenBIOS on Mac OS X!

Segher Boessenkool segher at kernel.crashing.org
Thu May 9 02:08:02 CEST 2013


>>> 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
>>> +	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
>>> }
>>
>> This is wrong.  "uname" does not tell you the machine architecture;
>> "uname -m" does, at least on my PowerPC Macs.  Also:
>
> Who said I was trying to obtain the machine architecture?

That is what this function does.

> As I said in the comment you can't depend on uname -m on Mac OS X.  
> It will not tell you if the architecture is 64 bit or 32 bit.

And ignoring it does not tell you if the machine is x86 at all,
which you just blindly assume.  It might work for you, but it is
just wrong and breaks things for other people.

> Do you even use Mac OS X?

Yes I do.

> The hw.cpu64bit_capable will tell you that information.
>
>> $ sysctl hw.cpu64bit_capable
>> second level name cpu64bit_capable in hw.cpu64bit_capable is invalid
>
> I don't know what you are using, but on Mac OS 10.6 and up it is  
> valid. Are you even using Mac OS X? If so, what version? It might  
> be possible to build OpenBIOS on Mac OS 10.5, but I really doubt  
> anything before that would work.

It is not valid on any OSX version; it is only valid on x86.

Everything builds fine on 10.3 and 10.4, fwiw.

>>> 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 is also wrong.  ppc-elf is neither a canonical nor a common  
>> prefix.
>> Whoever built your toolchain was hellbent on making life difficult  
>> for
>> the users of said toolchain.
>
> WHAT? Just because you don't like the name doesn't make it wrong.

Let's add a "butterfly-cherry-blossom-sortofelf-" prefix as well!

I have many toolchains with custom program prefixes; I don't expect
the openbios scripts to automatically pick those up, either.  It is
not going to scale...

> In the end you are wrong about most of the issues you brought up. I  
> would appreciate it if you kept your comments to yourself. Thank you.


Segher




More information about the OpenBIOS mailing list