18 May, 2020

1 commit

  • This commit enables dual bootloader feature for imx8m/imx8q, but
    as commit 'a2018ab' already brings in some dual bootloader codes
    when enabling fastboot support, so this commit won't be a complete
    and standalone patch to introduce the dual bootloader feature.

    This commit will do the following:
    1. clean up dual bootloader flow and add missing implementation.
    2. Merge the dual bootloader entry for fit and container to one
    function 'mmc_load_image_raw_sector_dual_uboot'.

    Change-Id: Ic9410a48092cc05de599dd897fc912177e2a1fe1
    Signed-off-by: Ji Luo

    Ji Luo
     

27 Apr, 2020

1 commit

  • When download image through ROM API for stream mode (USB, eMMC fastboot).
    We uses tricky way to get the total image size:
    The spl_load_simple_fit is called but the data reading is invalid, so the image
    data is not really downloaded.
    We should not call HAB authenticate in this tricky way. Otherwise it
    will alway fail.
    This patch add a new flag SPL_FIT_BYPASS_POST_LOAD to skip the authentication
    only for this tricky using.

    Signed-off-by: Ye Li
    Reviewed-by: Peng Fan
    (cherry picked from commit 47b0cf6de06ff9b3e2b2755d5c8203210378b26a)
    (cherry picked from commit 3e50573a7007771586e737b343bdde4d98c21c23)

    Ye Li
     

20 Jan, 2020

1 commit


14 Jan, 2020

1 commit


15 Dec, 2019

1 commit

  • Binman supports writing the position and size of U-Boot proper and SPL
    into the previous phase of U-Boot. This allows the next phase to be easily
    located and loaded.

    Add functions to return these useful values, along with symbols to allow
    TPL to load SPL.

    Signed-off-by: Simon Glass
    Reviewed-by: Bin Meng

    Simon Glass
     

03 Nov, 2019

1 commit

  • At present the name of the image comes first in the linker-list symbol
    used. This means that the name of the function sets the sort order, which
    is not the intention.

    Update it to put the boot-device type first, then the priority. This
    produces the expected behaviour.

    Signed-off-by: Simon Glass
    Reviewed-by: Bin Meng

    Simon Glass
     

11 Oct, 2019

1 commit


09 Oct, 2019

1 commit


08 Oct, 2019

4 commits

  • i.MX8 only support AHAB secure boot with Container format image,
    we could not use FIT to support secure boot, so introduce container
    support to let SPL could load container images.

    Cc: Simon Goldschmidt
    Cc: Tien Fong Chee
    Cc: York Sun
    Cc: Marek Vasut
    Cc: Alex Kiernan
    Cc: Simon Glass
    Cc: Philipp Tomsich
    Cc: Kever Yang
    Cc: Heiko Schocher
    Signed-off-by: Peng Fan

    Peng Fan
     
  • Pass spl_image and bootdev to board_return_bootrom.
    i.MX8MN needs the args to let ROM to load images

    Cc: Simon Glass
    Cc: Philipp Tomsich
    Cc: Kever Yang
    Signed-off-by: Peng Fan
    Reviewed-by: Kever Yang

    Peng Fan
     
  • U-Boot has two distinct phases: before and after relocation. These are
    commonly referred to as F (running from Flash) and R (Relocated and
    running from RAM). Some drivers want to do different things in these
    phases so update the SPL phase function to return a different value for
    each.

    Signed-off-by: Simon Glass
    Reviewed-by: Bin Meng

    Simon Glass
     
  • U-Boot is built in three phases: TPL, SPL and U-Boot proper. Sometimes
    it is necessary to use different init code depending on the phase. For
    example, TPL might do very basic CPU init, SPL might do a little more
    and U-Boot proper might bring the CPU up to full speed and enable all
    cores.

    Add a function which allows easy determination of the current phase being
    built.

    Signed-off-by: Simon Glass
    Reviewed-by: Bin Meng

    Simon Glass
     

26 Aug, 2019

1 commit

  • RISC-V OpenSBI is an open-source implementation of the RISC-V Supervisor
    Binary Interface (SBI) specification. It is required by Linux and U-Boot
    running in supervisor mode. This patch adds support for booting via the
    OpenSBI FW_DYNAMIC firmware. It supports OpenSBI version 0.4 and higher.

    In this configuration, U-Boot SPL starts in machine mode. After loading
    OpenSBI and U-Boot proper, it will start OpenSBI. All necessary
    parameters are generated by U-Boot SPL and are passed to OpenSBI. U-Boot
    proper is started in supervisor mode by OpenSBI. Support for OpenSBI is
    enabled with CONFIG_SPL_OPENSBI. An additional configuration entry,
    CONFIG_SPL_OPENSBI_LOAD_ADDR, is used to specify the load address of the
    OpenSBI firmware binary. It is not used directly in U-Boot and instead
    is intended to make the value available to scripts such as FIT
    configuration generators.

    The header file include/opensbi.h is based on header files from the
    OpenSBI project. They are recent, as of commit bae54f764570 ("firmware:
    Add fw_dynamic firmware").

    Signed-off-by: Lukas Auer
    Reviewed-by: Bin Meng
    Tested-by: Bin Meng
    Reviewed-by: Anup Patel

    Lukas Auer
     

17 Jul, 2019

1 commit

  • The current U-Boot SPL image loader infrastructure is very powerful,
    able to initialize and load from a variety of boot media however it
    is strongly geared towards loading specific types of images in a very
    specific way. To address the need being able to use this infrastructure
    to load arbitrary image files go ahead and refactor it as follows:

    - Refactor existing spl_mmc_load_image function into superset function,
    accepting additional arguments such as filenames and media load offset
    (same concept can also be applied toother spl_XXX_load_image functions)
    - Extend the loader function to "remember" their peripheral initialization
    status so that the init is only done once during the boot process,
    - Extend the FIT image loading function to allow skipping the parsing/
    processing of the FIT contents (so that this can be done separately
    in a more customized fashion)
    - Populate the SPL_LOAD_IMAGE_METHOD() list with a trampoline function,
    invoking the newly refactored superset functions in a way to maintain
    compatibility with the existing behavior

    This refactoring initially covers MMC/SD card loading (RAW and FS-based).

    Signed-off-by: Andreas Dannenberg
    Reviewed-by: Tom Rini

    Andreas Dannenberg
     

19 May, 2019

1 commit


19 Feb, 2019

1 commit

  • SPL currently does not check uImage CRCs when loading U-Boot.

    This patch adds checking the uImage CRC when SPL loads U-Boot. It does
    this by reusing the existing config option SPL_CRC32_SUPPORT to allow
    leaving out the CRC check on boards where the additional code size or
    boot time is a problem (adding the CRC check currently adds ~1.4 kByte
    to flash).

    The SPL_CRC32_SUPPORT config option now gets enabled by default if SPL
    support for legacy images is enabled to check the CRC on all boards
    that don't actively take countermeasures.

    Signed-off-by: Simon Goldschmidt
    Reviewed-by: Simon Glass

    Simon Goldschmidt
     

01 Jan, 2019

2 commits

  • Introduce function prototypes for board_spl_fit_size_align and
    board_spl_fit_post_load

    Signed-off-by: Peng Fan

    Peng Fan
     
  • Introduce two board level callback functions to FIT image loading process, and
    a SPL_FIT_FOUND flag to differentiate FIT image or RAW image.

    Implement functions in imx common SPL codes to call HAB funtion
    to authenticate the FIT image. Generally, we have to sign multiple regions
    in FIT image:
    1. Sign FIT FDT data (configuration)
    2. Sign FIT external data (Sub-images)

    Because the CSF supports to sign multiple memory blocks, so that we can use one
    signature to cover all regions in FIT image and only authenticate once.
    The authentication should be done after the entire FIT image is loaded into
    memory including all sub-images.
    We use "-p" option to generate FIT image to reserve a space for FIT IVT
    and FIT CSF, also this help to fix the offset of the external data (u-boot-nodtb.bin,
    ATF, u-boot DTB).

    The signed FIT image layout is as below:
    --------------------------------------------------
    | | | | | | | |
    | FIT | FIT | FIT | | U-BOOT | ATF | U-BOOT |
    | FDT | IVT | CSF | | nodtb.bin | | DTB |
    | | | | | | | |
    --------------------------------------------------

    Signed-off-by: Ye Li
    Reviewed-by: Peng Fan
    Reviewed-by: Tom Rini
    Signed-off-by: Peng Fan

    Ye Li
     

07 Dec, 2018

1 commit

  • commit d6330064634a ("spl: Add a define for SPL_TPL_PROMPT")

    changes the SPL/TPL banner from upper case into lower
    case. As SPL and TPL are three-letter acronyms and they
    are written in upper case, change it back to upper case.

    Signed-off-by: Heiko Schocher
    Reviewed-by: Simon Glass

    Heiko Schocher
     

26 Nov, 2018

3 commits

  • There is some basic informaton that SPL normally wants to pass through to
    U-Boot, such as the SDRAM size and bank information.

    Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
    which is set up in SPL and passed to U-Boot proper. Also adda test for
    sandbox_spl that checks that this works correctly and a new 'sb' command
    to show the information passed from SPL.

    Reviewed-by: Tom Rini
    Signed-off-by: Simon Glass

    Simon Glass
     
  • We should use a macro rather than hard-coding the SPL prompt to 'spl'
    since the code can be used by TPL too. Add a macro that works for both
    and use it in various places.

    This allows TPL to use the same code without printing confusing messages.

    Note that the string is lower case ('spl', 'tpl') which is a change from
    previously.

    Reviewed-by: Tom Rini
    Signed-off-by: Simon Glass

    Simon Glass
     
  • The bloblist is normally set up in SPL ready for use by U-Boot. Add
    a simple implementation of this to the common SPL code.

    Signed-off-by: Simon Glass

    Simon Glass
     

05 Oct, 2018

1 commit

  • OP-TEE is an open source trusted OS, in armv7, its loading and
    running are like this:
    loading:
    - SPL load both OP-TEE and U-Boot
    running:
    - SPL run into OP-TEE in secure mode;
    - OP-TEE run into U-Boot in non-secure mode;

    To make code simple, it would be fine to use IH_OS_TEE for the
    os tyle in TPL(just like IH_OS_LINUX is using both in SPL and U-Boot).

    Here is the diagram for SPL loading OP-TEE,
    IH_OS_TEE:(make u-boot.itb for SPL)
    Non-Secure Secure

    BootROM
    |
    v
    SPL
    |
    v
    --------- OP-TEE
    |
    v
    U-Boot
    |
    V
    Linux
    For other two king of OP-TEE loading/booting, see commit message:
    45b55712d4 image: Add IH_OS_TEE for TEE chain-load boot

    More detail:
    https://github.com/OP-TEE/optee_os
    and search for 'boot arguments' for detail entry parameter in:
    core/arch/arm/kernel/generic_entry_a32.S

    Signed-off-by: Kever Yang
    Cc: Bryan O'Donoghue
    Reviewed-by: Philipp Tomsich

    Kever Yang
     

26 Sep, 2018

1 commit

  • The SPL loaders assume that the CONFIG_SYS_TEXT_BASE memory location
    is available and can be corrupted by loading ie. uImage or fitImage
    headers there. Sometimes it could be beneficial to load the headers
    elsewhere, ie. if CONFIG_SYS_TEXT_BASE is not yet writable while we
    still want to parse the image headers in some local onchip memory to
    ie. extract firmware from that image.

    Add the possibility to override the location where the headers get
    loaded by introducing new function, spl_get_load_buffer() which takes
    two arguments -- offset from the CONFIG_SYS_TEXT_BASE and size of the
    data that are to be loaded there -- and returns a valid buffer address
    or hangs the system. The default behavior is the same as before, add
    the offset to CONFIG_SYS_TEXT_BASE and return that address. User can
    override the weak spl_get_load_buffer() function though.

    Signed-off-by: Marek Vasut
    Cc: Tom Rini
    Reviewed-by: Simon Goldschmidt

    Marek Vasut
     

02 Aug, 2018

2 commits

  • At present each entry has an offset within its parent section. This is
    useful for figuring out how entries relate to one another. However it
    is sometimes necessary to locate an entry within an image, regardless
    of which sections it is nested inside.

    Add a new 'image-pos' property to provide this information. Also add
    some documentation for the -u option binman provides, which updates the
    device tree with final entry information.

    Since the image position is a better symbol to use for the position of
    U-Boot as obtained by SPL, update the SPL symbols to use this instead of
    offset, which might be incorrect if hierarchical sections are used.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • After some thought, I believe there is an unfortunate naming flaw in
    binman. Entries have a position and size, but now that we support
    hierarchical sections it is unclear whether a position should be an
    absolute position within the image, or a relative position within its
    parent section.

    At present 'position' actually means the relative position. This indicates
    a need for an 'image position' for code that wants to find the location of
    an entry without having to do calculations back through parents to
    discover this image position.

    A better name for the current 'position' or 'pos' is 'offset'. It is not
    always an absolute position, but it is always an offset from its parent
    offset.

    It is unfortunate to rename this concept now, 18 months after binman was
    introduced. However I believe it is the right thing to do. The impact is
    mostly limited to binman itself and a few changes to in-tree users to
    binman:

    tegra
    sunxi
    x86

    The change makes old binman definitions (e.g. downstream or out-of-tree)
    incompatible if they use the 'pos = ' property. Later work will
    adjust binman to generate an error when it is used.

    Signed-off-by: Simon Glass

    Simon Glass
     

21 Jul, 2018

1 commit

  • On some boards, we want to give the board/architecture-specific code a
    chance to look at where the next image has been loaded from and
    perform fixups before starting the next image. This is of particular
    importance, when we probe multiple devices for bootable payloads and
    boot the first one found.

    This change adds the following:
    - we record the boot_device used into the spl_image structure
    - we provide an extension-point for boards/architectures that can
    perform late fixups depending on a fully populated spl_image
    structure (i.e. we'll know the final boot_device and have info
    on the image type and operating system to be booted).

    Signed-off-by: Philipp Tomsich
    Tested-by: Klaus Goger

    Philipp Tomsich
     

07 May, 2018

1 commit

  • When U-Boot started using SPDX tags we were among the early adopters and
    there weren't a lot of other examples to borrow from. So we picked the
    area of the file that usually had a full license text and replaced it
    with an appropriate SPDX-License-Identifier: entry. Since then, the
    Linux Kernel has adopted SPDX tags and they place it as the very first
    line in a file (except where shebangs are used, then it's second line)
    and with slightly different comment styles than us.

    In part due to community overlap, in part due to better tag visibility
    and in part for other minor reasons, switch over to that style.

    This commit changes all instances where we have a single declared
    license in the tag as both the before and after are identical in tag
    contents. There's also a few places where I found we did not have a tag
    and have introduced one.

    Signed-off-by: Tom Rini

    Tom Rini
     

07 Apr, 2018

1 commit

  • The spl_boot_partition function has been added in order to have
    the possibility to boot on a same binary from different mmc devices
    with different partitions.

    By default keep the current behavior, SPL use the partition defined
    by CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION.

    Signed-off-by: Patrick Delaunay
    Signed-off-by: Christophe KERELLO
    Reviewed-by: Tom Rini
    Reviewed-by: Lukasz Majewski

    Patrick Delaunay
     

13 Dec, 2017

1 commit


26 Nov, 2017

2 commits


09 Oct, 2017

1 commit

  • Commit 15eb1d43bf47 ("spl: reorder the assignment of board info to
    global data") intended to move assignment of board info earlier,
    into board_init_r(). However, function preload_console_init() is
    called either from spl_board_init() or from board_init_f(). For the
    latter case, the board info assignment is much earlier than proposed
    board_init_r(). Create a new function to fill gd->bd and call this
    function when needed.

    Signed-off-by: York Sun
    CC: Lokesh Vutla
    CC: Ravi Babu
    CC: Lukasz Majewski
    CC: Tom Rini
    Reviewed-by: Simon Glass

    York Sun
     

13 Aug, 2017

1 commit

  • Some devices (e.g. the RK3368) have only limited SRAM, but provide
    support for loading the next boot stage after our SPL performs basic
    setup (e.g. DRAM).

    For target systems like these, we add a boot device BOOTROM that will
    invoke a board-specific hook to return to the bootrom (if supported).

    Signed-off-by: Philipp Tomsich

    Reviewed-by: Tom Rini
    Reviewed-by: Simon Glass

    Philipp Tomsich
     

15 May, 2017

1 commit

  • ATF(ARM Trusted Firmware) is used by ARM arch64 SoCs, find more infomation
    about ATF at: https://github.com/ARM-software/arm-trusted-firmware

    SPL is considered as BL2 in ATF terminology, it needs to load other parts
    of ATF binary like BL31, BL32, SCP-BL30, and BL33(U-Boot). And needs to
    prepare the parameter for BL31 which including entry and image information
    for all other images. Then the SPL handle PC to BL31 with the parameter,
    the BL31 will do the rest of work and at last get into U-Boot(BL33).

    This patch needs work with patches from Andre for SPL support multi
    binary in FIT.

    The entry point of bl31 and bl33 are still using hard code because we
    still can not get them from the FIT image information.

    Signed-off-by: Kever Yang
    Tested-by: Heiko Stuebner
    Acked-by: Simon Glass
    Reviewed-by: Tom Rini

    Kever Yang
     

08 May, 2017

1 commit

  • At present fdt blob or argument address being passed to kernel is fixed at
    compile time using macro CONFIG_SYS_SPL_ARGS_ADDR. FDT blob from
    different media like nand, nor flash are copied to the address pointed
    by the macro.
    The problem is, it makes args/fdt blob compulsory to copy which is not required
    in cases like for NOR Flash. This patch removes this limitation.

    Signed-off-by: Vikas Manocha

    Vikas Manocha
     

19 Mar, 2017

1 commit

  • CONFIG_SPL_ABORT_ON_RAW_IMAGE causes SPL to abort and move on when it
    encounters RAW images, express this same functionality as a positive
    option enabling support for RAW images: CONFIG_SPL_RAW_IMAGE_SUPPORT

    Also move uses of this to defconfigs.

    Signed-off-by: Andrew F. Davis
    Reviewed-by: Tom Rini
    Reviewed-by: Simon Glass
    [trini: Rework Kconfig logic a little, move to common/spl/Kconfig]
    Signed-off-by: Tom Rini

    Andrew F. Davis
     

17 Mar, 2017

1 commit

  • At present malloc_base/_limit/_ptr are not initialised in spl_init() when
    we call spl_init() in board_init_f(). This is due to a recent change aimed
    at avoiding overwriting the malloc area set up on some boards by
    spl_relocate_stack_gd().

    However if CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN is not defined, we now
    skip setting up the memory area in spl_init() which is obviously wrong.

    To fix this, add a new function spl_early_init() which can be called in
    board_init_f().

    Fixes: b3d2861e (spl: Remove overwrite of relocated malloc limit)
    Signed-off-by: Eddie Cai
    Rewrote spl_{,early_}init() to avoid duplicate code:
    Rewrite/expand commit message:
    Signed-off-by: Simon Glass
    Reviewed-by: Eddie Cai

    Eddie Cai
     

04 Jan, 2017

1 commit

  • Since entry_point and load_addr are addresses, they should be
    represented as longs to cover the whole address space and to avoid
    warning when compiling the SPL in 64-bit.
    Also adjust debug prints to add the 'l' specifier, where needed.

    Signed-off-by: Andre Przywara
    Reviewed-by: Alexander Graf
    Reviewed-by: Simon Glass
    Reviewed-by: Tom Rini
    Acked-by: Maxime Ripard
    Reviewed-by: Jagan Teki

    Andre Przywara
     

09 Dec, 2016

1 commit

  • It is useful to name each method so that we can print out this name when
    using the method. Currently this happens using a separate function. In
    preparation for unifying this, add a name to each method.

    The name is only available if we have libcommon support (i.e can use
    printf()).

    Signed-off-by: Simon Glass

    Simon Glass