summaryrefslogtreecommitdiffstats
path: root/hdata/test/hdata_to_dt.c
diff options
context:
space:
mode:
authorStewart Smith <stewart@linux.vnet.ibm.com>2017-02-10 13:12:51 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-02-16 15:22:30 +1100
commit2ca064df7da39ad5009b46e1ddeddabf8ff17a08 (patch)
tree8e5aadeb08d981517aca19c60f15e5eeb8e41074 /hdata/test/hdata_to_dt.c
parent0e386883f797ee6fd7023ba24329cb115014973b (diff)
downloadblackbird-skiboot-2ca064df7da39ad5009b46e1ddeddabf8ff17a08.tar.gz
blackbird-skiboot-2ca064df7da39ad5009b46e1ddeddabf8ff17a08.zip
hdata_to_dt: Only output dtb
convert test cases to diff DTS rather than DTB. This means we also have to build dtc on CentOS 7 to be able to run the test suite. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com> [oohall@gmail.com moved the test cases into seperate patches] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hdata/test/hdata_to_dt.c')
-rw-r--r--hdata/test/hdata_to_dt.c50
1 files changed, 16 insertions, 34 deletions
diff --git a/hdata/test/hdata_to_dt.c b/hdata/test/hdata_to_dt.c
index 113887ac..85733196 100644
--- a/hdata/test/hdata_to_dt.c
+++ b/hdata/test/hdata_to_dt.c
@@ -197,10 +197,9 @@ static void squash_blobs(struct dt_node *root)
squash_blobs(n);
}
-static void dump_hdata_fdt(struct dt_node *root, const char *filename)
+static void dump_hdata_fdt(struct dt_node *root)
{
void *fdt_blob;
- FILE *f;
fdt_blob = create_dtb(root, false);
@@ -209,15 +208,7 @@ static void dump_hdata_fdt(struct dt_node *root, const char *filename)
return;
}
- f = fopen(filename, "wb");
- if (!f) {
- fprintf(stderr, "Unable to open '%s' for writing\n", filename);
- free(fdt_blob);
- return;
- }
-
- fwrite(fdt_blob, fdt_totalsize(fdt_blob), 1, f);
- fclose(f);
+ fwrite(fdt_blob, fdt_totalsize(fdt_blob), 1, stdout);
free(fdt_blob);
}
@@ -225,23 +216,15 @@ static void dump_hdata_fdt(struct dt_node *root, const char *filename)
int main(int argc, char *argv[])
{
int fd, r, i = 0, opt_count = 0;
- bool verbose = false, quiet = false, tree_only = false;
- bool new_spira = false, blobs = false;
- const char *fdt_filename = NULL;
+ bool verbose = false, quiet = false, new_spira = false, blobs = false;
while (argv[++i]) {
- if (strcmp(argv[i], "-f") == 0) {
- fdt_filename = argv[++i];
- opt_count += 2;
- } else if (strcmp(argv[i], "-v") == 0) {
+ if (strcmp(argv[i], "-v") == 0) {
verbose = true;
opt_count++;
} else if (strcmp(argv[i], "-q") == 0) {
quiet = true;
opt_count++;
- } else if (strcmp(argv[i], "-t") == 0) {
- tree_only = true;
- opt_count++;
} else if (strcmp(argv[i], "-s") == 0) {
new_spira = true;
opt_count++;
@@ -254,15 +237,17 @@ int main(int argc, char *argv[])
argc -= opt_count;
argv += opt_count;
if (argc != 3) {
- errx(1, "Usage:\n"
- " hdata <opts> <spira-dump> <heap-dump>\n"
- " hdata <opts> -s <spirah-dump> <spiras-dump>\n"
- "Options: \n"
- " -v Verbose\n"
- " -q Quiet mode\n"
- " -t Print the DT nodes only, no properties\n"
- " -f <filename> File to write the FDT into\n"
- " -b Keep blobs in the output\n");
+ errx(1, "Converts HDAT dumps to DTB.\n"
+ "\n"
+ "Usage:\n"
+ " hdata <opts> <spira-dump> <heap-dump>\n"
+ " hdata <opts> -s <spirah-dump> <spiras-dump>\n"
+ "Options: \n"
+ " -v Verbose\n"
+ " -q Quiet mode\n"
+ " -b Keep blobs in the output\n"
+ "\n"
+ "Pipe to 'dtc -I dtb -O dts' for human readable\n");
}
/* Copy in spira dump (assumes little has changed!). */
@@ -334,10 +319,7 @@ int main(int argc, char *argv[])
squash_blobs(dt_root);
if (!quiet)
- dump_dt(dt_root, 0, !tree_only);
-
- if (fdt_filename)
- dump_hdata_fdt(dt_root, fdt_filename);
+ dump_hdata_fdt(dt_root);
dt_free(dt_root);
return 0;
OpenPOWER on IntegriCloud