diff options
author | Martin Braun <martin.braun@ettus.com> | 2021-07-07 16:48:24 +0200 |
---|---|---|
committer | Martin Braun <martin@gnuradio.org> | 2021-07-08 00:05:43 -0700 |
commit | d610a16cc4877f861c13cb29507eca2d4f10a990 (patch) | |
tree | 20f3fd384e6d6789ce25290c8af4411789837331 /mpm | |
parent | 5b31c2964d9084845d38815d4da2f859acf516bf (diff) | |
download | uhd-d610a16cc4877f861c13cb29507eca2d4f10a990.tar.gz uhd-d610a16cc4877f861c13cb29507eca2d4f10a990.tar.bz2 uhd-d610a16cc4877f861c13cb29507eca2d4f10a990.zip |
mpm: Update usrp_update_fs to support X410
With this patch, we can, for example, run
usrp_update_fs -t master
to download the currently most up-to-date filesystem and apply to the
device.
Diffstat (limited to 'mpm')
-rwxr-xr-x | mpm/python/usrp_update_fs | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/mpm/python/usrp_update_fs b/mpm/python/usrp_update_fs index 0d44a88d2..45714f2c0 100755 --- a/mpm/python/usrp_update_fs +++ b/mpm/python/usrp_update_fs @@ -8,13 +8,12 @@ Embedded USRP filesystem update utility """ -from __future__ import print_function +import sys import os import time import subprocess import argparse import tempfile -from builtins import input import requests MPM_DEVICE = None # This is the default value @@ -26,10 +25,15 @@ except ImportError: DEFAULT_IMAGES_INSTALL_LOCATION = '/usr/share/uhd/images/' DEFAULT_REMOTE_MANIFEST_URL =\ 'https://raw.githubusercontent.com/EttusResearch/uhd/{tag}/images/manifest.txt' -DEFAULT_FS_IMAGE = {'n3xx': 'usrp_n3xx_fs.mender', 'e320': 'usrp_e320_fs.mender'} +DEFAULT_FS_IMAGE = { + 'n3xx': 'usrp_n3xx_fs.mender', + 'e320': 'usrp_e320_fs.mender', + 'x4xx': 'usrp_x4xx_fs.mender', +} DEFAULT_MENDER_TARGET = { 'n3xx': 'n3xx_...._mender_default', 'e320': 'e320_...._mender_default', + 'x4xx': 'x4xx_common_mender_default', } def parse_args(): @@ -92,7 +96,7 @@ def prepare_manifest(manifest): manifest = manifest.strip() if os.path.isfile(manifest): return manifest - elif manifest.strip().startswith('http'): + if manifest.strip().startswith('http'): manifest = manifest.strip() temp_dir = tempfile.mkdtemp() print("Downloading manifest file from {}...".format( @@ -103,10 +107,11 @@ def prepare_manifest(manifest): # This will leave a stray file in /tmp but that's OK... we're blowing # away the FS anyway return manifest_path + raise RuntimeError("Unknown manifest location type: " + manifest) def get_manifest_from_tag(git_tag): """Turn a git tag or branch into a URL to a valid manifest""" - manifest_url = DEFAULT_REMOTE_MANIFEST_URL.format(git_tag) + manifest_url = DEFAULT_REMOTE_MANIFEST_URL.format(tag=git_tag) return prepare_manifest(manifest_url) def prepare_image(device_type, args): @@ -136,7 +141,7 @@ def prepare_image(device_type, args): def apply_image(mender_image): """Actually run mender to inject the mender_image""" - subprocess.check_call(['mender', '-rootfs', mender_image]) + subprocess.check_call(['mender', 'install', mender_image]) def reboot(): """ @@ -161,7 +166,7 @@ def run(): apply_image(mender_image) print("Applied image. After reboot, check if everything works, and then " "run the command '$ mender -commit' to confirm (otherwise, this " - "update will be undone.") + "update will be undone).") print("Note: Any data stored in this partition will be not accessible " "after reboot.") if args.yes: @@ -191,4 +196,4 @@ def main(): return False if __name__ == '__main__': - exit(not main()) + sys.exit(not main()) |