From 2cf729818bc1452b3e6870e29f838a3833f860f6 Mon Sep 17 00:00:00 2001 From: Moritz Warning Date: Mon, 22 Feb 2021 00:18:10 +0100 Subject: [PATCH 1/3] build: preserve profiles.json between builds Keep other profiles.json content if the data belongs to the current build version. Also useful for the ImageBuilder, which builds for a single model each time. Without this commit the profiles.json would only contain the latest build profile information. Signed-off-by: Moritz Warning [improve commit message] Signed-off-by: Paul Spooren (cherry picked from commit a463b96241fbc2d142982387eaed9989e201ac7a) --- scripts/json_overview_image_info.py | 32 +++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/scripts/json_overview_image_info.py b/scripts/json_overview_image_info.py index 8dbd24af2d..45c05012b1 100755 --- a/scripts/json_overview_image_info.py +++ b/scripts/json_overview_image_info.py @@ -18,19 +18,33 @@ work_dir = Path(getenv("WORK_DIR")) output = {} + +def get_initial_output(image_info): + # preserve existing profiles.json + if output_path.is_file(): + profiles = json.loads(output_path.read_text()) + if profiles["version_code"] == image_info["version_code"]: + return profiles + return image_info + + for json_file in work_dir.glob("*.json"): image_info = json.loads(json_file.read_text()) + if not output: - output.update(image_info) + output = get_initial_output(image_info) + + # get first and only profile in json file + device_id, profile = next(iter(image_info["profiles"].items())) + if device_id not in output["profiles"]: + output["profiles"][device_id] = profile else: - # get first (and only) profile in json file - device_id = next(iter(image_info["profiles"].keys())) - if device_id not in output["profiles"]: - output["profiles"].update(image_info["profiles"]) - else: - output["profiles"][device_id]["images"].append( - image_info["profiles"][device_id]["images"][0] - ) + output["profiles"][device_id]["images"].extend(profile["images"]) + +# make image lists unique by name, keep last/latest +for device_id, profile in output["profiles"].items(): + profile["images"] = list({e["name"]: e for e in profile["images"]}.values()) + if output: default_packages, output["arch_packages"] = run( From 230a1072371b035713ea1a0ea9e6d0097a979805 Mon Sep 17 00:00:00 2001 From: Chris Blake Date: Wed, 9 Jun 2021 07:23:11 -0500 Subject: [PATCH 2/3] x86: add upgrade support to diag.sh Similar to how this is done in the diag.sh found in the base-files package, we should blink our status LED (if we have one) during the upgrade process. This follows the same blink pattern as seen at ./package/base-files/files/etc/diag.sh#L36 Signed-off-by: Chris Blake (cherry picked from commit 82bec3364de557eb21ef85e1993468ba535e540b) --- target/linux/x86/base-files/etc/diag.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/linux/x86/base-files/etc/diag.sh b/target/linux/x86/base-files/etc/diag.sh index 3af4b23583..5a71c18caf 100644 --- a/target/linux/x86/base-files/etc/diag.sh +++ b/target/linux/x86/base-files/etc/diag.sh @@ -71,6 +71,10 @@ set_state() { status_led_blink_preinit_regular ;; + upgrade) + status_led_blink_preinit_regular + ;; + done) status_led_on ;; From 0397f2d0c6d6d2f63d46347b5d7a06c754125c87 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Thu, 17 Jun 2021 23:47:35 +0800 Subject: [PATCH 3/3] x86: fix upgrade vars Signed-off-by: Tianling Shen --- target/linux/x86/base-files/lib/upgrade/platform.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/x86/base-files/lib/upgrade/platform.sh b/target/linux/x86/base-files/lib/upgrade/platform.sh index 9147ddcf2a..3fe9d4126e 100644 --- a/target/linux/x86/base-files/lib/upgrade/platform.sh +++ b/target/linux/x86/base-files/lib/upgrade/platform.sh @@ -79,7 +79,7 @@ platform_do_upgrade() { sync - if [ "$UPGRADE_OPT_SAVE_PARTITIONS" = "1" ]; then + if [ "$SAVE_PARTITIONS" = "1" ]; then get_partitions "/dev/$diskdev" bootdisk echo "Extract boot sector from the image"