From c22df41ca6a17bcfc10c242242b0cd55945db8ab Mon Sep 17 00:00:00 2001 From: Tiago Medicci Serrano Date: Tue, 29 Apr 2025 12:36:08 -0300 Subject: [PATCH] espressif: Add variable to override MCUboot version and URL The version and the git repository of Espressif's MCUboot port can be changed by setting the `MCUBOOT_VERSION` and `MCUBOOT_URL` environment variables before running the `make bootloader` command. Signed-off-by: Tiago Medicci Serrano --- arch/risc-v/src/common/espressif/Bootloader.mk | 10 ++++++++-- arch/xtensa/src/esp32/Bootloader.mk | 10 ++++++++-- arch/xtensa/src/esp32s2/Bootloader.mk | 10 ++++++++-- arch/xtensa/src/esp32s3/Bootloader.mk | 10 ++++++++-- 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/arch/risc-v/src/common/espressif/Bootloader.mk b/arch/risc-v/src/common/espressif/Bootloader.mk index e46f7235360..46eee4f9e06 100644 --- a/arch/risc-v/src/common/espressif/Bootloader.mk +++ b/arch/risc-v/src/common/espressif/Bootloader.mk @@ -35,8 +35,14 @@ BOOTLOADER_CONFIG = $(BOOTLOADER_SRCDIR)/bootloader.conf MCUBOOT_SRCDIR = $(BOOTLOADER_SRCDIR)/mcuboot MCUBOOT_ESPDIR = $(MCUBOOT_SRCDIR)/boot/espressif -MCUBOOT_URL = https://github.com/mcu-tools/mcuboot MCUBOOT_TOOLCHAIN = $(TOOLSDIR)/mcuboot_toolchain_espressif.cmake +ifndef MCUBOOT_VERSION + MCUBOOT_VERSION = $(CONFIG_ESPRESSIF_MCUBOOT_VERSION) +endif + +ifndef MCUBOOT_URL + MCUBOOT_URL = https://github.com/mcu-tools/mcuboot +endif # Helpers for creating the configuration file @@ -92,7 +98,7 @@ BOOTLOADER_BIN = $(TOPDIR)/mcuboot-$(CHIP_SERIES).bin $(MCUBOOT_SRCDIR): $(BOOTLOADER_SRCDIR) $(Q) echo "Cloning MCUboot" $(Q) git clone --quiet $(MCUBOOT_URL) $(MCUBOOT_SRCDIR) - $(Q) git -C "$(MCUBOOT_SRCDIR)" checkout --quiet $(CONFIG_ESPRESSIF_MCUBOOT_VERSION) + $(Q) git -C "$(MCUBOOT_SRCDIR)" checkout --quiet $(MCUBOOT_VERSION) $(Q) git -C "$(MCUBOOT_SRCDIR)" submodule --quiet update --init --recursive ext/mbedtls $(BOOTLOADER_BIN): chip/$(ESP_HAL_3RDPARTY_REPO) $(MCUBOOT_SRCDIR) $(BOOTLOADER_CONFIG) diff --git a/arch/xtensa/src/esp32/Bootloader.mk b/arch/xtensa/src/esp32/Bootloader.mk index 975eabc8979..411cce20bac 100644 --- a/arch/xtensa/src/esp32/Bootloader.mk +++ b/arch/xtensa/src/esp32/Bootloader.mk @@ -35,8 +35,14 @@ BOOTLOADER_CONFIG = $(BOOTLOADER_DIR)/bootloader.conf MCUBOOT_SRCDIR = $(BOOTLOADER_DIR)/mcuboot MCUBOOT_ESPDIR = $(MCUBOOT_SRCDIR)/boot/espressif -MCUBOOT_URL = https://github.com/mcu-tools/mcuboot MCUBOOT_TOOLCHAIN = $(TOPDIR)/tools/esp32/mcuboot_toolchain_esp32.cmake +ifndef MCUBOOT_VERSION + MCUBOOT_VERSION = $(CONFIG_ESP32_MCUBOOT_VERSION) +endif + +ifndef MCUBOOT_URL + MCUBOOT_URL = https://github.com/mcu-tools/mcuboot +endif # Helpers for creating the configuration file @@ -128,7 +134,7 @@ BOOTLOADER_SIGNED_BIN = $(TOPDIR)/mcuboot-esp32.signed.bin $(MCUBOOT_SRCDIR): $(Q) echo "Cloning MCUboot" $(Q) git clone --quiet $(MCUBOOT_URL) $(MCUBOOT_SRCDIR) - $(Q) git -C "$(MCUBOOT_SRCDIR)" checkout --quiet $(CONFIG_ESP32_MCUBOOT_VERSION) + $(Q) git -C "$(MCUBOOT_SRCDIR)" checkout --quiet $(MCUBOOT_VERSION) $(Q) git -C "$(MCUBOOT_SRCDIR)" submodule --quiet update --init --recursive ext/mbedtls $(BOOTLOADER_BIN): chip/$(ESP_HAL_3RDPARTY_REPO) $(MCUBOOT_SRCDIR) $(BOOTLOADER_CONFIG) diff --git a/arch/xtensa/src/esp32s2/Bootloader.mk b/arch/xtensa/src/esp32s2/Bootloader.mk index b83a59025c4..34507d08dd2 100644 --- a/arch/xtensa/src/esp32s2/Bootloader.mk +++ b/arch/xtensa/src/esp32s2/Bootloader.mk @@ -35,8 +35,14 @@ BOOTLOADER_CONFIG = $(BOOTLOADER_DIR)/bootloader.conf MCUBOOT_SRCDIR = $(BOOTLOADER_DIR)/mcuboot MCUBOOT_ESPDIR = $(MCUBOOT_SRCDIR)/boot/espressif -MCUBOOT_URL = https://github.com/mcu-tools/mcuboot MCUBOOT_TOOLCHAIN = $(TOPDIR)/tools/esp32s2/mcuboot_toolchain_esp32s2.cmake +ifndef MCUBOOT_VERSION + MCUBOOT_VERSION = $(CONFIG_ESP32S2_MCUBOOT_VERSION) +endif + +ifndef MCUBOOT_URL + MCUBOOT_URL = https://github.com/mcu-tools/mcuboot +endif $(BOOTLOADER_DIR): $(Q) mkdir -p $(BOOTLOADER_DIR) &>/dev/null @@ -121,7 +127,7 @@ BOOTLOADER_SIGNED_BIN = $(TOPDIR)/mcuboot-esp32s2.signed.bin $(MCUBOOT_SRCDIR): $(BOOTLOADER_DIR) $(Q) echo "Cloning MCUboot" $(Q) git clone --quiet $(MCUBOOT_URL) $(MCUBOOT_SRCDIR) - $(Q) git -C "$(MCUBOOT_SRCDIR)" checkout --quiet $(CONFIG_ESP32S2_MCUBOOT_VERSION) + $(Q) git -C "$(MCUBOOT_SRCDIR)" checkout --quiet $(MCUBOOT_VERSION) $(Q) git -C "$(MCUBOOT_SRCDIR)" submodule --quiet update --init --recursive ext/mbedtls $(BOOTLOADER_BIN): chip/$(ESP_HAL_3RDPARTY_REPO) $(MCUBOOT_SRCDIR) $(BOOTLOADER_CONFIG) diff --git a/arch/xtensa/src/esp32s3/Bootloader.mk b/arch/xtensa/src/esp32s3/Bootloader.mk index 7e47af0cc9a..07f5c7e4853 100644 --- a/arch/xtensa/src/esp32s3/Bootloader.mk +++ b/arch/xtensa/src/esp32s3/Bootloader.mk @@ -35,8 +35,14 @@ BOOTLOADER_CONFIG = $(BOOTLOADER_DIR)/bootloader.conf MCUBOOT_SRCDIR = $(BOOTLOADER_DIR)/mcuboot MCUBOOT_ESPDIR = $(MCUBOOT_SRCDIR)/boot/espressif -MCUBOOT_URL = https://github.com/mcu-tools/mcuboot MCUBOOT_TOOLCHAIN = $(TOPDIR)/tools/esp32s3/mcuboot_toolchain_esp32s3.cmake +ifndef MCUBOOT_VERSION + MCUBOOT_VERSION = $(CONFIG_ESP32S3_MCUBOOT_VERSION) +endif + +ifndef MCUBOOT_URL + MCUBOOT_URL = https://github.com/mcu-tools/mcuboot +endif $(BOOTLOADER_DIR): $(Q) mkdir -p $(BOOTLOADER_DIR) &>/dev/null @@ -98,7 +104,7 @@ BOOTLOADER_BIN = $(TOPDIR)/mcuboot-esp32s3.bin $(MCUBOOT_SRCDIR): $(BOOTLOADER_DIR) $(Q) echo "Cloning MCUboot" $(Q) git clone --quiet $(MCUBOOT_URL) $(MCUBOOT_SRCDIR) - $(Q) git -C "$(MCUBOOT_SRCDIR)" checkout --quiet $(CONFIG_ESP32S3_MCUBOOT_VERSION) + $(Q) git -C "$(MCUBOOT_SRCDIR)" checkout --quiet $(MCUBOOT_VERSION) $(Q) git -C "$(MCUBOOT_SRCDIR)" submodule --quiet update --init --recursive ext/mbedtls $(BOOTLOADER_BIN): chip/$(ESP_HAL_3RDPARTY_REPO) $(MCUBOOT_SRCDIR) $(BOOTLOADER_CONFIG)