projects
/
yaffs2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add endian feature to image maker and do some tidy up.
[yaffs2.git]
/
direct
/
test-framework
/
yaffs2_image_maker
/
yaffs2_image_maker.c
diff --git
a/direct/test-framework/yaffs2_image_maker/yaffs2_image_maker.c
b/direct/test-framework/yaffs2_image_maker/yaffs2_image_maker.c
index 8bdc1b67f81c8fc2f26628f7f5d6f0cc6a8eea17..08752c72b0d97e7279e263dd521ce5642eebfd31 100644
(file)
--- a/
direct/test-framework/yaffs2_image_maker/yaffs2_image_maker.c
+++ b/
direct/test-framework/yaffs2_image_maker/yaffs2_image_maker.c
@@
-32,6
+32,7
@@
#include "yaffs_nandsim_file.h"
#include "yaffs_guts.h"
#include "yaffs_nandsim_file.h"
#include "yaffs_guts.h"
+#include "yaffs_trace.h"
/*
/*
@@
-41,6
+42,7
@@
#define PAGE_SPARE_SIZE 64
#define PAGE_SIZE (PAGE_DATA_SIZE + PAGE_SPARE_SIZE)
#define PAGE_SPARE_SIZE 64
#define PAGE_SIZE (PAGE_DATA_SIZE + PAGE_SPARE_SIZE)
+
/* Some stub definitions to get building to work. */
int simulate_power_failure = 0;
int random_seed = 0;
/* Some stub definitions to get building to work. */
int simulate_power_failure = 0;
int random_seed = 0;
@@
-48,6
+50,7
@@
int random_seed = 0;
static char *input_dir;
static char *output_file;
static char *working_file;
static char *input_dir;
static char *output_file;
static char *working_file;
+static char endian = 'l';
static void usage(const char *prog_name)
{
static void usage(const char *prog_name)
{
@@
-55,6
+58,7
@@
static void usage(const char *prog_name)
printf("\t-i name input_directory\n");
printf("\t-o name output_file\n");
printf("\t-w name working_file\n");
printf("\t-i name input_directory\n");
printf("\t-o name output_file\n");
printf("\t-w name working_file\n");
+ printf("\t-b big endian output\n");
}
static void parse_args(int argc, char *argv[])
}
static void parse_args(int argc, char *argv[])
@@
-62,13
+66,14
@@
static void parse_args(int argc, char *argv[])
int c;
opterr = 0;
int c;
opterr = 0;
- while ((c = getopt(argc, argv, "i:o:w:h")) != -1) {
+ while ((c = getopt(argc, argv, "
b
i:o:w:h")) != -1) {
switch (c) {
default:
case 'h': usage(argv[0]); break;
case 'i': input_dir = strdup(optarg); break;
case 'o': output_file = strdup(optarg); break;
case 'w': working_file = strdup(optarg); break;
switch (c) {
default:
case 'h': usage(argv[0]); break;
case 'i': input_dir = strdup(optarg); break;
case 'o': output_file = strdup(optarg); break;
case 'w': working_file = strdup(optarg); break;
+ case 'b': endian = 'b'; break;
}
}
}
}
}
}
@@
-270,6
+275,8
@@
int main(int argc, char *argv[])
struct yaffs_dev * dev;
int ret;
struct yaffs_dev * dev;
int ret;
+ yaffs_trace_mask = 0;
+
parse_args(argc, argv);
if (!input_dir || !output_file || !working_file) {
parse_args(argc, argv);
if (!input_dir || !output_file || !working_file) {
@@
-277,6
+284,11
@@
int main(int argc, char *argv[])
exit(1);
}
exit(1);
}
+ printf("Generating image from %s into file %s using working file %s\n",
+ input_dir, output_file, working_file);
+ printf("Output file is in %s endian\n",
+ (endian == 'l') ? "little" : "big");
+
/*
* Create the Yaffs working file using the simulator.
*/
/*
* Create the Yaffs working file using the simulator.
*/
@@
-298,16
+310,21
@@
int main(int argc, char *argv[])
dev->param.skip_checkpt_rd = 1;
dev->param.skip_checkpt_wr = 1;
dev->param.skip_checkpt_rd = 1;
dev->param.skip_checkpt_wr = 1;
+ /*
+ * Set up stored endian: 1 = little endian, 2 = big endian.
+ */
+ dev->param.stored_endian = (endian == 'l') ? 1 : 2;
+
ret = yaffs_mount("yroot");
printf("yaffs_mount returned %d\n", ret);
ret = yaffs_mount("yroot");
printf("yaffs_mount returned %d\n", ret);
- printf("Generating image from %s into file %s using working file %s\n",
- input_dir, output_file, working_file);
process_directory(input_dir, "yroot");
yaffs_unmount("yroot");
process_directory(input_dir, "yroot");
yaffs_unmount("yroot");
+ printf("Generating output file\n");
+
ret = generate_output_file(working_file, output_file);
printf("wrote %d bytes to output\n", ret);
ret = generate_output_file(working_file, output_file);
printf("wrote %d bytes to output\n", ret);