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>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@26680
3c298f89-4303-0410-b956-
a3cf2f4a3e73
char imageCRC[CRC_LEN]; // 216-219: CRC32 of image less imagetag (kernel for Alice Gate)
char rootfsCRC[CRC_LEN]; // 220-223: CRC32 of rootfs partition
char kernelCRC[CRC_LEN]; // 224-227: CRC32 of kernel partition
char imageCRC[CRC_LEN]; // 216-219: CRC32 of image less imagetag (kernel for Alice Gate)
char rootfsCRC[CRC_LEN]; // 220-223: CRC32 of rootfs partition
char kernelCRC[CRC_LEN]; // 224-227: CRC32 of kernel partition
- 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
- char reserved1[4]; // 232-235: Unused at present
+ char imageSequence[4]; // 228-231: Image sequence number
+ 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
char headerCRC[CRC_LEN]; // 236-239: CRC32 of header excluding tagVersion
char reserved2[16]; // 240-255: Unused at present
};
char headerCRC[CRC_LEN]; // 236-239: CRC32 of header excluding tagVersion
char reserved2[16]; // 240-255: Unused at present
};
char kernel_crc[CRC_LEN];
- /* 228-235: Unused at present */
- char reserved1[8];
char kernel_crc[CRC_LEN];
- /* 228-235: Unused at present */
- char reserved1[8];
-+ /* 228-231: OpenWrt: real rootfs length */
++ /* 228-231: Image sequence number */
++ char image_sequence[4];
++ /* 222-235: Openwrt: real rootfs length */
+ char real_rootfs_length[4];
+ char real_rootfs_length[4];
-+ /* 222-235: Unused at present */
-+ char reserved1[4];
/* 236-239: CRC32 of header excluding tagVersion */
char header_crc[CRC_LEN];
/* 240-255: Unused at present */
/* 236-239: CRC32 of header excluding tagVersion */
char header_crc[CRC_LEN];
/* 240-255: Unused at present */
strncpy(tag.information2, args->info2_arg, TAGINFO2_LEN);
}
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);
}
if (args->reserved2_given) {
strncpy(tag.reserved2, args->reserved2_arg, 16);
}
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 "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
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
" -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')",
" -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
" --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
args_info->rsa_signature_given = 0 ;
args_info->second_image_flag_given = 0 ;
args_info->inactive_given = 0 ;
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 ;
}
args_info->reserved2_given = 0 ;
args_info->kernel_file_has_header_given = 0 ;
}
args_info->second_image_flag_orig = NULL;
args_info->inactive_arg = gengetopt_strdup ("2");
args_info->inactive_orig = NULL;
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;
args_info->reserved2_arg = NULL;
args_info->reserved2_orig = NULL;
args_info->kernel_file_has_header_flag = 0;
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->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] ;
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->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));
free_string_field (&(args_info->reserved2_arg));
free_string_field (&(args_info->reserved2_orig));
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);
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)
if (args_info->reserved2_given)
write_into_file(outfile, "reserved2", args_info->reserved2_orig, 0);
if (args_info->kernel_file_has_header_given)
{ "rsa-signature", 1, NULL, 'r' },
{ "second-image-flag", 1, NULL, 0 },
{ "inactive", 1, NULL, 0 },
{ "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 }
{ "reserved2", 1, NULL, 0 },
{ "kernel-file-has-header", 0, NULL, 0 },
{ 0, 0, 0, 0 }
additional_error))
goto failure;
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)
}
/* String for second reserved section.. */
else if (strcmp (long_options[option_index].name, "reserved2") == 0)
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 * 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. */
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. */
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 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. */
unsigned int reserved2_given ; /**< @brief Whether reserved2 was given. */
unsigned int kernel_file_has_header_given ; /**< @brief Whether kernel-file-has-header was given. */