Ping?

On Fri, Oct 26, 2012 at 12:13 AM, Catalin Patulea <[email protected]> wrote:
>
> Signed-off-by: Catalin Patulea <[email protected]>
> ---
> Unlikely myloader.h, bcm963xx_tag.h was already in the kernel tree, so to move
> it, I didn't want to have the patch remove it and to add it through files - so
> the patch does both. It should be easier to update if bcm963xx_tag.h changes
> upstream.
>
> The patch is in linux/generic because if it were in brcm63xx, then 
> non-brcm63xx
> builds would still emit the warning.
>
> You have to run 'make toolchain/kernel-headers/{clean,install}' after applying
> this so the toolchain refreshes exported headers from the kernel and places
> them somewhere in the include path.
>
> Build tested on malta_be and brcm63xx.
>
>  package/mtd/Makefile                               |    2 +-
>  package/mtd/src/imagetag.c                         |    2 +-
>  .../patches-3.3/115-move_bcm963xx_tag.patch        |  220 
> ++++++++++++++++++++
>  3 files changed, 222 insertions(+), 2 deletions(-)
>  create mode 100644 
> target/linux/generic/patches-3.3/115-move_bcm963xx_tag.patch
>
> diff --git a/package/mtd/Makefile b/package/mtd/Makefile
> index c6b94ff..9304c78 100644
> --- a/package/mtd/Makefile
> +++ b/package/mtd/Makefile
> @@ -38,7 +38,7 @@ endef
>  target=$(firstword $(subst -, ,$(BOARD)))
>
>  MAKE_FLAGS += TARGET="$(target)"
> -TARGET_CFLAGS := -I$(LINUX_DIR)/include $(TARGET_CFLAGS) 
> -Dtarget_$(target)=1 -Wall
> +TARGET_CFLAGS += -Dtarget_$(target)=1 -Wall
>
>  ifdef CONFIG_MTD_REDBOOT_PARTS
>    MAKE_FLAGS += FIS_SUPPORT=1
> diff --git a/package/mtd/src/imagetag.c b/package/mtd/src/imagetag.c
> index 9f5c193..a53c17a 100644
> --- a/package/mtd/src/imagetag.c
> +++ b/package/mtd/src/imagetag.c
> @@ -32,7 +32,7 @@
>
>  #include <sys/ioctl.h>
>  #include <mtd/mtd-user.h>
> -#include <../arch/mips/include/asm/mach-bcm63xx/bcm963xx_tag.h>
> +#include <linux/bcm963xx_tag.h>
>
>  #include "mtd.h"
>  #include "crc32.h"
> diff --git a/target/linux/generic/patches-3.3/115-move_bcm963xx_tag.patch 
> b/target/linux/generic/patches-3.3/115-move_bcm963xx_tag.patch
> new file mode 100644
> index 0000000..da27fb6
> --- /dev/null
> +++ b/target/linux/generic/patches-3.3/115-move_bcm963xx_tag.patch
> @@ -0,0 +1,220 @@
> +--- a/arch/mips/include/asm/mach-bcm63xx/bcm963xx_tag.h
> ++++ b/arch/mips/include/asm/mach-bcm63xx/bcm963xx_tag.h
> +@@ -1,96 +1 @@
> +-#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 */
> ++#error In OpenWrt, this files lives at <linux/bcm963xx_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/linux/Kbuild
> ++++ b/include/linux/Kbuild
> +@@ -77,6 +77,7 @@ header-y += blk_types.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/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 */
> --
> 1.7.7.3
>
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to