[U-Boot] [PATCH v2] rpi: passthrough of the firmware provided FDT blob

Stephen Warren swarren at wwwdotorg.org
Tue Nov 8 17:36:19 CET 2016


On 11/08/2016 03:32 AM, Cédric Schieli wrote:
>
> 2016-11-08 4:14 GMT+01:00 Stephen Warren <swarren at wwwdotorg.org
> <mailto:swarren at wwwdotorg.org>>:
>
>         Please note that for this to work the U-Boot binary must be tagged
>         with a recent version of the mkknlimg script found in the Rasperry
>         Fundation's kernel tree:
>
>         <kernel>/scripts/mkknlimg --dtok <uboot>/u-boot.bin /boot/u-boot.bin
>
>         [1]
>         https://www.raspberrypi.org/forums//viewtopic.php?f=107&t=134018
>         <https://www.raspberrypi.org/forums//viewtopic.php?f=107&t=134018>

>         diff --git a/board/raspberrypi/rpi/rpi.c
>         b/board/raspberrypi/rpi/rpi.c
>
>
>         +#ifdef CONFIG_ARM64
>         +void save_boot_params(unsigned long dtb)
>         +#else
>         +void save_boot_params(unsigned long r0, unsigned long r1,
>         unsigned long dtb)
>         +#endif
>         +{
>         +       fw_dtb_pointer = dtb;
>         +       save_boot_params_ret();
>         +}
>
>
>     I think you need to write that function in assembly. This "function"
>     is called very early during U-Boot startup, before any stack pointer
>     is set up. You can't guarantee that a function written in C won't
>     attempt to use the stack, although admittedly with the current code,
>     Makefile, and the Ubuntu compilers, it just happens not to.
>
>
> Is inline assembly enough to guarantee that, or is it mandatory to
> revert to an assembly file ?

The entire function needs to be in assembly, since the compiler is free 
to touch the stack during function prologue/epilogue too.


More information about the U-Boot mailing list