bcm63xx: Move the OpenWrt rootfs length field
authorDaniel Dickinson <crazycshore@gmail.com>
Fri, 15 Apr 2011 12:18:25 +0000 (12:18 +0000)
committerDaniel Dickinson <crazycshore@gmail.com>
Fri, 15 Apr 2011 12:18:25 +0000 (12:18 +0000)
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@gmail.com>
SVN-Revision: 26680

src/imagetag.c
src/imagetag.ggo
src/imagetag_cmdline.c
src/imagetag_cmdline.h

index a7b9babd3e911f98e91f8893f2dc359f6a8ea43a..bebaba2f29dee03abbd9c89f2cc9cc50476ae48d 100644 (file)
@@ -361,10 +361,6 @@ int tagfile(const char *kernel, const char *rootfs, const char *bin, \
          strncpy(tag.information2, args->info2_arg, TAGINFO2_LEN);
        }
 
-       if (args->reserved1_given) {
-         strncpy(tag.reserved1, args->reserved1_arg, 8);
-       }
-
        if (args->reserved2_given) {
          strncpy(tag.reserved2, args->reserved2_arg, 16);
        }
index 4b9d5d361e317c4e785d3589807f5dd328a211c7..7e8e7d90e32097a435edd260d6ea98fccc03ee12 100644 (file)
@@ -40,6 +40,5 @@ option "root-first" - "Put the rootfs before the kernel (only for stock images,
 option "rsa-signature" r "String for RSA Signature section." string optional
 option "second-image-flag" - "Dual Image Flag (2=not-specified)." values="0", "1", "2" default="2" typestr="flag-value" optional
 option "inactive" - "Inactive Flag (2=not-specified)." values="0", "1", "2" default="2" typestr="flag-value" optional
-option "reserved1" - "String for first reserved section." string optional
 option "reserved2" - "String for second reserved section." string optional
 option "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
index 85f214bc6cc5867cf11b4d71ef686067ae5d6992..91ac90b09d0b45aa13bd6ba2a17df016fbfa0b7e 100644 (file)
@@ -56,7 +56,6 @@ const char *gengetopt_args_info_help[] = {
   "  -r, --rsa-signature=STRING    String for RSA Signature section.",
   "      --second-image-flag=flag-value\n                                Dual Image Flag (2=not-specified).  (possible \n                                  values=\"0\", \"1\", \"2\" default=`2')",
   "      --inactive=flag-value     Inactive Flag (2=not-specified).  (possible \n                                  values=\"0\", \"1\", \"2\" default=`2')",
-  "      --reserved1=STRING        String for first reserved section.",
   "      --reserved2=STRING        String for second reserved section.",
   "      --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)",
     0
@@ -112,7 +111,6 @@ void clear_given (struct gengetopt_args_info *args_info)
   args_info->rsa_signature_given = 0 ;
   args_info->second_image_flag_given = 0 ;
   args_info->inactive_given = 0 ;
-  args_info->reserved1_given = 0 ;
   args_info->reserved2_given = 0 ;
   args_info->kernel_file_has_header_given = 0 ;
 }
@@ -164,8 +162,6 @@ void clear_args (struct gengetopt_args_info *args_info)
   args_info->second_image_flag_orig = NULL;
   args_info->inactive_arg = gengetopt_strdup ("2");
   args_info->inactive_orig = NULL;
-  args_info->reserved1_arg = NULL;
-  args_info->reserved1_orig = NULL;
   args_info->reserved2_arg = NULL;
   args_info->reserved2_orig = NULL;
   args_info->kernel_file_has_header_flag = 0;
@@ -201,9 +197,8 @@ void init_args_info(struct gengetopt_args_info *args_info)
   args_info->rsa_signature_help = gengetopt_args_info_help[21] ;
   args_info->second_image_flag_help = gengetopt_args_info_help[22] ;
   args_info->inactive_help = gengetopt_args_info_help[23] ;
-  args_info->reserved1_help = gengetopt_args_info_help[24] ;
-  args_info->reserved2_help = gengetopt_args_info_help[25] ;
-  args_info->kernel_file_has_header_help = gengetopt_args_info_help[26] ;
+  args_info->reserved2_help = gengetopt_args_info_help[24] ;
+  args_info->kernel_file_has_header_help = gengetopt_args_info_help[25] ;
   
 }
 
@@ -326,8 +321,6 @@ cmdline_parser_release (struct gengetopt_args_info *args_info)
   free_string_field (&(args_info->second_image_flag_orig));
   free_string_field (&(args_info->inactive_arg));
   free_string_field (&(args_info->inactive_orig));
-  free_string_field (&(args_info->reserved1_arg));
-  free_string_field (&(args_info->reserved1_orig));
   free_string_field (&(args_info->reserved2_arg));
   free_string_field (&(args_info->reserved2_orig));
   
@@ -449,8 +442,6 @@ cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info)
     write_into_file(outfile, "second-image-flag", args_info->second_image_flag_orig, cmdline_parser_second_image_flag_values);
   if (args_info->inactive_given)
     write_into_file(outfile, "inactive", args_info->inactive_orig, cmdline_parser_inactive_values);
-  if (args_info->reserved1_given)
-    write_into_file(outfile, "reserved1", args_info->reserved1_orig, 0);
   if (args_info->reserved2_given)
     write_into_file(outfile, "reserved2", args_info->reserved2_orig, 0);
   if (args_info->kernel_file_has_header_given)
@@ -794,7 +785,6 @@ cmdline_parser_internal (
         { "rsa-signature",     1, NULL, 'r' },
         { "second-image-flag", 1, NULL, 0 },
         { "inactive",  1, NULL, 0 },
-        { "reserved1", 1, NULL, 0 },
         { "reserved2", 1, NULL, 0 },
         { "kernel-file-has-header",    0, NULL, 0 },
         { 0,  0, 0, 0 }
@@ -1089,20 +1079,6 @@ cmdline_parser_internal (
                 additional_error))
               goto failure;
           
-          }
-          /* String for first reserved section..  */
-          else if (strcmp (long_options[option_index].name, "reserved1") == 0)
-          {
-          
-          
-            if (update_arg( (void *)&(args_info->reserved1_arg), 
-                 &(args_info->reserved1_orig), &(args_info->reserved1_given),
-                &(local_args_info.reserved1_given), optarg, 0, 0, ARG_STRING,
-                check_ambiguity, override, 0, 0,
-                "reserved1", '-',
-                additional_error))
-              goto failure;
-          
           }
           /* String for second reserved section..  */
           else if (strcmp (long_options[option_index].name, "reserved2") == 0)
index a3891484177986eaadc51b133c0df0364d73543c..c566a9f293268724f40e39947e8c4f1b56fcb308 100644 (file)
@@ -104,9 +104,6 @@ struct gengetopt_args_info
   char * inactive_arg; /**< @brief Inactive Flag (2=not-specified). (default='2').  */
   char * inactive_orig;        /**< @brief Inactive Flag (2=not-specified). original value given at command line.  */
   const char *inactive_help; /**< @brief Inactive Flag (2=not-specified). help description.  */
-  char * reserved1_arg;        /**< @brief String for first reserved section..  */
-  char * reserved1_orig;       /**< @brief String for first reserved section. original value given at command line.  */
-  const char *reserved1_help; /**< @brief String for first reserved section. help description.  */
   char * reserved2_arg;        /**< @brief String for second reserved section..  */
   char * reserved2_orig;       /**< @brief String for second reserved section. original value given at command line.  */
   const char *reserved2_help; /**< @brief String for second reserved section. help description.  */
@@ -137,7 +134,6 @@ struct gengetopt_args_info
   unsigned int rsa_signature_given ;   /**< @brief Whether rsa-signature was given.  */
   unsigned int second_image_flag_given ;       /**< @brief Whether second-image-flag was given.  */
   unsigned int inactive_given ;        /**< @brief Whether inactive was given.  */
-  unsigned int reserved1_given ;       /**< @brief Whether reserved1 was given.  */
   unsigned int reserved2_given ;       /**< @brief Whether reserved2 was given.  */
   unsigned int kernel_file_has_header_given ;  /**< @brief Whether kernel-file-has-header was given.  */