From 92eb27f56d613d9b6119dd05c375390076a0f342 Mon Sep 17 00:00:00 2001
From: Jonas Gorski <jogo@openwrt.org>
Date: Fri, 27 Feb 2015 17:38:25 +0000
Subject: [PATCH] package: mtd: move bcm963xx_tag definition into source code

Remove the need for the header file to be exported - we don't need most
of it anyway; all we care about are the offset of the rootfs length and
header crc fields.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>

SVN-Revision: 44557
---
 package/system/mtd/src/imagetag.c             |  93 +++++++-
 ...-Always-use-IRQ-domains-for-CPU-IRQs.patch |  10 +-
 ...s_cpu_intc_init-mips_cpu_irq_of_init.patch |   2 +-
 ...-Provide-a-generic-plat_irq_dispatch.patch |   4 +-
 .../311-bcm63xxpart_use_cfedetection.patch    |   2 +-
 ...ort-for-bcm6345-style-periphery-irq-.patch |  37 +--
 .../401-bcm963xx_real_rootfs_length.patch     |   4 +-
 ...-bcm63xxpart_parse_paritions_from_dt.patch |   2 +-
 ...-Always-use-IRQ-domains-for-CPU-IRQs.patch |   8 +-
 ...s_cpu_intc_init-mips_cpu_irq_of_init.patch |   2 +-
 ...-Provide-a-generic-plat_irq_dispatch.patch |   4 +-
 .../311-bcm63xxpart_use_cfedetection.patch    |   2 +-
 .../401-bcm963xx_real_rootfs_length.patch     |   4 +-
 ...-bcm63xxpart_parse_paritions_from_dt.patch |   2 +-
 .../patches-3.10/261-move_bcm963xx_tag.patch  | 219 ------------------
 .../patches-3.13/261-move_bcm963xx_tag.patch  | 219 ------------------
 .../patches-3.14/261-move_bcm963xx_tag.patch  | 219 ------------------
 .../generic/patches-3.14/700-swconfig.patch   |   2 +-
 .../patches-3.18/261-move_bcm963xx_tag.patch  | 219 ------------------
 .../generic/patches-3.18/700-swconfig.patch   |   2 +-
 .../patches-3.19/261-move_bcm963xx_tag.patch  | 219 ------------------
 .../patches-3.8/261-move_bcm963xx_tag.patch   | 219 ------------------
 .../patches-4.0/261-move_bcm963xx_tag.patch   | 219 ------------------
 23 files changed, 121 insertions(+), 1592 deletions(-)
 delete mode 100644 target/linux/generic/patches-3.10/261-move_bcm963xx_tag.patch
 delete mode 100644 target/linux/generic/patches-3.13/261-move_bcm963xx_tag.patch
 delete mode 100644 target/linux/generic/patches-3.14/261-move_bcm963xx_tag.patch
 delete mode 100644 target/linux/generic/patches-3.18/261-move_bcm963xx_tag.patch
 delete mode 100644 target/linux/generic/patches-3.19/261-move_bcm963xx_tag.patch
 delete mode 100644 target/linux/generic/patches-3.8/261-move_bcm963xx_tag.patch
 delete mode 100644 target/linux/generic/patches-4.0/261-move_bcm963xx_tag.patch

diff --git a/package/system/mtd/src/imagetag.c b/package/system/mtd/src/imagetag.c
index a53c17a703..b850837791 100644
--- a/package/system/mtd/src/imagetag.c
+++ b/package/system/mtd/src/imagetag.c
@@ -32,11 +32,102 @@
 
 #include <sys/ioctl.h>
 #include <mtd/mtd-user.h>
-#include <linux/bcm963xx_tag.h>
 
 #include "mtd.h"
 #include "crc32.h"
 
+#define TAGVER_LEN		4	/* Length of Tag Version */
+#define TAGLAYOUT_LEN		4	/* Length of FlashLayoutVer */
+#define SIG1_LEN		20	/* Company Signature 1 Length */
+#define SIG2_LEN		14	/* Company Signature 2 Length */
+#define BOARDID_LEN		16	/* Length of BoardId */
+#define ENDIANFLAG_LEN		2	/* Endian Flag Length */
+#define CHIPID_LEN		6	/* Chip Id Length */
+#define IMAGE_LEN		10	/* Length of Length Field */
+#define ADDRESS_LEN		12	/* Length of Address field */
+#define DUALFLAG_LEN		2	/* Dual Image flag Length */
+#define INACTIVEFLAG_LEN	2	/* Inactie Flag Length */
+#define RSASIG_LEN		20	/* Length of RSA Signature in tag */
+#define TAGINFO1_LEN		30	/* Length of vendor information field1 in tag */
+#define FLASHLAYOUTVER_LEN	4	/* Length of Flash Layout Version String tag */
+#define TAGINFO2_LEN		16	/* Length of vendor information field2 in tag */
+#define ALTTAGINFO_LEN		54	/* Alternate length for vendor information; Pirelli */
+
+#define NUM_PIRELLI		2
+#define IMAGETAG_CRC_START	0xFFFFFFFF
+
+#define PIRELLI_BOARDS { \
+	"AGPF-S0", \
+	"DWV-S0", \
+}
+/*
+ * The broadcom firmware assumes the rootfs starts the image,
+ * therefore uses the rootfs start (flash_image_address)
+ * to determine where to flash the image.  Since we have the kernel first
+ * we have to give it the kernel address, but the crc uses the length
+ * associated with this address (root_length), which is added to the kernel
+ * length (kernel_length) to determine the length of image to flash and thus
+ * needs to be rootfs + deadcode (jffs2 EOF marker)
+*/
+
+struct bcm_tag {
+	/* 0-3: Version of the image tag */
+	char tag_version[TAGVER_LEN];
+	/* 4-23: Company Line 1 */
+	char sig_1[SIG1_LEN];
+	/*  24-37: Company Line 2 */
+	char sig_2[SIG2_LEN];
+	/* 38-43: Chip this image is for */
+	char chip_id[CHIPID_LEN];
+	/* 44-59: Board name */
+	char board_id[BOARDID_LEN];
+	/* 60-61: Map endianness -- 1 BE 0 LE */
+	char big_endian[ENDIANFLAG_LEN];
+	/* 62-71: Total length of image */
+	char total_length[IMAGE_LEN];
+	/* 72-83: Address in memory of CFE */
+	char cfe__address[ADDRESS_LEN];
+	/* 84-93: Size of CFE */
+	char cfe_length[IMAGE_LEN];
+	/* 94-105: Address in memory of image start
+	 * (kernel for OpenWRT, rootfs for stock firmware)
+	 */
+	char flash_image_start[ADDRESS_LEN];
+	/* 106-115: Size of rootfs */
+	char root_length[IMAGE_LEN];
+	/* 116-127: Address in memory of kernel */
+	char kernel_address[ADDRESS_LEN];
+	/* 128-137: Size of kernel */
+	char kernel_length[IMAGE_LEN];
+	/* 138-139: Unused at the moment */
+	char dual_image[DUALFLAG_LEN];
+	/* 140-141: Unused at the moment */
+	char inactive_flag[INACTIVEFLAG_LEN];
+	/* 142-161: RSA Signature (not used; some vendors may use this) */
+	char rsa_signature[RSASIG_LEN];
+	/* 162-191: Compilation and related information (not used in OpenWrt) */
+	char information1[TAGINFO1_LEN];
+	/* 192-195: Version flash layout */
+	char flash_layout_ver[FLASHLAYOUTVER_LEN];
+	/* 196-199: kernel+rootfs CRC32 */
+	__u32 fskernel_crc;
+	/* 200-215: Unused except on Alice Gate where is is information */
+	char information2[TAGINFO2_LEN];
+	/* 216-219: CRC32 of image less imagetag (kernel for Alice Gate) */
+	__u32 image_crc;
+	/* 220-223: CRC32 of rootfs partition */
+	__u32 rootfs_crc;
+	/* 224-227: CRC32 of kernel partition */
+	__u32 kernel_crc;
+	/* 228-231: Image sequence number */
+	char image_sequence[4];
+	/* 222-235: Openwrt: real rootfs length */
+	__u32 real_rootfs_length;
+	/* 236-239: CRC32 of header excluding last 20 bytes */
+	__u32 header_crc;
+	/* 240-255: Unused at present */
+	char reserved2[16];
+};
 ssize_t pread(int fd, void *buf, size_t count, off_t offset);
 ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);
 
diff --git a/target/linux/brcm63xx/patches-3.14/030-MIPS-Always-use-IRQ-domains-for-CPU-IRQs.patch b/target/linux/brcm63xx/patches-3.14/030-MIPS-Always-use-IRQ-domains-for-CPU-IRQs.patch
index e6570ecdc6..21b69ab1ed 100644
--- a/target/linux/brcm63xx/patches-3.14/030-MIPS-Always-use-IRQ-domains-for-CPU-IRQs.patch
+++ b/target/linux/brcm63xx/patches-3.14/030-MIPS-Always-use-IRQ-domains-for-CPU-IRQs.patch
@@ -29,7 +29,7 @@ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
 
 --- a/arch/mips/Kconfig
 +++ b/arch/mips/Kconfig
-@@ -1025,6 +1025,7 @@ config MIPS_HUGE_TLB_SUPPORT
+@@ -1026,6 +1026,7 @@ config MIPS_HUGE_TLB_SUPPORT
  
  config IRQ_CPU
  	bool
@@ -39,8 +39,8 @@ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  	bool
 --- a/arch/mips/kernel/irq_cpu.c
 +++ b/arch/mips/kernel/irq_cpu.c
-@@ -94,28 +94,6 @@ static struct irq_chip mips_mt_cpu_irq_c
- 	.irq_eoi	= unmask_mips_irq,
+@@ -98,28 +98,6 @@ static struct irq_chip mips_mt_cpu_irq_c
+ 	.irq_enable	= unmask_mips_irq,
  };
  
 -void __init mips_cpu_irq_init(void)
@@ -68,7 +68,7 @@ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  static int mips_cpu_intc_map(struct irq_domain *d, unsigned int irq,
  			     irq_hw_number_t hw)
  {
-@@ -138,8 +116,7 @@ static const struct irq_domain_ops mips_
+@@ -142,8 +120,7 @@ static const struct irq_domain_ops mips_
  	.xlate = irq_domain_xlate_onecell,
  };
  
@@ -78,7 +78,7 @@ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  {
  	struct irq_domain *domain;
  
-@@ -151,7 +128,16 @@ int __init mips_cpu_intc_init(struct dev
+@@ -155,7 +132,16 @@ int __init mips_cpu_intc_init(struct dev
  				       &mips_cpu_intc_irq_domain_ops, NULL);
  	if (!domain)
  		panic("Failed to add irqdomain for MIPS CPU");
diff --git a/target/linux/brcm63xx/patches-3.14/031-MIPS-Rename-mips_cpu_intc_init-mips_cpu_irq_of_init.patch b/target/linux/brcm63xx/patches-3.14/031-MIPS-Rename-mips_cpu_intc_init-mips_cpu_irq_of_init.patch
index de0f111e28..141644f285 100644
--- a/target/linux/brcm63xx/patches-3.14/031-MIPS-Rename-mips_cpu_intc_init-mips_cpu_irq_of_init.patch
+++ b/target/linux/brcm63xx/patches-3.14/031-MIPS-Rename-mips_cpu_intc_init-mips_cpu_irq_of_init.patch
@@ -65,7 +65,7 @@ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  #endif /* _ASM_IRQ_CPU_H */
 --- a/arch/mips/kernel/irq_cpu.c
 +++ b/arch/mips/kernel/irq_cpu.c
-@@ -135,8 +135,8 @@ void __init mips_cpu_irq_init(void)
+@@ -139,8 +139,8 @@ void __init mips_cpu_irq_init(void)
  	__mips_cpu_irq_init(NULL);
  }
  
diff --git a/target/linux/brcm63xx/patches-3.14/032-MIPS-Provide-a-generic-plat_irq_dispatch.patch b/target/linux/brcm63xx/patches-3.14/032-MIPS-Provide-a-generic-plat_irq_dispatch.patch
index 79a0436dc6..8f5bd3144f 100644
--- a/target/linux/brcm63xx/patches-3.14/032-MIPS-Provide-a-generic-plat_irq_dispatch.patch
+++ b/target/linux/brcm63xx/patches-3.14/032-MIPS-Provide-a-generic-plat_irq_dispatch.patch
@@ -31,8 +31,8 @@ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
 
 --- a/arch/mips/kernel/irq_cpu.c
 +++ b/arch/mips/kernel/irq_cpu.c
-@@ -94,6 +94,24 @@ static struct irq_chip mips_mt_cpu_irq_c
- 	.irq_eoi	= unmask_mips_irq,
+@@ -98,6 +98,24 @@ static struct irq_chip mips_mt_cpu_irq_c
+ 	.irq_enable	= unmask_mips_irq,
  };
  
 +asmlinkage void __weak plat_irq_dispatch(void)
diff --git a/target/linux/brcm63xx/patches-3.14/311-bcm63xxpart_use_cfedetection.patch b/target/linux/brcm63xx/patches-3.14/311-bcm63xxpart_use_cfedetection.patch
index dedd728ce9..46d9b47cdf 100644
--- a/target/linux/brcm63xx/patches-3.14/311-bcm63xxpart_use_cfedetection.patch
+++ b/target/linux/brcm63xx/patches-3.14/311-bcm63xxpart_use_cfedetection.patch
@@ -3,7 +3,7 @@
 @@ -35,7 +35,7 @@
  
  #include <asm/mach-bcm63xx/bcm63xx_nvram.h>
- #include <linux/bcm963xx_tag.h>
+ #include <asm/mach-bcm63xx/bcm963xx_tag.h>
 -#include <asm/mach-bcm63xx/board_bcm963xx.h>
 +#include <asm/mach-bcm63xx/bcm63xx_board.h>
  
diff --git a/target/linux/brcm63xx/patches-3.14/320-irqchip-add-support-for-bcm6345-style-periphery-irq-.patch b/target/linux/brcm63xx/patches-3.14/320-irqchip-add-support-for-bcm6345-style-periphery-irq-.patch
index 2fd1568e27..8219c98a4b 100644
--- a/target/linux/brcm63xx/patches-3.14/320-irqchip-add-support-for-bcm6345-style-periphery-irq-.patch
+++ b/target/linux/brcm63xx/patches-3.14/320-irqchip-add-support-for-bcm6345-style-periphery-irq-.patch
@@ -94,7 +94,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  obj-$(CONFIG_METAG_PERFCOUNTER_IRQS)	+= irq-metag.o
 --- /dev/null
 +++ b/drivers/irqchip/irq-bcm6345-periph.c
-@@ -0,0 +1,340 @@
+@@ -0,0 +1,341 @@
 +/*
 + * This file is subject to the terms and conditions of the GNU General Public
 + * License.  See the file "COPYING" in the main directory of this archive
@@ -246,6 +246,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
 +	irq_hw_number_t hwirq = irqd_to_hwirq(data);
 +	struct intc_data *priv = data->domain->host_data;
 +	unsigned int i, reg, bit;
++	unsigned long flags;
 +	bool enabled;
 +	int cpu;
 +
@@ -265,7 +266,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
 +	if (!priv->block[cpu].parent_irq)
 +		return -EINVAL;
 +
-+	raw_spin_lock(&priv->lock);
++	raw_spin_lock_irqsave(&priv->lock, flags);
 +	enabled = !irqd_irq_masked(data);
 +	for (i = 0; i < MAX_PARENT_IRQS; i++) {
 +		struct intc_block *block = &priv->block[i];
@@ -281,7 +282,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
 +			__bcm6345_periph_enable(block, reg, bit, false);
 +		}
 +	}
-+	raw_spin_unlock(&priv->lock);
++	raw_spin_unlock_irqrestore(&priv->lock, flags);
 +
 +	return 0;
 +}
@@ -454,33 +455,3 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
 +			      int num_words);
 +
 +#endif /* __INCLUDE_LINUX_IRQCHIP_IRQ_BCM6345_PERIPH_H */
-diff --git a/drivers/irqchip/irq-bcm6345-periph.c b/drivers/irqchip/irq-bcm6345-periph.c
-index dfab88e..b280164 100644
---- a/drivers/irqchip/irq-bcm6345-periph.c
-+++ b/drivers/irqchip/irq-bcm6345-periph.c
-@@ -149,6 +149,7 @@ static int bcm6345_periph_set_affinity(struct irq_data *data,
- 	irq_hw_number_t hwirq = irqd_to_hwirq(data);
- 	struct intc_data *priv = data->domain->host_data;
- 	unsigned int i, reg, bit;
-+	unsigned long flags;
- 	bool enabled;
- 	int cpu;
- 
-@@ -168,7 +169,7 @@ static int bcm6345_periph_set_affinity(struct irq_data *data,
- 	if (!priv->block[cpu].parent_irq)
- 		return -EINVAL;
- 
--	raw_spin_lock(&priv->lock);
-+	raw_spin_lock_irqsave(&priv->lock, flags);
- 	enabled = !irqd_irq_masked(data);
- 	for (i = 0; i < MAX_PARENT_IRQS; i++) {
- 		struct intc_block *block = &priv->block[i];
-@@ -184,7 +185,7 @@ static int bcm6345_periph_set_affinity(struct irq_data *data,
- 			__bcm6345_periph_enable(block, reg, bit, false);
- 		}
- 	}
--	raw_spin_unlock(&priv->lock);
-+	raw_spin_unlock_irqrestore(&priv->lock, flags);
- 
- 	return 0;
- }
diff --git a/target/linux/brcm63xx/patches-3.14/401-bcm963xx_real_rootfs_length.patch b/target/linux/brcm63xx/patches-3.14/401-bcm963xx_real_rootfs_length.patch
index caf8b9514d..92c264bd76 100644
--- a/target/linux/brcm63xx/patches-3.14/401-bcm963xx_real_rootfs_length.patch
+++ b/target/linux/brcm63xx/patches-3.14/401-bcm963xx_real_rootfs_length.patch
@@ -1,5 +1,5 @@
---- a/include/uapi/linux/bcm963xx_tag.h
-+++ b/include/uapi/linux/bcm963xx_tag.h
+--- a/arch/mips/include/asm/mach-bcm63xx/bcm963xx_tag.h
++++ b/arch/mips/include/asm/mach-bcm63xx/bcm963xx_tag.h
 @@ -85,8 +85,10 @@ struct bcm_tag {
  	__u32 rootfs_crc;
  	/* 224-227: CRC32 of kernel partition */
diff --git a/target/linux/brcm63xx/patches-3.14/425-bcm63xxpart_parse_paritions_from_dt.patch b/target/linux/brcm63xx/patches-3.14/425-bcm63xxpart_parse_paritions_from_dt.patch
index dd0ba7054d..7f3890eb0a 100644
--- a/target/linux/brcm63xx/patches-3.14/425-bcm63xxpart_parse_paritions_from_dt.patch
+++ b/target/linux/brcm63xx/patches-3.14/425-bcm63xxpart_parse_paritions_from_dt.patch
@@ -7,7 +7,7 @@
 +#include <linux/of.h>
  
  #include <asm/mach-bcm63xx/bcm63xx_nvram.h>
- #include <linux/bcm963xx_tag.h>
+ #include <asm/mach-bcm63xx/bcm963xx_tag.h>
 @@ -43,66 +44,35 @@
  
  #define BCM63XX_CFE_MAGIC_OFFSET 0x4e0
diff --git a/target/linux/brcm63xx/patches-3.18/030-MIPS-Always-use-IRQ-domains-for-CPU-IRQs.patch b/target/linux/brcm63xx/patches-3.18/030-MIPS-Always-use-IRQ-domains-for-CPU-IRQs.patch
index e7d091c95d..cfa72980d2 100644
--- a/target/linux/brcm63xx/patches-3.18/030-MIPS-Always-use-IRQ-domains-for-CPU-IRQs.patch
+++ b/target/linux/brcm63xx/patches-3.18/030-MIPS-Always-use-IRQ-domains-for-CPU-IRQs.patch
@@ -39,8 +39,8 @@ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  	bool
 --- a/arch/mips/kernel/irq_cpu.c
 +++ b/arch/mips/kernel/irq_cpu.c
-@@ -94,28 +94,6 @@ static struct irq_chip mips_mt_cpu_irq_c
- 	.irq_eoi	= unmask_mips_irq,
+@@ -98,28 +98,6 @@ static struct irq_chip mips_mt_cpu_irq_c
+ 	.irq_enable	= unmask_mips_irq,
  };
  
 -void __init mips_cpu_irq_init(void)
@@ -68,7 +68,7 @@ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  static int mips_cpu_intc_map(struct irq_domain *d, unsigned int irq,
  			     irq_hw_number_t hw)
  {
-@@ -138,8 +116,7 @@ static const struct irq_domain_ops mips_
+@@ -142,8 +120,7 @@ static const struct irq_domain_ops mips_
  	.xlate = irq_domain_xlate_onecell,
  };
  
@@ -78,7 +78,7 @@ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  {
  	struct irq_domain *domain;
  
-@@ -151,7 +128,16 @@ int __init mips_cpu_intc_init(struct dev
+@@ -155,7 +132,16 @@ int __init mips_cpu_intc_init(struct dev
  				       &mips_cpu_intc_irq_domain_ops, NULL);
  	if (!domain)
  		panic("Failed to add irqdomain for MIPS CPU");
diff --git a/target/linux/brcm63xx/patches-3.18/031-MIPS-Rename-mips_cpu_intc_init-mips_cpu_irq_of_init.patch b/target/linux/brcm63xx/patches-3.18/031-MIPS-Rename-mips_cpu_intc_init-mips_cpu_irq_of_init.patch
index de0f111e28..141644f285 100644
--- a/target/linux/brcm63xx/patches-3.18/031-MIPS-Rename-mips_cpu_intc_init-mips_cpu_irq_of_init.patch
+++ b/target/linux/brcm63xx/patches-3.18/031-MIPS-Rename-mips_cpu_intc_init-mips_cpu_irq_of_init.patch
@@ -65,7 +65,7 @@ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  #endif /* _ASM_IRQ_CPU_H */
 --- a/arch/mips/kernel/irq_cpu.c
 +++ b/arch/mips/kernel/irq_cpu.c
-@@ -135,8 +135,8 @@ void __init mips_cpu_irq_init(void)
+@@ -139,8 +139,8 @@ void __init mips_cpu_irq_init(void)
  	__mips_cpu_irq_init(NULL);
  }
  
diff --git a/target/linux/brcm63xx/patches-3.18/032-MIPS-Provide-a-generic-plat_irq_dispatch.patch b/target/linux/brcm63xx/patches-3.18/032-MIPS-Provide-a-generic-plat_irq_dispatch.patch
index 79a0436dc6..8f5bd3144f 100644
--- a/target/linux/brcm63xx/patches-3.18/032-MIPS-Provide-a-generic-plat_irq_dispatch.patch
+++ b/target/linux/brcm63xx/patches-3.18/032-MIPS-Provide-a-generic-plat_irq_dispatch.patch
@@ -31,8 +31,8 @@ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
 
 --- a/arch/mips/kernel/irq_cpu.c
 +++ b/arch/mips/kernel/irq_cpu.c
-@@ -94,6 +94,24 @@ static struct irq_chip mips_mt_cpu_irq_c
- 	.irq_eoi	= unmask_mips_irq,
+@@ -98,6 +98,24 @@ static struct irq_chip mips_mt_cpu_irq_c
+ 	.irq_enable	= unmask_mips_irq,
  };
  
 +asmlinkage void __weak plat_irq_dispatch(void)
diff --git a/target/linux/brcm63xx/patches-3.18/311-bcm63xxpart_use_cfedetection.patch b/target/linux/brcm63xx/patches-3.18/311-bcm63xxpart_use_cfedetection.patch
index dedd728ce9..46d9b47cdf 100644
--- a/target/linux/brcm63xx/patches-3.18/311-bcm63xxpart_use_cfedetection.patch
+++ b/target/linux/brcm63xx/patches-3.18/311-bcm63xxpart_use_cfedetection.patch
@@ -3,7 +3,7 @@
 @@ -35,7 +35,7 @@
  
  #include <asm/mach-bcm63xx/bcm63xx_nvram.h>
- #include <linux/bcm963xx_tag.h>
+ #include <asm/mach-bcm63xx/bcm963xx_tag.h>
 -#include <asm/mach-bcm63xx/board_bcm963xx.h>
 +#include <asm/mach-bcm63xx/bcm63xx_board.h>
  
diff --git a/target/linux/brcm63xx/patches-3.18/401-bcm963xx_real_rootfs_length.patch b/target/linux/brcm63xx/patches-3.18/401-bcm963xx_real_rootfs_length.patch
index caf8b9514d..92c264bd76 100644
--- a/target/linux/brcm63xx/patches-3.18/401-bcm963xx_real_rootfs_length.patch
+++ b/target/linux/brcm63xx/patches-3.18/401-bcm963xx_real_rootfs_length.patch
@@ -1,5 +1,5 @@
---- a/include/uapi/linux/bcm963xx_tag.h
-+++ b/include/uapi/linux/bcm963xx_tag.h
+--- a/arch/mips/include/asm/mach-bcm63xx/bcm963xx_tag.h
++++ b/arch/mips/include/asm/mach-bcm63xx/bcm963xx_tag.h
 @@ -85,8 +85,10 @@ struct bcm_tag {
  	__u32 rootfs_crc;
  	/* 224-227: CRC32 of kernel partition */
diff --git a/target/linux/brcm63xx/patches-3.18/425-bcm63xxpart_parse_paritions_from_dt.patch b/target/linux/brcm63xx/patches-3.18/425-bcm63xxpart_parse_paritions_from_dt.patch
index dd0ba7054d..7f3890eb0a 100644
--- a/target/linux/brcm63xx/patches-3.18/425-bcm63xxpart_parse_paritions_from_dt.patch
+++ b/target/linux/brcm63xx/patches-3.18/425-bcm63xxpart_parse_paritions_from_dt.patch
@@ -7,7 +7,7 @@
 +#include <linux/of.h>
  
  #include <asm/mach-bcm63xx/bcm63xx_nvram.h>
- #include <linux/bcm963xx_tag.h>
+ #include <asm/mach-bcm63xx/bcm963xx_tag.h>
 @@ -43,66 +44,35 @@
  
  #define BCM63XX_CFE_MAGIC_OFFSET 0x4e0
diff --git a/target/linux/generic/patches-3.10/261-move_bcm963xx_tag.patch b/target/linux/generic/patches-3.10/261-move_bcm963xx_tag.patch
deleted file mode 100644
index b095deb4d2..0000000000
--- a/target/linux/generic/patches-3.10/261-move_bcm963xx_tag.patch
+++ /dev/null
@@ -1,219 +0,0 @@
---- a/arch/mips/include/asm/mach-bcm63xx/bcm963xx_tag.h
-+++ /dev/null
-@@ -1,96 +0,0 @@
--#ifndef __BCM963XX_TAG_H
--#define __BCM963XX_TAG_H
--
--#define TAGVER_LEN		4	/* Length of Tag Version */
--#define TAGLAYOUT_LEN		4	/* Length of FlashLayoutVer */
--#define SIG1_LEN		20	/* Company Signature 1 Length */
--#define SIG2_LEN		14	/* Company Signature 2 Length */
--#define BOARDID_LEN		16	/* Length of BoardId */
--#define ENDIANFLAG_LEN		2	/* Endian Flag Length */
--#define CHIPID_LEN		6	/* Chip Id Length */
--#define IMAGE_LEN		10	/* Length of Length Field */
--#define ADDRESS_LEN		12	/* Length of Address field */
--#define DUALFLAG_LEN		2	/* Dual Image flag Length */
--#define INACTIVEFLAG_LEN	2	/* Inactie Flag Length */
--#define RSASIG_LEN		20	/* Length of RSA Signature in tag */
--#define TAGINFO1_LEN		30	/* Length of vendor information field1 in tag */
--#define FLASHLAYOUTVER_LEN	4	/* Length of Flash Layout Version String tag */
--#define TAGINFO2_LEN		16	/* Length of vendor information field2 in tag */
--#define ALTTAGINFO_LEN		54	/* Alternate length for vendor information; Pirelli */
--
--#define NUM_PIRELLI		2
--#define IMAGETAG_CRC_START	0xFFFFFFFF
--
--#define PIRELLI_BOARDS { \
--	"AGPF-S0", \
--	"DWV-S0", \
--}
--
--/*
-- * The broadcom firmware assumes the rootfs starts the image,
-- * therefore uses the rootfs start (flash_image_address)
-- * to determine where to flash the image.  Since we have the kernel first
-- * we have to give it the kernel address, but the crc uses the length
-- * associated with this address (root_length), which is added to the kernel
-- * length (kernel_length) to determine the length of image to flash and thus
-- * needs to be rootfs + deadcode (jffs2 EOF marker)
--*/
--
--struct bcm_tag {
--	/* 0-3: Version of the image tag */
--	char tag_version[TAGVER_LEN];
--	/* 4-23: Company Line 1 */
--	char sig_1[SIG1_LEN];
--	/*  24-37: Company Line 2 */
--	char sig_2[SIG2_LEN];
--	/* 38-43: Chip this image is for */
--	char chip_id[CHIPID_LEN];
--	/* 44-59: Board name */
--	char board_id[BOARDID_LEN];
--	/* 60-61: Map endianness -- 1 BE 0 LE */
--	char big_endian[ENDIANFLAG_LEN];
--	/* 62-71: Total length of image */
--	char total_length[IMAGE_LEN];
--	/* 72-83: Address in memory of CFE */
--	char cfe__address[ADDRESS_LEN];
--	/* 84-93: Size of CFE */
--	char cfe_length[IMAGE_LEN];
--	/* 94-105: Address in memory of image start
--	 * (kernel for OpenWRT, rootfs for stock firmware)
--	 */
--	char flash_image_start[ADDRESS_LEN];
--	/* 106-115: Size of rootfs */
--	char root_length[IMAGE_LEN];
--	/* 116-127: Address in memory of kernel */
--	char kernel_address[ADDRESS_LEN];
--	/* 128-137: Size of kernel */
--	char kernel_length[IMAGE_LEN];
--	/* 138-139: Unused at the moment */
--	char dual_image[DUALFLAG_LEN];
--	/* 140-141: Unused at the moment */
--	char inactive_flag[INACTIVEFLAG_LEN];
--	/* 142-161: RSA Signature (not used; some vendors may use this) */
--	char rsa_signature[RSASIG_LEN];
--	/* 162-191: Compilation and related information (not used in OpenWrt) */
--	char information1[TAGINFO1_LEN];
--	/* 192-195: Version flash layout */
--	char flash_layout_ver[FLASHLAYOUTVER_LEN];
--	/* 196-199: kernel+rootfs CRC32 */
--	__u32 fskernel_crc;
--	/* 200-215: Unused except on Alice Gate where is is information */
--	char information2[TAGINFO2_LEN];
--	/* 216-219: CRC32 of image less imagetag (kernel for Alice Gate) */
--	__u32 image_crc;
--	/* 220-223: CRC32 of rootfs partition */
--	__u32 rootfs_crc;
--	/* 224-227: CRC32 of kernel partition */
--	__u32 kernel_crc;
--	/* 228-235: Unused at present */
--	char reserved1[8];
--	/* 236-239: CRC32 of header excluding last 20 bytes */
--	__u32 header_crc;
--	/* 240-255: Unused at present */
--	char reserved2[16];
--};
--
--#endif /* __BCM63XX_TAG_H */
---- a/drivers/mtd/bcm63xxpart.c
-+++ b/drivers/mtd/bcm63xxpart.c
-@@ -32,7 +32,7 @@
- #include <linux/mtd/mtd.h>
- #include <linux/mtd/partitions.h>
- 
--#include <asm/mach-bcm63xx/bcm963xx_tag.h>
-+#include <linux/bcm963xx_tag.h>
- #include <asm/mach-bcm63xx/board_bcm963xx.h>
- 
- #define BCM63XX_EXTENDED_SIZE	0xBFC00000	/* Extended flash address */
---- a/include/uapi/linux/Kbuild
-+++ b/include/uapi/linux/Kbuild
-@@ -67,6 +67,7 @@ header-y += binfmts.h
- header-y += blkpg.h
- header-y += blktrace_api.h
- header-y += bpqether.h
-+header-y += bcm963xx_tag.h
- header-y += bsg.h
- header-y += btrfs.h
- header-y += can.h
---- /dev/null
-+++ b/include/uapi/linux/bcm963xx_tag.h
-@@ -0,0 +1,96 @@
-+#ifndef __BCM963XX_TAG_H
-+#define __BCM963XX_TAG_H
-+
-+#define TAGVER_LEN		4	/* Length of Tag Version */
-+#define TAGLAYOUT_LEN		4	/* Length of FlashLayoutVer */
-+#define SIG1_LEN		20	/* Company Signature 1 Length */
-+#define SIG2_LEN		14	/* Company Signature 2 Length */
-+#define BOARDID_LEN		16	/* Length of BoardId */
-+#define ENDIANFLAG_LEN		2	/* Endian Flag Length */
-+#define CHIPID_LEN		6	/* Chip Id Length */
-+#define IMAGE_LEN		10	/* Length of Length Field */
-+#define ADDRESS_LEN		12	/* Length of Address field */
-+#define DUALFLAG_LEN		2	/* Dual Image flag Length */
-+#define INACTIVEFLAG_LEN	2	/* Inactie Flag Length */
-+#define RSASIG_LEN		20	/* Length of RSA Signature in tag */
-+#define TAGINFO1_LEN		30	/* Length of vendor information field1 in tag */
-+#define FLASHLAYOUTVER_LEN	4	/* Length of Flash Layout Version String tag */
-+#define TAGINFO2_LEN		16	/* Length of vendor information field2 in tag */
-+#define ALTTAGINFO_LEN		54	/* Alternate length for vendor information; Pirelli */
-+
-+#define NUM_PIRELLI		2
-+#define IMAGETAG_CRC_START	0xFFFFFFFF
-+
-+#define PIRELLI_BOARDS { \
-+	"AGPF-S0", \
-+	"DWV-S0", \
-+}
-+
-+/*
-+ * The broadcom firmware assumes the rootfs starts the image,
-+ * therefore uses the rootfs start (flash_image_address)
-+ * to determine where to flash the image.  Since we have the kernel first
-+ * we have to give it the kernel address, but the crc uses the length
-+ * associated with this address (root_length), which is added to the kernel
-+ * length (kernel_length) to determine the length of image to flash and thus
-+ * needs to be rootfs + deadcode (jffs2 EOF marker)
-+*/
-+
-+struct bcm_tag {
-+	/* 0-3: Version of the image tag */
-+	char tag_version[TAGVER_LEN];
-+	/* 4-23: Company Line 1 */
-+	char sig_1[SIG1_LEN];
-+	/*  24-37: Company Line 2 */
-+	char sig_2[SIG2_LEN];
-+	/* 38-43: Chip this image is for */
-+	char chip_id[CHIPID_LEN];
-+	/* 44-59: Board name */
-+	char board_id[BOARDID_LEN];
-+	/* 60-61: Map endianness -- 1 BE 0 LE */
-+	char big_endian[ENDIANFLAG_LEN];
-+	/* 62-71: Total length of image */
-+	char total_length[IMAGE_LEN];
-+	/* 72-83: Address in memory of CFE */
-+	char cfe__address[ADDRESS_LEN];
-+	/* 84-93: Size of CFE */
-+	char cfe_length[IMAGE_LEN];
-+	/* 94-105: Address in memory of image start
-+	 * (kernel for OpenWRT, rootfs for stock firmware)
-+	 */
-+	char flash_image_start[ADDRESS_LEN];
-+	/* 106-115: Size of rootfs */
-+	char root_length[IMAGE_LEN];
-+	/* 116-127: Address in memory of kernel */
-+	char kernel_address[ADDRESS_LEN];
-+	/* 128-137: Size of kernel */
-+	char kernel_length[IMAGE_LEN];
-+	/* 138-139: Unused at the moment */
-+	char dual_image[DUALFLAG_LEN];
-+	/* 140-141: Unused at the moment */
-+	char inactive_flag[INACTIVEFLAG_LEN];
-+	/* 142-161: RSA Signature (not used; some vendors may use this) */
-+	char rsa_signature[RSASIG_LEN];
-+	/* 162-191: Compilation and related information (not used in OpenWrt) */
-+	char information1[TAGINFO1_LEN];
-+	/* 192-195: Version flash layout */
-+	char flash_layout_ver[FLASHLAYOUTVER_LEN];
-+	/* 196-199: kernel+rootfs CRC32 */
-+	__u32 fskernel_crc;
-+	/* 200-215: Unused except on Alice Gate where is is information */
-+	char information2[TAGINFO2_LEN];
-+	/* 216-219: CRC32 of image less imagetag (kernel for Alice Gate) */
-+	__u32 image_crc;
-+	/* 220-223: CRC32 of rootfs partition */
-+	__u32 rootfs_crc;
-+	/* 224-227: CRC32 of kernel partition */
-+	__u32 kernel_crc;
-+	/* 228-235: Unused at present */
-+	char reserved1[8];
-+	/* 236-239: CRC32 of header excluding last 20 bytes */
-+	__u32 header_crc;
-+	/* 240-255: Unused at present */
-+	char reserved2[16];
-+};
-+
-+#endif /* __BCM63XX_TAG_H */
diff --git a/target/linux/generic/patches-3.13/261-move_bcm963xx_tag.patch b/target/linux/generic/patches-3.13/261-move_bcm963xx_tag.patch
deleted file mode 100644
index 96f2ad209b..0000000000
--- a/target/linux/generic/patches-3.13/261-move_bcm963xx_tag.patch
+++ /dev/null
@@ -1,219 +0,0 @@
---- a/arch/mips/include/asm/mach-bcm63xx/bcm963xx_tag.h
-+++ /dev/null
-@@ -1,96 +0,0 @@
--#ifndef __BCM963XX_TAG_H
--#define __BCM963XX_TAG_H
--
--#define TAGVER_LEN		4	/* Length of Tag Version */
--#define TAGLAYOUT_LEN		4	/* Length of FlashLayoutVer */
--#define SIG1_LEN		20	/* Company Signature 1 Length */
--#define SIG2_LEN		14	/* Company Signature 2 Length */
--#define BOARDID_LEN		16	/* Length of BoardId */
--#define ENDIANFLAG_LEN		2	/* Endian Flag Length */
--#define CHIPID_LEN		6	/* Chip Id Length */
--#define IMAGE_LEN		10	/* Length of Length Field */
--#define ADDRESS_LEN		12	/* Length of Address field */
--#define DUALFLAG_LEN		2	/* Dual Image flag Length */
--#define INACTIVEFLAG_LEN	2	/* Inactie Flag Length */
--#define RSASIG_LEN		20	/* Length of RSA Signature in tag */
--#define TAGINFO1_LEN		30	/* Length of vendor information field1 in tag */
--#define FLASHLAYOUTVER_LEN	4	/* Length of Flash Layout Version String tag */
--#define TAGINFO2_LEN		16	/* Length of vendor information field2 in tag */
--#define ALTTAGINFO_LEN		54	/* Alternate length for vendor information; Pirelli */
--
--#define NUM_PIRELLI		2
--#define IMAGETAG_CRC_START	0xFFFFFFFF
--
--#define PIRELLI_BOARDS { \
--	"AGPF-S0", \
--	"DWV-S0", \
--}
--
--/*
-- * The broadcom firmware assumes the rootfs starts the image,
-- * therefore uses the rootfs start (flash_image_address)
-- * to determine where to flash the image.  Since we have the kernel first
-- * we have to give it the kernel address, but the crc uses the length
-- * associated with this address (root_length), which is added to the kernel
-- * length (kernel_length) to determine the length of image to flash and thus
-- * needs to be rootfs + deadcode (jffs2 EOF marker)
--*/
--
--struct bcm_tag {
--	/* 0-3: Version of the image tag */
--	char tag_version[TAGVER_LEN];
--	/* 4-23: Company Line 1 */
--	char sig_1[SIG1_LEN];
--	/*  24-37: Company Line 2 */
--	char sig_2[SIG2_LEN];
--	/* 38-43: Chip this image is for */
--	char chip_id[CHIPID_LEN];
--	/* 44-59: Board name */
--	char board_id[BOARDID_LEN];
--	/* 60-61: Map endianness -- 1 BE 0 LE */
--	char big_endian[ENDIANFLAG_LEN];
--	/* 62-71: Total length of image */
--	char total_length[IMAGE_LEN];
--	/* 72-83: Address in memory of CFE */
--	char cfe__address[ADDRESS_LEN];
--	/* 84-93: Size of CFE */
--	char cfe_length[IMAGE_LEN];
--	/* 94-105: Address in memory of image start
--	 * (kernel for OpenWRT, rootfs for stock firmware)
--	 */
--	char flash_image_start[ADDRESS_LEN];
--	/* 106-115: Size of rootfs */
--	char root_length[IMAGE_LEN];
--	/* 116-127: Address in memory of kernel */
--	char kernel_address[ADDRESS_LEN];
--	/* 128-137: Size of kernel */
--	char kernel_length[IMAGE_LEN];
--	/* 138-139: Unused at the moment */
--	char dual_image[DUALFLAG_LEN];
--	/* 140-141: Unused at the moment */
--	char inactive_flag[INACTIVEFLAG_LEN];
--	/* 142-161: RSA Signature (not used; some vendors may use this) */
--	char rsa_signature[RSASIG_LEN];
--	/* 162-191: Compilation and related information (not used in OpenWrt) */
--	char information1[TAGINFO1_LEN];
--	/* 192-195: Version flash layout */
--	char flash_layout_ver[FLASHLAYOUTVER_LEN];
--	/* 196-199: kernel+rootfs CRC32 */
--	__u32 fskernel_crc;
--	/* 200-215: Unused except on Alice Gate where is is information */
--	char information2[TAGINFO2_LEN];
--	/* 216-219: CRC32 of image less imagetag (kernel for Alice Gate) */
--	__u32 image_crc;
--	/* 220-223: CRC32 of rootfs partition */
--	__u32 rootfs_crc;
--	/* 224-227: CRC32 of kernel partition */
--	__u32 kernel_crc;
--	/* 228-235: Unused at present */
--	char reserved1[8];
--	/* 236-239: CRC32 of header excluding last 20 bytes */
--	__u32 header_crc;
--	/* 240-255: Unused at present */
--	char reserved2[16];
--};
--
--#endif /* __BCM63XX_TAG_H */
---- a/drivers/mtd/bcm63xxpart.c
-+++ b/drivers/mtd/bcm63xxpart.c
-@@ -34,7 +34,7 @@
- #include <linux/mtd/partitions.h>
- 
- #include <asm/mach-bcm63xx/bcm63xx_nvram.h>
--#include <asm/mach-bcm63xx/bcm963xx_tag.h>
-+#include <linux/bcm963xx_tag.h>
- #include <asm/mach-bcm63xx/board_bcm963xx.h>
- 
- #define BCM63XX_EXTENDED_SIZE	0xBFC00000	/* Extended flash address */
---- a/include/uapi/linux/Kbuild
-+++ b/include/uapi/linux/Kbuild
-@@ -68,6 +68,7 @@ header-y += binfmts.h
- header-y += blkpg.h
- header-y += blktrace_api.h
- header-y += bpqether.h
-+header-y += bcm963xx_tag.h
- header-y += bsg.h
- header-y += btrfs.h
- header-y += can.h
---- /dev/null
-+++ b/include/uapi/linux/bcm963xx_tag.h
-@@ -0,0 +1,96 @@
-+#ifndef __BCM963XX_TAG_H
-+#define __BCM963XX_TAG_H
-+
-+#define TAGVER_LEN		4	/* Length of Tag Version */
-+#define TAGLAYOUT_LEN		4	/* Length of FlashLayoutVer */
-+#define SIG1_LEN		20	/* Company Signature 1 Length */
-+#define SIG2_LEN		14	/* Company Signature 2 Length */
-+#define BOARDID_LEN		16	/* Length of BoardId */
-+#define ENDIANFLAG_LEN		2	/* Endian Flag Length */
-+#define CHIPID_LEN		6	/* Chip Id Length */
-+#define IMAGE_LEN		10	/* Length of Length Field */
-+#define ADDRESS_LEN		12	/* Length of Address field */
-+#define DUALFLAG_LEN		2	/* Dual Image flag Length */
-+#define INACTIVEFLAG_LEN	2	/* Inactie Flag Length */
-+#define RSASIG_LEN		20	/* Length of RSA Signature in tag */
-+#define TAGINFO1_LEN		30	/* Length of vendor information field1 in tag */
-+#define FLASHLAYOUTVER_LEN	4	/* Length of Flash Layout Version String tag */
-+#define TAGINFO2_LEN		16	/* Length of vendor information field2 in tag */
-+#define ALTTAGINFO_LEN		54	/* Alternate length for vendor information; Pirelli */
-+
-+#define NUM_PIRELLI		2
-+#define IMAGETAG_CRC_START	0xFFFFFFFF
-+
-+#define PIRELLI_BOARDS { \
-+	"AGPF-S0", \
-+	"DWV-S0", \
-+}
-+
-+/*
-+ * The broadcom firmware assumes the rootfs starts the image,
-+ * therefore uses the rootfs start (flash_image_address)
-+ * to determine where to flash the image.  Since we have the kernel first
-+ * we have to give it the kernel address, but the crc uses the length
-+ * associated with this address (root_length), which is added to the kernel
-+ * length (kernel_length) to determine the length of image to flash and thus
-+ * needs to be rootfs + deadcode (jffs2 EOF marker)
-+*/
-+
-+struct bcm_tag {
-+	/* 0-3: Version of the image tag */
-+	char tag_version[TAGVER_LEN];
-+	/* 4-23: Company Line 1 */
-+	char sig_1[SIG1_LEN];
-+	/*  24-37: Company Line 2 */
-+	char sig_2[SIG2_LEN];
-+	/* 38-43: Chip this image is for */
-+	char chip_id[CHIPID_LEN];
-+	/* 44-59: Board name */
-+	char board_id[BOARDID_LEN];
-+	/* 60-61: Map endianness -- 1 BE 0 LE */
-+	char big_endian[ENDIANFLAG_LEN];
-+	/* 62-71: Total length of image */
-+	char total_length[IMAGE_LEN];
-+	/* 72-83: Address in memory of CFE */
-+	char cfe__address[ADDRESS_LEN];
-+	/* 84-93: Size of CFE */
-+	char cfe_length[IMAGE_LEN];
-+	/* 94-105: Address in memory of image start
-+	 * (kernel for OpenWRT, rootfs for stock firmware)
-+	 */
-+	char flash_image_start[ADDRESS_LEN];
-+	/* 106-115: Size of rootfs */
-+	char root_length[IMAGE_LEN];
-+	/* 116-127: Address in memory of kernel */
-+	char kernel_address[ADDRESS_LEN];
-+	/* 128-137: Size of kernel */
-+	char kernel_length[IMAGE_LEN];
-+	/* 138-139: Unused at the moment */
-+	char dual_image[DUALFLAG_LEN];
-+	/* 140-141: Unused at the moment */
-+	char inactive_flag[INACTIVEFLAG_LEN];
-+	/* 142-161: RSA Signature (not used; some vendors may use this) */
-+	char rsa_signature[RSASIG_LEN];
-+	/* 162-191: Compilation and related information (not used in OpenWrt) */
-+	char information1[TAGINFO1_LEN];
-+	/* 192-195: Version flash layout */
-+	char flash_layout_ver[FLASHLAYOUTVER_LEN];
-+	/* 196-199: kernel+rootfs CRC32 */
-+	__u32 fskernel_crc;
-+	/* 200-215: Unused except on Alice Gate where is is information */
-+	char information2[TAGINFO2_LEN];
-+	/* 216-219: CRC32 of image less imagetag (kernel for Alice Gate) */
-+	__u32 image_crc;
-+	/* 220-223: CRC32 of rootfs partition */
-+	__u32 rootfs_crc;
-+	/* 224-227: CRC32 of kernel partition */
-+	__u32 kernel_crc;
-+	/* 228-235: Unused at present */
-+	char reserved1[8];
-+	/* 236-239: CRC32 of header excluding last 20 bytes */
-+	__u32 header_crc;
-+	/* 240-255: Unused at present */
-+	char reserved2[16];
-+};
-+
-+#endif /* __BCM63XX_TAG_H */
diff --git a/target/linux/generic/patches-3.14/261-move_bcm963xx_tag.patch b/target/linux/generic/patches-3.14/261-move_bcm963xx_tag.patch
deleted file mode 100644
index 96f2ad209b..0000000000
--- a/target/linux/generic/patches-3.14/261-move_bcm963xx_tag.patch
+++ /dev/null
@@ -1,219 +0,0 @@
---- a/arch/mips/include/asm/mach-bcm63xx/bcm963xx_tag.h
-+++ /dev/null
-@@ -1,96 +0,0 @@
--#ifndef __BCM963XX_TAG_H
--#define __BCM963XX_TAG_H
--
--#define TAGVER_LEN		4	/* Length of Tag Version */
--#define TAGLAYOUT_LEN		4	/* Length of FlashLayoutVer */
--#define SIG1_LEN		20	/* Company Signature 1 Length */
--#define SIG2_LEN		14	/* Company Signature 2 Length */
--#define BOARDID_LEN		16	/* Length of BoardId */
--#define ENDIANFLAG_LEN		2	/* Endian Flag Length */
--#define CHIPID_LEN		6	/* Chip Id Length */
--#define IMAGE_LEN		10	/* Length of Length Field */
--#define ADDRESS_LEN		12	/* Length of Address field */
--#define DUALFLAG_LEN		2	/* Dual Image flag Length */
--#define INACTIVEFLAG_LEN	2	/* Inactie Flag Length */
--#define RSASIG_LEN		20	/* Length of RSA Signature in tag */
--#define TAGINFO1_LEN		30	/* Length of vendor information field1 in tag */
--#define FLASHLAYOUTVER_LEN	4	/* Length of Flash Layout Version String tag */
--#define TAGINFO2_LEN		16	/* Length of vendor information field2 in tag */
--#define ALTTAGINFO_LEN		54	/* Alternate length for vendor information; Pirelli */
--
--#define NUM_PIRELLI		2
--#define IMAGETAG_CRC_START	0xFFFFFFFF
--
--#define PIRELLI_BOARDS { \
--	"AGPF-S0", \
--	"DWV-S0", \
--}
--
--/*
-- * The broadcom firmware assumes the rootfs starts the image,
-- * therefore uses the rootfs start (flash_image_address)
-- * to determine where to flash the image.  Since we have the kernel first
-- * we have to give it the kernel address, but the crc uses the length
-- * associated with this address (root_length), which is added to the kernel
-- * length (kernel_length) to determine the length of image to flash and thus
-- * needs to be rootfs + deadcode (jffs2 EOF marker)
--*/
--
--struct bcm_tag {
--	/* 0-3: Version of the image tag */
--	char tag_version[TAGVER_LEN];
--	/* 4-23: Company Line 1 */
--	char sig_1[SIG1_LEN];
--	/*  24-37: Company Line 2 */
--	char sig_2[SIG2_LEN];
--	/* 38-43: Chip this image is for */
--	char chip_id[CHIPID_LEN];
--	/* 44-59: Board name */
--	char board_id[BOARDID_LEN];
--	/* 60-61: Map endianness -- 1 BE 0 LE */
--	char big_endian[ENDIANFLAG_LEN];
--	/* 62-71: Total length of image */
--	char total_length[IMAGE_LEN];
--	/* 72-83: Address in memory of CFE */
--	char cfe__address[ADDRESS_LEN];
--	/* 84-93: Size of CFE */
--	char cfe_length[IMAGE_LEN];
--	/* 94-105: Address in memory of image start
--	 * (kernel for OpenWRT, rootfs for stock firmware)
--	 */
--	char flash_image_start[ADDRESS_LEN];
--	/* 106-115: Size of rootfs */
--	char root_length[IMAGE_LEN];
--	/* 116-127: Address in memory of kernel */
--	char kernel_address[ADDRESS_LEN];
--	/* 128-137: Size of kernel */
--	char kernel_length[IMAGE_LEN];
--	/* 138-139: Unused at the moment */
--	char dual_image[DUALFLAG_LEN];
--	/* 140-141: Unused at the moment */
--	char inactive_flag[INACTIVEFLAG_LEN];
--	/* 142-161: RSA Signature (not used; some vendors may use this) */
--	char rsa_signature[RSASIG_LEN];
--	/* 162-191: Compilation and related information (not used in OpenWrt) */
--	char information1[TAGINFO1_LEN];
--	/* 192-195: Version flash layout */
--	char flash_layout_ver[FLASHLAYOUTVER_LEN];
--	/* 196-199: kernel+rootfs CRC32 */
--	__u32 fskernel_crc;
--	/* 200-215: Unused except on Alice Gate where is is information */
--	char information2[TAGINFO2_LEN];
--	/* 216-219: CRC32 of image less imagetag (kernel for Alice Gate) */
--	__u32 image_crc;
--	/* 220-223: CRC32 of rootfs partition */
--	__u32 rootfs_crc;
--	/* 224-227: CRC32 of kernel partition */
--	__u32 kernel_crc;
--	/* 228-235: Unused at present */
--	char reserved1[8];
--	/* 236-239: CRC32 of header excluding last 20 bytes */
--	__u32 header_crc;
--	/* 240-255: Unused at present */
--	char reserved2[16];
--};
--
--#endif /* __BCM63XX_TAG_H */
---- a/drivers/mtd/bcm63xxpart.c
-+++ b/drivers/mtd/bcm63xxpart.c
-@@ -34,7 +34,7 @@
- #include <linux/mtd/partitions.h>
- 
- #include <asm/mach-bcm63xx/bcm63xx_nvram.h>
--#include <asm/mach-bcm63xx/bcm963xx_tag.h>
-+#include <linux/bcm963xx_tag.h>
- #include <asm/mach-bcm63xx/board_bcm963xx.h>
- 
- #define BCM63XX_EXTENDED_SIZE	0xBFC00000	/* Extended flash address */
---- a/include/uapi/linux/Kbuild
-+++ b/include/uapi/linux/Kbuild
-@@ -68,6 +68,7 @@ header-y += binfmts.h
- header-y += blkpg.h
- header-y += blktrace_api.h
- header-y += bpqether.h
-+header-y += bcm963xx_tag.h
- header-y += bsg.h
- header-y += btrfs.h
- header-y += can.h
---- /dev/null
-+++ b/include/uapi/linux/bcm963xx_tag.h
-@@ -0,0 +1,96 @@
-+#ifndef __BCM963XX_TAG_H
-+#define __BCM963XX_TAG_H
-+
-+#define TAGVER_LEN		4	/* Length of Tag Version */
-+#define TAGLAYOUT_LEN		4	/* Length of FlashLayoutVer */
-+#define SIG1_LEN		20	/* Company Signature 1 Length */
-+#define SIG2_LEN		14	/* Company Signature 2 Length */
-+#define BOARDID_LEN		16	/* Length of BoardId */
-+#define ENDIANFLAG_LEN		2	/* Endian Flag Length */
-+#define CHIPID_LEN		6	/* Chip Id Length */
-+#define IMAGE_LEN		10	/* Length of Length Field */
-+#define ADDRESS_LEN		12	/* Length of Address field */
-+#define DUALFLAG_LEN		2	/* Dual Image flag Length */
-+#define INACTIVEFLAG_LEN	2	/* Inactie Flag Length */
-+#define RSASIG_LEN		20	/* Length of RSA Signature in tag */
-+#define TAGINFO1_LEN		30	/* Length of vendor information field1 in tag */
-+#define FLASHLAYOUTVER_LEN	4	/* Length of Flash Layout Version String tag */
-+#define TAGINFO2_LEN		16	/* Length of vendor information field2 in tag */
-+#define ALTTAGINFO_LEN		54	/* Alternate length for vendor information; Pirelli */
-+
-+#define NUM_PIRELLI		2
-+#define IMAGETAG_CRC_START	0xFFFFFFFF
-+
-+#define PIRELLI_BOARDS { \
-+	"AGPF-S0", \
-+	"DWV-S0", \
-+}
-+
-+/*
-+ * The broadcom firmware assumes the rootfs starts the image,
-+ * therefore uses the rootfs start (flash_image_address)
-+ * to determine where to flash the image.  Since we have the kernel first
-+ * we have to give it the kernel address, but the crc uses the length
-+ * associated with this address (root_length), which is added to the kernel
-+ * length (kernel_length) to determine the length of image to flash and thus
-+ * needs to be rootfs + deadcode (jffs2 EOF marker)
-+*/
-+
-+struct bcm_tag {
-+	/* 0-3: Version of the image tag */
-+	char tag_version[TAGVER_LEN];
-+	/* 4-23: Company Line 1 */
-+	char sig_1[SIG1_LEN];
-+	/*  24-37: Company Line 2 */
-+	char sig_2[SIG2_LEN];
-+	/* 38-43: Chip this image is for */
-+	char chip_id[CHIPID_LEN];
-+	/* 44-59: Board name */
-+	char board_id[BOARDID_LEN];
-+	/* 60-61: Map endianness -- 1 BE 0 LE */
-+	char big_endian[ENDIANFLAG_LEN];
-+	/* 62-71: Total length of image */
-+	char total_length[IMAGE_LEN];
-+	/* 72-83: Address in memory of CFE */
-+	char cfe__address[ADDRESS_LEN];
-+	/* 84-93: Size of CFE */
-+	char cfe_length[IMAGE_LEN];
-+	/* 94-105: Address in memory of image start
-+	 * (kernel for OpenWRT, rootfs for stock firmware)
-+	 */
-+	char flash_image_start[ADDRESS_LEN];
-+	/* 106-115: Size of rootfs */
-+	char root_length[IMAGE_LEN];
-+	/* 116-127: Address in memory of kernel */
-+	char kernel_address[ADDRESS_LEN];
-+	/* 128-137: Size of kernel */
-+	char kernel_length[IMAGE_LEN];
-+	/* 138-139: Unused at the moment */
-+	char dual_image[DUALFLAG_LEN];
-+	/* 140-141: Unused at the moment */
-+	char inactive_flag[INACTIVEFLAG_LEN];
-+	/* 142-161: RSA Signature (not used; some vendors may use this) */
-+	char rsa_signature[RSASIG_LEN];
-+	/* 162-191: Compilation and related information (not used in OpenWrt) */
-+	char information1[TAGINFO1_LEN];
-+	/* 192-195: Version flash layout */
-+	char flash_layout_ver[FLASHLAYOUTVER_LEN];
-+	/* 196-199: kernel+rootfs CRC32 */
-+	__u32 fskernel_crc;
-+	/* 200-215: Unused except on Alice Gate where is is information */
-+	char information2[TAGINFO2_LEN];
-+	/* 216-219: CRC32 of image less imagetag (kernel for Alice Gate) */
-+	__u32 image_crc;
-+	/* 220-223: CRC32 of rootfs partition */
-+	__u32 rootfs_crc;
-+	/* 224-227: CRC32 of kernel partition */
-+	__u32 kernel_crc;
-+	/* 228-235: Unused at present */
-+	char reserved1[8];
-+	/* 236-239: CRC32 of header excluding last 20 bytes */
-+	__u32 header_crc;
-+	/* 240-255: Unused at present */
-+	char reserved2[16];
-+};
-+
-+#endif /* __BCM63XX_TAG_H */
diff --git a/target/linux/generic/patches-3.14/700-swconfig.patch b/target/linux/generic/patches-3.14/700-swconfig.patch
index a60722c27b..16024f8967 100644
--- a/target/linux/generic/patches-3.14/700-swconfig.patch
+++ b/target/linux/generic/patches-3.14/700-swconfig.patch
@@ -29,7 +29,7 @@
  obj-$(CONFIG_CICADA_PHY)	+= cicada.o
 --- a/include/uapi/linux/Kbuild
 +++ b/include/uapi/linux/Kbuild
-@@ -366,6 +366,7 @@ header-y += stddef.h
+@@ -365,6 +365,7 @@ header-y += stddef.h
  header-y += string.h
  header-y += suspend_ioctls.h
  header-y += swab.h
diff --git a/target/linux/generic/patches-3.18/261-move_bcm963xx_tag.patch b/target/linux/generic/patches-3.18/261-move_bcm963xx_tag.patch
deleted file mode 100644
index ff8f6f85c6..0000000000
--- a/target/linux/generic/patches-3.18/261-move_bcm963xx_tag.patch
+++ /dev/null
@@ -1,219 +0,0 @@
---- a/arch/mips/include/asm/mach-bcm63xx/bcm963xx_tag.h
-+++ /dev/null
-@@ -1,96 +0,0 @@
--#ifndef __BCM963XX_TAG_H
--#define __BCM963XX_TAG_H
--
--#define TAGVER_LEN		4	/* Length of Tag Version */
--#define TAGLAYOUT_LEN		4	/* Length of FlashLayoutVer */
--#define SIG1_LEN		20	/* Company Signature 1 Length */
--#define SIG2_LEN		14	/* Company Signature 2 Length */
--#define BOARDID_LEN		16	/* Length of BoardId */
--#define ENDIANFLAG_LEN		2	/* Endian Flag Length */
--#define CHIPID_LEN		6	/* Chip Id Length */
--#define IMAGE_LEN		10	/* Length of Length Field */
--#define ADDRESS_LEN		12	/* Length of Address field */
--#define DUALFLAG_LEN		2	/* Dual Image flag Length */
--#define INACTIVEFLAG_LEN	2	/* Inactie Flag Length */
--#define RSASIG_LEN		20	/* Length of RSA Signature in tag */
--#define TAGINFO1_LEN		30	/* Length of vendor information field1 in tag */
--#define FLASHLAYOUTVER_LEN	4	/* Length of Flash Layout Version String tag */
--#define TAGINFO2_LEN		16	/* Length of vendor information field2 in tag */
--#define ALTTAGINFO_LEN		54	/* Alternate length for vendor information; Pirelli */
--
--#define NUM_PIRELLI		2
--#define IMAGETAG_CRC_START	0xFFFFFFFF
--
--#define PIRELLI_BOARDS { \
--	"AGPF-S0", \
--	"DWV-S0", \
--}
--
--/*
-- * The broadcom firmware assumes the rootfs starts the image,
-- * therefore uses the rootfs start (flash_image_address)
-- * to determine where to flash the image.  Since we have the kernel first
-- * we have to give it the kernel address, but the crc uses the length
-- * associated with this address (root_length), which is added to the kernel
-- * length (kernel_length) to determine the length of image to flash and thus
-- * needs to be rootfs + deadcode (jffs2 EOF marker)
--*/
--
--struct bcm_tag {
--	/* 0-3: Version of the image tag */
--	char tag_version[TAGVER_LEN];
--	/* 4-23: Company Line 1 */
--	char sig_1[SIG1_LEN];
--	/*  24-37: Company Line 2 */
--	char sig_2[SIG2_LEN];
--	/* 38-43: Chip this image is for */
--	char chip_id[CHIPID_LEN];
--	/* 44-59: Board name */
--	char board_id[BOARDID_LEN];
--	/* 60-61: Map endianness -- 1 BE 0 LE */
--	char big_endian[ENDIANFLAG_LEN];
--	/* 62-71: Total length of image */
--	char total_length[IMAGE_LEN];
--	/* 72-83: Address in memory of CFE */
--	char cfe__address[ADDRESS_LEN];
--	/* 84-93: Size of CFE */
--	char cfe_length[IMAGE_LEN];
--	/* 94-105: Address in memory of image start
--	 * (kernel for OpenWRT, rootfs for stock firmware)
--	 */
--	char flash_image_start[ADDRESS_LEN];
--	/* 106-115: Size of rootfs */
--	char root_length[IMAGE_LEN];
--	/* 116-127: Address in memory of kernel */
--	char kernel_address[ADDRESS_LEN];
--	/* 128-137: Size of kernel */
--	char kernel_length[IMAGE_LEN];
--	/* 138-139: Unused at the moment */
--	char dual_image[DUALFLAG_LEN];
--	/* 140-141: Unused at the moment */
--	char inactive_flag[INACTIVEFLAG_LEN];
--	/* 142-161: RSA Signature (not used; some vendors may use this) */
--	char rsa_signature[RSASIG_LEN];
--	/* 162-191: Compilation and related information (not used in OpenWrt) */
--	char information1[TAGINFO1_LEN];
--	/* 192-195: Version flash layout */
--	char flash_layout_ver[FLASHLAYOUTVER_LEN];
--	/* 196-199: kernel+rootfs CRC32 */
--	__u32 fskernel_crc;
--	/* 200-215: Unused except on Alice Gate where is is information */
--	char information2[TAGINFO2_LEN];
--	/* 216-219: CRC32 of image less imagetag (kernel for Alice Gate) */
--	__u32 image_crc;
--	/* 220-223: CRC32 of rootfs partition */
--	__u32 rootfs_crc;
--	/* 224-227: CRC32 of kernel partition */
--	__u32 kernel_crc;
--	/* 228-235: Unused at present */
--	char reserved1[8];
--	/* 236-239: CRC32 of header excluding last 20 bytes */
--	__u32 header_crc;
--	/* 240-255: Unused at present */
--	char reserved2[16];
--};
--
--#endif /* __BCM63XX_TAG_H */
---- a/drivers/mtd/bcm63xxpart.c
-+++ b/drivers/mtd/bcm63xxpart.c
-@@ -34,7 +34,7 @@
- #include <linux/mtd/partitions.h>
- 
- #include <asm/mach-bcm63xx/bcm63xx_nvram.h>
--#include <asm/mach-bcm63xx/bcm963xx_tag.h>
-+#include <linux/bcm963xx_tag.h>
- #include <asm/mach-bcm63xx/board_bcm963xx.h>
- 
- #define BCM63XX_EXTENDED_SIZE	0xBFC00000	/* Extended flash address */
---- a/include/uapi/linux/Kbuild
-+++ b/include/uapi/linux/Kbuild
-@@ -70,6 +70,7 @@ header-y += blktrace_api.h
- header-y += bpf.h
- header-y += bpf_common.h
- header-y += bpqether.h
-+header-y += bcm963xx_tag.h
- header-y += bsg.h
- header-y += btrfs.h
- header-y += can.h
---- /dev/null
-+++ b/include/uapi/linux/bcm963xx_tag.h
-@@ -0,0 +1,96 @@
-+#ifndef __BCM963XX_TAG_H
-+#define __BCM963XX_TAG_H
-+
-+#define TAGVER_LEN		4	/* Length of Tag Version */
-+#define TAGLAYOUT_LEN		4	/* Length of FlashLayoutVer */
-+#define SIG1_LEN		20	/* Company Signature 1 Length */
-+#define SIG2_LEN		14	/* Company Signature 2 Length */
-+#define BOARDID_LEN		16	/* Length of BoardId */
-+#define ENDIANFLAG_LEN		2	/* Endian Flag Length */
-+#define CHIPID_LEN		6	/* Chip Id Length */
-+#define IMAGE_LEN		10	/* Length of Length Field */
-+#define ADDRESS_LEN		12	/* Length of Address field */
-+#define DUALFLAG_LEN		2	/* Dual Image flag Length */
-+#define INACTIVEFLAG_LEN	2	/* Inactie Flag Length */
-+#define RSASIG_LEN		20	/* Length of RSA Signature in tag */
-+#define TAGINFO1_LEN		30	/* Length of vendor information field1 in tag */
-+#define FLASHLAYOUTVER_LEN	4	/* Length of Flash Layout Version String tag */
-+#define TAGINFO2_LEN		16	/* Length of vendor information field2 in tag */
-+#define ALTTAGINFO_LEN		54	/* Alternate length for vendor information; Pirelli */
-+
-+#define NUM_PIRELLI		2
-+#define IMAGETAG_CRC_START	0xFFFFFFFF
-+
-+#define PIRELLI_BOARDS { \
-+	"AGPF-S0", \
-+	"DWV-S0", \
-+}
-+
-+/*
-+ * The broadcom firmware assumes the rootfs starts the image,
-+ * therefore uses the rootfs start (flash_image_address)
-+ * to determine where to flash the image.  Since we have the kernel first
-+ * we have to give it the kernel address, but the crc uses the length
-+ * associated with this address (root_length), which is added to the kernel
-+ * length (kernel_length) to determine the length of image to flash and thus
-+ * needs to be rootfs + deadcode (jffs2 EOF marker)
-+*/
-+
-+struct bcm_tag {
-+	/* 0-3: Version of the image tag */
-+	char tag_version[TAGVER_LEN];
-+	/* 4-23: Company Line 1 */
-+	char sig_1[SIG1_LEN];
-+	/*  24-37: Company Line 2 */
-+	char sig_2[SIG2_LEN];
-+	/* 38-43: Chip this image is for */
-+	char chip_id[CHIPID_LEN];
-+	/* 44-59: Board name */
-+	char board_id[BOARDID_LEN];
-+	/* 60-61: Map endianness -- 1 BE 0 LE */
-+	char big_endian[ENDIANFLAG_LEN];
-+	/* 62-71: Total length of image */
-+	char total_length[IMAGE_LEN];
-+	/* 72-83: Address in memory of CFE */
-+	char cfe__address[ADDRESS_LEN];
-+	/* 84-93: Size of CFE */
-+	char cfe_length[IMAGE_LEN];
-+	/* 94-105: Address in memory of image start
-+	 * (kernel for OpenWRT, rootfs for stock firmware)
-+	 */
-+	char flash_image_start[ADDRESS_LEN];
-+	/* 106-115: Size of rootfs */
-+	char root_length[IMAGE_LEN];
-+	/* 116-127: Address in memory of kernel */
-+	char kernel_address[ADDRESS_LEN];
-+	/* 128-137: Size of kernel */
-+	char kernel_length[IMAGE_LEN];
-+	/* 138-139: Unused at the moment */
-+	char dual_image[DUALFLAG_LEN];
-+	/* 140-141: Unused at the moment */
-+	char inactive_flag[INACTIVEFLAG_LEN];
-+	/* 142-161: RSA Signature (not used; some vendors may use this) */
-+	char rsa_signature[RSASIG_LEN];
-+	/* 162-191: Compilation and related information (not used in OpenWrt) */
-+	char information1[TAGINFO1_LEN];
-+	/* 192-195: Version flash layout */
-+	char flash_layout_ver[FLASHLAYOUTVER_LEN];
-+	/* 196-199: kernel+rootfs CRC32 */
-+	__u32 fskernel_crc;
-+	/* 200-215: Unused except on Alice Gate where is is information */
-+	char information2[TAGINFO2_LEN];
-+	/* 216-219: CRC32 of image less imagetag (kernel for Alice Gate) */
-+	__u32 image_crc;
-+	/* 220-223: CRC32 of rootfs partition */
-+	__u32 rootfs_crc;
-+	/* 224-227: CRC32 of kernel partition */
-+	__u32 kernel_crc;
-+	/* 228-235: Unused at present */
-+	char reserved1[8];
-+	/* 236-239: CRC32 of header excluding last 20 bytes */
-+	__u32 header_crc;
-+	/* 240-255: Unused at present */
-+	char reserved2[16];
-+};
-+
-+#endif /* __BCM63XX_TAG_H */
diff --git a/target/linux/generic/patches-3.18/700-swconfig.patch b/target/linux/generic/patches-3.18/700-swconfig.patch
index 6d24149330..7cf525a509 100644
--- a/target/linux/generic/patches-3.18/700-swconfig.patch
+++ b/target/linux/generic/patches-3.18/700-swconfig.patch
@@ -29,7 +29,7 @@
  obj-$(CONFIG_CICADA_PHY)	+= cicada.o
 --- a/include/uapi/linux/Kbuild
 +++ b/include/uapi/linux/Kbuild
-@@ -375,6 +375,7 @@ header-y += stddef.h
+@@ -374,6 +374,7 @@ header-y += stddef.h
  header-y += string.h
  header-y += suspend_ioctls.h
  header-y += swab.h
diff --git a/target/linux/generic/patches-3.19/261-move_bcm963xx_tag.patch b/target/linux/generic/patches-3.19/261-move_bcm963xx_tag.patch
deleted file mode 100644
index 1592a639ef..0000000000
--- a/target/linux/generic/patches-3.19/261-move_bcm963xx_tag.patch
+++ /dev/null
@@ -1,219 +0,0 @@
---- a/arch/mips/include/asm/mach-bcm63xx/bcm963xx_tag.h
-+++ /dev/null
-@@ -1,96 +0,0 @@
--#ifndef __BCM963XX_TAG_H
--#define __BCM963XX_TAG_H
--
--#define TAGVER_LEN		4	/* Length of Tag Version */
--#define TAGLAYOUT_LEN		4	/* Length of FlashLayoutVer */
--#define SIG1_LEN		20	/* Company Signature 1 Length */
--#define SIG2_LEN		14	/* Company Signature 2 Length */
--#define BOARDID_LEN		16	/* Length of BoardId */
--#define ENDIANFLAG_LEN		2	/* Endian Flag Length */
--#define CHIPID_LEN		6	/* Chip Id Length */
--#define IMAGE_LEN		10	/* Length of Length Field */
--#define ADDRESS_LEN		12	/* Length of Address field */
--#define DUALFLAG_LEN		2	/* Dual Image flag Length */
--#define INACTIVEFLAG_LEN	2	/* Inactie Flag Length */
--#define RSASIG_LEN		20	/* Length of RSA Signature in tag */
--#define TAGINFO1_LEN		30	/* Length of vendor information field1 in tag */
--#define FLASHLAYOUTVER_LEN	4	/* Length of Flash Layout Version String tag */
--#define TAGINFO2_LEN		16	/* Length of vendor information field2 in tag */
--#define ALTTAGINFO_LEN		54	/* Alternate length for vendor information; Pirelli */
--
--#define NUM_PIRELLI		2
--#define IMAGETAG_CRC_START	0xFFFFFFFF
--
--#define PIRELLI_BOARDS { \
--	"AGPF-S0", \
--	"DWV-S0", \
--}
--
--/*
-- * The broadcom firmware assumes the rootfs starts the image,
-- * therefore uses the rootfs start (flash_image_address)
-- * to determine where to flash the image.  Since we have the kernel first
-- * we have to give it the kernel address, but the crc uses the length
-- * associated with this address (root_length), which is added to the kernel
-- * length (kernel_length) to determine the length of image to flash and thus
-- * needs to be rootfs + deadcode (jffs2 EOF marker)
--*/
--
--struct bcm_tag {
--	/* 0-3: Version of the image tag */
--	char tag_version[TAGVER_LEN];
--	/* 4-23: Company Line 1 */
--	char sig_1[SIG1_LEN];
--	/*  24-37: Company Line 2 */
--	char sig_2[SIG2_LEN];
--	/* 38-43: Chip this image is for */
--	char chip_id[CHIPID_LEN];
--	/* 44-59: Board name */
--	char board_id[BOARDID_LEN];
--	/* 60-61: Map endianness -- 1 BE 0 LE */
--	char big_endian[ENDIANFLAG_LEN];
--	/* 62-71: Total length of image */
--	char total_length[IMAGE_LEN];
--	/* 72-83: Address in memory of CFE */
--	char cfe__address[ADDRESS_LEN];
--	/* 84-93: Size of CFE */
--	char cfe_length[IMAGE_LEN];
--	/* 94-105: Address in memory of image start
--	 * (kernel for OpenWRT, rootfs for stock firmware)
--	 */
--	char flash_image_start[ADDRESS_LEN];
--	/* 106-115: Size of rootfs */
--	char root_length[IMAGE_LEN];
--	/* 116-127: Address in memory of kernel */
--	char kernel_address[ADDRESS_LEN];
--	/* 128-137: Size of kernel */
--	char kernel_length[IMAGE_LEN];
--	/* 138-139: Unused at the moment */
--	char dual_image[DUALFLAG_LEN];
--	/* 140-141: Unused at the moment */
--	char inactive_flag[INACTIVEFLAG_LEN];
--	/* 142-161: RSA Signature (not used; some vendors may use this) */
--	char rsa_signature[RSASIG_LEN];
--	/* 162-191: Compilation and related information (not used in OpenWrt) */
--	char information1[TAGINFO1_LEN];
--	/* 192-195: Version flash layout */
--	char flash_layout_ver[FLASHLAYOUTVER_LEN];
--	/* 196-199: kernel+rootfs CRC32 */
--	__u32 fskernel_crc;
--	/* 200-215: Unused except on Alice Gate where is is information */
--	char information2[TAGINFO2_LEN];
--	/* 216-219: CRC32 of image less imagetag (kernel for Alice Gate) */
--	__u32 image_crc;
--	/* 220-223: CRC32 of rootfs partition */
--	__u32 rootfs_crc;
--	/* 224-227: CRC32 of kernel partition */
--	__u32 kernel_crc;
--	/* 228-235: Unused at present */
--	char reserved1[8];
--	/* 236-239: CRC32 of header excluding last 20 bytes */
--	__u32 header_crc;
--	/* 240-255: Unused at present */
--	char reserved2[16];
--};
--
--#endif /* __BCM63XX_TAG_H */
---- a/drivers/mtd/bcm63xxpart.c
-+++ b/drivers/mtd/bcm63xxpart.c
-@@ -34,7 +34,7 @@
- #include <linux/mtd/partitions.h>
- 
- #include <asm/mach-bcm63xx/bcm63xx_nvram.h>
--#include <asm/mach-bcm63xx/bcm963xx_tag.h>
-+#include <linux/bcm963xx_tag.h>
- #include <asm/mach-bcm63xx/board_bcm963xx.h>
- 
- #define BCM63XX_EXTENDED_SIZE	0xBFC00000	/* Extended flash address */
---- a/include/uapi/linux/Kbuild
-+++ b/include/uapi/linux/Kbuild
-@@ -71,6 +71,7 @@ header-y += blktrace_api.h
- header-y += bpf_common.h
- header-y += bpf.h
- header-y += bpqether.h
-+header-y += bcm963xx_tag.h
- header-y += bsg.h
- header-y += btrfs.h
- header-y += can.h
---- /dev/null
-+++ b/include/uapi/linux/bcm963xx_tag.h
-@@ -0,0 +1,96 @@
-+#ifndef __BCM963XX_TAG_H
-+#define __BCM963XX_TAG_H
-+
-+#define TAGVER_LEN		4	/* Length of Tag Version */
-+#define TAGLAYOUT_LEN		4	/* Length of FlashLayoutVer */
-+#define SIG1_LEN		20	/* Company Signature 1 Length */
-+#define SIG2_LEN		14	/* Company Signature 2 Length */
-+#define BOARDID_LEN		16	/* Length of BoardId */
-+#define ENDIANFLAG_LEN		2	/* Endian Flag Length */
-+#define CHIPID_LEN		6	/* Chip Id Length */
-+#define IMAGE_LEN		10	/* Length of Length Field */
-+#define ADDRESS_LEN		12	/* Length of Address field */
-+#define DUALFLAG_LEN		2	/* Dual Image flag Length */
-+#define INACTIVEFLAG_LEN	2	/* Inactie Flag Length */
-+#define RSASIG_LEN		20	/* Length of RSA Signature in tag */
-+#define TAGINFO1_LEN		30	/* Length of vendor information field1 in tag */
-+#define FLASHLAYOUTVER_LEN	4	/* Length of Flash Layout Version String tag */
-+#define TAGINFO2_LEN		16	/* Length of vendor information field2 in tag */
-+#define ALTTAGINFO_LEN		54	/* Alternate length for vendor information; Pirelli */
-+
-+#define NUM_PIRELLI		2
-+#define IMAGETAG_CRC_START	0xFFFFFFFF
-+
-+#define PIRELLI_BOARDS { \
-+	"AGPF-S0", \
-+	"DWV-S0", \
-+}
-+
-+/*
-+ * The broadcom firmware assumes the rootfs starts the image,
-+ * therefore uses the rootfs start (flash_image_address)
-+ * to determine where to flash the image.  Since we have the kernel first
-+ * we have to give it the kernel address, but the crc uses the length
-+ * associated with this address (root_length), which is added to the kernel
-+ * length (kernel_length) to determine the length of image to flash and thus
-+ * needs to be rootfs + deadcode (jffs2 EOF marker)
-+*/
-+
-+struct bcm_tag {
-+	/* 0-3: Version of the image tag */
-+	char tag_version[TAGVER_LEN];
-+	/* 4-23: Company Line 1 */
-+	char sig_1[SIG1_LEN];
-+	/*  24-37: Company Line 2 */
-+	char sig_2[SIG2_LEN];
-+	/* 38-43: Chip this image is for */
-+	char chip_id[CHIPID_LEN];
-+	/* 44-59: Board name */
-+	char board_id[BOARDID_LEN];
-+	/* 60-61: Map endianness -- 1 BE 0 LE */
-+	char big_endian[ENDIANFLAG_LEN];
-+	/* 62-71: Total length of image */
-+	char total_length[IMAGE_LEN];
-+	/* 72-83: Address in memory of CFE */
-+	char cfe__address[ADDRESS_LEN];
-+	/* 84-93: Size of CFE */
-+	char cfe_length[IMAGE_LEN];
-+	/* 94-105: Address in memory of image start
-+	 * (kernel for OpenWRT, rootfs for stock firmware)
-+	 */
-+	char flash_image_start[ADDRESS_LEN];
-+	/* 106-115: Size of rootfs */
-+	char root_length[IMAGE_LEN];
-+	/* 116-127: Address in memory of kernel */
-+	char kernel_address[ADDRESS_LEN];
-+	/* 128-137: Size of kernel */
-+	char kernel_length[IMAGE_LEN];
-+	/* 138-139: Unused at the moment */
-+	char dual_image[DUALFLAG_LEN];
-+	/* 140-141: Unused at the moment */
-+	char inactive_flag[INACTIVEFLAG_LEN];
-+	/* 142-161: RSA Signature (not used; some vendors may use this) */
-+	char rsa_signature[RSASIG_LEN];
-+	/* 162-191: Compilation and related information (not used in OpenWrt) */
-+	char information1[TAGINFO1_LEN];
-+	/* 192-195: Version flash layout */
-+	char flash_layout_ver[FLASHLAYOUTVER_LEN];
-+	/* 196-199: kernel+rootfs CRC32 */
-+	__u32 fskernel_crc;
-+	/* 200-215: Unused except on Alice Gate where is is information */
-+	char information2[TAGINFO2_LEN];
-+	/* 216-219: CRC32 of image less imagetag (kernel for Alice Gate) */
-+	__u32 image_crc;
-+	/* 220-223: CRC32 of rootfs partition */
-+	__u32 rootfs_crc;
-+	/* 224-227: CRC32 of kernel partition */
-+	__u32 kernel_crc;
-+	/* 228-235: Unused at present */
-+	char reserved1[8];
-+	/* 236-239: CRC32 of header excluding last 20 bytes */
-+	__u32 header_crc;
-+	/* 240-255: Unused at present */
-+	char reserved2[16];
-+};
-+
-+#endif /* __BCM63XX_TAG_H */
diff --git a/target/linux/generic/patches-3.8/261-move_bcm963xx_tag.patch b/target/linux/generic/patches-3.8/261-move_bcm963xx_tag.patch
deleted file mode 100644
index c85719930e..0000000000
--- a/target/linux/generic/patches-3.8/261-move_bcm963xx_tag.patch
+++ /dev/null
@@ -1,219 +0,0 @@
---- a/arch/mips/include/asm/mach-bcm63xx/bcm963xx_tag.h
-+++ /dev/null
-@@ -1,96 +0,0 @@
--#ifndef __BCM963XX_TAG_H
--#define __BCM963XX_TAG_H
--
--#define TAGVER_LEN		4	/* Length of Tag Version */
--#define TAGLAYOUT_LEN		4	/* Length of FlashLayoutVer */
--#define SIG1_LEN		20	/* Company Signature 1 Length */
--#define SIG2_LEN		14	/* Company Signature 2 Length */
--#define BOARDID_LEN		16	/* Length of BoardId */
--#define ENDIANFLAG_LEN		2	/* Endian Flag Length */
--#define CHIPID_LEN		6	/* Chip Id Length */
--#define IMAGE_LEN		10	/* Length of Length Field */
--#define ADDRESS_LEN		12	/* Length of Address field */
--#define DUALFLAG_LEN		2	/* Dual Image flag Length */
--#define INACTIVEFLAG_LEN	2	/* Inactie Flag Length */
--#define RSASIG_LEN		20	/* Length of RSA Signature in tag */
--#define TAGINFO1_LEN		30	/* Length of vendor information field1 in tag */
--#define FLASHLAYOUTVER_LEN	4	/* Length of Flash Layout Version String tag */
--#define TAGINFO2_LEN		16	/* Length of vendor information field2 in tag */
--#define ALTTAGINFO_LEN		54	/* Alternate length for vendor information; Pirelli */
--
--#define NUM_PIRELLI		2
--#define IMAGETAG_CRC_START	0xFFFFFFFF
--
--#define PIRELLI_BOARDS { \
--	"AGPF-S0", \
--	"DWV-S0", \
--}
--
--/*
-- * The broadcom firmware assumes the rootfs starts the image,
-- * therefore uses the rootfs start (flash_image_address)
-- * to determine where to flash the image.  Since we have the kernel first
-- * we have to give it the kernel address, but the crc uses the length
-- * associated with this address (root_length), which is added to the kernel
-- * length (kernel_length) to determine the length of image to flash and thus
-- * needs to be rootfs + deadcode (jffs2 EOF marker)
--*/
--
--struct bcm_tag {
--	/* 0-3: Version of the image tag */
--	char tag_version[TAGVER_LEN];
--	/* 4-23: Company Line 1 */
--	char sig_1[SIG1_LEN];
--	/*  24-37: Company Line 2 */
--	char sig_2[SIG2_LEN];
--	/* 38-43: Chip this image is for */
--	char chip_id[CHIPID_LEN];
--	/* 44-59: Board name */
--	char board_id[BOARDID_LEN];
--	/* 60-61: Map endianness -- 1 BE 0 LE */
--	char big_endian[ENDIANFLAG_LEN];
--	/* 62-71: Total length of image */
--	char total_length[IMAGE_LEN];
--	/* 72-83: Address in memory of CFE */
--	char cfe__address[ADDRESS_LEN];
--	/* 84-93: Size of CFE */
--	char cfe_length[IMAGE_LEN];
--	/* 94-105: Address in memory of image start
--	 * (kernel for OpenWRT, rootfs for stock firmware)
--	 */
--	char flash_image_start[ADDRESS_LEN];
--	/* 106-115: Size of rootfs */
--	char root_length[IMAGE_LEN];
--	/* 116-127: Address in memory of kernel */
--	char kernel_address[ADDRESS_LEN];
--	/* 128-137: Size of kernel */
--	char kernel_length[IMAGE_LEN];
--	/* 138-139: Unused at the moment */
--	char dual_image[DUALFLAG_LEN];
--	/* 140-141: Unused at the moment */
--	char inactive_flag[INACTIVEFLAG_LEN];
--	/* 142-161: RSA Signature (not used; some vendors may use this) */
--	char rsa_signature[RSASIG_LEN];
--	/* 162-191: Compilation and related information (not used in OpenWrt) */
--	char information1[TAGINFO1_LEN];
--	/* 192-195: Version flash layout */
--	char flash_layout_ver[FLASHLAYOUTVER_LEN];
--	/* 196-199: kernel+rootfs CRC32 */
--	__u32 fskernel_crc;
--	/* 200-215: Unused except on Alice Gate where is is information */
--	char information2[TAGINFO2_LEN];
--	/* 216-219: CRC32 of image less imagetag (kernel for Alice Gate) */
--	__u32 image_crc;
--	/* 220-223: CRC32 of rootfs partition */
--	__u32 rootfs_crc;
--	/* 224-227: CRC32 of kernel partition */
--	__u32 kernel_crc;
--	/* 228-235: Unused at present */
--	char reserved1[8];
--	/* 236-239: CRC32 of header excluding last 20 bytes */
--	__u32 header_crc;
--	/* 240-255: Unused at present */
--	char reserved2[16];
--};
--
--#endif /* __BCM63XX_TAG_H */
---- a/drivers/mtd/bcm63xxpart.c
-+++ b/drivers/mtd/bcm63xxpart.c
-@@ -32,7 +32,7 @@
- #include <linux/mtd/mtd.h>
- #include <linux/mtd/partitions.h>
- 
--#include <asm/mach-bcm63xx/bcm963xx_tag.h>
-+#include <linux/bcm963xx_tag.h>
- #include <asm/mach-bcm63xx/board_bcm963xx.h>
- 
- #define BCM63XX_EXTENDED_SIZE	0xBFC00000	/* Extended flash address */
---- a/include/uapi/linux/Kbuild
-+++ b/include/uapi/linux/Kbuild
-@@ -67,6 +67,7 @@ header-y += binfmts.h
- header-y += blkpg.h
- header-y += blktrace_api.h
- header-y += bpqether.h
-+header-y += bcm963xx_tag.h
- header-y += bsg.h
- header-y += can.h
- header-y += capability.h
---- /dev/null
-+++ b/include/uapi/linux/bcm963xx_tag.h
-@@ -0,0 +1,96 @@
-+#ifndef __BCM963XX_TAG_H
-+#define __BCM963XX_TAG_H
-+
-+#define TAGVER_LEN		4	/* Length of Tag Version */
-+#define TAGLAYOUT_LEN		4	/* Length of FlashLayoutVer */
-+#define SIG1_LEN		20	/* Company Signature 1 Length */
-+#define SIG2_LEN		14	/* Company Signature 2 Length */
-+#define BOARDID_LEN		16	/* Length of BoardId */
-+#define ENDIANFLAG_LEN		2	/* Endian Flag Length */
-+#define CHIPID_LEN		6	/* Chip Id Length */
-+#define IMAGE_LEN		10	/* Length of Length Field */
-+#define ADDRESS_LEN		12	/* Length of Address field */
-+#define DUALFLAG_LEN		2	/* Dual Image flag Length */
-+#define INACTIVEFLAG_LEN	2	/* Inactie Flag Length */
-+#define RSASIG_LEN		20	/* Length of RSA Signature in tag */
-+#define TAGINFO1_LEN		30	/* Length of vendor information field1 in tag */
-+#define FLASHLAYOUTVER_LEN	4	/* Length of Flash Layout Version String tag */
-+#define TAGINFO2_LEN		16	/* Length of vendor information field2 in tag */
-+#define ALTTAGINFO_LEN		54	/* Alternate length for vendor information; Pirelli */
-+
-+#define NUM_PIRELLI		2
-+#define IMAGETAG_CRC_START	0xFFFFFFFF
-+
-+#define PIRELLI_BOARDS { \
-+	"AGPF-S0", \
-+	"DWV-S0", \
-+}
-+
-+/*
-+ * The broadcom firmware assumes the rootfs starts the image,
-+ * therefore uses the rootfs start (flash_image_address)
-+ * to determine where to flash the image.  Since we have the kernel first
-+ * we have to give it the kernel address, but the crc uses the length
-+ * associated with this address (root_length), which is added to the kernel
-+ * length (kernel_length) to determine the length of image to flash and thus
-+ * needs to be rootfs + deadcode (jffs2 EOF marker)
-+*/
-+
-+struct bcm_tag {
-+	/* 0-3: Version of the image tag */
-+	char tag_version[TAGVER_LEN];
-+	/* 4-23: Company Line 1 */
-+	char sig_1[SIG1_LEN];
-+	/*  24-37: Company Line 2 */
-+	char sig_2[SIG2_LEN];
-+	/* 38-43: Chip this image is for */
-+	char chip_id[CHIPID_LEN];
-+	/* 44-59: Board name */
-+	char board_id[BOARDID_LEN];
-+	/* 60-61: Map endianness -- 1 BE 0 LE */
-+	char big_endian[ENDIANFLAG_LEN];
-+	/* 62-71: Total length of image */
-+	char total_length[IMAGE_LEN];
-+	/* 72-83: Address in memory of CFE */
-+	char cfe__address[ADDRESS_LEN];
-+	/* 84-93: Size of CFE */
-+	char cfe_length[IMAGE_LEN];
-+	/* 94-105: Address in memory of image start
-+	 * (kernel for OpenWRT, rootfs for stock firmware)
-+	 */
-+	char flash_image_start[ADDRESS_LEN];
-+	/* 106-115: Size of rootfs */
-+	char root_length[IMAGE_LEN];
-+	/* 116-127: Address in memory of kernel */
-+	char kernel_address[ADDRESS_LEN];
-+	/* 128-137: Size of kernel */
-+	char kernel_length[IMAGE_LEN];
-+	/* 138-139: Unused at the moment */
-+	char dual_image[DUALFLAG_LEN];
-+	/* 140-141: Unused at the moment */
-+	char inactive_flag[INACTIVEFLAG_LEN];
-+	/* 142-161: RSA Signature (not used; some vendors may use this) */
-+	char rsa_signature[RSASIG_LEN];
-+	/* 162-191: Compilation and related information (not used in OpenWrt) */
-+	char information1[TAGINFO1_LEN];
-+	/* 192-195: Version flash layout */
-+	char flash_layout_ver[FLASHLAYOUTVER_LEN];
-+	/* 196-199: kernel+rootfs CRC32 */
-+	__u32 fskernel_crc;
-+	/* 200-215: Unused except on Alice Gate where is is information */
-+	char information2[TAGINFO2_LEN];
-+	/* 216-219: CRC32 of image less imagetag (kernel for Alice Gate) */
-+	__u32 image_crc;
-+	/* 220-223: CRC32 of rootfs partition */
-+	__u32 rootfs_crc;
-+	/* 224-227: CRC32 of kernel partition */
-+	__u32 kernel_crc;
-+	/* 228-235: Unused at present */
-+	char reserved1[8];
-+	/* 236-239: CRC32 of header excluding last 20 bytes */
-+	__u32 header_crc;
-+	/* 240-255: Unused at present */
-+	char reserved2[16];
-+};
-+
-+#endif /* __BCM63XX_TAG_H */
diff --git a/target/linux/generic/patches-4.0/261-move_bcm963xx_tag.patch b/target/linux/generic/patches-4.0/261-move_bcm963xx_tag.patch
deleted file mode 100644
index b4b02a7bb2..0000000000
--- a/target/linux/generic/patches-4.0/261-move_bcm963xx_tag.patch
+++ /dev/null
@@ -1,219 +0,0 @@
---- a/arch/mips/include/asm/mach-bcm63xx/bcm963xx_tag.h
-+++ /dev/null
-@@ -1,96 +0,0 @@
--#ifndef __BCM963XX_TAG_H
--#define __BCM963XX_TAG_H
--
--#define TAGVER_LEN		4	/* Length of Tag Version */
--#define TAGLAYOUT_LEN		4	/* Length of FlashLayoutVer */
--#define SIG1_LEN		20	/* Company Signature 1 Length */
--#define SIG2_LEN		14	/* Company Signature 2 Length */
--#define BOARDID_LEN		16	/* Length of BoardId */
--#define ENDIANFLAG_LEN		2	/* Endian Flag Length */
--#define CHIPID_LEN		6	/* Chip Id Length */
--#define IMAGE_LEN		10	/* Length of Length Field */
--#define ADDRESS_LEN		12	/* Length of Address field */
--#define DUALFLAG_LEN		2	/* Dual Image flag Length */
--#define INACTIVEFLAG_LEN	2	/* Inactie Flag Length */
--#define RSASIG_LEN		20	/* Length of RSA Signature in tag */
--#define TAGINFO1_LEN		30	/* Length of vendor information field1 in tag */
--#define FLASHLAYOUTVER_LEN	4	/* Length of Flash Layout Version String tag */
--#define TAGINFO2_LEN		16	/* Length of vendor information field2 in tag */
--#define ALTTAGINFO_LEN		54	/* Alternate length for vendor information; Pirelli */
--
--#define NUM_PIRELLI		2
--#define IMAGETAG_CRC_START	0xFFFFFFFF
--
--#define PIRELLI_BOARDS { \
--	"AGPF-S0", \
--	"DWV-S0", \
--}
--
--/*
-- * The broadcom firmware assumes the rootfs starts the image,
-- * therefore uses the rootfs start (flash_image_address)
-- * to determine where to flash the image.  Since we have the kernel first
-- * we have to give it the kernel address, but the crc uses the length
-- * associated with this address (root_length), which is added to the kernel
-- * length (kernel_length) to determine the length of image to flash and thus
-- * needs to be rootfs + deadcode (jffs2 EOF marker)
--*/
--
--struct bcm_tag {
--	/* 0-3: Version of the image tag */
--	char tag_version[TAGVER_LEN];
--	/* 4-23: Company Line 1 */
--	char sig_1[SIG1_LEN];
--	/*  24-37: Company Line 2 */
--	char sig_2[SIG2_LEN];
--	/* 38-43: Chip this image is for */
--	char chip_id[CHIPID_LEN];
--	/* 44-59: Board name */
--	char board_id[BOARDID_LEN];
--	/* 60-61: Map endianness -- 1 BE 0 LE */
--	char big_endian[ENDIANFLAG_LEN];
--	/* 62-71: Total length of image */
--	char total_length[IMAGE_LEN];
--	/* 72-83: Address in memory of CFE */
--	char cfe__address[ADDRESS_LEN];
--	/* 84-93: Size of CFE */
--	char cfe_length[IMAGE_LEN];
--	/* 94-105: Address in memory of image start
--	 * (kernel for OpenWRT, rootfs for stock firmware)
--	 */
--	char flash_image_start[ADDRESS_LEN];
--	/* 106-115: Size of rootfs */
--	char root_length[IMAGE_LEN];
--	/* 116-127: Address in memory of kernel */
--	char kernel_address[ADDRESS_LEN];
--	/* 128-137: Size of kernel */
--	char kernel_length[IMAGE_LEN];
--	/* 138-139: Unused at the moment */
--	char dual_image[DUALFLAG_LEN];
--	/* 140-141: Unused at the moment */
--	char inactive_flag[INACTIVEFLAG_LEN];
--	/* 142-161: RSA Signature (not used; some vendors may use this) */
--	char rsa_signature[RSASIG_LEN];
--	/* 162-191: Compilation and related information (not used in OpenWrt) */
--	char information1[TAGINFO1_LEN];
--	/* 192-195: Version flash layout */
--	char flash_layout_ver[FLASHLAYOUTVER_LEN];
--	/* 196-199: kernel+rootfs CRC32 */
--	__u32 fskernel_crc;
--	/* 200-215: Unused except on Alice Gate where is is information */
--	char information2[TAGINFO2_LEN];
--	/* 216-219: CRC32 of image less imagetag (kernel for Alice Gate) */
--	__u32 image_crc;
--	/* 220-223: CRC32 of rootfs partition */
--	__u32 rootfs_crc;
--	/* 224-227: CRC32 of kernel partition */
--	__u32 kernel_crc;
--	/* 228-235: Unused at present */
--	char reserved1[8];
--	/* 236-239: CRC32 of header excluding last 20 bytes */
--	__u32 header_crc;
--	/* 240-255: Unused at present */
--	char reserved2[16];
--};
--
--#endif /* __BCM63XX_TAG_H */
---- a/drivers/mtd/bcm63xxpart.c
-+++ b/drivers/mtd/bcm63xxpart.c
-@@ -34,7 +34,7 @@
- #include <linux/mtd/partitions.h>
- 
- #include <asm/mach-bcm63xx/bcm63xx_nvram.h>
--#include <asm/mach-bcm63xx/bcm963xx_tag.h>
-+#include <linux/bcm963xx_tag.h>
- #include <asm/mach-bcm63xx/board_bcm963xx.h>
- 
- #define BCM63XX_EXTENDED_SIZE	0xBFC00000	/* Extended flash address */
---- a/include/uapi/linux/Kbuild
-+++ b/include/uapi/linux/Kbuild
-@@ -72,6 +72,7 @@ header-y += blktrace_api.h
- header-y += bpf_common.h
- header-y += bpf.h
- header-y += bpqether.h
-+header-y += bcm963xx_tag.h
- header-y += bsg.h
- header-y += btrfs.h
- header-y += can.h
---- /dev/null
-+++ b/include/uapi/linux/bcm963xx_tag.h
-@@ -0,0 +1,96 @@
-+#ifndef __BCM963XX_TAG_H
-+#define __BCM963XX_TAG_H
-+
-+#define TAGVER_LEN		4	/* Length of Tag Version */
-+#define TAGLAYOUT_LEN		4	/* Length of FlashLayoutVer */
-+#define SIG1_LEN		20	/* Company Signature 1 Length */
-+#define SIG2_LEN		14	/* Company Signature 2 Length */
-+#define BOARDID_LEN		16	/* Length of BoardId */
-+#define ENDIANFLAG_LEN		2	/* Endian Flag Length */
-+#define CHIPID_LEN		6	/* Chip Id Length */
-+#define IMAGE_LEN		10	/* Length of Length Field */
-+#define ADDRESS_LEN		12	/* Length of Address field */
-+#define DUALFLAG_LEN		2	/* Dual Image flag Length */
-+#define INACTIVEFLAG_LEN	2	/* Inactie Flag Length */
-+#define RSASIG_LEN		20	/* Length of RSA Signature in tag */
-+#define TAGINFO1_LEN		30	/* Length of vendor information field1 in tag */
-+#define FLASHLAYOUTVER_LEN	4	/* Length of Flash Layout Version String tag */
-+#define TAGINFO2_LEN		16	/* Length of vendor information field2 in tag */
-+#define ALTTAGINFO_LEN		54	/* Alternate length for vendor information; Pirelli */
-+
-+#define NUM_PIRELLI		2
-+#define IMAGETAG_CRC_START	0xFFFFFFFF
-+
-+#define PIRELLI_BOARDS { \
-+	"AGPF-S0", \
-+	"DWV-S0", \
-+}
-+
-+/*
-+ * The broadcom firmware assumes the rootfs starts the image,
-+ * therefore uses the rootfs start (flash_image_address)
-+ * to determine where to flash the image.  Since we have the kernel first
-+ * we have to give it the kernel address, but the crc uses the length
-+ * associated with this address (root_length), which is added to the kernel
-+ * length (kernel_length) to determine the length of image to flash and thus
-+ * needs to be rootfs + deadcode (jffs2 EOF marker)
-+*/
-+
-+struct bcm_tag {
-+	/* 0-3: Version of the image tag */
-+	char tag_version[TAGVER_LEN];
-+	/* 4-23: Company Line 1 */
-+	char sig_1[SIG1_LEN];
-+	/*  24-37: Company Line 2 */
-+	char sig_2[SIG2_LEN];
-+	/* 38-43: Chip this image is for */
-+	char chip_id[CHIPID_LEN];
-+	/* 44-59: Board name */
-+	char board_id[BOARDID_LEN];
-+	/* 60-61: Map endianness -- 1 BE 0 LE */
-+	char big_endian[ENDIANFLAG_LEN];
-+	/* 62-71: Total length of image */
-+	char total_length[IMAGE_LEN];
-+	/* 72-83: Address in memory of CFE */
-+	char cfe__address[ADDRESS_LEN];
-+	/* 84-93: Size of CFE */
-+	char cfe_length[IMAGE_LEN];
-+	/* 94-105: Address in memory of image start
-+	 * (kernel for OpenWRT, rootfs for stock firmware)
-+	 */
-+	char flash_image_start[ADDRESS_LEN];
-+	/* 106-115: Size of rootfs */
-+	char root_length[IMAGE_LEN];
-+	/* 116-127: Address in memory of kernel */
-+	char kernel_address[ADDRESS_LEN];
-+	/* 128-137: Size of kernel */
-+	char kernel_length[IMAGE_LEN];
-+	/* 138-139: Unused at the moment */
-+	char dual_image[DUALFLAG_LEN];
-+	/* 140-141: Unused at the moment */
-+	char inactive_flag[INACTIVEFLAG_LEN];
-+	/* 142-161: RSA Signature (not used; some vendors may use this) */
-+	char rsa_signature[RSASIG_LEN];
-+	/* 162-191: Compilation and related information (not used in OpenWrt) */
-+	char information1[TAGINFO1_LEN];
-+	/* 192-195: Version flash layout */
-+	char flash_layout_ver[FLASHLAYOUTVER_LEN];
-+	/* 196-199: kernel+rootfs CRC32 */
-+	__u32 fskernel_crc;
-+	/* 200-215: Unused except on Alice Gate where is is information */
-+	char information2[TAGINFO2_LEN];
-+	/* 216-219: CRC32 of image less imagetag (kernel for Alice Gate) */
-+	__u32 image_crc;
-+	/* 220-223: CRC32 of rootfs partition */
-+	__u32 rootfs_crc;
-+	/* 224-227: CRC32 of kernel partition */
-+	__u32 kernel_crc;
-+	/* 228-235: Unused at present */
-+	char reserved1[8];
-+	/* 236-239: CRC32 of header excluding last 20 bytes */
-+	__u32 header_crc;
-+	/* 240-255: Unused at present */
-+	char reserved2[16];
-+};
-+
-+#endif /* __BCM63XX_TAG_H */
-- 
GitLab