Merge "platform: msm8952: Add SDM429w support to msm8952"
diff --git a/AndroidBoot.mk b/AndroidBoot.mk
index 8697f7d..6c67721 100644
--- a/AndroidBoot.mk
+++ b/AndroidBoot.mk
@@ -51,6 +51,12 @@
VERIFIED_BOOT_2 := VERIFIED_BOOT_2=0
endif
+ifeq ($(PRODUCT_USE_DYNAMIC_PARTITIONS),true)
+ DYNAMIC_PARTITION_SUPPORT := DYNAMIC_PARTITION_SUPPORT=1
+else
+ DYNAMIC_PARTITION_SUPPORT := DYNAMIC_PARTITION_SUPPORT=0
+endif
+
ifeq ($(BOARD_DTBO_NOT_SUPPORTED),true)
TARGET_DTBO_NOT_SUPPORTED := TARGET_DTBO_NOT_SUPPORTED=1
else
@@ -125,7 +131,7 @@
# ELF binary for ABOOT
TARGET_ABOOT_ELF := $(PRODUCT_OUT)/aboot.elf
$(TARGET_ABOOT_ELF): ABOOT_CLEAN | $(ABOOT_OUT)
- $(MAKE) -C $(LK_PATH) TOOLCHAIN_PREFIX=$(CROSS_COMPILE) BOOTLOADER_OUT=$(CROOT_DIR)/$(ABOOT_OUT) $(BOOTLOADER_PLATFORM) $(EMMC_BOOT) $(SIGNED_KERNEL) $(VERIFIED_BOOT) $(VERIFIED_BOOT_2) $(TARGET_DTBO_NOT_SUPPORTED) $(ENABLE_DISPLAY) $(ENABLE_KASLRSEED) $(ENABLE_BOOTDEVICE_MOUNT) $(DEVICE_STATUS) $(BUILD_VARIANT) $(BOARD_NAME) $(ENABLE_VB_ATTEST) $(OSVERSION_IN_BOOTIMAGE) $(QSEECOM_SECAPP_REGION_2MB) $(TARGET_USE_SYSTEM_AS_ROOT_IMAGE)
+ $(MAKE) -C $(LK_PATH) TOOLCHAIN_PREFIX=$(CROSS_COMPILE) BOOTLOADER_OUT=$(CROOT_DIR)/$(ABOOT_OUT) $(BOOTLOADER_PLATFORM) $(EMMC_BOOT) $(SIGNED_KERNEL) $(VERIFIED_BOOT) $(VERIFIED_BOOT_2) $(TARGET_DTBO_NOT_SUPPORTED) $(ENABLE_DISPLAY) $(ENABLE_KASLRSEED) $(ENABLE_BOOTDEVICE_MOUNT) $(DEVICE_STATUS) $(BUILD_VARIANT) $(BOARD_NAME) $(ENABLE_VB_ATTEST) $(OSVERSION_IN_BOOTIMAGE) $(QSEECOM_SECAPP_REGION_2MB) $(TARGET_USE_SYSTEM_AS_ROOT_IMAGE) $(DYNAMIC_PARTITION_SUPPORT)
# NAND variant output
TARGET_NAND_BOOTLOADER := $(PRODUCT_OUT)/appsboot.mbn
@@ -154,7 +160,7 @@
# Top level for eMMC variant targets
$(TARGET_EMMC_BOOTLOADER): emmc_appsbootldr_clean | $(EMMC_BOOTLOADER_OUT) $(INSTALLED_KEYSTOREIMAGE_TARGET)
- $(MAKE) -C $(LK_PATH) TOOLCHAIN_PREFIX=$(CROSS_COMPILE) BOOTLOADER_OUT=$(CROOT_DIR)/$(EMMC_BOOTLOADER_OUT) $(BOOTLOADER_PLATFORM) EMMC_BOOT=1 $(SIGNED_KERNEL) $(VERIFIED_BOOT) $(VERIFIED_BOOT_2) $(TARGET_DTBO_NOT_SUPPORTED) $(ENABLE_DISPLAY) $(ENABLE_KASLRSEED) $(ENABLE_BOOTDEVICE_MOUNT) $(DEVICE_STATUS) $(BUILD_VARIANT) $(BOARD_NAME) $(ENABLE_VB_ATTEST) $(OSVERSION_IN_BOOTIMAGE) $(ENABLE_BG_SUPPORT) $(QSEECOM_SECAPP_REGION_2MB) $(TARGET_USE_SYSTEM_AS_ROOT_IMAGE)
+ $(MAKE) -C $(LK_PATH) TOOLCHAIN_PREFIX=$(CROSS_COMPILE) BOOTLOADER_OUT=$(CROOT_DIR)/$(EMMC_BOOTLOADER_OUT) $(BOOTLOADER_PLATFORM) EMMC_BOOT=1 $(SIGNED_KERNEL) $(VERIFIED_BOOT) $(VERIFIED_BOOT_2) $(TARGET_DTBO_NOT_SUPPORTED) $(ENABLE_DISPLAY) $(ENABLE_KASLRSEED) $(ENABLE_BOOTDEVICE_MOUNT) $(DEVICE_STATUS) $(BUILD_VARIANT) $(BOARD_NAME) $(ENABLE_VB_ATTEST) $(OSVERSION_IN_BOOTIMAGE) $(ENABLE_BG_SUPPORT) $(QSEECOM_SECAPP_REGION_2MB) $(TARGET_USE_SYSTEM_AS_ROOT_IMAGE) $(DYNAMIC_PARTITION_SUPPORT)
# Keep build NAND & eMMC as default for targets still using TARGET_BOOTLOADER
TARGET_BOOTLOADER := $(PRODUCT_OUT)/EMMCBOOT.MBN
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index 534db14..ea90598 100644
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -2,7 +2,7 @@
* Copyright (c) 2009, Google Inc.
* All rights reserved.
*
- * Copyright (c) 2009-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2009-2019, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -1504,7 +1504,8 @@
/* For a/b recovery image code is on boot partition.
If we support multislot, always use boot partition. */
if (boot_into_recovery &&
- (!partition_multislot_is_supported()))
+ ((!partition_multislot_is_supported()) ||
+ (target_dynamic_partition_supported())))
ptn_name = "recovery";
else
ptn_name = "boot";
@@ -4387,6 +4388,40 @@
return;
}
+#if DYNAMIC_PARTITION_SUPPORT
+void cmd_reboot_fastboot(const char *arg, void *data, unsigned sz)
+{
+ dprintf(INFO, "rebooting the device - userspace fastboot\n");
+ if (send_recovery_cmd(RECOVERY_BOOT_FASTBOOT_CMD)) {
+ dprintf(CRITICAL, "ERROR: Failed to update recovery commands\n");
+ fastboot_fail("Failed to update recovery command");
+ return;
+ }
+ fastboot_okay("");
+ reboot_device(REBOOT_MODE_UNKNOWN);
+
+ //shouldn't come here.
+ dprintf(CRITICAL, "ERROR: Failed to reboot device\n");
+ return;
+}
+
+void cmd_reboot_recovery(const char *arg, void *data, unsigned sz)
+{
+ dprintf(INFO, "rebooting the device - recovery\n");
+ if (send_recovery_cmd(RECOVERY_BOOT_RECOVERY_CMD)) {
+ dprintf(CRITICAL, "ERROR: Failed to update recovery commands\n");
+ fastboot_fail("Failed to update recovery command");
+ return;
+ }
+ fastboot_okay("");
+ reboot_device(REBOOT_MODE_UNKNOWN);
+
+ //shouldn't come here.
+ dprintf(CRITICAL, "ERROR: Failed to reboot device\n");
+ return;
+}
+#endif
+
void cmd_reboot_bootloader(const char *arg, void *data, unsigned sz)
{
dprintf(INFO, "rebooting the device\n");
@@ -4910,6 +4945,10 @@
{"oem off-mode-charge", cmd_oem_off_mode_charger},
{"oem select-display-panel", cmd_oem_select_display_panel},
{"set_active",cmd_set_active},
+#if DYNAMIC_PARTITION_SUPPORT
+ {"reboot-fastboot",cmd_reboot_fastboot},
+ {"reboot-recovery",cmd_reboot_recovery},
+#endif
#if UNITTEST_FW_SUPPORT
{"oem run-tests", cmd_oem_runtests},
#endif
@@ -4988,6 +5027,8 @@
fastboot_publish("battery-voltage", (const char *) battery_voltage);
fastboot_publish("battery-soc-ok", (const char *) battery_soc_ok);
#endif
+ if (target_dynamic_partition_supported())
+ fastboot_publish("is-userspace", "no");
}
void aboot_init(const struct app_descriptor *app)
diff --git a/app/aboot/recovery.c b/app/aboot/recovery.c
index 0cc2ceb..389b91d 100644
--- a/app/aboot/recovery.c
+++ b/app/aboot/recovery.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2010-2017,2019 The Linux Foundation. All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -241,7 +241,7 @@
sizeof(msg.command), msg.command);
}
- if (!strcmp("boot-recovery",msg.command))
+ if (!strcmp(RECOVERY_BOOT_RECOVERY_CMD, msg.command))
{
if(!strcmp("RADIO",msg.status))
{
@@ -267,6 +267,12 @@
return 0;
}
+ if (target_dynamic_partition_supported() &&
+ !strcmp(RECOVERY_BOOT_FASTBOOT_CMD, msg.command)) {
+ boot_into_recovery = 1; // Boot in userspace fastboot mode
+ return 0;
+ }
+
if (!strcmp("update-radio",msg.command)) {
dprintf(INFO,"start radio update\n");
valid_command = 1;
@@ -369,6 +375,28 @@
return 0;
}
+/* Generic funcition to write misc commands. */
+int send_recovery_cmd(const char *command)
+{
+ struct recovery_message msg;
+ int status = 0;
+ memset(&msg, 0, sizeof(msg));
+
+ /* Populate command to msg */
+ snprintf(msg.command,
+ sizeof(msg.command),
+ command);
+
+ dprintf(INFO,"Recovery command: %s\n", msg.command);
+ if (target_is_emmc_boot())
+ /* Update emmc partition */
+ status = emmc_set_recovery_msg(&msg);
+ else
+ status = set_recovery_message(&msg);
+
+ return status;
+}
+
int _emmc_recovery_init(void)
{
int update_status = 0;
@@ -394,7 +422,12 @@
sizeof(msg->command), msg->command);
}
- if (!strcmp(msg->command, "boot-recovery")) {
+ if (!strcmp(msg->command, RECOVERY_BOOT_RECOVERY_CMD)) {
+ boot_into_recovery = 1;
+ }
+
+ if (target_dynamic_partition_supported() &&
+ !strcmp(msg->command, RECOVERY_BOOT_FASTBOOT_CMD)) {
boot_into_recovery = 1;
}
diff --git a/app/aboot/recovery.h b/app/aboot/recovery.h
index 177148a..da7d400 100644
--- a/app/aboot/recovery.h
+++ b/app/aboot/recovery.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2010-2017,2019 The Linux Foundation. All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -38,6 +38,9 @@
#define BOOTSELECT_FORMAT (1 << 31)
#define BOOTSELECT_FACTORY (1 << 30)
+#define RECOVERY_BOOT_RECOVERY_CMD "boot-recovery"
+#define RECOVERY_BOOT_FASTBOOT_CMD "boot-fastboot"
+
/* bootselect partition format structure */
struct boot_selection_info {
uint32_t signature; // Contains value BOOTSELECT_SIGNATURE defined above
@@ -78,7 +81,7 @@
int get_recovery_message(struct recovery_message *out);
int set_recovery_message(const struct recovery_message *in);
-
+int send_recovery_cmd(const char *command);
int recovery_init (void);
/* This function will look for the ffbm cookie in the misc partition.
* Upon finding a valid cookie it will return 1 and place the cookie
diff --git a/include/target.h b/include/target.h
index 0a0e545..d4b2416 100644
--- a/include/target.h
+++ b/include/target.h
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2008 Travis Geiselbrecht
*
- * Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2017,2019 The Linux Foundation. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files
@@ -104,6 +104,7 @@
void pmic_reset_configure(uint8_t reset_type);
bool is_display_disabled(void);
bool target_uses_system_as_root(void);
+bool target_dynamic_partition_supported(void);
struct qmp_reg *target_get_qmp_settings();
int target_get_qmp_regsize();
uint32_t target_ddr_cfg_reg();
diff --git a/makefile b/makefile
index f6da064..9822cc5 100644
--- a/makefile
+++ b/makefile
@@ -127,6 +127,10 @@
DEFINES += _SIGNED_KERNEL=1
endif
+ifeq ($(DYNAMIC_PARTITION_SUPPORT),1)
+ DEFINES += DYNAMIC_PARTITION_SUPPORT=1
+endif
+
ifeq ($(TARGET_DTBO_NOT_SUPPORTED),1)
DEFINES += TARGET_DTBO_NOT_SUPPORTED=1
endif
diff --git a/target/init.c b/target/init.c
index c907da3..ce7e0b8 100644
--- a/target/init.c
+++ b/target/init.c
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2008 Travis Geiselbrecht
*
- * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files
@@ -278,6 +278,16 @@
return false;
}
+/* Check dynamic partition support is enabled for target */
+bool target_dynamic_partition_supported(void)
+{
+#if DYNAMIC_PARTITION_SUPPORT
+ return true;
+#else
+ return false;
+#endif
+}
+
/* Default CFG register value */
uint32_t target_ddr_cfg_reg()
{