Commit Graph

5038 Commits

Author SHA1 Message Date
Jason Zhu fc04460b2e common: android: support boot recovery system
In android A/B system, there is no recovery partition, but in the linux
system, we need the recovery to update system.

Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: Idac88720b260791b1ad4c51a5ebc7aae9c66ca67
2021-02-21 14:38:23 +08:00
Jason Zhu 66f2fdd9d8 common: android_ab: add function ab_can_find_recovery_part
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: Ic8f225699915063b9a2e069a4cb248fd4d5a6976
2021-02-21 14:38:23 +08:00
Jason Zhu a0166cc6be mtd: Kconfig: add a Kconfig option to enable the support for MTD block write operations
This allows using CONFIG_IS_ENABLED(SPLMTD_WRITE) to compile out code
needed only if write support is required.
The option is added for u-boot and for SPL.

Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: Ia48169fcd601ad51d1723923ed71d610901275e1
2021-01-06 15:29:34 +08:00
Joseph Chen 791045ea0f common: android: AVB support lz4 kernel
The key point is to get kernel compression type by:
bootm_parse_comp((void *)(ulong)hdr + hdr->page_size);

Because if hdr->kernel_address is set as decompress
address before this comment, android_image_get_kernel_addr()
would return error kernel offset, result in a wrong
compression type from android_image_parse_comp().

Tested successfully on RK3568 EVB board:
 - LZ4 Image + AVB full partition load
 - LZ4 Image + AVB separate load
 - LZ4 Image + none-AVB separate load
 - Image + AVB full partition load
 - Image + AVB separate load
 - Image + none-AVB separate load

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Ic5385843f036b52eb7a286b7194852accfb52225
2021-01-06 14:44:05 +08:00
Jason Zhu 1f5c7b6414 spl: fit: support decreasing 1 if verify fail when enable a/b
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I922b929ac37181f61e820b6c2b2de750e816a99d
2021-01-04 19:23:48 +08:00
Jason Zhu 093f4d990f spl: ab: support decreasing 1 in spl
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: Ie3bad33476e25bbcbf9d845abc87c6e075671e0c
2021-01-04 17:12:44 +08:00
Jean-Jacques Hiblot 9127fbf440 UPSTREAM: mmc: add a Kconfig option to enable the support for MMC write operations
This allows using CONFIG_IS_ENABLED(MMC_WRITE) to compile out code
needed only if write support is required.
The option is added for u-boot and for SPL

Change-Id: Ibb3836ed8713e491238460783a85ee1808770f66
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
(cherry picked from commit d6400c3f8520bb9a203fe397039279c80f093c27)
2021-01-04 17:12:30 +08:00
Joseph Chen 3e9875cd72 spl: fit: assume the max size of U-Boot/tee/atf is 2MB
RK3568 U-Boot is over 1MB size.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I743cf403ddfb63d9452a2d6781d99ebdd5313e9c
2020-12-30 17:33:11 +08:00
Jason Zhu c6d7f8e4f0 spl: ab: print a/b info in spl
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I2f1b05a6e12e53988a84b8ac876e80cd722fcaff
2020-12-30 16:04:51 +08:00
Jianqun Xu 9d8aa448b5 common: fix hex print format to %#010lx
Before this patch:
   Flattened Device Tree blob at 08300000
   Booting using the fdt blob at 0x8300000

With this patch:
   Flattened Device Tree blob at 0x08300000
   Booting using the fdt blob at 0x08300000

Change-Id: Ibd5f1cfc07791eff829512d1820eb3c8c0caa007
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
2020-12-30 08:38:31 +08:00
Jason Zhu d06e16f8b1 common: fit: fix calculate data error
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I3bea25d1d4c2d9e846146e33dbd7a5454ceca853
2020-12-11 17:37:33 +08:00
Jason Zhu 78263d89a3 rsa: support write public hash in spl
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I4120d0cad1cb24b45c3b281649e1eba520a11ee2
2020-12-10 15:59:22 +08:00
Yifeng Zhao ffc357038c spl: support boot from rknand device
Signed-off-by: Yifeng Zhao <yifeng.zhao@rock-chips.com>
Change-Id: I168ec42ec1ac4bc1e8b640fba22357cde4a26aac
2020-11-30 09:53:12 +08:00
Joseph Chen 39b9f515bc spl: fit: update U-Boot entry point by image info
Otherwise it depends on static value CONFIG_SYS_TEXT_BASE
if the image node can't be found in "/fit-images".

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I103bd3467baaefb816ab34d7a2bf37547113e431
2020-11-26 15:43:56 +08:00
Joseph Chen 69a04b4fa5 spl: atf: traverse all "/fit-images" sub nodes
Fix find sub nodes failed.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I2cb885028da9711a15f001fdd48e9d273cfd348a
2020-11-26 15:43:56 +08:00
Jason Zhu 5d4ebb14fc spl: modify the spl log
Correct the log when bring up kernel with spl directly.

Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: Ic3204d8ddab37c3a5aac3488e209b3764e96a977
2020-11-25 22:17:34 +08:00
Weiwen Chen 4623d13df7 spl: Kconfig: update SPL_KERNEL_BOOT_SECTOR depend on
Signed-off-by: Weiwen Chen <cww@rock-chips.com>
Change-Id: I0284e105960dd58690c779903c227c371a4611fc
2020-11-24 16:33:22 +08:00
Jason Zhu a9e6d1e544 spl: mtd_blk: redefine the mtd device name
Redefine the mtd device name according to the defination in
file blk.h:

BLK_MTD_NAND		0
BLK_MTD_SPI_NAND	1
BLK_MTD_SPI_NOR		2

Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I75df9f0405d351c61929ff65781bfd4a26f2a1a4
2020-11-24 14:47:34 +08:00
Jason Zhu cd081a9734 spl: rkfw: fix printing error message
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I4cfd0de01b826aaa21c7269e1b814e234670561a
2020-11-20 15:57:44 +08:00
Jason Zhu a741b19cf7 spl: fit: map the bad block table depending on the image's size
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I6a257327fce16c8bf5ce10c8cbae0b60e044eb88
2020-11-18 16:11:15 +08:00
Joseph Chen 9d23fbe3b7 spl: fit: load kernel dtb if need
kernel FDT is for U-Boot if there is not valid one from images,
ie: resource.img, boot.img or recovery.img. It is put right
after U-Boot FDT.

This is used for U-disk bing up.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I348b6ea5736f46c091284c501e7e0f9c64cd2f78
2020-11-14 15:32:03 +08:00
Joseph Chen d6e082ceff common: board_f: print kern.dtb address
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I8f593632676cad3758c37d5a027932bc1302f0d5
2020-11-14 15:32:03 +08:00
Joseph Chen 253ea6c67d common: android: independent on optee client
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I5c124c7bfcdfd3c2972a5310046b633324e3bdf0
2020-11-09 17:20:46 +08:00
Joseph Chen 713cdac3a7 common: android: allow failed to overly dtbo
Restore main fdt if it's destroyed by fdt_overlay_apply()
when overlay failed.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Id26085f2df89d208caadeb3c4ce33f21f896ee22
2020-11-09 14:51:56 +08:00
Joseph Chen a5aaa1e14d common: fdt_support: remove earlycon if uart is disabled
If uart is required to be disabled during power on, it would be
not initialized by any pre-loader and U-Boot.

If we don't remove earlycon from commandline, kernel hangs while
using earlycon to putc/getc which may dead loop for waiting uart
status. (It seems the root cause is baundrate is not initilalized)

So let's remove earlycon from commandline.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I2edcf48cb4dd301f2e79d5e94b1477c55198708f
2020-11-02 18:34:22 +08:00
Joseph Chen 034db99592 dm: serial: support always use uart debug mode
In this mode, uart debug is initialized depends on
configuration from pre-loader or CONFIG_UART_DEBUG_.

The serial is not care about dts "stdout-path" and
not register into console framework any more. It's
nice to use pre-loader serial and make serial easy
to configure.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: If4c68229d76b6f1710a35e3ef9a2a91cb306fa9c
2020-11-02 18:34:22 +08:00
Joseph Chen 912fa0754a common: board_f.c: add fpga init call
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I5fb507094207b14ad64cf3dee646aaac177bf43d
2020-11-02 16:39:14 +08:00
Joseph Chen cc0848dfb9 common: android: simplify image verify/un-verify
Support hash verify if header version < 3.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I2ade1a50aa26cd94c4464c25c86836421d973f00
2020-10-30 18:27:07 +08:00
Jason Zhu 651b0d0dfc common: android: move crypto_sha_init() after load IMG_RK_DTB
We call crypto to verify dtb alone, so move the crypto_sha_init()
after load IMG_RK_DTB when begin another hash verification.

Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I12f36172a5d03fa8baa0236503be5627fa18adf0
2020-10-30 15:18:37 +08:00
Lin Jinhan 1817f8c289 common: android: crypto v2 hash need length in crypto_sha_init
if not set ctx.length, you will get zero length hash value.

Change-Id: I9e653c845a36b4caea986c328c48ea8b2835da75
Signed-off-by: Lin Jinhan <troy.lin@rock-chips.com>
2020-10-30 09:58:59 +08:00
Jason Zhu beeaf83f44 common: android: support AVB_SLOT_VERIFY_FLAGS_NO_VBMETA_PARTITION
Usually, the recovery is updated alone, so attach the vbmeta to its tail.
Pass AVB_SLOT_VERIFY_FLAGS_NO_VBMETA_PARTITION to verify the recovery.

Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: Iaea6c8cd06f02ce946a84f8f568a7b91ef6dd40a
Signed-off-by: Yifeng Zhao <yifeng.zhao@rock-chips.com>
2020-10-26 16:39:25 +08:00
Jason Zhu 516562c2d3 spl: mtd_blk: support get image sector address by part info
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I85d5433ce165a8b027e485c694315c492467c6d9
2020-10-26 09:28:39 +08:00
Jason Zhu cee2fb0e57 common: android_ab: move the ab functions to android_ab.c
Move the ab functions to android_ab.c and add "ab_" prefix to
api function.

Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I4527a0c957aa7853a1b75d456ca3fabaf80c1c57
2020-10-22 19:38:57 +08:00
Jason Zhu cf87ffd351 include: android_image: move some android common definitions to this file
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: Ia0da707408bcd43b50b49cef89495af7f9d97cd7
2020-10-22 19:38:57 +08:00
Joseph Chen 295b646621 spl: fit: print ATF and U-Boot load address
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I0b732934c1aa63ed6e849d85bd77fa8ec1f622b3
2020-10-22 16:37:49 +08:00
Joseph Chen e7498cb05b common: android: show ramdisk size of boot and vendor-boot
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Ia8eca7010989e64d10b09628a12bcfc5aaeb988c
2020-10-10 16:17:06 +08:00
Dayao Ji 132e9ecacf rockchip: rkimg: Add R/W interfaces for virtual A/B metadata
According to the AOSP default definition, the virtual A/B
metadata is located at the offset 32KB of the misc partition.

Signed-off-by: Dayao Ji <jdy@rock-chips.com>
Change-Id: Ib60379f25e4c72be9f5ed03934ab7dc928cdd585
2020-09-23 16:26:32 +08:00
Joseph Chen 745aeb1a7d common: android: add boot_img_hdr_v3 and vendor boot support
Android Header v3 and vendor boot partition are introduced
from Android-11(R).

Header populate:
  Header v3 is no longer compatible with v0/1/2 header, we
  add populate_andr_img_hdr() to merge boot and vendor_boot
  partition header into struct andr_img_hdr in order to
  compatible with v0/1/2 header.

resource.img:
  The second_addr and second_size fields are removed in v3,
  so we require resource partition to restore resource.img.

A/B system:
  If not A/B system, the boot.img header version is 3 and
  recovery header is version 2.

AVB load image:
  - If allow verification error: the image is loaded by
    ops->get_preloaded_partition() which auto populates
    boot_img_hdr_v3.
  - If not allow verification error: the image is full loaded
    by ops->read_from_partition() which doesn't populate
    boot_img_hdr_v3, we need to fix it.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I2afce53c43d782fc57baa01acf9c05518b580840
2020-09-18 14:41:37 +08:00
Joseph Chen 93fd134f77 common: malloc simple: enable space exhausted message
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: If089f38abf5e205a2b9f00fd2d735751fd7d5201
2020-09-17 20:03:01 +08:00
Joseph Chen 69b1ad4693 common: android: clean up code
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I98dfd54edd813f892c5f2717a694b2424b8ecded
2020-09-15 10:55:29 +08:00
Jason Zhu fdb19f3978 spl: fit: add file spl_fit_tb_arm_v7.S
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I59554a339cbad5f03806c6b1007ccf69e03be470
2020-09-07 16:26:04 +08:00
Jason Zhu 2201a451d5 common: fit: add fit_image_is_preload()
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I3c3001a347ae59fcfd186156382c04b4b8a77546
2020-09-07 14:53:06 +08:00
Joseph Chen 3eac03e218 common: spl: ab: allow missing misc partition
Return partition name without any slot suffix in this case.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: If0692e3e2845f152802632994f5da5a9d3fb1731
2020-09-02 17:10:09 +08:00
Joseph Chen b8fa09953a common: console: support enable timestamp in SPL
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Iefe5f9ea6e9abb8c3cc07e75beb68c387f20320f
2020-09-02 16:35:17 +08:00
Joseph Chen 29725e8530 spl: fit: print invalid fit magic
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I89da3797e444bb12e58cf99f902cb758c6fd82f9
2020-08-20 15:09:09 +08:00
Joseph Chen a00b516f44 spl: fit: use CONFIG_SPL_KERNEL_BOOT for thunder-boot
This option was added by RKFW boot flow, let's reuse it.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Id4625a783747ce2e4ebaf69a5fa3812077a79639
2020-08-20 15:04:37 +08:00
Joseph Chen 45d851f407 common: spl: show total time of SPL
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I93de59f4064a2579f8010da2655607f45840f8ed
2020-08-20 15:04:37 +08:00
Jason Zhu 01c0df48f9 common: android: decrease ab tries count after load firmware successfully
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I31842eda26f05b03ea6a0274502a60814e00e6a0
2020-08-19 17:05:30 +08:00
Joseph Chen 50466f5805 spl: fit: update newline position
Adding newline after board_fit_image_post_process() message.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I325f26bfb33638a4dfe8fef473d6c5062e566158
2020-07-27 20:03:53 +08:00
Jason Zhu fb743922bc spl: mtd_blk: use CONFIG_MTD_BLK_U_BOOT_OFFS as uboot location address
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I7a8e75095e30541947503481e214462b3d543fd0
2020-07-24 18:43:48 +08:00