<p dir="ltr"><br>
Le 19 mai 2015 15:51, "Kevin O'Connor" <<a href="mailto:kevin@koconnor.net">kevin@koconnor.net</a>> a écrit :<br>
><br>
> On Tue, May 19, 2015 at 08:14:56AM +0200, Vladimir 'φ-coder/phcoder' Serbinenko wrote:<br>
> > On 19.05.2015 04:10, Kevin O'Connor wrote:<br>
> > > On Mon, May 18, 2015 at 08:05:17PM +0000, Vladimir 'phcoder' Serbinenko wrote:<br>
> > >><br>
> > ><br>
> > >> diff --git a/scripts/layoutrom.py b/scripts/layoutrom.py<br>
> > >> index dd770fe..04e7efa 100755<br>
> > >> --- a/scripts/layoutrom.py<br>
> > >> +++ b/scripts/layoutrom.py<br>
> > >> @@ -646,9 +646,10 @@ def main():<br>
> > >>          entrysym = symbols['16'].get('entry_csm')<br>
> > >>      else:<br>
> > >>          entrysym = symbols['16'].get('reset_vector')<br>
> > >> +    mb_section = symbols['32flat'].get('mb_head').section<br>
> > >>      anchorsections = [entrysym.section] + [<br>
> > >>          section for section in allsections<br>
> > >> -        if section.name.startswith('.fixedaddr.')]<br>
> > >> +        if section.name.startswith('.fixedaddr.')] + [mb_section]<br>
> > >>      keepsections = findReachable(anchorsections, checkKeep, symbols)<br>
> > >>      sections = [section for section in allsections if section in keepsections]<br>
> > >><br>
> > >> diff --git a/src/fw/coreboot.c b/src/fw/coreboot.c<br>
> > >> index 8fd8449..6610b3a 100644<br>
> > >> --- a/src/fw/coreboot.c<br>
> > >> +++ b/src/fw/coreboot.c<br>
> > >> @@ -551,3 +551,19 @@ cbfs_payload_setup(void)<br>
> > >>          boot_add_cbfs(cfile->fhdr, desc, bootprio_find_named_rom(filename, 0));<br>
> > >>      }<br>
> > >>  }<br>
> > >> +<br>
> > >> +void VARLOW<br>
> > >> +mb_head(u32 mbptr)<br>
> > >> +{<br>
> > >> +  asm volatile(<br>
> > >> +  ".align 4\n"<br>
> > >> +  "mb_header:\n"<br>
> > >> +  ".long 0x1BADB002\n"<br>
> > >> +  ".long 0x00010000\n"<br>
> > >> +  ".long -(0x1BADB002+0x00010000)\n"<br>
> > >> +  ".long mb_header\n"<br>
> > >> +  ".long _reloc_abs_start\n"<br>
> > >> +  ".long 0\n"<br>
> > >> +  ".long 0\n"<br>
> > >> +  ".long entry_elf\n");<br>
> > >> +}<br>
> > ><br>
> > > Can this header really exist anywhere in the rom file?<br>
> > It needs to be in the first 8K, aligned to 4 bytes.<br>
> > >  Is 0x1BADB002<br>
> > > a required signature?<br>
> > ><br>
> > Yes<br>
> > > If this is just a header, it should not be placed into a function, and<br>
> > > it shouldn't be marked with VARLOW.<br>
> > VARLOW is to get it in first 8K. 32-bit function is for easy access to<br>
> > _reloc_abs_start which is address of the first byte that needs to be loaded.<br>
><br>
> The VARLOW macro does other things in addition to location in the<br>
> final binary - namely it treats the space as a variable and reserves<br>
> space in low memory.  If there is a specific location the table needs<br>
> to be, it really should be placed in that location by<br>
> layoutrom.py:doLayout().<br>
><br>
Ok<br>
> The _reloc_abs_start definition isn't available if<br>
> CONFIG_RELOCATE_INIT is disabled - I think the symbol you want is<br>
> code32flat_start.  Both should be available in a top level ASM32FLAT()<br>
> and in romlayout.S.<br>
><br>
code32flat-start misses all the relocation entries<br>
> Also, I just noticed in your comments that the bios.bin.raw file was<br>
> used in your example.  That's not an exported file today (the build<br>
> could fail while that file still exists).  Does multi-boot require a<br>
> raw image to deploy (that is, a single linear area of memory that is<br>
> copied to a final location)?<br>
><br>
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<br>
> -Kevin<br>
</p>