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

Kevin O'Connor kevin at koconnor.net
Tue May 19 04:10:11 CEST 2015


On Mon, May 18, 2015 at 08:05:17PM +0000, Vladimir 'phcoder' Serbinenko wrote:
> 

> diff --git a/scripts/layoutrom.py b/scripts/layoutrom.py
> index dd770fe..04e7efa 100755
> --- a/scripts/layoutrom.py
> +++ b/scripts/layoutrom.py
> @@ -646,9 +646,10 @@ def main():
>          entrysym = symbols['16'].get('entry_csm')
>      else:
>          entrysym = symbols['16'].get('reset_vector')
> +    mb_section = symbols['32flat'].get('mb_head').section
>      anchorsections = [entrysym.section] + [
>          section for section in allsections
> -        if section.name.startswith('.fixedaddr.')]
> +        if section.name.startswith('.fixedaddr.')] + [mb_section]
>      keepsections = findReachable(anchorsections, checkKeep, symbols)
>      sections = [section for section in allsections if section in keepsections]
>  
> diff --git a/src/fw/coreboot.c b/src/fw/coreboot.c
> index 8fd8449..6610b3a 100644
> --- a/src/fw/coreboot.c
> +++ b/src/fw/coreboot.c
> @@ -551,3 +551,19 @@ cbfs_payload_setup(void)
>          boot_add_cbfs(cfile->fhdr, desc, bootprio_find_named_rom(filename, 0));
>      }
>  }
> +
> +void VARLOW
> +mb_head(u32 mbptr)
> +{
> +  asm volatile(
> +	".align 4\n"
> +	"mb_header:\n"
> +	".long 0x1BADB002\n"
> +	".long 0x00010000\n"
> +	".long -(0x1BADB002+0x00010000)\n"
> +	".long mb_header\n"
> +	".long _reloc_abs_start\n"
> +	".long 0\n"
> +	".long 0\n"
> +	".long entry_elf\n");
> +}

Can this header really exist anywhere in the rom file?  Is 0x1BADB002
a required signature?

If this is just a header, it should not be placed into a function, and
it shouldn't be marked with VARLOW.  Instead it should be placed in
in a top-level assembler (see ASM macro) or in romlayout.S.

-Kevin



More information about the SeaBIOS mailing list