kernel: support FIT partition parser on mtdblock devices
Allow using the FIT block-device partition partition parser to work on top of mtdblock devices. This is more tricky than it sounds as it requires to reorganize the procedure of registering mtdblock devices in order to avoid locking troubles caused by the block partition parsers then trying to open the mtdblock device for reading while locks are still being held. Fix that by moving the adding of the disks after the entire device has been probed when locks no longer need to be held. Also address issue with mtdsuper surfaced when using sub-partitions which prevented mounting JFFS2 using the /dev/mtdblock* device. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
@@ -112,20 +112,19 @@ int parse_fit_partitions(struct parsed_partitions *state, u64 fit_start_sector,
|
||||
dsectors = (dsectors>sectors)?sectors:dsectors;
|
||||
|
||||
dsize = dsectors << SECTOR_SHIFT;
|
||||
printk(KERN_DEBUG "FIT: volume size: %llu sectors (%llu bytes)\n", dsectors, dsize);
|
||||
|
||||
size = fdt_totalsize(init_fit);
|
||||
printk(KERN_DEBUG "FIT: FDT structure size: %u bytes\n", size);
|
||||
|
||||
/* silently skip non-external-data legacy FIT images */
|
||||
if (size > PAGE_SIZE) {
|
||||
printk(KERN_ERR "FIT: FDT structure beyond page boundaries, use 'mkimage -E ...'!\n");
|
||||
put_page(page);
|
||||
return -ENOTSUPP;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (size >= dsize) {
|
||||
state->access_beyond_eod = 1;
|
||||
put_page(page);
|
||||
state->access_beyond_eod = (size >= dsize);
|
||||
return 0;
|
||||
return -EFBIG;
|
||||
}
|
||||
|
||||
fit = kmemdup(init_fit, size, GFP_KERNEL);
|
||||
@@ -158,7 +157,7 @@ int parse_fit_partitions(struct parsed_partitions *state, u64 fit_start_sector,
|
||||
config_description = fdt_getprop(fit, node, FIT_DESC_PROP, &config_description_len);
|
||||
config_loadables = fdt_getprop(fit, node, FIT_LOADABLE_PROP, &config_loadables_len);
|
||||
|
||||
printk(KERN_DEBUG "FIT: Default configuration: %s%s%s%s\n", config_default,
|
||||
printk(KERN_DEBUG "FIT: Default configuration: \"%s\"%s%s%s\n", config_default,
|
||||
config_description?" (":"", config_description?:"", config_description?")":"");
|
||||
|
||||
images = fdt_path_offset(fit, FIT_IMAGES_PATH);
|
||||
@@ -190,7 +189,7 @@ int parse_fit_partitions(struct parsed_partitions *state, u64 fit_start_sector,
|
||||
|
||||
image_description = fdt_getprop(fit, node, FIT_DESC_PROP, &image_description_len);
|
||||
|
||||
printk(KERN_DEBUG "FIT: %16s sub-image 0x%08x - 0x%08x '%s' %s%s%s\n",
|
||||
printk(KERN_DEBUG "FIT: %16s sub-image 0x%08x - 0x%08x \"%s\" %s%s%s\n",
|
||||
image_type, image_pos, image_pos + image_len, image_name,
|
||||
image_description?"(":"", image_description?:"", image_description?") ":"");
|
||||
|
||||
@@ -230,7 +229,7 @@ int parse_fit_partitions(struct parsed_partitions *state, u64 fit_start_sector,
|
||||
state->parts[*slot].has_info = true;
|
||||
|
||||
if (config_loadables && !strcmp(image_name, config_loadables)) {
|
||||
printk(KERN_DEBUG "FIT: selecting configured loadable %s to be root filesystem\n", image_name);
|
||||
printk(KERN_DEBUG "FIT: selecting configured loadable \"%s\" to be root filesystem\n", image_name);
|
||||
state->parts[*slot].flags |= ADDPART_FLAG_ROOTDEV;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user