Patchwork [v2] pc-bios: build OpenBIOS if possible

login
register
mail settings
Submitter Blue Swirl
Date Feb. 16, 2013, 3:36 p.m.
Message ID <6f0349e4b1f427d920762861abc0da8f7a7aa47b.1361028634.git.blauwirbel@gmail.com>
Download mbox | patch
Permalink /patch/220965/
State New
Headers show

Comments

Blue Swirl - Feb. 16, 2013, 3:36 p.m.
Check if xsltproc and Sparc32, Sparc64 and PPC compilers
are available. If found, rebuild OpenBIOS ROMs from submodule.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
v2:
 fix crossgcc check
 print which ROMs will be built
 create the build directory in configure 
 don't overwrite source versions when building out of tree

I've pushed the OpenBIOS patch (r1099).
---
 configure                 |   25 +++++++++++++++++++++++++
 pc-bios/openbios/Makefile |   29 +++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 0 deletions(-)
 create mode 100644 pc-bios/openbios/Makefile
Mark Cave-Ayland - Feb. 19, 2013, 8:23 p.m.
On 16/02/13 15:36, Blue Swirl wrote:

> Check if xsltproc and Sparc32, Sparc64 and PPC compilers
> are available. If found, rebuild OpenBIOS ROMs from submodule.
>
> Signed-off-by: Blue Swirl<blauwirbel@gmail.com>

If possible, can we also fix the automatic git svn sync with OpenBIOS 
SVN for openbios.git on qemu.org? It used to update every 24 hours or 
so, but now it seems to always be behind without manual prodding from 
Anthony :/


ATB,

Mark.

Patch

diff --git a/configure b/configure
index 8789324..ded5c7b 100755
--- a/configure
+++ b/configure
@@ -76,6 +76,20 @@  has() {
     type "$1" >/dev/null 2>&1
 }
 
+# check for cross compile or native tools for arch $1
+has_crossgcc() {
+    if test "$cpu" = "$1"; then
+        return 1
+    fi
+    for ccprefix in "${1}-linux-gnu-" "${1}-linux-" \
+        "${1}-elf-" "${1}-eabi-"; do
+        if has "${ccprefix}gcc"; then
+            return 1
+        fi
+    done
+    return 0
+}
+
 # search for an executable in PATH
 path_of() {
     local_command="$1"
@@ -3241,6 +3255,14 @@  if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
   roms="$roms spapr-rtas"
 fi
 
+# OpenBIOS needs xsltproc, and Sparc32, Sparc64 and PPC cross compilers
+if has xsltproc; then
+    if has_crossgcc "sparc" && has_crossgcc "sparc64" && \
+        \( has_crossgcc "powerpc" ||  has_crossgcc "ppc" \); then
+        roms="$roms openbios"
+    fi
+fi
+
 # add pixman flags after all config tests are done
 QEMU_CFLAGS="$QEMU_CFLAGS $pixman_cflags"
 libs_softmmu="$libs_softmmu $pixman_libs"
@@ -3344,6 +3366,7 @@  echo "GlusterFS support $glusterfs"
 echo "virtio-blk-data-plane $virtio_blk_data_plane"
 echo "gcov              $gcov_tool"
 echo "gcov enabled      $gcov"
+echo "build ROMs        $roms"
 
 if test "$sdl_too_old" = "yes"; then
 echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -4281,6 +4304,7 @@  fi
 # build tree in object directory in case the source is not in the current directory
 DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32"
 DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas"
+DIRS="$DIRS pc-bios/openbios pc-bios/openbios/build"
 DIRS="$DIRS roms/seabios roms/vgabios"
 DIRS="$DIRS qapi-generated"
 FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
@@ -4288,6 +4312,7 @@  FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
 FILES="$FILES tests/tcg/lm32/Makefile"
 FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
 FILES="$FILES pc-bios/spapr-rtas/Makefile"
+FILES="$FILES pc-bios/openbios/Makefile"
 FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
 for bios_file in \
     $source_path/pc-bios/*.bin \
diff --git a/pc-bios/openbios/Makefile b/pc-bios/openbios/Makefile
new file mode 100644
index 0000000..0849cf8
--- /dev/null
+++ b/pc-bios/openbios/Makefile
@@ -0,0 +1,29 @@ 
+all: build-all
+# Dummy command so that make thinks it has done something
+	@true
+
+include ../../config-host.mak
+
+.PHONY : all clean build-all
+
+# Avoid polluting sub-make environment, especially MAKEFLAGS causes build to fail
+unexport AS AS_FLAGS CC CFLAGS CPP INCLUDES LD LDFLAGS VERSION SRCDIR ODIR
+unexport HOSTCC HOSTCFLAGS HOSTARCH HOSTINCLUDES TARGET MAKE MAKEFLAGS MFLAGS
+
+build-all: config
+	make -C build build-verbose
+	rm -f ../openbios-*
+	cp build/obj-sparc32/openbios-builtin.elf ../openbios-sparc32
+	cp build/obj-sparc64/openbios-builtin.elf ../openbios-sparc64
+	cp build/obj-ppc/openbios-qemu.elf ../openbios-ppc
+
+config: config-timestamp
+	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
+
+config-timestamp: $(SRC_PATH)/roms/openbios/config/scripts/switch-arch
+	cd build && sh $(SRC_PATH)/roms/openbios/config/scripts/switch-arch sparc32 sparc64 ppc
+	touch $@
+
+clean:
+	make -C build $@
+	rm -f config config-timestamp