package: kernel: add handling for 3.2 renames (and some missed ones for 3.1)
[openwrt.git] / target / linux / generic / patches-2.6.36 / 071-redboot_boardconfig.patch
1 --- a/drivers/mtd/redboot.c
2 +++ b/drivers/mtd/redboot.c
3 @@ -29,6 +29,8 @@
4 #include <linux/mtd/mtd.h>
5 #include <linux/mtd/partitions.h>
6
7 +#define BOARD_CONFIG_PART "boardconfig"
8 +
9 struct fis_image_desc {
10 unsigned char name[16]; // Null terminated name
11 uint32_t flash_base; // Address within FLASH of image
12 @@ -59,6 +61,7 @@ static int parse_redboot_partitions(stru
13 struct mtd_partition **pparts,
14 unsigned long fis_origin)
15 {
16 + unsigned long max_offset = 0;
17 int nrparts = 0;
18 struct fis_image_desc *buf;
19 struct mtd_partition *parts;
20 @@ -227,14 +230,14 @@ static int parse_redboot_partitions(stru
21 }
22 }
23 #endif
24 - parts = kzalloc(sizeof(*parts)*nrparts + nulllen + namelen, GFP_KERNEL);
25 + parts = kzalloc(sizeof(*parts) * (nrparts + 1) + nulllen + namelen + sizeof(BOARD_CONFIG_PART), GFP_KERNEL);
26
27 if (!parts) {
28 ret = -ENOMEM;
29 goto out;
30 }
31
32 - nullname = (char *)&parts[nrparts];
33 + nullname = (char *)&parts[nrparts + 1];
34 #ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
35 if (nulllen > 0) {
36 strcpy(nullname, nullstring);
37 @@ -253,6 +256,8 @@ static int parse_redboot_partitions(stru
38 }
39 #endif
40 for ( ; i<nrparts; i++) {
41 + if(max_offset < buf[i].flash_base + buf[i].size)
42 + max_offset = buf[i].flash_base + buf[i].size;
43 parts[i].size = fl->img->size;
44 parts[i].offset = fl->img->flash_base;
45 parts[i].name = names;
46 @@ -286,6 +291,14 @@ static int parse_redboot_partitions(stru
47 fl = fl->next;
48 kfree(tmp_fl);
49 }
50 + if(master->size - max_offset >= master->erasesize)
51 + {
52 + parts[nrparts].size = master->size - max_offset;
53 + parts[nrparts].offset = max_offset;
54 + parts[nrparts].name = names;
55 + strcpy(names, BOARD_CONFIG_PART);
56 + nrparts++;
57 + }
58 ret = nrparts;
59 *pparts = parts;
60 out:
This page took 0.046133 seconds and 5 git commands to generate.