<div dir="ltr">The point of that code in the Makefile is to ensure that you're not accidentally loading the payload over the same memory addresses that coreboot is still using (e.g. for the ramstage itself).<div><br></div><div>I think the problem here is that we've assumed all ARMv7 systems have certain regions (see the "<span style="color:rgb(0,0,0)">check-ramstage-overlap-regions += postram_cbfs_cache stack ttb" line in arch/arm/Makefile.inc), which is true for all real SoCs but not for the emulation code. I would've hoped that the check just succeeds by default if a region isn't there, but it looks like it might not (it's a fiddly little thing trying to do math in bash unfortunately... I would have to see what symbols exactly end up in the ramstage.elf from the emulator to really track down what it does in this case).</span></div><div><span style="color:rgb(0,0,0)"><br></span></div><div><span style="color:rgb(0,0,0)">So we either need to fix that check to deal with this, or make the qemu-armv7 mainboard Makefile.inc extract those regions back out of check-ramstage-overlap-regions again, or fix the emulation code to work more like a real ARMv7 board. (I think the last one might be best even though it's also the most work, since the main point of emulation code is really testing and there's little point in testing something that works completely differently than any of the real options.)</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 17, 2017 at 1:51 PM, Paul Menzel via coreboot <span dir="ltr"><<a href="mailto:coreboot@coreboot.org" target="_blank">coreboot@coreboot.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear coreboot folks,<br>
<br>
<br>
Am Freitag, den 17.02.2017, 09:28 +0100 schrieb Paul Menzel:<br>
<br>
> What payload can be easily build and used for ARM targets?<br>
><br>
> If you have any scripts, could you please share those? Maybe they can<br>
> be integrated into coreboot, so that there is also a default payload<br>
> available for ARM targets.<br>
><br>
> Building GRUB resulted in a payload that is too big. I’ll try building<br>
> with a bigger ROM chip size for the target *QEMU armv7* later.<br>
<br>
It looks like, there is actually enough room, but cbfstool claims there<br>
is an overlap.<br>
<br>
```<br>
[…]<br>
    CBFS       fallback/<wbr>payload<br>
INFO: Performing operation on 'COREBOOT' region...<br>
ERROR: Ramstage region _postram_cbfs_cache overlapped by: fallback/payload<br>
```<br>
<br>
But there is enough room available. Any idea, what is going on? The<br>
commands below work just fine.<br>
<br>
```<br>
$ git describe --tag<br>
4.5-1004-g17335fab17<br>
$ make V=1<br>
[…]<br>
printf "    CBFS       fallback/payload\n"<br>
    CBFS       fallback/payload<br>
build/util/cbfstool/cbfstool build/coreboot.pre.tmp add-payload -f payloads/external/GRUB2/grub2/<wbr>build/default_payload.elf -n fallback/payload -t payload -c LZMA  -r COREBOOT<br>
true<br>
mv build/coreboot.pre.tmp build/coreboot.pre<br>
programs=$( build/util/cbfstool/cbfstool build/coreboot.pre print -v | sed -n '\%fallback/payload%,\%^[^ ]\{4\}%s%    .*load: \(0x[0-9a-fA-F]*\),.*length: [0-9]*/\([0-9]*\).*%\1 \2%p' ; ) ; \<br>
regions=$( echo ramstage ; arm-linux-gnueabi-objdump -t build/cbfs/fallback/ramstage.<wbr>elf | sed -n '/ _ramstage$/s/^\([0-9a-fA-F]*\) .*/0x\1/p' ; arm-linux-gnueabi-objdump -t build/cbfs/fallback/ramstage.<wbr>elf | sed -n '/ _eramstage$/s/^\([0-9a-fA-F]*\<wbr>) .*/0x\1/p' ;   echo postram_cbfs_cache ; arm-linux-gnueabi-objdump -t build/cbfs/fallback/ramstage.<wbr>elf | sed -n '/ _postram_cbfs_cache$/s/^\([0-<wbr>9a-fA-F]*\) .*/0x\1/p' ; arm-linux-gnueabi-objdump -t build/cbfs/fallback/ramstage.<wbr>elf | sed -n '/ _epostram_cbfs_cache$/s/^\([0-<wbr>9a-fA-F]*\) .*/0x\1/p' ;   echo stack ; arm-linux-gnueabi-objdump -t build/cbfs/fallback/ramstage.<wbr>elf | sed -n '/ _stack$/s/^\([0-9a-fA-F]*\) .*/0x\1/p' ; arm-linux-gnueabi-objdump -t build/cbfs/fallback/ramstage.<wbr>elf | sed -n '/ _estack$/s/^\([0-9a-fA-F]*\) .*/0x\1/p' ;   echo ttb ; arm-linux-gnueabi-objdump -t build/cbfs/fallback/ramstage.<wbr>elf | sed -n '/ _ttb$/s/^\([0-9a-fA-F]*\) .*/0x\1/p' ; arm-linux-gnueabi-objdump -t build/cbfs/fallback/ramstage.<wbr>elf | sed -n '/ _ettb$/s/^\([0-9a-fA-F]*\) .*/0x\1/p' ; ) ; \<br>
pstart= ; pend= ; \<br>
for x in $programs; do \<br>
    if [ -z $pstart ]; then pstart=$(($x)) ; continue ; fi ; \<br>
    pend=$(($pstart + $x)) ; \<br>
    rname= ; rstart= ; rend= ; \<br>
    for y in $regions ; do \<br>
        if [ -z $rname ]; then rname=$y ; continue ; fi ; \<br>
        if [ -z $rstart ]; then rstart=$(($y)) ; continue ; fi ; \<br>
        rend=$(($y)) ; \<br>
        if [ $pstart -lt $rend -a $rstart -lt $pend ]; then \<br>
            echo "ERROR: Ramstage region _$rname overlapped by:" \<br>
                  fallback/payload ; \<br>
            exit 1 ; \<br>
        fi ; \<br>
        rname= ; rstart= ; rend= ; \<br>
    done ; \<br>
    pstart= ; pend= ; \<br>
done<br>
INFO: Performing operation on 'COREBOOT' region...<br>
ERROR: Ramstage region _postram_cbfs_cache overlapped by: fallback/payload<br>
```<br>
<br>
Commit fffee873c86 (Makefile: Add build-time overlap check for programs<br>
loaded after coreboot) [1] adds this check.<br>
<br>
<br>
Thanks,<br>
<br>
Paul<br>
<br>
<br>
[1] <a href="https://review.coreboot.org/13949" rel="noreferrer" target="_blank">https://review.coreboot.org/<wbr>13949</a><br>--<br>
coreboot mailing list: <a href="mailto:coreboot@coreboot.org">coreboot@coreboot.org</a><br>
<a href="https://www.coreboot.org/mailman/listinfo/coreboot" rel="noreferrer" target="_blank">https://www.coreboot.org/<wbr>mailman/listinfo/coreboot</a><br></blockquote></div><br></div>