aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic-2.6/patches-2.6.35/021-mips_image_cmdline_hack.patch
blob: a304f0bcc71ab3a68527cac5f525ce1bc9b182c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -856,6 +856,10 @@ config SYNC_R4K
 config MIPS_MACHINE
 	def_bool n
 
+config IMAGE_CMDLINE_HACK
+	bool "OpenWrt specific image command line hack"
+	default n
+
 config NO_IOPORT
 	def_bool n
 
--- a/arch/mips/kernel/head.S
+++ b/arch/mips/kernel/head.S
@@ -143,6 +143,12 @@ FEXPORT(__kernel_entry)
 	j	kernel_entry
 #endif
 
+#ifdef CONFIG_IMAGE_CMDLINE_HACK
+	.ascii	"CMDLINE:"
+EXPORT(__image_cmdline)
+	.fill	0x400
+#endif /* CONFIG_IMAGE_CMDLINE_HACK */
+
 	__REF
 
 NESTED(kernel_entry, 16, sp)			# kernel entry point
struct fis_image_desc { unsigned char name[16]; // Null terminated name uint32_t flash_base; // Address within FLASH of image @@ -41,6 +43,7 @@ static int parse_redboot_partitions(stru struct mtd_partition **pparts, unsigned long fis_origin) { + unsigned long max_offset = 0; int nrparts = 0; struct fis_image_desc *buf; struct mtd_partition *parts; @@ -209,14 +212,14 @@ static int parse_redboot_partitions(stru } } #endif - parts = kzalloc(sizeof(*parts)*nrparts + nulllen + namelen, GFP_KERNEL); + parts = kzalloc(sizeof(*parts) * (nrparts + 1) + nulllen + namelen + sizeof(BOARD_CONFIG_PART), GFP_KERNEL); if (!parts) { ret = -ENOMEM; goto out; } - nullname = (char *)&parts[nrparts]; + nullname = (char *)&parts[nrparts + 1]; #ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED if (nulllen > 0) { strcpy(nullname, nullstring); @@ -235,6 +238,8 @@ static int parse_redboot_partitions(stru } #endif for ( ; i<nrparts; i++) { + if(max_offset < buf[i].flash_base + buf[i].size) + max_offset = buf[i].flash_base + buf[i].size; parts[i].size = fl->img->size; parts[i].offset = fl->img->flash_base; parts[i].name = names; @@ -268,6 +273,14 @@ static int parse_redboot_partitions(stru fl = fl->next; kfree(tmp_fl); } + if(master->size - max_offset >= master->erasesize) + { + parts[nrparts].size = master->size - max_offset; + parts[nrparts].offset = max_offset; + parts[nrparts].name = names; + strcpy(names, BOARD_CONFIG_PART); + nrparts++; + } ret = nrparts; *pparts = parts; out: