aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile80
1 files changed, 80 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..bf16c3b
--- /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/$*