Commit graph

2200 commits

Author SHA1 Message Date
Andre Przywara
24e7f511fd fdtdump: Fix signedness comparisons warnings
With -Wsign-compare, compilers warn about a mismatching signedness in
comparisons in fdtdump.c.

The "len" parameter to valid_header() refers to a memory size, not a
file offset, so the (unsigned) size_t is better fit, and fixes the
warning nicely.

In the main function we compare the difference between two pointers,
which produces a signed ptrdiff_t type. However the while loop above the
comparison makes sure that "p" always points before "endp" (by virtue of
the limit in the memchr() call). This means "endp - p" is never
negative, so we can safely cast this expression to an unsigned type.

This fixes "make fdtdump", when compiled with -Wsign-compare.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Message-Id: <20210611171040.25524-3-andre.przywara@arm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-06-15 12:35:54 +10:00
David Gibson
b6910bec11 Bump version to v1.6.1
A number of fixes have accumulated, so rolling up another release.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-06-08 17:00:49 +10:00
David Gibson
21d61d18f9 Fix CID 1461557
Coverity gets a bit confused by loading fdt_size_dt_strings() and
using it in a memmove().  In fact this is safe because the callers
have verified this information (via FDT_RW_PROBE() in fdt_pack() or
construction in fdt_open_into()).

Passing in strings_size like we already do struct_size seems to get
Coverity to follow what's going on here.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-06-08 16:32:59 +10:00
David Gibson
4c2ef8f4d1 checks: Introduce is_multiple_of()
In a number of places we check if one number is a multiple of another,
using a modulus.  In some of those cases the divisor is potentially zero,
which needs special handling or we could trigger a divide by zero.

Introduce an is_multiple_of() helper to safely handle this case, and use
it in a bunch of places.  This should close Coverity issue 1501687, maybe
others as well.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-06-08 15:17:11 +10:00
David Gibson
e59ca36fb7 Make handling of cpp line information more tolerant
At least some cpp implementations, in at least some circumstances place
multiple numbers after the file name when they put line number information
into the output.  We don't really care what the content of these is, but
we want the dtc lexer not to choke on this, so adjust the rule for handling
cpp line number information accordingly.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-06-08 14:15:25 +10:00
Rob Herring
0c3fd9b6ac checks: Drop interrupt_cells_is_cell check
With the prior commit, this check is now redundant.

Signed-off-by: Rob Herring <robh@kernel.org>
Message-Id: <20210526010335.860787-4-robh@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-06-08 11:58:43 +10:00
Rob Herring
6b3081abc4 checks: Add check_is_cell() for all phandle+arg properties
There's already a check for '#.*-cells' properties, so let's enable it for
all the ones we already know about.

Signed-off-by: Rob Herring <robh@kernel.org>
Message-Id: <20210526010335.860787-3-robh@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-06-08 11:57:04 +10:00
Rob Herring
2dffc192a7 yamltree: Remove marker ordering dependency
The check for phandle markers is fragile because the phandle marker must
be after a type marker. The only guarantee for markers is they are in
offset order. The order at a specific offset is undefined.

Rework yaml_propval_int() to get the full marker list, so it can find a
phandle marker no matter the ordering.

Signed-off-by: Rob Herring <robh@kernel.org>
Message-Id: <20210526010335.860787-2-robh@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-06-08 11:53:19 +10:00
Tom Rini
61e513439e pylibfdt: Rework "avoid unused variable warning" lines
Clang has -Wself-assign enabled by default under -Wall and so when
building with -Werror we would get an error here.  Inspired by Linux
kernel git commit a21151b9d81a ("tools/build: tweak unused value
workaround") make use of the fact that both Clang and GCC support
casting to `void` as the method to note that something is intentionally
unused.

Signed-off-by: Tom Rini <trini@konsulko.com>
Message-Id: <20210524154910.30523-1-trini@konsulko.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-05-25 13:27:00 +10:00
Ilya Lipnitskiy
c8bddd1060 tests: add a positive gpio test case
Ensure that properly named properties don't trigger warnings

Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
Message-Id: <20210504035944.8453-5-ilya.lipnitskiy@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-05-04 14:45:20 +10:00
Ilya Lipnitskiy
ad4abfadb6 checks: replace strstr and strrchr with strends
Makes the logic more clear

Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
Message-Id: <20210504035944.8453-4-ilya.lipnitskiy@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-05-04 14:45:20 +10:00
Ilya Lipnitskiy
09c6a6e887 dtc.h: add strends for suffix matching
Logic is similar to strcmp_suffix in <kernel>/drivers/of/property.c with
the exception that strends allows string length to equal suffix length.

Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
Message-Id: <20210504035944.8453-3-ilya.lipnitskiy@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-05-04 14:45:20 +10:00
Ilya Lipnitskiy
9bb9b8d0b4 checks: tigthen up nr-gpios prop exception
There are no instances of nr-gpio in the Linux kernel tree, only
"[<vendor>,]nr-gpios", so make the check stricter.

nr-gpios without a "vendor," prefix is also invalid, according to the DT
spec[0], and there are no DT files in the Linux kernel tree with
non-vendor nr-gpios. There are some drivers, but they are not DT spec
compliant, so don't suppress the check for them.

[0]:
Link: cb53a16a1e/schemas/gpio/gpio-consumer.yaml (L20)

Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
Cc: Rob Herring <robh+dt@kernel.org>
Message-Id: <20210504035944.8453-2-ilya.lipnitskiy@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-05-04 14:45:20 +10:00
Rob Herring
b07b62ee33 libfdt: Add FDT alignment check to fdt_check_header()
Only checking the FDT alignment in fdt_ro_probe_() means that
fdt_check_header() can pass, but then subsequent API calls fail on
alignment checks. Let's add an alignment check to fdt_check_header() so
alignment errors are found up front.

Cc: Tom Rini <trini@konsulko.com>
Cc: Frank Rowand <frowand.list@gmail.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Message-Id: <20210406190712.2118098-1-robh@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-04-07 12:44:19 +10:00
Simon Glass
a2def54799 libfdt: Check that the root-node name is empty
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>
2021-03-23 12:13:06 +11:00
Simon Glass
4ca61f84dc libfdt: Check that there is only one root node
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>
2021-03-23 11:56:34 +11:00
Masahiro Yamada
34d708249a dtc: Remove -O dtbo support
This partially reverts 163f0469bf ("dtc: Allow overlays to have
.dtbo extension").

I think accepting "dtbo" as --out-format is strange. This is not
shown by --help, at least.

*.dtb and *.dtbo should have the same format, "dtb".

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Message-Id: <20210311094956.924310-1-masahiroy@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-03-12 12:57:31 +11:00
David Gibson
8e7ff260f7 libfdt: Fix a possible "unchecked return value" warning
Apparently the unchecked return value of the first fdt_next_tag() call in
fdt_add_subnode_namelen() is tripping Coverity Scan in some circumstances,
although it appears not to for the scan on our project itself.

This fdt_next_tag() should always return FDT_BEGIN_NODE, since otherwise
the fdt_subnode_offset_namelen() above would have returned BADOFFSET or
BADSTRUCTURE.

Still, add a check to shut Coverity up, gated by a can_assume() to avoid
bloat in small builds.

Reported-by: Ryan Long <ryan.long@oarcorp.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-03-09 14:49:35 +11:00
Xin Li
a09335b8cf [automerger skipped] Mark ab/7061308 as merged in stage. am: 678be469e3 -s ours am: 79afc4ee63 -s ours
am skip reason: Change-Id If3911be0b4ebb872b1c0630013afc7627b484548 with SHA-1 35f4807790 is in history

Original change: undetermined

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ie994c4ac15380a58c209333ac08245eea8886183
2021-02-20 14:18:06 +00:00
Xin Li
79afc4ee63 [automerger skipped] Mark ab/7061308 as merged in stage. am: 678be469e3 -s ours
am skip reason: Change-Id If3911be0b4ebb872b1c0630013afc7627b484548 with SHA-1 35f4807790 is in history

Original change: undetermined

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I06d86f911605a87c268240c62d12008383527a05
2021-02-20 13:43:52 +00:00
Xin Li
678be469e3 Mark ab/7061308 as merged in stage.
Bug: 180401296
Merged-In: If3911be0b4ebb872b1c0630013afc7627b484548
Change-Id: Icae2afb484a5b94889ab4dd0f90035723513650f
2021-02-20 00:24:06 -08:00
Bob Badour
7e4b3dab65 [LSC] Add LOCAL_LICENSE_KINDS to external/dtc am: 88ad004dd5 am: cb833a423f am: fda2fad632
Original change: https://android-review.googlesource.com/c/platform/external/dtc/+/1588886

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I8c214c5b2997628f425f86562c7cb16ed6bf786d
2021-02-16 23:02:25 +00:00
Bob Badour
fda2fad632 [LSC] Add LOCAL_LICENSE_KINDS to external/dtc am: 88ad004dd5 am: cb833a423f
Original change: https://android-review.googlesource.com/c/platform/external/dtc/+/1588886

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I6fc0370457afc89fe12908f6bfef252a75e82b3b
2021-02-16 22:23:28 +00:00
Bob Badour
cb833a423f [LSC] Add LOCAL_LICENSE_KINDS to external/dtc am: 88ad004dd5
Original change: https://android-review.googlesource.com/c/platform/external/dtc/+/1588886

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I38aae77587517fcb62a8188813536b1f0259c2e8
2021-02-16 21:45:57 +00:00
Kumar Gala
88875268c0 checks: Warn on node-name and property name being the same
Treat a node-name and property name at the same level of tree as
a warning

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Message-Id: <20210210193912.799544-1-kumar.gala@linaro.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-02-15 17:17:36 +11:00
Bob Badour
88ad004dd5 [LSC] Add LOCAL_LICENSE_KINDS to external/dtc
Added SPDX-license-identifier-BSD SPDX-license-identifier-BSD-2-Clause to:
  libfdt/Android.bp

Added SPDX-license-identifier-BSD SPDX-license-identifier-BSD-2-Clause
    SPDX-license-identifier-GPL SPDX-license-identifier-GPL-2.0
    SPDX-license-identifier-ISC SPDX-license-identifier-LGPL
    SPDX-license-identifier-LGPL-2.1
to:
  Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: I77e096e006ed52d651da76a924f09da18696311c
2021-02-12 15:22:26 -08:00
Kumar Gala
9d2279e7e6 checks: Change node-name check to match devicetree spec
The devicetree spec limits the valid character set to:
  A-Z
  a-z
  0-9
  ,._+-

while property can additionally have '?#'.  Change the check to match
the spec.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Message-Id: <20210209184641.63052-1-kumar.gala@linaro.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-02-10 16:29:21 +11:00
Jonathan Gray
f527c867a8 util: limit gnu_printf format attribute to gcc >= 4.4.0
The gnu_printf format attribute was introduced in gcc 4.4.0
https://gcc.gnu.org/legacy-ml/gcc-help/2012-02/msg00225.html.

Use the printf format attribute on earlier versions of gcc and clang
(which claims to be gcc 4.2.1 in builtin defines) to fix the build with
gcc 4.2.1.

Fixes: 588a29f ("util: use gnu_printf format attribute")
Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Message-Id: <20210206100110.75228-1-jsg@jsg.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-02-07 14:22:39 +11:00
Viresh Kumar
183df9e9c2 gitignore: Ignore the swp files
Ignore the temporary .*.swp files.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Message-Id: <15496f8669ac2bb3b4b61a1a7c978947623cb7c3.1612346186.git.viresh.kumar@linaro.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-02-03 21:19:53 +11:00
Viresh Kumar
0db6d09584 gitignore: Add cscope files
Add cscope files in gitignore.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Message-Id: <3c39a6324ef2be64f839e6e6205f4afc63486216.1612338199.git.viresh.kumar@linaro.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-02-03 21:17:58 +11:00
David Gibson
307afa1a7b Update Jon Loeliger's email
At Jon's request update to a more current address.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-01-28 11:24:20 +11:00
David Gibson
ca16a723fa fdtdump: Fix gcc11 warning
In one place, fdtdump abuses fdt_set_magic(), passing it just a small char
array instead of the full fdt header it expects.  That's relying on the
fact that in fact fdt_set_magic() will only actually access the first 4
bytes of the buffer.

This trips a new warning in GCC 11 - and it's entirely possible it was
always UB.  So, don't do that.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-01-15 16:58:40 +11:00
Ignacy Kuchciński
64990a272e srcpos: increase MAX_SRCFILE_DEPTH
Some kernels require the MAX_SRCFILE_DEPTH to be bigger than 100, and
since it's just a sanity check to detect infinite recursion it shouldn't
hurt increasing it to 200.

Signed-off-by: Ignacy Kuchciński <ignacykuchcinski@gmail.com>
Message-Id: <CAJq_QG0BHBQYT4RnVi0QSxM_vFK2K-5k1eTpJnwZQtWbKnCBJA@mail.gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-01-13 12:05:26 +11:00
Viresh Kumar
163f0469bf dtc: Allow overlays to have .dtbo extension
Allow the overlays to have .dtbo extension instead of just .dtb. This
allows them to be identified easily by tools as well as humans.

Allow the dtbo outform in dtc.c for the same.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

Message-Id: <30fd0e5f2156665c713cf191c5fea9a5548360c0.1609926856.git.viresh.kumar@linaro.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-01-11 21:55:55 +11:00
Justin Covell
3b01518e68 Set last_comp_version correctly in new dtb and fix potential version issues in fdt_open_into
Changes in v3:
- Remove noop version sets
- Set version correctly on loaded fdt in fdt_open_into

Fixes: f1879e1a50 ("Add limited read-only support for older (V2 and V3) device tree to libfdt.")

Signed-off-by: Justin Covell <jujugoboom@gmail.com>

Message-Id: <20201229041749.2187-1-jujugoboom@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-01-04 12:26:37 +11:00
Paul Barker
f7e5737f26 tests: Fix overlay_overlay_nosugar test case
This test was accidentally skipped as the wrong test dts file was built.
The fragment numbering in this sugar-free test case needed adjusting to
match the numbering generated by dtc for overlay_overlay.dts.

Signed-off-by: Paul Barker <pbarker@konsulko.com>
Message-Id: <20201219143521.2118-1-pbarker@konsulko.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-12-22 20:45:42 +11:00
David Gibson
7cd5d5fe43 libfdt: Tweak description of assume-aligned load helpers
There's a small inaccuracy in the comment describing these new helpers.
This corrects it, and reformats while we're there.

Fixes: f98f28ab ("libfdt: Internally perform potentially unaligned loads")
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-12-16 16:52:17 +11:00
Tom Rini
a7c4040993 libfdt: Internally perform potentially unaligned loads
Commits 6dcb8ba4 "libfdt: Add helpers for accessing unaligned words"
introduced changes to support unaligned reads for ARM platforms and
11738cf01f "libfdt: Don't use memcpy to handle unaligned reads on ARM"
improved the performance of these helpers.

On further discussion, while there are potential cases where we could be
used on platforms that do not fixup unaligned reads for us, making this
choice the default is very expensive in terms of binary size and access
time.  To address this, introduce and use new fdt{32,64}_ld_ functions
that call fdt{32,64}_to_cpu() as was done prior to the above mentioned
commits.  Leave the existing load functions as unaligned-safe and
include comments in both cases.

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
Message-Id: <20201211022736.31657-1-trini@konsulko.com>
Tested-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-12-16 16:52:05 +11:00
Jiyong Park
e128a1078d add crosvm to com.android.virt am: 9591d1638e am: b01cc37bca am: 35f4807790
Original change: https://android-review.googlesource.com/c/platform/external/dtc/+/1526499

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ibd7197f735bc1f8ad75decbe4bc92a23c667f30a
2020-12-15 19:21:00 +00:00
Jiyong Park
35f4807790 add crosvm to com.android.virt am: 9591d1638e am: b01cc37bca
Original change: https://android-review.googlesource.com/c/platform/external/dtc/+/1526499

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If3911be0b4ebb872b1c0630013afc7627b484548
2020-12-15 19:03:58 +00:00
Jiyong Park
b01cc37bca add crosvm to com.android.virt am: 9591d1638e
Original change: https://android-review.googlesource.com/c/platform/external/dtc/+/1526499

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I25d3911c9e8bc39aa78639372d2653ff85e9a1dd
2020-12-15 18:30:31 +00:00
Jiyong Park
9591d1638e add crosvm to com.android.virt
To do so, crosvm and its dependencies have the apex_available property
set to "//apex_available:platform", "com.android.virt" to explicitly
acknowledge the joining.

Bug: 174639241
Test: m com.android.virt

Change-Id: I3e65cbf19ea47d2d20e31e5a8c034cfbc25d2d77
2020-12-14 15:53:03 +09:00
Marc-André Lureau
bab85e48a6 meson: increase default timeout for tests
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20201207130055.462734-4-marcandre.lureau@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-12-08 15:30:28 +11:00
Marc-André Lureau
f8b4609882 meson: do not assume python is installed, skip tests
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20201207130055.462734-3-marcandre.lureau@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-12-08 15:30:28 +11:00
Marc-André Lureau
30a56bce4f meson: fix -Wall warning
Meson already handles Wall via the built-in warning_level option.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20201207130055.462734-2-marcandre.lureau@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-12-08 15:30:28 +11:00
Tom Rini
5e735860c4 libfdt: Check for 8-byte address alignment in fdt_ro_probe_()
The device tree must be loaded in to memory at an 8-byte aligned
address.  Add a check for this condition in fdt_ro_probe_() and a new
error code to return if we are not.

Signed-off-by: Tom Rini <trini@konsulko.com>
Message-Id: <20201104130605.28874-1-trini@konsulko.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-11-24 16:41:45 +11:00
Xin Li
de3b7b2a43 Mark ab/6881855 as merged am: c1f40d69c8 am: 001eb070af
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/dtc/+/13112099

Change-Id: I71b5567f86f519ddda40254ddfd935a486e33d6c
2020-11-24 02:36:31 +00:00
Xin Li
001eb070af Mark ab/6881855 as merged am: c1f40d69c8
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/dtc/+/13112099

Change-Id: I56d2a71db89cfaba026efc7d98a07b08cf949dd3
2020-11-24 02:01:18 +00:00
Xin Li
c1f40d69c8 Mark ab/6881855 as merged
Bug: 172690556
Change-Id: Id03bb380a75333d3692acdba9ad1bf44c7e90776
2020-11-23 11:30:07 -08:00
Marc-André Lureau
67849a3279 build-sys: add meson build
The meson build system allows projects to "vendor" dtc easily, thanks to
subproject(). QEMU has recently switched to meson, and adding meson
support to dtc will help to handle the QEMU submodule.

meson rules are arguably simpler to write and maintain than
the hand-crafted/custom Makefile. meson support various backends, and
default build options (including coverage, sanitizer, debug/release
etc, see: https://mesonbuild.com/Builtin-options.html)

Compare to the Makefiles, the same build targets should be built and
installed and the same tests should be run ("meson test" can be provided
extra test arguments for running the equivalent of checkm/checkv).

There is no support EXTRAVERSION/LOCAL_VERSION/CONFIG_LOCALVERSION,
instead the version is simply set with project(), and vcs_tag() is
used for git/dirty version reporting (This is most common and is
hopefully enough. If necessary, configure-time options could be added
for extra versioning.).

libfdt shared library is build following regular naming conventions:
instead of libfdt.so.1 -> libfdt-1.6.0.so (with current build-sys),
libfdt.so.1 -> libfdt.so.1.6.0. I am not sure why the current build
system use an uncommon naming pattern. I also included a libfdt.pc
pkg-config file, as convenience.

Both Linux native build and mingw cross-build pass. CI pass. Tests are
only run on native build.

The current Makefiles are left in-tree, and make/check still work.
Eventually, the Makefiles could be marked as deprecated, to start a
transition period and avoid having to maintain 2 build systems in the
near future.

(run_tests.sh could eventually be replaced by the meson test runner,
which would have several advantages in term of flexibility/features,
but this is left for another day)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20201012073405.1682782-3-marcandre.lureau@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-10-21 14:36:07 +11:00