[SeaBIOS] [PATCH 1/5] vgabios: support building multiple variants.

Gerd Hoffmann kraxel at redhat.com
Mon Jan 23 12:30:30 CET 2012


This patch allows to build multiple versions of the vgabios without
the need to reconfigure it each time.  To implement that the way vgabios
configuration works has been changed radically.  It is now done in the
Makefile, using target-specific variables.  Kconfig is used to pick the
variants which should be built.

Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>
---
 Makefile          |   58 ++++++++++++++++++++++++++++-----
 vgasrc/Kconfig    |   92 ++++++++++------------------------------------------
 vgasrc/vgaentry.S |    2 +-
 3 files changed, 68 insertions(+), 84 deletions(-)

diff --git a/Makefile b/Makefile
index 0343ce5..bfed5f9 100644
--- a/Makefile
+++ b/Makefile
@@ -68,7 +68,10 @@ STRIP=strip
 -include $(KCONFIG_CONFIG)
 
 target-y = $(OUT) $(OUT)bios.bin
-target-$(CONFIG_BUILD_VGABIOS) += $(OUT)vgabios.bin
+target-$(CONFIG_BUILD_QEMU_CIRRUS) += $(OUT)vgabios-cirrus.bin
+target-$(CONFIG_BUILD_QEMU_STDVGA) += $(OUT)vgabios-stdvga.bin
+target-$(CONFIG_BUILD_GEODEGX2)    += $(OUT)vgabios-genodegx2.bin
+target-$(CONFIG_BUILD_GEODELX)     += $(OUT)vgabios-genodelx.bin
 
 all: $(target-y)
 
@@ -188,21 +191,58 @@ SRCVGA=src/output.c src/util.c src/pci.c \
 
 CFLAGS16VGA = $(CFLAGS16INC) -g -Isrc
 
-$(OUT)vgaccode.16.s: $(OUT)autoconf.h ; $(call whole-compile, $(CFLAGS16VGA) -S, $(SRCVGA),$@)
-
-$(OUT)vgalayout16.o: vgaentry.S $(OUT)vgaccode.16.s $(OUT)asm-offsets.h
+# defaults
+ENABLE_CIRRUS   := 0
+ENABLE_BOCHS    := 0
+ENABLE_GEODEGX2 := 0
+ENABLE_GEODELX  := 0
+ENABLE_PCI      := 1
+ENABLE_VBE      := 1
+
+# tweak defaults per target
+$(OUT)vgabios-cirrus.bin    : ENABLE_CIRRUS   := 1
+$(OUT)vgabios-stdvga.bin    : ENABLE_BOCHS    := 1
+$(OUT)vgabios-genodegx2.bin : ENABLE_GEODEGX2 := 1
+$(OUT)vgabios-genodelx.bin  : ENABLE_GEODELX  := 1
+
+# add common config options
+CFLAGS16INC += -DCONFIG_VGA_CIRRUS=$(ENABLE_CIRRUS)
+CFLAGS16INC += -DCONFIG_VGA_BOCHS=$(ENABLE_BOCHS)
+CFLAGS16INC += -DCONFIG_VGA_GEODEGX2=$(ENABLE_GEODEGX2)
+CFLAGS16INC += -DCONFIG_VGA_GEODELX=$(ENABLE_GEODELX)
+CFLAGS16INC += -DCONFIG_VGA_PCI=$(ENABLE_PCI)
+CFLAGS16INC += -DCONFIG_VGA_VBE=$(ENABLE_VBE)
+
+# set pci vendor ids per target
+$(OUT)vgabios-cirrus.bin    : CFLAGS16INC += -DCONFIG_VGA_VID=0x1013
+$(OUT)vgabios-stdvga.bin    : CFLAGS16INC += -DCONFIG_VGA_VID=0x1234
+$(OUT)vgabios-genodegx2.bin : CFLAGS16INC += -DCONFIG_VGA_VID=0x100b
+$(OUT)vgabios-genodelx.bin  : CFLAGS16INC += -DCONFIG_VGA_VID=0x1022
+
+# set pci device ids per target
+$(OUT)vgabios-cirrus.bin    : CFLAGS16INC += -DCONFIG_VGA_DID=0x00b8
+$(OUT)vgabios-stdvga.bin    : CFLAGS16INC += -DCONFIG_VGA_DID=0x1111
+$(OUT)vgabios-genodegx2.bin : CFLAGS16INC += -DCONFIG_VGA_DID=0x0030
+$(OUT)vgabios-genodelx.bin  : CFLAGS16INC += -DCONFIG_VGA_DID=0x2081
+
+$(OUT)vgaccode-%.16.s: $(OUT)autoconf.h
+	@echo CFLAGS16INC=$(CFLAGS16INC)
+	$(call whole-compile, $(CFLAGS16VGA) -S, $(SRCVGA),$@)
+
+$(OUT)vgalayout-%16.o: $(OUT)vgaccode-%.16.s vgaentry.S $(OUT)asm-offsets.h
 	@echo "  Compiling (16bit) $@"
-	$(Q)$(CC) $(CFLAGS16INC) -c -D__ASSEMBLY__ -Isrc $< -o $@
+	$(Q)$(CC) $(CFLAGS16INC) -c -D__ASSEMBLY__ \
+		-DVGACODE16='"vgaccode-$*.16.s"' -Isrc vgasrc/vgaentry.S -o $@
 
-$(OUT)vgarom.o: $(OUT)vgalayout16.o $(OUT)vgalayout.lds
+$(OUT)vgarom-%.o: $(OUT)vgalayout-%16.o $(OUT)vgalayout.lds
 	@echo "  Linking $@"
-	$(Q)$(LD) --gc-sections -T $(OUT)vgalayout.lds $(OUT)vgalayout16.o -o $@
+	$(Q)$(LD) --gc-sections -T $(OUT)vgalayout.lds $< -o $@
 
-$(OUT)vgabios.bin.raw: $(OUT)vgarom.o
+$(OUT)vgabios-%.bin.raw: $(OUT)vgarom-%.o
 	@echo "  Extracting binary $@"
 	$(Q)$(OBJCOPY) -O binary $< $@
 
-$(OUT)vgabios.bin: $(OUT)vgabios.bin.raw tools/buildrom.py
+$(OUT)vgabios-%.bin: $(OUT)vgabios-%.bin.raw tools/buildrom.py
 	@echo "  Finalizing rom $@"
 	$(Q)./tools/buildrom.py $< $@
 
diff --git a/vgasrc/Kconfig b/vgasrc/Kconfig
index 881e9ec..ed59065 100644
--- a/vgasrc/Kconfig
+++ b/vgasrc/Kconfig
@@ -1,87 +1,31 @@
 # Kconfig SeaBIOS VGA BIOS configuration
 
 menu "VGA ROM"
-    choice
-        prompt "VGA Hardware Type"
-        default NO_VGABIOS
+    config BUILD_QEMU
+        bool "Build vgabios variants for QEMU"
+        default !COREBOOT
 
-        config NO_VGABIOS
-            bool "None"
-            help
-                Do not build a VGA BIOS.
-
-        config VGA_STANDARD_VGA
-            bool "Standard VGA"
-            help
-                Build basic VGA BIOS support.
-
-        config VGA_CIRRUS
-            bool "QEMU Cirrus CLGD 54xx VGA BIOS"
-            help
-                Build support for Cirrus VGA emulation.
-
-        config VGA_BOCHS
-            bool "Bochs DISPI interface VGA BIOS"
-            help
-                Build support for Bochs DISPI interface.
-
-        config VGA_GEODEGX2
-            bool "GeodeGX2 interface VGA BIOS"
-            help
-                Build support for Geode GX2 vga.
-
-        config VGA_GEODELX
-            bool "GeodeLX interface VGA BIOS"
-            help
-                Build support for Geode LX vga.
-    endchoice
-
-    config BUILD_VGABIOS
-        bool
-        default !NO_VGABIOS
-
-    config VGA_VBE
-        depends on BUILD_VGABIOS
-        bool "Video BIOS Extensions (VBE)"
-        default y
+    config BUILD_QEMU_CIRRUS
+        bool "QEMU Cirrus CLGD 54xx VGA BIOS"
+        default BUILD_QEMU
         help
-            Support VBE.
+            Build vgabios for cirrus VGA emulation.
 
-    config VGA_PCI
-        depends on BUILD_VGABIOS
-        bool "PCI ROM Headers"
-        default y
+    config BUILD_QEMU_STDVGA
+        bool "QEMU standard VGA BIOS"
+        default BUILD_QEMU
         help
-            Build PCI ROM headers so the vga rom can be extracted from
-            a PCI device.
+            Build vgabios for QEMU standard VGA emulation,
+            using Bochs DISPI interface.
 
-    config OVERRIDE_PCI_ID
-        depends on VGA_PCI
-        bool "Override PCI Vendor and Device IDs"
+    config BUILD_GEODEGX2
+        bool "GeodeGX2 interface VGA BIOS"
         help
-            Specify specific values for the PCI Vendor and Device IDs.
+            Build vgabios for Geode GX2 vga.
 
-    config VGA_VID
-        depends on VGA_PCI
-        hex
-        prompt "PCI Vendor ID" if OVERRIDE_PCI_ID
-        default 0x1013 if VGA_CIRRUS
-        default 0x1234 if VGA_BOCHS
-        default 0x100b if VGA_GEODEGX2
-        default 0x1022 if VGA_GEODELX
-        default 0x0000
+    config BUILD_GEODELX
+        bool "GeodeLX interface VGA BIOS"
         help
-            Vendor ID for the PCI ROM
+            Build vgabios for Geode LX vga.
 
-    config VGA_DID
-        depends on VGA_PCI
-        hex
-        prompt "PCI Vendor ID" if OVERRIDE_PCI_ID
-        default 0x00b8 if VGA_CIRRUS
-        default 0x1111 if VGA_BOCHS
-        default 0x0030 if VGA_GEODEGX2
-        default 0x2081 if VGA_GEODELX
-        default 0x0000
-        help
-            Device ID for the PCI ROM
 endmenu
diff --git a/vgasrc/vgaentry.S b/vgasrc/vgaentry.S
index 112857b..d83a4ca 100644
--- a/vgasrc/vgaentry.S
+++ b/vgasrc/vgaentry.S
@@ -10,7 +10,7 @@
  ****************************************************************/
 
         .code16gcc
-#include "vgaccode.16.s"
+#include VGACODE16
 
 #include "config.h" // CONFIG_*
 #include "entryfuncs.S" // ENTRY_*
-- 
1.7.1




More information about the SeaBIOS mailing list