]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
core: Extend poor man's config system to makefiles
authorJan Kiszka <jan.kiszka@siemens.com>
Thu, 25 Sep 2014 16:11:33 +0000 (18:11 +0200)
committerJan Kiszka <jan.kiszka@siemens.com>
Fri, 19 Dec 2014 08:57:47 +0000 (09:57 +0100)
Generate hypervisor/config.mk from the optional config.h the user may
leave in hypervisor/include/jailhouse. Only boolean switches of the form

    #define CONFIG_OPTION 1

are supported and will be translated to CONFIG_OPTION=y. Any other line
in config.h is ignored. The kernel's CONFIG variables a unset to remove
any collision possibilities. The architecture makefile can then include
the config.mk via

    include $(CONFIG_MK)

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
.gitignore
hypervisor/Makefile

index ad84359663a4cabc073b3c3add60080b13684c51..0e9f2d690e5c5cf0eb38dc177ef7de3895f04cd3 100644 (file)
@@ -8,6 +8,7 @@ Module.symvers
 modules.order
 jailhouse.ko
 hypervisor/include/jailhouse/config.h
+hypervisor/include/jailhouse/config.mk
 hypervisor/include/jailhouse/version.h
 hypervisor/hypervisor.lds
 tools/jailhouse
index 6c7d1160e84f7269e518a5715340a09cfd32bb0d..8a4a3572c7a6e6a04fa24f1832b3ad5d2262bb01 100644 (file)
@@ -32,11 +32,27 @@ endif
 
 CORE_OBJECTS = setup.o printk.o paging.o control.o lib.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/jailhouse/config.mk: Makefile FORCE
+       $(call filechk,config_mk)
+
 define filechk_version
        $(src)/../scripts/gen_version_h $(src)/..
 endef
 
-clean-files := $(obj)/include/jailhouse/version.h
+clean-files := $(obj)/include/jailhouse/config.mk \
+       $(obj)/include/jailhouse/version.h
 
 define sed-y
        "/^=>/{s:=>#\(.*\):/* \1 */:; \
@@ -81,8 +97,9 @@ $(foreach co,$(CORE_OBJECTS),\
 
 $(obj)/setup.o: $(obj)/include/jailhouse/version.h
 
-arch-builtin: $(obj)/$(defines-file) FORCE
-       $(Q)$(MAKE) $(build)=$(obj)/arch/$(SRCARCH)
+arch-builtin: $(obj)/$(defines-file) $(obj)/include/jailhouse/config.mk FORCE
+       $(Q)$(MAKE) $(build)=$(obj)/arch/$(SRCARCH) \
+               CONFIG_MK=$(obj)/include/jailhouse/config.mk
 
 always :=