kernel: make uImage.FIT partition parser work on MBR partitions
authorDaniel Golle <daniel@makrotopia.org>
Mon, 12 Jul 2021 15:54:45 +0000 (16:54 +0100)
committerDaniel Golle <daniel@makrotopia.org>
Tue, 20 Jul 2021 03:11:05 +0000 (04:11 +0100)
Introduce new partition type 0x2e representing uImage.FIT and trigger
FIT partition parser on partitions having that type.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
target/linux/generic/files/block/partitions/fit.c
target/linux/generic/hack-5.10/410-block-fit-partition-parser.patch

index 823ee715de90d16a21ec440827b599da2d9dc9cc..27e44a4af4739f06fc39bb067fe4c55555ea7dbd 100644 (file)
@@ -189,8 +189,8 @@ 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",
-                       image_type, image_pos, image_pos + image_len, image_name,
+               printk(KERN_DEBUG "FIT: %16s sub-image 0x%08x..0x%08x \"%s\" %s%s%s\n",
+                       image_type, image_pos, image_pos + image_len - 1, image_name,
                        image_description?"(":"", image_description?:"", image_description?") ":"");
 
                if (strcmp(image_type, FIT_FILESYSTEM_PROP))
index 2528f3afa1c0f376b2089edd8f16456690b045f4..6c2132e85e821f1117b9fe8a0700948b1696354e 100644 (file)
  
        set_capacity(gd, ((u64)new->size * tr->blksize) >> 9);
  
+--- a/block/partitions/msdos.c
++++ b/block/partitions/msdos.c
+@@ -565,6 +565,15 @@ static void parse_minix(struct parsed_pa
+ #endif /* CONFIG_MINIX_SUBPARTITION */
+ }
++static void parse_fit_mbr(struct parsed_partitions *state,
++                        sector_t offset, sector_t size, int origin)
++{
++#ifdef CONFIG_FIT_PARTITION
++      u32 extra_slot = 64;
++      (void) parse_fit_partitions(state, offset, size, &extra_slot, 1);
++#endif /* CONFIG_FIT_PARTITION */
++}
++
+ static struct {
+       unsigned char id;
+       void (*parse)(struct parsed_partitions *, sector_t, sector_t, int);
+@@ -576,6 +585,7 @@ static struct {
+       {UNIXWARE_PARTITION, parse_unixware},
+       {SOLARIS_X86_PARTITION, parse_solaris_x86},
+       {NEW_SOLARIS_X86_PARTITION, parse_solaris_x86},
++      {FIT_PARTITION, parse_fit_mbr},
+       {0, NULL},
+ };
+--- a/include/linux/msdos_partition.h
++++ b/include/linux/msdos_partition.h
+@@ -31,6 +31,7 @@ enum msdos_sys_ind {
+       LINUX_LVM_PARTITION = 0x8e,
+       LINUX_RAID_PARTITION = 0xfd,    /* autodetect RAID partition */
++      FIT_PARTITION = 0x2e,           /* U-Boot uImage.FIT */
+       SOLARIS_X86_PARTITION = 0x82,   /* also Linux swap partitions */
+       NEW_SOLARIS_X86_PARTITION = 0xbf,