This commit is contained in:
刘可亮
2024-06-04 19:00:30 +08:00
parent 990c72f5be
commit 0a13af6a1d
1668 changed files with 342810 additions and 37726 deletions

View File

@@ -22,6 +22,26 @@
#define APPLICATION_PART "os"
#ifdef AIC_AB_SYSTEM_INTERFACE
#include <absystem.h>
char target[32] = { 0 };
#endif
static struct aic_partition *find_boot_part(struct aic_partition *part, char *name)
{
struct aic_partition *p = part;
while (p) {
if (!strcmp(p->name, name))
break;
p = p->next;
}
return p;
}
static int do_mmc_boot(int argc, char *argv[])
{
int ret = 0, mmc_id = 0;
@@ -57,13 +77,28 @@ static int do_mmc_boot(int argc, char *argv[])
}
part = parts;
while (part) {
if (!strcmp(part->name, APPLICATION_PART))
break;
part = part->next;
#ifdef AIC_AB_SYSTEM_INTERFACE
ret = aic_ota_check();
if (ret) {
printf("Aic ota check error.\n");
}
ret = aic_get_os_to_startup(target);
if (ret) {
printf("Aic get os fail, startup from %s default.\n", APPLICATION_PART);
part = find_boot_part(part, APPLICATION_PART);
} else {
part = find_boot_part(part, target);
printf("Start-up from %s\n", target);
}
#else
part = find_boot_part(part, APPLICATION_PART);
#endif
if (!part) {
printf("Failed to get application partition.\n");
goto out;
@@ -74,6 +109,7 @@ static int do_mmc_boot(int argc, char *argv[])
info.dev_type = DEVICE_MMC;
info.bl_len = MMC_BLOCK_SIZE;
entry_point = 0;
ret = spl_load_simple_fit(&info, &entry_point);
if (ret < 0)
goto out;