Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] Support image sources other than flash #2031

Closed
wants to merge 4 commits into from

Commits on Aug 8, 2024

  1. boot/bootutil: Split RAM load code to its own file

    RAM loading code is currently under bootutil/loader.c, and it's not
    accessible for different loaders, such as the single loaders. Future
    patches will make use of the RAM loading code outside the
    bootutil/loader.c context, and this patch prepares for that by making it
    standalone on boot/bootutil/src/ram_load.c
    
    Signed-off-by: Ederson de Souza <[email protected]>
    edersondisouza committed Aug 8, 2024
    Configuration menu
    Copy the full SHA
    38ec4be View commit details
    Browse the repository at this point in the history
  2. boot/zephyr: Move RAM load Kconfigs outside !SINGLE_APPLICATION_SLOT

    Now that RAM load code is not dependent on bootutil/loader.c, it can be
    used independently of !SINGLE_APPLICATION_SLOT configurations. Move the
    related Kconfigs accordingly, so that applications configured to use
    single loader can do RAM loading.
    
    Signed-off-by: Ederson de Souza <[email protected]>
    edersondisouza committed Aug 8, 2024
    Configuration menu
    Copy the full SHA
    f39123f View commit details
    Browse the repository at this point in the history
  3. boot/zephyr: Support image sources other than flash

    MCUboot assumes that the images being booted live on a flash (or will be
    loaded to it, in case of serial support). However, some devices may end
    up loading an image from a different source, such as an I2C/eSPI storage,
    using some appropriate protocol. In these cases, usually the image is
    then loaded directly to RAM.
    
    This patch adds support for such scenarios, currently only on Zephyr
    port. It expects Zephyr CONFIG_FLASH_MAP_CUSTOM_BACKEND is used to
    provide Flash Map API to access the image in the non-flash device (but
    doesn't mandate it). This allows for an integration that is less intrusive
    on MCUboot code.
    
    It uses single loader to load an image from a set of "sources". The
    single loader loops through available sources and the first one to
    succeed signature/validation boots. To access the images, weak functions
    flash_map_id_get_next() and flash_map_id_get_current() are used. Default
    implementation keeps current behaviour for single loader, i.e. just
    loads from FLASH_AREA_IMAGE_PRIMARY(0).
    
    It is expected applications will reimplement these functions, allowing
    them to define a priority of different sources. As these different
    storage media may be ready only, MCUboot won't attempt to update them to
    record last source to succeed or so, it's application responsibility to
    define the correct priority of sources on every boot.
    
    Signed-off-by: Ederson de Souza <[email protected]>
    edersondisouza committed Aug 8, 2024
    Configuration menu
    Copy the full SHA
    74f74bc View commit details
    Browse the repository at this point in the history
  4. samples: Add a sample for non-flash-source

    A sample for non-flash-source on MEC17 EVB. It provides implementation
    for Zephyr flash_area_open_custom(), so the right flash map
    implementation is used, and MCUboot flash_map_id_get_next() and
    flash_map_id_get_current() to prioritize sources. It should show what is
    expected from an application to be able to use non-flash sources for
    images.
    
    For the I2C device simulation, an Aardvark I2C host adapter is needed,
    and a script is provided to make the image loadable via I2C. An
    implementation for an "Aardvark driver" on top of I2C is also provided.
    Finally, a sample application to be loaded is also available.
    
    For more details on how to build and test the samples, check the
    provided README.md.
    
    Signed-off-by: Ederson de Souza <[email protected]>
    edersondisouza committed Aug 8, 2024
    Configuration menu
    Copy the full SHA
    9645ebd View commit details
    Browse the repository at this point in the history