u-boot.git
3 years agoLFU-18 spi: fsl_lpspi: Fix dereference before null check
Ye Li [Thu, 27 May 2021 08:05:44 +0000 (01:05 -0700)]
LFU-18 spi: fsl_lpspi: Fix dereference before null check

Fix coverity Issue: 11026161 Dereference before null check
The lpspi should not be dereferenced before null checking, moving
getting its udevice after the checking

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
3 years agoLFU-145 imx8qxp_val: Fix uninitialized gpio variable
Ye Li [Thu, 27 May 2021 07:59:06 +0000 (00:59 -0700)]
LFU-145 imx8qxp_val: Fix uninitialized gpio variable

Fix coverity Issue: 13562326 Uninitialized scalar variable
The flags field of struct gpio_desc is not initialized. When calling
dm_gpio_set_dir_flags, the flags field will be used.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
3 years agoLFU-154 imx6ul: bee: fix build break
Peng Fan [Thu, 27 May 2021 10:42:24 +0000 (18:42 +0800)]
LFU-154 imx6ul: bee: fix build break

Fix below build break by including the global_data.h header file.
"
  CC      arch/arm/mach-imx/mx6/bee.o
arch/arm/mach-imx/mx6/bee.c:18:1: warning: data definition has no type or storage class
   18 | DECLARE_GLOBAL_DATA_PTR;
      | ^~~~~~~~~~~~~~~~~~~~~~~
arch/arm/mach-imx/mx6/bee.c:18:1: warning: type defaults to ‘int’ in declaration of ‘DECLARE_GLOBAL_DATA_PTR’ [-Wimplicit-int]
arch/arm/mach-imx/mx6/bee.c: In function ‘region_valid’:
arch/arm/mach-imx/mx6/bee.c:261:29: error: ‘gd’ undeclared (first use in this function)
  261 |  if ((start + size - 1) >= (gd->start_addr_sp - SZ_128K)) {
      |                             ^~
arch/arm/mach-imx/mx6/bee.c:261:29: note: each undeclared identifier is reported only once for each function it appears in
scripts/Makefile.build:265: recipe for target 'arch/arm/mach-imx/mx6/bee.o' failed
make[2]: *** [arch/arm/mach-imx/mx6/bee.o] Error 1

"

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoMA-19082-2 imx8m: Use Trusty OS handle SNVS operation
Ji Luo [Thu, 18 Jul 2019 06:18:14 +0000 (14:18 +0800)]
MA-19082-2 imx8m: Use Trusty OS handle SNVS operation

This patch added Trusty OS in u-boot to handle
some snvs related operation.

Change-Id: Iba2b9e12381ce537b40959f14e831accbdecba8f
Signed-off-by: Haoran.Wang <elven.wang@nxp.com>
Signed-off-by: Ji Luo <ji.luo@nxp.com>
3 years agoLF-3898-4 dts: imx8mm/n-evk: disable over current for usb1
Peng Fan [Wed, 26 May 2021 09:47:24 +0000 (17:47 +0800)]
LF-3898-4 dts: imx8mm/n-evk: disable over current for usb1

Sync with Ticket LF-3861.

Since imx8mm and imx8mn evk base board does not support over current
detection for usb1, so disable it.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoLF-3898-3 imx: imx8m: soc: runtime drop extcon property from usbotg node
Peng Fan [Wed, 26 May 2021 09:44:41 +0000 (17:44 +0800)]
LF-3898-3 imx: imx8m: soc: runtime drop extcon property from usbotg node

The extcon is an decrepted property and not used by upstream Linux and
NXP 5.10 kernel, so we remove it before kicking linux in case it is in
dts. Otherwise distro kernel will not able to have usb function.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoLF-3898-2 arm: dts: imx8mm: remove power domain property
Peng Fan [Wed, 26 May 2021 09:39:43 +0000 (17:39 +0800)]
LF-3898-2 arm: dts: imx8mm: remove power domain property

The current power domain node in imx8mm.dtsi is not used in U-Boot,
and it not match with upstream Linux Kernel. U-Boot use arm smccc
to enable usb power domain, so we could remove this property.
It could be added back when we finally switch to upstream pgc node.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoLF-3898-1 configs: imx8mm_evk: enable CONFIG_CMD_POWEROFF
Peng Fan [Wed, 26 May 2021 09:38:04 +0000 (17:38 +0800)]
LF-3898-1 configs: imx8mm_evk: enable CONFIG_CMD_POWEROFF

Enable CONFIG_CMD_POWEROFF to support ARM SystemReady power off test.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoLF-3843: dts: imx8mq evk: correct 1280x720p60 video timing
Sandor Yu [Fri, 21 May 2021 06:00:50 +0000 (14:00 +0800)]
LF-3843: dts: imx8mq evk: correct 1280x720p60 video timing

For 720p60 CEA mode:
hfront_porch = hsync_start - hdisplay = 1390-1280=110
hback_porch = htotal - hsync_end = 1650-1430=220
vfront_porch = vsync_start - vdisplay = 725-720=5
vback_porch = vtotal - vsync_end = 750-730=20

Add hsync-active and vsync-active;

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
3 years agoMA-19065-1 Support widevine keybox provision
Ji Luo [Wed, 19 May 2021 05:48:05 +0000 (13:48 +0800)]
MA-19065-1 Support widevine keybox provision

support widevine keybox provisioning via hwcrypto,
the keybox would be wrote into secure storage.

This commit supports two kinds of widevine keybox
provisioning: plain text keybox and encrypted keybox.

Command to provision the plain text keybox:
  $ fastboot stage <path-to-plain-text-keybox>
  $ fastboot oem provision-wv-keybox

Command to provision the encrypted text keybox:
  $ fastboot stage <path-to-encrypted-keybox>
  $ fastboot oem provision-wv-keybox-enc

Test: plain text/encrypted keybox provisioning on imx8mp.

Change-Id: I241afade415fc3e2b0a80d286b3cc4e8d702e620
Signed-off-by: Ji Luo <ji.luo@nxp.com>
3 years agoMA-19068 android auto: get right kernel size
Ji Luo [Thu, 20 May 2021 01:47:40 +0000 (09:47 +0800)]
MA-19068 android auto: get right kernel size

Pass the correct kernel address for android auto
so uboot can get correct kernel size.

Change-Id: I20b6501bbc401c5a1d5752179e00b3b9875a10a2
Signed-off-by: Ji Luo <ji.luo@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
3 years agoLFU-15 Fix using uninitialized value
Ji Luo [Thu, 17 Dec 2020 06:03:06 +0000 (14:03 +0800)]
LFU-15 Fix using uninitialized value

This commit fixes Coverity Issue: 11468195, avoid
uninitialized value using.

Test: AVB check.

Change-Id: I04eb8faafd6c9a9fec1aeae0b29edc6940251094
Signed-off-by: Ji Luo <ji.luo@nxp.com>
(cherry picked from commit 742cc182bf9d0d0a7c8cecdac2a328e5c0bd64cb)

3 years agoLF-1897 trusty: Fix extra argument to printf format specifier
Ji Luo [Mon, 3 Aug 2020 14:44:11 +0000 (22:44 +0800)]
LF-1897 trusty: Fix extra argument to printf format specifier

Fix Coverity Issue 10473659 and 10473672. Pass correct parameter
to fix the extra argument issue.

Signed-off-by: Ji Luo <ji.luo@nxp.com>
Change-Id: I72e30250827ad0c48e079a7048bdb40773c17a96
(cherry picked from commit ed061b4a21a24d8deb36561e0bfe2343e2ce45c8)

3 years agoLF-1896 trusty: fix invalid type in argument to printf format specifier
Ji Luo [Mon, 3 Aug 2020 11:53:15 +0000 (19:53 +0800)]
LF-1896 trusty: fix invalid type in argument to printf format specifier

Fix Coverity Issue 104736581047366310473664 and 10473668. Use "%lu"
for "uint64_t" and "unsigned long" parameter in printf to fix the type
mismatch issue.

Signed-off-by: Ji Luo <ji.luo@nxp.com>
Change-Id: Ic1642ab4d5aecee9676b65582b04eaca4c16d3c2

3 years agoLF-1894 trusty: fix invalid printf format string
Ji Luo [Mon, 3 Aug 2020 11:34:20 +0000 (19:34 +0800)]
LF-1894 trusty: fix invalid printf format string

Fix Coverity Issue 10473656. Use "%s" instead of "%" to
print the function name.

Signed-off-by: Ji Luo <ji.luo@nxp.com>
Change-Id: I3158b2504a2be0330eb982d279811ca88935a902
(cherry picked from commit 4339a489b8f24b35d2e59084e7ce42de27f28461)

3 years agoLF-1892 7ulp: Fix missing break in switch
Ji Luo [Mon, 3 Aug 2020 11:24:11 +0000 (19:24 +0800)]
LF-1892 7ulp: Fix missing break in switch

Fix Coverity Issue 10473654. Add 'break' statememt for 'case 2' to
fix MISSING_BREAK issue.

Signed-off-by: Ji Luo <ji.luo@nxp.com>
Change-Id: I33072ffeb1b8ecf108d1fbea8bc14905a23facc3
(cherry picked from commit e1155dc7a77b299899f8e0f7ca1c20a2bcbcea94)

3 years agoLF-1846 avb: Fix unintentional integer overflow
Ji Luo [Mon, 3 Aug 2020 11:17:09 +0000 (19:17 +0800)]
LF-1846 avb: Fix unintentional integer overflow

Fix Coverity Issue 2690361. Fix unintentional integer overflow by
casting the pte->length to type 'uint64_t'.

Signed-off-by: Ji Luo <ji.luo@nxp.com>
Change-Id: I4536e733c82cb31bbd7da0ee916e7698850c3b81
(cherry picked from commit 3a332c5264b1cdb5aa026bcb6fd4afad69c0d19b)

3 years agoLF-1850 fastboot: Fix buffer not null terminated
Ji Luo [Mon, 3 Aug 2020 10:31:36 +0000 (18:31 +0800)]
LF-1850 fastboot: Fix buffer not null terminated

Fix Coverity Issue 3351934. Calling strncpy() with the size shorter
than the source string and would cause null-terminate dest buffer.

Signed-off-by: Ji Luo <ji.luo@nxp.com>
Change-Id: I1e71fb584eb8f10a90ec87564cc49b7f9388c3de
(cherry picked from commit 0c408158af2592f34ed4ecc7c6a30db5c8676ffe)

3 years agoMA-19067 android: skip optee dtb node handling
Ji Luo [Wed, 19 May 2021 10:51:06 +0000 (18:51 +0800)]
MA-19067 android: skip optee dtb node handling

Android doesn't use optee so skip optee dtb node
handling.

Change-Id: I30bf91a62fe774dbae0d219fd17405feed6f0784
Signed-off-by: Ji Luo <ji.luo@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
3 years agoLFU-126-12 i.MX8: Moved Power on JR resource to jobring driver.
Gaurav Jain [Mon, 17 May 2021 04:09:31 +0000 (09:39 +0530)]
LFU-126-12 i.MX8: Moved Power on JR resource to jobring driver.

u-boot power domain driver API is used to power on JR.
so that u-boot framework will automatically
power off JR resource before booting into kernel.

Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
3 years agoMerging in latest from upstream (LFAC/uboot-nxp:refs/heads/imx_v2021.04)
Gaurav Jain [Tue, 18 May 2021 07:10:09 +0000 (09:10 +0200)]
Merging in latest from upstream (LFAC/uboot-nxp:refs/heads/imx_v2021.04)

* commit '4272c700e189240ca1befba02dd6c0ee795c1751':
  LF-3782 fastboot: Select USB_GADGET_OS_DESCRIPTORS for fastboot function
  MLK-25497 nand: mxs_nand_spl: Fix nand_spl_adjust_offset issue
  MLK-25496 imx6: Fix CONFIG_SYS_MMC_ENV_DEV for QSPI/SPI/EIM boot

3 years agoLF-3782 fastboot: Select USB_GADGET_OS_DESCRIPTORS for fastboot function
Ye Li [Tue, 18 May 2021 03:10:22 +0000 (20:10 -0700)]
LF-3782 fastboot: Select USB_GADGET_OS_DESCRIPTORS for fastboot function

CONFIG_USB_GADGET_OS_DESCRIPTORS must be set when using OS descriptor,
otherwise the OS descriptors (windows WCID) are not handled.
Since only fastboot uses this feature, default select
USB_GADGET_OS_DESCRIPTORS for fastboot function

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
3 years agoMLK-25497 nand: mxs_nand_spl: Fix nand_spl_adjust_offset issue
Ye Li [Sat, 15 May 2021 05:54:28 +0000 (22:54 -0700)]
MLK-25497 nand: mxs_nand_spl: Fix nand_spl_adjust_offset issue

Wrong offset was returned in commit e849aaa
(LF-3483-2 nand: mxs_nand_spl: Implement the nand_spl_adjust_offset)
Fix the issue by removing the sector.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
3 years agoMLK-25496 imx6: Fix CONFIG_SYS_MMC_ENV_DEV for QSPI/SPI/EIM boot
Ye Li [Fri, 14 May 2021 10:41:18 +0000 (03:41 -0700)]
MLK-25496 imx6: Fix CONFIG_SYS_MMC_ENV_DEV for QSPI/SPI/EIM boot

CONFIG_SYS_MMC_ENV_DEV depends on CONFIG_ENV_IS_IN_MMC.  So even
we have added it in defconfig for QSPI/SPI/EIM, but this does not
really set due to we set ENV in NOR flash device.

This causes "mmcdev" set to invalid value. So u-boot fails to
select SD card before loading kernel image.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
3 years agoMA-19038 Android: Add imx8/imx8m reference boards support
Ji Luo [Wed, 12 May 2021 07:00:38 +0000 (15:00 +0800)]
MA-19038 Android: Add imx8/imx8m reference boards support

Add configs to support imx8/imx8m reference boards, each platform
has specific header files include.

Test: sanity test on imx8/imx8m platforms.

Change-Id: Ic7341fe71fc765b93beb061208e1e3b8b92b990b
Signed-off-by: Ji Luo <ji.luo@nxp.com>
3 years agoMA-19037 imx8mn: Add spl mmc boot support
Ji Luo [Wed, 12 May 2021 05:49:55 +0000 (13:49 +0800)]
MA-19037 imx8mn: Add spl mmc boot support

Android won't boot with boot rom so add spl
mmc boot support here.

Change-Id: I0d1d9240ed63b99cec6d964ea369ff55865547c5
Signed-off-by: Ji Luo <ji.luo@nxp.com>
3 years agoMA-19036 android: imx8mm: Add 4GB lpddr4 support
Ji Luo [Wed, 12 May 2021 05:46:20 +0000 (13:46 +0800)]
MA-19036 android: imx8mm: Add 4GB lpddr4 support

Add support for imx8mm evk board with 4GB lpddr4.

Change-Id: I8254dfba90ac48a04c38bef21741cdc22d3cd470
Signed-off-by: Ji Luo <ji.luo@nxp.com>
3 years agoMA-19032 android: imx8: don't initialize caam in uboot
Ji Luo [Tue, 11 May 2021 08:31:13 +0000 (16:31 +0800)]
MA-19032 android: imx8: don't initialize caam in uboot

CAAM JR0/JR1 are reserved for SECO, JR2/JR3 will be used in
Trusty OS for android. As Android doesn't need the caam
in uboot for imx8q, so bypass the caam JR probe to avoid
conflicts.

Change-Id: Id4ffe9fbb466abfeadc2c18e4b5d7e1b68360ab5
Signed-off-by: Ji Luo <ji.luo@nxp.com>
3 years agoMA-19031 imx: hab: fix build break
Ji Luo [Tue, 11 May 2021 06:21:10 +0000 (14:21 +0800)]
MA-19031 imx: hab: fix build break

Include correct header file to fix below build
break:
  arch/arm/mach-imx/hab.c:20:1: warning: data definition has no type or storage class DECLARE_GLOBAL_DATA_PTR;
  ^~~~~~~~~~~~~~~~~~~~~~~
  arch/arm/mach-imx/hab.c:20:1: warning: type defaults to 'int' in declaration of 'DECLARE_GLOBAL_DATA_PTR' [-Wimplicit-int]
  arch/arm/mach-imx/hab.c:61:17: error: unknown type name 'gd_t'
  static volatile gd_t *gd_save;
  ^~~~
  arch/arm/mach-imx/hab.c: In function 'save_gd':
  arch/arm/mach-imx/hab.c:67:12: error: 'gd'
  undeclared (first use in this function)
  gd_save = gd;
  ^~
  arch/arm/mach-imx/hab.c:67:12: note: each undeclared identifier is reported only once for each function it appears in

Change-Id: Ie8c396be901a80d9bf90b74e59607d6d17619aaa
Signed-off-by: Ji Luo <ji.luo@nxp.com>
3 years agoMA-19030 android: Switch to new caam drivers
Ji Luo [Tue, 11 May 2021 04:10:01 +0000 (12:10 +0800)]
MA-19030 android: Switch to new caam drivers

fsl_caam.c would be dropped and this commit switches to
the new caam drivers for android.

Change-Id: I91ff446dc9a337d14732f05fb724368010d73dd2
Signed-off-by: Ji Luo <ji.luo@nxp.com>
3 years agoMA-19027 crypto/fsl: code clean up
Ji Luo [Tue, 11 May 2021 02:17:31 +0000 (10:17 +0800)]
MA-19027 crypto/fsl: code clean up

This commit makes some clean up for the caam blob
codes.

Change-Id: I1544894825ad9a25ae1e346b5fb917dd7cd78829
Signed-off-by: Ji Luo <ji.luo@nxp.com>
3 years agoMA-19026 Add config to guard rpmb driver in SPL
Ji Luo [Tue, 11 May 2021 02:00:49 +0000 (10:00 +0800)]
MA-19026 Add config to guard rpmb driver in SPL

Android will need rpmb operation in SPL, below commit
guard the rpmb.c build with CONFIG_SPL_SUPPORT_EMMC_RPMB
but didn't add it in the Kconfig:
  commit 2448c34f9fc26d3c459e6e7b28c6357656bfa287
  Author: Heinrich Schuchardt <xypron.glpk@gmx.de>
  Date:   Wed Apr 15 18:28:09 2020 +0200

      drivers: mmc: rpmb: do not build for SPL

      RPMB support is used by the 'mmc rpmb' command and by the OP-TEE
      support.
      We do not need it in SPL.
This commit will add CONFIG_SPL_SUPPORT_EMMC_RPMB defination
and select it by default when trusty is enabled.

Change-Id: I8d3b4481d529828cb03328b826e0e7065104ba46
Signed-off-by: Ji Luo <ji.luo@nxp.com>
3 years agoMA-19023 Add is_recovery_key_pressing() for imx8/imx8m
Ji Luo [Sat, 8 May 2021 07:59:32 +0000 (15:59 +0800)]
MA-19023 Add is_recovery_key_pressing() for imx8/imx8m

This is_recovery_key_pressing() will simply return as
we don't support it on the reference board.

Change-Id: I4748450f5d571737aa457662da7c972d613e15df
Signed-off-by: Ji Luo <ji.luo@nxp.com>
3 years agoMA-19022 Remove cmd_tbl_t typedef for imx
Ji Luo [Sat, 8 May 2021 06:43:11 +0000 (14:43 +0800)]
MA-19022 Remove cmd_tbl_t typedef for imx

cmd_tbl_t typedef has been removed by below commit:
  commit 09140113108541b95d340f3c7b6ee597d31ccc73
  Author: Simon Glass <sjg@chromium.org>
  Date:   Sun May 10 11:40:03 2020 -0600

      command: Remove the cmd_tbl_t typedef
Sync this change for imx platforms.

Change-Id: Ia08287658a3471569a92438434f3163ac078a49c
Signed-off-by: Ji Luo <ji.luo@nxp.com>
3 years agoMA-17916-1 Clean Up: Guard codes with correct configs
Ji Luo [Mon, 21 Sep 2020 08:22:21 +0000 (16:22 +0800)]
MA-17916-1 Clean Up: Guard codes with correct configs

This commit does some clean-up to guard the codes/configs with
correct configs, so we can enable/disable the feature without
modifying the codes.

Test: builds and boots on imx8qm.

Signed-off-by: Ji Luo <ji.luo@nxp.com>
Change-Id: Ic4cf4d9f47bd5a4317b2621a5378cb4b192e52fb
(cherry picked from commit 2c2363e47b858bd178c44869328eca211b2c3f62)
(cherry picked from commit cdf01e8a0fbf29df6230344889d1ec5035b6c978)

3 years agoMA-17046-1 Show orange warning for unlocked device
Ji Luo [Tue, 28 Apr 2020 01:52:07 +0000 (09:52 +0800)]
MA-17046-1 Show orange warning for unlocked device

According to the google boot flow, an orange warning should
be displayed on UNLOCKED device to reminder the users of the
potential risks.

This commit will show an orange warning logo and warning text
on the screen, it shall be dismissed after 3 seconds, users
can also skip it by pressing the ON-OFF button.

Config 'CONFIG_AVB_WARNING_LOGO_COLS' and 'CONFIG_AVB_WARNING_LOGO_ROWS'
define the (x, y) position of the warning logo, its default
value is for 1080*720 resolution display and can be overridden.

Test: Orange warning logo show on all imx8m/imx8q platfroms.

Change-Id: I607edb3da039b47ddfac681f855834d8da187af8
Signed-off-by: Ji Luo <ji.luo@nxp.com>
(cherry picked from commit 8ddefdb1186feb3580830fa04b588d3ee606cf81)

3 years agoMA-17159 Implement bootloader menu for imx7ulp
Ji Luo [Thu, 7 May 2020 04:52:00 +0000 (12:52 +0800)]
MA-17159 Implement bootloader menu for imx7ulp

According to the spec of android wear, the device MUST provides a
bootloader menu for debugging purpose.

This commit implements a simple bootloader menu based on imx7ulp_evk
revb board, the menu will show when booting with 'VOL+' key pressed,
users can press "VOL+" to choose the item, then press "ONOFF" key to
confirm.

Test: bootloader menu show on imx7ulp_evk revb.

Change-Id: I80638a43afa17e312e633b05888c62440380b42b
Signed-off-by: Ji Luo <ji.luo@nxp.com>
(cherry picked from commit 9d5995caf7146d4955fba2524a7f25d761049e28)

3 years agoMA-18914 Don't load key from RPMB in hard-code case
Ji Luo [Tue, 13 Apr 2021 06:18:24 +0000 (14:18 +0800)]
MA-18914 Don't load key from RPMB in hard-code case

Use hard-code public key instead of reading it from RPMB
When "CONFIG_LOAD_KEY_FROM_RPMB" is setting to "n".

Test: Boots on imx8mp.

Change-Id: I701777a0cfe3790a4e38f2cbe858e1fbddc2552a
Signed-off-by: Ji Luo <ji.luo@nxp.com>
Reviewed-by: Wang Haoran <elven.wang@nxp.com>
(cherry picked from commit 740eaa338b656b20611affb22572fe0a2253161d)

3 years agoMA-18913 Load dtb according to kernel address
Ji Luo [Tue, 13 Apr 2021 05:03:57 +0000 (13:03 +0800)]
MA-18913 Load dtb according to kernel address

As the kernel image will get bigger after enabling some debug
tools, 64MB kernel max size is not enough. Load the dtb to the
address right after linux kernel instead of setting fixed offset
to the start of kernel image.

The "kernel_size" in boot image header is the physical size of
"Image" instead of the memory size which the linux requires to
boot.

Test: boots on imx8mp/imx8qm.

Change-Id: I5946c8530610ff0742f2a911aaeccf7636938b94
Signed-off-by: Ji Luo <ji.luo@nxp.com>
Reviewed-by: Wang Haoran <elven.wang@nxp.com>
(cherry picked from commit c1f83790077516a64397467fce5880be0871f615)

3 years agoMA-18775 system will hang about 3s when boot up kernel
zhang sanshan [Fri, 5 Mar 2021 02:15:34 +0000 (10:15 +0800)]
MA-18775 system will hang about 3s when boot up kernel

system will hang at line 1834 which will hold console_waiter
1833    /* Owner will clear console_waiter on hand off */
1834    while (READ_ONCE(console_waiter))
1835           cpu_relax();
1836    spin_release(&console_owner_dep_map, _THIS_IP_);

It means  console_lock_spinning_disable_and_check is not called in time.
So console_unlock may not called in time.
remove earlycon as workaround.

Change-Id: I5742c0ade6e289d1a96a67b27b4e55f2e1732187
Signed-off-by: zhang sanshan <pete.zhang@nxp.com>
(cherry picked from commit 74938a70b5fece2d1f3f60e74596f393a40e5713)
(cherry picked from commit 9be7570228e5ede0b1ab0b015210aeb56585e39c)

3 years agoMA-18680-2 Support derive rpmb key from BKEK
Ji Luo [Fri, 5 Feb 2021 00:43:13 +0000 (08:43 +0800)]
MA-18680-2 Support derive rpmb key from BKEK

The BKEK will bind to the soc chip and we don't need to
store the encapsulated keyslot after using BKEK as the
rpmb key, which reduces the risk of losing the rpmb key.

This commit adds two commands to support derive the rpmb
key from BKEK and erase the rpmb storage (for debug purpose,
need support from trusty):
  $ fastboot oem set-rpmb-hardware-key
  $ fastboot oem erase-rpmb

Legacy keyslot way is still supported and boards programed
with keyslot can still work in compatible way. Command
to set provisioned rpmb key is changed to:
  $ fastboot stage <rpmb-key>
  $ fastboot oem set-rpmb-staged-key

Test: Key set and boot on imx8mn/imx8qxp.

Change-Id: Ifc88010fe8802d3550e42dff0bbd5a5e5ad922a3
Signed-off-by: Ji Luo <ji.luo@nxp.com>
(cherry picked from commit 0fd1b5e41645ac3f5c05ad82258df1645c59fb5a)
(cherry picked from commit 6a5125b9caf4c2e036853d8f53f8398c147758b3)

3 years agoMA-18634-1 Android: refine config dependency
Ji Luo [Tue, 26 Jan 2021 07:26:36 +0000 (15:26 +0800)]
MA-18634-1 Android: refine config dependency

Refine the dependency of some configs to make it
easier to add/modify android config files.

Test: builds.

Change-Id: Iccb044dadc7ce1e0b839bf83e2e9157e718f286c
Signed-off-by: Ji Luo <ji.luo@nxp.com>
(cherry picked from commit 86f4f99a367bbc0ef99d4ab2a0b4078babfbfbd2)
(cherry picked from commit 8f3e86b52a27948ba1be1d93dae5e5a4c8a73a0a)

3 years agoMA-18346-11 Android refine power on imx8mp board
haidong.zheng [Mon, 12 Oct 2020 08:41:03 +0000 (16:41 +0800)]
MA-18346-11 Android refine power on imx8mp board

VDD SOC normal run changed to 0.85V
LPDDR4 freq0 change from 4000MTS to 2400MTS

Change-Id: I69676ea5b582a817fb3c367bd861db96ba647540
(cherry picked from commit 1205f1edfaed1383181d4d52344cc55e5e92a351)
(cherry picked from commit 4a9841d9f362d98fe0bf4804d2b365d1f3cb1bb8)

3 years agoMA-18508 Sync keymaster bootloader commands ID
Ji Luo [Thu, 31 Dec 2020 01:14:26 +0000 (09:14 +0800)]
MA-18508 Sync keymaster bootloader commands ID

AOSP adds command 'KM_CLEAR_ATTESTATION_CERT_CHAIN' to clear
the attestation cert chain, but its ID will conflict with
'KM_SET_ATTESTATION_KEY_ENC'. This commit will reorder the
keymaster commands to avoid conflicts.

Test: ID attestation provision.

Change-Id: I0046b5bee4e0ffea3bdcff31859452da53d8e50d
Signed-off-by: Ji Luo <ji.luo@nxp.com>
(cherry picked from commit e19aa1c26047dc719e7561695100dac807925ae7)
(cherry picked from commit b9a1bcaea22da0491df322b36740d7498e39cd38)

3 years agoMA-18422 Locate the misc partition by name
Ji Luo [Wed, 16 Dec 2020 13:07:13 +0000 (21:07 +0800)]
MA-18422 Locate the misc partition by name

Locating the misc partition by ID can help reduce the boot
time but error may happen if the ID of the misc partition
is changed. Moving the misc partition to the start of the
GPT and locate the partition by name is another option but
it will break the backward compatibility as the GPT is
changed.

part_get_info_by_name() will loop the PTE and return the
matched partition info, but it will cost much time as it
will reload the whole PTE from storage in each loop.

This commit provides part_get_info_efi_by_name() to support
return the partition info by name without reloading the whole
PTE.

Test: A/B slot switch in dual bootloader.

Change-Id: I13cb2a7b3217f73aecc2aec6e06abc0d6e8abcdd
Signed-off-by: Ji Luo <ji.luo@nxp.com>
(cherry picked from commit cd8f603f0d977ed73f0d0b44437c5c68fcebde25)
(cherry picked from commit d9972736dc0272377f89ccf528e8a873199c7903)

3 years agoMA-18352-5 Support device IDs provision
Ji Luo [Fri, 4 Dec 2020 03:01:23 +0000 (11:01 +0800)]
MA-18352-5 Support device IDs provision

The device IDs are provisioned from bootloader, this commit
add commands to provision the deivce IDs:
    $ fastboot oem append-device-id

Test: Device IDs provision and attest.

Change-Id: Id3c737d3da02f7ba463e51b0525f3cb9bcf0c6d1
Signed-off-by: Ji Luo <ji.luo@nxp.com>
(cherry picked from commit 7575ac07ac625c35269868511297385a69c96196)
(cherry picked from commit 7f300b1fc543d8f4cbe7329a78e31273678162a5)

3 years agoMA-18392-2 pass imx8 soc revision info to kernel
faqiang.zhu [Wed, 9 Dec 2020 13:56:27 +0000 (21:56 +0800)]
MA-18392-2 pass imx8 soc revision info to kernel

pass imx8 soc revision info to kernel so it can be used to judge
bootloader0 partition offset in postinstall command and update
the partition.

Change-Id: Ifc4d3d2abe8a694d7ec6f368c3e56f3d175982e5
Signed-off-by: faqiang.zhu <faqiang.zhu@nxp.com>
(cherry picked from commit cc51505010505ad39a12c07e7405bb992407d927)
(cherry picked from commit ca6530da25c826ff400b372333f46c3ad026db00)

3 years agoMA-18406 Fix panic when provision keys on boards without rpmb key
Ji Luo [Mon, 14 Dec 2020 06:47:04 +0000 (14:47 +0800)]
MA-18406 Fix panic when provision keys on boards without rpmb key

The keymaster client won't be initialized if the rpmb
key is not set, return early with error in such case
to avoid panic.

Test: provision attestation keys & certs on boards without
      rpmb key set.

Change-Id: I6f908aecafd15ab390629cb89b090c9ee817ba1e
Signed-off-by: Ji Luo <ji.luo@nxp.com>
(cherry picked from commit b999b03c3eb153a99b481e42315e048653247107)
(cherry picked from commit 8e2cacff502629d88d5dd49baae3e547728e7af7)

3 years agoMA-16954 set partition type to efi after flash gpt partition
faqiang.zhu [Tue, 14 Apr 2020 07:44:58 +0000 (15:44 +0800)]
MA-16954 set partition type to efi after flash gpt partition

If the target device have DOS partition, uboot will save the partition
type as dos partition at early stage when the driver bind the device.
After the gpt partition is flashed, uboot will try to reload the DOS
partition, instead of the the EFI partition.

In this commit, if the GPT partition is successfully flashed, set the
partition type to be PART_TYPE_EFI if necessary, so the EFI partitions
will be reloaded.

Change-Id: I6095cb56c73aecee24f76d169db89daba3783e29
Signed-off-by: faqiang.zhu <faqiang.zhu@nxp.com>
(cherry picked from commit 62becd667e5f3ebbefef796818eda78f4d0e167b)
(cherry picked from commit 358efa24b714738ce145fa60f0b4d194b68c4c49)

3 years agoMA-18325 Pad keyslot_package struct to one block size
Ji Luo [Thu, 26 Nov 2020 05:21:33 +0000 (13:21 +0800)]
MA-18325 Pad keyslot_package struct to one block size

blk_dwrite() will write data in blocks, padding the keyslot_package
struct to one block to avoid redundant data write.

Test: RPMB key set.

Change-Id: I326d7f4394d15e6e22b12c3abd6a5e2de18920cc
Signed-off-by: Ji Luo <ji.luo@nxp.com>
(cherry picked from commit 8a0deb19628d2752b516fbce00fc1b988f2e78b5)
(cherry picked from commit baaa810e604aa3afd8cf9832a5b29828d6ffc6f4)

3 years agoMA-18304 pass ramdisk address when boot up evk_7ulp
faqiang.zhu [Fri, 20 Nov 2020 05:07:13 +0000 (13:07 +0800)]
MA-18304 pass ramdisk address when boot up evk_7ulp

evk_7ulp images has normal ramdisk in boot.img and recovery ramdisk in
recovery.img.

Normal ramdisk in boot.img is used to boot up Android, ramdisk addr need
to be passed to kernel any way.

Recovery ramdisk in recovery.img is not used to boot up Android, there
is no need to pass "androidboot.force_normal_boot=1".

Change-Id: Id1e9c31035cbf65cd325c70a0aa9df05ea1d90b2
Signed-off-by: faqiang.zhu <faqiang.zhu@nxp.com>
(cherry picked from commit 3f4d826944f7f0db9251cf26f6f65014ca3f5e8a)
(cherry picked from commit 6ecfd9ed2af555f589c7cdfe32134ea1e6a41d80)

3 years agoMA-18214-1 Hard code the BT mac address for imx8mp
Ji Luo [Wed, 4 Nov 2020 12:29:01 +0000 (20:29 +0800)]
MA-18214-1 Hard code the BT mac address for imx8mp

imx8mp has serial number as all zeros, hard code the BT mac
address for such case instead of setting it by property.

Test: BT on imx8mp.

Change-Id: I99f5b49164e1fa40c7fc6ecb639c71fa89158852
Signed-off-by: Ji Luo <ji.luo@nxp.com>
(cherry picked from commit 501690cb93c4df30700c1bf40f0f2eaed2444503)
(cherry picked from commit 312109135045b450d57c3095a822db827a587be6)

3 years agoMA-18221 Fix build break for imx7ulp
Ji Luo [Thu, 5 Nov 2020 09:00:44 +0000 (17:00 +0800)]
MA-18221 Fix build break for imx7ulp

GCC for arm32 doesn't support division between signed
and unsigned integer. Clean up the code to use 'long'
for both arm32 and arm64 platforms.

Test: build on 7ulp and 8mm.

Change-Id: I21c23b1948994558237b27bfe7452e78e3d45172
Signed-off-by: Ji Luo <ji.luo@nxp.com>
(cherry picked from commit 2062183df063e0653e9e88a690764647702af7dd)
(cherry picked from commit 49aad2989b6256934b146c50af5cf26b7486d658)

3 years agoMA-18192 Only bump the rollback index when avb verify ok
Ji Luo [Fri, 30 Oct 2020 08:14:09 +0000 (16:14 +0800)]
MA-18192 Only bump the rollback index when avb verify ok

AVB verify should fail for GKI boot image but we should allow it
continue to boot in UNLOCKED state. In such case, we should not
update the stored rollback index.

This commit will update the rollback index only when the AVB
verify is OK to prevent rollback index check error.

Test: boots.

Signed-off-by: Ji Luo <ji.luo@nxp.com>
Change-Id: I82678d288edd4df6de40a1ca863ed36d3b3658a8
(cherry picked from commit ea48b544581d630bc031a7968a90b2fcf328424a)
(cherry picked from commit 8619089859b6c24f82a2f6fda9bd2c58c2e38851)

3 years agoMA-18166 Android: Fix mmc multi blk load issue
Ji Luo [Wed, 28 Oct 2020 01:12:59 +0000 (09:12 +0800)]
MA-18166 Android: Fix mmc multi blk load issue

The 'offset' can be negative number passed from fsl_read_from_partition_multi(),
don't covert 'blksz' to 'uint64_t' as it will cause overflow when the 'offset'
is negative number.

Test: mmc blk read with 'offset < 0'.

Signed-off-by: Ji Luo <ji.luo@nxp.com>
Change-Id: Id1ce8e0c748dd280d70c1722cc7d17cc9646a4bb
(cherry picked from commit 077b448679b9ad2891495c7344ba99a6c10a59fb)
(cherry picked from commit f927599650ba1fbdbe8f4887b970a4f003b0d277)

3 years agoMA-18087-3 Add snapshot-update command
Ji Luo [Wed, 21 Oct 2020 04:36:03 +0000 (12:36 +0800)]
MA-18087-3 Add snapshot-update command

Add support for 'fastboot snapshot-update cancel', it cancels
the snapshot update process so erase/update partitions can
proceed.

Test: run 'fastboot snapshot-update cancel'.

Signed-off-by: Ji Luo <ji.luo@nxp.com>
Change-Id: Ic1dfaf09a27fecf6e14b7149aeb5e0a9a1d220c9
(cherry picked from commit 3074fbf88b1b654026608574b94fdd58426ae493)
(cherry picked from commit 18c6b24524b13b3c6c5c1d7db2043159a784fccc)

3 years agoMA-18087-2 Support snapshot-update-status variable
Ji Luo [Wed, 21 Oct 2020 02:52:21 +0000 (10:52 +0800)]
MA-18087-2 Support snapshot-update-status variable

Add support for 'fastboot getvar snapshot-update-status', it
returns the snapshot update states.

Test: run 'fastboot getvar snapshot-update-status'

Signed-off-by: Ji Luo <ji.luo@nxp.com>
Change-Id: Ifd46410994b11c327373a35eb86d121f321e39ae
(cherry picked from commit 28c6cbec7fe9e613620e5d80b7b43d1ca6bdd9c6)
(cherry picked from commit dece52d012e8c6e06f96f1ad34b47f5da6514d2e)

3 years agoMA-18087-1 Enhance virtual A/B slot check
Ji Luo [Wed, 21 Oct 2020 02:11:51 +0000 (10:11 +0800)]
MA-18087-1 Enhance virtual A/B slot check

Set the initial 'source_slot' in 'misc_virtual_ab_message' as
the current slot. At the same time, add slot checks before
erase data if virtual A/B is enabled.

Test: virtual A/B update and erase.

Signed-off-by: Ji Luo <ji.luo@nxp.com>
Change-Id: I84896335a95d9188b85e114037b470b3f4e7a209
(cherry picked from commit a522c2245c3e58adbbcb99c43e0917ce315cc1aa)
(cherry picked from commit 40a1e64ded230e1c2b3d76cccaea1f910ed0d6d6)

3 years agoMA-17519-4 boot up car2 with recovery ramdisk
faqiang.zhu [Wed, 21 Oct 2020 08:14:38 +0000 (16:14 +0800)]
MA-17519-4 boot up car2 with recovery ramdisk

To use dynamic partition feature in Android, recovery ramdisk is used to
mount the logical partitions and boot up Android.

Define a configuration item "CONFIG_ANDROID_DYNAMIC_PARTITION", use it
to control the bootargs and whether ramdisk should be loaded instead of
"CONFIG_ANDROID_AUTO" because now Android auto also use dynamic
partition feature now.

Move the definition of function "fastboot_setup_system_boot_args" under
the macro "CONFIG_CMD_BOOTA" to avoid build warnings.

Signed-off-by: faqiang.zhu <faqiang.zhu@nxp.com>
Change-Id: I0b1cfe6120fc939e7f1a1eb600d8176c81edf129
(cherry picked from commit 972ccff86796e2b7f9a444d09550cd5e393cd93e)
(cherry picked from commit 7154723e8a43f06f27bab3692024f3579f4b78e4)

3 years agoMA-18051 avoid overflow of in partition size calculation
faqiang.zhu [Wed, 14 Oct 2020 11:50:10 +0000 (19:50 +0800)]
MA-18051 avoid overflow of in partition size calculation

If a partition is not less than 4GB, to avoid the overflow issue when
calculate the partition size in bytes, change the value of partition
length in block size to the type of "unsigned long".

Change-Id: Ifa4ddb5169fcb02822ef152a6c70d01b5d3cf50d
Signed-off-by: faqiang.zhu <faqiang.zhu@nxp.com>
(cherry picked from commit c4e9be08d90ca59531542c97bd8fe16eab2ab099)
(cherry picked from commit 6c1471828256f5c95d3043099fcc00906726fdd3)

3 years agoMA-17910-1 Add config to guard avb public key load
Ji Luo [Mon, 21 Sep 2020 08:10:32 +0000 (16:10 +0800)]
MA-17910-1 Add config to guard avb public key load

Add config "CONFIG_LOAD_KEY_FROM_RPMB" to decide loading the
avb public key from RPMB storage or building it statically.

Test: AVB verify.

Signed-off-by: Ji Luo <ji.luo@nxp.com>
Change-Id: I1ca09c28bbfa18dd00aa28405389b382e09fe07e
(cherry picked from commit 5a7973e8f42e54b3cd8ce15624478dcbe19c49fd)
(cherry picked from commit 29f15078f00ed862abf6ca9592e68815046a38f3)

3 years agoMA-16457-4 fix issue of evk_7ulp using boot-debug.img
faqiang.zhu [Thu, 10 Sep 2020 11:16:44 +0000 (19:16 +0800)]
MA-16457-4 fix issue of evk_7ulp using boot-debug.img

evk_7ulp has recovery partition, the ramdisk in boot.img and
boot-debug.img is normal boot ramdisk not recovery ramdisk, in this
condition, there is no need to pass the bootargs to indicate it's to
boot up to Android or recovery.

Change-Id: Ic3e04aaf361b78e36c95d19f87dc266bf9b6c7d6
Signed-off-by: faqiang.zhu <faqiang.zhu@nxp.com>
(cherry picked from commit 6e0dec768a2d16a6ff2de31fbd319d045ac83c48)
(cherry picked from commit 59abb5e52b70df34d415031d4b89606c7543b999)

3 years agoMA-17851 boota: fix dereference before null check
Luo Ji [Tue, 8 Sep 2020 08:21:50 +0000 (16:21 +0800)]
MA-17851 boota: fix dereference before null check

This fixes coverity issue 3776938 and 8666209. Check pointer
before reference.

Test: Coverity scan.

Change-Id: I2b08b7a63226a5a4246eec26db7dda363344369e
Signed-off-by: Luo Ji <ji.luo@nxp.com>
(cherry picked from commit 3dea9fb836800f93c292999de6f6c1271d947aca)
(cherry picked from commit 6482a7a30f520060ddcc7b5330da5fc080d39e0c)

3 years agoMA-17142-3 erase metadata partition as user generated data
faqiang.zhu [Tue, 1 Sep 2020 06:50:59 +0000 (14:50 +0800)]
MA-17142-3 erase metadata partition as user generated data

metadata partition contains metadata of OTA update, remount, etc.
erase metadata partition as user generated data.

Change-Id: I2b08b7a64226a5a4246eec26db7dda363344369e
Signed-off-by: faqiang.zhu <faqiang.zhu@nxp.com>
(cherry picked from commit 4d9b8d694edc6482ec1aa6161ed8d1928130aee8)
(cherry picked from commit eb9e9f6a2f4d81ca5323fb0833e083c00f258650)

3 years agoMA-17554 Decide if GKI is enabled at runtime
Ji Luo [Tue, 28 Jul 2020 12:05:55 +0000 (20:05 +0800)]
MA-17554 Decide if GKI is enabled at runtime

As we have to support GKI and non-GKI at the same time, it will be
a must to decide if the GKI is enabled or not at run-time.

This commit reads the 'header_version' in boot header to decide if
GKI is enabled.

This commit also make some cleanup to make the code more readable and
easier to maintain.

Test: boots on Android and Anroid Auto.

Signed-off-by: Ji Luo <ji.luo@nxp.com>
Change-Id: I6068bbaa60f5d76049b6ff0a892b5b8ca2c2f86b
(cherry picked from commit b39f7532ab524408550b8b2827bb42ab38159033)
(cherry picked from commit 93ea85fcd20d616bc137a76a371ee6799c5ca07a)

3 years agoMA-17541-1 Support virtual A/B update
Ji Luo [Wed, 22 Jul 2020 11:03:32 +0000 (19:03 +0800)]
MA-17541-1 Support virtual A/B update

A 'misc_virtual_ab_message' struct will be stored at the 32kB offset
in misc partition, which will be used to record the virtual A/B update
status.

Bootloader should take care of this status, some operations must be
restricted. This commit will:
    1. Restrict erase/flash operations to "misc", "userdata" or
       "metadata" partitions if the merge status are "SNAPSHOTTED" or
       "MERGING".
    2. Restrict slot switch if the merge status is "MERGING".
    3. Output a warning in slot switch if the merge status is "SNAPSHOTTED".
    4. Set the merge status as "CANCELLED" if image flash happen.

Test: 1. fastboot erase/flash "userdata", "misc", "metadata" after virtual
        A/B update
      2. slot switch after virtual A/B update

Signed-off-by: Ji Luo <ji.luo@nxp.com>
Change-Id: I33f0041c5e76913d3970d943cad52353e0ac5f2d
(cherry picked from commit 30df087bfc5e31413473f85dfefaa7176bc394a8)
(cherry picked from commit 7fd03bcc8f1fc094362c11d71cf740ac9b5724c1)

3 years agoMA-17142-2 set metadata partition type as ext4
faqiang.zhu [Wed, 15 Jul 2020 04:57:50 +0000 (12:57 +0800)]
MA-17142-2 set metadata partition type as ext4

metadata partition is used in some functions like apex, userdata
checkpoint to store files, mark it as ext4 partition so it can be
formated with "fastboot format metadata" command and be mounted when
executing first stage init.

Change-Id: Id22b39d71e6823d3a284f3df00959a6d748ab9c7
Signed-off-by: faqiang.zhu <faqiang.zhu@nxp.com>
(cherry picked from commit 4f42888967a0354a0dd222ad7b01761450a1713b)
(cherry picked from commit a69157bee180974eb4ee89b0847473bd6538d2a0)

3 years agoMA-15487 Pass correct verified boot/key hash to keymaster
Ji Luo [Thu, 19 Sep 2019 10:40:06 +0000 (18:40 +0800)]
MA-15487 Pass correct verified boot/key hash to keymaster

Keymaster 4 HAL will require correct verified boot hash and
verified key hash for keymaster boot parameters. Here the
verified boot hash should be the sha256 hash of the vbmeta
image, and the verified key hash should be the sha256 hash
of vbmeta public key.

In unlocked state, the verified key hash should be passed
with 32-byte '\0' string.

Test: VtsHalKeymasterV4_0Target#AttestationTest.EcAttestation
      VtsHalKeymasterV4_0Target#AttestationTest.RsaAttestation

Change-Id: I869f6625123200ec265b854a3a378dd841c947a7
Signed-off-by: Ji Luo <ji.luo@nxp.com>
(cherry picked from commit 5255073374df88177805682dc6901e0fd63b1576)
(cherry picked from commit fa0fcc654fc825073d9ecd0cb1f8c014eac6a4a1)

3 years agoMA-17338-1 Enable boot control v1.1
Ji Luo [Tue, 9 Jun 2020 06:59:45 +0000 (14:59 +0800)]
MA-17338-1 Enable boot control v1.1

The old boot control logic and misc data struct is based on the
'external/avb/libavb_ab' library which is already marked as
deprecated and won't be maintained by google anymore:

  commit 37f5946d0e1159273eff61dd8041377fedbf55a9
  Author: David Zeuthen <zeuthen@google.com>
  Date:   Wed Sep 20 15:02:32 2017 -0400

    Deprecate libavb_ab and bootctrl.avb code.

    This code was already marked as experimental in anticipation of being
    removed in the future. Officially deprecate it and set Jun 1 2018 as
    the date it will be removed. This should give users of the code ample
    time to fork/migrate.

    To keep using the code AVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED
    must be defined.

    The reason for deprecating this code is twofold:

     - Its policy was optimized for devices without a display with
       e.g. automatic fallback to the other slot if a slot fails to
       boot. Since most A/B stacks in Android devices don't work this
       way this code is confusing.

     - There are no known active users, no good test coverage for the
       bootctrl.avb code, and no plans to use it.

    When the code is removed we'll provide an easy transition path by
    keeping (but renaming) the |ab_ops| member in AvbOps.

    Change-Id: Id5e090a2048076d36ccca2e1c4cb55e226b8b43d

Google has provided a new boot control v1.1 implementation under
'hardware/interfaces/boot/1.1/default' which uses a new misc data struct defined
in the 'include/android_bootloader_message.h'. This commit adds a new boot control
implementation in bootloader, which combines the new misc data struct and inherit
some flow in 'libavb_ab', the old 'libavb_ab' library will be removed.

Test: boot/slot switch/retry count test on single&dual bootloader.

Signed-off-by: Ji Luo <ji.luo@nxp.com>
Change-Id: I0fa1ee8562c83afec549c8f6aad7a26a2214f626
(cherry picked from commit 29aafaf065d1688201d014213052863ec9d18e9c)
(cherry picked from commit f5cda163c1559480a43e75869747a50787fd0ee1)

3 years agoMA-17368 Trigger board reset for fastboot reboot
Ji Luo [Fri, 12 Jun 2020 09:15:53 +0000 (17:15 +0800)]
MA-17368 Trigger board reset for fastboot reboot

Trigger system board reset for imx8q when reboot is required
in fastboot commands, this will help fix the hang issue when
switch normal Android and Android Auto images.

Test: fastboot reboot.

Change-Id: Ibfdb34e88e0393294af25c1ef5aceeadb8c02f74
Signed-off-by: Ji Luo <ji.luo@nxp.com>
(cherry picked from commit 2cb43a55955ae400acce66b3d4ce870b0e423c81)
(cherry picked from commit fa8c79a3b4b4bc8fe0a399f9f8a415c94c2e280c)

3 years agoMA-17387 Remove the rpmb handle flag in hwcrypto
Ji Luo [Thu, 18 Jun 2020 02:01:19 +0000 (10:01 +0800)]
MA-17387 Remove the rpmb handle flag in hwcrypto

The handle_rpmb flag should indicate whether the call will invoke
RPMB callbacks, which has been removed by below commit:
  commit dfd911856d31fd91eb4e3c1edb1d691723c6edaf
  Author: Roberto Pereira <rpere@google.com>
  Date:   Thu Nov 2 15:09:20 2017 -0700

      ql-tipc: trusty_ipc: Change ipc polling to be per device

      This allows ipc devices to provide service callbacks (e.g. rpmb) transparently
      to the application instead of needing to have prior knowledge of the expected
      request and having to poll the individual services' channels separately.

      Change-Id: I3257ae5e429f4a0c279f070d750b56c5600c38d5

Sync the change for hwcrypto, it will help remove some build warnings.

Test: builds and boots with trusty.

Signed-off-by: Ji Luo <ji.luo@nxp.com>
Change-Id: I696b13d9d509d5983c934df5ee6fb36e46f4c884
(cherry picked from commit 8812d39018c23cc26afa43a97acf27427979c90c)
(cherry picked from commit e79c079bd3f10d4fd80d33edeae184d53f80f706)

3 years agoMA-17390 Clean build warnings for android
Ji Luo [Thu, 18 Jun 2020 02:52:37 +0000 (10:52 +0800)]
MA-17390 Clean build warnings for android

This commit eliminate the annoying build warning logs.

Test: builds with buildman.

Signed-off-by: Ji Luo <ji.luo@nxp.com>
Change-Id: Ia335dafe3f4c0eab08e011215b9de5d2974b8d0c
(cherry picked from commit 85e0d429d19b8f9a62369a5f20e088644c488b1e)
(cherry picked from commit 52471735760a8d3a410f88c144910a07a161028d)

3 years agoMA-17382 spl: Add weak function at the end of image load
Ji Luo [Wed, 17 Jun 2020 07:44:05 +0000 (15:44 +0800)]
MA-17382 spl: Add weak function at the end of image load

Add a weak function after the image load in case we have extra
steps to complete, like check the rpmb keyblob for trusty enabled
platform.

Test: Boots with trusty.

Signed-off-by: Ji Luo <ji.luo@nxp.com>
Change-Id: Ie8181fcb32d1640e39fdcc3cebb2dbf50cbfdbab
(cherry picked from commit b16fc52cf9a9ea4d63bced50b949d0bc2328ddea)
(cherry picked from commit 3e40454cdac6b7b63cdff36ab48f86e4b98502be)

3 years agoMA-17353-1 Add system board reset command for imx8q devices
Ji Luo [Wed, 10 Jun 2020 10:29:54 +0000 (18:29 +0800)]
MA-17353-1 Add system board reset command for imx8q devices

Default 'reset' command in bootloader will only trigger partition reboot
for A core, which will not reload everything (like SPL, SCFW, M4, etc.).
Sometimes, we want to trigger a board reboot without pressing the reset
button, it can be very helpful in some cases like remote debugging...

This commit adds command 'reboot' to trigger system board reboot via the
psci interface provided by ATF, it's enabled on i.MX 8 Quad platforms only.

Test: system board reboot on imx8qm/imx8qxp.

Change-Id: I27f2291806b6959d46fa6f55fe186041d141d2f4
Signed-off-by: Ji Luo <ji.luo@nxp.com>
(cherry picked from commit f8a127354ba4f77ba5b1af87f692133bb704cfe0)
(cherry picked from commit 646b99c6bcba96c97d3517a2c21d54908a8c4ed5)

3 years agoMA-17261 fix start kernel hang issue
zhang sanshan [Thu, 28 May 2020 08:13:53 +0000 (16:13 +0800)]
MA-17261 fix start kernel hang issue

overwrite the console to hvc0 in xen, otherwise it will hang at starting kernel.
specific androidboot.android_dt_dir which define dts, and let the system mount in first stage. It may change in xen.
disable selinux temporarily

Change-Id: I90d4c374f0d0478d6386ae31cddb3f7ef510ae93
Signed-off-by: zhang sanshan <pete.zhang@nxp.com>
(cherry picked from commit: e7ddf17f0e95867d0e59ef5e7aef1e3b5c4e7a3b)

3 years agoMA-17260 Add vendor boot and boot header v3 support
Ji Luo [Thu, 28 May 2020 03:06:37 +0000 (11:06 +0800)]
MA-17260 Add vendor boot and boot header v3 support

GKI(Generic Kernel Image) would require the boot header v3 and vendor
boot support, all device specific info are moved to vendor_boot partition
,the boot header v3 will not be compatible with earlier version(0/1/2).

This commit adds support for boot header v3 and vendor boot, it would
concatenate the generic ramdisk and vendor ramdisk to generate the
final ramdisk passed to kernel.

Test: boots with or without boot header v3 and vendor boot support.

Signed-off-by: Ji Luo <ji.luo@nxp.com>
Change-Id: Ib3298ae46bfc728aa4a34909d372eff6cc86ca70
(cherry picked from commit c3854f270a19e7d57b996e6074d692ab9bc88c32)

3 years agoMA-17226 Invalidate the dcache after DMA operation
Ji Luo [Fri, 22 May 2020 02:54:30 +0000 (10:54 +0800)]
MA-17226 Invalidate the dcache after DMA operation

The main memory contents can spontaneously come to the cache due to
the speculative memory access by the CPU, this may cause coherency
problem if this happens during the DMA operaion is on-going.

Invalidate the dcache range after DMA opeartion but before the main
memory read to avoid coherency problem.

Test: reboot test.

Change-Id: I93824deab9285b5478669e0a311e0b338bf02f8a
Signed-off-by: Ji Luo <ji.luo@nxp.com>
(cherry picked from commit 4cd1d087111dd3b4ddaad33ef4862f7ac1ab1b34)

3 years agoMA-17046-3 Add implementation to get ONOFF button status
Ji Luo [Tue, 28 Apr 2020 02:52:56 +0000 (10:52 +0800)]
MA-17046-3 Add implementation to get ONOFF button status

Add board level implementation to get the ON-OFF button
status for imx8q/imx8m.

Test: Get ON-OFF button status on imx7ulp/imx8m/imx8q.

Change-Id: I8e4ea61ec1c52ab7cfa20b5498756a25f3cd2f8d
Signed-off-by: Ji Luo <ji.luo@nxp.com>
(cherry picked from commit 44c6edfbd2607f1458220031467fc7de20dc46be)

3 years agoMA-17046-2 imx8q: porting scu api to get onoff button status
Ji Luo [Tue, 28 Apr 2020 02:05:33 +0000 (10:05 +0800)]
MA-17046-2 imx8q: porting scu api to get onoff button status

Porting the scu api 'sc_misc_get_button_status()' to get the
ON-OFF button status.

Test: Get the ON-OFF button status.

Change-Id: I8e06ef4dc170750fe2dfbeeba7850b5e0dcfc774
Signed-off-by: Ji Luo <ji.luo@nxp.com>
(cherry picked from commit 130747618d813ea64611ed111e5d80487aa154b6)

3 years agoMA-17144 Only do security check for rpmb key flashed boards
Ji Luo [Mon, 18 May 2020 03:02:13 +0000 (11:02 +0800)]
MA-17144 Only do security check for rpmb key flashed boards

Only check the bootloader rollback index and trusty keyslot package
for rpmb key flashed boards.

Test: boots on boards without rpmb key.

Change-Id: I130e4d906c0f08d602eac820ec5612214e01ff55
Signed-off-by: Ji Luo <ji.luo@nxp.com>
(cherry pick from commit bb0c880bb2cd5d9414b4c167eac546682a5d5ccc)

3 years agoMA-13050-5 [Android] support evs on mek-8qxp board
Ji Luo [Thu, 14 May 2020 08:34:19 +0000 (16:34 +0800)]
MA-13050-5 [Android] support evs on mek-8qxp board

camera sometime can't been open once run M4 image.
ISI-CH0 probe funtion is not called when meet issue.

The root cause is:
  M4 image set assign resource SC_R_ISI_CH0 into m4 partition
  when open camera in m4 side.
  Uboot will call update_fdt_with_owned_resources to check
  the pd in current dts node. it will call sc_rm_is_resource_owned to
  check the pd whether in other partition, if yes, it will delete
  the dts node. uboot delete isi_0 node whose pd is SC_R_ISI_CH0.

add CONFIG_SKIP_RESOURCE_CHECKING to skip checking resource when load
dtb.

Change-Id: Iaf9a5eda07074c45c15c43f23cb6ad6b5a77de47
Signed-off-by: zhang sanshan <sanshan.zhang@nxp.com>
(cherry picked from commit: bd0682f5b3208525363690d446bc86da15a43120)

3 years agoMA-16940 remove logically dead code
faqiang.zhu [Thu, 16 Apr 2020 12:46:24 +0000 (20:46 +0800)]
MA-16940 remove logically dead code

boot_buf was used to point to the memory allocated in do_boota function
to save boot partition data. now boot partition is loaded by AVB, this
boot_buf should be removed.

Change-Id: I614c412b5f7ed980d29106b364a8193c56db13dc
Signed-off-by: faqiang.zhu <faqiang.zhu@nxp.com>
(cherry picked from commit 2a27f021798e31a8bab37804b053d2b9ebaea928)
(cherry picked from commit 4ae3275bb7065dfcf99dcdf559eaf99d044c51e0)

3 years agoMA-16877 Skip kernel hab authentication for android
Ji Luo [Wed, 8 Apr 2020 04:34:55 +0000 (12:34 +0800)]
MA-16877 Skip kernel hab authentication for android

Android use AVB to verify the kernel, hab authentication is
not necessary for boot image.

For imx8m, don't authenticate the kernel image when AVB
(CONFIG_AVB_SUPPORT) is enabled. For imx8q, as android uses
different 'CONFIG_EXTRA_ENV_SETTINGS' and 'CONFIG_BOOTCOMMAND'
with linux bsp, so it won't try to do kernel hab authentication.
by default.

Test: boot imx8mp with "CONFIG_IMX_HAB" and imx8qxp with
      'CONFIG_AHAB_BOOT'.

Change-Id: I1b2087ce7d8f9795422a053b6b68a694c86f0b3d
Signed-off-by: Ji Luo <ji.luo@nxp.com>
(cherry picked from commit f907e4ac090e960ba5110b8039cccc4296841595)
(cherry picked from commit f9f6ae742696f51326ec7da5b0c74a7fca21f774)

3 years agoMA-16594-1 Set dtb load offset in bootloader
Ji Luo [Thu, 5 Mar 2020 07:41:06 +0000 (15:41 +0800)]
MA-16594-1 Set dtb load offset in bootloader

This commit sets the dtb load address in bootloader, the
dtb load address would be 'kernel_addr + FDT_OFFSET_TO_KERNEL'.

For imx8m, this commit will reserve 64MB for kernel, 2MB for fdt
and 16MB for ramdisk. For imx8q, this commit will reserve 60MB for
kernel, 1.5MB for fdt and 16MB for ramdisk.

This commit is a merge of below commits:
  f581f72be1 MA-16594-1 Set dtb load offset in bootloader
  207f813b2d MA-16668-2 Fix kernel hang after enabling debug configs
  42cdd5ef6d MA-16939-1 correct reserved space for kernel image for non-imx8 SoC

Change-Id: Ie597731992107ec2343e5ab6db0cab0e123f009c
Signed-off-by: Ji Luo <ji.luo@nxp.com>
3 years agoMA-16457-2 support reboot-fastboot command in u-boot
Haoran.Wang [Wed, 26 Feb 2020 00:45:13 +0000 (08:45 +0800)]
MA-16457-2 support reboot-fastboot command in u-boot

Android implement the userspace fastboot in Android Recovery.
Follow Google's spec, added below 2 fastboot command support:
  * fastboot getvar is-userspace
  * fastboot reboot fastboot

TEST: fastboot commands.

Change-Id: Ib6047413be0a45b3c00626cdb8594809eb8a2b6b
Signed-off-by: Haoran.Wang <elven.wang@nxp.com>
(cherry picked from commit 314bded076dfc3e544cc7094ce3f6c4c330be4dd)
(cherry picked from commit 89e63a8f1b20dfe5633f4d854aeb6d712b3ccaa4)

3 years agoMA-16457-1 avoid to try to access system partition
faqiang.zhu [Tue, 25 Feb 2020 02:18:24 +0000 (10:18 +0800)]
MA-16457-1 avoid to try to access system partition

To enable dynamic partition feature, system partition will be a logic
parition in "super" partition, uboot can't access system partition
anymore.

In i.MX Android use case, only vbmeta partition is used to verify other
imags. boot and system are not used. so there is no need to access
system partition to get avb device info, remove system partition from
avb lib for standard android.

Now, standard Android will boot with ramdisk in boot.img, there is no
need to provide root info to kernel for standard Android. so only
Android Auto will provide this info.

Change-Id: I99a43eb8f7aa1dc635e3937c93266f881c9b3655
Signed-off-by: faqiang.zhu <faqiang.zhu@nxp.com>
(cherry picked from commit 3a2418a1cc097cd956347fc12b0b4e0566652bfd)
(cherry picked from commit 133644540d6e5c89cc6e8109b2bf3ac6a9b897d1)

3 years agoMA-16418 [Android] Support imx8mp spl boot from mmc
Ji Luo [Tue, 18 Feb 2020 07:32:39 +0000 (15:32 +0800)]
MA-16418 [Android] Support imx8mp spl boot from mmc

Add mmc board level implementation for imx8mp, so we can support
boot from mmc besides ROMAPI.

Test: eMMC/SD boot.

Change-Id: Ie3c28e5622dd819583e2146557ac75f89dbe19ef
Signed-off-by: Ji Luo <ji.luo@nxp.com>
(cherry picked from commit 05b64483e5f46f82beb7f542d0148498fc21334f)

3 years agoMA-16203 Load boot/dtbo image to fixed memory
Ji Luo [Fri, 6 Dec 2019 09:34:46 +0000 (17:34 +0800)]
MA-16203 Load boot/dtbo image to fixed memory

When the device is locked, avb will try to verify one slot
first, it will continue to verify another if the first slot
returns failure. Function load_full_partition() will alloc memory
to load boot/dtbo images from heap (which is a big and continuous
memory region), this memory will be freed if the first slot returns
verify failure. but because part of the continous memory region
will be used in following verify process, even total available memory
is enough, u-boot can't find a continous memory region to load the
boot/dtbo image for another slot and will return error "Failed to
allocate memory".

Instead, this commit use fixed memory region start from 96MB offset of
CONFIG_FASTBOOT_BUF_ADDR to load the boot/dtbo images.

Test: slot verify and A/B slot switch.

Change-Id: Ifc83bed5a6be37196c0fd109d942eaf9b07b6a74
Signed-off-by: Ji Luo <ji.luo@nxp.com>
(cherry picked from commit d13752e831957fb84c71f8ca24fd1979d3605cde)
(cherry picked from commit 11f79ca63338a00960e90763d4764956907fdcb5)

3 years agoMA-16191 eliminate warning info about "is-logical" when flash images
faqiang.zhu [Thu, 26 Dec 2019 05:35:28 +0000 (13:35 +0800)]
MA-16191 eliminate warning info about "is-logical" when flash images

"is-logical" is used to check whether the partition to be flashed is
dynamic partition, if it is, a partition resize command will be issued
by host fastboot. this can be well processed in fastbootd.

process this "is-logical" in uboot, now there is no logical partition,
for every partition found in u-boot, returns "no".

Signed-off-by: faqiang.zhu <faqiang.zhu@nxp.com>
Change-Id: I4d93a0c7b32fed9fe5a5ac846bc4e97bfbe69e67
(cherry picked from commit 7b27a2290aec78b49ce7c2aed497db858f436eb4)
(cherry picked from commit cfc8e3034c5ce4f6f777bc7faff3dbb880de43fe)

3 years agoMA-15860 Get and switch the target dev in fastboot erase
Ji Luo [Wed, 20 Nov 2019 05:53:54 +0000 (13:53 +0800)]
MA-15860 Get and switch the target dev in fastboot erase

Target mmc dev is not properly switched when the device enters
fastboot mode via uuu "-i" parameter, which causes "erase"
operation doesn't work.

Get and switch the target mmc dev every time before erase operations
happen.

Test: "fastboot erase boot_a" in uuu fastboot mode.

Change-Id: I4822d2b4ecfd2d874dfbe7474d6824b8fc3a7903
Signed-off-by: Ji Luo <ji.luo@nxp.com>
(cherry picked from commit 46161b62c341139dcdbb13e00634ae8ae903c5da)
(cherry picked from commit b66d13c7ecd1c1e44dd9edb6c0d5566b4f738bbe)

3 years agoMA-15813 [Android] imx8q: Enable reset in spl stage
Ji Luo [Mon, 4 Nov 2019 14:32:45 +0000 (22:32 +0800)]
MA-15813 [Android] imx8q: Enable reset in spl stage

To avoid both A/B slots are marked as unbootable because
of some random failures, we will need to reset at spl stage
when current slot load/verify fail but already with flag
"successful_boot" set.

imx8q can't be reset via the psci driver because the atf
is not avaiable at spl stage, porting the sc_pm_reboot()
scu api so we can do reset at spl stage for imx8qm/imx8qxp
mek boards.

Test: reset on imx8qm_mek and imx8qxp_mek.

Change-Id: Ifa0bdea9393e413942a8a0188a4f937fa0aa9ab8
Signed-off-by: Ji Luo <ji.luo@nxp.com>
(cherry picked from a5c5748101c383bc3afb424a3ef2689ab2664846)
(cherry picked from c9f8d7c19a7fc20c99e061beabbb094b6bd50f52)

3 years agoMA-15814 Check 'successful_boot' flag before marking unbootable
Ji Luo [Mon, 11 May 2020 03:47:46 +0000 (11:47 +0800)]
MA-15814 Check 'successful_boot' flag before marking unbootable

Slot will be marked as "unbootable" state if error happens during
image load/verify process, this may cause the board never boot up
if some random failures happen (like eMMC/DRAM access error at some
critical temperature).

Check the "successful_boot" flag before marking the slot as "unbootable",
this will help ease the "no bootable slot" issue.

Test: slot switch on imx8qm_mek.

Signed-off-by: Ji Luo <ji.luo@nxp.com>
(cherry picked from commit 6db8ebe2224ab6656e8e798288bd1b3c0472c0c0)
(cherry picked from commit b64a9dcd87da333265c2ac4da2be8a735186b77e)

Change-Id: Ib060b11cc6687a3bacd09cecda7dd925beba6316

3 years agoMA-16966 Add hdmi rx/tx fw loading function
Ji Luo [Mon, 11 May 2020 02:09:52 +0000 (10:09 +0800)]
MA-16966 Add hdmi rx/tx fw loading function

Add implementation to load hdmi rx/tx firmwares, use different config to
guide the function.

Change-Id: Ibb43c2301b5f6cdc8b5103bd04cc30baefac9b9f
Signed-off-by: Ji Luo <ji.luo@nxp.com>
(cherry picked from commit 942bf95ae42750a1f8b8092040ebb3ca144777fd)

3 years agoMA-15715-1 Refine trusty logs
Ji Luo [Thu, 24 Oct 2019 06:06:41 +0000 (14:06 +0800)]
MA-15715-1 Refine trusty logs

Refine trusty logs output to make it more
simple.

Test: boots.

Change-Id: Id94fc245206c5f78e0dbcb0baf5db6475c9f744d
Signed-off-by: Ji Luo <ji.luo@nxp.com>
(cherry picked from commit a50b4fca22111fe7b85b5584ff317db55d664c50)
(cherry picked from commit c17f0cb30c23ed6dab7312cec88707cb355e91a3)

3 years agoMA-15339-1 load ramdisk in boot image to do first stage mount
faqiang.zhu [Sun, 29 Sep 2019 01:56:31 +0000 (09:56 +0800)]
MA-15339-1 load ramdisk in boot image to do first stage mount

With Android10 code, to build GSI image for devices launching with
Android10, the target should be "aosp_$arch-user". Google releases GSI
images is so built in user mode.

To do CTS-on-GSI test, a debug ramdisk containing .prop file to enable
adb root permission and GSI keys to verify the GSI image is needed, this
ramdisk is in boot image. so ramdisk in boot image need to be loaded by
uboot even in non-recovery mode.

To save boot time, only standard Android use ramdisk to boot up Android,
Android Auto keeps the original way: kernel be responsible for verify
and mount system partition. Let the customers to decide whether to use
recovery ramdisk to boot the system. and under this condition, user-debug
Android Auto GSI image need to be used for VTS-on-GSI test.

when use ramdisk to bootup Android, info provided by "dm=" bootarg is
not used by kernel to setup dm-verity, so it is removed from the
bootargs. The 4.19 kernel used together with this uboot does not handle
"skip_initramfs", so it's also removed.

Change-Id: Ia8b8fa8b85a44acda2670b46504038a009ce01a8
Signed-off-by: faqiang.zhu <faqiang.zhu@nxp.com>
(cherry picked from commit e7d3c9ee1a713434d2948928ff0c4daea09ce3dc)
(cherry picked from commit 8f191d088797e9fbea49f482d0aa517f989b7821)

3 years agoMA-15575-3 Add support for oemlock 1.0 hal
Ji Luo [Tue, 8 Oct 2019 13:22:24 +0000 (21:22 +0800)]
MA-15575-3 Add support for oemlock 1.0 hal

Add commands to read oem device unlock state from
trusty avb app. Use the oem device unlock state to
determine if the device can be unlocked instead of
the state in persistdata part.

Test: Read oem device unlock state from avb app.

Change-Id: Ifccaa788ba0f681c2b3a47151c8474e8da5a2559
Signed-off-by: Ji Luo <ji.luo@nxp.com>
(cherry picked from commit c6eaf8e32987f120c0c5441ea39aa0f39a65b50d)
(cherry picked from commit 8b58afda1cd1f91048504b48b95260e930a37326)

3 years agoMA-15360 Verify vbmeta public key for non-trusty devices
Ji Luo [Tue, 27 Aug 2019 07:41:57 +0000 (15:41 +0800)]
MA-15360 Verify vbmeta public key for non-trusty devices

Don't skip vbmeta public key verify for non-trusty
platforms.

Test: boot on imx8mm.

Change-Id: I4712e5dd6e5c8848468e9d85c6b38eb5fb11377f
Signed-off-by: Ji Luo <ji.luo@nxp.com>
(cherry picked from commit 9b8264c89ccb3e9179a438e428ad79d72c7efe9b)
(cherry picked from commit 75d9dfb2474d03bd83a5b4d3f03d0a5cea6ea25d)

3 years agoMA-15321-3 Support secure unlock feature
Ji Luo [Thu, 15 Aug 2019 12:53:53 +0000 (20:53 +0800)]
MA-15321-3 Support secure unlock feature

Decrypt and verify the secure credential in keymaster TA, unlock
operation can only be allowed after secure credential verify pass.

Since the mppubk can only be generated on hab closed imx8q, so secure
unlock feature can only supported when hab is closed.

Test: secure unlock credential verify on hab closed imx8mm_evk.

Change-Id: I1ab5e24df28d1e75ff853de3adf29f34da1d0a71
Signed-off-by: Ji Luo <ji.luo@nxp.com>
(cherry picked from commit 631149fc0fc8ce035311949db643c2708e41435a)
(cherry picked from commit 063d358ab4bbfea998e0c975f31724757243545a)

3 years agoMA-15321-2 Add command to get serial number
Ji Luo [Thu, 15 Aug 2019 03:17:00 +0000 (11:17 +0800)]
MA-15321-2 Add command to get serial number

Add commands to support extract serial number from device.
Commands:
    $ fastboot oem get-serial-number
    $ fastboot get_staged <path-to-serial-number>

Test: serial number upload on imx8mm.

Change-Id: I5c905ab797d4fd28d76c8403914f191eaf2ef687
Signed-off-by: Ji Luo <ji.luo@nxp.com>
(cherry picked from commit 250ef119c1dc02908046113893df5eeb9ef40605)

3 years agoMA-15158 Set spl recovery mode for dual bootloader
Ji Luo [Thu, 18 Jul 2019 05:56:45 +0000 (13:56 +0800)]
MA-15158 Set spl recovery mode for dual bootloader

The A/B slot selection is moved to spl, it may lead to hang
if no bootable slots found. The only way to recover the board
is re-flash images with uuu tool, which is quite inconvenient
for some customers who can't enter serial download mode.

This patch will set "spl recovery mode" which will give us a
chance to re-flash images with fastboot commands.

Test: Enter spl recovery mode and flash images when no bootable
      slots found.

Change-Id: I31278f5212bde7609fe2f49e77b3849e92c0c516
Signed-off-by: Ji Luo <ji.luo@nxp.com>
(cherry picked from commit 46cc755cf3f42422ee1d7783394e14e8125df2b6)
(cherry picked from commit 047f09ef2ef33657d76fd92d8f5599e00158cd6b)