mirror of https://github.com/arendst/Tasmota.git
copy factory firmware to `build_output`
This commit is contained in:
parent
c808257284
commit
12ecfae94d
|
@ -14,6 +14,12 @@ def bin_map_copy(source, target, env):
|
||||||
map_file = tasmotapiolib.get_final_map_path(env)
|
map_file = tasmotapiolib.get_final_map_path(env)
|
||||||
bin_file = tasmotapiolib.get_final_bin_path(env)
|
bin_file = tasmotapiolib.get_final_bin_path(env)
|
||||||
|
|
||||||
|
if env["PIOPLATFORM"] == "espressif32":
|
||||||
|
factory_tmp = pathlib.Path(firsttarget).with_suffix("")
|
||||||
|
factory = factory_tmp.with_suffix(factory_tmp.suffix + ".factory.bin")
|
||||||
|
one_bin_tmp = pathlib.Path(bin_file).with_suffix("")
|
||||||
|
one_bin_file = one_bin_tmp.with_suffix(one_bin_tmp.suffix + ".factory.bin")
|
||||||
|
|
||||||
# check if new target files exist and remove if necessary
|
# check if new target files exist and remove if necessary
|
||||||
for f in [map_file, bin_file]:
|
for f in [map_file, bin_file]:
|
||||||
if f.is_file():
|
if f.is_file():
|
||||||
|
@ -22,6 +28,7 @@ def bin_map_copy(source, target, env):
|
||||||
# copy firmware.bin and map to final destination
|
# copy firmware.bin and map to final destination
|
||||||
shutil.copy(firsttarget, bin_file)
|
shutil.copy(firsttarget, bin_file)
|
||||||
shutil.move(tasmotapiolib.get_source_map_path(env), map_file)
|
shutil.move(tasmotapiolib.get_source_map_path(env), map_file)
|
||||||
|
if env["PIOPLATFORM"] == "espressif32":
|
||||||
|
shutil.copy(factory, one_bin_file)
|
||||||
|
|
||||||
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", bin_map_copy)
|
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", bin_map_copy)
|
||||||
|
|
|
@ -37,7 +37,7 @@ def esp32_create_factory_bin(source, target, env):
|
||||||
# - 0xe000 | ~\.platformio\packages\framework-arduinoespressif32\tools\partitions\boot_app0.bin
|
# - 0xe000 | ~\.platformio\packages\framework-arduinoespressif32\tools\partitions\boot_app0.bin
|
||||||
# - 0x10000 | ~\Tasmota\.pio\build\<env name>/firmware.bin
|
# - 0x10000 | ~\Tasmota\.pio\build\<env name>/firmware.bin
|
||||||
|
|
||||||
new_file_name = env.subst("$BUILD_DIR/${PROGNAME}-factory.bin")
|
new_file_name = env.subst("$BUILD_DIR/${PROGNAME}.factory.bin")
|
||||||
sections = env.subst(env.get('FLASH_EXTRA_IMAGES'))
|
sections = env.subst(env.get('FLASH_EXTRA_IMAGES'))
|
||||||
new_file = open(new_file_name,"wb")
|
new_file = open(new_file_name,"wb")
|
||||||
new_file.truncate() # Make sure no left over data is present from a previous build
|
new_file.truncate() # Make sure no left over data is present from a previous build
|
||||||
|
|
Loading…
Reference in New Issue