diff options
author | Ji Luo <ji.luo@nxp.com> | 2018-09-10 18:44:31 +0800 |
---|---|---|
committer | Ji Luo <ji.luo@nxp.com> | 2018-09-11 12:19:40 +0800 |
commit | 02b8787d0dc66aebbf395c4707c795ed8a42c5ff (patch) | |
tree | e309b95093c121c14c530063875e5e602ff40b4e /common | |
parent | 225fa189faa518a334729d01176bc966e0259b8d (diff) |
MA-12335 Canonical Boot Reason in Android Pie 9.0
Read boot reason from SRC(system reset controller) and report
it to kernel by "androidboot.bootreason=<>" kernel commandline.
This is enabled on imx6/7/7ulp/8m, imx8 will report default value
"androidboot.bootreason=reboot" since it can't get such info on
A core at u-boot stage.
Test: Boot reason report ok on imx6qp/imx7ulp/imx8qxp.
Change-Id: I03effaa03bc513bec6153e82c1a04e29c07e7db8
Signed-off-by: Ji Luo <ji.luo@nxp.com>
Diffstat (limited to 'common')
-rw-r--r-- | common/image-android.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/common/image-android.c b/common/image-android.c index 07d82d54593..81eaca8ef4d 100644 --- a/common/image-android.c +++ b/common/image-android.c @@ -143,6 +143,23 @@ int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify, metrics.odt, metrics.sw); strncat(commandline, newbootargs, sizeof(commandline) - strlen(commandline)); +#if defined(CONFIG_ARCH_MX6) || defined(CONFIG_ARCH_MX7) || \ + defined(CONFIG_ARCH_MX7ULP) || defined(CONFIG_ARCH_IMX8M) + char cause[18]; + + memset(cause, '\0', sizeof(cause)); + get_reboot_reason(cause); + if (strstr(cause, "POR")) + sprintf(newbootargs," androidboot.bootreason=cold,powerkey"); + else if (strstr(cause, "WDOG") || strstr(cause, "WDG")) + sprintf(newbootargs," androidboot.bootreason=watchdog"); + else + sprintf(newbootargs," androidboot.bootreason=reboot"); +#else + sprintf(newbootargs," androidboot.bootreason=reboot"); +#endif + strncat(commandline, newbootargs, sizeof(commandline) - strlen(commandline)); + #ifdef CONFIG_AVB_SUPPORT /* secondary cmdline added by avb */ char *bootargs_sec = env_get("bootargs_sec"); |