ANDROID: 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
Bug: 141272741
Test: Booted a rpi3 with this flow.
Change-Id: I4b1ff93145b1d73dc250e1fc2c9ec005f8fe147e
Signed-off-by: Alex Deymo <deymo@google.com>
[astrachan: Merged in bits of CMD_LOAD_ANDROID, without the actual
            load_android command, to keep this change building]
Signed-off-by: Alistair Strachan <astrachan@google.com>
Signed-off-by: David Anderson <dvander@google.com>

Link: https://android-review.googlesource.com/c/platform/external/u-boot/+/1126443/7
Bug: https://baylibre.atlassian.net/browse/RITA-97
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
7 files changed