summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorJi Luo <ji.luo@nxp.com>2018-10-31 09:55:07 +0800
committerNitin Garg <nitin.garg@nxp.com>2018-11-02 20:50:09 -0500
commit8cd43400c1539f1e48f952d23626dbaf03986dc4 (patch)
treea7ff9e4012624908e080c48d4b564b52b2f47bc1 /common
parent4207a8df84dadbc68c99ed965661546a6af5a99c (diff)
MA-13276 [Auto] Generate key blob when set the rpmb key
Generate the key blob and store it to the last block of boot1 partition after setting the rpmb key. The key blob should be checked in spl and be passed to Trusty OS if it's valid. If the key blob are damaged, RPMB storage proxy service will return fail and should make the device hang. Test: Build and boot ok on imx8qm/qxp. Change-Id: Ia274cd72109ab6ae15920e91b2a2008e1f1e667c Signed-off-by: Ji Luo <ji.luo@nxp.com>
Diffstat (limited to 'common')
-rw-r--r--common/image-android.c9
-rw-r--r--common/spl/spl_mmc.c9
2 files changed, 15 insertions, 3 deletions
diff --git a/common/image-android.c b/common/image-android.c
index f569725c82..dac4236bdb 100644
--- a/common/image-android.c
+++ b/common/image-android.c
@@ -204,9 +204,12 @@ int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify,
#endif
#ifdef CONFIG_IMX_TRUSTY_OS
- char *bootargs_trusty = "androidboot.keystore=trusty";
- strncat(commandline, " ", sizeof(commandline) - strlen(commandline));
- strncat(commandline, bootargs_trusty, sizeof(commandline) - strlen(commandline));
+ char *keystore = env_get("keystore");
+ if (!strncpy(keystore, "software", sizeof("software"))) {
+ char *bootargs_trusty = "androidboot.keystore=trusty";
+ strncat(commandline, " ", sizeof(commandline) - strlen(commandline));
+ strncat(commandline, bootargs_trusty, sizeof(commandline) - strlen(commandline));
+ }
#endif
/* Add 'append_bootargs' to hold some paramemters which need to be appended
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index 90935aab1a..91b5190c07 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -54,6 +54,11 @@ ulong h_spl_load_read(struct spl_load_info *load, ulong sector,
return blk_dread(mmc_get_blk_desc(mmc), sector, count, buf);
}
+#if defined(CONFIG_IMX_TRUSTY_OS) && defined(CONFIG_ANDROID_AUTO_SUPPORT)
+/* Pre-declaration of check_rpmb_blob. */
+int check_rpmb_blob(struct mmc *mmc);
+#endif
+
#ifdef CONFIG_DUAL_BOOTLOADER
/* Pre-declaration of mmc_load_image_raw_sector_dual_uboot().
*/
@@ -103,6 +108,10 @@ int mmc_load_image_raw_sector(struct spl_image_info *spl_image,
return -1;
}
+ /* Images loaded, now check the rpmb keyblob for Trusty OS. */
+#if defined(CONFIG_IMX_TRUSTY_OS) && defined(CONFIG_ANDROID_AUTO_SUPPORT)
+ ret = check_rpmb_blob(mmc);
+#endif
return 0;
}