Changeset 38325


Ignore:
Timestamp:
2013-10-07T17:02:48+02:00 (4 years ago)
Author:
blogic
Message:

lantiq: fix eva partition split for squashfs

Signed-off-by: John Crispin <blogic@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/lantiq/patches-3.10/0100-mtd-split.patch

    r38180 r38325  
    1 --- a/arch/mips/lantiq/xway/Makefile 
    2 +++ b/arch/mips/lantiq/xway/Makefile 
     1Index: linux-3.10.13/arch/mips/lantiq/xway/Makefile 
     2=================================================================== 
     3--- linux-3.10.13.orig/arch/mips/lantiq/xway/Makefile   2013-10-01 00:07:55.165279437 +0200 
     4+++ linux-3.10.13/arch/mips/lantiq/xway/Makefile        2013-10-01 00:10:24.269285811 +0200 
    35@@ -1,6 +1,6 @@ 
    46 obj-y := prom.o sysctrl.o clk.o reset.o dma.o gptu.o dcdc.o 
     
    911 obj-$(CONFIG_PCI) += ath_eep.o rt_eep.o pci-ath-fixup.o 
    1012  
    11 --- /dev/null 
    12 +++ b/arch/mips/lantiq/xway/mtd_split.c 
    13 @@ -0,0 +1,151 @@ 
     13Index: linux-3.10.13/arch/mips/lantiq/xway/mtd_split.c 
     14=================================================================== 
     15--- /dev/null   1970-01-01 00:00:00.000000000 +0000 
     16+++ linux-3.10.13/arch/mips/lantiq/xway/mtd_split.c     2013-10-01 00:11:28.745288566 +0200 
     17@@ -0,0 +1,129 @@ 
    1418+#include <linux/magic.h> 
    1519+#include <linux/root_dev.h> 
     
    6569+#define EVA_MAGIC   0xfeed1281 
    6670+       unsigned long magic = 0; 
    67 +       unsigned long part_size = 0; 
     71+       unsigned long part_size = 0, p; 
    6872+       size_t len; 
    6973+       int ret; 
     
    8387+               return; 
    8488+ 
    85 +       part_size = le32_to_cpu(part_size) + 0x18; 
    86 +       part_size = mtd_pad_erasesize(master, offset, len); 
     89+       p = part_size = le32_to_cpu(part_size) + 0x18; 
     90+       p &= ~0xffff; 
     91+       p += 0x10000; 
     92+ 
     93+       ret = mtd_read(master, offset + p, 4, &len, (void *)&magic); 
     94+       if (ret || len != sizeof(magic)) 
     95+               return; 
     96+ 
     97+       if (magic == SQUASHFS_MAGIC) 
     98+               part_size = p + 0x100; 
     99+       else 
     100+               part_size = mtd_pad_erasesize(master, offset, len); 
     101+ 
    87102+       if (part_size + master->erasesize > size) 
    88103+               return; 
     
    123138+} 
    124139+ 
    125 +static void split_squashfs(struct mtd_info *master, const char *name, 
    126 +                               int offset, int size) 
    127 +{ 
    128 +       struct squashfs_super_block sb; 
    129 +       int len, ret; 
    130 + 
    131 +       offset += 0x100; 
    132 +       size -= 0x100; 
    133 + 
    134 +       ret = mtd_read(master, offset, sizeof(sb), &len, (void *) &sb); 
    135 +       if (ret || (len != sizeof(sb))) 
    136 +               return; 
    137 + 
    138 +       if (SQUASHFS_MAGIC != le32_to_cpu(sb.s_magic) ) 
    139 +               return; 
    140 + 
    141 +       if (le64_to_cpu((sb.bytes_used)) <= 0) 
    142 +               printk(KERN_ALERT "split_squashfs: squashfs is empty in \"%s\"\n", 
    143 +                       master->name); 
    144 +               return; 
    145 + 
    146 +       len = (u32) le64_to_cpu(sb.bytes_used); 
    147 +       len = mtd_pad_erasesize(master, offset, len); 
    148 +       offset += len; 
    149 +       size -= len ; 
    150 +       printk(KERN_INFO "mtd: partition \"%s\" created automatically, ofs=0x%x, len=0x%x\n", 
    151 +               ROOTFS_SPLIT_NAME, offset, size); 
    152 + 
    153 +       __mtd_add_partition(master, ROOTFS_SPLIT_NAME, offset, 
    154 +                           size, false); 
    155 +} 
    156 + 
    157140+void arch_split_mtd_part(struct mtd_info *master, const char *name, 
    158141+                               int offset, int size) 
     
    161144+       split_eva_kernel(master, name, offset, size); 
    162145+       split_brnimage_kernel(master, name, offset, size); 
    163 +       split_squashfs(master, name, offset, size); 
    164 +} 
    165 --- a/include/linux/mtd/partitions.h 
    166 +++ b/include/linux/mtd/partitions.h 
    167 @@ -89,12 +89,17 @@ extern int deregister_mtd_parser(struct 
     146+} 
     147Index: linux-3.10.13/include/linux/mtd/partitions.h 
     148=================================================================== 
     149--- linux-3.10.13.orig/include/linux/mtd/partitions.h   2013-10-01 00:07:55.165279437 +0200 
     150+++ linux-3.10.13/include/linux/mtd/partitions.h        2013-10-01 00:08:03.889279810 +0200 
     151@@ -89,12 +89,17 @@ 
    168152 int mtd_is_partition(const struct mtd_info *mtd); 
    169153 int mtd_add_partition(struct mtd_info *master, char *name, 
     
    185169 int parse_mtd_partitions_by_type(struct mtd_info *master, 
    186170                                 enum mtd_parser_type type, 
    187 --- a/drivers/mtd/mtdpart.c 
    188 +++ b/drivers/mtd/mtdpart.c 
    189 @@ -616,7 +616,7 @@ out_register: 
     171Index: linux-3.10.13/drivers/mtd/mtdpart.c 
     172=================================================================== 
     173--- linux-3.10.13.orig/drivers/mtd/mtdpart.c    2013-10-01 00:07:55.165279437 +0200 
     174+++ linux-3.10.13/drivers/mtd/mtdpart.c 2013-10-01 00:08:03.893279810 +0200 
     175@@ -616,7 +616,7 @@ 
    190176 } 
    191177  
     
    196182                    long long offset, long long length, bool dup_check) 
    197183 { 
    198 @@ -737,7 +737,7 @@ run_parsers_by_type(struct mtd_part *sla 
     184@@ -737,7 +737,7 @@ 
    199185        return nr_parts; 
    200186 } 
     
    205191 { 
    206192        unsigned long mask = mtd->erasesize - 1; 
    207 @@ -806,7 +806,6 @@ static void split_uimage(struct mtd_info 
     193@@ -806,7 +806,6 @@ 
    208194                return; 
    209195  
Note: See TracChangeset for help on using the changeset viewer.