Changeset 26680


Ignore:
Timestamp:
2011-04-15T14:18:25+02:00 (7 years ago)
Author:
cshore
Message:

bcm63xx: Move the OpenWrt rootfs length field

Dual image capable CFEs store an image sequence at the same place as
currently OpenWrt stores the actual rootfs length, so it will get
overwritten when flashing through such a CFE.

To prevent this from happening, move the rootfs length field to the next
four bytes, thus completely using the reserved1 field.

Since the reserved1 field is now completely in use, it does not make sense
to allow it to be set from the imagetag utility, so remove the option.

Signed-off-by: Jonas Gorski <jonas.gorski+openwrt@…>

Location:
trunk
Files:
6 edited

Legend:

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

    r24838 r26680  
    6262        char rootfsCRC[CRC_LEN];               // 220-223: CRC32 of rootfs partition 
    6363        char kernelCRC[CRC_LEN];               // 224-227: CRC32 of kernel partition 
    64      char rootLength[4];                        // 228-231: 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 
    65         char reserved1[4];                     // 232-235: Unused at present 
     64        char imageSequence[4];                 // 228-231: Image sequence number 
     65        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 
    6666        char headerCRC[CRC_LEN];               // 236-239: CRC32 of header excluding tagVersion 
    6767        char reserved2[16];                    // 240-255: Unused at present 
  • trunk/target/linux/brcm63xx/patches-2.6.37/041-bcm963xx_real_rootfs_length.patch

    r25938 r26680  
    77-       /* 228-235: Unused at present */ 
    88-       char reserved1[8]; 
    9 +       /* 228-231: OpenWrt: real rootfs length */ 
     9+       /* 228-231: Image sequence number */ 
     10+       char image_sequence[4]; 
     11+       /* 222-235: Openwrt: real rootfs length */ 
    1012+       char real_rootfs_length[4]; 
    11 +       /* 222-235: Unused at present */ 
    12 +       char reserved1[4]; 
    1313        /* 236-239: CRC32 of header excluding tagVersion */ 
    1414        char header_crc[CRC_LEN]; 
  • trunk/tools/firmware-utils/src/imagetag.c

    r24838 r26680  
    362362        } 
    363363 
    364         if (args->reserved1_given) { 
    365           strncpy(tag.reserved1, args->reserved1_arg, 8); 
    366         } 
    367  
    368364        if (args->reserved2_given) { 
    369365          strncpy(tag.reserved2, args->reserved2_arg, 16); 
  • trunk/tools/firmware-utils/src/imagetag.ggo

    r24011 r26680  
    4141option "second-image-flag" - "Dual Image Flag (2=not-specified)." values="0", "1", "2" default="2" typestr="flag-value" optional 
    4242option "inactive" - "Inactive Flag (2=not-specified)." values="0", "1", "2" default="2" typestr="flag-value" optional 
    43 option "reserved1" - "String for first reserved section." string optional 
    4443option "reserved2" - "String for second reserved section." string optional 
    4544option "kernel-file-has-header" - "Indicates that the kernel file includes the kernel header with correct load address and entry point, so no changes are needed" flag off 
  • trunk/tools/firmware-utils/src/imagetag_cmdline.c

    r24011 r26680  
    5757  "      --second-image-flag=flag-value\n                                Dual Image Flag (2=not-specified).  (possible \n                                  values=\"0\", \"1\", \"2\" default=`2')", 
    5858  "      --inactive=flag-value     Inactive Flag (2=not-specified).  (possible \n                                  values=\"0\", \"1\", \"2\" default=`2')", 
    59   "      --reserved1=STRING        String for first reserved section.", 
    6059  "      --reserved2=STRING        String for second reserved section.", 
    6160  "      --kernel-file-has-header  Indicates that the kernel file includes the \n                                  kernel header with correct load address and \n                                  entry point, so no changes are needed  \n                                  (default=off)", 
     
    113112  args_info->second_image_flag_given = 0 ; 
    114113  args_info->inactive_given = 0 ; 
    115   args_info->reserved1_given = 0 ; 
    116114  args_info->reserved2_given = 0 ; 
    117115  args_info->kernel_file_has_header_given = 0 ; 
     
    165163  args_info->inactive_arg = gengetopt_strdup ("2"); 
    166164  args_info->inactive_orig = NULL; 
    167   args_info->reserved1_arg = NULL; 
    168   args_info->reserved1_orig = NULL; 
    169165  args_info->reserved2_arg = NULL; 
    170166  args_info->reserved2_orig = NULL; 
     
    202198  args_info->second_image_flag_help = gengetopt_args_info_help[22] ; 
    203199  args_info->inactive_help = gengetopt_args_info_help[23] ; 
    204   args_info->reserved1_help = gengetopt_args_info_help[24] ; 
    205   args_info->reserved2_help = gengetopt_args_info_help[25] ; 
    206   args_info->kernel_file_has_header_help = gengetopt_args_info_help[26] ; 
     200  args_info->reserved2_help = gengetopt_args_info_help[24] ; 
     201  args_info->kernel_file_has_header_help = gengetopt_args_info_help[25] ; 
    207202   
    208203} 
     
    327322  free_string_field (&(args_info->inactive_arg)); 
    328323  free_string_field (&(args_info->inactive_orig)); 
    329   free_string_field (&(args_info->reserved1_arg)); 
    330   free_string_field (&(args_info->reserved1_orig)); 
    331324  free_string_field (&(args_info->reserved2_arg)); 
    332325  free_string_field (&(args_info->reserved2_orig)); 
     
    450443  if (args_info->inactive_given) 
    451444    write_into_file(outfile, "inactive", args_info->inactive_orig, cmdline_parser_inactive_values); 
    452   if (args_info->reserved1_given) 
    453     write_into_file(outfile, "reserved1", args_info->reserved1_orig, 0); 
    454445  if (args_info->reserved2_given) 
    455446    write_into_file(outfile, "reserved2", args_info->reserved2_orig, 0); 
     
    795786        { "second-image-flag",  1, NULL, 0 }, 
    796787        { "inactive",   1, NULL, 0 }, 
    797         { "reserved1",  1, NULL, 0 }, 
    798788        { "reserved2",  1, NULL, 0 }, 
    799789        { "kernel-file-has-header",     0, NULL, 0 }, 
     
    10911081           
    10921082          } 
    1093           /* String for first reserved section..  */ 
    1094           else if (strcmp (long_options[option_index].name, "reserved1") == 0) 
    1095           { 
    1096            
    1097            
    1098             if (update_arg( (void *)&(args_info->reserved1_arg),  
    1099                  &(args_info->reserved1_orig), &(args_info->reserved1_given), 
    1100                 &(local_args_info.reserved1_given), optarg, 0, 0, ARG_STRING, 
    1101                 check_ambiguity, override, 0, 0, 
    1102                 "reserved1", '-', 
    1103                 additional_error)) 
    1104               goto failure; 
    1105            
    1106           } 
    11071083          /* String for second reserved section..  */ 
    11081084          else if (strcmp (long_options[option_index].name, "reserved2") == 0) 
  • trunk/tools/firmware-utils/src/imagetag_cmdline.h

    r24011 r26680  
    105105  char * inactive_orig; /**< @brief Inactive Flag (2=not-specified). original value given at command line.  */ 
    106106  const char *inactive_help; /**< @brief Inactive Flag (2=not-specified). help description.  */ 
    107   char * reserved1_arg; /**< @brief String for first reserved section..  */ 
    108   char * reserved1_orig;        /**< @brief String for first reserved section. original value given at command line.  */ 
    109   const char *reserved1_help; /**< @brief String for first reserved section. help description.  */ 
    110107  char * reserved2_arg; /**< @brief String for second reserved section..  */ 
    111108  char * reserved2_orig;        /**< @brief String for second reserved section. original value given at command line.  */ 
     
    138135  unsigned int second_image_flag_given ;        /**< @brief Whether second-image-flag was given.  */ 
    139136  unsigned int inactive_given ; /**< @brief Whether inactive was given.  */ 
    140   unsigned int reserved1_given ;        /**< @brief Whether reserved1 was given.  */ 
    141137  unsigned int reserved2_given ;        /**< @brief Whether reserved2 was given.  */ 
    142138  unsigned int kernel_file_has_header_given ;   /**< @brief Whether kernel-file-has-header was given.  */ 
Note: See TracChangeset for help on using the changeset viewer.