mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-29 16:10:58 +00:00
6b403ca4dc
Add code to support FWU_MULTI_BANK_UPDATE. The platform does not have gpt-partition storage for Banks and MetaData, rather it used SPI-NOR backed mtd regions for the purpose. Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
37 lines
773 B
C
37 lines
773 B
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*
|
|
* Copyright (c) 2023, Linaro Limited
|
|
*/
|
|
|
|
#include <efi_loader.h>
|
|
#include <fwu.h>
|
|
#include <fwu_mdata.h>
|
|
#include <memalign.h>
|
|
#include <mtd.h>
|
|
|
|
#define DFU_ALT_BUF_LEN 256
|
|
|
|
/* Generate dfu_alt_info from partitions */
|
|
void set_dfu_alt_info(char *interface, char *devstr)
|
|
{
|
|
ALLOC_CACHE_ALIGN_BUFFER(char, buf, DFU_ALT_BUF_LEN);
|
|
struct mtd_info *mtd;
|
|
int ret;
|
|
|
|
memset(buf, 0, sizeof(buf));
|
|
|
|
mtd_probe_devices();
|
|
|
|
mtd = get_mtd_device_nm("nor1");
|
|
if (IS_ERR_OR_NULL(mtd))
|
|
return;
|
|
|
|
ret = fwu_gen_alt_info_from_mtd(buf, DFU_ALT_BUF_LEN, mtd);
|
|
if (ret < 0) {
|
|
log_err("Error: Failed to generate dfu_alt_info. (%d)\n", ret);
|
|
return;
|
|
}
|
|
log_debug("Make dfu_alt_info: '%s'\n", buf);
|
|
|
|
env_set("dfu_alt_info", buf);
|
|
}
|