Changeset 20652


Ignore:
Timestamp:
2010-04-01T23:20:43+02:00 (8 years ago)
Author:
florian
Message:

[brcm63xx] flashmap and image generation: reduced union bcm_tag to a single struct
combining the elements so that it is no longer necessary to create an openwrt-only
tagid and tagcrc, and elimate the tagid detection and switch statements which
made dealing with imagetags overly complicated, especially since the logic would
need analogs in all code that touched the imagetag. Patch from cshore.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/brcm63xx/files/arch/mips/include/asm/mach-bcm63xx/bcm_tag.h

    r20548 r20652  
    22#define __BCM63XX_TAG_H 
    33 
     4#define TAGVER_LEN 4                   /* Length of Tag Version */ 
     5#define TAGLAYOUT_LEN 4                /* Length of FlashLayoutVer */ 
     6#define SIG1_LEN 20                    /* Company Signature 1 Length */ 
     7#define SIG2_LEN 14                    /* Company Signature 2 Lenght */ 
     8#define BOARDID_LEN 16                 /* Length of BoardId */ 
     9#define ENDIANFLAG_LEN 2               /* Endian Flag Length */ 
     10#define CHIPID_LEN 6                   /* Chip Id Length */ 
    411#define IMAGE_LEN 10                   /* Length of Length Field */ 
    512#define ADDRESS_LEN 12                 /* Length of Address field */ 
    6 #define TAGID_LEN  6                   /* Length of tag ID */ 
    7 #define TAGINFO_LEN 20                 /* Length of vendor information field in tag */ 
    8 #define TAGVER_LEN 4                   /* Length of Tag Version */ 
    9 #define TAGLAYOUT_LEN 4                /* Length of FlashLayoutVer */ 
     13#define DUALFLAG_LEN 2                 /* Dual Image flag Length */ 
     14#define INACTIVEFLAG_LEN 2             /* Inactie Flag Length */ 
     15#define RSASIG_LEN 20                  /* Length of RSA Signature in tag */ 
     16#define TAGINFO1_LEN 30                /* Length of vendor information field1 in tag */ 
     17#define FLASHLAYOUTVER_LEN 4           /* Length of Flash Layout Version String tag */ 
     18#define TAGINFO2_LEN 16                /* Length of vendor information field2 in tag */ 
     19#define CRC_LEN 4                      /* Length of CRC in bytes */ 
     20#define ALTTAGINFO_LEN 54              /* Alternate length for vendor information; Pirelli */ 
    1021 
    11 #define NUM_TAGID 5 
     22#define NUM_PIRELLI 2 
    1223#define IMAGETAG_CRC_START              0xFFFFFFFF 
    1324 
    14 struct tagiddesc_t { 
    15   char tagid[TAGID_LEN + 1]; 
    16   char tagiddesc[80]; 
    17 }; 
    18  
    19  // bc221 is used by BT Voyager and should be right 
    20  // bc310 should be right, and may apply to 3.08 code as well 
    21 #define TAGID_DEFINITIONS { \ 
    22   { "bccfe", "Broadcom CFE flash image" }, \ 
    23   { "bc300", "Broadcom code version 3.00-3.06 and all ftp/tftp flash" }, \ 
    24   { "ag306", "Alice Gate (Pirelli, based on Broadcom 3.06)" }, \ 
    25   { "bc221", "Broadcom code version 2.21" }, \ 
    26   { "bc310", "Broadcom code version 3.10-3.12" }, \ 
     25#define PIRELLI_BOARDS { \ 
     26  "AGPF_S0", \ 
     27  "DWV_SO", \ 
    2728} 
    2829 
    29 struct bcm_tag_bccfe { 
    30         unsigned char tagVersion[TAGVER_LEN];           // 0-3: Version of the image tag 
    31         unsigned char sig_1[20];                        // 4-23: Company Line 1 
    32         unsigned char sig_2[14];                        // 24-37: Company Line 2 
    33         unsigned char chipid[6];                        // 38-43: Chip this image is for 
    34         unsigned char boardid[16];                      // 44-59: Board name 
    35         unsigned char big_endian[2];                    // 60-61: Map endianness -- 1 BE 0 LE 
    36         unsigned char totalLength[IMAGE_LEN];           // 62-71: Total length of image 
    37         unsigned char cfeAddress[ADDRESS_LEN];          // 72-83: Address in memory of CFE 
    38         unsigned char cfeLength[IMAGE_LEN];             // 84-93: Size of CFE 
    39         unsigned char rootAddress[ADDRESS_LEN];         // 94-105: Address in memory of rootfs 
    40         unsigned char rootLength[IMAGE_LEN];            // 106-115: Size of rootfs 
    41         unsigned char kernelAddress[ADDRESS_LEN];       // 116-127: Address in memory of kernel 
    42         unsigned char kernelLength[IMAGE_LEN];          // 128-137: Size of kernel 
    43         unsigned char dualImage[2];                     // 138-139: Unused at present 
    44         unsigned char inactiveFlag[2];                  // 140-141: Unused at present 
    45         unsigned char information1[TAGINFO_LEN];        // 142-161: Unused at present 
    46         unsigned char tagId[TAGID_LEN];                 // 162-167: Identifies which type of tag this is, currently two-letter company code, and then three digits for version of broadcom code in which this tag was first introduced 
    47         unsigned char tagIdCRC[4];                      // 168-171: CRC32 of tagId 
    48         unsigned char reserved1[44];                    // 172-215: Reserved area not in use 
    49         unsigned char imageCRC[4];                      // 216-219: CRC32 of images 
    50         unsigned char reserved2[16];                    // 220-235: Unused at present 
    51         unsigned char headerCRC[4];                     // 236-239: CRC32 of header excluding tagVersion 
    52         unsigned char reserved3[16];                    // 240-255: Unused at present 
    53 }; 
     30/* 
     31 * The broadcom firmware assumes the rootfs starts the image, 
     32 * therefore uses the rootfs start (flashImageAddress) 
     33 * to determine where to flash the image.  Since we have the kernel first 
     34 * we have to give it the kernel address, but the crc uses the length 
     35 * associated with this address (rootLength), which is added to the kernel 
     36 * length (kernelLength) to determine the length of image to flash and thus 
     37 * needs to be rootfs + deadcode (jffs2 EOF marker) 
     38*/ 
    5439 
    55 struct bcm_tag_bc300 { 
    56         unsigned char tagVersion[TAGVER_LEN];           // 0-3: Version of the image tag 
    57         unsigned char sig_1[20];                        // 4-23: Company Line 1 
    58         unsigned char sig_2[14];                        // 24-37: Company Line 2 
    59         unsigned char chipid[6];                        // 38-43: Chip this image is for 
    60         unsigned char boardid[16];                      // 44-59: Board name 
    61         unsigned char big_endian[2];                    // 60-61: Map endianness -- 1 BE 0 LE 
    62         unsigned char totalLength[IMAGE_LEN];           // 62-71: Total length of image 
    63         unsigned char cfeAddress[ADDRESS_LEN];          // 72-83: Address in memory of CFE 
    64         unsigned char cfeLength[IMAGE_LEN];             // 84-93: Size of CFE 
    65         unsigned char flashImageStart[ADDRESS_LEN];     // 94-105: Address in memory of kernel (start of image) 
    66         unsigned char flashRootLength[IMAGE_LEN];       // 106-115: Size of rootfs + deadcode (web flash uses this + kernelLength to determine the size of the kernel+rootfs flash image) 
    67         unsigned char kernelAddress[ADDRESS_LEN];       // 116-127: Address in memory of kernel 
    68         unsigned char kernelLength[IMAGE_LEN];          // 128-137: Size of kernel 
    69         unsigned char dualImage[2];                     // 138-139: Unused at present 
    70         unsigned char inactiveFlag[2];                  // 140-141: Unused at present 
    71         unsigned char information1[TAGINFO_LEN];        // 142-161: Unused at present 
    72         unsigned char tagId[TAGID_LEN];                 // 162-167: Identifies which type of tag this is, currently two-letter company code, and then three digits for version of broadcom code in which this tag was first introduced 
    73         unsigned char tagIdCRC[4];                      // 168-173: CRC32 to ensure validity of tagId 
    74         unsigned char rootAddress[ADDRESS_LEN];         // 174-183: Address in memory of rootfs partition 
    75         unsigned char rootLength[IMAGE_LEN];            // 184-193: Size of rootfs partition 
    76         unsigned char reserved1[22];                    // 194-215: Reserved area not in use 
    77         unsigned char imageCRC[4];                      // 216-219: CRC32 of images 
    78         unsigned char reserved2[16];                    // 220-235: Unused at present 
    79         unsigned char headerCRC[4];                     // 236-239: CRC32 of header excluding tagVersion 
    80         unsigned char reserved3[16];                    // 240-255: Unused at present 
    81 }; 
    82  
    83 struct bcm_tag_ag306 { 
    84         unsigned char tagVersion[TAGVER_LEN];           // 0-3: Version of the image tag 
    85         unsigned char sig_1[20];                        // 4-23: Company Line 1 
    86         unsigned char sig_2[14];                        // 24-37: Company Line 2 
    87         unsigned char chipid[6];                        // 38-43: Chip this image is for 
    88         unsigned char boardid[16];                      // 44-59: Board name 
    89         unsigned char big_endian[2];                    // 60-61: Map endianness -- 1 BE 0 LE 
    90         unsigned char totalLength[IMAGE_LEN];           // 62-71: Total length of image 
    91         unsigned char cfeAddress[ADDRESS_LEN];          // 72-83: Address in memory of CFE 
    92         unsigned char cfeLength[IMAGE_LEN];             // 84-93: Size of CFE 
    93         unsigned char flashImageStart[ADDRESS_LEN];     // 94-105: Address in memory of kernel (start of image) 
    94         unsigned char flashRootLength[IMAGE_LEN];       // 106-115: Size of rootfs + deadcode (web flash uses this + kernelLength to determine the size of the kernel+rootfs flash image) 
    95         unsigned char kernelAddress[ADDRESS_LEN];       // 116-127: Address in memory of kernel 
    96         unsigned char kernelLength[IMAGE_LEN];          // 128-137: Size of kernel 
    97         unsigned char dualImage[2];                     // 138-139: Unused at present 
    98         unsigned char inactiveFlag[2];                  // 140-141: Unused at present 
    99         unsigned char information1[TAGINFO_LEN];        // 142-161: Unused at present 
    100         unsigned char information2[54];                 // 162-215: Compilation and related information (not generated/used by OpenWRT) 
    101         unsigned char kernelCRC[4] ;                    // 216-219: CRC32 of images 
    102         unsigned char rootAddress[ADDRESS_LEN];         // 220-231: Address in memory of rootfs partition 
    103         unsigned char tagIdCRC[4];                      // 232-235: Checksum to ensure validity of tagId 
    104         unsigned char headerCRC[4];                     // 236-239: CRC32 of header excluding tagVersion 
    105         unsigned char rootLength[IMAGE_LEN];            // 240-249: Size of rootfs 
    106         unsigned char tagId[TAGID_LEN];                 // 250-255: Identifies which type of tag this is, currently two-letter company code, and then three digits for version of broadcom code in which this tag was first introduced 
    107 }; 
    108  
    109 struct bcm_tag_bc221 { 
    110         unsigned char tagVersion[TAGVER_LEN];           // 0-3: Version of the image tag 
    111         unsigned char sig_1[20];                        // 4-23: Company Line 1 
    112         unsigned char sig_2[14];                        // 24-37: Company Line 2 
    113         unsigned char chipid[6];                        // 38-43: Chip this image is for 
    114         unsigned char boardid[16];                      // 44-59: Board name 
    115         unsigned char big_endian[2];                    // 60-61: Map endianness -- 1 BE 0 LE 
    116         unsigned char totalLength[IMAGE_LEN];           // 62-71: Total length of image 
    117         unsigned char cfeAddress[ADDRESS_LEN];          // 72-83: Address in memory of CFE 
    118         unsigned char cfeLength[IMAGE_LEN];             // 84-93: Size of CFE 
    119         unsigned char flashImageStart[ADDRESS_LEN];     // 94-105: Address in memory of kernel (start of image) 
    120         unsigned char flashRootLength[IMAGE_LEN];       // 106-115: Size of rootfs + deadcode (web flash uses this + kernelLength to determine the size of the kernel+rootfs flash image) 
    121         unsigned char kernelAddress[ADDRESS_LEN];       // 116-127: Address in memory of kernel 
    122         unsigned char kernelLength[IMAGE_LEN];          // 128-137: Size of kernel 
    123         unsigned char dualImage[2];                     // 138-139: Unused at present 
    124         unsigned char inactiveFlag[2];                  // 140-141: Unused at present 
    125         unsigned char rsa_signature[TAGINFO_LEN];       // 142-161: RSA Signature (unused at present; some vendors may use this) 
    126         unsigned char reserved5[2];                     // 162-163: Unused at present 
    127         unsigned char tagId[TAGID_LEN];                 // 164-169: Identifies which type of tag this is, currently two-letter company code, and then three digits for version of broadcom code in which this tag was first introduced 
    128         unsigned char rootAddress[ADDRESS_LEN];         // 170-181: Address in memory of rootfs partition 
    129         unsigned char rootLength[IMAGE_LEN];            // 182-191: Size of rootfs partition 
    130         unsigned char flashLayoutVer[4];                // 192-195: Version flash layout 
    131         unsigned char fskernelCRC[4];                   // 196-199: Guessed to be kernel CRC 
    132         unsigned char reserved4[16];                    // 200-215: Reserved area; unused at present 
    133         unsigned char imageCRC[4];                      // 216-219: CRC32 of images 
    134         unsigned char reserved2[12];                    // 220-231: Unused at present 
    135         unsigned char tagIdCRC[4];                      // 232-235: CRC32 to ensure validity of tagId 
    136         unsigned char headerCRC[4];                     // 236-239: CRC32 of header excluding tagVersion 
    137         unsigned char reserved3[16];                    // 240-255: Unused at present 
    138 }; 
    139  
    140 struct bcm_tag_bc310 { 
    141         unsigned char tagVersion[4];                    // 0-3: Version of the image tag 
    142         unsigned char sig_1[20];                        // 4-23: Company Line 1 
    143         unsigned char sig_2[14];                        // 24-37: Company Line 2 
    144         unsigned char chipid[6];                        // 38-43: Chip this image is for 
    145         unsigned char boardid[16];                      // 44-59: Board name 
    146         unsigned char big_endian[2];                    // 60-61: Map endianness -- 1 BE 0 LE 
    147         unsigned char totalLength[IMAGE_LEN];           // 62-71: Total length of image 
    148         unsigned char cfeAddress[ADDRESS_LEN];          // 72-83: Address in memory of CFE 
    149         unsigned char cfeLength[IMAGE_LEN];             // 84-93: Size of CFE 
    150         unsigned char flashImageStart[ADDRESS_LEN];     // 94-105: Address in memory of kernel (start of image) 
    151         unsigned char flashRootLength[IMAGE_LEN];       // 106-115: Size of rootfs + deadcode (web flash uses this + kernelLength to determine the size of the kernel+rootfs flash image) 
    152         unsigned char kernelAddress[ADDRESS_LEN];       // 116-127: Address in memory of kernel 
    153         unsigned char kernelLength[IMAGE_LEN];          // 128-137: Size of kernel 
    154         unsigned char dualImage[2];                     // 138-139: Unused at present 
    155         unsigned char inactiveFlag[2];                  // 140-141: Unused at present 
    156         unsigned char information1[TAGINFO_LEN];        // 142-161: Unused at present; Some vendors use this for optional information 
    157         unsigned char tagId[6];                         // 162-167: Identifies which type of tag this is, currently two-letter company code, and then three digits for version of broadcom code in which this tag was first introduced 
    158         unsigned char tagIdCRC[4];                      // 168-171: CRC32 to ensure validity of tagId 
    159         unsigned char rootAddress[ADDRESS_LEN];         // 172-183: Address in memory of rootfs partition 
    160         unsigned char rootLength[IMAGE_LEN];            // 184-193: Size of rootfs partition 
    161         unsigned char reserved1[22];                    // 193-215: Reserved area not in use 
    162         unsigned char imageCRC[4];                      // 216-219: CRC32 of images 
    163         unsigned char rootfsCRC[4];                     // 220-227: CRC32 of rootfs partition 
    164         unsigned char kernelCRC[4];                     // 224-227: CRC32 of kernel partition 
    165         unsigned char reserved2[8];                     // 228-235: Unused at present 
    166         unsigned char headerCRC[4];                     // 235-239: CRC32 of header excluding tagVersion 
    167         unsigned char reserved3[16];                    // 240-255: Unused at present 
    168 }; 
    169  
    170 union bcm_tag { 
    171   struct bcm_tag_bccfe bccfe; 
    172   struct bcm_tag_bc300 bc300; 
    173   struct bcm_tag_ag306 ag306; 
    174   struct bcm_tag_bc221 bc221; 
    175   struct bcm_tag_bc310 bc310; 
     40struct bcm_tag { 
     41        char tagVersion[TAGVER_LEN];           // 0-3: Version of the image tag 
     42        char sig_1[SIG1_LEN];                  // 4-23: Company Line 1 
     43        char sig_2[SIG2_LEN];                  // 24-37: Company Line 2 
     44        char chipid[CHIPID_LEN];               // 38-43: Chip this image is for 
     45        char boardid[BOARDID_LEN];             // 44-59: Board name 
     46        char big_endian[ENDIANFLAG_LEN];       // 60-61: Map endianness -- 1 BE 0 LE 
     47        char totalLength[IMAGE_LEN];           // 62-71: Total length of image 
     48        char cfeAddress[ADDRESS_LEN];          // 72-83: Address in memory of CFE 
     49        char cfeLength[IMAGE_LEN];             // 84-93: Size of CFE 
     50        char flashImageStart[ADDRESS_LEN];     // 94-105: Address in memory of image start (kernel for OpenWRT, rootfs for stock firmware) 
     51        char rootLength[IMAGE_LEN];            // 106-115: Size of rootfs 
     52        char kernelAddress[ADDRESS_LEN];       // 116-127: Address in memory of kernel 
     53        char kernelLength[IMAGE_LEN];          // 128-137: Size of kernel 
     54        char dualImage[DUALFLAG_LEN];          // 138-139: Unused at present 
     55        char inactiveFlag[INACTIVEFLAG_LEN];   // 140-141: Unused at present 
     56        char rsa_signature[RSASIG_LEN];        // 142-161: RSA Signature (unused at present; some vendors may use this) 
     57        char information1[TAGINFO1_LEN];       // 162-191: Compilation and related information (not generated/used by OpenWRT) 
     58        char flashLayoutVer[FLASHLAYOUTVER_LEN];// 192-195: Version flash layout 
     59        char fskernelCRC[CRC_LEN];             // 196-199: kernel+rootfs CRC32 
     60        char information2[TAGINFO2_LEN];       // 200-215: Unused at present except Alice Gate where is is information 
     61        char imageCRC[CRC_LEN];                // 216-219: CRC32 of image less imagetag (kernel for Alice Gate) 
     62        char rootfsCRC[CRC_LEN];               // 220-223: CRC32 of rootfs partition 
     63        char kernelCRC[CRC_LEN];               // 224-227: CRC32 of kernel partition 
     64        char reserved1[8];                     // 228-235: Unused at present 
     65        char headerCRC[CRC_LEN];               // 236-239: CRC32 of header excluding tagVersion 
     66        char reserved2[16];                    // 240-255: Unused at present 
    17667}; 
    17768 
  • trunk/target/linux/brcm63xx/image/Makefile

    r19894 r20652  
    3131        # Generate the tagged image 
    3232        $(STAGING_DIR_HOST)/bin/imagetag -i $(KDIR)/vmlinux.lzma.cfe -f $(KDIR)/root.$(1) \ 
    33                 -o $(BIN_DIR)/openwrt-$(2)-$(1)-$(6)-cfe.bin \ 
     33                -o $(BIN_DIR)/openwrt-$(4)-$(1)-cfe.bin \ 
    3434                -b $(2) -c $(3) -e $(LOADADDR) -l $(LOADADDR) \ 
    35                 -t $(4) -d "$(5)" $(7) 
     35                -r "$(5)" $(6) 
    3636#               -b $(2) -c $(3) -e $(KERNEL_ENTRY) -l $(LOADADDR) 
    3737 
     
    4141        # Generate the tagged image 
    4242        $(STAGING_DIR_HOST)/bin/imagetag -i $(KDIR)/vmlinux.lzma.cfe -f $(KDIR)/root.$(1) \ 
    43                 -o $(BIN_DIR)/openwrt-$(2)-$(1)-$(7)-cfe.bin \ 
     43                -o $(BIN_DIR)/openwrt-$(5)-$(1)-cfe.bin \ 
    4444                -b $(2) -c $(3) -e $(LOADADDR) -l $(LOADADDR) \ 
    45                 -v 8 -m IMAGE -k 0x20000 -n $(4) -t $(5) 
     45                -v 8 -m IMAGE -k 0x20000 -n $(4) 
    4646endef 
    4747 
     
    4949        # Generate the tagged image 
    5050        $(STAGING_DIR_HOST)/bin/imagetag -i $(KDIR)/vmlinux.lzma.cfe -f $(KDIR)/root.$(1) \ 
    51                 -o $(BIN_DIR)/openwrt-$(6)-$(1)-$(7)-cfe.bin \ 
     51                -o $(BIN_DIR)/openwrt-$(5)-$(1)-cfe.bin \ 
    5252                -b $(2) -c $(3) -e $(LOADADDR) -l $(LOADADDR) \ 
    53                 -k 0x20000 -n $(4) -t $(5) 
     53                -k 0x20000 -n $(4) 
    5454endef 
    5555 
     
    106106        dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/openwrt-$(BOARD)-root.$(1) bs=128k conv=sync 
    107107        # Various routers 
    108         $(call Image/Build/CFE,$(1),96345GW2,6345,bccfe,,bccfe,) 
    109         $(call Image/Build/CFE,$(1),96345GW2,6345,bc221,,bc221,-y 5) 
    110         $(call Image/Build/CFE,$(1),96345GW2,6345,bc300,,bc300,) 
    111         $(call Image/Build/CFE,$(1),96345GW2,6345,bc310,OpenWRT-$(REVISION),bc310,) 
    112         $(call Image/Build/CFE,$(1),96348GW,6348,bccfe,,bccfe,) 
    113         $(call Image/Build/CFE,$(1),96348GW,6348,bc221,,bc221,-y 5) 
     108        $(call Image/Build/CFE,$(1),96345GW2,6345,96345GW2-generic) 
     109        $(call Image/Build/CFE,$(1),96345GW2,6345,96348GW2-bc221,,-y 5) 
     110        $(call Image/Build/CFE,$(1),96345GW2,6345,92345GW2-revision,OpenWRT-$(REVISION)) 
     111        $(call Image/Build/CFE,$(1),96348GW,6348,96348GW-generic,,) 
     112        $(call Image/Build/CFE,$(1),96348GW,6348,96348GW-bc221,,-y 5) 
     113        $(call Image/Build/CFE,$(1),6338GW,6338,6338GW-generic,,) 
     114        $(call Image/Build/CFE,$(1),6338W,6338,6338W-generic,,) 
     115 
    114116        # BT Voyager V210_BTR 
    115         $(call Image/Build/CFE,$(1),V210_BB,6348,bc221,,btvgr,-y 5) 
     117        $(call Image/Build/CFE,$(1),V210_BB,6348,BTV210_BTR,,-y 5) 
    116118        # BT Voyager V210_ROI, V210_WB 
    117         $(call Image/Build/CFE,$(1),V210,6348,bc221,,btvgr,-y 5) 
     119        $(call Image/Build/CFE,$(1),V210,6348,BTV210_ROI_WB,,-y 5) 
    118120        # BT Voyager V2091_BTR 
    119         $(call Image/Build/CFE,$(1),V2091_BB,6348,bc221,,btvgr,-y 5) 
     121        $(call Image/Build/CFE,$(1),V2091_BB,6348,BTV2091_BTR,,y 5) 
    120122        # BT Voyager V2091_ROI, V2091_WB 
    121         $(call Image/Build/CFE,$(1),V2091,6348,bc221,,btvgr,-y 5) 
     123        $(call Image/Build/CFE,$(1),V2091,6348,BTV2091_ROI_WB,,-y 5) 
    122124        # BT Voyager V220V, V220V_MGCP_BTR 
    123         $(call Image/Build/CFE,$(1),RTA1052V,6348,bc221,,btvgr,-y 5) 
     125        $(call Image/Build/CFE,$(1),RTA1052V,6348,BTV220V_MGCP_BTR,,-y 5) 
    124126        # BT Voyager V2110, V2110_AA, V2110_ROI 
    125         $(call Image/Build/CFE,$(1),V2110,6348,bc221,,btvgr,-y 5) 
     127        $(call Image/Build/CFE,$(1),V2110,6348,BTV2110,,-y 5) 
    126128        # BT Voyager V2500V, V2500V_SIP_CLUB, V2500V_AA 
    127         $(call Image/Build/CFE,$(1),V2500V_BB,6348,bc221,,btvgr,-y 5) 
     129        $(call Image/Build/CFE,$(1),V2500V_BB,6348,BTV2500V,,-y 5) 
    128130        # RTA1025W_16 (numerous routers) 
    129         $(call Image/Build/CFE,$(1),RTA1025W_16,6348,bc221,,btrta,-y 5) 
     131        $(call Image/Build/CFE,$(1),RTA1025W_16,6348,RTA1025W_16,,-y 5) 
    130132        # Tecom GW6000 
    131         $(call Image/Build/CFE,$(1),96348GW,6348,bc300,,bc300,) 
     133        $(call Image/Build/CFE,$(1),96348GW,6348,GW6000) 
    132134        # Tecom GW6200 
    133         $(call Image/Build/CFE,$(1),96348GW,6348,bc310,$(shell printf '\x99'),gw6200) 
     135        $(call Image/Build/CFE,$(1),96348GW,6348,GW6200,$(shell printf '\x99')) 
    134136        # Neufbox4 
    135         $(call Image/Build/CFE,$(1),96358VW,6358,bccfe,,bccfe) 
    136         $(call Image/Build/CFE,$(1),96358VW,6358,bc310,OpenWRT-$(REVISION),nb4) 
     137        $(call Image/Build/CFE,$(1),96358VW,6358,NEUFBOX4,OpenWRT-$(REVISION)) 
    137138        # Comtrend 536, 5621 
    138         $(call Image/Build/CFE,$(1),96348GW-11,6348,bccfe,,bccfe) 
    139         $(call Image/Build/CFE,$(1),96348GW-11,6348,bc300,,bc300) 
    140         # TP-Link 8900GB 
    141         $(call Image/Build/CFE,$(1),96348GW-11,6348,bc310,$(shell printf 'PRID\x89\x10\x00\x02'),td8900GB) 
     139        $(call Image/Build/CFE,$(1),96348GW-11,6348,CT536_CT5621) 
    142140        # Davolink DV201AMR 
    143141        $(call Image/Build/CFEOLD,$(1),DV201AMR,6348) 
    144142        # USR 9108 
    145         $(call Image/Build/CFE,$(1),96348GW-A,6348,bccfe,,bccfe) 
    146         $(call Image/Build/CFE,$(1),96348GW-A,6348,bc300,,bc300) 
     143        $(call Image/Build/CFE,$(1),96348GW-A,6348,USR9108) 
    147144        # NetGear DG834GT, DG834PN 
    148         $(call Image/Build/CFE,$(1),96348GW-10,6348,bccfe,,bccfe) 
    149         $(call Image/Build/CFE,$(1),96348GW-10,6348,bc300,,bc300) 
     145        $(call Image/Build/CFE,$(1),96348GW-10,6348,DG834GT_DG834PN) 
    150146        # Belkin f5d7633 
    151         $(call Image/Build/CFE,$(1),96348GW-10,6348,bc310,,bc310) 
     147        $(call Image/Build/CFE,$(1),96348GW-10,6348,F5D7633) 
    152148        # D-Link DSL-2640B 
    153         $(call Image/Build/CFE,$(1),D-4P-W,6348,bc310,,bc310) 
     149        $(call Image/Build/CFE,$(1),D-4P-W,6348,DSL2640B) 
     150        # D-Link DSL-2740B 
     151        $(call Image/Build/CFE,$(1),96358GW,6358,DSL2740B) 
    154152 
    155153        # TP-Link TD-8810A, TD-8810B, TD-8811A, TD-8811B 
    156         $(call Image/Build/CFE,$(1),8L-2M-8M,6338,bccfe,,bccfe) 
    157         $(call Image/Build/CFE,$(1),8L-2M-8M,6338,bc300,,bc300) 
    158  
    159         # Generic 6338 images 
    160         $(call Image/Build/CFE,$(1),6338GW,6338,bccfe,,bccfe) 
    161         $(call Image/Build/CFE,$(1),6338GW,6338,bc221,,bc221) 
    162         $(call Image/Build/CFE,$(1),6338GW,6338,bc300,,bc300) 
    163         $(call Image/Build/CFE,$(1),6338GW,6338,bc310,,bc310) 
    164         $(call Image/Build/CFE,$(1),6338W,6338,bccfe,,bccfe) 
    165         $(call Image/Build/CFE,$(1),6338W,6338,bc221,,bc221) 
    166         $(call Image/Build/CFE,$(1),6338W,6338,bc300,,bc300) 
    167         $(call Image/Build/CFE,$(1),6338W,6338,bc310,,bc310) 
     154        $(call Image/Build/CFE,$(1),8L-2M-8M,6338,TP8810_8811) 
     155        # TP-Link 8900GB 
     156        $(call Image/Build/CFE,$(1),96348GW-11,6348,TD8900GB,$(shell printf 'PRID\x89\x10\x00\x02')) 
    168157 
    169158        # Sagem F@ST2404 
    170         $(call Image/Build/CFE,$(1),F@ST2404,6348,bccfe,,bccfe) 
    171         $(call Image/Build/CFE,$(1),F@ST2404,6348,bc300,,bc300) 
    172         $(call Image/Build/CFE,$(1),F@ST2404,6348,bc310,OpenWRT-$(REVISION),bc310) 
     159        $(call Image/Build/CFE,$(1),F@ST2404,6348,F@ST2404-cfe) 
     160        $(call Image/Build/CFE,$(1),F@ST2404,6348,F@ST2404,OpenWRT-$(REVISION)) 
    173161        # Inventel Livebox 
    174162        $(call Image/Build/RedBoot,livebox) 
    175         # D-Link DSL-2740B 
    176         $(call Image/Build/CFE,$(1),96358GW,6358,bc310,,dsl2740b) 
    177163        # Pirelli Alice Gate VoIP 2 Plus Wi-Fi AGPF-S0 
    178         $(call Image/Build/CFEAGPF,$(1),AGPF-S0,6358,0x20000,bccfe,,bccfe) 
    179         $(call Image/Build/CFEAGPF,$(1),AGPF-S0,6358,0x20000,ag306,,agv2+w) 
     164        $(call Image/Build/CFEAGPF,$(1),AGPF-S0,6358,0x20000,AGV2+W-cfe) 
     165        $(call Image/Build/CFEAGPF,$(1),AGPF-S0,6358,0x20000,AGV2+W) 
    180166        # Pirelli A226G 
    181         $(call Image/Build/CFEAGPF,$(1),DWV-S0,6358,0x10000,bccfe,,bccfe) 
    182         $(call Image/Build/CFEAGPF,$(1),DWV-S0,6358,0x10000,ag306,DWV_96358,a226g) 
     167        $(call Image/Build/CFEAGPF,$(1),DWV-S0,6358,0x10000,A226G-cfe) 
     168        $(call Image/Build/CFEAGPF,$(1),DWV-S0,6358,0x10000,A226G) 
    183169         
    184170        # RG100A,DB120 etc. 
    185         $(call Image/Build/RG100A,$(1),96358VW2,6358,0x20000,bc310,rg100a,bc310) 
     171        $(call Image/Build/RG100A,$(1),96358VW2,6358,0x20000,RG100A_DB120) 
    186172 
    187173endef 
  • trunk/target/linux/brcm63xx/image/README.images-bcm63xx

    r16396 r20652  
    1717and is known to be correct as the source code GPL and is available for reading. 
    1818 
     19Broadcom code 2.21 is based on the BT Voyager firmware image I looked at.  It 
     20may in fact be BT Voyager-specific.  2.21 is actually more difficult to deal 
     21with the imagetag from 3.00 as it has three different CRC calculations in 
     22addtition to the header CRC. 
     23 
    1924Broadcom 3.00-3.02 flashing has been tested on Comtrend CT-5261, CT-536 and  
    2025Tecom GW6000, and is the version of the flashing that was present before the 
     
    2833Broadcom code. 
    2934 
    30 Broadcom 3.08 introduced changes to the imagetag to deal with TR69 (a remote 
    31 router management system developed by the DSL Forum).  The version we are 
    32 using as 3.08 is based on the BT Voyager firmware image I looked at.  It may 
    33 in fact be BT Voyager-specific, and may in fact not be 3.08, but modified 3.06 
    34 and not apply to all 3.08 versions. 
    35  
    3635Broadcom 3.10 uses an imagetag that is believed to apply to all 3.10 and 3.12 
    37 versions, and has been tested on the Tecom GW6200.  It is similar to 3.08.   
    38 There is a field for vendor-specific information, that at least in some cases 
    39 is not optional.  It is based on the hexedit of a neufbox4 firmware image, the 
     36versions, and has been tested on the Tecom GW6200.  This version introdec changes to 
     37the imagetag to deal with TR69 (a remote rouer management system developed by the 
     38DSL forum).  There is a field for vendor-specific information, that at least in some 
     39cases is not optional.  It is based on the hexedit of a neufbox4 firmware image, the 
    4040information in https://dev.openwrt.org/ticket/4987, and the hexedit of a Tecom 
    4141GW6200 image. 
     
    4545image reflects the router for which the image was created. 
    4646 
    47 router        |method| codever |tagid |filename 
    48 +-------------+------+---------+------+---------------------------------------- 
    49 |any          |cfe   |   any   |bccfe |openwrt-<board>-<fs>-bccfe-cfe.bin 
    50 |any          |t/ftp |   any   |bc300 |openwrt-<board>-<fs>-bc300-cfe.bin 
    51 |             |web   |3.00-3.06|bc300 |openwrt-<board>-<fs>-bc300-cfe.bin 
    52 |             |web   |3.10-3.12|bc310 |openwrt-<board>-<fs>-bc310-cfe.bin 
    53 |AGVoIP2+WiFi |web   |alice3.06|ag306 |openwrt-AGPF-S0-<fs>-agv2+w-cfe.bin 
    54 |CT536        |web   |3.02     |bc300 |openwrt-96348GW-11-<fs>-bc300-cfe.bin 
    55 |CT5621       |web   |3.02     |bc300 |openwrt-96348GW-11-<fs>-bc300-cfe.bin 
    56 |DG834GT      |web   |3.02     |bc300 |openwrt-96348GW-10-<fs>-bc300-cfe.bin 
    57 |DG834PN      |web   |3.02     |bc300 |openwrt-96348GW-10-<fs>-bc300-cfe.bin 
    58 |DSL-2640B    |web   |3.10     |bc310 |openwrt-D-4P-W-<fs>-bc310-cfe.bin 
    59 |DSL-2740B    |web   |3.10     |bc310 |openwrt-96358GW-<fs>-dsl2740b-cfe.bin 
    60 |F5D7633      |web   |3.10     |bc310 |openwrt-96348GW-10-<fs>-bc310-cfe.bin 
    61 |F@ST2404     |web   |?        |bc300 |openwrt-F@ST2404-<fs>-bc300-cfe.bin 
    62 |F@ST2404     |web   |?        |bc310 |openwrt-F@ST2404-<fs>-bc310-cfe.bin 
    63 |GW6000       |web   |3.00     |bc300 |openwrt-96348GW-<fs>-bc300-cfe.bin 
    64 |GW6200       |web   |3.10     |bc310 |openwrt-96348GW-<fs>-gw6200-cfe.bin 
    65 |Neufbox4     |web   |3.12     |bc310 |openwrt-96358VW-<fs>-nb4-cfe.bin 
    66 |TD8810A      |web   |3.06     |bc300 |openwrt-8L-2M-8M-<fs>-bc306-cfe.bin 
    67 |TD8810B      |web   |3.06     |bc300 |openwrt-8L-2M-8M-<fs>-bc306-cfe.bin 
    68 |TD8811A      |web   |3.06     |bc300 |openwrt-8L-2M-8M-<fs>-bc306-cfe.bin 
    69 |TD8811B      |web   |3.06     |bc300 |openwrt-8L-2M-8M-<fs>-bc306-cfe.bin 
    70 |TD8900GB     |web   |3.06     |bc300 |openwrt-96348GW-11-<fs>-td8900gb-cfe.bin 
    71 |USR9108      |web   |?        |bc300 |openwrt-96348GW-A-<fs>-bc300-cfe.bin 
    72 |V2091_BTR    |web   |2.21     |bc221 |openwrt-V2091_BB-<fs>-btvgr-cfe.bin 
    73 |V2091_ROI    |web   |2.21     |bc221 |openwrt-V2091-<fs>-btvgr-cfe.bin 
    74 |V2091_WB     |web   |2.21     |bc221 |openwrt-V2091-<fs>-btvgr-cfe.bin 
    75 |V210_BTR     |web   |2.21     |bc221 |openwrt-V210_BB-<fs>-btvgr-cfe.bin 
    76 |V210_ROI     |web   |2.21     |bc221 |openwrt-V210-<fs>-btvgr-cfe.bin 
    77 |V210_WB      |web   |2.21     |bc221 |openwrt-V210-<fs>-btvgr-cfe.bin 
    78 |V2110        |web   |2.21     |bc221 |openwrt-V2110-<fs>-btvgr-cfe.bin 
    79 |V2110_AA     |web   |2.21     |bc221 |openwrt-V2110-<fs>-btvgr-cfe.bin 
    80 |V2110_ROI    |web   |2.21     |bc221 |openwrt-V2110-<fs>-btvgr-cfe.bin 
    81 |V2500V       |web   |2.21     |bc221 |openwrt-V2500V_BB-<fs>-btvgr-cfe.bin 
    82 |V2500V_AA    |web   |2.21     |bc221 |openwrt-V2500V_BB-<fs>-btvgr-cfe.bin 
    83 |V2500V_SIP_CLUB |web|2.21     |bc221 |openwrt-V2500V_BB-<fs>-btvgr-cfe.bin 
     47router        |method       | codever |filename 
     48+-------------+-------------+---------+--------------------------------------- 
     49|any          |cfe+most web |   any   |openwrt-<board>-<fs>-cfe.bin 
     50|AGVoIP2+WiFi |cfe          |alice3.06|openwrt-AGV2+W-cfe-<fs>-cfe.bin 
     51|AGVoIP2+WiFi |web          |alice3.06|openwrt-AGV2+W-cfe-<fs>-cfe.bin 
     52|CT536        |web          |3.02     |openwrt-CT536_CT5621-<fs>-cfe.bin 
     53|CT5621       |web          |3.02     |openwrt-CT536_CT5621-<fs>-cfe.bin 
     54|DG834GT      |web          |3.02     |openwrt-DG834GT_DG834PN-<fs>-cfe.bin 
     55|DG834PN      |web          |3.02     |openwrt-DG834GT_DG834PN-<fs>-cfe.bin 
     56|DSL-2640B    |web          |3.10     |openwrt-DSL2640B-<fs>-cfe.bin 
     57|DSL-2740B    |web          |3.10     |openwrt-DSL2670B-<fs>-cfe.bin 
     58|F5D7633      |web          |3.10     |openwrt-F5D7633-<fs>-cfe.bin 
     59|F@ST2404     |web          |3.0X?    |openwrt-F@ST2404-cfe-<fs>-cfe.bin 
     60|F@ST2404     |web          |3.1X?    |openwrt-F@ST2404-<fs>-cfe.bin 
     61|GW6000       |web          |3.00     |openwrt-GW6000-<fs>-cfe.bin 
     62|GW6200       |web          |3.10     |openwrt-GW6200-<fs>-cfe.bin 
     63|Neufbox4     |web          |3.12     |openwrt-NEUFBOX4-<fs>-cfe.bin 
     64|TD8810A      |web          |3.06     |openwrt-TD8810-<fs>-cfe.bin 
     65|TD8810B      |web          |3.06     |openwrt-TD8810-<fs>-cfe.bin 
     66|TD8811A      |web          |3.06     |openwrt-TD8811-<fs>-cfe.bin 
     67|TD8811B      |web          |3.06     |openwrt-TD881-<fs>-cfe.bin 
     68|TD8900GB     |web          |3.06     |openwrt-TD8900DB<fs>-cfe.bin 
     69|USR9108      |web          |3.0X?    |openwrt-USR9108-<fs>-cfe.bin 
     70|V2091_BTR    |web          |2.21     |openwrt-V2091_BTR-<fs>-cfe.bin 
     71|V2091_ROI    |web          |2.21     |openwrt-V2091-<fs>-cfe.bin 
     72|V2091_WB     |web          |2.21     |openwrt-V2091-<fs>-cfe.bin 
     73|V210_BTR     |web          |2.21     |openwrt-V210_BTR-<fs>-cfe.bin 
     74|V210_ROI     |web          |2.21     |openwrt-V210-ROI_WB<fs>-cfe.bin 
     75|V210_WB      |web          |2.21     |openwrt-V210-ROI_WB<fs>-cfe.bin 
     76|V2110        |web          |2.21     |openwrt-V2110-<fs>-cfe.bin 
     77|V2110_AA     |web          |2.21     |openwrt-V2110-<fs>-cfe.bin 
     78|V2110_ROI    |web          |2.21     |openwrt-V2110-<fs>-cfe.bin 
     79|V2500V       |web          |2.21     |openwrt-V2500V<fs>-cfe.bin 
     80|V2500V_AA    |web          |2.21     |openwrt-V2500V-<fs>-cfe.bin 
     81|V2500V_SIP_CLUB |web       |2.21     |openwrt-V2500V-<fs>-cfe.bin 
    8482 
    8583Old imagetag routers 
     
    127125Tecom                      |GW6200                                    |3.10 
    128126USR                        |9108                                      |? 
     127 
  • trunk/target/linux/brcm63xx/patches-2.6.32/040-bcm963xx_flashmap.patch

    r20548 r20652  
    1212 3 files changed, 18 insertions(+), 3 deletions(-) 
    1313 
    14 --- a/drivers/mtd/maps/Kconfig 
    15 +++ b/drivers/mtd/maps/Kconfig 
    16 @@ -259,6 +259,13 @@ config MTD_ALCHEMY 
     14Index: linux-2.6.32.10/drivers/mtd/maps/Kconfig 
     15=================================================================== 
     16--- linux-2.6.32.10.orig/drivers/mtd/maps/Kconfig       2010-03-29 06:35:59.987293878 -0400 
     17+++ linux-2.6.32.10/drivers/mtd/maps/Kconfig    2010-03-29 06:37:14.968545954 -0400 
     18@@ -259,6 +259,13 @@ 
    1719        help 
    1820          Flash memory access on AMD Alchemy Pb/Db/RDK Reference Boards 
     
    2830        tristate "CFI Flash device mapped on DIL/Net PC" 
    2931        depends on X86 && MTD_CONCAT && MTD_PARTITIONS && MTD_CFI_INTELEXT && BROKEN 
    30 --- a/drivers/mtd/redboot.c 
    31 +++ b/drivers/mtd/redboot.c 
    32 @@ -39,7 +39,7 @@ static inline int redboot_checksum(struc 
     32Index: linux-2.6.32.10/drivers/mtd/redboot.c 
     33=================================================================== 
     34--- linux-2.6.32.10.orig/drivers/mtd/redboot.c  2010-03-29 06:36:00.017292877 -0400 
     35+++ linux-2.6.32.10/drivers/mtd/redboot.c       2010-03-29 06:37:14.968545954 -0400 
     36@@ -39,7 +39,7 @@ 
    3337        return 1; 
    3438 } 
     
    3943                              unsigned long fis_origin) 
    4044 { 
    41 @@ -162,6 +162,14 @@ static int parse_redboot_partitions(stru 
     45@@ -162,6 +162,14 @@ 
    4246                goto out; 
    4347        } 
     
    5458                struct fis_list *new_fl, **prev; 
    5559  
    56 @@ -184,9 +192,8 @@ static int parse_redboot_partitions(stru 
     60@@ -184,9 +192,8 @@ 
    5761                new_fl->img = &buf[i]; 
    5862                 if (fis_origin) { 
     
    6569                /* I'm sure the JFFS2 code has done me permanent damage. 
    6670                 * I now think the following is _normal_ 
    67 --- a/drivers/mtd/maps/Makefile 
    68 +++ b/drivers/mtd/maps/Makefile 
    69 @@ -61,3 +61,4 @@ obj-$(CONFIG_MTD_BFIN_ASYNC)  += bfin-asy 
     71Index: linux-2.6.32.10/drivers/mtd/maps/Makefile 
     72=================================================================== 
     73--- linux-2.6.32.10.orig/drivers/mtd/maps/Makefile      2010-03-29 06:35:59.947294290 -0400 
     74+++ linux-2.6.32.10/drivers/mtd/maps/Makefile   2010-03-29 06:37:14.968545954 -0400 
     75@@ -61,3 +61,4 @@ 
    7076 obj-$(CONFIG_MTD_RBTX4939)     += rbtx4939-flash.o 
    7177 obj-$(CONFIG_MTD_VMU)          += vmu-flash.o 
    7278 obj-$(CONFIG_MTD_GPIO_ADDR)    += gpio-addr-flash.o 
    7379+obj-$(CONFIG_MTD_BCM963XX)     += bcm963xx-flash.o 
    74 --- /dev/null 
    75 +++ b/drivers/mtd/maps/bcm963xx-flash.c 
    76 @@ -0,0 +1,399 @@ 
     80Index: linux-2.6.32.10/drivers/mtd/maps/bcm963xx-flash.c 
     81=================================================================== 
     82--- /dev/null   1970-01-01 00:00:00.000000000 +0000 
     83+++ linux-2.6.32.10/drivers/mtd/maps/bcm963xx-flash.c   2010-03-29 13:33:58.797288897 -0400 
     84@@ -0,0 +1,266 @@ 
    7785+/* 
    7886+ * Copyright (C) 2006-2008  Florian Fainelli <florian@openwrt.org> 
     
    120128+}; 
    121129+ 
    122 +static struct tagiddesc_t tagidtab[NUM_TAGID] = TAGID_DEFINITIONS; 
    123 + 
    124 +static uint32_t tagcrc32tab[256] = { 
    125 +       0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, 
    126 +       0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 
    127 +       0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, 
    128 +       0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, 
    129 +       0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 
    130 +       0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, 
    131 +       0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, 
    132 +       0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, 
    133 +       0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, 
    134 +       0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, 
    135 +       0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 
    136 +       0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, 
    137 +       0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, 
    138 +       0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, 
    139 +       0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, 
    140 +       0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, 
    141 +       0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, 
    142 +       0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, 
    143 +       0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, 
    144 +       0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 
    145 +       0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, 
    146 +       0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, 
    147 +       0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 
    148 +       0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, 
    149 +       0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, 
    150 +       0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 
    151 +       0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, 
    152 +       0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, 
    153 +       0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, 
    154 +       0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, 
    155 +       0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, 
    156 +       0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D 
    157 +}; 
    158 + 
    159 +static uint32_t tagcrc32(uint32_t crc, uint8_t *data, size_t len) 
    160 +{ 
    161 +       while (len--) 
    162 +               crc = (crc >> 8) ^ tagcrc32tab[(crc ^ *data++) & 0xFF]; 
    163 + 
    164 +       return crc; 
    165 +} 
    166130+ 
    167131+static int parse_cfe_partitions( struct mtd_info *master, struct mtd_partition **pparts) 
    168132+{ 
    169133+       int nrparts = 3, curpart = 0; /* CFE,NVRAM and global LINUX are always present. */ 
    170 +       union bcm_tag *buf; 
     134+       struct bcm_tag *buf; 
    171135+       struct mtd_partition *parts; 
    172136+       int ret; 
     
    174138+       unsigned int rootfsaddr, kerneladdr, spareaddr; 
    175139+       unsigned int rootfslen, kernellen, sparelen, totallen; 
    176 +       unsigned char *tagid; 
    177140+       int namelen = 0; 
    178141+       int i; 
    179 +       uint32_t tagidcrc; 
    180 +       uint32_t calctagidcrc; 
    181 +        bool tagid_match = false; 
    182142+       char *boardid; 
    183143+        char *tagversion; 
    184 +       char *matchtagid; 
    185144+ 
    186145+       /* Allocate memory for buffer */ 
    187 +       buf = vmalloc(sizeof(union bcm_tag)); 
     146+       buf = vmalloc(sizeof(struct bcm_tag)); 
    188147+       if (!buf) 
    189148+               return -ENOMEM; 
    190149+ 
    191150+       /* Get the tag */ 
    192 +       ret = master->read(master,master->erasesize,sizeof(union bcm_tag), &retlen, (void *)buf); 
    193 +       if (retlen != sizeof(union bcm_tag)){ 
     151+       ret = master->read(master,master->erasesize,sizeof(struct bcm_tag), &retlen, (void *)buf); 
     152+       if (retlen != sizeof(struct bcm_tag)){ 
    194153+               vfree(buf); 
    195154+               return -EIO; 
    196155+       } 
    197156+ 
    198 +       /* tagId isn't in the same location, so we check each tagid against the 
    199 +         * tagid CRC.  If the CRC is valid we have found the right tag and so 
    200 +         * use that tag 
    201 +         */ 
    202 + 
    203 +       for (i = 0; i < NUM_TAGID; i++) { 
    204 +         switch(i) { 
    205 +         case 0: 
    206 +           matchtagid = "bccfe"; 
    207 +           tagid = &(buf->bccfe.tagId[0]); 
    208 +           sscanf(buf->bccfe.rootAddress,"%u", &rootfsaddr); 
    209 +           sscanf(buf->bccfe.rootLength, "%u", &rootfslen); 
    210 +           sscanf(buf->bccfe.kernelAddress, "%u", &kerneladdr); 
    211 +           sscanf(buf->bccfe.kernelLength, "%u", &kernellen); 
    212 +           sscanf(buf->bccfe.totalLength, "%u", &totallen); 
    213 +           tagidcrc = *(uint32_t *)&(buf->bccfe.tagIdCRC[0]); 
    214 +           tagversion = &(buf->bccfe.tagVersion[0]); 
    215 +           boardid = &(buf->bccfe.boardid[0]); 
    216 +           break; 
    217 +         case 1: 
    218 +           matchtagid = "bc300"; 
    219 +           tagid = &(buf->bc300.tagId[0]); 
    220 +           sscanf(buf->bc300.rootAddress,"%u", &rootfsaddr); 
    221 +           sscanf(buf->bc300.rootLength, "%u", &rootfslen); 
    222 +           sscanf(buf->bc300.kernelAddress, "%u", &kerneladdr); 
    223 +           sscanf(buf->bc300.kernelLength, "%u", &kernellen); 
    224 +           sscanf(buf->bc300.totalLength, "%u", &totallen); 
    225 +           tagidcrc = *(uint32_t *)&(buf->bc300.tagIdCRC[0]); 
    226 +           tagversion = &(buf->bc300.tagVersion[0]); 
    227 +           boardid = &(buf->bc300.boardid[0]); 
    228 +           break; 
    229 +         case 2: 
    230 +           matchtagid = "ag306"; 
    231 +           tagid = &(buf->ag306.tagId[0]); 
    232 +           sscanf(buf->ag306.rootAddress,"%u", &rootfsaddr); 
    233 +           sscanf(buf->ag306.rootLength, "%u", &rootfslen); 
    234 +           sscanf(buf->ag306.kernelAddress, "%u", &kerneladdr); 
    235 +           sscanf(buf->ag306.kernelLength, "%u", &kernellen); 
    236 +           sscanf(buf->ag306.totalLength, "%u", &totallen); 
    237 +           tagidcrc = *(uint32_t *)&(buf->ag306.tagIdCRC[0]); 
    238 +           tagversion = &(buf->ag306.tagVersion[0]); 
    239 +           boardid = &(buf->ag306.boardid[0]); 
    240 +           break; 
    241 +         case 3: 
    242 +           matchtagid = "bc221"; 
    243 +           tagid = &(buf->bc221.tagId[0]); 
    244 +           sscanf(buf->bc221.rootAddress,"%u", &rootfsaddr); 
    245 +           sscanf(buf->bc221.rootLength, "%u", &rootfslen); 
    246 +           sscanf(buf->bc221.kernelAddress, "%u", &kerneladdr); 
    247 +           sscanf(buf->bc221.kernelLength, "%u", &kernellen); 
    248 +           sscanf(buf->bc221.totalLength, "%u", &totallen); 
    249 +           tagidcrc = *(uint32_t *)&(buf->bc221.tagIdCRC[0]); 
    250 +           tagversion = &(buf->bc221.tagVersion[0]); 
    251 +           boardid = &(buf->bc221.boardid[0]); 
    252 +           break; 
    253 +         case 4: 
    254 +           matchtagid = "bc310"; 
    255 +           tagid = &(buf->bc310.tagId[0]); 
    256 +           sscanf(buf->bc310.rootAddress,"%u", &rootfsaddr); 
    257 +           sscanf(buf->bc310.rootLength, "%u", &rootfslen); 
    258 +           sscanf(buf->bc310.kernelAddress, "%u", &kerneladdr); 
    259 +           sscanf(buf->bc310.kernelLength, "%u", &kernellen); 
    260 +           sscanf(buf->bc310.totalLength, "%u", &totallen); 
    261 +           tagidcrc = *(uint32_t *)&(buf->bc310.tagIdCRC[0]); 
    262 +           tagversion = &(buf->bc310.tagVersion[0]); 
    263 +           boardid = &(buf->bc310.boardid[0]); 
    264 +           break; 
    265 +         } 
    266 +         if (strncmp(tagid, matchtagid, TAGID_LEN) != 0) { 
    267 +           continue; 
    268 +         } 
    269 + 
    270 +         calctagidcrc = htonl(tagcrc32(IMAGETAG_CRC_START, tagid, TAGID_LEN)); 
    271 +         if (tagidcrc == calctagidcrc) { 
    272 +           tagid_match = true; 
    273 +           break; 
    274 +         } 
    275 +       } 
    276 + 
    277 +       if (!tagid_match) { 
    278 +           tagid = "bcram"; 
    279 +           sscanf(buf->bccfe.rootAddress,"%u", &rootfsaddr); 
    280 +           sscanf(buf->bccfe.rootLength, "%u", &rootfslen); 
    281 +           sscanf(buf->bccfe.kernelAddress, "%u", &kerneladdr); 
    282 +           sscanf(buf->bccfe.kernelLength, "%u", &kernellen); 
    283 +           sscanf(buf->bccfe.totalLength, "%u", &totallen); 
    284 +           tagidcrc = *(uint32_t *)&(buf->bccfe.tagIdCRC[0]); 
    285 +           tagversion = &(buf->bccfe.tagVersion[0]); 
    286 +           boardid = &(buf->bccfe.boardid[0]); 
    287 +       } 
    288 + 
    289 +       printk(KERN_INFO PFX "CFE boot tag found with version %s, board type %s, and tagid %s.\n",tagversion,boardid,tagid); 
    290 + 
    291 +       rootfsaddr = rootfsaddr - EXTENDED_SIZE; 
     157+       sscanf(buf->kernelAddress, "%u", &kerneladdr); 
     158+       sscanf(buf->kernelLength, "%u", &kernellen); 
     159+       sscanf(buf->totalLength, "%u", &totallen); 
     160+       tagversion = &(buf->tagVersion[0]); 
     161+       boardid = &(buf->boardid[0]); 
     162+ 
     163+       printk(KERN_INFO PFX "CFE boot tag found with version %s and board type %s\n",tagversion, boardid); 
     164+ 
    292165+       kerneladdr = kerneladdr - EXTENDED_SIZE; 
    293 +       spareaddr = roundup(totallen,master->erasesize) + master->erasesize; 
     166+       rootfsaddr = kerneladdr + kernellen; 
     167+       spareaddr = roundup(totallen, master->erasesize) + master->erasesize; 
    294168+       sparelen = master->size - spareaddr - master->erasesize; 
     169+       rootfslen = spareaddr - rootfsaddr; 
    295170+ 
    296171+       /* Determine number of partitions */ 
     
    343218+       parts[curpart].offset = parts[0].size; 
    344219+       parts[curpart].size = master->size - parts[0].size - parts[3].size; 
    345 +  
     220+ 
    346221+       for (i = 0; i < nrparts; i++) 
    347 +               printk(KERN_INFO PFX "Partition %d is %s offset %lx and length %lx\n", i, parts[i].name, parts[i].offset, parts[i].size); 
     222+               printk(KERN_INFO PFX "Partition %d is %s offset %lx and length %lx\n", i, parts[i].name, (long unsigned int)(parts[i].offset), (long unsigned int)(parts[i].size)); 
    348223+ 
    349224+       printk(KERN_INFO PFX "Spare partition is %x offset and length %x\n", spareaddr, sparelen); 
     
    376251+       struct resource *r; 
    377252+ 
    378 +       r = platform_get_resource(pdev, IORESOURCE_MEM, 0);  
     253+       r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 
    379254+       bcm963xx_map.phys = r->start; 
    380255+       bcm963xx_map.size = (r->end - r->start) + 1; 
     
    474349+MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org>"); 
    475350+MODULE_AUTHOR("Mike Albon <malbon@openwrt.org>"); 
    476 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c 
    477 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c 
    478 @@ -722,20 +722,6 @@ static int board_get_mac_address(u8 *mac 
     351Index: linux-2.6.32.10/arch/mips/bcm63xx/boards/board_bcm963xx.c 
     352=================================================================== 
     353--- linux-2.6.32.10.orig/arch/mips/bcm63xx/boards/board_bcm963xx.c      2010-03-29 06:35:59.927292275 -0400 
     354+++ linux-2.6.32.10/arch/mips/bcm63xx/boards/board_bcm963xx.c   2010-03-29 06:37:35.178541753 -0400 
     355@@ -722,20 +722,6 @@ 
    479356        return 0; 
    480357 } 
     
    497374        { 
    498375                .start          = 0,    /* filled at runtime */ 
    499 @@ -745,12 +731,9 @@ static struct resource mtd_resources[] = 
     376@@ -745,12 +731,9 @@ 
    500377 }; 
    501378  
  • trunk/tools/firmware-utils/src/imagetag.c

    r17190 r20652  
    3030union int2char { 
    3131  uint32_t input; 
    32   unsigned char output[4]; 
     32  char output[4]; 
    3333}; 
    3434 
     
    4444}; 
    4545 
    46 static struct tagiddesc_t tagidtab[NUM_TAGID] = TAGID_DEFINITIONS; 
     46static char pirellitab[NUM_PIRELLI][BOARDID_LEN] = PIRELLI_BOARDS; 
    4747 
    4848static uint32_t crc32tab[256] = { 
     
    131131            const uint32_t loadaddr, const uint32_t entry, 
    132132            const char *ver, const char *magic2, const uint32_t flash_bs, 
    133             const char *tagid, const char *information, const char *layoutver) 
     133            const char *rsignature, const char *layoutver) 
    134134{ 
    135         union bcm_tag tag; 
     135        struct bcm_tag tag; 
    136136        struct kernelhdr khdr; 
    137137        FILE *kernelfile = NULL, *rootfsfile = NULL, *binfile; 
     
    144144        const uint32_t deadcode = htonl(DEADCODE); 
    145145        union int2char intchar; 
    146  
    147         memset(&tag, 0, sizeof(union bcm_tag)); 
    148  
    149         /* All imagetags have boardid in the same location and of the same 
    150          * size, so we just use the bccfe one 
    151          */ 
    152         if (strlen(boardid) >= sizeof(tag.bccfe.boardid)) { 
     146        int i; 
     147        int is_pirelli = 0; 
     148 
     149        memset(&tag, 0, sizeof(struct bcm_tag)); 
     150 
     151        if (strlen(boardid) >= sizeof(tag.boardid)) { 
    153152                fprintf(stderr, "Board id is too long!\n"); 
    154153                return 1; 
     
    156155 
    157156        /* Likewise chipid */ 
    158         if (strlen(chipid) >= sizeof(tag.bccfe.chipid)) { 
     157        if (strlen(chipid) >= sizeof(tag.chipid)) { 
    159158                fprintf(stderr, "Chip id is too long!\n"); 
    160159                return 1; 
     160        } 
     161 
     162        if (!kernel || !rootfs) { 
     163                fprintf(stderr, "imagetag can't create an image without both kernel and rootfs\n"); 
    161164        } 
    162165 
     
    225228        fflush(binfile); 
    226229 
    227         /* Choose and compute the CRC32 that should be inserted in the tag */ 
    228         if ( tagid && ( (strncmp(tagid, "bccfe", TAGID_LEN) == 0)) || ( strncmp(tagid, "bc300", TAGID_LEN) == 0)) { 
    229                 /* Compute the crc32 of the entire image (deadC0de included) */ 
    230                 imagecrc = compute_crc32(imagecrc, binfile, kerneloff - fwaddr, imagelen); 
    231         } else if ( tagid && (strncmp(tagid, "ag306", TAGID_LEN) == 0)) { 
    232                 /* Compute the crc32 of the kernel and padding between kernel and rootfs) */ 
    233                 kernelcrc = compute_crc32(kernelcrc, binfile, kerneloff - fwaddr, kernellen + rootfsoffpadlen); 
    234         } else if ( tagid && ( (strncmp(tagid, "bc221", TAGID_LEN) == 0))) { 
    235                 /* Compute the crc32 of the entire image (deadC0de included) */ 
    236                 imagecrc = compute_crc32(imagecrc, binfile, kerneloff - fwaddr, imagelen); 
    237                 /* Compute the crc32 of the kernel and padding between kernel and rootfs) */ 
    238                 kernelfscrc = compute_crc32(kernelfscrc, binfile, kerneloff - fwaddr, kernellen + rootfsoffpadlen + rootfslen + sizeof(deadcode)); 
    239         } else if ( tagid && (strncmp(tagid, "bc310", TAGID_LEN) == 0) ) { 
    240                 /* Compute the crc32 of the entire image (deadC0de included) */ 
    241                 imagecrc = compute_crc32(imagecrc, binfile, kerneloff - fwaddr, imagelen); 
    242                 /* Compute the crc32 of the kernel and padding between kernel and rootfs) */ 
    243                 kernelcrc = compute_crc32(kernelcrc, binfile, kerneloff - fwaddr, kernellen + rootfsoffpadlen); 
    244                 /* Compute the crc32 of the flashImageStart to rootLength.  
    245                  * The broadcom firmware assumes the rootfs starts the image, 
    246                  * therefore uses the rootfs start to determine where to flash 
    247                  * the image.  Since we have the kernel first we have to give 
    248                  * it the kernel address, but the crc uses the length 
    249                  * associated with this address, which is added to the kernel 
    250                  * length to determine the length of image to flash and thus 
    251                  * needs to be rootfs + deadcode 
    252                  */ 
    253                 rootfscrc = compute_crc32(rootfscrc, binfile, kerneloff - fwaddr, rootfslen + sizeof(deadcode)); 
    254         } 
     230        /* Compute the crc32 of the entire image (deadC0de included) */ 
     231        imagecrc = compute_crc32(imagecrc, binfile, kerneloff - fwaddr, imagelen); 
     232        /* Compute the crc32 of the kernel and padding between kernel and rootfs) */ 
     233        kernelcrc = compute_crc32(kernelcrc, binfile, kerneloff - fwaddr, kernellen + rootfsoffpadlen); 
     234        /* Compute the crc32 of the kernel and padding between kernel and rootfs) */ 
     235        kernelfscrc = compute_crc32(kernelfscrc, binfile, kerneloff - fwaddr, kernellen + rootfsoffpadlen + rootfslen + sizeof(deadcode)); 
     236        /* Compute the crc32 of the flashImageStart to rootLength. 
     237         * The broadcom firmware assumes the rootfs starts the image, 
     238         * therefore uses the rootfs start to determine where to flash 
     239         * the image.  Since we have the kernel first we have to give 
     240         * it the kernel address, but the crc uses the length 
     241         * associated with this address, which is added to the kernel 
     242         * length to determine the length of image to flash and thus 
     243         * needs to be rootfs + deadcode 
     244         */ 
     245        rootfscrc = compute_crc32(rootfscrc, binfile, kerneloff - fwaddr, rootfslen + sizeof(deadcode)); 
    255246         
    256247        /* Close the files */ 
     
    258249        fclose(rootfsfile); 
    259250 
    260         if ( tagid && (strcmp(tagid, "bccfe") == 0)) { 
    261           /* Build the tag */ 
    262           strncpy(tag.bccfe.tagVersion, ver, TAGVER_LEN); 
    263           strncpy(tag.bccfe.sig_1, IMAGETAG_MAGIC1, sizeof(tag.bccfe.sig_1) - 1); 
    264           strncpy(tag.bccfe.sig_2, magic2, sizeof(tag.bccfe.sig_2) - 1); 
    265           strcpy(tag.bccfe.chipid, chipid); 
    266           strcpy(tag.bccfe.boardid, boardid); 
    267           strcpy(tag.bccfe.big_endian, "1"); 
    268           sprintf(tag.bccfe.totalLength, "%lu", imagelen); 
    269  
    270           /* We don't include CFE */ 
    271           strcpy(tag.bccfe.cfeAddress, "0"); 
    272           strcpy(tag.bccfe.cfeLength, "0"); 
    273  
    274           if (kernelfile) { 
    275             sprintf(tag.bccfe.kernelAddress, "%lu", kerneloff); 
    276             sprintf(tag.bccfe.kernelLength, "%lu", kernellen + rootfsoffpadlen); 
    277           } 
    278  
    279           if (rootfsfile) { 
    280             sprintf(tag.bccfe.rootAddress, "%lu", rootfsoff); 
    281             sprintf(tag.bccfe.rootLength, "%lu", rootfslen); 
    282           } 
    283  
    284           strncpy(tag.bccfe.tagId, "bccfe", TAGID_LEN); 
    285  
    286           int2tag(tag.bccfe.tagIdCRC, crc32(IMAGETAG_CRC_START, (uint8_t*)&(tag.bccfe.tagId[0]), TAGID_LEN)); 
    287           int2tag(tag.bccfe.imageCRC, imagecrc); 
    288           int2tag(tag.bccfe.headerCRC, crc32(IMAGETAG_CRC_START, (uint8_t*)&tag, sizeof(tag) - 20)); 
    289         } else if ( tagid && (strcmp(tagid, "bc300") == 0)) { 
    290           /* Build the tag */ 
    291           strncpy(tag.bc300.tagVersion, ver, TAGVER_LEN); 
    292           strncpy(tag.bc300.sig_1, IMAGETAG_MAGIC1, sizeof(tag.bc300.sig_1) - 1); 
    293           strncpy(tag.bc300.sig_2, magic2, sizeof(tag.bc300.sig_2) - 1); 
    294           strcpy(tag.bc300.chipid, chipid); 
    295           strcpy(tag.bc300.boardid, boardid); 
    296           strcpy(tag.bc300.big_endian, "1"); 
    297           sprintf(tag.bc300.totalLength, "%lu", imagelen); 
    298  
    299           /* We don't include CFE */ 
    300           strcpy(tag.bc300.cfeAddress, "0"); 
    301           strcpy(tag.bc300.cfeLength, "0"); 
    302  
    303           if (kernelfile) { 
    304             sprintf(tag.bc300.kernelAddress, "%lu", kerneloff); 
    305             sprintf(tag.bc300.kernelLength, "%lu", kernellen + rootfsoffpadlen); 
    306           } 
    307  
    308           if (rootfsfile) { 
    309             sprintf(tag.bc300.flashImageStart, "%lu", kerneloff); 
    310             sprintf(tag.bc300.flashRootLength, "%lu", rootfslen + sizeof(deadcode)); 
    311             sprintf(tag.bc300.rootAddress, "%lu", rootfsoff); 
    312             sprintf(tag.bc300.rootLength, "%lu", rootfslen); 
    313           } 
    314  
    315           strncpy(tag.bc300.tagId, "bc300", TAGID_LEN); 
    316  
    317           int2tag(tag.bc300.tagIdCRC, crc32(IMAGETAG_CRC_START, (uint8_t*)&(tag.bc300.tagId[0]), TAGID_LEN)); 
    318           int2tag(tag.bc300.imageCRC, imagecrc); 
    319           int2tag(tag.bc300.headerCRC, crc32(IMAGETAG_CRC_START, (uint8_t*)&tag, sizeof(tag) - 20)); 
    320         } else if ( tagid && (strcmp(tagid, "ag306") == 0)) { 
    321           /* Build the tag */ 
    322           strncpy(tag.ag306.tagVersion, ver, TAGVER_LEN); 
    323           strncpy(tag.ag306.sig_1, IMAGETAG_MAGIC1, sizeof(tag.ag306.sig_1) - 1); 
    324           strncpy(tag.ag306.sig_2, magic2, sizeof(tag.ag306.sig_2) - 1); 
    325           strcpy(tag.ag306.chipid, chipid); 
    326           strcpy(tag.ag306.boardid, boardid); 
    327           strcpy(tag.ag306.big_endian, "1"); 
    328           sprintf(tag.ag306.totalLength, "%lu", imagelen); 
    329  
    330           /* We don't include CFE */ 
    331           strcpy(tag.ag306.cfeAddress, "0"); 
    332           strcpy(tag.ag306.cfeLength, "0"); 
    333  
    334           if (kernelfile) { 
    335             sprintf(tag.ag306.kernelAddress, "%lu", kerneloff); 
    336             sprintf(tag.ag306.kernelLength, "%lu", kernellen + rootfsoffpadlen); 
    337           } 
    338  
    339           if (rootfsfile) { 
    340             sprintf(tag.ag306.flashImageStart, "%lu", kerneloff); 
    341             sprintf(tag.ag306.flashRootLength, "%lu", rootfslen + sizeof(deadcode)); 
    342             sprintf(tag.ag306.rootAddress, "%lu", rootfsoff); 
    343             sprintf(tag.ag306.rootLength, "%lu", rootfslen); 
    344           } 
    345  
    346           strncpy(tag.ag306.tagId, "ag306", TAGID_LEN); 
    347  
    348           int2tag(tag.ag306.tagIdCRC, crc32(IMAGETAG_CRC_START, (uint8_t*)&(tag.ag306.tagId[0]), TAGID_LEN)); 
    349           int2tag(tag.ag306.kernelCRC, kernelcrc); 
    350           int2tag(tag.ag306.headerCRC, crc32(IMAGETAG_CRC_START, (uint8_t*)&tag, sizeof(tag) - 20)); 
    351         } else if ( tagid && (strcmp(tagid, "bc221") == 0)) { 
    352           /* Build the tag */ 
    353           strncpy(tag.bc221.tagVersion, ver, TAGVER_LEN); 
    354           strncpy(tag.bc221.sig_1, IMAGETAG_MAGIC1, sizeof(tag.bc221.sig_1) - 1); 
    355           strncpy(tag.bc221.sig_2, magic2, sizeof(tag.bc221.sig_2) - 1); 
    356           strcpy(tag.bc221.chipid, chipid); 
    357           strcpy(tag.bc221.boardid, boardid); 
    358           strcpy(tag.bc221.big_endian, "1"); 
    359           sprintf(tag.bc221.totalLength, "%lu", imagelen); 
    360  
    361           /* We don't include CFE */ 
    362           strcpy(tag.bc221.cfeAddress, "0"); 
    363           strcpy(tag.bc221.cfeLength, "0"); 
    364  
    365           if (kernelfile) { 
    366             sprintf(tag.bc221.kernelAddress, "%lu", kerneloff); 
    367             sprintf(tag.bc221.kernelLength, "%lu", kernellen + rootfsoffpadlen); 
    368           } 
    369  
    370           if (rootfsfile) { 
    371             sprintf(tag.bc221.flashImageStart, "%lu", kerneloff); 
    372             sprintf(tag.bc221.flashRootLength, "%lu", rootfslen + sizeof(deadcode)); 
    373             sprintf(tag.bc221.rootAddress, "%lu", rootfsoff); 
    374             sprintf(tag.bc221.rootLength, "%lu", rootfslen); 
    375           } 
    376  
    377           strncpy(tag.bc221.tagId, "bc221", TAGID_LEN); 
    378           if (layoutver) { 
    379             strncpy(tag.bc221.flashLayoutVer, layoutver, TAGLAYOUT_LEN); 
    380           } 
    381  
    382           int2tag(tag.bc221.tagIdCRC, crc32(IMAGETAG_CRC_START, (uint8_t*)&(tag.bc221.tagId[0]), TAGID_LEN)); 
    383           int2tag(tag.bc221.imageCRC, imagecrc); 
    384           int2tag(tag.bc221.fskernelCRC, kernelfscrc); 
    385           int2tag(tag.bc221.headerCRC, crc32(IMAGETAG_CRC_START, (uint8_t*)&tag, sizeof(tag) - 20)); 
    386         } else if ( tagid && (strcmp(tagid, "bc310") == 0)) { 
    387           /* Build the tag */ 
    388           strncpy(tag.bc310.tagVersion, ver, TAGVER_LEN); 
    389           strncpy(tag.bc310.sig_1, IMAGETAG_MAGIC1, sizeof(tag.bc310.sig_1) - 1); 
    390           strncpy(tag.bc310.sig_2, magic2, sizeof(tag.bc310.sig_2) - 1); 
    391           strcpy(tag.bc310.chipid, chipid); 
    392           strcpy(tag.bc310.boardid, boardid); 
    393           strcpy(tag.bc310.big_endian, "1"); 
    394           sprintf(tag.bc310.totalLength, "%lu", imagelen); 
    395  
    396           /* We don't include CFE */ 
    397           strcpy(tag.bc310.cfeAddress, "0"); 
    398           strcpy(tag.bc310.cfeLength, "0"); 
    399  
    400           if (kernelfile) { 
    401             sprintf(tag.bc310.kernelAddress, "%lu", kerneloff); 
    402             sprintf(tag.bc310.kernelLength, "%lu", kernellen + rootfsoffpadlen); 
    403           } 
    404  
    405           if (rootfsfile) { 
    406             sprintf(tag.bc310.flashImageStart, "%lu", kerneloff); 
    407             sprintf(tag.bc310.flashRootLength, "%lu", rootfslen + sizeof(deadcode)); 
    408             sprintf(tag.bc310.rootAddress, "%lu", rootfsoff); 
    409             sprintf(tag.bc310.rootLength, "%lu", rootfslen); 
    410           } 
    411  
    412           strncpy(tag.bc310.tagId, "bc310", TAGID_LEN); 
    413           if (information) { 
    414             strncpy(tag.bc310.information1, information, TAGINFO_LEN); 
    415           } 
    416  
    417           int2tag(tag.bc310.tagIdCRC, crc32(IMAGETAG_CRC_START, (uint8_t*)&(tag.bc310.tagId[0]), TAGID_LEN)); 
    418           int2tag(tag.bc310.imageCRC, imagecrc); 
    419           int2tag(tag.bc310.kernelCRC, kernelcrc); 
    420           int2tag(tag.bc310.rootfsCRC, rootfscrc); 
    421           int2tag(tag.bc310.headerCRC, crc32(IMAGETAG_CRC_START, (uint8_t*)&tag, sizeof(tag) - 20)); 
    422         } 
     251        /* Build the tag */ 
     252        strncpy(tag.tagVersion, ver, TAGVER_LEN); 
     253        strncpy(tag.sig_1, IMAGETAG_MAGIC1, sizeof(tag.sig_1) - 1); 
     254        strncpy(tag.sig_2, magic2, sizeof(tag.sig_2) - 1); 
     255        strcpy(tag.chipid, chipid); 
     256        strcpy(tag.boardid, boardid); 
     257        strcpy(tag.big_endian, "1"); 
     258        sprintf(tag.totalLength, "%lu", imagelen); 
     259 
     260        /* We don't include CFE */ 
     261        strcpy(tag.cfeAddress, "0"); 
     262        strcpy(tag.cfeLength, "0"); 
     263 
     264        sprintf(tag.kernelAddress, "%lu", kerneloff); 
     265        sprintf(tag.kernelLength, "%lu", kernellen + rootfsoffpadlen); 
     266        sprintf(tag.flashImageStart, "%lu", kerneloff); 
     267        sprintf(tag.rootLength, "%lu", rootfslen + sizeof(deadcode)); 
     268 
     269        if (rsignature) { 
     270            strncpy(tag.rsa_signature, rsignature, RSASIG_LEN); 
     271        } 
     272 
     273        if (layoutver) { 
     274            strncpy(tag.flashLayoutVer, layoutver, TAGLAYOUT_LEN); 
     275        } 
     276 
     277        for (i = 0; i < NUM_PIRELLI; i++) { 
     278                if (strncmp(boardid, pirellitab[i], BOARDID_LEN) == 0) { 
     279                        is_pirelli = 1; 
     280                        break; 
     281                } 
     282        } 
     283 
     284        if ( !is_pirelli ) { 
     285                int2tag(tag.imageCRC, imagecrc); 
     286        } else { 
     287                int2tag(tag.imageCRC, kernelcrc); 
     288        } 
     289        int2tag(tag.kernelCRC, kernelcrc); 
     290        int2tag(tag.rootfsCRC, rootfscrc); 
     291        int2tag(tag.fskernelCRC, kernelfscrc); 
     292        int2tag(tag.headerCRC, crc32(IMAGETAG_CRC_START, (uint8_t*)&tag, sizeof(tag) - 20)); 
    423293 
    424294        fseek(binfile, 0L, SEEK_SET); 
     
    433303{ 
    434304        int c, i; 
    435         char *kernel, *rootfs, *bin, *boardid, *chipid, *magic2, *ver, *tagid, *information, *layoutver; 
     305        char *kernel, *rootfs, *bin, *boardid, *chipid, *magic2, *ver, *tagid, *rsignature, *layoutver; 
    436306        uint32_t flashstart, fwoffset, loadaddr, entry; 
    437307        uint32_t fwaddr, flash_bs; 
    438308        int tagidfound = 0; 
    439309         
    440         kernel = rootfs = bin = boardid = chipid = magic2 = ver = tagid = information = layoutver = NULL; 
     310        kernel = rootfs = bin = boardid = chipid = magic2 = ver = rsignature = layoutver = NULL; 
    441311        entry = 0; 
    442312 
     
    446316        flash_bs = DEFAULT_FLASH_BS; 
    447317 
    448         printf("Broadcom image tagger - v0.2.0\n"); 
     318        printf("Broadcom image tagger - v1.0.0\n"); 
    449319        printf("Copyright (C) 2008 Axel Gembe\n"); 
    450         printf("Copyright (C) 2009 Daniel Dickinson\n"); 
    451  
    452         while ((c = getopt(argc, argv, "i:f:o:b:c:s:n:v:m:k:l:e:h:t:d:y:")) != -1) { 
     320        printf("Copyright (C) 2009-2010 Daniel Dickinson\n"); 
     321 
     322        while ((c = getopt(argc, argv, "i:f:o:b:c:s:n:v:m:k:l:e:h:r:y:")) != -1) { 
    453323                switch (c) { 
    454324                        case 'i': 
     
    488358                                entry = strtoul(optarg, NULL, 16); 
    489359                                break; 
    490                         case 't': 
    491                                 tagid = optarg; 
    492                                 break; 
    493                         case 'd': 
    494                                 information = optarg; 
     360                        case 'r': 
     361                                rsignature = optarg; 
    495362                                break; 
    496363                        case 'y': 
     
    512379                                fprintf(stderr, "       -l <loadaddr>           - Address where the kernel expects to be loaded (defaults to 0x80010000)\n"); 
    513380                                fprintf(stderr, "       -e <entry>              - Address where the kernel entry point will end up\n"); 
    514                                 fprintf(stderr, "       -t <tagid> - type if imagetag to create, use 'list' to see available choices"); 
    515                                 fprintf(stderr, "       -d <information> - vendor specific information, for those that need it"); 
    516                                 fprintf(stderr, "       -y <layoutver> - Flash Layout Version (2.2x code versions need this)"); 
     381                                fprintf(stderr, "       -r <signature>          - vendor specific signature, for those that need it"); 
     382                                fprintf(stderr, "       -y <layoutver>          - Flash Layout Version (2.2x code versions need this)"); 
    517383                                fprintf(stderr, "       -h                      - Displays this text\n\n"); 
    518384                                return 1; 
     
    530396        } 
    531397         
    532         tagidfound = 0; 
    533         if (!tagid) { 
    534           fprintf(stderr, "You must specify a tagid (-t)\n"); 
    535         } else { 
    536           if (strncmp(tagid, "list", 4) == 0) { 
    537             fprintf(stderr, "\n----------------------------------------\n"); 
    538             fprintf(stderr, "\tAvailable tagId:"); 
    539             fprintf(stderr, "\n\n"); 
    540             for (i = 0; i < NUM_TAGID; i++) { 
    541               fprintf(stderr, "\t%s\t%s", tagidtab[i].tagid, tagidtab[i].tagiddesc);     
    542             } 
    543             fprintf(stderr, "\n----------------------------------------\n"); 
    544             return 0;        
    545           } 
    546         } 
    547  
    548         if (tagid) { 
    549           for(i = 0; i < NUM_TAGID; i++) { 
    550             if (strncmp(tagid, tagidtab[i].tagid, TAGID_LEN) == 0) { 
    551               tagidfound = 1; 
    552               break; 
    553             } 
    554           } 
    555           if (!tagidfound) { 
    556             if (tagid) { 
    557               fprintf(stderr, "The tagid you selected '%s' does't exist.\n", tagid); 
    558             } 
    559             fprintf(stderr, "Use -t list to see the list of available ids");   
    560             return 1; 
    561           } 
    562         } 
    563  
    564398        /* Fallback to defaults */ 
    565399 
     
    585419                 
    586420 
    587         return tagfile(kernel, rootfs, bin, boardid, chipid, fwaddr, loadaddr, entry, ver, magic2, flash_bs, tagid, information, layoutver); 
     421        return tagfile(kernel, rootfs, bin, boardid, chipid, fwaddr, loadaddr, entry, ver, magic2, flash_bs, rsignature, layoutver); 
    588422} 
Note: See TracChangeset for help on using the changeset viewer.