From: Andreas Koelbl <
andreas...@st.oth-regensburg.de>
The Jailhouse configuration is currently hidden in
hypervisor/include/jailhouse/config.h, together with
config.mk.
config.mk is only needed for the kbuild system, and not an actual include.
config.h is a global jailhouse configuration that not only applies to
the hypervisor, but also to inmates.
As a consequence, move
config.mk and config.h to the project root directory.
.gitignore | 2 +-
FAQ.md | 2 +-
Kbuild | 21 +++++++++++++++++++--
ci/build-all-configs.sh | 2 +-
configs/Makefile | 4 ++--
hypervisor/Makefile | 26 ++++++--------------------
hypervisor/arch/arm/Makefile | 2 +-
inmates/Makefile | 4 ++--
inmates/lib/arm/Makefile.lib | 2 +-
9 files changed, 34 insertions(+), 31 deletions(-)
diff --git a/.gitignore b/.gitignore
index 87962f4..d4687da 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,7 +7,7 @@
Module.symvers
modules.order
driver/jailhouse.ko
-hypervisor/include/jailhouse/config.h
+config.h
hypervisor/hypervisor.lds
tools/jailhouse
tools/jailhouse-config-collect
diff --git a/FAQ.md b/FAQ.md
index 5d2cc05..005d9b1 100644
--- a/FAQ.md
+++ b/FAQ.md
@@ -58,7 +58,7 @@ a Linux machine to the other side of serial connection and use terminal emulator
like minicom to grab the log messages.
To enable error tracing, put ```#define CONFIG_TRACE_ERROR``` in file
-hypervisor/include/jailhouse/config.h before compiling.
+config.h before compiling.
Please note Jailhouse developers may ask you for these logs, shall you come for
help to jailhouse-dev mailing list, because they are extremely useful to analyze
diff --git a/Kbuild b/Kbuild
index 9013179..6fcc741 100644
--- a/Kbuild
+++ b/Kbuild
@@ -11,10 +11,27 @@
# the COPYING file in the top-level directory.
#
+define filechk_config_mk
+( \
+ echo "\$$(foreach config,\$$(filter CONFIG_%, \
+ \$$(.VARIABLES)), \$$(eval undefine \$$(config)))"; \
+ if [ -f $(src)/config.h ]; then \
+ sed -e "/^#define \([^[:space:]]*\)[[:space:]]*1/!d" \
+ -e "s/^#define \([^[:space:]]*\)[[:space:]]*1/\1=y/" \
+ $(src)/config.h; \
+ fi \
+)
+endef
+
subdir-y := driver hypervisor configs inmates
subdir-ccflags-y := -Werror
-# inmates build depends on generated
config.mk of the hypervisor,
+# inmates build depends on generated
config.mk,
# and the driver needs version.h from there
-$(obj)/inmates $(obj)/driver: $(obj)/hypervisor
+$(obj)/inmates $(obj)/driver: $(obj)/
config.mk $(obj)/hypervisor
+
+$(obj)/
config.mk: Makefile
+ $(call filechk,config_mk)
+
+.PHONY: $(obj)/
config.mk
diff --git a/ci/build-all-configs.sh b/ci/build-all-configs.sh
index cbcbb86..cc47215 100755
--- a/ci/build-all-configs.sh
+++ b/ci/build-all-configs.sh
@@ -30,7 +30,7 @@ for CONFIG in $CONFIGS; do
echo
echo "*** Building configuration $CONFIG ***"
- cp ci/jailhouse-config-$CONFIG.h hypervisor/include/jailhouse/config.h
+ cp ci/jailhouse-config-$CONFIG.h config.h
case $CONFIG in
x86)
diff --git a/configs/Makefile b/configs/Makefile
index 3e94199..f5fa0d9 100644
--- a/configs/Makefile
+++ b/configs/Makefile
@@ -14,8 +14,8 @@ LINUXINCLUDE := -I$(src)/../hypervisor/arch/$(SRCARCH)/include \
-I$(src)/../hypervisor/include
KBUILD_CFLAGS := -Wextra
-ifneq ($(wildcard $(obj)/../hypervisor/include/jailhouse/config.h),)
-KBUILD_CFLAGS += -include $(obj)/../hypervisor/include/jailhouse/config.h
+ifneq ($(wildcard $(obj)/../config.h),)
+KBUILD_CFLAGS += -include $(obj)/../config.h
endif
OBJCOPYFLAGS := -O binary
diff --git a/hypervisor/Makefile b/hypervisor/Makefile
index 0532e4e..e070abd 100644
--- a/hypervisor/Makefile
+++ b/hypervisor/Makefile
@@ -16,6 +16,8 @@
# Copyright (c) Linux kernel developers, 2014
#
+include $(src)/../
config.mk
+
LINUXINCLUDE := -I$(src)/arch/$(SRCARCH)/include -I$(src)/include
KBUILD_CFLAGS := -g -Os -Wall -Wstrict-prototypes -Wtype-limits \
-Wmissing-declarations -Wmissing-prototypes \
@@ -33,27 +35,12 @@ ifeq ($(SRCARCH),arm)
KBUILD_CFLAGS += -marm
endif
-ifneq ($(wildcard $(obj)/include/jailhouse/config.h),)
-KBUILD_CFLAGS += -include $(obj)/include/jailhouse/config.h
+ifneq ($(wildcard $(src)/../config.h),)
+KBUILD_CFLAGS += -include $(obj)/../config.h
endif
CORE_OBJECTS = setup.o printk.o paging.o control.o lib.o mmio.o
-define filechk_config_mk
-( \
- echo "\$$(foreach config,\$$(filter CONFIG_%, \
- \$$(.VARIABLES)), \$$(eval undefine \$$(config)))"; \
- if [ -f $(src)/include/jailhouse/config.h ]; then \
- sed -e "/^#define \([^[:space:]]*\)[[:space:]]*1/!d" \
- -e "s/^#define \([^[:space:]]*\)[[:space:]]*1/\1=y/" \
- $(src)/include/jailhouse/config.h; \
- fi \
-)
-endef
-
-$(obj)/include/generated/
config.mk: Makefile FORCE
- $(call filechk,config_mk)
-
define filechk_version
$(src)/../scripts/gen_version_h $(src)/..
endef
@@ -103,9 +90,8 @@ $(foreach co,$(CORE_OBJECTS),\
$(obj)/setup.o: $(obj)/include/generated/version.h
-arch-builtin: $(obj)/$(defines-file) $(obj)/include/generated/
config.mk FORCE
- $(Q)$(MAKE) $(build)=$(obj)/arch/$(SRCARCH) \
- CONFIG_MK=$(obj)/include/generated/
config.mk
+arch-builtin: $(obj)/$(defines-file) FORCE
+ $(Q)$(MAKE) $(build)=$(obj)/arch/$(SRCARCH)
always :=
diff --git a/hypervisor/arch/arm/Makefile b/hypervisor/arch/arm/Makefile
index 437b78d..5d06679 100644
--- a/hypervisor/arch/arm/Makefile
+++ b/hypervisor/arch/arm/Makefile
@@ -10,7 +10,7 @@
# the COPYING file in the top-level directory.
#
-include $(CONFIG_MK)
+include $(src)/../../../
config.mk
KBUILD_AFLAGS := $(subst -include asm/unified.h,,$(KBUILD_AFLAGS))
diff --git a/inmates/Makefile b/inmates/Makefile
index 0e8f258..7d3b1a8 100644
--- a/inmates/Makefile
+++ b/inmates/Makefile
@@ -23,8 +23,8 @@ KBUILD_CFLAGS := -g -Os -Wall -Wstrict-prototypes -Wtype-limits \
-Wmissing-declarations -Wmissing-prototypes \
-fno-strict-aliasing -fomit-frame-pointer -fno-pic \
-fno-common -fno-stack-protector $(INCLUDES)
-ifneq ($(wildcard $(src)/../hypervisor/include/jailhouse/config.h),)
-KBUILD_CFLAGS += -include $(src)/../hypervisor/include/jailhouse/config.h
+ifneq ($(wildcard $(src)/../config.h),)
+KBUILD_CFLAGS += -include $(src)/../config.h
endif
OBJCOPYFLAGS := -O binary
diff --git a/inmates/lib/arm/Makefile.lib b/inmates/lib/arm/Makefile.lib
index 9510ff8..67841cf 100644
--- a/inmates/lib/arm/Makefile.lib
+++ b/inmates/lib/arm/Makefile.lib
@@ -12,7 +12,7 @@
# the COPYING file in the top-level directory.
#
--include $(obj)/../../../hypervisor/include/generated/
config.mk
+-include $(obj)/../../../
config.mk
KBUILD_AFLAGS := $(filter-out -include asm/unified.h,$(KBUILD_AFLAGS))
--
2.10.0