mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-09-27 23:20:26 +09:00
dfu: mmc: add support for in-partition offset
Add possibility to define a part of partition as a separate DFU entity. This allows to have more than one items on the given partition. The real use case for this option is TM2 board. It can use u-boot stored as Linux kernel on the defined partition (as RAW data) and load the real kernel from the same partition, but stored under the certain offset. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Acked-by: Lukasz Majewski <lukma@denx.de>
This commit is contained in:
parent
909338c345
commit
d2d8eab421
@ -352,6 +352,7 @@ int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *devstr, char *s)
|
|||||||
struct blk_desc *blk_dev = mmc_get_blk_desc(mmc);
|
struct blk_desc *blk_dev = mmc_get_blk_desc(mmc);
|
||||||
int mmcdev = second_arg;
|
int mmcdev = second_arg;
|
||||||
int mmcpart = third_arg;
|
int mmcpart = third_arg;
|
||||||
|
int offset = 0;
|
||||||
|
|
||||||
if (part_get_info(blk_dev, mmcpart, &partinfo) != 0) {
|
if (part_get_info(blk_dev, mmcpart, &partinfo) != 0) {
|
||||||
pr_err("Couldn't find part #%d on mmc device #%d\n",
|
pr_err("Couldn't find part #%d on mmc device #%d\n",
|
||||||
@ -359,9 +360,17 @@ int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *devstr, char *s)
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check for an extra entry at dfu_alt_info env variable
|
||||||
|
* specifying the mmc HW defined partition number
|
||||||
|
*/
|
||||||
|
if (s)
|
||||||
|
if (!strcmp(strsep(&s, " "), "offset"))
|
||||||
|
offset = simple_strtoul(s, NULL, 0);
|
||||||
|
|
||||||
dfu->layout = DFU_RAW_ADDR;
|
dfu->layout = DFU_RAW_ADDR;
|
||||||
dfu->data.mmc.lba_start = partinfo.start;
|
dfu->data.mmc.lba_start = partinfo.start + offset;
|
||||||
dfu->data.mmc.lba_size = partinfo.size;
|
dfu->data.mmc.lba_size = partinfo.size-offset;
|
||||||
dfu->data.mmc.lba_blk_size = partinfo.blksz;
|
dfu->data.mmc.lba_blk_size = partinfo.blksz;
|
||||||
} else if (!strcmp(entity_type, "fat")) {
|
} else if (!strcmp(entity_type, "fat")) {
|
||||||
dfu->layout = DFU_FS_FAT;
|
dfu->layout = DFU_FS_FAT;
|
||||||
|
Loading…
Reference in New Issue
Block a user