Commit Graph

4642 Commits

Author SHA1 Message Date
Joseph Chen 7cef4c7ca2 fdt_support: add more debug info when merge bootargs
Change-Id: Ib01c2b20bf2b71fe3079febcfb3b4e77e874026a
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-08-08 11:39:32 +08:00
Joseph Chen f4d148502c board_r: add dram_initr_banksize()
Some platform requires to reserve memory regions for some firmware
to avoid kernel touches it, but U-Boot may have communication with
firmware by share memory. So that we had better reserve firmware
region after the initr_caches() which enables MMU and init
translation table, we need firmware region to be mapped as cacheable
like other regions, otherwise there would be dcache coherence issue
between firmware and U-Boot.

Change-Id: Icb986022b484c96dffcafc98972ae24362cb8e4b
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-08-07 10:47:42 +08:00
Joseph Chen f8dbe86116 android: support dtb overlay
- read dtbo from recovery or dtbo partition;
- append "androidboot.dtbo_idx" to cmdline;
- apply dtb overlay when first read kernel dtb;
- pass dtb that first time read to kernel;

Change-Id: Iba5c02c1307d3dad69ef96d3b3b0927fb507be8f
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-08-06 11:15:19 +08:00
Joseph Chen c67b8746fb image: android: use debug to print cmdline
if cmdline is too long, it wastes time.

Change-Id: Ie8658fca11c3706df50d1eaae2ee479af6e8de08
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-08-06 11:15:19 +08:00
Joseph Chen bcd21a1f01 image: android-dt: add dt_for_each_entry() to iterate over all dt entry of DT image
Change-Id: I4db1e1da0d55701798bb8c296dd58e26592ef3c8
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-08-06 11:15:19 +08:00
Joseph Chen c673757f56 common: fdt_support: support "bootargs_ext" merge into "bootargs"
When DTBO is enabled, dtbo may provide "bootargs_ext" to append
cmdline base on "bootargs".

Change-Id: I4abf554591a3983c5f41494ecadf5614b8f6404b
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-08-06 11:15:19 +08:00
Joseph Chen 09f4e561ac android: update android image header to support new version
mainly to support android P.

Change-Id: I34a49e4eedcde06a9e40792c7c908737dc10b426
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-08-06 11:15:19 +08:00
Sam Protsenko 2967d2f74d FROMLIST: cmd: Add dtimg command
dtimg command allows user to work with Android DTB/DTBO image format.
Such as, getting the address of desired DTB/DTBO file, printing the dump
of the image in U-Boot shell, etc.

This command is needed to provide Android boot with new Android DT image
format further.

Change-Id: I2a626f333f604b6f0424aa03feaddab4e8506a3f
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Zhangbin Tong <zebulun.tong@rock-chips.com>
(am from http://patchwork.ozlabs.org/patch/925871/)
2018-08-06 11:15:19 +08:00
Sam Protsenko e91b3373a9 FROMLIST: common: Add support for Android DT image
Android documentation recommends new image format for storing DTB/DTBO
files: [1]. To support that format, this patch adds helper functions for
Android DTB/DTBO format. In image-android-dt.* files you can find helper
functions to work with Android DT image format, such us routines for:
    - printing the dump of image structure
    - getting the address and size of desired dtb/dtbo file

This patch uses dt_table.h file, that was added in 643cefa4d848 ("Import
Android's dt_table.h for DT image format") by Alex Deymo.

[1] https://source.android.com/devices/architecture/dto/partitions

Change-Id: I78f6750af6c4fecb80d331bc06bc5cbe98da5825
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Zhangbin Tong <zebulun.tong@rock-chips.com>
(am from http://patchwork.ozlabs.org/patch/925870/)
2018-08-06 11:15:19 +08:00
Dingqiang Lin c8638ec3c0 common: boot_rkimg: add SPI flash boot type
Change-Id: I9d1d36390833387a93eb7ed76b1d6f90e3640edb
Signed-off-by: Dingqiang Lin <jon.lin@rock-chips.com>
2018-07-31 14:51:32 +08:00
Jason Zhu d34064effa android: get dev_desc by rockchip_get_bootdev()
Get dev_desc by call rockchip_get_bootdev() but not
default mmc 0.

Change-Id: I78c6760eb6410a14a9f767db2f90902ec97f432f
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2018-07-19 09:57:37 +08:00
Jian Qiu 65413a00f9 fastboot: add FASTBOOT_OEM_UNLOCK option
This enables the following fastboot commands:
  fastboot oem unlock
  fastboot oem unlock_accept
  fastboot oem lock
  fastboot getvar oem-unlock

Android 8.1 need the oem unlock status attach to bootargs on boot.

Change-Id: Icc83451336a4dea2cbcf4927287de23bc8e28cb1
Signed-off-by: Jian Qiu <qiujian@rock-chips.com>
2018-07-19 09:56:14 +08:00
YouMin Chen ba5fd738de rockchip: tpl: rename CONFIG_TINY_TPL to CONFIG_TPL_TINY_FRAMEWORK
Change-Id: Ia05a73467578f5620a9ba168e67bcfb02c40e1d0
Signed-off-by: YouMin Chen <cym@rock-chips.com>
2018-07-18 17:09:38 +08:00
Joseph Chen 243527b501 console: support timestamp for printf
with this patch, we can see the detail boot time of boot flow.
The U-Boot log is like this:

[    0.259266] U-Boot 2017.09-01739-g856f373-dirty (Jul 10 2018 - 20:26:05 +0800)
[    0.260596] Model: Rockchip RK3399 Evaluation Board
[    0.261332] DRAM:  3.8 GiB
Relocation Offset is: f5bfd000
Using default environment

[    0.354038] dwmmc@fe320000: 1, sdhci@fe330000: 0
[    0.521125] Card did not respond to voltage select!
[    0.521188] mmc_init: -95, time 9
[    0.671451] switch to partitions #0, OK
[    0.671500] mmc0(part 0) is current device
......

Change-Id: I3ce2a4466f9ecd9eeb6b334ba4ba48391aa47c30
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-07-17 10:07:08 +08:00
Andy Yan 79bdfc405d android: only handle compressed kernel after read a valid android image
We shouldn't go on with the compress/decompress flow
when we get a invalid andoird image.

Change-Id: Ied7266b8791fe571c670cacafffdd393161c8189
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
2018-07-16 16:00:10 +08:00
Andy Yan e2ced6c33b android: only take the successed return value as load_address from android_image_load
Function android_image_load will return a negative value in case
of error. We should check the return value first before take it
as an unsigned long load_address.

This fix 008aee876ae5("boot_android: add runtime compatible for
un/compressed kernel image"), which may cause system panic on
a system that boot with none-android format image.

Change-Id: I7f67c322d4ef343328b2276fe83432716148a76d
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
2018-07-16 09:05:39 +08:00
Joseph Chen 3ee3aa8966 common: fdt_support: replace env_update with env_update_filter
Change-Id: Ic47d3b82b3aac6b36f9fe7803c0d3a165ebd9e05
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-07-14 17:36:03 +08:00
Jason Zhu 2c9c7f0d24 common: fdt_support: delete root=
Delete default "root=" in the dts when use AB system.

The ab bootctl will choose the high priority system
and storage its UUID to cmdline.The format is:
root=PARTUUID=xxxx-xxxx...

Change-Id: I4ad5b167952c84764fee741b527346bdfe5af1d7
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2018-07-14 17:23:30 +08:00
Andy Yan 008aee876a boot_android: add runtime compatible for un/compressed kernel image
This patch add auto parse the compress format of kernel image.
Then decompress the compressed kernel image for arm64, as for
arm32 zImage, we only need to load it to a higher memory, then
the kernel will handle the decompress itself.

Test on RK3308 AARCH64 mode (Cortex A35 816 MHZ) boot with eMMC:

------------------------------------------------------------------
Format    |  Size(Byte) | Ratio | Decomp time(ms) | Boot time(ms) |
-------------------------------------------------------------------
Image     | 7720968     |       |                 |     488       |
-------------------------------------------------------------------
Image.lz4 | 4119448     | 53%   |       59        |     455       |
-------------------------------------------------------------------
Image.lzo | 3858322     | 49%   |       141       |     536       |
-------------------------------------------------------------------
Image.gz  | 3529108     | 45%   |       222       |     609       |
-------------------------------------------------------------------
Image.bz2 | 3295914     | 42%   |       2940      |               |
-------------------------------------------------------------------
Image.lzma| 2683750     | 34%   |                 |               |
-------------------------------------------------------------------

Note: the boot time is counted from first ddr init log to first Kernel log.

Change-Id: I73b12ec944fbc8238b0e061a37e2f31aa3093231
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
2018-07-14 11:39:04 +08:00
Jason Zhu 6651d4c0fb dev_desc: judge dev_desc whether NULL or not before use it
Change-Id: I9d0e2d207a143a02949fbdff2d9ad39f154e4f3e
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2018-07-04 09:31:05 +08:00
Jason Zhu 051c625387 android: fix android_bootloader_message_write bug
Acording to rockchip, the bootloader message is storaged
in the misc, and the offset address is BOOTLOADER_MESSAGE_BLK_OFFSET
blocks. But the offset address is zero in the normal state.
So add the CONFIG_RKIMG_BOOTLOADER to seperate it.

Change-Id: Ie4cd473ff9a32f578fe901b48689e60c7a28012a
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2018-06-28 16:26:46 +08:00
Jason Zhu 8e620d08b8 android: add the default fastbootcmd
Run the default fastbootcmd if can not get fastbootcmd
from env.

Change-Id: Iaf4d155a9737dd712673f1a7ab9543dc405343fa
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2018-06-25 09:11:32 +08:00
Joseph Chen c2304c02b1 console: add warning message if slient console is enabled
Change-Id: Ibc50e9bc19c77bb688a0312c1d1290250a9b6a2f
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-06-22 19:40:00 +08:00
Joseph Chen 7f571427ef board_r: add interrupt_debugger_init()
provide for platforms to override as early as possible since
interrupt is ready.

Change-Id: I803620b71c3f1559e79074c03bee36a84f1ebc1c
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-06-13 10:56:38 +08:00
Joseph Chen 3fc26c82e8 board_r: initialize interrupt earlier
Change-Id: I1c674efd0d1b7e8229179ac570727da9b4adab27
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-06-12 18:03:55 +08:00
Joseph Chen 4cda574961 boot_rkimg: check recovery mode by env "reboot_mode"
This is set when recovery key pressed.

Change-Id: Id5fe334fafd67fec461c36df13b2e856e519a083
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-06-06 17:55:12 +08:00
Jason Zhu 564ab2efb0 common: bootm: reserve memory bank
Reserve lmb according to gd->bd->bi_dram.

Change-Id: Ib1d4da95e826d3afe034bd3a90ec1d1c92a692bf
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2018-06-06 16:36:00 +08:00
Jason Zhu 9cc336e89e android: bring up the kernel if device is unlock
If the device is unlock, the device can be brought
up when use avb.

Change-Id: I82dd71d33f47dda0a760740428988dd658a96713
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2018-06-05 08:56:54 +08:00
Joseph Chen 93d59c05c7 android: fix "reboot recovery" command doesn't work
If not find recovery message in misc partition, we try to check
kernel reboot command.

Change-Id: I25847cb5cc06efc39c419426ab6dbe9acde3797d
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-05-25 17:48:46 +08:00
Kever Yang fd262f5b6d rockchip: rkimg: rksfc use the storagemedia type 'nand'
The device node for rksfc and rknand are the same in kernel, so
we can use the same storage media type.

Change-Id: I3eb70bc1a502e516fbf538ac274ee856a98ba556
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2018-05-24 09:56:51 +08:00
Kever Yang 083c304ab8 rockchip: rkimg: add 'sd' type for storagemedia
mmc1 is sd card in U-Boot.

Change-Id: I9f57d0029dcf0af043bc6b7c2e184e6e02482d89
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2018-05-24 09:56:51 +08:00
Joseph Chen 740107bb19 rockchip: support alternative kernel dtb depends on adc/gpio
1. support adc value recognize;
2. support gpio value recognize;

Change-Id: I8bcbdd914405184d46029c4995c09b09e36c7ea3
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-05-11 11:12:35 +08:00
Dingqiang Lin c2717d6fed common: boot_rkimg: add boot devtype rksfc
Change-Id: I2ec14959aa1cc83ef7edf82944f8235f4db17690
Signed-off-by: Dingqiang Lin <jon.lin@rock-chips.com>
2018-05-11 11:08:38 +08:00
Jason Zhu dc588d96b8 common: boot_rkimg: make devnum alterable
make devnum alterable when get blk_desc

Change-Id: I0bd7387003c78cae058b85c93c3de266d90e9ee7
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2018-05-08 11:35:20 +08:00
qiujian 9e68721b27 bootargs : read oem unlock status
Read oem unlock status from optee_client api
and attach it to bootargs

Change-Id: Ib8b1a9bc115ec9cb7e5ce09dc50845cfd7c1c81b
Signed-off-by: Qiu Jian <qiujian@rock-chips.com>
2018-04-03 10:30:56 +08:00
qiujian f61a997e29 fastboot: implement oem unlock commands for bootrkp
Read-write oem unlock status from optee client api.

Implement the following fastboot commands:
  fastboot oem unlock
  fastboot oem unlock_accept
  fastboot oem lock
  fastboot getvar oem-unlock

Change-Id: I99edcee7b60c6d9529e6687291d87f22bf97b771
Signed-off-by: Qiu Jian <qiujian@rock-chips.com>
2018-04-03 10:30:56 +08:00
jason.zhu 5353f2a9a0 android: fix memory overflow
In the function android_assemble_cmdline, the allocated_suffix
size must be strlen(ANDROID_ARG_SLOT_SUFFIX) + strlen(slot_suffix)
+1. If not, the later strcpy and strcat operation will be
out of bounds.

Change-Id: Ib0ed73ebc2f076c8dc8afac168c7aaeccfddfa67
Signed-off-by: jason.zhu <jason.zhu@rock-chips.com>
2018-04-02 16:15:23 +08:00
David Wu 30129f2f83 config: Add CONFIG_TINY_TPL to disable SPL framework at TPL
Some devices cann't use SPL framework at TPL stage, but the
CONFIG_SPL_FRAMEWORK is still defined at TPL stage, so need
to separate them with CONFIG_TINY_TPL.

If the SPL framewrok was used both at TPL and SPL stage,
CONFIG_TINY_TPL is not defined.
If the SPL framewrok was used at SPL stage, but not use at
TPL, need to define CONFIG_TINY_TPL.

Change-Id: Iabb7e0377ee00311ca468cb8ff7544c96bd999d6
Signed-off-by: David Wu <david.wu@rock-chips.com>
2018-03-29 16:27:44 +08:00
Joseph Chen f2d1698c73 autoboot: only allow ctrl+c to abort bootcmd
It works only for rockchip platforms.

Change-Id: I67e7d9ab625b7667ec411347249582ed9537686c
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-03-27 09:02:33 +08:00
Andy Yan 849faaa0e3 common: boot_rkimg: avoid to access NULL address when failed to get bootdev type from env
The NULL address maybe point to a security region on
rockchip armv8 platform, which can't be accessed from
u-boot(normal world). So before we access devtype by strcmp,
set devtype to mmc if we failed to get it from env.

Change-Id: Iceae3d1b89abd78fe59a3b57938254e55fa3894f
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
2018-03-22 08:55:24 +08:00
qiujian 91c73fb4d1 lib: optee_client:Support attestation
Add methods to read attestation key from the misc partition of
 last 64K, store key and certificate chain data in secure storage.

 When CONFIG_OPTEE_CLIENT is defined,
 uboot support load attestation data.

Change-Id: I8f3bd7096a7856de9e58d294822a818d5fe380ba
Signed-off-by: qiujian <qiujian@rock-chips.com>
2018-03-21 16:38:08 +08:00
Jason Zhu 2301a6f51c rockchip: resrouce_img: support a/b
If apply the a/b system, open the macro CONFIG_ANDROID_AB.
Then get the dtb from the boot '_a' or '_b' image.

Change-Id: I21ad9d5a5e6e63e26bc16b1aeeb2e690c669a535
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2018-03-05 14:42:53 +08:00
Joseph Chen 2e3f27707f board_f: print relocation offset
actually that relocation takes some troubls for our debug,
print relocation offset can help a lot.

Change-Id: Ib15d6111930fda8e8cdfab505d977aaf1da934b2
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-03-05 09:54:07 +08:00
Kever Yang 64e1e04c21 fastboot: support rknand device
Use rockchip_get_bootdev() to get dev_desc.

Change-Id: I127d5418f65db42d93930283348bb4072447012f
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2018-03-01 08:54:25 +08:00
Joseph Chen 3c3675ddd7 rockchip: recoganize boot devtype dynamicly
currently support: emmc and rknand.

Change-Id: I8b0e2623256ed3357de2acbee0d2455162228ab5
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-02-25 16:49:34 +08:00
Kever Yang eb2a5055ad rockchip: boot_rkimg: do not read dtb again if we have do it
We may read the dtb file before bootrkp command, we can use it directly.

Change-Id: Iff6dcd037d9d3637f1be81f458140189c13b1977
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2018-02-23 10:28:27 +08:00
Kever Yang 3a39dbf874 fdt_support: add fdt_update_reserved_memory()
Add API for rockchip pass uboot logo memory info to kernel.

Change-Id: Ib3bfadc381efae21359a43654493e8e0f4e67dd0
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2018-02-23 10:28:26 +08:00
Yu YongZhen 09e52837fc common: boot_rkimg: go on the boot flow even no ramdisk found
in some case, we need persistent file system in NOR or NAND,
such as squashfs, we need to boot system in flash.

Change-Id: I46e4ae3e43f96f77f1ca6b4df8424fce19866226
Signed-off-by: Yu YongZhen <yuyz@rock-chips.com>
2018-02-11 20:28:48 +08:00
Kever Yang e4feb814ab rockchip: android: fix compile warning
Change-Id: Ic89e97a852999a9ec929942b1b612f13cc43f57f
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2018-02-11 19:49:52 +08:00
Joseph Chen e87597928c image-fdt: print reserved-memory node name
Change-Id: Ib7d4d7d4ae8355877b45eccc93deb03298f1e138
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-02-11 11:57:26 +08:00