Skip to content

Commit

Permalink
[ESP32] Simplifies SimpleNamespace creation for generating factory pa…
Browse files Browse the repository at this point in the history
…rtition with and without encryption (#26015)

* [tools] Simplifies SimpleNamespace creation and usage for generating nvs binary with and without encryption in 'scripts/tools/generate_esp32_chip_factory_bin.py'

Signed-off-by: dhairyashah1 <[email protected]>

* Restyled by autopep8

---------

Signed-off-by: dhairyashah1 <[email protected]>
Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Jan 25, 2024
1 parent 553c048 commit c42e51d
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions scripts/tools/generate_esp32_chip_factory_bin.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,22 +400,17 @@ def generate_nvs_csv(out_csv_filename):


def generate_nvs_bin(encrypt, size, csv_filename, bin_filename):
nvs_args = SimpleNamespace(version=2,
outdir=os.getcwd(),
input=csv_filename,
output=bin_filename,
size=hex(size))
if encrypt:
nvs_args = SimpleNamespace(version=2,
keygen=True,
keyfile=NVS_KEY_PARTITION_BIN,
inputkey=None,
outdir=os.getcwd(),
input=csv_filename,
output=bin_filename,
size=hex(size))
nvs_args.keygen = True
nvs_args.keyfile = NVS_KEY_PARTITION_BIN
nvs_args.inputkey = None,
nvs_partition_gen.encrypt(nvs_args)
else:
nvs_args = SimpleNamespace(input=csv_filename,
output=bin_filename,
size=hex(size),
outdir=os.getcwd(),
version=2)
nvs_partition_gen.generate(nvs_args)


Expand Down

0 comments on commit c42e51d

Please sign in to comment.