[OpenBIOS] Solaris anyone? Q2

Blue Swirl blauwirbel at gmail.com
Wed May 4 22:00:44 CEST 2011


On Tue, May 3, 2011 at 3:57 AM, Kenneth Salerno
<kennethsalerno at yahoo.com> wrote:
> ----- Original Message -----
>
> From: Nathan Kunkee <nkunkee42 at hotmail.com>
> To: The OpenBIOS Mailinglist <openbios at openbios.org>
> Cc:
> Sent: Monday, May 2, 2011 12:20 PM
> Subject: Re: [OpenBIOS] Solaris anyone? Q2
>
>
>>>>>> Ah that will probably be the problem - config/script/switch-arch
>>>>>> contains the logic which detects how
>>>>>> NATIVE_BITWIDTH_EQUALS_HOST_BITWIDTH and SWAP_ENDIANNESS should be set
>>>>>> and adds them to CFLAGS in Makefile.target as appropriate.
>>>>>>
>>>>> OK. I'll start looking to see how to change that for by build
>>>>> environment.
>>>> Great - thanks!
>>> I figured it out!
>>>
>>> /bin/sh, the default choice if you just run switch-arch, on OpenSolaris is
>>> ksh93, which silently fails on the $...bigendian tests. If I run switch-arch
>>> with /usr/xpg4/bin/sh or bash, it works fine and my builds from x86 and
>>> sparc are now correct and load. It looks like testing for $KSH_VERSION would
>>> be a way to find out if the shell isn't going to work, but I don't know if
>>> this would come up enough to warrant adding logic to check it.
>> Maybe we have a bashism somewhere (should be fixed), or more likely
>> since ksh93 is not fully Posix compatible, we use some Posix features
>> which are not implemented by ksh93 (maybe avoidable). Please send
>> again the output from sh -x for the bigendian test.
>>
> As run on my Ultra60 which should set CONFIG_BIG_ENDIAN:
>
> nathan at valhalla:/export/home/nathan/openbios-devel$ LANG=C /bin/sh -x ./config/scripts/switch\-arch sparc32
> + MOLPATH=/export/home/nathan//mol-0.9.71
> + [ xsparc32 = x -o sparc32 = -help ]
> + test -f utils/dist/debian/rules
> + chmod 755 utils/dist/debian/rules
> + chmod 755 config/scripts/switch-arch
> + chmod 755 config/scripts/reldir
> + test x = x
> + archname
> + 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/'
> + uname -m
> + HOSTARCH=sparc64
> + head VERSION
> + VERSION=1.0
> + echo 'Configuring OpenBIOS on sparc64 for sparc32'
> Configuring OpenBIOS on sparc64 for sparc32
> + target_list=''
> + target_list=' builtin-sparc32 unix-sparc32'
> + arch_list=''
> + sed 's/.*-//g'
> + echo builtin-sparc32
> + arch=sparc32
> + test -f config/examples/sparc32_config.xml
> + grep -q sparc32
> + echo
> + arch_list=' sparc32'
> + sed 's/.*-//g'
> + echo unix-sparc32
> + arch=sparc32
> + test -f config/examples/sparc32_config.xml
> + grep -q sparc32
> + echo sparc32
> + unix=no
> + builtin=no
> + plain=no
> + mol=no
> + briq=no
> + pearpc=no
> + qemu=no
> + xbox=no
> + cross=no
> + :
> + builtin=yes
> + :
> + [ sparc32 != sparc64 ]
> + continue
> + BASEARCH=sparc32
> + select_prefix sparc
> + whence -v sparc-linux-gnu-gcc
> + 1> /dev/null 2>& 1
> + whence -v sparc-linux-gcc
> + 1> /dev/null 2>& 1
> + whence -v sparc-elf-gcc
> + 1> /dev/null 2>& 1
> + whence -v sparc-eabi-gcc
> + 1> /dev/null 2>& 1
> + whence -v sparc-sun-solaris2.11-gcc
> + 1> /dev/null 2>& 1
> + return
> + CFLAGS='-Wa,-xarch=v8 -Wa,-32 -m32 -mcpu=supersparc -fno-builtin'
> + AS_FLAGS='-Wa,-xarch=v8 -Wa,-32'
> + uname -s
> + [ sparc32 != sparc64 -o SunOS = Darwin ]
> + cross=yes
> + crosscflags sparc64 sparc32
> + local host=sparc64
> ./config/scripts/switch-arch[22]: local: not found [No such file or directory]
> + local target=sparc32
> ./config/scripts/switch-arch[23]: local: not found [No such file or directory]
> + test '' = powerpc -o '' = ppc -o '' = mips -o '' = s390 -o '' = sparc32 -o '' = sparc64 -o '' = m68k -o '' = armv4b
> + hostbigendian=no
> + test '' = sparc64 -o '' = ia64 -o '' = amd64 -o '' = x86_64 -o '' = alpha
> + hostlongbits=32
> + test unix-sparc32 = powerpc -o unix-sparc32 = ppc -o unix-sparc32 = powerpc64 -o unix-sparc32 = ppc64 -o unix-sparc32 = mips -o unix-sparc32 = s390 -o unix-sparc32 = sparc32 -o unix-sparc32 = sparc64 -o unix-sparc32 = m68k -o unix-sparc32 = armv4b
> + targetbigendian=no
> + test unix-sparc32 = sparc64 -o unix-sparc32 = ia64 -o unix-sparc32 = amd64 -o unix-sparc32 = x86_64 -o unix-sparc32 = powerpc64 -o unix-sparc32 = ppc64 -o unix-sparc32 = alpha
> + targetlongbits=32
> + echo 'test same endian -target -host ' no no
> test same endian -target -host  no no
> + test no = no
> + cflags=-USWAP_ENDIANNESS
> + test 32 = 32
> + cflags='-USWAP_ENDIANNESS -DNATIVE_BITWIDTH_EQUALS_HOST_BITWIDTH'
> + test unix-sparc32 = sparc64 -o unix-sparc32 = ia64 -o unix-sparc32 = amd64 -o unix-sparc32 = x86_64 -o unix-sparc32 = alpha
> + CROSSCFLAGS='-USWAP_ENDIANNESS -DNATIVE_BITWIDTH_EQUALS_HOST_BITWIDTH'
> + OBJDIR=obj-sparc32
> + printf 'Initializing build tree obj-sparc32...'
> Initializing build tree obj-sparc32...+ rm -rf obj-sparc32
> + mkdir obj-sparc32
> + mkdir -p obj-sparc32/target
> + mkdir -p obj-sparc32/target/include
> + mkdir -p obj-sparc32/target/arch
> + mkdir -p obj-sparc32/target/arch/unix
> + mkdir -p obj-sparc32/target/arch/sparc32
> + mkdir -p obj-sparc32/target/libgcc
> + mkdir -p obj-sparc32/target/kernel
> + mkdir -p obj-sparc32/target/libopenbios
> + mkdir -p obj-sparc32/target/packages
> + mkdir -p obj-sparc32/target/fs
> + mkdir -p obj-sparc32/target/fs/grubfs
> + mkdir -p obj-sparc32/target/fs/hfs
> + mkdir -p obj-sparc32/target/fs/hfsplus
> + mkdir -p obj-sparc32/target/fs/iso9660
> + mkdir -p obj-sparc32/target/fs/ext2
> + mkdir -p obj-sparc32/target/drivers
> + mkdir -p obj-sparc32/target/libc
> + mkdir -p obj-sparc32/host/include
> + mkdir -p obj-sparc32/host/kernel
> + mkdir -p obj-sparc32/forth
> + ln -s ../../../include/arch/sparc32 obj-sparc32/target/include/asm
> + [ no = yes ]
> + [ no = yes ]
> + [ no = yes ]
> + [ no = yes ]
> + [ no = yes ]
> + echo ok.
> ok.
> + cd obj-sparc32
> + SRCDIR=..
> + ODIR=.
> + printf 'Creating target Makefile...'
> Creating target Makefile...+ echo ARCH=sparc32
> + 1> ./config.mak
> + [ yes = yes ]
> + echo TARGET=sparc-sun-solaris2.11-
> + 1>> ./config.mak
> + echo CFLAGS='-Wa,-xarch=v8 -Wa,-32 -m32 -mcpu=supersparc -fno-builtin'
> + 1>> ./config.mak
> + echo AS_FLAGS='-Wa,-xarch=v8 -Wa,-32'
> + 1>> ./config.mak
> + echo 'HOSTARCH?=sparc64'
> + 1>> ./config.mak
> + echo CROSSCFLAGS='-USWAP_ENDIANNESS -DNATIVE_BITWIDTH_EQUALS_HOST_BITWIDTH'
> + 1>> ./config.mak
> + echo VERSION='"1.0"'
> + 1>> ./config.mak
> + ln -s ../config/xml/rules.xml ./rules.xml
> + echo '<?xml version="1.0"?><config>'
> + 1> ./config.xml
> + config_set_boolean CONFIG_sparc32
> + 1>> ./config.xml
> + echo CONFIG_sparc32
> + tr a-z A-Z
> + option=CONFIG_SPARC32
> + echo '<option name="CONFIG_SPARC32" type="boolean" value="true" />'
> + [ sparc32 != sparc32 ]
> + [ no = yes ]
> + [ no = yes ]
> + [ no = yes ]
> + [ no = yes ]
> + [ no = yes ]
> + echo 'config test -target ' no
> config test -target  no
> + [ no = yes ]
> + config_set_boolean CONFIG_LITTLE_ENDIAN
> + 1>> ./config.xml
> + echo CONFIG_LITTLE_ENDIAN
> + tr a-z A-Z
> + option=CONFIG_LITTLE_ENDIAN
> + echo '<option name="CONFIG_LITTLE_ENDIAN" type="boolean" value="true" />'
> + [ no = yes ]
> + [ yes = yes ]
> + config_set_boolean CONFIG_IMAGE_ELF_EMBEDDED
> + 1>> ./config.xml
> + echo CONFIG_IMAGE_ELF_EMBEDDED
> + tr a-z A-Z
> + option=CONFIG_IMAGE_ELF_EMBEDDED
> + echo '<option name="CONFIG_IMAGE_ELF_EMBEDDED" type="boolean" value="true" />'
> + [ no = yes ]
> + cat ../config/examples/sparc32_config.xml
> + 1>> ./config.xml
> + echo '</config>'
> + 1>> ./config.xml
> + ln -s ../Makefile.target ./Makefile
> + xsltproc ../config/xml/xinclude.xsl ../build.xml
> + 1> ./build-full.xml
> + xsltproc ../config/xml/makefile.xsl ./build-full.xml
> + 1> ./rules.mak
> + echo ok.
> ok.
> + printf 'Creating config files...'
> Creating config files...+ xsltproc ../config/xml/config-c.xsl ./config.xml
> + 1> ./host/include/autoconf.h
> + xsltproc ../config/xml/config-c.xsl ./config.xml
> + 1> ./target/include/autoconf.h
> + xsltproc ../config/xml/config-forth.xsl ./config.xml
> + 1> ./forth/config.fs
> + echo ok.
> ok.
> + cd ..
>
> Nathan
>
>
> -- OpenBIOS                 http://openbios.org/
> Mailinglist:  http://lists.openbios.org/mailman/listinfo
> Free your System - May the Forth be with you
>
>
> This would fix the script to work on Solaris:
>
> --- switch-arch.orig    2011-05-02 20:54:43.312500000 -0400
> +++ switch-arch 2011-05-02 20:56:05.093750000 -0400
> @@ -19,8 +19,8 @@
>
>  crosscflags()
>  {
> -    local host=$1
> -    local target=$2
> +    host=$1
> +    target=$2

This happens to work because variable $target (used in some for loops)
is not used after the call to crosscflags. It's a bit fragile though.
Considering the various uses of $target, I'd rename $host to $host_cpu
and $target to $target_cpu in crosscflags.



More information about the OpenBIOS mailing list