diff options
author | Ye Li <ye.li@nxp.com> | 2020-12-30 03:04:09 -0800 |
---|---|---|
committer | Ye Li <ye.li@nxp.com> | 2021-01-03 18:20:03 -0800 |
commit | 12b10ca458ba34f17bc91ea13e9598e5d135687e (patch) | |
tree | f8220d62895cb891b774848e06c7248bc833efa7 | |
parent | 42b1b6cf8e03e0416c55ef87e32555ec69b2e60f (diff) |
LF-2627 plat: imx: Update the version string parser
For git repo without tag, the build string does not have tag and
commit with "g" prefix. Update the parser for this case.
Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
-rw-r--r-- | plat/imx/common/imx_sip_handler.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/plat/imx/common/imx_sip_handler.c b/plat/imx/common/imx_sip_handler.c index a8f92b97b..af3389181 100644 --- a/plat/imx/common/imx_sip_handler.c +++ b/plat/imx/common/imx_sip_handler.c @@ -214,12 +214,18 @@ static uint64_t imx_get_commit_hash(u_register_t x2, if (*(parse) == 'g') { /* Default is 7 hexadecimal digits */ memcpy((void *)&hash, (void *)(parse + 1), 7); - break; + return hash; } } } while (parse != NULL); + /* When no tag, the build string only contains commit and dirty */ + parse = strchr(version_string, ':'); + if (parse && *(parse + 1) != '\0') { + memcpy((void *)&hash, (void *)(parse + 1), 7); + } + return hash; } |