[coreboot] Ramstage region overlap with QEMU armv7 and GRUB (was: What payloads are easily usable with ARM targets?)

Julius Werner jwerner at chromium.org
Wed Feb 22 03:30:52 CET 2017


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).

I think the problem here is that we've assumed all ARMv7 systems have
certain regions (see the "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).

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.)

On Fri, Feb 17, 2017 at 1:51 PM, Paul Menzel via coreboot <
coreboot at coreboot.org> wrote:

> Dear coreboot folks,
>
>
> Am Freitag, den 17.02.2017, 09:28 +0100 schrieb Paul Menzel:
>
> > What payload can be easily build and used for ARM targets?
> >
> > If you have any scripts, could you please share those? Maybe they can
> > be integrated into coreboot, so that there is also a default payload
> > available for ARM targets.
> >
> > Building GRUB resulted in a payload that is too big. I’ll try building
> > with a bigger ROM chip size for the target *QEMU armv7* later.
>
> It looks like, there is actually enough room, but cbfstool claims there
> is an overlap.
>
> ```
> […]
>     CBFS       fallback/payload
> INFO: Performing operation on 'COREBOOT' region...
> ERROR: Ramstage region _postram_cbfs_cache overlapped by: fallback/payload
> ```
>
> But there is enough room available. Any idea, what is going on? The
> commands below work just fine.
>
> ```
> $ git describe --tag
> 4.5-1004-g17335fab17
> $ make V=1
> […]
> printf "    CBFS       fallback/payload\n"
>     CBFS       fallback/payload
> build/util/cbfstool/cbfstool build/coreboot.pre.tmp add-payload -f
> payloads/external/GRUB2/grub2/build/default_payload.elf -n
> fallback/payload -t payload -c LZMA  -r COREBOOT
> true
> mv build/coreboot.pre.tmp build/coreboot.pre
> 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' ; ) ; \
> regions=$( echo ramstage ; arm-linux-gnueabi-objdump -t
> build/cbfs/fallback/ramstage.elf | sed -n '/
> _ramstage$/s/^\([0-9a-fA-F]*\) .*/0x\1/p' ; arm-linux-gnueabi-objdump -t
> build/cbfs/fallback/ramstage.elf | sed -n '/
> _eramstage$/s/^\([0-9a-fA-F]*\) .*/0x\1/p' ;   echo postram_cbfs_cache ;
> arm-linux-gnueabi-objdump -t build/cbfs/fallback/ramstage.elf | sed -n '/
> _postram_cbfs_cache$/s/^\([0-9a-fA-F]*\) .*/0x\1/p' ;
> arm-linux-gnueabi-objdump -t build/cbfs/fallback/ramstage.elf | sed -n '/
> _epostram_cbfs_cache$/s/^\([0-9a-fA-F]*\) .*/0x\1/p' ;   echo stack ;
> arm-linux-gnueabi-objdump -t build/cbfs/fallback/ramstage.elf | sed -n '/
> _stack$/s/^\([0-9a-fA-F]*\) .*/0x\1/p' ; arm-linux-gnueabi-objdump -t
> build/cbfs/fallback/ramstage.elf | sed -n '/ _estack$/s/^\([0-9a-fA-F]*\)
> .*/0x\1/p' ;   echo ttb ; arm-linux-gnueabi-objdump -t
> build/cbfs/fallback/ramstage.elf | sed -n '/ _ttb$/s/^\([0-9a-fA-F]*\)
> .*/0x\1/p' ; arm-linux-gnueabi-objdump -t build/cbfs/fallback/ramstage.elf
> | sed -n '/ _ettb$/s/^\([0-9a-fA-F]*\) .*/0x\1/p' ; ) ; \
> pstart= ; pend= ; \
> for x in $programs; do \
>     if [ -z $pstart ]; then pstart=$(($x)) ; continue ; fi ; \
>     pend=$(($pstart + $x)) ; \
>     rname= ; rstart= ; rend= ; \
>     for y in $regions ; do \
>         if [ -z $rname ]; then rname=$y ; continue ; fi ; \
>         if [ -z $rstart ]; then rstart=$(($y)) ; continue ; fi ; \
>         rend=$(($y)) ; \
>         if [ $pstart -lt $rend -a $rstart -lt $pend ]; then \
>             echo "ERROR: Ramstage region _$rname overlapped by:" \
>                   fallback/payload ; \
>             exit 1 ; \
>         fi ; \
>         rname= ; rstart= ; rend= ; \
>     done ; \
>     pstart= ; pend= ; \
> done
> INFO: Performing operation on 'COREBOOT' region...
> ERROR: Ramstage region _postram_cbfs_cache overlapped by: fallback/payload
> ```
>
> Commit fffee873c86 (Makefile: Add build-time overlap check for programs
> loaded after coreboot) [1] adds this check.
>
>
> Thanks,
>
> Paul
>
>
> [1] https://review.coreboot.org/13949
> --
> coreboot mailing list: coreboot at coreboot.org
> https://www.coreboot.org/mailman/listinfo/coreboot
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.coreboot.org/pipermail/coreboot/attachments/20170221/d8f8156a/attachment.html>


More information about the coreboot mailing list