summaryrefslogtreecommitdiff
path: root/tools/firmware-utils
diff options
context:
space:
mode:
authorJonas Gorski <jogo@openwrt.org>2015-02-27 17:38:14 +0000
committerJonas Gorski <jogo@openwrt.org>2015-02-27 17:38:14 +0000
commitbb54859543955dcff3126f2e54d9d966f65c745a (patch)
tree593ab120d366351783d38c37cc09e2b64a617376 /tools/firmware-utils
parentd4652e817a7f1d57f9b1d1a205d44c6877b9a895 (diff)
downloadmtk-20170518-bb54859543955dcff3126f2e54d9d966f65c745a.zip
mtk-20170518-bb54859543955dcff3126f2e54d9d966f65c745a.tar.gz
mtk-20170518-bb54859543955dcff3126f2e54d9d966f65c745a.tar.bz2
brcm63xx: do not align squashfs rootfs start
We do not need to align the start of read only rootfs's to erase blocks. This allows us to write the squashfs rootfs directly behind the kernel, potentially freeing up one erase block. We still need to align for jffs2, so add a flag for imagetag to optionally align the rootfs start. Signed-off-by: Jonas Gorski <jogo@openwrt.org> SVN-Revision: 44556
Diffstat (limited to 'tools/firmware-utils')
-rw-r--r--tools/firmware-utils/src/imagetag.c19
-rw-r--r--tools/firmware-utils/src/imagetag.ggo1
-rw-r--r--tools/firmware-utils/src/imagetag_cmdline.c141
-rw-r--r--tools/firmware-utils/src/imagetag_cmdline.h57
4 files changed, 124 insertions, 94 deletions
diff --git a/tools/firmware-utils/src/imagetag.c b/tools/firmware-utils/src/imagetag.c
index c15ffd7..f04f98d 100644
--- a/tools/firmware-utils/src/imagetag.c
+++ b/tools/firmware-utils/src/imagetag.c
@@ -83,7 +83,8 @@ int tagfile(const char *kernel, const char *rootfs, const char *bin, \
struct kernelhdr khdr;
FILE *kernelfile = NULL, *rootfsfile = NULL, *binfile = NULL, *cfefile = NULL;
size_t cfeoff, cfelen, kerneloff, kernellen, rootfsoff, rootfslen, \
- read, imagelen, rootfsoffpadlen = 0, kernelfslen, kerneloffpadlen = 0, oldrootfslen;
+ read, imagelen, rootfsoffpadlen = 0, kernelfslen, kerneloffpadlen = 0, oldrootfslen, \
+ rootfsend;
uint8_t readbuf[1024];
uint32_t imagecrc = IMAGETAG_CRC_START;
uint32_t kernelcrc = IMAGETAG_CRC_START;
@@ -157,11 +158,17 @@ int tagfile(const char *kernel, const char *rootfs, const char *bin, \
kernellen += sizeof(khdr);
}
- /* Build the rootfs address and length (start and end do need to be aligned on flash erase block boundaries */
+ /* Build the rootfs address and length */
rootfsoff = kerneloff + kernellen;
- rootfsoff = (rootfsoff % block_size) > 0 ? (((rootfsoff / block_size) + 1) * block_size) : rootfsoff;
- rootfslen = getlen(rootfsfile);
- rootfslen = ( (rootfslen % block_size) > 0 ? (((rootfslen / block_size) + 1) * block_size) : rootfslen );
+ /* align the start if requested */
+ if (args->align_rootfs_flag)
+ rootfsoff = (rootfsoff % block_size) > 0 ? (((rootfsoff / block_size) + 1) * block_size) : rootfsoff;
+
+ /* align the end */
+ rootfsend = rootfsoff + getlen(rootfsfile);
+ if ((rootfsend % block_size) > 0)
+ rootfsend = (((rootfsend / block_size) + 1) * block_size);
+ rootfslen = rootfsend - rootfsoff;
imagelen = rootfsoff + rootfslen - kerneloff + sizeof(deadcode);
rootfsoffpadlen = rootfsoff - (kerneloff + kernellen);
@@ -390,7 +397,7 @@ int main(int argc, char **argv)
kernel = rootfs = bin = NULL;
- if (cmdline_parser(argc, argv, &parsed_args)) {
+ if (imagetag_cmdline(argc, argv, &parsed_args)) {
exit(1);
}
diff --git a/tools/firmware-utils/src/imagetag.ggo b/tools/firmware-utils/src/imagetag.ggo
index 7c9f943..7318485 100644
--- a/tools/firmware-utils/src/imagetag.ggo
+++ b/tools/firmware-utils/src/imagetag.ggo
@@ -43,3 +43,4 @@ option "inactive" - "Inactive Flag (2=not-specified)." values="0", "1", "2" defa
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 "pad" p "Pad the image to this size if smaller (in MiB)" int typestr="size (in MiB)" optional
+option "align-rootfs" - "Align the rootfs start to erase block size" flag off
diff --git a/tools/firmware-utils/src/imagetag_cmdline.c b/tools/firmware-utils/src/imagetag_cmdline.c
index efb82ac..86c90bb 100644
--- a/tools/firmware-utils/src/imagetag_cmdline.c
+++ b/tools/firmware-utils/src/imagetag_cmdline.c
@@ -1,7 +1,7 @@
/*
- File autogenerated by gengetopt version 2.22.4
+ File autogenerated by gengetopt version 2.22.5
generated with the following command:
- gengetopt --file-name=imagetag_cmdline --file-name=imagetag_cmdline
+ gengetopt -i imagetag.ggo -f imagetag_cmdline --file-name=imagetag_cmdline
The developers of gengetopt consider the fixed text that goes in all
gengetopt output files to be in the public domain:
@@ -59,6 +59,7 @@ const char *gengetopt_args_info_help[] = {
" --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)",
" -p, --pad=size (in MiB) Pad the image to this size if smaller (in MiB)",
+ " --align-rootfs Align the rootfs start to erase block size \n (default=off)",
0
};
@@ -66,7 +67,7 @@ typedef enum {ARG_NO
, ARG_FLAG
, ARG_STRING
, ARG_INT
-} cmdline_parser_arg_type;
+} imagetag_cmdline_arg_type;
static
void clear_given (struct gengetopt_args_info *args_info);
@@ -74,14 +75,14 @@ static
void clear_args (struct gengetopt_args_info *args_info);
static int
-cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info,
- struct cmdline_parser_params *params, const char *additional_error);
+imagetag_cmdline_internal (int argc, char **argv, struct gengetopt_args_info *args_info,
+ struct imagetag_cmdline_params *params, const char *additional_error);
static int
-cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error);
+imagetag_cmdline_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error);
-const char *cmdline_parser_second_image_flag_values[] = {"0", "1", "2", 0}; /*< Possible values for second-image-flag. */
-const char *cmdline_parser_inactive_values[] = {"0", "1", "2", 0}; /*< Possible values for inactive. */
+const char *imagetag_cmdline_second_image_flag_values[] = {"0", "1", "2", 0}; /*< Possible values for second-image-flag. */
+const char *imagetag_cmdline_inactive_values[] = {"0", "1", "2", 0}; /*< Possible values for inactive. */
static char *
gengetopt_strdup (const char *s);
@@ -116,6 +117,7 @@ void clear_given (struct gengetopt_args_info *args_info)
args_info->reserved2_given = 0 ;
args_info->kernel_file_has_header_given = 0 ;
args_info->pad_given = 0 ;
+ args_info->align_rootfs_given = 0 ;
}
static
@@ -169,6 +171,7 @@ void clear_args (struct gengetopt_args_info *args_info)
args_info->reserved2_orig = NULL;
args_info->kernel_file_has_header_flag = 0;
args_info->pad_orig = NULL;
+ args_info->align_rootfs_flag = 0;
}
@@ -204,19 +207,20 @@ void init_args_info(struct gengetopt_args_info *args_info)
args_info->reserved2_help = gengetopt_args_info_help[24] ;
args_info->kernel_file_has_header_help = gengetopt_args_info_help[25] ;
args_info->pad_help = gengetopt_args_info_help[26] ;
+ args_info->align_rootfs_help = gengetopt_args_info_help[27] ;
}
void
-cmdline_parser_print_version (void)
+imagetag_cmdline_print_version (void)
{
printf ("%s %s\n",
- (strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE),
- CMDLINE_PARSER_VERSION);
+ (strlen(IMAGETAG_CMDLINE_PACKAGE_NAME) ? IMAGETAG_CMDLINE_PACKAGE_NAME : IMAGETAG_CMDLINE_PACKAGE),
+ IMAGETAG_CMDLINE_VERSION);
}
static void print_help_common(void) {
- cmdline_parser_print_version ();
+ imagetag_cmdline_print_version ();
if (strlen(gengetopt_args_info_purpose) > 0)
printf("\n%s\n", gengetopt_args_info_purpose);
@@ -231,7 +235,7 @@ static void print_help_common(void) {
}
void
-cmdline_parser_print_help (void)
+imagetag_cmdline_print_help (void)
{
int i = 0;
print_help_common();
@@ -240,7 +244,7 @@ cmdline_parser_print_help (void)
}
void
-cmdline_parser_init (struct gengetopt_args_info *args_info)
+imagetag_cmdline_init (struct gengetopt_args_info *args_info)
{
clear_given (args_info);
clear_args (args_info);
@@ -248,7 +252,7 @@ cmdline_parser_init (struct gengetopt_args_info *args_info)
}
void
-cmdline_parser_params_init(struct cmdline_parser_params *params)
+imagetag_cmdline_params_init(struct imagetag_cmdline_params *params)
{
if (params)
{
@@ -260,12 +264,12 @@ cmdline_parser_params_init(struct cmdline_parser_params *params)
}
}
-struct cmdline_parser_params *
-cmdline_parser_params_create(void)
+struct imagetag_cmdline_params *
+imagetag_cmdline_params_create(void)
{
- struct cmdline_parser_params *params =
- (struct cmdline_parser_params *)malloc(sizeof(struct cmdline_parser_params));
- cmdline_parser_params_init(params);
+ struct imagetag_cmdline_params *params =
+ (struct imagetag_cmdline_params *)malloc(sizeof(struct imagetag_cmdline_params));
+ imagetag_cmdline_params_init(params);
return params;
}
@@ -281,7 +285,7 @@ free_string_field (char **s)
static void
-cmdline_parser_release (struct gengetopt_args_info *args_info)
+imagetag_cmdline_release (struct gengetopt_args_info *args_info)
{
free_string_field (&(args_info->kernel_arg));
@@ -390,13 +394,13 @@ write_into_file(FILE *outfile, const char *opt, const char *arg, const char *val
int
-cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info)
+imagetag_cmdline_dump(FILE *outfile, struct gengetopt_args_info *args_info)
{
int i = 0;
if (!outfile)
{
- fprintf (stderr, "%s: cannot dump options to stream\n", CMDLINE_PARSER_PACKAGE);
+ fprintf (stderr, "%s: cannot dump options to stream\n", IMAGETAG_CMDLINE_PACKAGE);
return EXIT_FAILURE;
}
@@ -445,15 +449,17 @@ cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info)
if (args_info->rsa_signature_given)
write_into_file(outfile, "rsa-signature", args_info->rsa_signature_orig, 0);
if (args_info->second_image_flag_given)
- write_into_file(outfile, "second-image-flag", args_info->second_image_flag_orig, cmdline_parser_second_image_flag_values);
+ write_into_file(outfile, "second-image-flag", args_info->second_image_flag_orig, imagetag_cmdline_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, "inactive", args_info->inactive_orig, imagetag_cmdline_inactive_values);
if (args_info->reserved2_given)
write_into_file(outfile, "reserved2", args_info->reserved2_orig, 0);
if (args_info->kernel_file_has_header_given)
write_into_file(outfile, "kernel-file-has-header", 0, 0 );
if (args_info->pad_given)
write_into_file(outfile, "pad", args_info->pad_orig, 0);
+ if (args_info->align_rootfs_given)
+ write_into_file(outfile, "align-rootfs", 0, 0 );
i = EXIT_SUCCESS;
@@ -461,7 +467,7 @@ cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info)
}
int
-cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_info)
+imagetag_cmdline_file_save(const char *filename, struct gengetopt_args_info *args_info)
{
FILE *outfile;
int i = 0;
@@ -470,20 +476,20 @@ cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_
if (!outfile)
{
- fprintf (stderr, "%s: cannot open file for writing: %s\n", CMDLINE_PARSER_PACKAGE, filename);
+ fprintf (stderr, "%s: cannot open file for writing: %s\n", IMAGETAG_CMDLINE_PACKAGE, filename);
return EXIT_FAILURE;
}
- i = cmdline_parser_dump(outfile, args_info);
+ i = imagetag_cmdline_dump(outfile, args_info);
fclose (outfile);
return i;
}
void
-cmdline_parser_free (struct gengetopt_args_info *args_info)
+imagetag_cmdline_free (struct gengetopt_args_info *args_info)
{
- cmdline_parser_release (args_info);
+ imagetag_cmdline_release (args_info);
}
/** @brief replacement of strdup, which is not standard */
@@ -502,21 +508,21 @@ gengetopt_strdup (const char *s)
}
int
-cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info)
+imagetag_cmdline (int argc, char **argv, struct gengetopt_args_info *args_info)
{
- return cmdline_parser2 (argc, argv, args_info, 0, 1, 1);
+ return imagetag_cmdline2 (argc, argv, args_info, 0, 1, 1);
}
int
-cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info,
- struct cmdline_parser_params *params)
+imagetag_cmdline_ext (int argc, char **argv, struct gengetopt_args_info *args_info,
+ struct imagetag_cmdline_params *params)
{
int result;
- result = cmdline_parser_internal (argc, argv, args_info, params, 0);
+ result = imagetag_cmdline_internal (argc, argv, args_info, params, 0);
if (result == EXIT_FAILURE)
{
- cmdline_parser_free (args_info);
+ imagetag_cmdline_free (args_info);
exit (EXIT_FAILURE);
}
@@ -524,10 +530,10 @@ cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info
}
int
-cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
+imagetag_cmdline2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
{
int result;
- struct cmdline_parser_params params;
+ struct imagetag_cmdline_params params;
params.override = override;
params.initialize = initialize;
@@ -535,11 +541,11 @@ cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, i
params.check_ambiguity = 0;
params.print_errors = 1;
- result = cmdline_parser_internal (argc, argv, args_info, &params, 0);
+ result = imagetag_cmdline_internal (argc, argv, args_info, &params, 0);
if (result == EXIT_FAILURE)
{
- cmdline_parser_free (args_info);
+ imagetag_cmdline_free (args_info);
exit (EXIT_FAILURE);
}
@@ -547,16 +553,16 @@ cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, i
}
int
-cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog_name)
+imagetag_cmdline_required (struct gengetopt_args_info *args_info, const char *prog_name)
{
int result = EXIT_SUCCESS;
- if (cmdline_parser_required2(args_info, prog_name, 0) > 0)
+ if (imagetag_cmdline_required2(args_info, prog_name, 0) > 0)
result = EXIT_FAILURE;
if (result == EXIT_FAILURE)
{
- cmdline_parser_free (args_info);
+ imagetag_cmdline_free (args_info);
exit (EXIT_FAILURE);
}
@@ -564,7 +570,7 @@ cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog
}
int
-cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error)
+imagetag_cmdline_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error)
{
int error = 0;
FIX_UNUSED (additional_error);
@@ -631,8 +637,8 @@ static char *package_name = 0;
* @param possible_values the possible values for this option (if specified)
* @param default_value the default value (in case the option only accepts fixed values)
* @param arg_type the type of this option
- * @param check_ambiguity @see cmdline_parser_params.check_ambiguity
- * @param override @see cmdline_parser_params.override
+ * @param check_ambiguity @see imagetag_cmdline_params.check_ambiguity
+ * @param override @see imagetag_cmdline_params.override
* @param no_free whether to free a possible previous value
* @param multiple_option whether this is a multiple option
* @param long_opt the corresponding long option
@@ -644,7 +650,7 @@ int update_arg(void *field, char **orig_field,
unsigned int *field_given, unsigned int *prev_given,
char *value, const char *possible_values[],
const char *default_value,
- cmdline_parser_arg_type arg_type,
+ imagetag_cmdline_arg_type arg_type,
int check_ambiguity, int override,
int no_free, int multiple_option,
const char *long_opt, char short_opt,
@@ -747,9 +753,9 @@ int update_arg(void *field, char **orig_field,
int
-cmdline_parser_internal (
+imagetag_cmdline_internal (
int argc, char **argv, struct gengetopt_args_info *args_info,
- struct cmdline_parser_params *params, const char *additional_error)
+ struct imagetag_cmdline_params *params, const char *additional_error)
{
int c; /* Character of the parsed option. */
@@ -769,9 +775,9 @@ cmdline_parser_internal (
check_ambiguity = params->check_ambiguity;
if (initialize)
- cmdline_parser_init (args_info);
+ imagetag_cmdline_init (args_info);
- cmdline_parser_init (&local_args_info);
+ imagetag_cmdline_init (&local_args_info);
optarg = 0;
optind = 0;
@@ -810,6 +816,7 @@ cmdline_parser_internal (
{ "reserved2", 1, NULL, 0 },
{ "kernel-file-has-header", 0, NULL, 0 },
{ "pad", 1, NULL, 'p' },
+ { "align-rootfs", 0, NULL, 0 },
{ 0, 0, 0, 0 }
};
@@ -820,13 +827,13 @@ cmdline_parser_internal (
switch (c)
{
case 'h': /* Print help and exit. */
- cmdline_parser_print_help ();
- cmdline_parser_free (&local_args_info);
+ imagetag_cmdline_print_help ();
+ imagetag_cmdline_free (&local_args_info);
exit (EXIT_SUCCESS);
case 'V': /* Print version and exit. */
- cmdline_parser_print_version ();
- cmdline_parser_free (&local_args_info);
+ imagetag_cmdline_print_version ();
+ imagetag_cmdline_free (&local_args_info);
exit (EXIT_SUCCESS);
case 'i': /* File with LZMA compressed kernel to include in the image.. */
@@ -1094,7 +1101,7 @@ cmdline_parser_internal (
if (update_arg( (void *)&(args_info->second_image_flag_arg),
&(args_info->second_image_flag_orig), &(args_info->second_image_flag_given),
- &(local_args_info.second_image_flag_given), optarg, cmdline_parser_second_image_flag_values, "2", ARG_STRING,
+ &(local_args_info.second_image_flag_given), optarg, imagetag_cmdline_second_image_flag_values, "2", ARG_STRING,
check_ambiguity, override, 0, 0,
"second-image-flag", '-',
additional_error))
@@ -1108,7 +1115,7 @@ cmdline_parser_internal (
if (update_arg( (void *)&(args_info->inactive_arg),
&(args_info->inactive_orig), &(args_info->inactive_given),
- &(local_args_info.inactive_given), optarg, cmdline_parser_inactive_values, "2", ARG_STRING,
+ &(local_args_info.inactive_given), optarg, imagetag_cmdline_inactive_values, "2", ARG_STRING,
check_ambiguity, override, 0, 0,
"inactive", '-',
additional_error))
@@ -1141,6 +1148,18 @@ cmdline_parser_internal (
goto failure;
}
+ /* Align the rootfs start to erase block size. */
+ else if (strcmp (long_options[option_index].name, "align-rootfs") == 0)
+ {
+
+
+ if (update_arg((void *)&(args_info->align_rootfs_flag), 0, &(args_info->align_rootfs_given),
+ &(local_args_info.align_rootfs_given), optarg, 0, 0, ARG_FLAG,
+ check_ambiguity, override, 1, 0, "align-rootfs", '-',
+ additional_error))
+ goto failure;
+
+ }
break;
case '?': /* Invalid option. */
@@ -1148,7 +1167,7 @@ cmdline_parser_internal (
goto failure;
default: /* bug: option not considered. */
- fprintf (stderr, "%s: option unknown: %c%s\n", CMDLINE_PARSER_PACKAGE, c, (additional_error ? additional_error : ""));
+ fprintf (stderr, "%s: option unknown: %c%s\n", IMAGETAG_CMDLINE_PACKAGE, c, (additional_error ? additional_error : ""));
abort ();
} /* switch */
} /* while */
@@ -1157,10 +1176,10 @@ cmdline_parser_internal (
if (check_required)
{
- error += cmdline_parser_required2 (args_info, argv[0], additional_error);
+ error += imagetag_cmdline_required2 (args_info, argv[0], additional_error);
}
- cmdline_parser_release (&local_args_info);
+ imagetag_cmdline_release (&local_args_info);
if ( error )
return (EXIT_FAILURE);
@@ -1169,6 +1188,6 @@ cmdline_parser_internal (
failure:
- cmdline_parser_release (&local_args_info);
+ imagetag_cmdline_release (&local_args_info);
return (EXIT_FAILURE);
}
diff --git a/tools/firmware-utils/src/imagetag_cmdline.h b/tools/firmware-utils/src/imagetag_cmdline.h
index a6fd389..3f55c50 100644
--- a/tools/firmware-utils/src/imagetag_cmdline.h
+++ b/tools/firmware-utils/src/imagetag_cmdline.h
@@ -1,6 +1,6 @@
/** @file imagetag_cmdline.h
* @brief The header file for the command line option parser
- * generated by GNU Gengetopt version 2.22.4
+ * generated by GNU Gengetopt version 2.22.5
* http://www.gnu.org/software/gengetopt.
* DO NOT modify this file, since it can be overwritten
* @author GNU Gengetopt by Lorenzo Bettini */
@@ -19,19 +19,19 @@
extern "C" {
#endif /* __cplusplus */
-#ifndef CMDLINE_PARSER_PACKAGE
+#ifndef IMAGETAG_CMDLINE_PACKAGE
/** @brief the program name (used for printing errors) */
-#define CMDLINE_PARSER_PACKAGE "imagetag"
+#define IMAGETAG_CMDLINE_PACKAGE "imagetag"
#endif
-#ifndef CMDLINE_PARSER_PACKAGE_NAME
+#ifndef IMAGETAG_CMDLINE_PACKAGE_NAME
/** @brief the complete program name (used for help and version) */
-#define CMDLINE_PARSER_PACKAGE_NAME "imagetag"
+#define IMAGETAG_CMDLINE_PACKAGE_NAME "imagetag"
#endif
-#ifndef CMDLINE_PARSER_VERSION
+#ifndef IMAGETAG_CMDLINE_VERSION
/** @brief the program version */
-#define CMDLINE_PARSER_VERSION "2.0.0"
+#define IMAGETAG_CMDLINE_VERSION "2.0.0"
#endif
/** @brief Where the command line options are stored */
@@ -112,6 +112,8 @@ struct gengetopt_args_info
int pad_arg; /**< @brief Pad the image to this size if smaller (in MiB). */
char * pad_orig; /**< @brief Pad the image to this size if smaller (in MiB) original value given at command line. */
const char *pad_help; /**< @brief Pad the image to this size if smaller (in MiB) help description. */
+ int align_rootfs_flag; /**< @brief Align the rootfs start to erase block size (default=off). */
+ const char *align_rootfs_help; /**< @brief Align the rootfs start to erase block size help description. */
unsigned int help_given ; /**< @brief Whether help was given. */
unsigned int version_given ; /**< @brief Whether version was given. */
@@ -140,11 +142,12 @@ struct gengetopt_args_info
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 pad_given ; /**< @brief Whether pad was given. */
+ unsigned int align_rootfs_given ; /**< @brief Whether align-rootfs was given. */
} ;
/** @brief The additional parameters to pass to parser functions */
-struct cmdline_parser_params
+struct imagetag_cmdline_params
{
int override; /**< @brief whether to override possibly already present options (default 0) */
int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */
@@ -167,7 +170,7 @@ extern const char *gengetopt_args_info_help[];
* @param args_info the structure where option information will be stored
* @return 0 if everything went fine, NON 0 if an error took place
*/
-int cmdline_parser (int argc, char **argv,
+int imagetag_cmdline (int argc, char **argv,
struct gengetopt_args_info *args_info);
/**
@@ -179,9 +182,9 @@ int cmdline_parser (int argc, char **argv,
* @param initialize whether to initialize the option structure my_args_info
* @param check_required whether to check that all required options were provided
* @return 0 if everything went fine, NON 0 if an error took place
- * @deprecated use cmdline_parser_ext() instead
+ * @deprecated use imagetag_cmdline_ext() instead
*/
-int cmdline_parser2 (int argc, char **argv,
+int imagetag_cmdline2 (int argc, char **argv,
struct gengetopt_args_info *args_info,
int override, int initialize, int check_required);
@@ -193,9 +196,9 @@ int cmdline_parser2 (int argc, char **argv,
* @param params additional parameters for the parser
* @return 0 if everything went fine, NON 0 if an error took place
*/
-int cmdline_parser_ext (int argc, char **argv,
+int imagetag_cmdline_ext (int argc, char **argv,
struct gengetopt_args_info *args_info,
- struct cmdline_parser_params *params);
+ struct imagetag_cmdline_params *params);
/**
* Save the contents of the option struct into an already open FILE stream.
@@ -203,7 +206,7 @@ int cmdline_parser_ext (int argc, char **argv,
* @param args_info the option struct to dump
* @return 0 if everything went fine, NON 0 if an error took place
*/
-int cmdline_parser_dump(FILE *outfile,
+int imagetag_cmdline_dump(FILE *outfile,
struct gengetopt_args_info *args_info);
/**
@@ -213,44 +216,44 @@ int cmdline_parser_dump(FILE *outfile,
* @param args_info the option struct to save
* @return 0 if everything went fine, NON 0 if an error took place
*/
-int cmdline_parser_file_save(const char *filename,
+int imagetag_cmdline_file_save(const char *filename,
struct gengetopt_args_info *args_info);
/**
* Print the help
*/
-void cmdline_parser_print_help(void);
+void imagetag_cmdline_print_help(void);
/**
* Print the version
*/
-void cmdline_parser_print_version(void);
+void imagetag_cmdline_print_version(void);
/**
- * Initializes all the fields a cmdline_parser_params structure
+ * Initializes all the fields a imagetag_cmdline_params structure
* to their default values
* @param params the structure to initialize
*/
-void cmdline_parser_params_init(struct cmdline_parser_params *params);
+void imagetag_cmdline_params_init(struct imagetag_cmdline_params *params);
/**
- * Allocates dynamically a cmdline_parser_params structure and initializes
+ * Allocates dynamically a imagetag_cmdline_params structure and initializes
* all its fields to their default values
- * @return the created and initialized cmdline_parser_params structure
+ * @return the created and initialized imagetag_cmdline_params structure
*/
-struct cmdline_parser_params *cmdline_parser_params_create(void);
+struct imagetag_cmdline_params *imagetag_cmdline_params_create(void);
/**
* Initializes the passed gengetopt_args_info structure's fields
* (also set default values for options that have a default)
* @param args_info the structure to initialize
*/
-void cmdline_parser_init (struct gengetopt_args_info *args_info);
+void imagetag_cmdline_init (struct gengetopt_args_info *args_info);
/**
* Deallocates the string fields of the gengetopt_args_info structure
* (but does not deallocate the structure itself)
* @param args_info the structure to deallocate
*/
-void cmdline_parser_free (struct gengetopt_args_info *args_info);
+void imagetag_cmdline_free (struct gengetopt_args_info *args_info);
/**
* Checks that all the required options were specified
@@ -259,11 +262,11 @@ void cmdline_parser_free (struct gengetopt_args_info *args_info);
* possible errors
* @return
*/
-int cmdline_parser_required (struct gengetopt_args_info *args_info,
+int imagetag_cmdline_required (struct gengetopt_args_info *args_info,
const char *prog_name);
-extern const char *cmdline_parser_second_image_flag_values[]; /**< @brief Possible values for second-image-flag. */
-extern const char *cmdline_parser_inactive_values[]; /**< @brief Possible values for inactive. */
+extern const char *imagetag_cmdline_second_image_flag_values[]; /**< @brief Possible values for second-image-flag. */
+extern const char *imagetag_cmdline_inactive_values[]; /**< @brief Possible values for inactive. */
#ifdef __cplusplus