From 0bffea9ab8c6acc30af0cb613ae4cdd48f865834 Mon Sep 17 00:00:00 2001 From: Isaac Lee Date: Tue, 1 Jun 2021 15:47:34 +0800 Subject: futility: updater: correct the rootkey in manifest.json For customization projects, the bios image should be patched by model first, then the gbb got from the image could be correct. Reason: In the function, patch_image_by_model, it will apply the rootkey, vblock_a and vblock_b of the customization project to the gbb part of the image. This change moves the function "find_gbb" to the position after the function "patch_image_by_model" is called. BUG=b:188861251 BRANCH=none TEST=build Change-Id: I5d80405a2a3b0ecc45e86ca3322b328479b83702 Signed-off-by: Isaac Lee Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2929924 Reviewed-by: Hung-Te Lin --- futility/updater_archive.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/futility/updater_archive.c b/futility/updater_archive.c index 70d8bb33..f2475b6a 100644 --- a/futility/updater_archive.c +++ b/futility/updater_archive.c @@ -1061,16 +1061,16 @@ static void print_json_image( return; if (load_firmware_image(&image, fpath, archive)) return; - if (is_host) - gbb = find_gbb(&image); - else + if (!is_host) printf(",\n"); printf("%*s\"%s\": { \"versions\": { \"ro\": \"%s\", \"rw\": \"%s\" },", indent, "", name, image.ro_version, image.rw_version_a); indent += 2; - if (is_host && patch_image_by_model(&image, m, archive) != 0) { + if (!is_host) { + /* No extra information to be printed */ + } else if (patch_image_by_model(&image, m, archive) != 0) { ERROR("Failed to patch images by model: %s\n", m->name); - } else if (gbb) { + } else if (NULL != (gbb = find_gbb(&image))) { printf("\n%*s\"keys\": { \"root\": \"%s\", ", indent, "", get_gbb_key_hash(gbb, gbb->rootkey_offset, -- cgit v1.2.1