aboutsummaryrefslogtreecommitdiff
path: root/dtc.c
AgeCommit message (Collapse)AuthorFilesLines
2007-12-04dtc: Add many const qualificationsDavid Gibson1-7/+7
This adds 'const' qualifiers to many variables and functions. In particular it's now used for passing names to the tree accesor functions. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-12-04dtc: Fix uninitialized use of structure_okDavid Gibson1-12/+1
My rework of the tree checking code introduced a potentially nasty bug - it uses the structure_ok variable uninitialized. This patch fixes the problem. It's a fairly ugly bandaid approach, but the ugly will disappear once future patches have folded the semantic checks into the new framework. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-12-04Add an option to pad the blob that is generatedKumar Gala1-1/+13
There are times when we need extra space in the blob and just want to have it added on w/o know the exact size to make it. The padding and min size options are mutually exclusive. Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
2007-11-26dtc: Flexible tree checking infrastructure (v2)David Gibson1-11/+1
dtc: Flexible tree checking infrastructure Here, at last, is a substantial start on revising dtc's infrastructure for checking the tree; this is the rework I've been saying was necessary practically since dtc was first release. In the new model, we have a table of "check" structures, each with a name, references to checking functions, and status variables. Each check can (in principle) be individually switched off or on (as either a warning or error). Checks have a list of prerequisites, so if checks need to rely on results from earlier checks to make sense (or even to avoid crashing) they just need to list the relevant other checks there. For now, only the "structural" checks and the fixups for phandle references are converted to the new mechanism. The rather more involved semantic checks (which is where this new mechanism will really be useful) will have to be converted in future patches. At present, there's no user interface for turning on/off the checks - the -f option now forces output even if "error" level checks fail. Again, future patches will be needed to add the fine-grained control, but that should be quite straightforward with the infrastructure implemented here. Also adds a testcase for the handling of bad references, which catches a bug encountered while developing this patch. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-11-20dtc: Add testcases for tree checksDavid Gibson1-1/+1
This patch adds a group of testcases to check that dtc correctly rejects trees with various structural errors. To make things easier to test, we change dtc so that failing checks (as opposed to other errors) result in exit code 2. This patch also fixes an embarrasing bug uncovered by these new tests: check_phandles() worked out if the tree's phandles were valid, then throws that information away and returns success always. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-10-22dtc: Disable semantic checks by defaultDavid Gibson1-7/+24
At present, dtc makes a lot of semantic checks on the device tree by default, and will refuse to produce output if they fail. This means people tend to need -f to force output despite failing semantic checks rather a lot. This patch splits the device tree checks into structural checks (no bad or duplicate names or phandles) and semantic checks (everything else). By default, only the structural checks are performed, and are fatal. -f will force output even with structural errors (using this in -Idts mode would essentially always be a bad idea, but it might be useful in -Idtb mode for examining a malformed dtb). Semantic checks are only performed if the new -c command line option is supplied, and are always warnings only. Semantic checks will never be performed on a tree with structural errors. This patch is only a stopgap before implementing proper fine-grained error/warning handling, but it should at least get rid of the far-too-frequent need for -f for the time being. This patch removes the -f from the dtc testcases now that it's no longer necessary. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-09-27dtc: Use libfdt/fdt.h instead of flat_dt.hDavid Gibson1-2/+2
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>
2007-09-18dtc: Whitespace cleanupDavid Gibson1-7/+7
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>
2007-08-31dtc: Optimise by default, fix warnings thus uncoveredDavid Gibson1-1/+1
This patch turns on optimisation in the Makefile by default. With the optimizer on, some uninitialized variable warnings (one real, two bogus) are now generated. This patch also squashes those again.
2007-07-07Add DTC release version information.Jon Loeliger1-1/+8
Adopted the version information and implementation from of the Linux Kernel Makefiles. Signed-off-by: Jon Loeliger <jdl@jdl.com>
2007-04-19Add -o <output file> to the usage message.Jerry Van Baren1-0/+1
Signed-off-by: Gerald Van Baren <vanbaren@cideas.com> Acked-by: David Gibson <david@gibson.dropbear.id.au>
2007-04-05Implement the -R option and add a -S option.Jerry Van Baren1-3/+16
Implement the -R <number> option to add memory reserve slots. Add a -S <size> option makes the blob at least this number of bytes. Signed-off-by: Gerald Van Baren <vanbaren@cideas.com>
2007-03-26DTC: Add support for a C-like #include "file" mechanism.Jon Loeliger1-17/+2
Keeps track of open files in a stack, and assigns a filenum to source positions for each lexical token. Modified error reporting to show source file as well. No policy on file directory basis has been decided. Still handles stdin. Tested on all arch/powerpc/boot/dts DTS files Signed-off-by: Jon Loeliger <jdl@freescale.com>
2007-03-19Improve options, #define default version.Jerry Van Baren1-5/+18
Add -h option for help Add -q quiet option to reduce or suppress the whining Create #define for the default version value. Signed-off-by: vanbaren@cideas.com <vanbaren@cideas.com>
2007-03-14Add support for flat device tree format version 17David Gibson1-1/+1
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>
2006-11-01Change default output blob version from 3 to 16Kim Phillips1-2/+2
Signed-off-by: Kim Phillips <Kim.Phillips@freescale.com> Signed-off-by: Jon Loeliger <jdl@freescale.com>
2006-06-07dtc: add setting of physical boot cpuMichael Neuling1-4/+10
dtc always sets the physical boot CPU to 0xfeedbeef. Add a -b option to set this. Also add warnings when using the wrong property with the wrong blob version. Signed-off-by: Michael Neuling <mikey@neuling.org>
2005-10-26Use names for output functions in the form dt_to_*() instead ofDavid Gibson1-3/+3
write_dt_*() for consistency with the dt_from_*() input functions.
2005-07-15Support for specifying memreserve ranges in the source format, based onDavid Gibson1-9/+9
a patch by Jon Loeliger <jdl AT freescale.com>, although tweaked substantially.
2005-06-08Initial commitDavid Gibson1-0/+198