mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-29 21:56:35 +00:00
Do not abort compile when safeboot firmware can not be downloaded (#21684)
* Message when dl of safeboot failed * check for safeboot
This commit is contained in:
parent
25f17d7141
commit
17ea732753
@ -181,18 +181,30 @@ def esp32_fetch_safeboot_bin(tasmota_platform):
|
|||||||
safeboot_fw_name = join(variants_dir, tasmota_platform + "-safeboot.bin")
|
safeboot_fw_name = join(variants_dir, tasmota_platform + "-safeboot.bin")
|
||||||
if(exists(safeboot_fw_name)):
|
if(exists(safeboot_fw_name)):
|
||||||
print("safeboot binary already in place.")
|
print("safeboot binary already in place.")
|
||||||
return
|
return True
|
||||||
print("Will download safeboot binary from URL:")
|
print("Will download safeboot binary from URL:")
|
||||||
print(safeboot_fw_url)
|
print(safeboot_fw_url)
|
||||||
|
try:
|
||||||
response = requests.get(safeboot_fw_url)
|
response = requests.get(safeboot_fw_url)
|
||||||
open(safeboot_fw_name, "wb").write(response.content)
|
open(safeboot_fw_name, "wb").write(response.content)
|
||||||
print("safeboot binary written to variants dir.")
|
print("safeboot binary written to variants dir.")
|
||||||
|
return True
|
||||||
|
except:
|
||||||
|
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 Internet " + Fore.GREEN + tasmota_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):
|
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")
|
print("Copy new local safeboot firmware to variants dir -> using it for further flashing operations")
|
||||||
safeboot_fw_name = join(variants_dir, tasmota_platform + "-safeboot.bin")
|
safeboot_fw_name = join(variants_dir, tasmota_platform + "-safeboot.bin")
|
||||||
if os.path.exists(variants_dir):
|
if os.path.exists(variants_dir):
|
||||||
|
try:
|
||||||
shutil.copy(new_local_safeboot_fw, safeboot_fw_name)
|
shutil.copy(new_local_safeboot_fw, safeboot_fw_name)
|
||||||
|
return True
|
||||||
|
except:
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def esp32_create_combined_bin(source, target, env):
|
def esp32_create_combined_bin(source, target, env):
|
||||||
#print("Generating combined binary for serial flashing")
|
#print("Generating combined binary for serial flashing")
|
||||||
@ -235,10 +247,11 @@ def esp32_create_combined_bin(source, target, env):
|
|||||||
if not os.path.exists(variants_dir):
|
if not os.path.exists(variants_dir):
|
||||||
os.makedirs(variants_dir)
|
os.makedirs(variants_dir)
|
||||||
if "safeboot" in firmware_name:
|
if "safeboot" in firmware_name:
|
||||||
esp32_copy_new_safeboot_bin(tasmota_platform,firmware_name)
|
s_flag = esp32_copy_new_safeboot_bin(tasmota_platform,firmware_name)
|
||||||
else:
|
else:
|
||||||
esp32_fetch_safeboot_bin(tasmota_platform)
|
s_flag = esp32_fetch_safeboot_bin(tasmota_platform)
|
||||||
|
|
||||||
|
if s_flag: # check if safeboot firmware is existing
|
||||||
flash_size = env.BoardConfig().get("upload.flash_size", "4MB")
|
flash_size = env.BoardConfig().get("upload.flash_size", "4MB")
|
||||||
flash_mode = env["__get_board_flash_mode"](env)
|
flash_mode = env["__get_board_flash_mode"](env)
|
||||||
flash_freq = env["__get_board_f_flash"](env)
|
flash_freq = env["__get_board_f_flash"](env)
|
||||||
@ -264,7 +277,7 @@ def esp32_create_combined_bin(source, target, env):
|
|||||||
cmd += [sect_adr, sect_file]
|
cmd += [sect_adr, sect_file]
|
||||||
|
|
||||||
# "main" firmware to app0 - mandatory, except we just built a new safeboot bin locally
|
# "main" firmware to app0 - mandatory, except we just built a new safeboot bin locally
|
||||||
if "safeboot" not in firmware_name:
|
if ("safeboot" not in firmware_name):
|
||||||
print(f" - {hex(app_offset)} | {firmware_name}")
|
print(f" - {hex(app_offset)} | {firmware_name}")
|
||||||
cmd += [hex(app_offset), firmware_name]
|
cmd += [hex(app_offset), firmware_name]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user