
Hi,
Here is an RFC series of patches for the FWU Multi Bank Update support for the DeveloperBox platform. This series depends on Sughosh's Multi Bank Update v3 [1]. Thus if that is updated, this must be rebased and updated too.
[1] https://patchwork.ozlabs.org/project/uboot/list/?series=281875
This series includes my previous DFU updates[2] as [01/14]-[05/14], which is still under review in the U-Boot ML. For "nicely" indent the dfu_alt_info lines, I need that series. :-)
[2] https://patchwork.ozlabs.org/project/uboot/list/?series=275293
I also added some patches which updates Sughosh's series as [06/14] - [08/14]. Thus the [09/14] - [14/14] are the changes for DeveloperBox.
Unlike the STM32MP board, DeveloperBox (SynQuacer) loads the firmware from SPI NOR flash. Thus it doesn't use GPT partitions to store the firmware banks and the FWU metadata. Instead, it stores those data at fixed address areas on SPI NOR flash. I carefully chose the areas which doesn't overlap the previous firmware and EDK2.
I introduced fwu_metadata_sf.c driver for this FWU multi bank support on SPI flash, which does not use GPT too.
Since there is no GPT, the location GUID for images and the image GUID for banks are Null GUID. Anyway, for managing firmware image banks, we only need the ImageType GUID.
And the SynQuacer also does not have any non-volatile register. Thus this allocates the platform defined boot index on the SPI flash too.
So, in summary, on the DeveloperBox, this FWU Multi Bank update is only for avoidance of unexpected bricking by firmware update. If there are multiple banks, when the user (or firmware developer) update it with a wrong image, they can revert the wrong one. Even if it does not boot, SCP firmware can detect it and roll back to the previous bank. But please note that this is not "security" enhancement at all at least on the DeveloperBox because all images are still on normal SPI NOR flash. This is rather like a "safety" feature like a fool proof.
NOTE: To use this series, you also need to update SCP firmware[3] and TF-A[4] on the DeveloperBox. Those are under cleaning up.
[3] https://git.linaro.org/people/masami.hiramatsu/SCP-firmware.git/ [4] https://git.linaro.org/people/masami.hiramatsu/arm-trusted-firmware.git/
Thank you,
---
Masami Hiramatsu (14): DFU: Do not copy the entity name over the buffer size DFU: Accept redundant spaces and tabs in dfu_alt_info DFU: Check the number of arguments and argument string strictly doc: usage: DFU: Fix dfu_alt_info document cmd/dfu: Enable 'dfu list' command without DFU_OVER_USB FWU: Calculate CRC32 in gpt_update_mdata() FWU: Free metadata copy if gpt_get_mdata() failed FWU: Move FWU metadata operation code in fwu_mdata.c synquacer: Update for TBBR based new FIP layout FWU: Reboot soon after successfully install the new firmware FWU: Add FWU Multi Bank Update on SPI Flash FWU: synquacer: Add FWU Multi bank update support for DeveloperBox FWU: synquacer: Initialize broken metadata configs: synquacer: Add FWU support for DeveloperBox
.../dts/synquacer-sc2a11-developerbox-u-boot.dtsi | 26 +- board/socionext/developerbox/Kconfig | 31 +++ board/socionext/developerbox/Makefile | 1 board/socionext/developerbox/fwu_plat.c | 217 ++++++++++++++++++ cmd/dfu.c | 6 configs/synquacer_developerbox_defconfig | 12 + doc/usage/dfu.rst | 45 +++- drivers/dfu/dfu.c | 37 ++- drivers/dfu/dfu_mmc.c | 55 +++-- drivers/dfu/dfu_mtd.c | 34 ++- drivers/dfu/dfu_nand.c | 34 ++- drivers/dfu/dfu_ram.c | 24 +- drivers/dfu/dfu_sf.c | 34 ++- drivers/dfu/dfu_virt.c | 5 include/configs/synquacer.h | 14 + include/dfu.h | 33 ++- include/efi_loader.h | 3 include/fwu.h | 22 +- lib/efi_loader/efi_capsule.c | 10 + lib/efi_loader/efi_firmware.c | 14 + lib/fwu_updates/Kconfig | 43 ++++ lib/fwu_updates/Makefile | 5 lib/fwu_updates/fwu_mdata.c | 123 ++++++---- lib/fwu_updates/fwu_mdata_gpt_blk.c | 109 +-------- lib/fwu_updates/fwu_mdata_sf.c | 241 ++++++++++++++++++++ 25 files changed, 888 insertions(+), 290 deletions(-) create mode 100644 board/socionext/developerbox/fwu_plat.c create mode 100644 lib/fwu_updates/fwu_mdata_sf.c
-- Masami Hiramatsu masami.hiramatsu@linaro.org