diff options
author | Daniel Golle <daniel@makrotopia.org> | 2021-04-03 00:41:30 +0100 |
---|---|---|
committer | Daniel Golle <daniel@makrotopia.org> | 2021-04-09 16:04:35 +0100 |
commit | 2809d0000744b77d5b6cef20f6d44eed75c35e6a (patch) | |
tree | bfc220a6c41f870b357ebd4f8f789a92c3b6c1fd /target/linux/generic/files | |
parent | ce14445b748db8fbc57bc3e619c69d3989ef3efc (diff) | |
download | upstream-2809d0000744b77d5b6cef20f6d44eed75c35e6a.tar.gz upstream-2809d0000744b77d5b6cef20f6d44eed75c35e6a.tar.bz2 upstream-2809d0000744b77d5b6cef20f6d44eed75c35e6a.zip |
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>
Diffstat (limited to 'target/linux/generic/files')
-rw-r--r-- | target/linux/generic/files/block/partitions/fit.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/target/linux/generic/files/block/partitions/fit.c b/target/linux/generic/files/block/partitions/fit.c index c0d9642505..823ee715de 100644 --- a/target/linux/generic/files/block/partitions/fit.c +++ b/target/linux/generic/files/block/partitions/fit.c @@ -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; } } |