diff --git a/recipes-app/iot2050-firmware-update/files/iot2050-firmware-update b/recipes-app/iot2050-firmware-update/files/iot2050-firmware-update index 1102db91d..9124f1e0f 100755 --- a/recipes-app/iot2050-firmware-update/files/iot2050-firmware-update +++ b/recipes-app/iot2050-firmware-update/files/iot2050-firmware-update @@ -58,7 +58,7 @@ # } # ], # "suggest_preserved_uboot_env": [ -# "boot_targets", +# "boot_targets" # ] # } # @@ -105,6 +105,7 @@ import mmap import argparse import tarfile import json +import textwrap from types import SimpleNamespace as Namespace import subprocess import tempfile @@ -425,9 +426,23 @@ class ManagedFirmwareUpdate(FirmwareUpdate): return preserved_uboot_env_value +__version__ = "0.2" def main(argv): - parser = argparse.ArgumentParser(description='Update OSPI firmware.') + description=textwrap.dedent('''\ + Update OSPI firmware. + Examples: + 1. %(prog)s -f file.bin + using binary format firmware + 2. %(prog)s file.tar.xz + using tarball format firmware + 3. %(prog)s -p "env1,env2" file.tar.xz + using tarball format firmware, preserve environment follow -p + 4. %(prog)s -r file.tar.xz + using tarball format firmware, reset environment + ''') + parser = argparse.ArgumentParser(description=description, + formatter_class=argparse.RawDescriptionHelpFormatter) group = parser.add_mutually_exclusive_group() parser.add_argument('firmware', metavar='FIRMWARE', type=argparse.FileType('rb'), @@ -437,10 +452,13 @@ def main(argv): action='store_true') group.add_argument('-p', '--preserve_list', type=str, - help='env preserve list,using comma to separate env') + help='env preserve list, using comma to separate env') group.add_argument('-r', '--reset', help='reset env to default value', action='store_true') + parser.add_argument('-v', '--version', + action='version', + version="%(prog)s version: " + __version__) try: args = parser.parse_args() @@ -475,7 +493,7 @@ def main(argv): for env in envlist: print(env) preserved_env_input = input( - "\nWarning: Preserve the above env variables. Confirm(n/Y)? ") + "\nWarning: Preserve the above env variables. Confirm(Y/n)? ") if not preserved_env_input == "n": updater.update_uboot_env(envlist) diff --git a/recipes-app/iot2050-firmware-update/iot2050-firmware-update_0.1.bb b/recipes-app/iot2050-firmware-update/iot2050-firmware-update_0.2.bb similarity index 100% rename from recipes-app/iot2050-firmware-update/iot2050-firmware-update_0.1.bb rename to recipes-app/iot2050-firmware-update/iot2050-firmware-update_0.2.bb