Skip fdt and ramdisk relocation to save boot time.
Change-Id: I56fd2fca97fa7795024aa542f0a45d0512be01d4
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
It helps check whether uncompress kernel overlap with other region
or not.
Change-Id: Ia7e6c027f68c2e8af398824afd8b7580531cb77e
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
android_image_parse_kernel_comp() doesn't return valid os
compressed type after android_image_set_kload(), so we add
the env "os_comp" to record compressed type.
Change-Id: Ie175649d348c0578ce78e139bdbbf4b6f9ea1101
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
- import memblk id to manage memory blocks;
- change "sysmem_property" to generic "memblock";
- use alloc instead of reserve for all memory blocks;
- clean up and fix some logic;
- add U-Boot cmd for sysmem;
Change-Id: I614223ce3bf97a7b3566412a9d1864fb30b68fd8
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Minus the retry-count in every boot with ab system. If the ab system
boot success, the system service boot_ctrl reset the retry-count or set
boot-successful.
Change-Id: Ic37f65b745d1feb978730332835246dc43d72dab
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
There is a compile error when enable AB config. The error message is
"error: a label can only be part of a statement and a declaration isnot
a statement". Add brackets to fix this error.
Change-Id: I4ec3af984503e35fc1304d08cd7cd8ab587dfb0a
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Sometimes, framework or user would call fdt_increase_size() to update
fdt size, it's better reserve more space to avoid sysmem gives the fdt
region overflow report.
The CONFIG_SYS_FDT_PAD default value is sync with bootm framework
in: common/image-fdt.c
Change-Id: I363e9a4182e13b1628a76666acd8272d25db659d
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Return directly and do not continue read from misc partition
if there is no partition.
Change-Id: I549d123632aecc5bd29ebdc2c4c7917c76750247
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
- add interface to get android avb enable state;
- get ramdisk from "ramdisk_addr_r" only when android avb disabled
and CONFIG_ANDROID_BOOT_IMAGE_SEPARATE is enabled;
(fixes: 644e344 android: support loading android image separate)
Change-Id: I7280f911a0c5db851d119acb458b3f335dc28bce
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
This patch support loading android image separate for the
kernel/ramdisk/second images. It is disabled when android
AVB is enabled, because AVB need verify the full android image.
It brings some benefits, mainly for saving a lot of boot time:
- allow skip load second content when kernel dtb is enabled;
- allow skip fdt and ramdisk relocation during bootm boot flow;
- allow loading fdt/ramdisk to "fdt_addr_r"/"ramdisk_addr_r";
- avoid android image too large when load to ram;
Change-Id: Ia040b3031307a8a7c98b011ce038ec61fee6804a
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Extract keymaster CA module from OpteeClientInterface
refactoring code for keymaster reads and writes form caller module
Change-Id: I1069fce0d29d9d9815f71e7f3b4d231754382acd
Signed-off-by: Jian Qiu <qiujian@rock-chips.com>
Since the androidboot.verifiedbootstate is required in android Pie, so add
it to bootargs when secure boot flag is not set.
Change-Id: I4a883ca87bbba321a894ee66ebcf0ff9d5cb6ca8
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
We read the vboot_flag which is the flag of secure boot to enable
verified boot in uboot.
Change-Id: I592473ad14f9e19c6529602d029b7ec2fb335da8
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
If slot_suffix is equal to "_a", slot_index_to_boot is equal to '0'
but not '1' when use function strncmp.
Change-Id: I53ffc920824e03c923f1d9ab8fd326a733c59654
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
1. Actually, the "kernel_address" is android header address but not
real kernel address, let's use "kernel_addr_r/c" to verbose.
2. print compressed type info, like:
"Booting LZ4 kernel at 0x02480000(Uncompress to 00680000) with fdt at 1f00000..." or
"Booting kernel at 0x00680000 with fdt at 0x1f00000..."
Change-Id: Ifb628ab355670681f78d8f73893baddee21223a0
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
For some legacy reasons, rockchip use mkbootimg tool to pack android
images with special pack parameters(SDK version lower than 8.1) to
assign kernel/ramdisk/seconds address and page size.
Android hdr on RK3399 SDK-7.1:
kernel size: 1299808
kernel address: 60408000
ramdisk size: 1e6b80
ramdisk addrress: 62000000
second size: 41c00
second address: 60f00000
tags address: 60088000
page size: 4000
header_version: 0
os_version: e041114 (ver: 1.7.2, level: 2017.4)
name:
cmdline: buildvariant=userdebug
The kernel/ramdisk/seconds address base is not from 0x10000000 and
page size is not 0x800!
This patch makes bootflow to compatible with above legacy packing.
Change-Id: I663a0d1386694658c97586706ff21ed887d6a2e7
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
If the vbmeta has no data or verify errors occur, the system get abort:
"Synchronous Abort" handler, esr 0x96000010
* Relocate offset = 000000003db40000
* ELR(PC) = 0000000000220d2c
* LR = 0000000000220d08
* SP = 0000000031d35040
Change-Id: I452e9b109ef5f61dfc338ff5bfb72a687a2b0003
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
We may have special operations for fdt(optional):
- apply fdt overlay;
- select fdt by adc or gpio;
We can't read default rk-kernel.dtb and pass it to kernel,
call rockchip_read_dtb_file() to get dtb.
Change-Id: I3aba002b0cfe324cc7c3852bf8b9561575590fd4
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Set 'root=PARTUUID=' to bootargs When use the CONFIG_ANDROID_AB.
Change-Id: I9760f1a9ad67ba1f2cb334a0af50db464d87816b
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
When we use avb, we will add the verify result to cmdline.
The format is "androidboot.verifiedbootstate=green, yellow
orange, or red".
Change-Id: I0059fbd7e73225f580bb5bf0b5e4b04faeb22f45
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
- 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>
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>
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>
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>
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>
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>
Run the default fastbootcmd if can not get fastbootcmd
from env.
Change-Id: Iaf4d155a9737dd712673f1a7ab9543dc405343fa
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
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>
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>
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>
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>
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>
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>