[U-Boot] [PATCH v2 00/11] SPL support for RISC-V

Auer, Lukas lukas.auer at aisec.fraunhofer.de
Thu Aug 1 13:51:33 UTC 2019


Hi Rick,

On Thu, 2019-08-01 at 11:32 +0800, Rick Chen wrote:
> Hi Lukas
> 
> > > From: Lukas Auer [mailto:lukas.auer at aisec.fraunhofer.de]
> > > Sent: Sunday, July 28, 2019 11:57 PM
> > > To: u-boot at lists.denx.de
> > > Cc: Atish Patra; Rick Jian-Zhi Chen(陳建志); Bin Meng; Sagar Kadam; Alistair
> > > Francis; Anup Patel; Troy Benjegerdes; Lukas Auer; Abel Vesa; Alex Kiernan;
> > > Alex Marginean; Alexander Graf; Andreas Dannenberg; Andrew F. Davis; Anup
> > > Patel; Anup Patel; Atish Patra; Chris Packham; Eugeniu Rosca; Heiko Schocher;
> > > Heinrich Schuchardt; Jagan Teki; Jean-Jacques Hiblot; Jens Wiklander; Joe
> > > Hershberger; Kever Yang; Lokesh Vutla; Lukasz Majewski; Marek Vasut; Marek
> > > Vasut; Marek Vasut; Markus Klotzbuecher; Michal Simek; Paul Burton; Peng
> > > Fan; Philipp Tomsich; Philippe Reynes; Ryder Lee; Shawn Guo; Simon Glass;
> > > Simon Goldschmidt; Stefan Roese; Stefano Babic; Tien Fong Chee; Vignesh R;
> > > Weijie Gao; Ye Li
> > > Subject: [PATCH v2 00/11] SPL support for RISC-V
> > > 
> > > This series adds support for SPL to RISC-V U-Boot. Images can be booted via
> > > OpenSBI (FW_DYNAMIC firmware) or by directly jumping to them. In the
> > > former case, OpenSBI and U-Boot proper are bundled as a FIT image and made
> > > available to U-Boot SPL. Currently, only the QEMU board enables U-Boot SPL
> > > with a dedicated configuration. It uses RAM as SPL boot device.
> > > 
> > > On many RISC-V CPUs, the device tree is provided to U-Boot by the first stage
> > > bootloader. This requires changes to U-Boot SPL (patches 1,
> > > 2 and 3), which modify the behavior on other boards as well.
> > > 
> > > To test this series, OpenSBI has to be compiled first. The fw_dynamic.bin
> > > binary must be copied into the U-Boot root directory.
> > > Alternatively, the location of the binary can be specified with the OPENSBI
> > > environment variable. U-Boot can then be build as normal using the
> > > configuration qemu-riscv64_spl_defconfig for 64-bit builds or
> > > qemu-riscv32_spl_defconfig for 32-bit builds. The outputs from the build
> > > process are the U-Boot SPL binary (spl/u-boot-spl.bin) and the U-Boot FIT
> > > image (u-boot.itb) containing U-Boot proper and OpenSBI.
> > > 
> > > U-Boot can be run in QEMU with the following command.
> > > 
> > > qemu-system-riscv64 -nographic -machine virt -kernel spl/u-boot-spl \
> > >       -device loader,file=u-boot.itb,addr=0x80200000
> > > 
> 
> Great job !
> 

Thank you!

> I also try to run the spl flow on ax25-ae350 platform.
> But encounter some problems. I am still debugging.
> 
> Following is the error message:
> :
> U-Boot SPL 2019.07-10574-ge6ef7ec-dirty (Aug 01 2019 - 10:09:45 +0800)
> Trying to boot from RAM
> 
> U-Boot 2019.07-10574-ge6ef7ec-dirty (Aug 01 2019 - 10:09:45 +0800)
> 
> DRAM:  exception code: 5 , Load access fault , epc 1212654 , ra 1200ffe
> ### ERROR ### Please RESET the board ###
> 
> Do you have some comments ?
> 

It is difficult to judge without the exact configuration. Is your
current git tree available somewhere?

The error is quite strange, because it already booted U-Boot proper. So
the error does not happen in code, which has been directly modified by
this series. Perhaps it is trying to initialize something twice (once
in SPL and again in U-Boot proper)? Can you check at what location the
error occurs?

> By the way, please rebase u-boot-riscv/master to avoid some
> conflictions from Bin's patchs.
> 

Yes, I will do that.

Thanks,
Lukas

> Thanks
> Rick
> 
> 
> > > Changes in v2:
> > > - Rebase on master and format documentation as reStructuredText
> > > 
> > > Lukas Auer (11):
> > >   fdtdec: make CONFIG_OF_PRIOR_STAGE available in SPL
> > >   Makefile: support building SPL FIT images without device trees
> > >   spl: fit: use U-Boot device tree when FIT image has no device tree
> > >   riscv: add run mode configuration for SPL
> > >   spl: support booting via RISC-V OpenSBI
> > >   riscv: add SPL support
> > >   riscv: support SPL stack and global data relocation
> > >   riscv: add a generic FIT generator script
> > >   riscv: set default FIT generator script and build target for SPL
> > >     builds
> > >   riscv: qemu: add SPL configuration
> > >   doc: update QEMU RISC-V documentation
> > > 
> > >  Kconfig                                 |   4 +-
> > >  Makefile                                |   8 +-
> > >  arch/Kconfig                            |   6 ++
> > >  arch/riscv/Kconfig                      |  36 +++++++--
> > >  arch/riscv/cpu/ax25/Kconfig             |   6 +-
> > >  arch/riscv/cpu/cpu.c                    |   6 +-
> > >  arch/riscv/cpu/generic/Kconfig          |   5 +-
> > >  arch/riscv/cpu/start.S                  |  62 ++++++++++++++-
> > >  arch/riscv/cpu/u-boot-spl.lds           |  82 +++++++++++++++++++
> > >  arch/riscv/include/asm/encoding.h       |   2 +-
> > >  arch/riscv/include/asm/spl.h            |  31 ++++++++
> > >  arch/riscv/lib/Makefile                 |   8 +-
> > >  arch/riscv/lib/mkimage_fit_opensbi.sh   | 100
> > > ++++++++++++++++++++++++
> > >  arch/riscv/lib/spl.c                    |  48 ++++++++++++
> > >  board/emulation/qemu-riscv/Kconfig      |  10 +++
> > >  board/emulation/qemu-riscv/MAINTAINERS  |   2 +
> > >  board/emulation/qemu-riscv/qemu-riscv.c |  17 ++++
> > >  common/image.c                          |   1 +
> > >  common/spl/Kconfig                      |  17 ++++
> > >  common/spl/Makefile                     |   1 +
> > >  common/spl/spl.c                        |   8 +-
> > >  common/spl/spl_fit.c                    |  37 ++++++---
> > >  common/spl/spl_opensbi.c                |  85
> > > ++++++++++++++++++++
> > >  configs/qemu-riscv32_spl_defconfig      |  11 +++
> > >  configs/qemu-riscv64_spl_defconfig      |  12 +++
> > >  doc/board/emulation/qemu-riscv.rst      |  60 +++++++++++++-
> > >  include/configs/qemu-riscv.h            |  14 ++++
> > >  include/fdtdec.h                        |   2 +-
> > >  include/image.h                         |   1 +
> > >  include/opensbi.h                       |  40 ++++++++++
> > >  include/spl.h                           |   5 ++
> > >  lib/fdtdec.c                            |   6 +-
> > >  32 files changed, 691 insertions(+), 42 deletions(-)  create mode 100644
> > > arch/riscv/cpu/u-boot-spl.lds  create mode 100644
> > > arch/riscv/include/asm/spl.h  create mode 100755
> > > arch/riscv/lib/mkimage_fit_opensbi.sh
> > >  create mode 100644 arch/riscv/lib/spl.c  create mode 100644
> > > common/spl/spl_opensbi.c  create mode 100644
> > > configs/qemu-riscv32_spl_defconfig
> > >  create mode 100644 configs/qemu-riscv64_spl_defconfig
> > >  create mode 100644 include/opensbi.h
> > > 
> > > --
> > > 2.21.0


More information about the U-Boot mailing list