X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=qemu%2Froms%2Fopenbios%2Fconfig%2Fscripts%2Fswitch-arch;fp=qemu%2Froms%2Fopenbios%2Fconfig%2Fscripts%2Fswitch-arch;h=d5e2f7710513169f01b39129524dd0c96ce94953;hb=e44e3482bdb4d0ebde2d8b41830ac2cdb07948fb;hp=0000000000000000000000000000000000000000;hpb=9ca8dbcc65cfc63d6f5ef3312a33184e1d726e00;p=kvmfornfv.git diff --git a/qemu/roms/openbios/config/scripts/switch-arch b/qemu/roms/openbios/config/scripts/switch-arch new file mode 100755 index 000000000..d5e2f7710 --- /dev/null +++ b/qemu/roms/openbios/config/scripts/switch-arch @@ -0,0 +1,427 @@ +#!/bin/sh + +# +# MOLPATH is needed if you want to build openbios-mol.elf +# +MOLPATH=$HOME/mol-0.9.71 + +if [ x"$1" = x -o "$1" = "-help" ]; then + printf "Usage:\n $0 [arch-config]...\n" + printf "arch-config values supported for native or cross compiled builds:\n" + printf " amd64, ppc, sparc32, sparc64, x86\n\n" + printf "Add \"unix-\" prefix to compile openbios-unix executable (native only)\n" + printf "Add \"builtin-\" prefix to compile openbios-builtin executables\n\n" + printf "Without prefixes, builtin and unix targets are selected\n\n" + printf "Special targets: mol-ppc briq-ppc pearpc-ppc qemu-ppc qemu-ppc64 xbox-x86\n\n" + printf "Example: $0 builtin-sparc32 unix-amd64 builtin-amd64\n" + exit 0 +fi + +crosscflags() +{ + host=$1 + target=$2 + + if test "$host" = "powerpc" -o "$host" = "ppc" \ + -o "$host" = "mips" -o "$host" = "s390" \ + -o "$host" = "sparc32" -o "$host" = "sparc64" \ + -o "$host" = "m68k" -o "$host" = "armv4b"; then + hostbigendian="yes" + else + hostbigendian="no" + fi + +# host long bits test + if test "$host" = "sparc64" -o "$host" = "ia64" \ + -o "$host" = "amd64" -o "$host" = "x86_64" \ + -o "$host" = "alpha"; then + hostlongbits="64" + else + hostlongbits="32" + fi + + if test "$target" = "powerpc" -o "$target" = "ppc" \ + -o "$target" = "powerpc64" -o "$target" = "ppc64" \ + -o "$target" = "mips" -o "$target" = "s390" \ + -o "$target" = "sparc32" -o "$target" = "sparc64" \ + -o "$target" = "m68k" -o "$target" = "armv4b"; then + targetbigendian="yes" + else + targetbigendian="no" + fi + +# target long bits test + if test "$target" = "sparc64" -o "$target" = "ia64" \ + -o "$target" = "amd64" -o "$target" = "x86_64" \ + -o "$target" = "powerpc64" -o "$target" = "ppc64" \ + -o "$target" = "alpha"; then + targetlongbits="64" + else + targetlongbits="32" + fi + + if test "$targetbigendian" = "$hostbigendian"; then + cflags="-USWAP_ENDIANNESS" + else + cflags="-DSWAP_ENDIANNESS" + fi + + if test "$targetlongbits" = "$hostlongbits"; then + cflags="$cflags -DNATIVE_BITWIDTH_EQUALS_HOST_BITWIDTH" + elif test "$targetlongbits" -lt "$hostlongbits"; then + cflags="$cflags -DNATIVE_BITWIDTH_SMALLER_THAN_HOST_BITWIDTH" + else + cflags="$cflags -DNATIVE_BITWIDTH_LARGER_THAN_HOST_BITWIDTH" + fi + + if test "$target" = "sparc64" -o "$target" = "ia64" \ + -o "$target" = "amd64" -o "$target" = "x86_64" \ + -o "$target" = "alpha"; then + if test "$host" = "x86"; then + cflags="$cflags -DNEED_FAKE_INT128_T" + elif test "$host" = "arm"; then + cflags="$cflags -DNEED_FAKE_INT128_T" + elif test "$host" = "ppc" -a `uname -s` = "Darwin"; then + cflags="$cflags -DNEED_FAKE_INT128_T" + fi + fi + + CROSSCFLAGS=$cflags +} + +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/"` +} + +select_prefix() +{ + TARGETS="${1}-unknown-linux-gnu- ${1}-linux-gnu- ${1}-linux- ${1}-elf- ${1}-eabi-" + + if [ x"$CROSS_COMPILE" != "x" ]; then + TARGETS=$CROSS_COMPILE + fi + + for TARGET in $TARGETS + do + if type ${TARGET}gcc > /dev/null 2>&1 + then + return + fi + done + if [ "$ARCH" = "$HOSTARCH" ]; then + return + fi + echo "ERROR: no ${1} cross-compiler found !" 1>&2 + exit 1 +} + +config_set_boolean() +{ + option=`echo $1 | tr a-z A-Z` + echo "