[OpenBIOS] [commit] r879 - in trunk/openbios-devel/config: examples scripts

repository service svn at openbios.org
Sun Oct 3 16:23:19 CEST 2010


Author: blueswirl
Date: Sun Oct  3 16:23:18 2010
New Revision: 879
URL: http://tracker.coreboot.org/trac/openbios/changeset/879

Log:
Improve compile system

Autodetect cross compilation, so cross- prefix is no longer needed.

Unify cross and native configurations.

Add unix- prefix to enable openbios-unix build for selected target,
similarly builtin- for builtin targets etc.

Signed-off-by: Blue Swirl <blauwirbel at gmail.com>

Deleted:
   trunk/openbios-devel/config/examples/cross-ppc_config.xml
   trunk/openbios-devel/config/examples/cross-sparc32_config.xml
   trunk/openbios-devel/config/examples/cross-sparc64_config.xml
   trunk/openbios-devel/config/examples/cross-x86_config.xml
Modified:
   trunk/openbios-devel/config/examples/amd64_config.xml
   trunk/openbios-devel/config/examples/ppc_config.xml
   trunk/openbios-devel/config/examples/sparc32_config.xml
   trunk/openbios-devel/config/examples/sparc64_config.xml
   trunk/openbios-devel/config/examples/x86_config.xml
   trunk/openbios-devel/config/scripts/switch-arch

Modified: trunk/openbios-devel/config/examples/amd64_config.xml
==============================================================================
--- trunk/openbios-devel/config/examples/amd64_config.xml	Sun Oct  3 12:34:50 2010	(r878)
+++ trunk/openbios-devel/config/examples/amd64_config.xml	Sun Oct  3 16:23:18 2010	(r879)
@@ -1,20 +1,6 @@
-<?xml version="1.0"?>
-<config>
-
-  <!-- generic -->
-  <option name="CONFIG_AMD64" type="boolean" value="true"/>
-  <option name="CONFIG_LITTLE_ENDIAN" type="boolean" value="true"/>
-
   <!-- kernel binaries (AMD64) -->
-  <option name="CONFIG_IMAGE_ELF" type="boolean" value="true"/>
-  <option name="CONFIG_IMAGE_ELF_EMBEDDED" type="boolean" value="true"/>
   <option name="CONFIG_IMAGE_ELF_MULTIBOOT" type="boolean" value="true"/>
 
-  <!-- Build hosted UNIX Binary -->
-  <option name="CONFIG_HOST_UNIX" type="boolean" value="true"/>
-  <option name="CONFIG_UNIX_QT" type="boolean" value="false"/>
-  <option name="CONFIG_PLUGINS" type="boolean" value="false"/>
-
   <!-- Kernel Debugging -->
   <option name="CONFIG_DEBUG" type="boolean" value="true"/>
   <option name="CONFIG_DEBUG_BOOT" type="boolean" value="true"/>
@@ -72,5 +58,3 @@
   <option name="CONFIG_DRIVER_IDE" type="boolean" value="true"/>
   <option name="CONFIG_IDE_NUM_CHANNELS" type="integer" value="4"/>
   <option name="CONFIG_DEBUG_IDE" type="boolean" value="false"/>
-
-</config>

Modified: trunk/openbios-devel/config/examples/ppc_config.xml
==============================================================================
--- trunk/openbios-devel/config/examples/ppc_config.xml	Sun Oct  3 12:34:50 2010	(r878)
+++ trunk/openbios-devel/config/examples/ppc_config.xml	Sun Oct  3 16:23:18 2010	(r879)
@@ -1,19 +1,3 @@
-<?xml version="1.0"?>
-<config>
-
-  <!-- generic -->
-  <option name="CONFIG_PPC" type="boolean" value="true"/>
-  <option name="CONFIG_MOL" type="boolean" value="false"/>
-  <option name="CONFIG_BRIQ" type="boolean" value="false"/>
-  <option name="CONFIG_PEARPC" type="boolean" value="false"/>
-  <option name="CONFIG_QEMU" type="boolean" value="true"/>
-  <option name="CONFIG_BIG_ENDIAN" type="boolean" value="true"/>
-
-  <!-- Build hosted UNIX Binary -->
-  <option name="CONFIG_HOST_UNIX" type="boolean" value="false"/>
-  <option name="CONFIG_UNIX_QT" type="boolean" value="false"/>
-  <option name="CONFIG_PLUGINS" type="boolean" value="false"/>
-
   <!-- Kernel Debugging -->
   <option name="CONFIG_DEBUG" type="boolean" value="true"/>
   <option name="CONFIG_DEBUG_BOOT" type="boolean" value="false"/>
@@ -90,4 +74,3 @@
   <option name="CONFIG_DRIVER_ESCC" type="boolean" value="true"/>
   <option name="CONFIG_DRIVER_FW_CFG" type="boolean" value="true"/>
   <option name="CONFIG_FW_CFG_ADDR" type="integer" value="0xf0000510"/>
-</config>

Modified: trunk/openbios-devel/config/examples/sparc32_config.xml
==============================================================================
--- trunk/openbios-devel/config/examples/sparc32_config.xml	Sun Oct  3 12:34:50 2010	(r878)
+++ trunk/openbios-devel/config/examples/sparc32_config.xml	Sun Oct  3 16:23:18 2010	(r879)
@@ -1,21 +1,6 @@
-<?xml version="1.0"?>
-<config>
-
-  <!-- generic -->
-  <option name="CONFIG_SPARC" type="boolean" value="true"/>
-  <option name="CONFIG_SPARC32" type="boolean" value="true"/>
-  <option name="CONFIG_BIG_ENDIAN" type="boolean" value="true"/>
-
   <!-- kernel binaries (SPARC32) -->
-  <option name="CONFIG_IMAGE_ELF" type="boolean" value="false"/>
-  <option name="CONFIG_IMAGE_ELF_EMBEDDED" type="boolean" value="true"/>
   <option name="CONFIG_IMAGE_ELF_MULTIBOOT" type="boolean" value="true"/>
 
-  <!-- Build hosted UNIX Binary -->
-  <option name="CONFIG_HOST_UNIX" type="boolean" value="true"/>
-  <option name="CONFIG_UNIX_QT" type="boolean" value="false"/>
-  <option name="CONFIG_PLUGINS" type="boolean" value="false"/>
-
   <!-- Kernel Debugging -->
   <option name="CONFIG_DEBUG" type="boolean" value="true"/>
   <option name="CONFIG_DEBUG_BOOT" type="boolean" value="false"/>
@@ -84,4 +69,3 @@
   <option name="CONFIG_DRIVER_ESCC_SUN" type="boolean" value="true"/>
   <option name="CONFIG_DRIVER_FW_CFG" type="boolean" value="true"/>
   <option name="CONFIG_FW_CFG_ADDR" type="integer" value="0xd00000510ULL"/>
-</config>

Modified: trunk/openbios-devel/config/examples/sparc64_config.xml
==============================================================================
--- trunk/openbios-devel/config/examples/sparc64_config.xml	Sun Oct  3 12:34:50 2010	(r878)
+++ trunk/openbios-devel/config/examples/sparc64_config.xml	Sun Oct  3 16:23:18 2010	(r879)
@@ -1,22 +1,6 @@
-<?xml version="1.0"?>
-<config>
-
-  <!-- generic -->
-  <option name="CONFIG_SPARC" type="boolean" value="true"/>
-  <option name="CONFIG_SPARC64" type="boolean" value="true"/>
-  <option name="CONFIG_QEMU" type="boolean" value="true"/>
-  <option name="CONFIG_BIG_ENDIAN" type="boolean" value="true"/>
-
   <!-- kernel binaries (SPARC64) -->
-  <option name="CONFIG_IMAGE_ELF" type="boolean" value="false"/>
-  <option name="CONFIG_IMAGE_ELF_EMBEDDED" type="boolean" value="true"/>
   <option name="CONFIG_IMAGE_ELF_MULTIBOOT" type="boolean" value="true"/>
 
-  <!-- Build hosted UNIX Binary -->
-  <option name="CONFIG_HOST_UNIX" type="boolean" value="true"/>
-  <option name="CONFIG_UNIX_QT" type="boolean" value="false"/>
-  <option name="CONFIG_PLUGINS" type="boolean" value="false"/>
-
   <!-- Kernel Debugging -->
   <option name="CONFIG_DEBUG" type="boolean" value="true"/>
   <option name="CONFIG_DEBUG_BOOT" type="boolean" value="false"/>
@@ -88,4 +72,3 @@
   <option name="CONFIG_DRIVER_PC_SERIAL" type="boolean" value="true"/>
   <option name="CONFIG_DRIVER_FW_CFG" type="boolean" value="true"/>
   <option name="CONFIG_FW_CFG_ADDR" type="integer" value="0x510"/>
-</config>

Modified: trunk/openbios-devel/config/examples/x86_config.xml
==============================================================================
--- trunk/openbios-devel/config/examples/x86_config.xml	Sun Oct  3 12:34:50 2010	(r878)
+++ trunk/openbios-devel/config/examples/x86_config.xml	Sun Oct  3 16:23:18 2010	(r879)
@@ -1,21 +1,6 @@
-<?xml version="1.0"?>
-<config>
-
-  <!-- generic -->
-  <option name="CONFIG_X86" type="boolean" value="true"/>
-  <option name="CONFIG_LITTLE_ENDIAN" type="boolean" value="true"/>
-  <option name="CONFIG_XBOX" type="boolean" value="false"/>
-
   <!-- kernel binaries (AMD64) -->
-  <option name="CONFIG_IMAGE_ELF" type="boolean" value="true"/>
-  <option name="CONFIG_IMAGE_ELF_EMBEDDED" type="boolean" value="true"/>
   <option name="CONFIG_IMAGE_ELF_MULTIBOOT" type="boolean" value="true"/>
 
-  <!-- Build hosted UNIX Binary -->
-  <option name="CONFIG_HOST_UNIX" type="boolean" value="true"/>
-  <option name="CONFIG_UNIX_QT" type="boolean" value="false"/>
-  <option name="CONFIG_PLUGINS" type="boolean" value="false"/>
-
   <!-- Kernel Debugging -->
   <option name="CONFIG_DEBUG" type="boolean" value="true"/>
   <option name="CONFIG_DEBUG_BOOT" type="boolean" value="true"/>
@@ -76,5 +61,3 @@
   <option name="CONFIG_DRIVER_VGA" type="boolean" value="true"/>
   <option name="CONFIG_DRIVER_FLOPPY" type="boolean" value="false"/>
   <option name="CONFIG_DEBUG_FLOPPY" type="boolean" value="false"/>
-
-</config>

Modified: trunk/openbios-devel/config/scripts/switch-arch
==============================================================================
--- trunk/openbios-devel/config/scripts/switch-arch	Sun Oct  3 12:34:50 2010	(r878)
+++ trunk/openbios-devel/config/scripts/switch-arch	Sun Oct  3 16:23:18 2010	(r879)
@@ -5,12 +5,15 @@
 #
 MOLPATH=$HOME/mol-0.9.71
 
-if [ x"$1" = x ]; then
+if [ x"$1" = x -o "$1" = "-help" ]; then
   printf "Usage:\n  $0 [arch-config]...\n"
-  printf "arch-config values supported for native builds:\n"
-  printf " amd64, ppc, sparc32, sparc64, x86\n"
-  printf "arch-config values supported for cross compiled builds:\n"
-  printf " cross-ppc, cross-sparc32, cross-sparc64, cross-x86\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 xbox-x86\n\n"
+  printf "Example: $0 builtin-sparc32 unix-amd64 builtin-amd64\n"
   exit 0
 fi
 
@@ -102,6 +105,12 @@
     exit 1
 }
 
+config_set_boolean()
+{
+    option=`echo $1 | tr a-z A-Z`
+    echo "<option name=\"$option\" type=\"boolean\" value=\"true\" />"
+}
+
 if ! test -f utils/dist/debian/rules; then
 	echo "switch-arch must be run from the top-level source directory" >&2
 	exit 1
@@ -119,13 +128,93 @@
 VERSION=`head VERSION`
 
 echo "Configuring OpenBIOS on $HOSTARCH for $*"
-for RULES_ARCH in $*; do
-    if ! test -f config/examples/${RULES_ARCH}_config.xml; then
-	echo "Cannot find config/examples/${RULES_ARCH}_config.xml" >&2
-	exit 1
+
+target_list=""
+for target in $*; do
+    case $target in
+        unix-*|builtin-*|plain-*|mol-ppc|briq-ppc|pearpc-ppc|qemu-ppc|xbox-x86)
+        target_list="$target_list $target"
+        ;;
+        cross-*)
+        echo "\"cross-\" prefix is no longer needed"
+        target=`echo $target | sed s/cross-//g`
+        target_list="$target_list builtin-$target"
+        ;;
+        *)
+        #default: build builtin and if possible, unix target
+        target_list="$target_list builtin-$target unix-$target"
+        ;;
+    esac
+done
+
+arch_list=""
+for target in $target_list; do
+    arch=`echo $target | sed s/.*-//g`
+    if ! test -f config/examples/${arch}_config.xml; then
+        echo "Cannot find config/examples/${arch}_config.xml" >&2
+        exit 1
+    fi
+    if ! echo $arch_list | grep -q "$arch"; then
+        arch_list="$arch_list $arch"
     fi
+done
+
+for ARCH in $arch_list; do
+    unix="no"
+    builtin="no"
+    plain="no"
+    mol="no"
+    briq="no"
+    pearpc="no"
+    qemu="no"
+    xbox="no"
+    cross="no"
+
+    for target in $target_list; do
+        case $target in
+            *-$ARCH)
+            :
+            ;;
+            *)
+            continue
+            ;;
+        esac
+        case $target in
+            mol-ppc)
+            mol="yes"
+            ;;
+            briq-ppc)
+            briq="yes"
+            ;;
+            pearpc-ppc)
+            pearpc="yes"
+            ;;
+            builtin-ppc|qemu-ppc)
+            qemu="yes"
+            ;;
+            xbox-x86)
+            xbox="yes"
+            ;;
+            builtin-sparc64)
+            builtin="yes"
+            qemu="yes"
+            ;;
+            unix-*)
+            if [ "$ARCH" != "$HOSTARCH" ]; then
+                # Can't cross compile Unix target
+                continue
+            fi
+            unix="yes"
+            ;;
+            builtin-*)
+            builtin="yes"
+            ;;
+            plain-*)
+            plain="yes"
+            ;;
+        esac
+    done
 
-    ARCH=`echo $RULES_ARCH | sed s/cross-//g`
     case $ARCH in
         amd64)
         select_prefix x86_64
@@ -135,7 +224,11 @@
 
         ppc)
         select_prefix powerpc
-        CFLAGS="-msoft-float -fno-builtin-bcopy -fno-builtin-log2"
+        if [ "$unix" = "no" ]; then
+            CFLAGS="-msoft-float -fno-builtin-bcopy -fno-builtin-log2"
+        else
+            CFLAGS="-fno-builtin"
+        fi
         AS_FLAGS=
         ;;
 
@@ -157,11 +250,12 @@
         AS_FLAGS="-Wa,-32"
         ;;
     esac
-    if test "$ARCH" = "$RULES_ARCH"; then
-        TARGET=""
+    if [ "$ARCH" != "$HOSTARCH" ]; then
+        cross="yes"
     fi
     crosscflags $HOSTARCH $ARCH
     OBJDIR=obj-$ARCH
+
     printf "Initializing build tree $OBJDIR..."
     rm -rf "$OBJDIR"
     mkdir "$OBJDIR"
@@ -170,13 +264,6 @@
     mkdir -p $OBJDIR/target/arch
     mkdir -p $OBJDIR/target/arch/unix
     mkdir -p $OBJDIR/target/arch/$ARCH
-    mkdir -p $OBJDIR/target/arch/ppc
-    mkdir -p $OBJDIR/target/arch/ppc/briq # no autodetection of those..
-    mkdir -p $OBJDIR/target/arch/ppc/pearpc
-    mkdir -p $OBJDIR/target/arch/ppc/qemu
-    mkdir -p $OBJDIR/target/arch/ppc/mol
-    mkdir -p $OBJDIR/target/arch/x86
-    mkdir -p $OBJDIR/target/arch/x86/xbox
     mkdir -p $OBJDIR/target/libgcc
     mkdir -p $OBJDIR/target/kernel
     mkdir -p $OBJDIR/target/libopenbios
@@ -195,6 +282,31 @@
     ln -s ../../../include/arch/$ARCH $OBJDIR/target/include/asm
     #compile the host binary with target settings instead
     #ln -s ../../../include/arch/$HOSTARCH $OBJDIR/host/include/asm
+    if [ "$mol" = "yes" ]; then
+        printf "\nUsing MOL path $MOLPATH...\n"
+        mkdir -p $OBJDIR/target/arch/ppc/mol
+        ln -s $MOLPATH/src/shared/osi_calls.h $OBJDIR/target/include/
+        ln -s $MOLPATH/src/shared/osi.h $OBJDIR/target/include/
+        ln -s $MOLPATH/src/shared/prom.h $OBJDIR/target/include/
+        ln -s $MOLPATH/src/include/boothelper_sh.h $OBJDIR/target/include/
+        ln -s $MOLPATH/src/include/video_sh.h $OBJDIR/target/include/
+        ln -s $MOLPATH/src/include/pseudofs_sh.h $OBJDIR/target/include/
+        ln -s $MOLPATH/src/include/kbd_sh.h $OBJDIR/target/include/
+        ln -s $MOLPATH/src/drivers/disk/include/scsi_sh.h $OBJDIR/target/include/
+        ln -s $MOLPATH/src/drivers/disk/include/ablk_sh.h $OBJDIR/target/include/
+    fi
+    if [ "$briq" = "yes" ]; then
+        mkdir -p $OBJDIR/target/arch/ppc/briq
+    fi
+    if [ "$pearpc" = "yes" ]; then
+        mkdir -p $OBJDIR/target/arch/ppc/pearpc
+    fi
+    if [ "$qemu" = "yes" ]; then
+        mkdir -p $OBJDIR/target/arch/ppc/qemu
+    fi
+    if [ "$xbox" = "yes" ]; then
+        mkdir -p $OBJDIR/target/arch/x86/xbox
+    fi
     echo "ok."
 
     cd $OBJDIR
@@ -203,35 +315,64 @@
 
     printf "Creating target Makefile..."
     echo "ARCH=$ARCH" > $ODIR/config.mak
-    echo "TARGET=$TARGET" >> $ODIR/config.mak
+    if [ "$cross" = "yes" ]; then
+        echo "TARGET=$TARGET" >> $ODIR/config.mak
+    fi
     echo "CFLAGS=$CFLAGS" >> $ODIR/config.mak
     echo "AS_FLAGS=$AS_FLAGS" >> $ODIR/config.mak
     echo "HOSTARCH?=$HOSTARCH" >> $ODIR/config.mak
     echo "CROSSCFLAGS=$CROSSCFLAGS" >> $ODIR/config.mak
     echo "VERSION=\"$VERSION\"" >> $ODIR/config.mak
+
     ln -s $SRCDIR/config/xml/rules.xml $ODIR/rules.xml
-    ln -s $SRCDIR/config/examples/${RULES_ARCH}_config.xml $ODIR/config.xml
+    echo "<?xml version=\"1.0\"?><config>" > $ODIR/config.xml
+    # Generic
+    config_set_boolean CONFIG_$ARCH >> $ODIR/config.xml
+    if [ "$mol" = "yes" ]; then
+        config_set_boolean CONFIG_MOL >> $ODIR/config.xml
+    fi
+    if [ "$briq" = "yes" ]; then
+        config_set_boolean CONFIG_BRIQ >> $ODIR/config.xml
+    fi
+    if [ "$pearpc" = "yes" ]; then
+        config_set_boolean CONFIG_PEARPC >> $ODIR/config.xml
+    fi
+    if [ "$qemu" = "yes" ]; then
+        config_set_boolean CONFIG_QEMU >> $ODIR/config.xml
+    fi
+    if [ "$xbox" = "yes" ]; then
+        config_set_boolean CONFIG_XBOX >> $ODIR/config.xml
+    fi
+    if [ "$targetbigendian" = "yes" ]; then
+        config_set_boolean CONFIG_BIG_ENDIAN >> $ODIR/config.xml
+    else
+        config_set_boolean CONFIG_LITTLE_ENDIAN >> $ODIR/config.xml
+    fi
+    # Kernel binaries
+    if [ "$plain" = "yes" ]; then
+        config_set_boolean CONFIG_IMAGE_ELF >> $ODIR/config.xml
+    fi
+    if [ "$builtin" = "yes" ]; then
+        config_set_boolean CONFIG_IMAGE_ELF_EMBEDDED >> $ODIR/config.xml
+    fi
+    # Build hosted Unix binary?
+    if [ "$unix" = "yes" ]; then
+        config_set_boolean CONFIG_HOST_UNIX >> $ODIR/config.xml
+        #config_set_boolean CONFIG_UNIX_QT >> $ODIR/config.xml
+        #config_set_boolean CONFIG_PLUGINS >> $ODIR/config.xml
+    fi
+    cat $SRCDIR/config/examples/${ARCH}_config.xml >> $ODIR/config.xml
+
+    echo "</config>" >> $ODIR/config.xml
     ln -s ../Makefile.target $ODIR/Makefile
     xsltproc $SRCDIR/config/xml/xinclude.xsl $SRCDIR/build.xml > $ODIR/build-full.xml
     xsltproc $SRCDIR/config/xml/makefile.xsl $ODIR/build-full.xml > $ODIR/rules.mak
     echo "ok."
     printf "Creating config files..."
-    xsltproc $SRCDIR/config/xml/config-c.xsl $SRCDIR/config/examples/${RULES_ARCH}_config.xml > $ODIR/host/include/autoconf.h
-    xsltproc $SRCDIR/config/xml/config-c.xsl $SRCDIR/config/examples/${RULES_ARCH}_config.xml > $ODIR/target/include/autoconf.h
-    xsltproc $SRCDIR/config/xml/config-forth.xsl $SRCDIR/config/examples/${RULES_ARCH}_config.xml > $ODIR/forth/config.fs
+    xsltproc $SRCDIR/config/xml/config-c.xsl $ODIR/config.xml > $ODIR/host/include/autoconf.h
+    xsltproc $SRCDIR/config/xml/config-c.xsl $ODIR/config.xml > $ODIR/target/include/autoconf.h
+    xsltproc $SRCDIR/config/xml/config-forth.xsl $ODIR/config.xml > $ODIR/forth/config.fs
     echo "ok."
 
-    grep CONFIG_MOL $ODIR/forth/config.fs >/dev/null && ( \
-        echo "Using MOL path $MOLPATH..."; \
-        ln -s $MOLPATH/src/shared/osi_calls.h $ODIR/target/include/; \
-        ln -s $MOLPATH/src/shared/osi.h $ODIR/target/include/; \
-        ln -s $MOLPATH/src/shared/prom.h $ODIR/target/include/; \
-        ln -s $MOLPATH/src/include/boothelper_sh.h $ODIR/target/include/; \
-        ln -s $MOLPATH/src/include/video_sh.h $ODIR/target/include/; \
-        ln -s $MOLPATH/src/include/pseudofs_sh.h $ODIR/target/include/; \
-        ln -s $MOLPATH/src/include/kbd_sh.h $ODIR/target/include/; \
-        ln -s $MOLPATH/src/drivers/disk/include/scsi_sh.h $ODIR/target/include/; \
-        ln -s $MOLPATH/src/drivers/disk/include/ablk_sh.h $ODIR/target/include/ ) || true
-
     cd $SRCDIR
 done



More information about the OpenBIOS mailing list