Add auto-generated version info to each build.
authorKevin O'Connor <kevin@koconnor.net>
Thu, 30 Jul 2009 00:41:39 +0000 (20:41 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Thu, 30 Jul 2009 00:41:39 +0000 (20:41 -0400)
Add versioning info to initial debug and screen banner output.

Makefile
src/optionroms.c
src/post.c
src/rombios.lds.S
src/util.h

index 2e2ba1dbf46cb7a12eeaafbc394f3f279c10abf4..37589097295dde049f8512d99561a0320955fb41 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,9 @@
 #
 # This file may be distributed under the terms of the GNU LGPLv3 license.
 
+# Program version
+VERSION=pre-0.4.2-$(shell date +"%Y%m%d_%H%M%S")-$(shell hostname)
+
 # Output directory
 OUT=out/
 
@@ -134,11 +137,13 @@ $(OUT)rom32.o: $(OUT)code32.o $(OUT)rombios32.lds
        $(Q)$(LD) -r -T $(OUT)rombios32.lds $< -o $@
 
 $(OUT)rom.o: $(OUT)rom16.o $(OUT)rom32.o $(OUT)rombios16.lds $(OUT)rombios.lds
-       @echo "  Linking $@"
+       @echo "  Linking $@ (version \"$(VERSION)\")"
+       $(Q)echo 'const char VERSION[] __attribute__((section(".data32.version"))) = "$(VERSION)";' > $(OUT)version.c
+       $(Q)$(CC) $(CFLAGS) -c $(OUT)version.c -o $(OUT)version.o
        $(Q)$(LD) -T $(OUT)rombios16.lds $(OUT)rom16.o -R $(OUT)rom32.o -o $(OUT)rom16.reloc.o
        $(Q)$(STRIP) $(OUT)rom16.reloc.o -o $(OUT)rom16.final.o
        $(Q)$(OBJCOPY) --adjust-vma 0xf0000 $(OUT)rom16.o $(OUT)rom16.moved.o
-       $(Q)$(LD) -T $(OUT)rombios.lds $(OUT)rom16.final.o $(OUT)rom32.o -R $(OUT)rom16.moved.o -o $@
+       $(Q)$(LD) -T $(OUT)rombios.lds $(OUT)rom16.final.o $(OUT)rom32.o $(OUT)version.o -R $(OUT)rom16.moved.o -o $@
 
 $(OUT)bios.bin.elf: $(OUT)rom.o
        @echo "  Prepping $@"
index 00fa85dcb5cf792cb426a6870d5a0fe3b90695d7..819b318c306de0894b09d6c418ce4d2463bb60aa 100644 (file)
@@ -274,7 +274,7 @@ map_pcirom(u16 bdf, u32 vendev)
 
     struct rom_header *rom = (void*)orig;
     for (;;) {
-        dprintf(5, "Inspecting possible rom at %p (dv=%x bdf=%x)\n"
+        dprintf(5, "Inspecting possible rom at %p (dv=%08x bdf=%x)\n"
                 , rom, vendev, bdf);
         if (rom->signature != OPTION_ROM_SIGNATURE) {
             dprintf(6, "No option rom signature (got %x)\n", rom->signature);
@@ -290,7 +290,7 @@ map_pcirom(u16 bdf, u32 vendev)
         if (vd == vendev && pci->type == PCIROM_CODETYPE_X86)
             // A match
             break;
-        dprintf(6, "Didn't match dev/ven (got %x) or type (got %d)\n"
+        dprintf(6, "Didn't match dev/ven (got %08x) or type (got %d)\n"
                 , vd, pci->type);
         if (pci->indicator & 0x80) {
             dprintf(6, "No more images left\n");
@@ -313,7 +313,7 @@ static int
 init_pcirom(u16 bdf, int isvga)
 {
     u32 vendev = pci_config_readl(bdf, PCI_VENDOR_ID);
-    dprintf(4, "Attempting to init PCI bdf %02x:%02x.%x (dev/ven %x)\n"
+    dprintf(4, "Attempting to init PCI bdf %02x:%02x.%x (dev/ven %08x)\n"
             , pci_bdf_to_bus(bdf), pci_bdf_to_dev(bdf), pci_bdf_to_fn(bdf)
             , vendev);
     struct rom_header *rom = lookup_hardcode(vendev);
@@ -437,7 +437,7 @@ vga_setup()
     call16_int(0x10, &br);
 
     // Write to screen.
-    printf("Starting SeaBIOS\n\n");
+    printf("Starting SeaBIOS (version %s)\n\n", VERSION);
 }
 
 void
index abbd2dd614864590b6b5dd04297eaeb31bf44a0d..e80146f68efd16b471999d7ba889aa36b41dd283 100644 (file)
@@ -202,7 +202,7 @@ _start()
     init_dma();
 
     debug_serial_setup();
-    dprintf(1, "Start bios\n");
+    dprintf(1, "Start bios (version %s)\n", VERSION);
 
     // Allow writes to modify bios area (0xf0000)
     make_bios_writable();
index 0f6e388bab8074f5d852444b357b98e36becb546..3d59fad4b531b910547fe7acc8e3563e026518b1 100644 (file)
@@ -11,6 +11,7 @@ SECTIONS
 {
         .text code32_start : {
                 *(.text32)
+                *(.data32.version)
 
                 . = code16_start ;
                 *(.text16)
index 6cdcffef782eb32f1bd159976a2130bf68d53ba7..d369a49c506b3e834784934b94752deab78091fb 100644 (file)
@@ -247,4 +247,7 @@ extern u8 BiosChecksum;
 // mptable.c
 extern int irq0override;
 
+// version (auto generated file out/version.c)
+extern const char VERSION[];
+
 #endif // util.h