tools: Add VERSION file to jailhouse tool dependencies

If the version changes, we want this information in the tool (via
CFLAGS).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
driver: Fix signedness in stats_show()

A variable that store hypercall result in stats_show() function
was incorrectly declared as unsigned, hence the error check always
succeeded.

Signed-off-by: Valentine Sinitsyn <valentine.sinitsyn@gmail.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
tooling: split Kbuild-related rules from the main Makefile

Split all parts of the main Makefile, that are only related to the
kernel build-system, into their own file (Kbuild). When invokes, this
file will be search first for additional rules by the kernel
build-system.

The remaining rules in our own root-Makefile will not be seen by the
kernel build-system anymore and thus are easier to extend.

Also, change some variable-names to fit those suggested by the
kernel-documentation (Documentation/kbuild/modules.txt).

Signed-off-by: Benjamin Block <bebl@mageta.org>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
tooling: add recursive tools-build and proper install-rules to the root Makefile

To build the jailhouse-tools, one has to make separate make-calls in
each their directory. This is fixed by adding simple recursive rules to
the root-Makefile. This also makes sure, that we always build both and
don't get incompatible versions during development.

This patch also adds proper install-rules to the root-Makefile. We added
them to our tools-Makefile, so we should also add them here. This only
concerns the hypervisor-image-file at the moment.

Signed-off-by: Benjamin Block <bebl@mageta.org>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
tooling: extracts common install-definitions into a central include

After adding install-rules to the tools- and root-Makefile we have some
redundancies in some variables and definitions (e.g.: $(INSTALL)). To fix
this, extract all duplications and general definitions concerning the
install-process into one central Makefile-include `install.mk`.

This also unifies the way directories are created for
installation-rules. Previously we would just create them every time
without checking if that is needed. Now we add them as prerequisite to
the install-rule and generate a rule for each of them in `install.mk`.
This way `make` will figure out if the need to be created. This also
lowers the verboseness of the Makefile.

Signed-off-by: Benjamin Block <bebl@mageta.org>
[Jan: moved install.mk to scripts folder]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
tooling: Remove explicit depmod invocation

Modern kernels do this for us.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
tooling: Respect DESTDIR for module installation

If unset, derive INSTALL_MOD_PATH from DESTDIR and export it so that the
module installation will use it.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
tooling: Install jailhouse binary under sbin

It is, in fact, a privileged program, at least now and in the
foreseeable future. So move it to sbin.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>