Thomas reported U-Boot failed to build host tools if libfdt-devel
package is installed because tools include libfdt headers from
/usr/include/ instead of using internal ones.
This commit moves the header code:
include/libfdt.h -> include/linux/libfdt.h
include/libfdt_env.h -> include/linux/libfdt_env.h
and replaces include directives:
#include <libfdt.h> -> #include <linux/libfdt.h>
#include <libfdt_env.h> -> #include <linux/libfdt_env.h>
Change-Id: I6c0f7e50e8b571106627f25ddac008a62bd2994e
Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
This macro is locally referenced in common/image-fdt.c
Change-Id: Iaf308d919d666be2615ef8f894099c538366e89d
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
If we use a NULL dev_desc, it causes data abort.
Change-Id: Iaf315f7f0ca4a8c33d4d4b809fffea35fc5dcc51
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
We hope user can have more clear purpose on entering hush shell,
this avoids some unexpected key hit during normal boot.
Update message from:
Hit any key to stop autoboot: 5 => Hit key to stop autoboot('CTRL+C'): 5
Change-Id: Ifb1b594dc38f92fa38e2c2b8a9a576e38bbdf03e
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
- only allow "boot_android" as bootcmd;
- enter rockusb or fastboot when boot failed;
- don't allow ctrl+c to enter hush;
Change-Id: I7a67f4b738ed78370f19fe2c8c920a5abc104b4b
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
If we don't enable initr_serial(), even after relocation done, the
serial driver always use no relocation address of ns16550_serial_ops
which is setup in serial_init(). This makes abort issue when arm64 kernel
is load to overlap the ram area.
fixes: 064eb49314
(serial: ns16550: support using pre-loader serial)
Change-Id: Iab67010ba3712754c036ecb2aee76c13a0b200b6
Signed-off-by: Joseph Chen <chenjh@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>
rockchip platforms support both efi and rkparam partition types,
it helps a lot for debug.
Change-Id: I3ba3fe552ecd99c38112a1417eb6c22721a03242
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Split attestation key into AttestationKey.ec and AttestationKey.rsa,
then write to secure storage.
Change-Id: I8e00d602c4174a002e6ecad2e4cfa846f32a681f
Signed-off-by: Tony Xu <tony.xu@rock-chips.com>
- preloader would pass bootdev info;
- avoid going through all the possible bootdev;
- rename devtype_num_envset() to boot_devtype_init();
Change-Id: Ia047c744dc7aca97db97664fc92473e46ba102a9
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Keep same with ./common/bootm.c.
Don't rely on env_get_bootm_low() and env_get_bootm_size() since
they can't provide a confirm value, but bi_dram[...] it is.
Change-Id: I2c2b64e7b8dfa3c7b38a6498567a5af7248e7a1e
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
this patch fixes zboot.img boot up failed due to getting kernel
compress type failed(reading IH_COMP_NONE).
we need to read a few kernel image info, i.e. compress type.
Assume 2 blocks maybe enough.
fixes: ee465021fe
(android: support boot images packed with rockchip android hdr)
Change-Id: I140832a899102984aebaad160a3902cfc483bfeb
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
this avoids fdt being overriden when ramdisk relocation if
fdt is too close to lmb allocable high memory region.
fixes: 5af94f7887
(android: get fdt by suitable ways)
Change-Id: Iadd5854269d0832b0c0455c8423b9d4172768ce3
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
SPL need read data to IRAM for bl31(m0&data), but the SDHCI does
not support this path, we need to use DDR space as buffer.
The SDHCI driver do not have any error/warning if we set the
destination address to IRAM, and complete seems normally, but
the data is not transfer.
Change-Id: Ied9eed835961470bc87fda99a1565992c4103d9c
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
If the misc partition is nonexistent, it's still to be hope that get the
boot mode from GRF register.
Change-Id: I94e6a64b9433a0c95071e3ee380841b8fddf768d
Signed-off-by: Ziyuan Xu <xzy.xu@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>
- pass pre-loader serial configure by rk atags;
- it depends on serial aliases to find uart port;
- enabled by CONFIG_ROCKCHIP_USING_PRELOADER_SERIAL;
Change-Id: I6723cccc5e1f3dac77203b4cc19cdac631f5133b
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
if we would like to use kernel dtb, it must depends on nowhere
env to detect boot media and initialize it. After storage is
initialized, we switch env from nowhere to CONFIG_ENV_IS_IN_xxx=y,
nowhere env info will append or override to storage env.
Change-Id: Id1cf44d4b25dcaba3c142b283ed093bed0decafe
Signed-off-by: Joseph Chen <chenjh@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>
This reverts commit a80c59f488.
armv7 get new gd after relocation depends on gd->bd position, this
patch breaks the reserved memory layout.
Change-Id: Ic23fe79d8c6edf048774808f3a06be5e17ccf686
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
it promises reserve_board() not to overlay trust os memory.
Change-Id: I149de3b7956a63a80ab91c38c12c16b8709b9756
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
When CONFIG_USING_KERNEL_DTB is enabled, mmc has been initialized earlier.
Change-Id: If3d7374cbbd4e403d9627c44133bf5fd1aeb9af8
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>
commit 10be5b5d3a ("fdt: Pass the device serial number through
devicetree") introduce function fdt_root to pass a device serial
number to kernel through devicetree. But sometimes we may want
to generate the device serial number from kernel itself. So it's
better to have a configuration to enable/disable this function.
Change-Id: I9efd4fd63faca9ce5e44cade856993be251f4760
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
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>
- 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>
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>
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/)
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/)
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>
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>
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>
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>
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>
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>
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>
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>
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>
1. support adc value recognize;
2. support gpio value recognize;
Change-Id: I8bcbdd914405184d46029c4995c09b09e36c7ea3
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>
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>
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>
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>
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>
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>
Add API for rockchip pass uboot logo memory info to kernel.
Change-Id: Ib3bfadc381efae21359a43654493e8e0f4e67dd0
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
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>
Choose which partition to enter recovery and a/b depend
on CONFIG_ANDROID_AB.
Change-Id: I10d03f1c592702f857e6224566deea3a4d607788
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
The commit point is updated to google external/avb/
which commit point is cf8c56208d2d9643804a7f123b196c7ebc9af276.
Change-Id: I5a10a8a45d3e9e2c9d20d9b3d44946073c9a49ff
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
We need to get and update env if we need to read kernel dtb in board_init().
Note that the env is NOWHERE now, or else we need to init emmc first if
ENV_IS_IN_MMC.
Change-Id: I22685fea77315811f3ff2bac7fb29d3b9206be34
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
If the device support the AB system, must add the slot suffix
to partition.
Change-Id: Ibac54109dd937e22a76e6fa68e9fdd1c0be48cc1
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
1. use env_update() to combine bootargs which avoid variable repeat;
2. use env_delete() to delete legacy property: "initrd=0x...,0x,,,".
Change-Id: I5fd444a789df3f2ef9e527b9287e5173749cbb87
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
We are going to use a tiny dtb(with 'u-boot,dm-pre-reloc') in pre-relocate,
and then read kernel dtb and use it after relocate.
This feature only works with CONFIG_OF_LIVE enabled now.
Change-Id: I429ccd90ef562a96f2f7916255e7e427ce8f451d
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
This is a bug fix to:
534066e bootm: resever memory before any lmb_alloc()
the patch make distro boot hand.
Change-Id: I13634154daad211a2f51ee94043f6dfd57710eb3
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>