bcm_tag.h 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #ifndef __BCM63XX_TAG_H
  2. #define __BCM63XX_TAG_H
  3. #define TAGVER_LEN 4 /* Length of Tag Version */
  4. #define TAGLAYOUT_LEN 4 /* Length of FlashLayoutVer */
  5. #define SIG1_LEN 20 /* Company Signature 1 Length */
  6. #define SIG2_LEN 14 /* Company Signature 2 Lenght */
  7. #define BOARDID_LEN 16 /* Length of BoardId */
  8. #define ENDIANFLAG_LEN 2 /* Endian Flag Length */
  9. #define CHIPID_LEN 6 /* Chip Id Length */
  10. #define IMAGE_LEN 10 /* Length of Length Field */
  11. #define ADDRESS_LEN 12 /* Length of Address field */
  12. #define DUALFLAG_LEN 2 /* Dual Image flag Length */
  13. #define INACTIVEFLAG_LEN 2 /* Inactie Flag Length */
  14. #define RSASIG_LEN 20 /* Length of RSA Signature in tag */
  15. #define TAGINFO1_LEN 30 /* Length of vendor information field1 in tag */
  16. #define FLASHLAYOUTVER_LEN 4 /* Length of Flash Layout Version String tag */
  17. #define TAGINFO2_LEN 16 /* Length of vendor information field2 in tag */
  18. #define CRC_LEN 4 /* Length of CRC in bytes */
  19. #define ALTTAGINFO_LEN 54 /* Alternate length for vendor information; Pirelli */
  20. #define NUM_PIRELLI 2
  21. #define IMAGETAG_CRC_START 0xFFFFFFFF
  22. #define PIRELLI_BOARDS { \
  23. "AGPF-S0", \
  24. "DWV-S0", \
  25. }
  26. /*
  27. * The broadcom firmware assumes the rootfs starts the image,
  28. * therefore uses the rootfs start (flashImageAddress)
  29. * to determine where to flash the image. Since we have the kernel first
  30. * we have to give it the kernel address, but the crc uses the length
  31. * associated with this address (rootLength), which is added to the kernel
  32. * length (kernelLength) to determine the length of image to flash and thus
  33. * needs to be rootfs + deadcode (jffs2 EOF marker)
  34. */
  35. struct bcm_tag {
  36. char tagVersion[TAGVER_LEN]; // 0-3: Version of the image tag
  37. char sig_1[SIG1_LEN]; // 4-23: Company Line 1
  38. char sig_2[SIG2_LEN]; // 24-37: Company Line 2
  39. char chipid[CHIPID_LEN]; // 38-43: Chip this image is for
  40. char boardid[BOARDID_LEN]; // 44-59: Board name
  41. char big_endian[ENDIANFLAG_LEN]; // 60-61: Map endianness -- 1 BE 0 LE
  42. char totalLength[IMAGE_LEN]; // 62-71: Total length of image
  43. char cfeAddress[ADDRESS_LEN]; // 72-83: Address in memory of CFE
  44. char cfeLength[IMAGE_LEN]; // 84-93: Size of CFE
  45. char flashImageStart[ADDRESS_LEN]; // 94-105: Address in memory of image start (kernel for OpenWRT, rootfs for stock firmware)
  46. char flashRootLength[IMAGE_LEN]; // 106-115: Size of rootfs for flashing
  47. char kernelAddress[ADDRESS_LEN]; // 116-127: Address in memory of kernel
  48. char kernelLength[IMAGE_LEN]; // 128-137: Size of kernel
  49. char dualImage[DUALFLAG_LEN]; // 138-139: Unused at present
  50. char inactiveFlag[INACTIVEFLAG_LEN]; // 140-141: Unused at present
  51. char rsa_signature[RSASIG_LEN]; // 142-161: RSA Signature (unused at present; some vendors may use this)
  52. char information1[TAGINFO1_LEN]; // 162-191: Compilation and related information (not generated/used by OpenWRT)
  53. char flashLayoutVer[FLASHLAYOUTVER_LEN];// 192-195: Version flash layout
  54. char fskernelCRC[CRC_LEN]; // 196-199: kernel+rootfs CRC32
  55. char information2[TAGINFO2_LEN]; // 200-215: Unused at present except Alice Gate where is is information
  56. char imageCRC[CRC_LEN]; // 216-219: CRC32 of image less imagetag (kernel for Alice Gate)
  57. char rootfsCRC[CRC_LEN]; // 220-223: CRC32 of rootfs partition
  58. char kernelCRC[CRC_LEN]; // 224-227: CRC32 of kernel partition
  59. char imageSequence[4]; // 228-231: Image sequence number
  60. char rootLength[4]; // 232-235: steal from reserved1 to keep the real root length so we can use in the flash map even after we have change the rootLength to 0 to satisfy devices that check CRC on every boot
  61. char headerCRC[CRC_LEN]; // 236-239: CRC32 of header excluding tagVersion
  62. char reserved2[16]; // 240-255: Unused at present
  63. };
  64. #endif /* __BCM63XX_TAG_H */