Merge branch 'next-dev' into thunder-boot
This commit is contained in:
commit
ab6f8011c4
|
|
@ -242,26 +242,24 @@ out:
|
|||
return 0;
|
||||
}
|
||||
|
||||
int spl_get_partitions_sector(struct blk_desc *dev_desc, char *partition,
|
||||
u32 *sectors)
|
||||
int spl_ab_append_part_slot(struct blk_desc *dev_desc,
|
||||
const char *part_name,
|
||||
char *new_name)
|
||||
{
|
||||
disk_partition_t part_info;
|
||||
char part[10] = {0};
|
||||
char slot[3] = {0};
|
||||
char slot_suffix[3] = {0};
|
||||
|
||||
if (!partition || !sectors)
|
||||
return -EFAULT;
|
||||
if (!strcmp(part_name, "misc")) {
|
||||
strcat(new_name, part_name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
spl_get_current_slot(dev_desc, "misc", slot);
|
||||
if (strlen(partition) > 8)
|
||||
return -ENOMEM;
|
||||
if (spl_get_current_slot(dev_desc, "misc", slot_suffix)) {
|
||||
printf("%s: failed to get slot suffix !\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
strcat(part, partition);
|
||||
strcat(part, slot);
|
||||
if (part_get_info_by_name(dev_desc, part, &part_info) < 0)
|
||||
return -ENODEV;
|
||||
|
||||
*sectors = part_info.start;
|
||||
strcpy(new_name, part_name);
|
||||
strcat(new_name, slot_suffix);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
#include <common.h>
|
||||
#include <dm.h>
|
||||
#include <spl.h>
|
||||
#include <spl_ab.h>
|
||||
#include <spl_rkfw.h>
|
||||
#include <linux/compiler.h>
|
||||
#include <errno.h>
|
||||
|
|
@ -74,15 +73,6 @@ int mmc_load_image_raw_sector(struct spl_image_info *spl_image,
|
|||
load.bl_len = mmc->read_bl_len;
|
||||
load.read = h_spl_load_read;
|
||||
|
||||
#ifdef CONFIG_SPL_AB
|
||||
char trust_partition[] = "trust";
|
||||
char uboot_partition[] = "uboot";
|
||||
|
||||
spl_get_partitions_sector(mmc_get_blk_desc(mmc), trust_partition,
|
||||
&trust_sectors);
|
||||
spl_get_partitions_sector(mmc_get_blk_desc(mmc), uboot_partition,
|
||||
&uboot_sectors);
|
||||
#endif
|
||||
ret = spl_load_rkfw_image(spl_image, &load,
|
||||
trust_sectors,
|
||||
uboot_sectors,
|
||||
|
|
|
|||
39
disk/part.c
39
disk/part.c
|
|
@ -11,6 +11,9 @@
|
|||
#include <ide.h>
|
||||
#include <malloc.h>
|
||||
#include <part.h>
|
||||
#ifdef CONFIG_SPL_AB
|
||||
#include <spl_ab.h>
|
||||
#endif
|
||||
#include <ubifs_uboot.h>
|
||||
#ifdef CONFIG_ANDROID_AB
|
||||
#include <android_avb/avb_ops_user.h>
|
||||
|
|
@ -671,7 +674,6 @@ cleanup:
|
|||
return ret;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ANDROID_AB
|
||||
/*
|
||||
* For android A/B system, we append the current slot suffix quietly,
|
||||
* this takes over the responsibility of slot suffix appending from
|
||||
|
|
@ -688,14 +690,18 @@ int part_get_info_by_name(struct blk_desc *dev_desc, const char *name,
|
|||
part_drv = part_driver_lookup_type(dev_desc);
|
||||
if (!part_drv)
|
||||
return -1;
|
||||
#ifndef CONFIG_SPL_BUILD
|
||||
#if defined(CONFIG_ANDROID_AB) && !defined(CONFIG_SPL_BUILD)
|
||||
/* 1. Query partition with A/B slot suffix */
|
||||
if (rk_avb_append_part_slot(name, name_slot))
|
||||
return -1;
|
||||
#elif defined(CONFIG_SPL_AB) && defined(CONFIG_SPL_BUILD)
|
||||
if (spl_ab_append_part_slot(dev_desc, name, name_slot))
|
||||
return -1;
|
||||
#else
|
||||
strcpy(name_slot, name);
|
||||
#endif
|
||||
retry:
|
||||
debug("## Query partition(%d): %s\n", none_slot_try, name_slot);
|
||||
|
||||
for (i = 1; i < part_drv->max_entries; i++) {
|
||||
ret = part_drv->get_info(dev_desc, i, info);
|
||||
if (ret != 0) {
|
||||
|
|
@ -718,33 +724,6 @@ retry:
|
|||
return -1;
|
||||
}
|
||||
|
||||
#else
|
||||
int part_get_info_by_name(struct blk_desc *dev_desc, const char *name,
|
||||
disk_partition_t *info)
|
||||
{
|
||||
struct part_driver *part_drv;
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
part_drv = part_driver_lookup_type(dev_desc);
|
||||
if (!part_drv)
|
||||
return -1;
|
||||
for (i = 1; i < part_drv->max_entries; i++) {
|
||||
ret = part_drv->get_info(dev_desc, i, info);
|
||||
if (ret != 0) {
|
||||
/* no more entries in table */
|
||||
break;
|
||||
}
|
||||
if (strcmp(name, (const char *)info->name) == 0) {
|
||||
/* matched */
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
void part_set_generic_name(const struct blk_desc *dev_desc,
|
||||
int part_num, char *name)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,13 +24,16 @@ int spl_get_current_slot(struct blk_desc *dev_desc, char *partition,
|
|||
char *slot);
|
||||
|
||||
/*
|
||||
* spl_get_partitions_sector
|
||||
* spl_ab_append_part_slot
|
||||
*
|
||||
* @dev_desc: block description
|
||||
* @partition: partition name
|
||||
* @sectors: firmware load address
|
||||
* @part_name: partition name
|
||||
* @new_name: append the slot suffix
|
||||
*
|
||||
* return: 0 success, others fail.
|
||||
*/
|
||||
int spl_get_partitions_sector(struct blk_desc *dev_desc, char *partition,
|
||||
u32 *sectors);
|
||||
int spl_ab_append_part_slot(struct blk_desc *dev_desc,
|
||||
const char *part_name,
|
||||
char *new_name);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue