diff options
author | Rob Barnes <robbarnes@google.com> | 2021-05-13 12:27:56 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-09-14 12:18:02 +0000 |
commit | 5d157c8679880b8c86bb3944daa35ba25aece58b (patch) | |
tree | c8285384008e6ee38b16d88e13f8f258298f3808 /zephyr | |
parent | da4711d25c547f760efd1b2e8df1af2957972eae (diff) | |
download | chrome-ec-5d157c8679880b8c86bb3944daa35ba25aece58b.tar.gz |
system: Add CrOS FWID to version output
EC version does not follow the the AP and OS version. This causes
confusion during development. This change augments the EC version output
to include the CrOS FWID when available. The CrOS FWID will be missing
when the CrOS EC is built outside of cros_sdk. When CrOS FWID is missing
'CROS_FWID_MISSING' will be used.
Zephyr/zmake support will be added later, CROS_FWID32 is set to
'CROS_FWID_MISSING' in zephyr builds until then.
BUG=b:188073399
TEST=version
21-05-20 16:43:18.627 Chip: Nuvoton NPCX993F A.00160101
21-05-20 16:43:18.631 Board: 1
21-05-20 16:43:18.631 RO: guybrush_v2.0.8770+f47439f75
21-05-20 16:43:18.634 guybrush_13983.0.21_05_20
21-05-20 16:43:18.639 RW_A: * guybrush_v2.0.8770+f47439f75
21-05-20 16:43:18.641 * guybrush_13983.0.21_05_20
21-05-20 16:43:18.644 RW_B: guybrush_v2.0.8770+f47439f75
21-05-20 16:43:18.644 guybrush_13983.0.21_05_20
21-05-20 16:43:18.647 Build: guybrush_v2.0.8770+f47439f75
21-05-20 16:43:18.651 guybrush_13983.0.21_05_20 2021-05-20
21-05-20 16:43:18.657 16:31:19 robbarnes@robbarnes0
ectool version
RO version: guybrush_v2.0.8770+f47439f75
RO cros fwid: guybrush_13983.0.21_05_20
RW version: guybrush_v2.0.8770+f47439f75
RW cros fwid: guybrush_13983.0.21_05_20
Firmware copy: RO
Build info: guybrush_v2.0.8770+f47439f75
guybrush_13983.0.21_05_20 2021-05-20 16:31:19 robbarnes@robbarnes0
Tool version: 1.1.9999-f47439f @robbarnes0
BRANCH=None
Signed-off-by: Rob Barnes <robbarnes@google.com>
Change-Id: Ief0a0c6e9d35edc72ac2d4780ee203be41d7305f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2894145
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'zephyr')
-rw-r--r-- | zephyr/Kconfig | 7 | ||||
-rw-r--r-- | zephyr/shim/include/config_chip.h | 5 | ||||
-rw-r--r-- | zephyr/zmake/tests/test_version.py | 4 | ||||
-rw-r--r-- | zephyr/zmake/zmake/version.py | 7 |
4 files changed, 23 insertions, 0 deletions
diff --git a/zephyr/Kconfig b/zephyr/Kconfig index 58961630ce..563fddd737 100644 --- a/zephyr/Kconfig +++ b/zephyr/Kconfig @@ -281,6 +281,13 @@ config PLATFORM_EC_CONSOLE_CMD_SHMEM used and the maximum number of bytes that have been used since the EC started running. +config PLATFORM_EC_CROS_FWID_VERSION + bool "Include CrOS FWID version" + default y + help + Include Chrome OS FWID in version output. The CrOS FWID will be common + across OS, AP firmware and EC firmware when built together. + config PLATFORM_EC_DEBUG_ASSERT bool "Enable assertion failures" default y diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h index 0ab812a5b8..f53e4025b7 100644 --- a/zephyr/shim/include/config_chip.h +++ b/zephyr/shim/include/config_chip.h @@ -633,6 +633,11 @@ #define CONFIG_CMD_SHMEM #endif +#undef CONFIG_CROS_FWID_VERSION +#ifdef CONFIG_PLATFORM_EC_CROS_FWID_VERSION +#define CONFIG_CROS_FWID_VERSION +#endif + #ifdef CONFIG_PLATFORM_EC_TIMER #define CONFIG_HWTIMER_64BIT #define CONFIG_HW_SPECIFIC_UDELAY diff --git a/zephyr/zmake/tests/test_version.py b/zephyr/zmake/tests/test_version.py index 44997f94da..a238a8ac02 100644 --- a/zephyr/zmake/tests/test_version.py +++ b/zephyr/zmake/tests/test_version.py @@ -124,6 +124,8 @@ EXPECTED_HEADER = ( '#define CROS_EC_VERSION32 "trogdor_v2.6.1004-cmsis:0dead0,"\n' '#define BUILDER "toukmond@pokey"\n' '#define DATE "2021-06-28 03:18:53"\n' + '#define CROS_FWID_MISSING_STR "CROS_FWID_MISSING"\n' + "#define CROS_FWID32 CROS_FWID_MISSING_STR\n" ) HEADER_VERSION_STR_STATIC = "trogdor_v2.6.0-STATIC" EXPECTED_HEADER_STATIC = ( @@ -132,6 +134,8 @@ EXPECTED_HEADER_STATIC = ( '#define CROS_EC_VERSION32 "trogdor_v2.6.0-STATIC"\n' '#define BUILDER "reproducible@build"\n' '#define DATE "STATIC_VERSION_DATE"\n' + '#define CROS_FWID_MISSING_STR "CROS_FWID_MISSING"\n' + "#define CROS_FWID32 CROS_FWID_MISSING_STR\n" ) diff --git a/zephyr/zmake/zmake/version.py b/zephyr/zmake/zmake/version.py index 2d505769f2..47aba6d804 100644 --- a/zephyr/zmake/zmake/version.py +++ b/zephyr/zmake/zmake/version.py @@ -144,6 +144,9 @@ def write_version_header(version_str, output_path, static=False): def add_def(name, value): output.write("#define {} {}\n".format(name, util.c_str(value))) + def add_def_unquoted(name, value): + output.write("#define {} {}\n".format(name, value)) + add_def("VERSION", version_str) add_def("CROS_EC_VERSION32", version_str[:31]) @@ -154,6 +157,10 @@ def write_version_header(version_str, output_path, static=False): add_def("BUILDER", "{}@{}".format(getpass.getuser(), platform.node())) add_def("DATE", datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")) + add_def("CROS_FWID_MISSING_STR", "CROS_FWID_MISSING") + # TODO(b/198475757): Add zmake support for getting CROS_FWID32 + add_def_unquoted("CROS_FWID32", "CROS_FWID_MISSING_STR") + contents = output.getvalue() if not output_path.exists() or output_path.read_text() != contents: output_path.write_text(contents) |