Refactor safeboot platform handling in post_esp32.py (#25129)

to use standard safeboot variant for 2M Tasmota build variants for C2 and C3
This commit is contained in:
Jason2866 authored and GitHub committed 2026-10-10 12:47:47 +02:00
1 parent edd93777ae
commit 78d0254762
1 file changed
+9 -4
+9 -4
View File
@@ -219,9 +219,13 @@ def esp32_build_filesystem(fs_size):
print(Fore.GREEN + f"LittleFS image created: {output_file}")
return True
def esp32_safeboot_platform(tasmota_platform):
return tasmota_platform[:-3] if tasmota_platform.endswith("_2M") else tasmota_platform
def esp32_fetch_safeboot_bin(tasmota_platform):
safeboot_fw_url = "http://ota.tasmota.com/tasmota32/release/" + tasmota_platform + "-safeboot.bin"
safeboot_fw_name = os.path.normpath(join(variants_dir, tasmota_platform + "-safeboot.bin"))
safeboot_platform = esp32_safeboot_platform(tasmota_platform)
safeboot_fw_url = "http://ota.tasmota.com/tasmota32/release/" + safeboot_platform + "-safeboot.bin"
safeboot_fw_name = os.path.normpath(join(variants_dir, safeboot_platform + "-safeboot.bin"))
if(exists(safeboot_fw_name)):
try:
with open(safeboot_fw_name, "rb") as safeboot_file:
@@ -250,12 +254,13 @@ def esp32_fetch_safeboot_bin(tasmota_platform):
pass
print(Fore.RED + "Download of safeboot binary failed. Please check your Internet connection.")
print(Fore.RED + "Creation of " + tasmota_platform + "-factory.bin not possible")
print(Fore.YELLOW + "Without download from Internet " + Fore.GREEN + tasmota_platform + "-safeboot.bin" + Fore.YELLOW + " needs to be compiled before " + Fore.GREEN + tasmota_platform)
print(Fore.YELLOW + "Without download from Internet " + Fore.GREEN + safeboot_platform + "-safeboot.bin" + Fore.YELLOW + " needs to be compiled before " + Fore.GREEN + tasmota_platform)
return False
def esp32_copy_new_safeboot_bin(tasmota_platform,new_local_safeboot_fw):
print("Copy new local safeboot firmware to variants dir -> using it for further flashing operations")
safeboot_fw_name = os.path.normpath(join(variants_dir, tasmota_platform + "-safeboot.bin"))
safeboot_platform = esp32_safeboot_platform(tasmota_platform)
safeboot_fw_name = os.path.normpath(join(variants_dir, safeboot_platform + "-safeboot.bin"))
if os.path.exists(variants_dir):
try:
shutil.copy(new_local_safeboot_fw, safeboot_fw_name)