rockchip: resrouce_img: support a/b
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>
This commit is contained in:
parent
76c40fa69f
commit
2301a6f51c
|
|
@ -8,6 +8,10 @@
|
|||
#include <linux/list.h>
|
||||
#include <asm/arch/resource_img.h>
|
||||
#include <boot_rkimg.h>
|
||||
#ifdef CONFIG_ANDROID_AB
|
||||
#include <android_avb/libavb_ab.h>
|
||||
#include <android_avb/rk_avb_ops_user.h>
|
||||
#endif
|
||||
#ifdef CONFIG_ANDROID_BOOT_IMAGE
|
||||
#include <android_bootloader.h>
|
||||
#include <android_image.h>
|
||||
|
|
@ -183,6 +187,15 @@ static int init_resource_list(struct resource_img_hdr *hdr)
|
|||
if (mode == BOOT_MODE_RECOVERY)
|
||||
boot_partname = PART_RECOVERY;
|
||||
/* Read boot/recovery and chenc if this is an AOSP img */
|
||||
#ifdef CONFIG_ANDROID_AB
|
||||
char slot_suffix[3] = {0};
|
||||
|
||||
if (rk_avb_get_current_slot(slot_suffix))
|
||||
goto out;
|
||||
boot_partname = android_str_append(boot_partname, slot_suffix);
|
||||
if (boot_partname == NULL)
|
||||
goto out;
|
||||
#endif
|
||||
ret = part_get_info_by_name(dev_desc, boot_partname,
|
||||
&part_info);
|
||||
if (ret < 0) {
|
||||
|
|
|
|||
|
|
@ -33,6 +33,24 @@
|
|||
#define ANDROID_ARG_FDT_FILENAME "kernel.dtb"
|
||||
#endif
|
||||
|
||||
char *android_str_append(char *base_name, char *slot_suffix)
|
||||
{
|
||||
char *part_name;
|
||||
size_t part_name_len;
|
||||
|
||||
part_name_len = strlen(base_name) + 1;
|
||||
if (slot_suffix)
|
||||
part_name_len += strlen(slot_suffix);
|
||||
part_name = malloc(part_name_len);
|
||||
if (!part_name)
|
||||
return NULL;
|
||||
strcpy(part_name, base_name);
|
||||
if (slot_suffix && (slot_suffix[0] != '\0'))
|
||||
strcat(part_name, slot_suffix);
|
||||
|
||||
return part_name;
|
||||
}
|
||||
|
||||
int android_bootloader_message_load(
|
||||
struct blk_desc *dev_desc,
|
||||
const disk_partition_t *part_info,
|
||||
|
|
|
|||
|
|
@ -77,4 +77,13 @@ int android_bootloader_boot_kernel(unsigned long kernel_address);
|
|||
*/
|
||||
int android_boot_flow(unsigned long kernel_address);
|
||||
|
||||
/** str_append- add str to tail.
|
||||
*
|
||||
* @base_name: base name address.
|
||||
* @slot_suffix: suffix.
|
||||
*
|
||||
* @return (base name + suffix)address.
|
||||
*/
|
||||
char *android_str_append(char *base_name, char *slot_suffix);
|
||||
|
||||
#endif /* __ANDROID_BOOTLOADER_H */
|
||||
|
|
|
|||
Loading…
Reference in New Issue