aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Anderson <dvander@google.com>2019-09-20 17:19:23 -0700
committerAlistair Delva <adelva@google.com>2020-10-02 07:16:53 -0700
commit2707b3b911d2d51a5a51833f21c8330242529d2c (patch)
tree619143c0b8e6e59f034fbbb5c694d2049138a3fc
parent5261aea124ce8ca2568639571f83cb1e84cef29c (diff)
downloadplatform_external_u-boot-2707b3b911d2d51a5a51833f21c8330242529d2c.tar.gz
platform_external_u-boot-2707b3b911d2d51a5a51833f21c8330242529d2c.tar.bz2
platform_external_u-boot-2707b3b911d2d51a5a51833f21c8330242529d2c.zip
ANDROID: Put system-as-root behind a compile-time flag.
For DAP devices (such as cuttlefish), we: - Do not specify "skip_initramfs" on the kernel command-line. We must always boot to the ramdisk. - Do not assume ramdisk boots to recovery. Instead, boot to the recovery partition for recovery mode. Bug: 141272741 Bug: 169336575 Test: cuttlefish boots Signed-off-by: David Anderson <dvander@google.com> [rammuthiah: Updated change to build post v2020.10 merge] Signed-off-by: Ram Muthiah <rammuthiah@google.com> Change-Id: I9e81047dd3d849764c78b09c47309faf56b892f5
-rw-r--r--common/android_bootloader.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/common/android_bootloader.c b/common/android_bootloader.c
index 46dd282d5e..95ac784748 100644
--- a/common/android_bootloader.c
+++ b/common/android_bootloader.c
@@ -16,6 +16,7 @@
#include <part.h>
#define ANDROID_PARTITION_BOOT "boot"
+#define ANDROID_PARTITION_RECOVERY "recovery"
#define ANDROID_PARTITION_SYSTEM "system"
#define ANDROID_ARG_SLOT_SUFFIX "androidboot.slot_suffix="
@@ -271,12 +272,16 @@ int android_bootloader_boot_flow(struct blk_desc *dev_desc,
{
enum android_boot_mode mode;
struct disk_partition boot_part_info;
- struct disk_partition system_part_info;
- int boot_part_num, system_part_num;
+ int boot_part_num;
int ret;
char *command_line;
char slot_suffix[3];
const char *mode_cmdline = NULL;
+ const char *boot_partition = ANDROID_PARTITION_BOOT;
+#ifdef CONFIG_ANDROID_SYSTEM_AS_ROOT
+ int system_part_num
+ struct disk_partition system_part_info;
+#endif
/* Determine the boot mode and clear its value for the next boot if
* needed.
@@ -286,16 +291,22 @@ int android_bootloader_boot_flow(struct blk_desc *dev_desc,
switch (mode) {
case ANDROID_BOOT_MODE_NORMAL:
+#ifdef CONFIG_ANDROID_SYSTEM_AS_ROOT
/* In normal mode, we load the kernel from "boot" but append
* "skip_initramfs" to the cmdline to make it ignore the
* recovery initramfs in the boot partition.
*/
mode_cmdline = "skip_initramfs";
+#endif
break;
case ANDROID_BOOT_MODE_RECOVERY:
+#ifdef CONFIG_ANDROID_SYSTEM_AS_ROOT
/* In recovery mode we still boot the kernel from "boot" but
* don't skip the initramfs so it boots to recovery.
*/
+#else
+ boot_partition = ANDROID_PARTITION_RECOVERY;
+#endif
break;
case ANDROID_BOOT_MODE_BOOTLOADER:
/* Bootloader mode enters fastboot. If this operation fails we
@@ -314,14 +325,14 @@ int android_bootloader_boot_flow(struct blk_desc *dev_desc,
/* Load the kernel from the desired "boot" partition. */
boot_part_num =
- android_part_get_info_by_name_suffix(dev_desc,
- ANDROID_PARTITION_BOOT,
+ android_part_get_info_by_name_suffix(dev_desc, boot_partition,
slot_suffix, &boot_part_info);
if (boot_part_num < 0)
return -1;
debug("ANDROID: Loading kernel from \"%s\", partition %d.\n",
boot_part_info.name, boot_part_num);
+#ifdef CONFIG_ANDROID_SYSTEM_AS_ROOT
system_part_num =
android_part_get_info_by_name_suffix(dev_desc,
ANDROID_PARTITION_SYSTEM,
@@ -331,15 +342,18 @@ int android_bootloader_boot_flow(struct blk_desc *dev_desc,
return -1;
debug("ANDROID: Using system image from \"%s\", partition %d.\n",
system_part_info.name, system_part_num);
+#endif
ret = android_image_load(dev_desc, &boot_part_info, kernel_address,
-1UL);
if (ret < 0)
return ret;
+#ifdef CONFIG_ANDROID_SYSTEM_AS_ROOT
/* Set Android root variables. */
env_set_ulong("android_root_devnum", dev_desc->devnum);
env_set_ulong("android_root_partnum", system_part_num);
+#endif
env_set("android_slotsufix", slot_suffix);
/* Assemble the command line */