This patch makes a number of minor changes to the ftdump debugging
tool.
* There was an endian bug in one place, which this fixes.
* We now use const qualifiers in a number of places where we can
* ftdump can now be instructed to read from stdin by giving "-" as
the filename.
* The buffer into which the blob is read is increased from 16k to
64k, and is now dynamically allocated.
* ftdump now emits source in dts-v1 format
Since ftdump is little used these days, these fixes are arguably of
little use. On the other hand, I already did the work of making the
changes some time back, so I guess we might as well fold these small
fixes and improvements in.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Enabling -Wcast-qual warnings in dtc shows up a number of places where
we are incorrectly discarding a const qualification. There are also
some places where we are intentionally discarding the 'const', and we
need an ugly cast through uintptr_t to suppress the warning. However,
most of these are pretty well isolated with the *_w() functions. So
in the interests of maximum safety with const qualifications, this
patch enables the warnings and fixes the existing complaints.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This patch turns on the -Wpointer-arith option in the dtc Makefile,
and fixes the resulting warnings due to using (void *) in pointer
arithmetic. While convenient, pointer arithmetic on void * is not
portable, so it's better that we avoid it, particularly in libfdt.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Following on from the last patch, which made dtc use the same endian
conversion functions as libfdt, this patch makes ftdump use these
functions as well. This brings us down to a single set of endian
handling functions in all of dtc and libfdt, so just one place to fix
things.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Currently, when used in -Idtb mode, dtc will dump information about
the input blob's header fields to stderr. This is kind of ugly, and
can get in the way of dtc's real output.
This patch, therefore, removes this. So that there's still a way of
getting this information for debugging purposes, it places something
similar to the removed code into ftdump, replacing the couple of
header fields it currently prints with a complete header dump.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
In the dtc tree, both flat_dt.h and libfdt/fdt.h have structures and
constants relating to the flattened device tree format derived from
asm-powerpc/prom.h in the kernel. The former is used in dtc, the
latter in libfdt.
libfdt/fdt.h is the more recent, revised version, so use that
throughout, removing flat_dt.h.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This large patch removes all trailing whitespace from dtc (including
libfdt, the testsuite and documentation). It also removes a handful
of redundant blank lines (at the end of functions, or when there are
two blank lines together for no particular reason).
As well as anything else, this means that quilt won't whinge when I go
to convert the whole of libfdt into a patch to apply to the kernel.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
libfdt defined a new version of the flattened device tree format,
version 17. It is backwards compatible with version 16, just adding
an extra header field giving the size of the blob's structure blob.
This patch adds support to dtc allowing it to read and write version
17 blobs. It also makes version 17 the default output version for
blobs.
At the same time we change the code to consistently using decimal
numbers for versions. Previously we sometimes used 16 and sometimes
0x10 to refer to version 16.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>