summaryrefslogtreecommitdiff
path: root/futility
diff options
context:
space:
mode:
authorBrian Norris <briannorris@chromium.org>2022-11-18 18:36:27 +0000
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-11-19 04:37:50 +0000
commit87663c3bef0f6b198945cf3eb83632f461a5d6f8 (patch)
tree5437a0949bda540a9b6ef245d2f378872a20c4f6 /futility
parent0d5f3ca53047313b96aa620a14f8401a2392a220 (diff)
downloadvboot-87663c3bef0f6b198945cf3eb83632f461a5d6f8.tar.gz
Revert "crossystem: Add board_id property"stabilize-15251.B
This reverts commit db1b34f559fdbf5584b57007da43e4dddda43c6a. Reason for revert: seems to break scarlet - b/259702907 Original change's description: > crossystem: Add board_id property > > futility is one of a few places in ChromeOS that uses "mosys platform > version". The goal is to remove this command from mosys. > > This commit adds a new property to crossystem, "board_id", which > reads the board revision from SMBIOS/FDT, and replaces the call in > futility with the appropriate VbGetSystemPropertyInt. > > BUG=b:187790074 > BRANCH=none > TEST="crossystem board_id" on hana and brya > > Change-Id: Id69c8e309c0e509a165aa6da2778573ac7de3455 > Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4029537 > Reviewed-by: Julius Werner <jwerner@chromium.org> Bug: b:187790074, b:259702907 Change-Id: Ibdc2525d6f395e2ef63354d36ca02b71543e8079 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4038443 Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Brian Norris <briannorris@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Owners-Override: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'futility')
-rw-r--r--futility/updater_utils.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/futility/updater_utils.c b/futility/updater_utils.c
index cc60ee8a..978936fa 100644
--- a/futility/updater_utils.c
+++ b/futility/updater_utils.c
@@ -23,6 +23,9 @@
#define COMMAND_BUFFER_SIZE 256
+/* System environment values. */
+static const char * const STR_REV = "rev";
+
/*
* Strips a string (usually from shell execution output) by removing all the
* trailing characters in pattern. If pattern is NULL, match by space type
@@ -425,9 +428,28 @@ static int host_get_fw_vboot2(void)
return VbGetSystemPropertyInt("fw_vboot2");
}
+/* A help function to get $(mosys platform version). */
static int host_get_platform_version(void)
{
- return VbGetSystemPropertyInt("board_id");
+ char *result = host_shell("mosys platform version");
+ long rev = -1;
+
+ /* Result should be 'revN' */
+ if (strncmp(result, STR_REV, strlen(STR_REV)) == 0)
+ rev = strtol(result + strlen(STR_REV), NULL, 0);
+
+ /* we should never have negative or extremely large versions,
+ * but clamp just to be sure
+ */
+ if (rev < 0)
+ rev = 0;
+ if (rev > INT_MAX)
+ rev = INT_MAX;
+
+ VB2_DEBUG("Raw data = [%s], parsed version is %ld\n", result, rev);
+
+ free(result);
+ return rev;
}
/*