diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000000..bf16c3b562
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,80 @@
+# directories
+DESTDIR	?=
+prefix	?= /usr/local
+datadir	:= $(DESTDIR)$(prefix)/share/qemu-firmware
+
+vgabios_variants := stdvga cirrus vmware qxl isavga virtio
+vgabios_targets  := $(subst -isavga,,$(patsubst %,vgabios-%.bin,$(vgabios_variants)))
+
+#
+# cross compiler auto detection
+#
+path := $(subst :, ,$(PATH))
+system := $(shell uname -s | tr "A-Z" "a-z")
+
+# first find cross binutils in path
+find-cross-ld = $(firstword $(wildcard $(patsubst %,%/$(1)-*$(system)*-ld,$(path))))
+# then check we have cross gcc too
+find-cross-gcc = $(firstword $(wildcard $(patsubst %ld,%gcc,$(call find-cross-ld,$(1)))))
+# finally strip off path + toolname so we get the prefix
+find-cross-prefix = $(subst gcc,,$(notdir $(call find-cross-gcc,$(1))))
+
+powerpc64_cross_prefix := $(call find-cross-prefix,powerpc64)
+powerpc_cross_prefix := $(call find-cross-prefix,powerpc)
+x86_64_cross_prefix := $(call find-cross-prefix,x86_64)
+
+# tag our seabios builds
+SEABIOS_EXTRAVERSION="-prebuilt.qemu-project.org"
+
+default help:
+	@echo
+	@echo "nothing is done by default"
+	@echo
+	@echo "build targets:"
+	@echo "  bios           -- update bios.bin (seabios)"
+	@echo "  vgabios        -- update vgabios binaries (seabios)"
+	@echo
+	@echo "other targets:"
+	@echo "  clean          -- cleanup"
+	@echo "  install        -- install blobs to $(datadir)"
+	@echo
+	@echo "You can set DESTDIR and prefix on the command line to"
+	@echo "to change the install target directory, for example:"
+	@echo "$ make prefix=/usr install"
+	@echo
+
+install:
+	mkdir -p $(datadir)
+	cp -v blobs/*.bin $(datadir)
+
+bios: build-seabios-config-seabios-128k build-seabios-config-seabios-256k
+	cp repos/seabios/builds/seabios-128k/bios.bin blobs/bios.bin
+	cp repos/seabios/builds/seabios-256k/bios.bin blobs/bios-256k.bin
+
+vgabios: $(patsubst %,vgabios-%,$(vgabios_variants))
+
+vgabios-isavga: build-seabios-config-vga-isavga
+	cp repos/seabios/builds/vga-isavga/vgabios.bin blobs/vgabios.bin
+
+vgabios-%: build-seabios-config-vga-%
+	cp repos/seabios/builds/vga-$*/vgabios.bin blobs/vgabios-$*.bin
+
+build-seabios-config-%: configs/% submodule-seabios
+	mkdir -p repos/seabios/builds/$*
+	cp $< repos/seabios/builds/$*/.config
+	$(MAKE) -C repos/seabios \
+		EXTRAVERSION=$(SEABIOS_EXTRAVERSION) \
+		CROSS_COMPILE=$(x86_64_cross_prefix) \
+		KCONFIG_CONFIG=$(CURDIR)/repos/seabios/builds/$*/.config \
+		OUT=$(CURDIR)/repos/seabios/builds/$*/ oldnoconfig
+	$(MAKE) -C repos/seabios \
+		EXTRAVERSION=$(SEABIOS_EXTRAVERSION) \
+		CROSS_COMPILE=$(x86_64_cross_prefix) \
+		KCONFIG_CONFIG=$(CURDIR)/repos/seabios/builds/$*/.config \
+		OUT=$(CURDIR)/repos/seabios/builds/$*/ all
+
+clean:
+	rm -rf repos/seabios/.config repos/seabios/out repos/seabios/builds
+
+submodule-%:
+	git submodule update --init repos/$*
diff --git a/configs/seabios-128k b/configs/seabios-128k
new file mode 100644
index 0000000000..93203af0de
--- /dev/null
+++ b/configs/seabios-128k
@@ -0,0 +1,12 @@
+# for qemu machine types 1.7 + older
+# need to turn off features (xhci,uas) to make it fit into 128k
+CONFIG_QEMU=y
+CONFIG_ROM_SIZE=128
+CONFIG_BOOTSPLASH=n
+CONFIG_XEN=n
+CONFIG_USB_OHCI=n
+CONFIG_USB_XHCI=n
+CONFIG_USB_UAS=n
+CONFIG_SDCARD=n
+CONFIG_TCGBIOS=n
+CONFIG_MPT_SCSI=n
diff --git a/configs/seabios-256k b/configs/seabios-256k
new file mode 100644
index 0000000000..65e5015c2f
--- /dev/null
+++ b/configs/seabios-256k
@@ -0,0 +1,3 @@
+# for qemu machine types 2.0 + newer
+CONFIG_QEMU=y
+CONFIG_ROM_SIZE=256
diff --git a/configs/vga-cirrus b/configs/vga-cirrus
new file mode 100644
index 0000000000..c8fe58239f
--- /dev/null
+++ b/configs/vga-cirrus
@@ -0,0 +1,3 @@
+CONFIG_BUILD_VGABIOS=y
+CONFIG_VGA_CIRRUS=y
+CONFIG_VGA_PCI=y
diff --git a/configs/vga-isavga b/configs/vga-isavga
new file mode 100644
index 0000000000..e55e294a0c
--- /dev/null
+++ b/configs/vga-isavga
@@ -0,0 +1,3 @@
+CONFIG_BUILD_VGABIOS=y
+CONFIG_VGA_BOCHS=y
+CONFIG_VGA_PCI=n
diff --git a/configs/vga-qxl b/configs/vga-qxl
new file mode 100644
index 0000000000..d393f0c34f
--- /dev/null
+++ b/configs/vga-qxl
@@ -0,0 +1,6 @@
+CONFIG_BUILD_VGABIOS=y
+CONFIG_VGA_BOCHS=y
+CONFIG_VGA_PCI=y
+CONFIG_OVERRIDE_PCI_ID=y
+CONFIG_VGA_VID=0x1b36
+CONFIG_VGA_DID=0x0100
diff --git a/configs/vga-stdvga b/configs/vga-stdvga
new file mode 100644
index 0000000000..7d063b787c
--- /dev/null
+++ b/configs/vga-stdvga
@@ -0,0 +1,3 @@
+CONFIG_BUILD_VGABIOS=y
+CONFIG_VGA_BOCHS=y
+CONFIG_VGA_PCI=y
diff --git a/configs/vga-virtio b/configs/vga-virtio
new file mode 100644
index 0000000000..aa7a15ba11
--- /dev/null
+++ b/configs/vga-virtio
@@ -0,0 +1,6 @@
+CONFIG_BUILD_VGABIOS=y
+CONFIG_VGA_BOCHS=y
+CONFIG_VGA_PCI=y
+CONFIG_OVERRIDE_PCI_ID=y
+CONFIG_VGA_VID=0x1af4
+CONFIG_VGA_DID=0x1050
diff --git a/configs/vga-vmware b/configs/vga-vmware
new file mode 100644
index 0000000000..eb10427afd
--- /dev/null
+++ b/configs/vga-vmware
@@ -0,0 +1,6 @@
+CONFIG_BUILD_VGABIOS=y
+CONFIG_VGA_BOCHS=y
+CONFIG_VGA_PCI=y
+CONFIG_OVERRIDE_PCI_ID=y
+CONFIG_VGA_VID=0x15ad
+CONFIG_VGA_DID=0x0405
