mirror of
https://github.com/pengutronix/genimage.git
synced 2024-11-27 03:33:59 +08:00
image-hd: allow partitions that are not listed in the partition table
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
fa915c7d19
commit
38eb8cf230
@ -83,6 +83,7 @@ static cfg_opt_t partition_opts[] = {
|
||||
CFG_INT("partition-type", 0, CFGF_NONE),
|
||||
CFG_STR("image", NULL, CFGF_NONE),
|
||||
CFG_BOOL("autoresize", 0, CFGF_NONE),
|
||||
CFG_BOOL("in-partition-table", cfg_true, CFGF_NONE),
|
||||
CFG_END()
|
||||
};
|
||||
|
||||
@ -230,6 +231,7 @@ static int parse_partitions(struct image *image, cfg_t *imagesec)
|
||||
part->partition_type = cfg_getint(partsec, "partition-type");
|
||||
part->image = cfg_getstr(partsec, "image");
|
||||
part->autoresize = cfg_getbool(partsec, "autoresize");
|
||||
part->in_partition_table = cfg_getbool(partsec, "in-partition-table");
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -32,6 +32,7 @@ struct partition {
|
||||
const char *image;
|
||||
struct list_head list;
|
||||
int autoresize;
|
||||
int in_partition_table;
|
||||
const char *name;
|
||||
};
|
||||
|
||||
|
@ -64,6 +64,9 @@ static int hdimage_setup_mbr(struct image *image, char *part_table)
|
||||
list_for_each_entry(part, &image->partitions, list) {
|
||||
struct partition_entry *entry;
|
||||
|
||||
if (!part->in_partition_table)
|
||||
continue;
|
||||
|
||||
if (i > 3) {
|
||||
image_error(image, "cannot handle more than 4 partitions");
|
||||
return -EINVAL;
|
||||
@ -162,13 +165,13 @@ static int hdimage_setup(struct image *image, cfg_t *cfg)
|
||||
part->name, part->size);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (part->offset % align) {
|
||||
if (part->in_partition_table && (part->offset % align)) {
|
||||
image_error(image, "part %s offset (%lld) must be a"
|
||||
"multiple of %lld bytes\n",
|
||||
part->name, part->offset, align);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (part->offset) {
|
||||
if (part->offset || !part->in_partition_table) {
|
||||
if (now > part->offset) {
|
||||
image_error(image, "part %s overlaps with previous partition\n",
|
||||
part->name);
|
||||
|
Loading…
Reference in New Issue
Block a user