Skip to contentSkip to conversation

build upstream qemu and seabios by default

PATCH Superseded Stefano Stabellini 2 participants 7 messages Sep 9, 2011 – Sep 13, 2011 Kbuild

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 build upstream qemu and seabios by default

Hi all,
this is the third version of the patch series to introduce upstream qemu and seabios in the xen-unstable build system.

Changes to v2:

- move tools/git-checkout.sh to scripts/git-checkout.sh;

- use git-checkout.sh for seabios;

- improve seabios integration with tools/firmware make system;

- add qemu-xen-traditional, qemu-xen and seabios dir entries to .hgignore.

Changes to v1:

- always build upstream qemu and seabios, rather than introducing them as an option.

Cheers,

Stefano

#1 lore raw

PATCH v3 1/4 Move the ioemu-dir-find shell script to an external file

Add support for configuring upstream qemu and rename ioemu-remote ioemu-dir-remote.

.hgignore +1 -1
@@ -291,7 +291,7 @@
 ^tools/xm-test/lib/XmTestLib/config.py$
 ^tools/xm-test/lib/XmTestReport/xmtest.py$
 ^tools/xm-test/tests/.*\.test$
-^tools/ioemu-remote
+^tools/ioemu-dir-remote
 ^tools/ioemu-dir$
 ^tools/ocaml/.*/.*\.annot$
 ^tools/ocaml/.*/.*\.cmx?a$
scripts/git-checkout.sh new file +46 -0

46 lines not on this page · raw message

tools/Makefile +4 -31
@@ -70,7 +70,7 @@ clean: subdirs-clean
 
 .PHONY: distclean
 distclean: subdirs-distclean
-	rm -rf ioemu-dir ioemu-remote
+	rm -rf ioemu-dir ioemu-dir-remote
 
 ifneq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
 IOEMU_CONFIGURE_CROSS ?= --cpu=$(XEN_TARGET_ARCH) \
@@ -78,41 +78,14 @@ IOEMU_CONFIGURE_CROSS ?= --cpu=$(XEN_TAR
 			 --interp-prefix=$(CROSS_SYS_ROOT)
 endif
 
-QEMU_ROOT := $(shell if [ -d "$(CONFIG_QEMU)" ]; then echo "$(CONFIG_QEMU)"; else echo .; fi)
-ifneq ($(QEMU_ROOT),.)
-export QEMU_ROOT
-endif
-
 ioemu-dir-find:
-	set -ex; \
-	if test -d $(CONFIG_QEMU); then \
-		mkdir -p ioemu-dir; \
-	else \
-		if [ ! -d ioemu-remote ]; then \
-			rm -rf ioemu-remote ioemu-remote.tmp; \
-			mkdir ioemu-remote.tmp; rmdir ioemu-remote.tmp; \
-			$(GIT) clone $(CONFIG_QEMU) ioemu-remote.tmp; \
-			if [ "$(QEMU_TAG)" ]; then			\
-				cd ioemu-remote.tmp;			\
-				$(GIT) branch -D dummy >/dev/null 2>&1 ||:; \
-				$(GIT) checkout -b dummy $(QEMU_TAG);	\
-				cd ..;					\
-			fi;						\
-			mv ioemu-remote.tmp ioemu-remote; \
-		fi; \
-		rm -f ioemu-dir; \
-		ln -sf ioemu-remote ioemu-dir; \
-	fi
-	set -e; \
-		$(buildmakevars2shellvars); \
-		cd ioemu-dir; \
-		$(QEMU_ROOT)/xen-setup $(IOEMU_CONFIGURE_CROSS)
-
+	$(XEN_ROOT)/scripts/git-checkout.sh $(CONFIG_QEMU) $(QEMU_TAG) ioemu-dir
+	
 .PHONY: ioemu-dir-force-update
 ioemu-dir-force-update:
 	set -ex; \
 	if [ "$(QEMU_TAG)" ]; then \
-		cd ioemu-remote; \
+		cd ioemu-dir-remote; \
 		$(GIT) fetch origin; \
 		$(GIT) reset --hard $(QEMU_TAG); \
 	fi
#2 lore raw

Re: [PATCH v3 1/4] Move the ioemu-dir-find shell script to an external file

Quoted 22 lines · On 09/09/11 13:17, [email protected] wrote:

Add support for configuring upstream qemu and rename ioemu-remote ioemu-dir-remote.

.hgignore +1 -1
@@ -291,7 +291,7 @@
  ^tools/xm-test/lib/XmTestLib/config.py$
  ^tools/xm-test/lib/XmTestReport/xmtest.py$
  ^tools/xm-test/tests/.*\.test$
-^tools/ioemu-remote
+^tools/ioemu-dir-remote
  ^tools/ioemu-dir$
  ^tools/ocaml/.*/.*\.annot$
  ^tools/ocaml/.*/.*\.cmx?a$
scripts/git-checkout.sh new file +0 -0
new file mode 100755

scripts/git-checkout.sh line 1

Quoted 1 line
scripts/git-checkout.sh new file +1 -0
@@ -0,0 +1,46 @@
+#!/bin/bash

There is no bashism. This should be #!/bin/sh.

Christoph

Quoted 102 lines
scripts/git-checkout.sh new file +45 -0
+
+TREE=$1
+TAG=$2
+DIR=$3
+
+
+if test -d $TREE; then
+	mkdir -p $DIR
+	ROOT=$TREE
+else
+	if test \! -d $DIR-remote; then
+		rm -rf $DIR-remote $DIR-remote.tmp;
+		mkdir $DIR-remote.tmp; rmdir $DIR-remote.tmp;
+		git clone $TREE $DIR-remote.tmp;
+		if test "$TAG" ; then
+			cd $DIR-remote.tmp
+			git branch -D dummy>/dev/null 2>&1 ||:
+			git checkout -b dummy $TAG
+			cd ..
+		fi
+		mv $DIR-remote.tmp $DIR-remote
+	fi
+	rm -f $DIR
+	ln -sf $DIR-remote $DIR
+	ROOT=.
+fi
+
+set -e
+cd $DIR
+# is this qemu-xen-traditional?
+if test -f $ROOT/xen-setup; then
+	$ROOT/xen-setup $IOEMU_CONFIGURE_CROSS
+# is this qemu-xen?
+elif test -f $ROOT/configure; then
+	cd $ROOT
+	./configure --enable-xen --target-list=i386-softmmu \
+		--extra-cflags="-I$XEN_ROOT/tools/include \
+		-I$XEN_ROOT/tools/libxc \
+		-I$XEN_ROOT/tools/xenstore" \
+		--extra-ldflags="-L$XEN_ROOT/tools/libxc \
+		-L$XEN_ROOT/tools/libxenstore" \
+		--bindir=/usr/lib/xen/bin \
+		--disable-kvm \
+		$IOEMU_CONFIGURE_CROSS
+fi
tools/Makefile +4 -31
@@ -70,7 +70,7 @@ clean: subdirs-clean
 
  .PHONY: distclean
  distclean: subdirs-distclean
-	rm -rf ioemu-dir ioemu-remote
+	rm -rf ioemu-dir ioemu-dir-remote
 
  ifneq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
  IOEMU_CONFIGURE_CROSS ?= --cpu=$(XEN_TARGET_ARCH) \
@@ -78,41 +78,14 @@ IOEMU_CONFIGURE_CROSS ?= --cpu=$(XEN_TAR
  			 --interp-prefix=$(CROSS_SYS_ROOT)
  endif
 
-QEMU_ROOT := $(shell if [ -d "$(CONFIG_QEMU)" ]; then echo "$(CONFIG_QEMU)"; else echo .; fi)
-ifneq ($(QEMU_ROOT),.)
-export QEMU_ROOT
-endif
-
  ioemu-dir-find:
-	set -ex; \
-	if test -d $(CONFIG_QEMU); then \
-		mkdir -p ioemu-dir; \
-	else \
-		if [ ! -d ioemu-remote ]; then \
-			rm -rf ioemu-remote ioemu-remote.tmp; \
-			mkdir ioemu-remote.tmp; rmdir ioemu-remote.tmp; \
-			$(GIT) clone $(CONFIG_QEMU) ioemu-remote.tmp; \
-			if [ "$(QEMU_TAG)" ]; then			\
-				cd ioemu-remote.tmp;			\
-				$(GIT) branch -D dummy>/dev/null 2>&1 ||:; \
-				$(GIT) checkout -b dummy $(QEMU_TAG);	\
-				cd ..;					\
-			fi;						\
-			mv ioemu-remote.tmp ioemu-remote; \
-		fi; \
-		rm -f ioemu-dir; \
-		ln -sf ioemu-remote ioemu-dir; \
-	fi
-	set -e; \
-		$(buildmakevars2shellvars); \
-		cd ioemu-dir; \
-		$(QEMU_ROOT)/xen-setup $(IOEMU_CONFIGURE_CROSS)
-
+	$(XEN_ROOT)/scripts/git-checkout.sh $(CONFIG_QEMU) $(QEMU_TAG) ioemu-dir
+	
  .PHONY: ioemu-dir-force-update
  ioemu-dir-force-update:
  	set -ex; \
  	if [ "$(QEMU_TAG)" ]; then \
-		cd ioemu-remote; \
+		cd ioemu-dir-remote; \
  		$(GIT) fetch origin; \
  		$(GIT) reset --hard $(QEMU_TAG); \
  	fi
Signature · 6 lines
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85689 Dornach b. Muenchen
Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632
#3 lore raw

Re: [PATCH v3 1/4] Move the ioemu-dir-find shell script to an external file

Quoted 18 lines · Christoph Egger
Quoted 17 lines · On 09/09/11 13:17, [email protected] wrote:

Add support for configuring upstream qemu and rename ioemu-remote ioemu-dir-remote.

.hgignore +1 -1
@@ -291,7 +291,7 @@
  ^tools/xm-test/lib/XmTestLib/config.py$
  ^tools/xm-test/lib/XmTestReport/xmtest.py$
  ^tools/xm-test/tests/.*\.test$
-^tools/ioemu-remote
+^tools/ioemu-dir-remote
  ^tools/ioemu-dir$
  ^tools/ocaml/.*/.*\.annot$
  ^tools/ocaml/.*/.*\.cmx?a$
Quoted 8 lines

scripts/git-checkout.sh line 1

Quoted 6 lines
scripts/git-checkout.sh new file +1 -0
new file mode 100755
@@ -0,0 +1,46 @@
+#!/bin/bash

There is no bashism. This should be #!/bin/sh.

yep, you are right.

#4 lore raw

PATCH v3 2/4 Rename ioemu-dir as qemu-xen-traditional-dir

In reply to Stefano Stabellini
.hgignore +2 -2
diff -r f27aff6f2cfe .hgignore
@@ -291,8 +291,8 @@
 ^tools/xm-test/lib/XmTestLib/config.py$
 ^tools/xm-test/lib/XmTestReport/xmtest.py$
 ^tools/xm-test/tests/.*\.test$
-^tools/ioemu-dir-remote
-^tools/ioemu-dir$
+^tools/qemu-xen-traditional-dir-remote
+^tools/qemu-xen-traditional-dir$
 ^tools/ocaml/.*/.*\.annot$
 ^tools/ocaml/.*/.*\.cmx?a$
 ^tools/ocaml/.*/META$
Makefile +7 -7
diff -r f27aff6f2cfe Makefile
@@ -70,7 +70,7 @@ install-tools:
 	$(MAKE) -C tools install
 
 ifeq ($(CONFIG_IOEMU),y)
-install-tools: tools/ioemu-dir
+install-tools: tools/qemu-xen-traditional-dir
 endif
 
 .PHONY: install-kernels
@@ -78,18 +78,18 @@ install-kernels:
 	for i in $(XKERNELS) ; do $(MAKE) $$i-install || exit 1; done
 
 .PHONY: install-stubdom
-install-stubdom: tools/ioemu-dir install-tools
+install-stubdom: tools/qemu-xen-traditional-dir install-tools
 	$(MAKE) -C stubdom install
 ifeq (x86_64,$(XEN_TARGET_ARCH))
 	XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom install-grub
 endif
 
-tools/ioemu-dir:
-	$(MAKE) -C tools ioemu-dir-find
+tools/qemu-xen-traditional-dir:
+	$(MAKE) -C tools qemu-xen-traditional-dir-find
 
-.PHONY: tools/ioemu-dir-force-update
-tools/ioemu-dir-force-update:
-	$(MAKE) -C tools ioemu-dir-force-update
+.PHONY: tools/qemu-xen-traditional-dir-force-update
+tools/qemu-xen-traditional-dir-force-update:
+	$(MAKE) -C tools qemu-xen-traditional-dir-force-update
 
 .PHONY: install-docs
 install-docs:
tools/Makefile +11 -11
diff -r f27aff6f2cfe tools/Makefile
@@ -30,7 +30,7 @@ SUBDIRS-$(LIBXENAPI_BINDINGS) += libxen
 
 # do not recurse in to a dir we are about to delete
 ifneq "$(MAKECMDGOALS)" "distclean"
-SUBDIRS-$(CONFIG_IOEMU) += ioemu-dir
+SUBDIRS-$(CONFIG_IOEMU) += qemu-xen-traditional-dir
 endif
 
 SUBDIRS-y += xenpmd
@@ -70,7 +70,7 @@ clean: subdirs-clean
 
 .PHONY: distclean
 distclean: subdirs-distclean
-	rm -rf ioemu-dir ioemu-dir-remote
+	rm -rf qemu-xen-traditional-dir qemu-xen-traditional-dir-remote
 
 ifneq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
 IOEMU_CONFIGURE_CROSS ?= --cpu=$(XEN_TARGET_ARCH) \
@@ -78,24 +78,24 @@ IOEMU_CONFIGURE_CROSS ?= --cpu=$(XEN_TAR
 			 --interp-prefix=$(CROSS_SYS_ROOT)
 endif
 
-ioemu-dir-find:
-	$(XEN_ROOT)/scripts/git-checkout.sh $(CONFIG_QEMU) $(QEMU_TAG) ioemu-dir
+qemu-xen-traditional-dir-find:
+	$(XEN_ROOT)/scripts/git-checkout.sh $(CONFIG_QEMU) $(QEMU_TAG) qemu-xen-traditional-dir
 	
-.PHONY: ioemu-dir-force-update
-ioemu-dir-force-update:
+.PHONY: qemu-xen-traditional-dir-force-update
+qemu-xen-traditional-dir-force-update:
 	set -ex; \
 	if [ "$(QEMU_TAG)" ]; then \
-		cd ioemu-dir-remote; \
+		cd qemu-xen-traditional-dir-remote; \
 		$(GIT) fetch origin; \
 		$(GIT) reset --hard $(QEMU_TAG); \
 	fi
 
-subdir-all-ioemu-dir subdir-install-ioemu-dir: ioemu-dir-find
+subdir-all-qemu-xen-traditional-dir subdir-install-qemu-xen-traditional-dir: qemu-xen-traditional-dir-find
 
-subdir-clean-ioemu-dir:
-	set -e; if test -d ioemu-dir/.; then \
+subdir-clean-qemu-xen-traditional-dir:
+	set -e; if test -d qemu-xen-traditional-dir/.; then \
 		$(buildmakevars2shellvars); \
-		$(MAKE) -C ioemu-dir clean; \
+		$(MAKE) -C qemu-xen-traditional-dir clean; \
 	fi
 
 subdir-clean-debugger/gdbsx subdir-distclean-debugger/gdbsx: .phony
#5 lore raw

PATCH v3 2/4 Clone and build upstream Qemu by default

In reply to Stefano Stabellini
.hgignore +2 -0
diff -r 4280714efabd .hgignore
@@ -293,6 +293,8 @@
 ^tools/xm-test/tests/.*\.test$
 ^tools/qemu-xen-traditional-dir-remote
 ^tools/qemu-xen-traditional-dir$
+^tools/qemu-xen-dir-remote
+^tools/qemu-xen-dir$
 ^tools/ocaml/.*/.*\.annot$
 ^tools/ocaml/.*/.*\.cmx?a$
 ^tools/ocaml/.*/META$
Config.mk +4 -0
diff -r 4280714efabd Config.mk
@@ -192,6 +192,10 @@ else
 QEMU_REMOTE=git://xenbits.xensource.com/qemu-xen-unstable.git
 endif
 
+# Only available through the git protocol at the moment
+QEMU_UPSTREAM_URL ?= git://xenbits.xen.org/people/sstabellini/qemu-dm.git
+QEMU_UPSTREAM_TAG ?= origin/xen-stable-0.15
+
 # Specify which qemu-dm to use. This may be `ioemu' to use the old
 # Mercurial in-tree version, or a local directory, or a git URL.
 # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
Makefile +4 -1
diff -r 4280714efabd Makefile
@@ -70,7 +70,7 @@ install-tools:
 	$(MAKE) -C tools install
 
 ifeq ($(CONFIG_IOEMU),y)
-install-tools: tools/qemu-xen-traditional-dir
+install-tools: tools/qemu-xen-traditional-dir tools/qemu-xen-dir
 endif
 
 .PHONY: install-kernels
@@ -91,6 +91,9 @@ tools/qemu-xen-traditional-dir:
 tools/qemu-xen-traditional-dir-force-update:
 	$(MAKE) -C tools qemu-xen-traditional-dir-force-update
 
+tools/qemu-xen-dir:
+	$(MAKE) -C tools qemu-xen-dir-find
+
 .PHONY: install-docs
 install-docs:
 	sh ./docs/check_pkgs && $(MAKE) -C docs install || true
tools/Makefile +13 -0
diff -r 4280714efabd tools/Makefile
@@ -31,6 +31,7 @@ SUBDIRS-$(LIBXENAPI_BINDINGS) += libxen
 # do not recurse in to a dir we are about to delete
 ifneq "$(MAKECMDGOALS)" "distclean"
 SUBDIRS-$(CONFIG_IOEMU) += qemu-xen-traditional-dir
+SUBDIRS-$(CONFIG_IOEMU) += qemu-xen-dir
 endif
 
 SUBDIRS-y += xenpmd
@@ -71,6 +72,7 @@ clean: subdirs-clean
 .PHONY: distclean
 distclean: subdirs-distclean
 	rm -rf qemu-xen-traditional-dir qemu-xen-traditional-dir-remote
+	rm -rf qemu-xen-dir qemu-xen-dir-remote
 
 ifneq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
 IOEMU_CONFIGURE_CROSS ?= --cpu=$(XEN_TARGET_ARCH) \
@@ -81,6 +83,9 @@ endif
 qemu-xen-traditional-dir-find:
 	$(XEN_ROOT)/scripts/git-checkout.sh $(CONFIG_QEMU) $(QEMU_TAG) qemu-xen-traditional-dir
 	
+qemu-xen-dir-find:
+	$(XEN_ROOT)/scripts/git-checkout.sh $(QEMU_UPSTREAM_URL) $(QEMU_UPSTREAM_TAG) qemu-xen-dir
+	
 .PHONY: qemu-xen-traditional-dir-force-update
 qemu-xen-traditional-dir-force-update:
 	set -ex; \
@@ -98,6 +103,14 @@ subdir-clean-qemu-xen-traditional-dir:
 		$(MAKE) -C qemu-xen-traditional-dir clean; \
 	fi
 
+subdir-all-qemu-xen-dir subdir-install-qemu-xen-dir: qemu-xen-dir-find
+
+subdir-clean-qemu-xen-dir:
+	set -e; if test -d qemu-xen-dir/.; then \
+		$(buildmakevars2shellvars); \
+		$(MAKE) -C qemu-xen-dir clean; \
+	fi
+
 subdir-clean-debugger/gdbsx subdir-distclean-debugger/gdbsx: .phony
 	$(MAKE) -C debugger/gdbsx clean
#6 lore raw

PATCH v3 2/4 Clone and build Seabios by default

In reply to Stefano Stabellini
.hgignore +2 -0
diff -r b62e9640049f .hgignore
@@ -295,6 +295,8 @@
 ^tools/qemu-xen-traditional-dir$
 ^tools/qemu-xen-dir-remote
 ^tools/qemu-xen-dir$
+^tools/tools/firmware/seabios-dir-remote
+^tools/tools/firmware/seabios-dir$
 ^tools/ocaml/.*/.*\.annot$
 ^tools/ocaml/.*/.*\.cmx?a$
 ^tools/ocaml/.*/META$
Config.mk +2 -9
diff -r b62e9640049f Config.mk
@@ -195,6 +195,8 @@ endif
 # Only available through the git protocol at the moment
 QEMU_UPSTREAM_URL ?= git://xenbits.xen.org/people/sstabellini/qemu-dm.git
 QEMU_UPSTREAM_TAG ?= origin/xen-stable-0.15
+SEABIOS_UPSTREAM_URL=git://git.qemu.org/seabios.git
+SEABIOS_UPSTREAM_TAG ?= 7fc039e9c262b4199fab497f3e12f4e425c37560
 
 # Specify which qemu-dm to use. This may be `ioemu' to use the old
 # Mercurial in-tree version, or a local directory, or a git URL.
@@ -208,15 +210,6 @@ QEMU_TAG ?= cd776ee9408ff127f934a707c1a3
 # Short answer -- do not enable this unless you know what you are
 # doing and are prepared for some pain.
 
-# SeaBIOS integration is a work in progress. Before enabling this
-# option you must clone git://git.qemu.org/seabios.git/, possibly add
-# some development patches and then build it yourself before pointing
-# this variable to it (using an absolute path).
-#
-# Note that using SeaBIOS requires the use the upstream qemu as the
-# device model.
-SEABIOS_DIR ?= 
-
 # Optional components
 XENSTAT_XENTOP     ?= y
 VTPM_TOOLS         ?= n
tools/firmware/Makefile +10 -2
diff -r b62e9640049f tools/firmware/Makefile
@@ -6,13 +6,18 @@ TARGET      := hvmloader/hvmloader
 INST_DIR := $(DESTDIR)$(XENFIRMWAREDIR)
 
 SUBDIRS :=
+SUBDIRS += seabios-dir
 SUBDIRS += rombios
 SUBDIRS += vgabios
 SUBDIRS += etherboot
 SUBDIRS += hvmloader
 
+seabios-dir:
+	$(XEN_ROOT)/scripts/git-checkout.sh $(SEABIOS_UPSTREAM_URL) $(SEABIOS_UPSTREAM_TAG) seabios-dir
+	cp seabios-config seabios-dir/.config;
+
 .PHONY: all
-all:
+all: seabios-dir
 	@set -e; if [ $$((`( bcc -v 2>&1 | grep version || echo 0.0.0 ) | cut -d' ' -f 3 | awk -F. '{ printf "0x%02x%02x%02x", $$1, $$2, $$3}'`)) -lt $$((0x00100e)) ] ; then \
 	echo "==========================================================================="; \
 	echo "Require dev86 rpm or bin86 & bcc debs version >= 0.16.14 to build firmware!"; \
@@ -35,4 +40,7 @@ clean: subdirs-clean
 distclean: subdirs-distclean
 
 subdir-distclean-etherboot: .phony
-	$(MAKE) -C etherboot distclean
\ No newline at end of file
+	$(MAKE) -C etherboot distclean
+
+subdir-distclean-seabios-dir: .phony
+	rm -rf seabios-dir seabios-dir-remote
tools/firmware/hvmloader/Makefile +1 -0
diff -r b62e9640049f tools/firmware/hvmloader/Makefile
@@ -44,6 +44,7 @@ CFLAGS += -DENABLE_ROMBIOS
 ROMBIOS_ROM := $(ROMBIOS_DIR)/BIOS-bochs-latest
 endif
 
+SEABIOS_DIR := ../seabios-dir
 ifneq ($(SEABIOS_DIR),)
 OBJS += seabios.o
 CFLAGS += -DENABLE_SEABIOS
tools/firmware/seabios-config new file +73 -0

73 lines not on this page · raw message