Commit Graph

123 Commits

Author SHA1 Message Date
Joseph Chen 4a2b8db466 common: add usbplug support
- disable some message
- add "usbplug.bin" generation
- add minimum usbplug dtb support
- add individual board_init_r() init sequence.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: If48ee49247fca6108db3a1fbab3b403241b3a8eb
2020-05-22 16:58:04 +08:00
Joseph Chen d45e5655df dm: serial: allow skip console serial init
Always use debug uart.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Id751856abd7be219e8acb4c5986469a804051934
2020-05-22 16:46:40 +08:00
Joseph Chen e7be2a072c Kconfig: disable CLI for verified-boot
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I09acae3dda1a886629d0f9901b4c95059cdd8b42
2020-04-10 14:17:32 +08:00
Joseph Chen 37526a5172 common: support disable CLI for verified-boot
Not allow any interactive from CLI.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I207da3f2c54df1a81100c404f045023ac763da73
2020-03-28 18:21:16 +08:00
Joseph Chen c15f307504 arm: Kconfig: default select SKIP_RELOCATE_UBOOT if !ARM64
Remove select from rockchip Kconfig.

Some 32-bit platforms needs relocation to support non-compressed
kernel image.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I0b60b79d7c67c5bd8439bd55bb277522c74a8bdd
2020-03-13 17:35:40 +08:00
Joseph Chen c484df2f85 common: android: refactor image load and sha1 verify
Unify single image load/memcpy to image_read(), containing
sha1 update.

Not support verify image by RK legacy mkbootimg tools.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Ide88d2dda79f3335a6c34e41bdce56eac0d66408
2019-12-10 12:48:27 +08:00
Joseph Chen 3f7fb06b24 common: android: make image separate load mandory
Since this feature is stable and helpful to save boot time,
let't make it mandory.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I36f244c6d319d6b54ed3d54730352c8d5b4cc6bd
2019-12-10 12:47:52 +08:00
Joseph Chen c641fb242b common: Kconfig: select SHA1 if !DM_CRYPTO for android image verify
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Id010fe3e5947ad19fdba8a2dd97f421d83282105
2019-11-27 20:53:34 +08:00
Joseph Chen 0cb72e53ea common: android: add image hash verify support
- mkbootimg tool always use SHA1 for images;
- make the the crypto higher priority;
- AVB images does not need this verify;

Change-Id: I543a3a53da61b920b83ba464a71959518437c436
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-08-29 13:03:17 +08:00
Kever Yang 92da45ec70 treewide: Migrate CONFIG_BOARD_EARLY_INIT_R to Kconfig
Migrate the CONFIG_BOARD_EARLY_INIT_R option to Kconfig.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>

Change-Id: I92483d7ecb8f2449eda4b3cdd3bc5ede45ae6c8d
2019-08-06 10:28:41 +08:00
Joseph Chen c7abde102f common: console: support disable console in & out
Set CONFIG_DISABLE_CONSOLE priority higher than CONFIG_DEBUG_UART,
otherwise there maybe some early message is printed by CONFIG_DEBUG_UART.

Change-Id: I235a49646b154e10e724e3d63e0ceecdd862c636
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-07-19 11:36:41 +08:00
Joseph Chen 5bb5aa82d3 common: console: optimize console record
- fix: passing argument 1 of ‘membuff_new’ discards ‘volatile’ qualifier from pointer target type;
- add console_record_print_purge();
- set default CONSOLE_RECORD_OUT_SIZE value for rockchip;

Change-Id: Id247d590b677cd2cff95bc5e66963b0ff07b0658
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-05-09 18:07:45 +08:00
Joseph Chen 590d13d737 console: add CONFIG_CONSOLE_DISABLE_CTRLC to disable ctrlc
There are sometimes we would like to disable ctrlc, just enable it.

Change-Id: I2911650b22d47b057a039774d8293cad6317bb6d
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-03-20 15:07:59 +08:00
Joseph Chen 644e344181 android: support loading android image separate
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>
2019-01-24 15:33:12 +08:00
Jian Qiu c2ba77d93f lib: optee_client: Extract keymaster CA module
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>
2019-01-18 09:09:34 +08:00
Tony Xu dfbf26e839 lib: optee_client: move keybox code to write_keybox.c
Change-Id: Ifcd9962a8b802ee2bcbdbd0e88effb4485e5963a
Signed-off-by: Tony Xu <tony.xu@rock-chips.com>
2019-01-16 18:10:16 +08:00
Joseph Chen 645a442d90 common: support skip U-Boot relocation
Change-Id: I8640907204c82928c2fb07177835dc55a126aaf0
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-12-01 11:47:26 +08:00
Andy Yan 5f08e86fd7 fdt: add config to enable/disable fdt_root function
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>
2018-08-09 10:40:57 +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
Jason Zhu b666ac0523 android: support android verified boot(AVB)
Define CONFIG_ANDROID_AVB to open avb.

Change-Id: Iae0306391e403b25aa454205dd5a70a578752aba
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2018-02-10 10:48:34 +08:00
Simon Glass 73991b074b log: Add a test command
Add a command which exercises the logging system.

Change-Id: I4eb139b69937c752d7f6fc42dde3f757260b832b
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit ef11ed8239bf02b347e7fb9fc6d980aec0c7810a)
2018-01-17 15:27:28 +08:00
Simon Glass 5cafef2de2 UPSTREAM: log: Add a console driver
It is useful to display log messages on the console. Add a simple driver
to handle this.

Note that this driver outputs to the console, which may be serial or
video. It does not specifically select serial output.

Change-Id: I3626673a306557400584e673f9725e74ecbaaf98
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit c6d47535dfb6636ae5244958a2a9e043bb7646ae)
2018-01-17 15:27:28 +08:00
Simon Glass 9530301c66 log: Add an implementation of logging
Add the logging header file and implementation with some configuration
options to control it.

Change-Id: Ic711fa39ba3183b288170ebdd4bfdf0a9e472bad
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit e9c8d49d54cbbc7b219a1637d2994de7448b767d)
2018-01-17 15:27:28 +08:00
Jean-Jacques Hiblot 2bbcffb1d3 UPSTREAM: dts: renamed FIT_EMBED to MULTI_DTB_FIT and moved it to the dts Kconfig
CONFIG_FIT_EMBED might be confused with CONFIG_OF_EMBED, rename it
MULTI_DTB_FIT as it is able to get a DTB from a FIT image containing
multiple DTBs. Also move the option to the Kconfig dedicated to the DTS
options and create a README for this feature.

Change-Id: Ide55c474339db3ccd5e20499c54c8bb41fe3a2c9
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 11955590a284ecb75892aad5f1174ca1b94a709b)
2018-01-17 15:27:28 +08:00
Tom Rini bcf5156aaa UPSTREAM: common: Drop LOGLEVEL to 4
While this came in with a default value of 6 I am lowering this to 4.
The MTD/UBI code has a large number of error messages that we include
now.  In addition, "normally" warning messages are not included so this
feels like a more natural level to have.

Change-Id: I20bc4b32caf1876d5f6052851580383f00a67dc9
Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 6a3e65dea3e525b5337ca8014aa4be9f5fafeb92)
2018-01-17 15:27:28 +08:00
Masahiro Yamada a9a4552a1c UPSTREAM: printk: collect printk stuff into <linux/printk.h> with loglevel support
When we import code from Linux, with regular re-sync planned, we want
to use printk() and pr_*().  U-Boot does not support them in a clean
way.  So, people end up with local macros, or compat headers here and
there, then we occasionally see build errors of definition conflicts.

We have include/linux/compat.h, but putting all sorts of unrelated
things into a single header is just a temporal workaround.  Hence this
patch, to find the best home for all printk variants.  If you want to
use printk() and friends, please include <linux/printk.h>.  This header
is self-contained, and pulls in only a few headers.

When I was testing this clean-up, I noticed the image size exceeded
its platform limit on some boards.  This is because all pr_*() that
were previously defined as no-op in include/linux/mtd/mtd.h (unless
CONFIG_MTD_DEBUG is set), are now enabled.

To make such boards happy, this commit also implements CONFIG_LOGLEVEL.
The concept is similar to the kernel parameter "loglevel".  (Actually,
the Kconfig help message was taken from kernel-paremeter.txt of Linux)
Messages with a loglevel smaller than console loglevel will be printed.

The difference is the loglevel is build-time determined.  To save the
image size, lower priority pr_*() are compiled out.  I set the default
of CONFIG_LOGLEVEL to 6, i.e. pr_notice and higher priority messages
are compiled in.

I adjusted CONFIG_LOGLEVEL to avoid build error for some boards.

Change-Id: I997d8bbeedd48777be87472df8ed126181fc4b8e
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Add in SPL_LOGLEVEL that is the same as LOGLEVEL]
Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit b44b30260ffa3dc82f4bb98b022483bb09e95353)
2018-01-17 15:27:28 +08:00
Alex Deymo 180cc7c601 android: Implement A/B slot select.
The android_bootloader_control struct defined in bootloader_message.h
stored the A/B metadata used to decide which slot should we use to boot
the device. This patch implements the bootloader side of the slot
selection in a new "android_ab_select" command which decides the
current slot and updates the metadata as needed.

Bug: 32707546
Test: Booted a rpi3, updated to the other slot.
Change-Id: I9344ff5b76194160d2b466a50e84f4f423b1a98a
2017-11-14 10:55:46 +08:00
Alex Deymo 67dac67453 Initial support for the Android Bootloader flow
An Android Bootloader must comply with certain boot modes and change
the kernel command line accordingly. This patch introduces the Android
boot mode concept which determines whether the device should boot to
one of the following:
 * recovery: which should boot to the recovery image,
 * bootloader: which should boot to the "bootloader" (fastboot) and
 * normal: which should boot to the system image.

The boot mode is determined in part by the Boot Control Block (BCB)
which is stored at the beginning of the "misc" partition. The BCB
is defined in the "bootloader_message.h" file in AOSP, now copied
here as android_bootloader_message.h with minor modifications.

This patch implements the basic boot flow that loads and boots an
Android kernel image assuming an A/B device which implies that it uses
boot as recovery (BOARD_USES_RECOVERY_AS_BOOT in the BoardConfig.mk).
This means that the recovery image shares the same kernel with the
normal boot system image, but stores the recovery image as a ramdisk
which is not used in normal mode.

Among the limitations, this patch doesn't implement the A/B slot
selection, it only boots from the slot "a".

Bug: 31887729
Test: Booted a rpi3 with this flow.

Signed-off-by: Alex Deymo <deymo@google.com>
Change-Id: Ia2932c6f398f1ae713f0cd9670828f84103dca38
update setenv/getenv to env_set/env_get.
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2017-11-14 10:55:46 +08:00
Simon Glass 0649cd0d49 Move environment files from common/ to env/
About a quarter of the files in common/ relate to the environment. It
seems better to put these into their own subdirectory and remove the
prefix.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2017-08-15 08:18:45 -04:00
Sam Protsenko 5abc1a4523 common: Move CONFIG_BOOTARGS to Kconfig
Also introduce CONFIG_USE_BOOTARGS option so we can control if
CONFIG_BOOTARGS defined at all.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
[trini: Resync r8a779[56]_ulcb, various ls10xx targets]
Signed-off-by: Tom Rini <trini@konsulko.com>
2017-08-14 17:06:06 -04:00
Bin Meng 5d89b37f71 x86: kconfig: Select ARCH_EARLY_INIT_R in the platform Kconfig
This is architecture-dependent early initialization hence should
be put in the platform Kconfig.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2017-08-01 20:17:02 +08:00
Bin Meng 30b1ecd265 x86: kconfig: Let board select BOARD_EARLY_INIT_F
CONFIG_BOARD_EARLY_INIT_F literally indicates board-specific codes
and should be not 'default y' for all x86 boards.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2017-08-01 20:17:02 +08:00
Tom Rini 43ba3c59cb env: Migrate CONFIG_ENV_IS_IN_FAT options to Kconfig
We rename the various FAT_ENV_xxx options to CONFIG_ENV_FAT_xxx so that
they can be modified via Kconfig.  Migrate all existing users to the new
values.

Signed-off-by: Tom Rini <trini@konsulko.com>
2017-07-31 11:22:56 -04:00
Simon Glass 609bf92411 Convert CONFIG_ENV_IS_IN_ONENAND to Kconfig
This converts the following to Kconfig:
   CONFIG_ENV_IS_IN_ONENAND

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-07-25 21:34:39 -04:00
Simon Glass b31e065f89 Convert CONFIG_ENV_IS_IN_FAT to Kconfig
This converts the following to Kconfig:
   CONFIG_ENV_IS_IN_FAT

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-07-25 21:34:15 -04:00
Simon Glass 337cd3f211 Convert CONFIG_ENV_IS_IN_REMOTE to Kconfig
This converts the following to Kconfig:
   CONFIG_ENV_IS_IN_REMOTE

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-07-25 21:33:22 -04:00
Simon Glass 91c868fe7c Convert CONFIG_ENV_IS_IN_SPI_FLASH to Kconfig
This converts the following to Kconfig:
   CONFIG_ENV_IS_IN_SPI_FLASH

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-07-25 21:31:03 -04:00
Simon Glass ef6253d7b3 Convert CONFIG_ENV_IS_IN_DATAFLASH to Kconfig
This converts the following to Kconfig:
   CONFIG_ENV_IS_IN_DATAFLASH

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-07-25 21:24:09 -04:00
Simon Glass f0bc2b542b Convert CONFIG_ENV_IS_IN_EEPROM to Kconfig
This converts the following to Kconfig:
   CONFIG_ENV_IS_IN_EEPROM

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-07-25 21:22:56 -04:00
Simon Glass 88b233a347 Convert CONFIG_ENV_IS_IN_NVRAM to Kconfig
This converts the following to Kconfig:
   CONFIG_ENV_IS_IN_NVRAM

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-07-25 21:21:24 -04:00
Simon Glass 85fc970d74 Convert CONFIG_ENV_IS_IN_FLASH to Kconfig
This converts the following to Kconfig:
   CONFIG_ENV_IS_IN_FLASH

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-07-25 21:20:02 -04:00
Simon Glass e73496d08e env: Move help from README to Kconfig
The CONFIG_ENV_IS_IN_... options which have already been converted to
Kconfig only have a small amount of help. Move the rest of it over from
the README.

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-07-25 21:08:07 -04:00
Simon Glass 2be296538e Convert CONFIG_ENV_IS_IN_MMC/NAND/UBI and NOWHERE to Kconfig
This converts the following to Kconfig:
   CONFIG_ENV_IS_IN_MMC
   CONFIG_ENV_IS_IN_NAND
   CONFIG_ENV_IS_IN_UBI
   CONFIG_ENV_IS_NOWHERE

In fact this already exists for sunxi as a 'choice' config. However not
all the choices are available in Kconfig yet so we cannot use that. It
would lead to more than one option being set.

In addition, one purpose of this series is to allow the environment to be
stored in more than one place. So the existing choice is converted to a
normal config allowing each option to be set independently.

There are not many opportunities for Kconfig updates to reduce the size of
this patch. This was tested with

   ./tools/moveconfig.py -i CONFIG_ENV_IS_IN_MMC

And then manual updates.  This is because for CHAIN_OF_TRUST boards they
can only have ENV_IS_NOWHERE set, so we enforce that via Kconfig logic
now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
2017-07-25 21:08:01 -04:00
Simon Glass d63b5b4fbb sandbox: Enable more console options
Enable the pre-console buffer, displaying the model and post-relocation
console announce on sandbox. Also add a model name to the device tree.
This allows testing of these features.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
2017-07-11 10:08:20 -06:00
Cooper Jr., Franklin af9e6ad4ab board_f: Add new function to allow runtime DTB selection
Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2017-07-10 14:25:54 -04:00
Cooper Jr., Franklin 92926bc80c boot_fit: Create helper functions that can be used to select DTB out of FIT
Some platforms may append a FIT image to the U-boot image. This function
aids in parsing the FIT image and selecting the correct DTB at runtime.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2017-07-10 14:25:50 -04:00
Heiko Schocher 064b55cfcb powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x
There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>
2017-06-16 10:14:55 -04:00
Simon Glass 824bb1b453 bootstage: Support SPL
At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-05 14:13:08 -04:00
Simon Glass 03ecac3149 bootstage: Use rec_count as the array index
At present bootstage has a large array with all possible bootstage IDs
recorded. It adds times to the array element indexed by the ID. This is
inefficient because many IDs are not used during boot. We can save space
by only recording those IDs which actually have timestamps.

Update the array to use a record count, which increments with each
addition of a new timestamp. This takes longer to record a time, since it
may involve an array search. Such a search may be particularly expensive
before relocation when the CPU is running slowly or the cache is off. But
at that stage there should be very few records.

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-05 14:13:05 -04:00
Simon Glass 5a0e275cbb bootstage: Change CONFIG_BOOTSTAGE_USER_COUNT to an int
There is no good read to make this hex, and integer is more natural for
this type of setting. Update it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-05 14:13:04 -04:00