[SeaBIOS] [PATCH 1/3] Add multiboot header to bios.bin.raw

Kevin O'Connor kevin at koconnor.net
Tue May 19 17:03:52 CEST 2015


On Tue, May 19, 2015 at 04:43:49PM +0200, Vladimir 'phcoder' Serbinenko wrote:
> Le 19 mai 2015 15:51, "Kevin O'Connor" <kevin at koconnor.net> a écrit :
> > The _reloc_abs_start definition isn't available if
> > CONFIG_RELOCATE_INIT is disabled - I think the symbol you want is
> > code32flat_start.  Both should be available in a top level ASM32FLAT()
> > and in romlayout.S.
> >
> code32flat-start misses all the relocation entries

It shouldn't - take a look at the generated file
out/romlayout32flat.lds

> > Also, I just noticed in your comments that the bios.bin.raw file was
> > used in your example.  That's not an exported file today (the build
> > could fail while that file still exists).  Does multi-boot require a
> > raw image to deploy (that is, a single linear area of memory that is
> > copied to a final location)?
> >
> Multiboot can either load ELF or a linear file. In either case the header
> needs to be in first 8K of resulting file. File produced by SeaBIOS
> contains few hundred kilobytes of zeros. I didn't manage to insert 12 bytes
> header in first 8K because of it. I'll give it another try

The system linkers tend to do funky things with alignment, which is
what causes the .elf files to be huge.  I don't know how to fix that.

I wouldn't worry about it too much though - something like the below
(totally untested) should be fine.

-Kevin


--- a/Makefile
+++ b/Makefile
@@ -88,6 +88,7 @@ target-y :=
 target-$(CONFIG_QEMU) += $(OUT)bios.bin
 target-$(CONFIG_CSM) += $(OUT)Csm16.bin
 target-$(CONFIG_COREBOOT) += $(OUT)bios.bin.elf
+target-$(CONFIG_MULTIBOOT) += $(OUT)bios.bin.multiboot
 target-$(CONFIG_BUILD_VGABIOS) += $(OUT)vgabios.bin
 
 all: $(target-y)
@@ -194,6 +195,10 @@ $(OUT)Csm16.bin: $(OUT)bios.bin.prep
        @echo "  Creating $@"
        $(Q)cp $< $@
 
+$(OUT)bios.bin.multiboot: $(OUT)rom.o $(OUT)bios.bin.prep
+       @echo "  Creating $@"
+       $(Q)$(OBJCOPY) -O binary $< $@
+
 $(OUT)bios.bin.elf: $(OUT)rom.o $(OUT)bios.bin.prep
        @echo "  Creating $@"
        $(Q)$(STRIP) -R .comment $< -o $(OUT)bios.bin.elf



More information about the SeaBIOS mailing list