arm/dt: Add dtb make rule

Add a make rule to compile dt blobs for ARM.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Acked-by: Shawn Guo <shawn.guo@freescale.com>
Tested-by: Jason Liu <jason.hui@linaro.org>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
ARM: 7021/1: Check for multiple load addresses before building a uImage

uImages need a load address specified. This makes them
incompatible with multiple zreladdrs. Catch this error
before building an uImage so that we do not end up with
broken uImages. The load address can still be specified
with LOADADDR= on the command line.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
ARM: 7152/1: distclean: Remove generated .dtb files

The patch 'arm/dt: Add dtb make rule' adds support to
create a .dtb file. But this is never removed afterwards.
Remove the generated .dtb file if 'distclean' is called.

Signed-off-by: Dirk Behme <dirk.behme@de.bosch.com>
Acked-by: Rob Herring <rob.herring@calxeda.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Cc: Shawn Guo <shawn.guo@freescale.com>
Cc: Jason Liu <jason.hui@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Kbuild: Use dtc's -d (dependency) option

This hooks dtc into Kbuild's dependency system.

Thus, for example, "make dtbs" will rebuild tegra-harmony.dtb if only
tegra20.dtsi has changed yet tegra-harmony.dts has not. The previous
lack of this feature recently caused me to have very confusing "git
bisect" results.

For ARM, it's obvious what to add to $(targets). I'm not familiar enough
with other architectures to know what to add there. Powerpc appears to
already add various .dtb files into $(targets), but the other archs may
need something added to $(targets) to work.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
[mmarek: Dropped arch/c6x part to avoid merging commits from the middle
of the merge window]
Signed-off-by: Michal Marek <mmarek@suse.cz>
dtc: Implement -d option to write out a dependency file

This will allow callers to rebuild .dtb files when any of the /include/d
.dtsi files are modified, not just the top-level .dts file.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Kbuild: centralize MKIMAGE and cmd_uimage definitions

All ARCHs have the same definition of MKIMAGE. Move it to Makefile.lib
to avoid duplication.

All ARCHs have similar definitions of cmd_uimage. Place a sufficiently
parameterized version in Makefile.lib to avoid duplication.

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
Acked-by: Nicolas Pitre <nico@linaro.org>
Tested-by: Mike Frysinger <vapier@gentoo.org> [Blackfin]
Tested-by: Michal Simek <monstr@monstr.eu> [Microblaze]
Tested-by: Guan Xuetao <gxt@mprc.pku.edu.cn> [unicore32]
Signed-off-by: Michal Marek <mmarek@suse.cz>
Sync all arch/arm/boot/dts/ from 3.12.rc3 NOT USED for now.
ARM: be really quiet when building with 'make -s'

Sometimes we want the kernel build process to only print messages
on errors, e.g. in automated build testing. This uses the "kecho"
macro that the build system provides to hide a few informational
messages. Nothing changes for a regular "make" or "make V=1".

Without this patch, building any ARM kernel results in:

  Kernel: arch/arm/boot/Image is ready
  Kernel: arch/arm/boot/zImage is ready

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Michal Marek <mmarek@suse.cz>
ARM: boot: Fix usage of kecho

Since commit edc88ceb0 (ARM: be really quiet when building with 'make -s') the
following output is generated when building a kernel for ARM:

echo '  Kernel: arch/arm/boot/Image is ready'
  Kernel: arch/arm/boot/Image is ready
  Building modules, stage 2.
echo '  Kernel: arch/arm/boot/zImage is ready'
  Kernel: arch/arm/boot/zImage is ready

As per Documentation/kbuild/makefiles.txt the correct way of using kecho is
'@$(kecho)'.

Make this change so no more unwanted 'echo' messages are displayed.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
3 commits for ARM BOOT.

https://github.com/torvalds/linux/commit/499cd8298628eeabf0eb5eb6525d4faa0eec80d8
https://github.com/torvalds/linux/commit/e50a622deaf6b1a7dd2b9fb60975dd1d5406db37
https://github.com/torvalds/linux/commit/387798b37c8dd0ae24c0ac12ba456dd76865bca3
arm: initial Xen support

- Basic hypervisor.h and interface.h definitions.
- Skeleton enlighten.c, set xen_start_info to an empty struct.
- Make xen_initial_domain dependent on the SIF_PRIVILIGED_BIT.

The new code only compiles when CONFIG_XEN is set, that is going to be
added to arch/arm/Kconfig in patch #11 "xen/arm: introduce CONFIG_XEN on
ARM".

Changes in v3:

- improve comments.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
ARM: 7656/1: uImage: Error out on build of multiplatform without LOADADDR

On multiplatform kernels, $MACHINE will be empty so there will be no
default LOADADDR. Fail to build the uImage target unless one is provided by the
developer at build time.

Signed-off-by: Olof Johansson <olof@lixom.net>
Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
ARM: dts: remove generated .dtb files on clean

commit 5f300acd8ae9f3d4585154370012ffc5c665330f
(ARM: 7152/1: distclean: Remove generated .dtb files)
ensured that dtbs were cleaned up when they were in
arch/arm/boot.
However, with the following commit:
commit 499cd8298628eeabf0eb5eb6525d4faa0eec80d8
(ARM: dt: change .dtb build rules to build in dts directory)

make clean now leaves dtbs in arch/arm/boot/dts/
untouched. Include dts directory so that clean-files rule
from arch/arm/boot/dts/Makefile is invoked when make
clean is done.

Cc: Dirk Behme <dirk.behme@de.bosch.com>
CC: Grant Likely <grant.likely@secretlab.ca>

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Olof Johansson <olof@lixom.net>
SYNC scripts/dtc/ and drivers/of/ (not used for now)
kbuild: prevent make from deleting _shipped files

commit 7373f4f (kbuild: add implicit rules for parser generation)
created a implicit rule chain (%.c: %.c_shipped: %.y).
Make considers the _shipped files to be intermediate files which
causes them to be deleted if they didn't exist before make was run.
Mark the _shipped files PRECIOUS to prevent make from deleting them.

Signed-off-by: Peter Foley <pefoley2@verizon.net>
Acked-by: Arnaud Lacombe <lacombar@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
kbuild: create a rule to run the pre-processor on *.dts files

Create cmd_dtc_cpp to run the C pre-processor on *.dts file before
passing them to dtc for final compilation. This allows the use of #define
and #include within the .dts file.

Acked-by: Simon Glass <sjg@chromium.org>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Acked-by: Michal Marek <mmarek@suse.cz>
Acked-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
kbuild: limit dtc+cpp include path

Device tree source files may now include header files. The intent is
that those header files define/name constants used as part of the DT
bindings. Currently this feature is open to abuse, since any kernel
header file at all can be included, This could allow device tree files
to become dependant on kernel headers files, and thus make them no
longer OS-independent. This would also prevent separating the device
tree source files from the kernel repository.

Solve this by limiting the cpp include path for device tree files to
separate directories.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
kbuild: create an "include chroot" for DT bindings

The recent dtc+cpp support allows header files and C pre-processor
defines/macros to be used when compiling device tree files. These
headers will typically define various constants that are part of the
device tree bindings.

The original patch which set up the dtc+cpp include path only considered
using those headers from device tree files. However, most are also
useful for kernel code which needs to interpret the device tree.

In both the DT files and the kernel, I'd like to include the DT-related
headers in the same way, for example, <dt-bindings/gpio/tegra-gpio.h>.
That will simplify any text which discusses the DT header locations.

Creating a <dt-bindings/> for kernel source to use is as simple as
placing files into include/dt-bindings/.

However, when compiling DT files, the include path should be restricted
so that only the dt-bindings path is available; arbitrary kernel headers
shouldn't be exposed. For this reason, create a specific include
directory for use by dtc+cpp, and symlink dt-bindings from there to the
actual location of include/dt-bindings/. For want of a better location,
place this "include chroot" into the existing dts/ directory.

arch/*/boot/dts/include/dt-bindings -> ../../../../../include/dt-bindings

Some headers used by device tree files may not be useful to the kernel;
they may be used simply to aid in constructing the DT file (e.g. macros
to create a node), but not define any information that the kernel needs
to share. These may be placed directly into arch/*/boot/dts/ along with
the DT files themselves.

Acked-by: Michal Marek <mmarek@suse.cz>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
kbuild: cmd_dtc_cpp: extract deps from both gcc -E and dtc

Prior to this change, when compiling *.dts to *.dtb, the dependency
output from dtc would be used, and when compiling *.dtsp to *.dtb, the
dependency output from gcc -E alone would be used, despite dtc also
being invoked (on a temporary file that was guaranteed to have no
dependencies).

With this change, when compiling *.dtsp to *.dtb, the dependency files
from both gcc -E and dtc are used. This will allow cmd_dtc_cpp to
replace cmd_dtc in a future change. In turn, that will allow the C pre-
processor to be run transparently on *.dts, without the need to a
separate rule or file extension to trigger it.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Rob Herring <rob.herring@calxeda.com>
kbuild: always run gcc -E on *.dts, remove cmd_dtc_cpp

Replace cmd_dtc with cmd_dtc_cpp, and delete the latter.

Previously, a special file extension (.dtsp) was required to trigger
the C pre-processor to run on device tree files. This was ugly. Now that
previous changes have enhanced cmd_dtc_cpp to collect dependency
information from both gcc -E and dtc, we can transparently run the pre-
processor on all device tree files, irrespective of whether they
use /include/ or #include syntax to include *.dtsi.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Rob Herring <rob.herring@calxeda.com>