Hi, Kevin,

I am experimenting with v3 and better integration of SeaBIOS and
coreboot. For that, I am copying a SeaBIOS image to the FSEG during
coreboot's VGA init code. In addition I added another 32bit entry point
to SeaBIOS at 0xffc0 (Thus, living at 0xfffc0)

int copy_systembios(void)
{
        struct mem_file archive, result;
        int ret;
        init_archive(&archive);
        ret = find_file(&archive, "bios.bin", &result);
        if (ret) {
                printk(BIOS_WARNING, "No legacy bios found.\n");
                return -1;
        }
        process_file(&result, (void *)0xf0000);
        return 0;
}

void run_bios(struct device *dev, unsigned long addr)
{
        int i;
        void (*init_systembios)(void) = (void *)0xfffc0;
        copy_systembios();
        init_systembios();
        real_mode_switch_call_vga((dev->bus->secondary << 8) |
dev->path.pci.devfn);
}

Now, the entry point looks like this:
diff -ur -x .git seabios2/src/romlayout.S seabios/src/romlayout.S
--- seabios2/src/romlayout.S    2008-11-06 15:46:44.000000000 +0100
+++ seabios/src/romlayout.S     2008-11-01 11:38:06.000000000 +0100
@@ -544,6 +544,18 @@
         ORG 0xff54
         IRQ_ENTRY_ARG 05

+.code32
+        ORG 0xffc0 // coreboot Entry Point
+       mov $0x3f8, %dx
+       mov $0x44, %al
+       outb %al, %dx // print
+       call _code32__init
+       mov $0x3f8, %dx
+       mov $0x45, %al
+       outb %al, %dx
+       ret
+.code16gcc
+
         ORG 0xfff0 // Power-up Entry Point
         ljmpw $SEG_BIOS, $post16

And _init looks like this (simplified):

void VISIBLE32
_init()
{
    outb('@', 0x3f8);
}

Unfortunately, this does not seem to work. The machine jumps somewhere
else and will triple fault eventually.

The outb to serial console in the assembler entry point work fine. If I
comment out the call to _code32__init, the function also returns nicely.
(printing "DE" on the way. But as soon as I leave the call in, seabios
crashes after printing "D" It does not even print the @.

Any hints?


Also, find attached a patch to allow cross compilation of SeaBIOS and
make it work with systems where /bin/echo does not know the option -e

Stefan

-- 
coresystems GmbH • Brahmsstr. 16 • D-79104 Freiburg i. Br.
      Tel.: +49 761 7668825 • Fax: +49 761 7664613
Email: [EMAIL PROTECTED]  • http://www.coresystems.de/
Registergericht: Amtsgericht Freiburg • HRB 7656
Geschäftsführer: Stefan Reinauer • Ust-IdNr.: DE245674866

Fix cross compilation issues of seabios

Signed-off-by: Stefan Reinauer <[EMAIL PROTECTED]>

diff -ur -x .git seabios/Makefile seabios/Makefile
--- seabios/Makefile	2008-10-31 15:46:44.000000000 +0100
+++ seabios/Makefile	2008-10-31 22:50:12.000000000 +0100
@@ -56,7 +56,7 @@
 DEPHACK=
 define whole-compile
 @echo "  Compiling whole program $3"
-$(Q)/bin/echo -e '$(foreach i,$2,#include "../$i"\n)' > $3.tmp.c
+$(Q)printf '$(foreach i,$2,#include "../$i"\n)' > $3.tmp.c
 $(Q)$(CC) $1 -c $3.tmp.c -o $3
 endef
 else
@@ -93,32 +93,32 @@
 
 $(OUT)rom32.o: $(OUT)romlayout32.o $(OUT)rombios32.lds
 	@echo "  Linking (no relocs) $@"
-	$(Q)ld -r -T $(OUT)rombios32.lds $< -o $@
+	$(Q)$(LD) -r -T $(OUT)rombios32.lds $< -o $@
 
 $(OUT)rom16.o: $(OUT)romlayout16.o $(OUT)rom32.o $(OUT)rombios16.lds
 	@echo "  Linking $@"
-	$(Q)objcopy --prefix-symbols=_code32_ $(OUT)rom32.o $(OUT)rom32.rename.o
-	$(Q)ld -T $(OUT)rombios16.lds -R $(OUT)rom32.rename.o $< -o $@
+	$(Q)$(OBJCOPY) --prefix-symbols=_code32_ $(OUT)rom32.o $(OUT)rom32.rename.o
+	$(Q)$(LD) -T $(OUT)rombios16.lds -R $(OUT)rom32.rename.o $< -o $@
 
 $(OUT)rom.o: $(OUT)rom16.o $(OUT)rom32.o $(OUT)rombios.lds
 	@echo "  Linking $@"
-	$(Q)ld -T $(OUT)rombios.lds $(OUT)rom16.o $(OUT)rom32.o -o $@
+	$(Q)$(LD) -T $(OUT)rombios.lds $(OUT)rom16.o $(OUT)rom32.o -o $@
 
 $(OUT)bios.bin.elf: $(OUT)rom.o
 	@echo "  Prepping $@"
-	$(Q)nm $< | ./tools/checkrom.py
-	$(Q)strip $< -o $@
+	$(Q)$(NM) $< | ./tools/checkrom.py
+	$(Q)$(STRIP) $< -o $@
 
 $(OUT)bios.bin: $(OUT)bios.bin.elf
 	@echo "  Extracting binary $@"
-	$(Q)objcopy -O binary $< $@
+	$(Q)$(OBJCOPY) -O binary $< $@
 
 
 ####### Generic rules
 clean:
-	rm -rf $(OUT)
+	$(Q)rm -rf $(OUT)
 
 $(OUT):
-	mkdir $@
+	$(Q)mkdir $@
 
 -include $(OUT)*.d

Attachment: signature.asc
Description: OpenPGP digital signature

--
coreboot mailing list: coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to