mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-01-04 15:14:27 +00:00
HV: make: introduce targets for generating configs
This patch implements the following targets as an includable .mk to the make
system of the hypervisor.
make defconfig PLATFORM=xx:
force (re)generating the default configuration for xx
make oldconfig PLATFORM=xx:
generate a configuration for platform xx based on .config if available
make minimalconfig
save a minimized .config to defconfig
The default target (make all) will generate a default configuration if no
.config is available.
The values defined in .config are available in the toplevel Makefile after
kconfig/kconfig.mk is included.
v4 -> v5:
* Add minimalconfig for generating default configs.
v3 -> v4:
* No changes.
v2 -> v3:
* "make defconfig" now correctly overwrite an existing .config.
* Add short descriptions on where each target is supposed to be used.
v1 -> v2:
* Add proper dependency checks in the Makefile of hypervisor.
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
This commit is contained in:
48
hypervisor/scripts/kconfig/kconfig.mk
Normal file
48
hypervisor/scripts/kconfig/kconfig.mk
Normal file
@@ -0,0 +1,48 @@
|
||||
HV_CONFIG := .config
|
||||
HV_DEFCONFIG := defconfig
|
||||
HV_CONFIG_H := include/config.h
|
||||
HV_CONFIG_MK := include/config.mk
|
||||
|
||||
KCONFIG_DIR := $(BASEDIR)/../scripts/kconfig
|
||||
|
||||
$(eval $(call check_dep_exec,python))
|
||||
$(eval $(call check_dep_exec,pip))
|
||||
$(eval $(call check_dep_pylib,kconfiglib))
|
||||
|
||||
# This target invoke silentoldconfig to generate a .config only if a .config
|
||||
# does not exist. Useful as a dependency for source compilation.
|
||||
$(HV_OBJDIR)/$(HV_CONFIG):
|
||||
@mkdir -p $(HV_OBJDIR)
|
||||
@python $(KCONFIG_DIR)/silentoldconfig.py Kconfig $(HV_OBJDIR)/$(HV_CONFIG) PLATFORM_$(shell echo $(PLATFORM) | tr a-z A-Z)=y
|
||||
|
||||
$(HV_OBJDIR)/$(HV_CONFIG_MK): $(HV_OBJDIR)/$(HV_CONFIG)
|
||||
@mkdir -p $(dir $@)
|
||||
@cp $< $@
|
||||
|
||||
$(HV_OBJDIR)/$(HV_CONFIG_H): $(HV_OBJDIR)/$(HV_CONFIG)
|
||||
@mkdir -p $(dir $@)
|
||||
@python $(KCONFIG_DIR)/generate_header.py Kconfig $< $@
|
||||
|
||||
# This target forcefully generate a .config based on a given default
|
||||
# one. Overwrite the current .config if it exists.
|
||||
.PHONY: defconfig
|
||||
defconfig:
|
||||
@mkdir -p $(HV_OBJDIR)
|
||||
@python $(KCONFIG_DIR)/defconfig.py Kconfig arch/x86/configs/$(PLATFORM).config $(HV_OBJDIR)/$(HV_CONFIG)
|
||||
|
||||
# Use silentoldconfig to forcefully update the current .config, or generate a
|
||||
# new one if no previous .config exists. This target can be used as a
|
||||
# prerequisite of all the others to make sure that the .config is consistent
|
||||
# even it has been modified manually before.
|
||||
.PHONY: oldconfig
|
||||
oldconfig:
|
||||
@mkdir -p $(HV_OBJDIR)
|
||||
@python $(KCONFIG_DIR)/silentoldconfig.py Kconfig $(HV_OBJDIR)/$(HV_CONFIG) PLATFORM_$(shell echo $(PLATFORM) | tr a-z A-Z)=y
|
||||
|
||||
# Minimize the current .config. This target can be used to generate a defconfig
|
||||
# for future use.
|
||||
.PHONY: minimalconfig
|
||||
minimalconfig: $(HV_OBJDIR)/$(HV_CONFIG)
|
||||
@python $(KCONFIG_DIR)/minimalconfig.py Kconfig $(HV_OBJDIR)/$(HV_CONFIG) $(HV_OBJDIR)/$(HV_DEFCONFIG)
|
||||
|
||||
-include $(HV_OBJDIR)/$(HV_CONFIG_MK)
|
||||
Reference in New Issue
Block a user