summaryrefslogtreecommitdiff
path: root/tests/Makefile.tests
Commit message (Collapse)AuthorAgeFilesLines
* libfdt: tests: add get_next_tag_invalid_prop_lenTadeusz Struk2022-10-121-1/+1
| | | | | | | | | | | Add a new test get_next_tag_invalid_prop_len, which covers fdt_next_tag(), when it is passed an corrupted blob, with invalid property len values. The test runs twice, on a blob in sw and finished state. Signed-off-by: Tadeusz Struk <tadeusz.struk@linaro.org> Message-Id: <20221011182611.116011-2-tadeusz.struk@linaro.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* Allow static building with makeTero Tervala2022-07-271-5/+7
| | | | | | | | | Set STATIC_BUILD=1 environment variable to enable static building when using makefiles. Signed-off-by: Tero Tervala <tero.tervala@unikie.com> Message-Id: <20220629163531.932281-1-tero.tervala@unikie.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* tests: add test cases for label-relative path referencesAhmad Fatoum2022-01-251-1/+1
| | | | | | Newly added &{label/path} feature doesn't yet have any tests. Add some. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
* libfdt: Check that the root-node name is emptySimon Glass2021-03-231-1/+1
| | | | | | | | | | | | | | | | The root node is supposed to have an empty name, but at present this is not checked. The behaviour of such a tree is not well defined. Most software rightly assumes that the root node is at offset 0 and does not check the name. This oddity was discovered as part of a security investigation into U-Boot verified boot. Add a check for this to fdt_check_full(). Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Arie Haenel <arie.haenel@intel.com> Reported-by: Julien Lenoir <julien.lenoir@intel.com> Message-Id: <20210323010410.3222701-2-sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Check that there is only one root nodeSimon Glass2021-03-231-1/+3
| | | | | | | | | | | | | | | At present it is possible to have two root nodes and even access nodes in the 'second' root. Such trees should not be considered valid. This was discovered as part of a security investigation into U-Boot verified boot. Add a check for this to fdt_check_full(). Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Arie Haenel <arie.haenel@intel.com> Reported-by: Julien Lenoir <julien.lenoir@intel.com> Message-Id: <20210323000926.3210733-1-sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* tests: Properly clean up .bak file from testsDavid Gibson2020-03-041-1/+1
| | | | | | | One of our testcases creates a .bak file from invoking sed. Fix that to be removed by make clean, and also ignore it in git to avoid clutter. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* tests: No need to explicitly pass $PYTHON from Make to run_tests.shDavid Gibson2020-03-041-3/+3
| | | | | | | Make automatically passes its variables through the environment, so we don't need to explicitly copy this one into the test script. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* dumptrees: pass outputdir as first argumentMarc-André Lureau2019-10-141-1/+1
| | | | | | | | | Instead of outputing files to current directory, allow to specificy an output directory. This helps with meson build system out-of-tree support. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20191009102025.10179-4-marcandre.lureau@redhat.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Ensure fdt_add_property frees allocated name string on failureNicholas Piggin2019-05-101-1/+1
| | | | | | | | | | | | | If fdt_add_property or fdt_property_placeholder fail after allocating a string for the name, they return without freeing that string. This does not change the structure of the tree, but in very specific cases it could lead to undesirable space consumption. Fix this by rolling back the string allocation in this situation. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Message-Id: <20190509094122.834-2-npiggin@gmail.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* Link tools and tests against libfdt shared libraryDavid Gibson2019-03-291-3/+3
| | | | | | | | | | | | | | | | Currently the libfdt based tools (fdtput, fdtget, etc.) and all the test binaries using libfdt are linked against the static version of libfdt. That's made it very easy in the past to forget to properly update the version.lds file which is needed to make functions publicaly accessible from the shared library. To avoid problems like that in future, alter the build so that we link and run the tests against the shared library version of libfdt. That immediately points out several important symbols that are still missing from the version.lds, so fix those as well. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: add fdt_append_addrrange()AKASHI Takahiro2019-03-291-0/+1
| | | | | | | | | | | | | This function will append an address range property using parent node's "#address-cells" and "#size-cells" properties. It will be used in implementing kdump with kexec_file_load system call at linux kernel for arm64 once it is merged into kernel tree. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Message-Id: <20190327061552.17170-2-takahiro.akashi@linaro.org> [dwg: Correct a SEGV error in the testcase] Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Add a test for fdt_getprop_by_offset()Simon Glass2018-11-241-1/+1
| | | | | | | This function does not have its own test at present. Add one. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* Refine make tests_clean targetDavid Gibson2018-11-231-4/+3
| | | | | | | Remove some redundancy, and also clean up *.test.dt.yaml files generated during the tests. Also add the latter to gitignore. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* pylibfdt: Allow switch to Python 3 via environment variable PYTHONLumir Balhar2018-11-231-3/+3
| | | | | | | | Python 2 is still the default but it can be changed by setting environment variable PYTHON before build/test. Signed-off-by: Lumir Balhar <lbalhar@redhat.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* tests: Don't lose errors from make checkmDavid Gibson2018-11-141-1/+1
| | | | | | | | | | For unclear reasons we had some code to copy a transcript of "make checkm" runs to a vglog.XXX file. It's not really clear why this was there, and it had the nasty side effect of discarding errors from run_tests.sh, meaning that an error on the valgrind run wouldn't show up clearly in Travis CI builds. Remove that logic so that we see errors more clearly. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* Make valgrind optionalDavid Gibson2018-09-101-0/+5
| | | | | | | | | | | | | Some platforms don't have valgrind support, and sometimes you simply might not want to use valgrind. But at present, dtc, or more specifically its testsuite, won't compile without valgrind because we use the valgrind client interface in some places to improve our testing and suppress false positives. This adds some Makefile detection to correctly handle the case where valgrind is not available. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* tests: Better testing of dtc -I fs modeDavid Gibson2018-09-101-1/+5
| | | | | | | | | | | | | | | | | | Greg Kurz added a trivial test of the -I fs mode recently, which was previously basically untested. This is an oversight, since we recently had a bug which completely broke it. This replaces Greg's test with a more thorough test of -I fs mode. We use a test helper to create the familiar test_tree1 in "fs" form, then use dtc -I fs to process it, and check that the results match what they should. We only check the content in -I fs -O dtb mode, since that's simplest, but we do run -I fs -O dts mode as well to make sure it doesn't blow up (the aforementioned bug caused just such a blow up, specific to -O dts mode, for example). Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: fdt_address_cells() and fdt_size_cells()Sebastian Huber2018-07-201-0/+1
| | | | | | | | Add internal fdt_cells() to avoid copy and paste. Test error cases and default values. Fix typo in fdt_size_cells() documentation comment. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Add fdt_check_full() functionDavid Gibson2018-06-071-1/+1
| | | | | | | | | | | | | This new function implements a complete and thorough check of an fdt blob's structure. Given a buffer containing an fdt, it should return 0 only if the fdt within is structurally sound in all regards. It doesn't check anything about the blob's contents (i.e. the actual values of the nodes and properties), of course. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Simon Glass <sjg@chromium.org>
* libfdt: Safer access to memory reservationsDavid Gibson2018-06-071-1/+1
| | | | | | | | | | | | | | | fdt_num_mem_rsv() and fdt_get_mem_rsv() currently don't sanity check their parameters, or the memory reserve section offset in the header. That means that on a corrupted blob they could access outside of the range of memory that they should. This improves their safety checking, meaning they shouldn't access outside the blob's bounds, even if its contents are badly corrupted. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Simon Glass <sjg@chromium.org>
* libfdt: Safer access to strings sectionDavid Gibson2018-06-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | fdt_string() is used to retrieve strings from a DT blob's strings section. It's rarely used directly, but is widely used internally. However, it doesn't do any bounds checking, which means in the case of a corrupted blob it could access bad memory, which libfdt is supposed to avoid. This write a safe alternative to fdt_string, fdt_get_string(). It checks both that the given offset is within the string section and that the string it points to is properly \0 terminated within the section. It also returns the string's length as a convenience (since it needs to determine to do the checks anyway). fdt_string() is rewritten in terms of fdt_get_string() for compatibility. Most of the diff here is actually testing infrastructure. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
* libfdt: Make fdt_check_header() more thoroughDavid Gibson2018-06-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Currently fdt_check_header() performs only some rudimentary checks, which is not really what the name suggests. This strengthens fdt_check_header() to check as much about the blob as is possible from the header alone: as well as checking the magic number and version, it checks that the total size is sane, and that all the sub-blocks within the blob lie within the total size. * This broadens the meaning of FDT_ERR_TRUNCATED to cover all sorts of improperly terminated blocks as well as just a structure block without FDT_END. * This makes fdt_check_header() only succeed on "complete" blobs, not in-progress sequential write blobs. The only reason this didn't fail before was that this function used to be called by many RO functions which are supposed to also work on incomplete SW blobs. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Simon Glass <sjg@chromium.org>
* libfdt: Improve sequential write state checkingDavid Gibson2018-06-071-1/+1
| | | | | | | | | | | | | | | | | | When creating a tree with the sequential write functions, certain things have to be done in a certain order. You must create the memory reserve map and only then can you create the actual tree structure. The -FDT_ERR_BADSTATE return code is for if you try to do things out of order. However, we weren't checking that very thoroughly, so it was possible to generate a corrupted blob if, for example, you started calling fdt_begin_node() etc. before calling fdt_finish_reservemap(). This makes the state checking more thorough disallow that. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Simon Glass <sjg@chromium.org>
* Makefile.tests: Add LIBDL make(1) variable for portability sakekevans@FreeBSD.org2018-01-041-1/+4
| | | | | | | | | | Some platforms (many, if not all, of the *BSD projects) do not provide a libdl, and instead provide the same functionality in libc. Instead of forcing these platforms to patch out the link against libdl, add a LIBDL make(1) variable to allow the -ldl argument to be excluded easily via make(1) arguments. Signed-off-by: Kyle Evans <kevans@FreeBSD.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* pylibfdt: Allow setup.py to operate stand-aloneSimon Glass2017-04-081-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | At present we require that setup.py is executed from the Makefile, which sets up various important things like the list of files to build and the version number. However many installation systems expect to be able to change to the directory containing setup.py and run it. This allows them to support (for example) building/installing for multiple Python versions, varying installation paths, particular C flags, etc. The problem in implementing this is that we don't want to duplicate the information in the Makefile. A common solution (so I am told) is to parse the Makefile to obtain the required information. Update the setup.py script to read a few Makefiles when it does not see the required information in its environment. This allows installation using: ./pylibfdt/setup.py install Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* tests: Add check_path testPantelis Antoniou2016-12-091-1/+2
| | | | | | | | | Add a test that checks for existence or not of a node. It is useful for testing the various cases when generating symbols and fixups for dynamic device tree objects. Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* tests: Add tests cases for the overlay codeMaxime Ripard2016-10-061-1/+2
| | | | | | | | | Add some test infrastructure to test that the overlay can be merged, but also that poorly formatted fixups would fail as expected. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> [dwg: Don't execute bad overlay tests without overlay aware dtc] Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Add iterator over propertiesMaxime Ripard2016-07-281-0/+1
| | | | | | | | | | | Implement a macro based on fdt_first_property_offset and fdt_next_property_offset that provides a convenience to iterate over all the properties of a given node. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Acked-by: Simon Glass <sjg@chromium.org> [dwg: Removed a stray trailing blank line] Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* fdt: Add a function to count stringsThierry Reding2015-09-301-0/+1
| | | | | | | | | | | | Given a device tree node and a property name, the fdt_stringlist_count() function counts the number of strings found in the property value. This also adds a new error code, FDT_ERR_BADVALUE, that the function returns when it encounters a non-NUL-terminated string list. Signed-off-by: Thierry Reding <treding@nvidia.com> [Changed testcase name --dwg] Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Add helpers to read #address-cells and #size-cellsDavid Gibson2014-05-121-0/+1
| | | | | | | | | | | This patch makes a small start on libfdt functions which actually help to parse the contents of device trees, rather than purely manipulating the tree's structure. We add simple helpers to read and sanity check the #address-cells and #size-cells values for a given node. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Add fdt_next_subnode() to permit easy subnode iterationSimon Glass2013-04-281-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Iterating through subnodes with libfdt is a little painful to write as we need something like this: for (depth = 0, count = 0, offset = fdt_next_node(fdt, parent_offset, &depth); (offset >= 0) && (depth > 0); offset = fdt_next_node(fdt, offset, &depth)) { if (depth == 1) { /* code body */ } } Using fdt_next_subnode() we can instead write this, which is shorter and easier to get right: for (offset = fdt_first_subnode(fdt, parent_offset); offset >= 0; offset = fdt_next_subnode(fdt, offset)) { /* code body */ } Also, it doesn't require two levels of indentation for the loop body. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: David Gibson <david@gibson.dropbear.id.au>
* dtc: cpp co-existence: allow names starting with # to be escapedStephen Warren2012-09-281-1/+1
| | | | | | | | | | | | | | | | | The device tree language as currently defined conflicts with the C pre- processor in one aspect - when a property or node name begins with a # character, a pre-processor would attempt to interpret it as a directive, fail, and most likely error out. This change allows a property/node name to be prefixed with \. This prevents a pre-processor from seeing # as the first non-whitespace character on the line, and hence prevents the conflict. \ was previously an illegal character in property/node names, so this change is backwards compatible. The \ is stripped from the name during parsing by dtc. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: David Gibson <david@gibson.dropbear.id.au>
* dtc: Basic integer expressionsStephen Warren2012-04-091-1/+2
| | | | | | | | | | | Written by David Gibson <david@gibson.dropbear.id.au>. Additions by me: * Ported to ToT dtc. * Renamed cell to integer throughout. * Implemented value range checks. * Allow U/L/UL/LL/ULL suffix on literals. * Enabled the commented test. Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
* Introduce ${TESTS_BIN} in Makefiles to identify tested executables.Jon Loeliger2012-01-211-3/+3
|
* libfdt: Activate testcase for appending propertiesDavid Gibson2012-01-111-0/+1
| | | | | | | | | | | Commit a31e3ef83bfce62d07695355e5f06cd4d0e44b86 introduced new libfdt functions to append to existing properties. It also included a test case for this, but neglected to update the Makefile and run_tests.sh script to actually build and execute this testcase. This patch corrects the oversight. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* dtc: Add support for variable sized elementsAnton Staaf2011-10-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Elements of size 8, 16, 32, and 64 bits are supported. The new /bits/ syntax was selected so as to not pollute the reserved keyword space with uint8/uint16/... type names. With this patch the following property assignment: property = /bits/ 16 <0x1234 0x5678 0x0 0xffff>; is equivalent to: property = <0x12345678 0x0000ffff>; It is now also possible to directly specify a 64 bit literal in a cell list, also known as an array using: property = /bits/ 64 <0xdeadbeef00000000>; It is an error to attempt to store a literal into an element that is too small to hold the literal, and the compiler will generate an error when it detects this. For instance: property = /bits/ 8 <256>; Will fail to compile. It is also an error to attempt to place a reference in a non 32-bit element. The documentation has been changed to reflect that the cell list is now an array of elements that can be of sizes other than the default 32-bit cell size. The sized_cells test tests the creation and access of 8, 16, 32, and 64-bit sized elements. It also tests that the creation of two properties, one with 16 bit elements and one with 32 bit elements result in the same property contents. Signed-off-by: Anton Staaf <robotboy@chromium.org> Acked-by: David Gibson <david@gibson.dropbear.id.au>
* Make testutils use utilfdtSimon Glass2011-09-221-2/+3
| | | | | | | | The load_blob() and save_blob() functions are very similar to the utilfdt versions. This removes the duplicated code. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: David Gibson <david@gibson.dropbear.id.au>
* Add fdt read/write utility functionsSimon Glass2011-09-221-2/+3
| | | | | | | | | | | | This adds higher-level libfdt operations for reading/writing an fdt blob from/to a file, as well as a function to decode a data type string as will be used by fdtget, fdtput. This also adds a few tests for the simple type argument supported by utilfdt_decode_type. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: David Gibson <david@gibson.dropbear.id.au>
* dtc: Support character literals in cell listsAnton Staaf2011-09-221-0/+1
| | | | | | | | | | | | | With this patch the following property assignment: property = <0x12345678 'a' '\r' 100>; is equivalent to: property = <0x12345678 0x00000061 0x0000000D 0x00000064> Signed-off-by: Anton Staaf <robotboy@chromium.org> Acked-by: David Gibson <david@gibson.dropbear.id.au>
* dtc: Extend and better test dtbs_equal utility programs (resend)David Gibson2010-04-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The dtbs_equal_ordered test program is used to implement a number of testcases. However, the test program itself has never been particularly well tested. In addition there are testcases coming in future for which it would be useful to have a corresponding "dtbs_equal_unordered" which checks for equality of device trees, not considering the internal ordering of elements. Finally, for some tests we may want it would be useful to check trees for equality with the PASS case being when they are *not* equal. This patch addresses all of the above. A dtbs_equal_unordered is added, and both it and the existing dtbs_equal_ordered program now take a -n option to make the PASS case be where the trees are not equal. A number of example trees with slight modifications from test_tree1 are used to verify that both these programs correctly identify when the tree is altered, and a dtb_reverse program is used to verify that the unordered version does not depend on internal ordering. These new testcases for the equality testing programs are split out into a new test group in run_tests.sh. dtbs_equal_unordered uses the new property iteration functions, and so this also acts as further testing for those functions. dtbs_equal_unordered will be useful for further testing the recently added tree-merging code and its upcoming extensions. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* Support ePAPR compliant phandle propertiesDavid Gibson2009-11-261-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the Linux kernel, libfdt and dtc, when using flattened device trees encode a node's phandle into a property named "linux,phandle". The ePAPR specification, however - aiming as it is to not be a Linux specific spec - requires that phandles be encoded in a property named simply "phandle". This patch adds support for this newer approach to dtc and libfdt. Specifically: - fdt_get_phandle() will now return the correct phandle if it is supplied in either of these properties - fdt_node_offset_by_phandle() will correctly find a node with the given phandle encoded in either property. - By default, when auto-generating phandles, dtc will encode it into both properties for maximum compatibility. A new -H option allows either only old-style or only new-style properties to be generated. - If phandle properties are explicitly supplied in the dts file, dtc will not auto-generate ones in the alternate format. - If both properties are supplied, dtc will check that they have the same value. - Some existing testcases are updated to use a mix of old and new-style phandles, partially testing the changes. - A new phandle_format test further tests the libfdt support, and the -H option. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* Fix dtc bugs for 64-bit compileDavid Gibson2009-11-111-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've just tested building dtc as an x86_64 binary on a 32-bit i386 host by using: make CC="gcc -m64" This patch fixes a handful of minor bugs thus discovered: * There is a printf() type mismatch on 64-bit in value-labels.c * For the tests which use libdl, we were using the GNU make feature where it will find libdl.so given a dependency in the form '-ldl'. But this built-in make logic doesn't know we're compiling 64-bit so finds the 32-bit version of the library. We avoid using this and instead explicitly pass -ldl to CC, which being the 64-bit version does know where to look. * To process dtc's asm output into .so files, run_tests.sh was directly invoking the (default instance of) the assembler and linker. Instead invoke these via the CC driver, and allow that to be overriden from the make environment. * The x86_64 assembler doesn't 0 fill with the .balign directive (presumably it is NOP filling). That doesn't produce strictly incorrect trees, but it is confusing and confounds are testcases which do byte-by-byte comparison of the trees produced by asm output with direct dtb output (which does 0 pad where necessary, of course). This patch uses the optional second argument to .balign to force gas to zero-fill instead. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* Fix bug in -Odts with properties containing multiple terminating nullsDavid Gibson2009-11-111-0/+1
| | | | | | | | | | When in -Odts mode, dtc will not produce correct output for string-like properties which have more than one \0 character at the end of the property's bytestring. In fact, it generates output which is not syntactically correct. This patch fixes the bug, and adds a testcase for future regressions here. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* dtc: Add testcases for labels within valuesDavid Gibson2009-02-031-1/+1
| | | | | | | This patch adds a testcase using asm output mode to check that labels within property values are correctly processed. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* dtc: Make asm output more portable and add testcasesDavid Gibson2009-02-031-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds some testcases for dtc's -Oasm mode. Specifically it checks that building the asm will result in the same device tree blob in memory as -Odtb mode would produce, for a variety of trees. This test uncovered two difficulties with our current -Oasm output, both of which are addressed in this patch as well. First, -Oasm output would only be correct if assembled for a big-endian target. Usually that would be the case, when building device trees into a firmware or similar. However this makes life inconvenient for testing on a little-endian target, and one can think up use cases where a program running on a little endian host might want to embed a device tree for a big-endian target. This patch therefore changes -Oasm output to use .byte directives instead of .long throughout in order to generate byte-for-byte identical trees regardless of the endianness of the assembler target. Second, -Oasm output emitted several #define statements which were then used in the innards of the output - i.e. it assumed the output would be processed by cpp before being assembled. That may not be convenient in all build environments, and in any case doesn't work well with the above fix. So, -Oasm output no longer needs to be preprocessed before assembling. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Introduce libfdt shared libraryJosh Boyer2009-01-021-2/+2
| | | | | | | Build a libfdt shared library in addition to the existing .a that is created. Symbol versioning is used from the libfdt/version.lds script. Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
* Rearrange ftdump and convert-dtsv0 into sub-Makefiles.Jon Loeliger2008-10-031-3/+2
| | | | | | | | | | | | Follows the model of the existing sub-Makefiles for dtc. Adjust $(BIN) definition to represent installable bin programs and use it as the list of installed programs rather than using an enumerated list in the install target. Adjust the tests/Makefile to clean up properly still. Signed-off-by: Jon Loeliger <jdl@freescale.com>
* libfdt: Add function to explicitly expand aliasesDavid Gibson2008-10-021-0/+1
| | | | | | | | | | Kumar has already added alias expansion to fdt_path_offset(). However, in some circumstances it may be convenient for the user of libfdt to explicitly get the string expansion of an alias. This patch adds a function to do this, fdt_get_alias(), and uses it to implement fdt_path_offset(). Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
* libfdt: Add support for using aliases in fdt_path_offset()Kumar Gala2008-08-141-1/+1
| | | | | | | | | If the path doesn't start with '/' check to see if it matches some alias under "/aliases" and substitute the matching alias value in the path and retry the lookup. Signed-off-by: Kumar Gala <galak@kernel.crashing.org> Acked-by: David Gibson <david@gibson.dropbear.id.au>
* dtc: Add support for binary includes.David Gibson2008-06-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Wed, Jun 04, 2008 at 09:26:23AM -0500, Jon Loeliger wrote: > David Gibson wrote: > >> But as I said that can be dealt with in the future without breaking >> compatibility. Objection withdrawn. >> > > And on that note, I officially implore Scott to > re-submit his binary include patch! Scott's original patch does still have some implementation details I didn't like. So in the interests of saving time, I've addressed some of those, added a testcase, and and now resubmitting my revised version of Scott's patch. dtc: Add support for binary includes. A property's data can be populated with a file's contents as follows: node { prop = /incbin/("path/to/data"); }; A subset of a file can be included by passing start and size parameters. For example, to include bytes 8 through 23: node { prop = /incbin/("path/to/data", 8, 16); }; As with /include/, non-absolute paths are looked for in the directory of the source file that includes them. Implementation revised, and a testcase added by David Gibson Signed-off-by: Scott Wood <scottwood@freescale.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Acked-by: Scott Wood <scottwood@freescale.com>