config_tools: remove obsolete kconfig files

Remove obsolete Kconfig files;
Update Kconfig related README and error message.

Tracked-On: #6315
Signed-off-by: Kunhui-Li <kunhuix.li@intel.com>
This commit is contained in:
Kunhui-Li 2021-08-05 16:17:29 +08:00 committed by wenlingz
parent 2dd9ec8612
commit 578c18b962
11 changed files with 2 additions and 808 deletions

View File

@ -1,3 +0,0 @@
mainmenu "ACRN Configuration"
source "arch/x86/Kconfig"

View File

@ -1,352 +0,0 @@
config SCENARIO
string "ACRN scenario"
default "industry"
help
By specifying SCENARIO name, ACRN will load corresponding VM configurations
to build the hypervisor. Currently ACRN provides four reference scenarios:
- industry: Typical scenario for industry usage with 8 VMs: one pre-launched SOS VM,
one post-launched KATA VM, one post-launched RT VM for real-time control,
and up to five post-launched Standard VMs;
- hybrid: Typical scenario for hybrid usage with 3 VMs: one pre-launched Safety VM,
one pre-launched Service VM and one post-launched Standard VM;
- hybrid_rt: Typical scenario for hybrid real-time usage with 4 VMs: one
pre-launched RTVM, one pre-launched Service VM and two post-launched Standard VMs;
- logical_partition: Typical scenario that run two isolated pre-launched VMs
Other values are possible if a corresponding scenario has been created
under 'misc/vm_configs/scenarios/' in the source code.
config MULTIBOOT2
bool "Multiboot2 support"
default y
help
Support boot ACRN from multiboot2 protocol. Multiboot2 support is needed for
some EFI platforms to get correct ACPI RSDP, it also could provide host efi
information for hypervisor.
choice
prompt "ACRN Scheduler"
default SCHED_BVT
help
Select the CPU scheduler to be used by the hypervisor
config SCHED_NOOP
bool "NOOP scheduler"
help
The NOOP (No-Operation) scheduler means there is a strict 1 to 1 mapping
between vCPUs and pCPUs.
config SCHED_IORR
bool "IORR scheduler"
help
IORR (IO sensitive Round Robin) scheduler supports multipule vCPUs running on
on one pCPU, and they will be scheduled by a IO sensitive round robin policy.
config SCHED_BVT
bool "BVT scheduler"
help
BVT (Borrowed Virtual time) is virtual time based scheduling algorithm, it
dispatching the runnable thread with the earliest effective virtual time.
TODO: BVT scheduler will be built on top of prioritized scheduling mechanism,
i.e. higher priority threads get scheduled first, and same priority tasks are
scheduled per BVT.
endchoice
config BOARD
string "Target board"
help
The target board this build runs on top of.
config DEFCONFIG_LIST
string
option defconfig_list
default "../misc/vm_configs/scenarios/$SCENARIO/$(BOARD)/$BOARD.config"
config RELEASE
bool "Release build"
default n
help
Whether to build a release version of the hypervisor. Logs, serial
console and hypervisor shell are available only in non-release
(i.e. debug) builds. Assertions are not effective in release builds.
config MAX_EMULATED_MMIO_REGIONS
int "Maximum number of emulated MMIO regions"
range 0 128
default 16
config MAX_PT_IRQ_ENTRIES
int "Maximum number of interrupt source for PT devices"
range 0 256
default 64
config STACK_SIZE
hex "Capacity of one stack, in bytes"
default 0x2000
help
The size of stacks used by physical cores. Each core uses one stack
for normal operations and another three for specific exceptions.
config LOG_BUF_SIZE
hex "Capacity of logbuf for each physical cpu"
default 0x40000
config LOG_DESTINATION
int "Bitmap of consoles where logs are printed"
range 0 7
default 7
help
A bitmap indicating the destinations of log messages. Currently there
are 3 destinations available. Bit 0 represents the serial console, bit
1 the SOS ACRN log and bit 2 NPK log. Effective only in debug builds.
choice
prompt "Serial IO type"
depends on !RELEASE
optional
help
If selected, this configures whether the physical serial port shall
be accessed via memory-mapped registers or I/O ports.
If this is not selected, the serial port is disabled. This is the
default.
config SERIAL_PCI
bool "PCI"
help
Select this if the serial port shall be accessed via PCI memory-mapped
registers.
config SERIAL_LEGACY
bool "Legacy"
help
Select this if the serial port shall be accessed via legacy port in/out
instructions.
config SERIAL_MMIO
bool "MMIO"
help
Select this if the serial port shall be accessed via MMIO registers.
endchoice
config SERIAL_PCI_BDF
hex "BDF of serial PCI device"
depends on SERIAL_PCI
default 0x00c2
help
BDF: bus, device and function of the serial PCI device. The BDF is packed
into a 16bit WORD with format (B:8, D:5, F:3). For an example,
PCI device ttyS2: 0:18.2.
config SERIAL_PIO_BASE
hex "Base address of serial PIO region"
depends on SERIAL_LEGACY
default 0x3f8
help
The base address of the serial ports. This is logically 16-bit but used
as a 64-bit integer.
config SERIAL_MMIO_BASE
hex "Base address of MMIO UART"
depends on SERIAL_MMIO
default 0xfe040000
help
The base address of the MMIO serial port.
config CONSOLE_LOGLEVEL_DEFAULT
int "Default loglevel on the serial console"
depends on !RELEASE
range 0 6
default 3
help
This indicates the maximum debug level of logs that will be available
on the the serial console. The higher the number, the more logs will
be available.
config MEM_LOGLEVEL_DEFAULT
int "Default loglevel in memory"
depends on !RELEASE
range 0 6
default 5
help
This indicates the maximum debug level of logs that will be available
in the logbuf in memory which can be accessed by ACRN log in SOS. The
higher the number, the more logs will be available.
config NPK_LOGLEVEL_DEFAULT
int "Default loglevel for the hypervisor NPK log"
depends on !RELEASE
range 0 6
default 5
help
This indicates the maximum debug level of logs that will be available
via NPK log. The higher the number, the more logs will be available.
config LOW_RAM_SIZE
hex "Size of the low RAM region"
range 0 0x10000
default 0x00010000
help
A 32-bit integer indicating the size of RAM region below address
0x10000, starting from address 0x0.
config HV_RAM_START
hex "2M-aligned Start physical address of the RAM region used by the hypervisor"
range 0x200000 0x80000000
default 0x10000000
help
A 64-bit integer indicating the base physical address where the
hypervisor should be loaded. If RELOC is disabled, the bootloader
is required to load the hypervisor to this specific address.
Otherwise the hypervisor will not boot. With RELOC enabled the
address will be referred as the lowest possible address that hypervisor be loaded,
hypervisor may relocate its symbols to where it is placed,
and thus the bootloader might not place the hypervisor at this
specific address.
Note that the addr demands 2M aligned, otherwise memory corruption
may occur.
config HV_RAM_SIZE
hex "Size of the RAM region used by the hypervisor"
range 0x800000 0x4000000
default 0x800000
help
A 64-bit integer indicating the size of RAM used by the hypervisor.
It is ensured at link time that the footprint of the hypervisor
does not exceed this size.
config PLATFORM_RAM_SIZE
hex "Size of the physical platform RAM"
range 0x100000000 0x4000000000
default 0x400000000
help
A 64-bit integer indicating the size of the physical platform RAM
(MMIO not included).
config ACPI_PARSE_ENABLED
bool "Enable ACPI runtime parsing"
default y
help
Platform specific ACPI info may be retrieved thru boot-time parse
of ACPI table, or thru parse of off-line tool. This option enables
the boot-time parse of ACPI table, and overwrite the information
from off-line tool.
config HYPERV_ENABLED
bool "Enable Hyper-V enlightenment"
default y
help
When set, the minimum set of TLFS functionality together with some
performance enlightenments are enabled.
config RDT_ENABLED
bool "Enable RDT (Resource Director Technology)"
default n
help
When set in platforms that support RDT, hypervisor can allocate
various amount of HW resources such as L2 or/and L3 to VMs to achieve
different Class of Service (COS, or CLOS).
config CDP_ENABLED
bool "Enable CDP (Code and Data Prioritization)"
depends on RDT_ENABLED
default n
help
CDP is an extension of CAT. It enables isolation and separate
prioritization of code and data fetches to the L2 or L3 cache in a
software configurable manner, depending on hardware support.
config SSRAM_ENABLED
bool "Enable Software SRAM support"
depends on !CDP_ENABLED
default n
help
This will enable RTVM to make use of Software SRAM to improve the performance
of Real-Time applications. Software SRAM essentially a block of cache, and is separated via
CAT and protected by some methods. Software SRAM support and CDP support cannot co-exist.
config GPU_SBDF
hex "Segment, Bus, Device, and function of the GPU"
depends on ACPI_PARSE_ENABLED
default 0x00000010
help
A 32-bit integer encoding the segment, bus, device and function of the
GPU. This integer consists of a 16-bit segment ID, 8-bit bus ID, 5-bit
device ID and 3-bit function ID. As an example, for PCI device at
00:02.0 in DRHD segment 0, this SBDF would be (0 << 16) | (0 << 8) |
(2 << 3) | (0 << 0), i.e. 0x00000010.
config RELOC
bool "Enable hypervisor relocation"
default y
help
When selected, the hypervisor will relocate itself to where it is
loaded. This allows the bootloader to put the hypervisor image to
wherever appropriate. Without relocation the bootloader must put the
image to RAM_START, otherwise the hypervisor will not start up.
config MAX_IOAPIC_NUM
int "Maximum number of IO-APICs"
range 1 10
default 1
config MAX_IOAPIC_LINES
int "Maximum number of interrupt lines per IOAPIC"
range 1 120
default 120
config MAX_IR_ENTRIES
int "Maximum number of Interrupt Remapping Entries"
range 256 512
default 256
help
Minimum value is 256. Value must be 2^n.
config IOMMU_BUS_NUM
hex "Highest PCI bus ID used during IOMMU initialization"
default 0x100
help
Any BDF with a bus ID smaller than this number is mapped to
the IOMMU domain of the first VM.
config MAX_PCI_DEV_NUM
int "Maximum number of PCI devices"
range 1 1024
default 96
config MAX_MSIX_TABLE_NUM
int "Maximum number of MSI-X tables per device"
range 1 2048
default 64
config L1D_FLUSH_VMENTRY_ENABLED
bool "Enable L1 cache flush before VM entry"
default n
config MCE_ON_PSC_WORKAROUND_DISABLED
bool "Force to disable software workaround for Machine Check Error on Page Size Change"
default n
help
By default, software workaround for Machine Check Error on Page Size Change is
conditionally applied to the models that may be affected by the issue. However,
the software workaround has negative impact on performance. If all the guest OS
kernels are trusted, this option may be set for performance.
config ENFORCE_TURNOFF_AC
bool "Force to disable #AC for Split-locked Access"
default n
help
If CPU has #AC for split-locked access, HV enable it and VMs can't disable.
Set this to enforce turn off that #AC, for community developer only.
config IVSHMEM_ENABLED
bool "Enable ivshmem inter-vm communication based on hypervisor shared memory"
default n
help
Ivshmem shared memory is located in the hypervisor, it can provide multiple
memory regions as communication channels between pre-launched or post-launched
VMs.

View File

@ -19,16 +19,6 @@ ifeq ($(CONFIG_XML_ENABLED),)
endif
ifeq ($(CONFIG_XML_ENABLED),true)
ifneq ($(BOARD_IN_KCONFIG),)
ifneq ($(BOARD_IN_XML),$(BOARD_IN_KCONFIG))
$(error BOARD $(BOARD_IN_XML) in $(BOARD_FILE) does not match BOARD $(BOARD_IN_KCONFIG) in $(KCONFIG_FILE))
endif
endif
ifneq ($(SCENARIO_IN_KCONFIG),)
ifneq ($(SCENARIO_IN_XML),$(SCENARIO_IN_KCONFIG))
$(error SCENARIO $(SCENARIO_IN_XML) in $(SCENARIO_FILE) does not match SCENARIO $(SCENARIO_IN_KCONFIG) in $(KCONFIG_FILE))
endif
endif
override BOARD := $(BOARD_IN_XML)
override SCENARIO := $(SCENARIO_IN_XML)
RELEASE_IN_XML := $(shell echo `sed -n '/<RELEASE/p' $(SCENARIO_FILE) | sed -r 's/.*<RELEASE(.*)>(.*)<(.*)/\2/g'`)

View File

@ -1,114 +0,0 @@
# usage: override_config <symbol> <default>
#
# Given a configuration symbol (without the CONFIG_ prefix), this macro
# overrides its value as follows.
# 1. If a value is specified from command line, that value is used.
# 2. If neither config.mk nor the command line specifies a value, the given
# default is used.
define override_config =
ifdef $(1)
CONFIG_$(1) := $($(1))
else ifndef CONFIG_$(1)
CONFIG_$(1) := $(2)
endif
endef
HV_CONFIG := .config
HV_DEFCONFIG := defconfig
HV_CONFIG_H := include/config.h
HV_CONFIG_MK := include/config.mk
KCONFIG_DIR := $(BASEDIR)/../misc/config_tools/kconfig
# Backward-compatibility for RELEASE=(0|1)
ifdef RELEASE
ifeq ($(RELEASE),1)
override RELEASE := y
else
override RELEASE := n
endif
endif
-include $(HV_OBJDIR)/$(HV_CONFIG_MK)
ifeq ($(shell [ $(HV_OBJDIR)/$(HV_CONFIG) -nt $(HV_OBJDIR)/$(HV_CONFIG_MK) ] && echo 1),1)
# config.mk may be outdated if .config has been overwritten. To update config.mk
# in such cases, we include .config again to get the new configurations. This
# only happens when GNU make checks the prerequisites.
-include $(HV_OBJDIR)/$(HV_CONFIG)
endif
$(eval $(call override_config,BOARD,nuc7i7dnb))
$(eval $(call override_config,SCENARIO,industry))
$(eval $(call override_config,RELEASE,y))
override RELEASE := $(CONFIG_RELEASE)
$(eval $(call check_dep_exec,python3,KCONFIG_DEPS))
$(eval $(call check_dep_py3lib,kconfiglib,KCONFIG_DEPS))
# This target invoke silentoldconfig to generate or update a .config. Useful as
# a prerequisite of other targets depending on .config.
#
# A dummy command is necessary to trigger the remaking of config.mk right after
# oldconfig changes HV_CONFIG in the same execution of make.
$(HV_OBJDIR)/$(HV_CONFIG): update_config oldconfig
@true
# Note: This target must not depend on a phony target (e.g. oldconfig) because
# it'll trigger endless re-execution of make.
$(HV_OBJDIR)/$(HV_CONFIG_MK): $(HV_OBJDIR)/$(HV_CONFIG)
@mkdir -p $(dir $@)
@sed 's/="\(.*\)"$$/=\1/g' $(HV_OBJDIR)/$(HV_CONFIG) > $@
$(HV_OBJDIR)/$(HV_CONFIG_H): $(HV_OBJDIR)/$(HV_CONFIG)
@mkdir -p $(dir $@)
@python3 $(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: $(KCONFIG_DEPS)
@mkdir -p $(HV_OBJDIR)
@if ([ "$(KCONFIG_FILE)" = "" ] || ([ "$(KCONFIG_FILE)" != "" ] && [ ! -f $(KCONFIG_FILE) ])) && [ "$(CONFIG_XML_ENABLED)" != "true" ]; then \
BOARD=$(CONFIG_BOARD) SCENARIO=$(CONFIG_SCENARIO) \
python3 $(KCONFIG_DIR)/defconfig.py Kconfig $(HV_OBJDIR)/$(HV_CONFIG); \
else \
if [ "$(KCONFIG_FILE)" != "" ] && [ -f $(KCONFIG_FILE) ]; then \
echo "Writing $(HV_OBJDIR)/$(HV_CONFIG) with $(KCONFIG_FILE)"; \
cp $(KCONFIG_FILE) $(HV_OBJDIR)/$(HV_CONFIG); \
elif [ "$(TARGET_DIR)" != "" ] && [ -d $(TARGET_DIR) ]; then \
if [ ! -f $(TARGET_DIR)/scenarios/$(SCENARIO)/$(BOARD)/$(BOARD).config ]; then \
echo "Board defconfig file $(BOARD).config is not found under $(TARGET_DIR)/scenarios/$(SCENARIO)/$(BOARD)/."; exit 1; \
fi; \
echo "Writing $(HV_OBJDIR)/$(HV_CONFIG) with $(BOARD_CFG_DIR)/$(BOARD).config"; \
cp $(TARGET_DIR)/scenarios/$(SCENARIO)/$(BOARD)/$(BOARD).config $(HV_OBJDIR)/$(HV_CONFIG); \
fi; \
BOARD=$(CONFIG_BOARD) SCENARIO=$(CONFIG_SCENARIO) \
python3 $(KCONFIG_DIR)/silentoldconfig.py Kconfig $(HV_OBJDIR)/$(HV_CONFIG) RELEASE=$(RELEASE); \
fi
# 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: $(KCONFIG_DEPS)
@mkdir -p $(HV_OBJDIR)
@BOARD=$(CONFIG_BOARD) SCENARIO=$(CONFIG_SCENARIO) \
python3 $(KCONFIG_DIR)/silentoldconfig.py Kconfig \
$(HV_OBJDIR)/$(HV_CONFIG) \
SCENARIO=$(CONFIG_SCENARIO) RELEASE=$(RELEASE)
# Minimize the current .config. This target can be used to generate a defconfig
# for future use.
.PHONY: savedefconfig
savedefconfig: $(HV_OBJDIR)/$(HV_CONFIG)
@python3 $(KCONFIG_DIR)/savedefconfig.py Kconfig \
$(HV_OBJDIR)/$(HV_CONFIG) \
$(HV_OBJDIR)/$(HV_DEFCONFIG)
$(eval $(call check_dep_exec,menuconfig,MENUCONFIG_DEPS))
export KCONFIG_CONFIG := $(HV_OBJDIR)/$(HV_CONFIG)
menuconfig: $(MENUCONFIG_DEPS) defconfig
@python3 $(shell which menuconfig) Kconfig
CFLAGS += -include $(HV_OBJDIR)/$(HV_CONFIG_H)

View File

@ -1,7 +1,6 @@
folder structure
Kconfig : Select working scenario and target board, configure ACRN hypervisor capabilities and features.
target : Get target board information under native Linux environment and generate board_info XML.
board_inspector : Get target board information under native Linux environment and generate board_info XML.
board_config : Parse board_info XML and scenario XML to generate board related configuration files under misc/acrn-config/xmls/board-xmls/ folder.
scenario_config : Parse board_info XML and scenario XML to generate scenario based VM configuration files under misc/acrn-config/xmls/config-xmls/$(BOARD)/ folder.
launch_config : Parse board_info XML, scenario XML and devicemodel param XML to generate launch script for post-launched vm under misc/acrn-config/xmls/config-xmls/$(BOARD)/ folder.

View File

@ -38,7 +38,7 @@ def gen_dmar_structure(config):
if not dmar_info_lines:
print("\n#ifndef CONFIG_ACPI_PARSE_ENABLED", file=config)
print("#error \"DMAR info is not available, please set ACPI_PARSE_ENABLED to y in Kconfig. \\", file=config)
print("#error \"DMAR info is not available, please set ACPI_PARSE_ENABLED to y. \\", file=config)
print("\tOr use acrn-config tool to generate platform DMAR info.\"", file=config)
print("#endif\n", file=config)

View File

@ -1,5 +0,0 @@
Copyright (c) 2011-2018, Ulf Magnusson <ulfalizer@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View File

@ -1,58 +0,0 @@
# Copyright (C) 2018 Intel Corporation.
# SPDX-License-Identifier: BSD-3-Clause
# This script takes a Kconfig and a defconfig file, and expands it to a .config
# with all default values listed explicitly.
import sys
import os
# Kconfiglib: Copyright (c) 2011-2018, Ulf Magnusson
# SPDX-License-Identifier: ISC
# Refer to scripts/kconfig/LICENSE.kconfiglib for the permission notice.
import kconfiglib
def usage():
sys.stdout.write("%s: <Kconfig file> <path to .config>\n" % sys.argv[0])
def main():
if len(sys.argv) < 3:
usage()
sys.exit(1)
target_board = os.environ['BOARD']
target_scenario = os.environ['SCENARIO']
kconfig_path = sys.argv[1]
if not os.path.isfile(kconfig_path):
sys.stderr.write("Cannot find file %s\n" % kconfig_path)
sys.exit(1)
kconfig = kconfiglib.Kconfig(kconfig_path)
defconfig_path = kconfig.defconfig_filename
if not defconfig_path or not os.path.isfile(defconfig_path):
sys.stderr.write("No defconfig found for BOARD %s on SCENARIO %s.\n" % (target_board, target_scenario))
sys.exit(1)
kconfig.load_config(defconfig_path)
config_path = sys.argv[2]
if os.path.isfile(config_path):
# No need to change .config if it is already equivalent to the specified
# default.
kconfig_current = kconfiglib.Kconfig(kconfig_path)
kconfig_current.load_config(config_path)
same_config = True
for sym in kconfig_current.syms:
if kconfig_current.syms[sym].str_value != kconfig.syms[sym].str_value:
same_config = False
break
if same_config:
sys.exit(0)
sys.stdout.write("Default configuration based on %s.\n" % defconfig_path)
kconfig.write_config(config_path)
sys.stdout.write("Configuration written to %s.\n" % config_path)
if __name__ == "__main__":
main()

View File

@ -1,97 +0,0 @@
# Copyright (C) 2018 Intel Corporation.
# SPDX-License-Identifier: BSD-3-Clause
# This script takes a Kconfig and a .config, and generates a C header file with
# all the configuration data defined as object-like macros.
import sys
import os
import re
# Kconfiglib: Copyright (c) 2011-2018, Ulf Magnusson
# SPDX-License-Identifier: ISC
# Refer to scripts/kconfig/LICENSE.kconfiglib for the permission notice.
import kconfiglib
class AcrnConfig(kconfiglib.Kconfig):
help_regex = re.compile("64-bit[\s\n]+integer")
def __init__(self, filename="Kconfig", warn=True, warn_to_stderr=True, encoding="utf-8"):
kconfiglib.Kconfig.__init__(self, filename, warn, warn_to_stderr, encoding)
def write_autoconf(self, filename,
header="/* Generated by Kconfiglib (https://github.com/ulfalizer/"
"Kconfiglib) */\n"):
guard_begin = "#ifndef HV_KCONFIG\n#define HV_KCONFIG\n"
guard_end = "#endif"
with open(filename, "w") as f_autoconf:
f_autoconf.write(header)
f_autoconf.write(guard_begin)
for sym in self.defined_syms:
if sym.config_string in ("", None):
continue
else:
val = sym.str_value
if sym.orig_type in (kconfiglib.BOOL, kconfiglib.TRISTATE):
if val != "n":
f_autoconf.write("#define {}{}{} 1\n"
.format(self.config_prefix, sym.name,
"_MODULE" if val == "m" else ""))
elif sym.orig_type == kconfiglib.STRING:
f_autoconf.write('#define {}{} "{}"\n'
.format(self.config_prefix, sym.name,
kconfiglib.escape(val)))
elif sym.orig_type in (kconfiglib.INT, kconfiglib.HEX):
if sym.orig_type == kconfiglib.HEX:
val = val + "U"
if not val.startswith(("0x", "0X")):
val = "0x" + val
elif sym.orig_type == kconfiglib.INT and len(sym.ranges) > 0:
left_sym = sym.ranges[0][0]
right_sym = sym.ranges[0][1]
left_value = int(left_sym.str_value)
right_value = int(right_sym.str_value)
if left_value >= 0 and right_value >= 0:
val = val + "U"
_help = sym.nodes[0].help
if _help not in (None, "") and len(self.help_regex.findall(_help)) > 0:
val = val + "L"
f_autoconf.write("#define {}{} {}\n"
.format(self.config_prefix, sym.name, val))
else:
raise Exception(
'Internal error while creating C header: unknown type "{}".' \
.format(sym.orig_type))
f_autoconf.write(guard_end)
def usage():
sys.stdout.write("%s: <Kconfig file> <.config file> <path to config.h>\n" % sys.argv[0])
def main():
if len(sys.argv) < 4:
usage()
sys.exit(1)
header = "/* Generated by Kconfiglib */\n"
kconfig_path = sys.argv[1]
if not os.path.isfile(kconfig_path):
sys.stderr.write("Cannot find file %s\n" % kconfig_path)
sys.exit(1)
config_path = sys.argv[2]
if not os.path.isfile(config_path):
sys.stderr.write("Cannot find file %s\n" % config_path)
sys.exit(1)
kconfig = AcrnConfig(kconfig_path)
kconfig.load_config(config_path)
kconfig.write_autoconf(sys.argv[3], header)
sys.stdout.write("Configuration header written to %s.\n" % sys.argv[3])
if __name__ == "__main__":
main()

View File

@ -1,40 +0,0 @@
# Copyright (C) 2018 Intel Corporation.
# SPDX-License-Identifier: BSD-3-Clause
# Given a Kconfig, this script minimize a given .config by removing the symbols
# having the default values. The minimized config can act as a defconfig for
# future use.
import sys
import os
# Kconfiglib: Copyright (c) 2011-2018, Ulf Magnusson
# SPDX-License-Identifier: ISC
# Refer to scripts/kconfig/LICENSE.kconfiglib for the permission notice.
import kconfiglib
def usage():
sys.stdout.write("%s: <Kconfig file> <.config file> <path to output .config>\n" % sys.argv[0])
def main():
if len(sys.argv) < 4:
usage()
sys.exit(1)
kconfig_path = sys.argv[1]
if not os.path.isfile(kconfig_path):
sys.stderr.write("Cannot find file %s\n" % kconfig_path)
sys.exit(1)
config_path = sys.argv[2]
if not os.path.isfile(config_path):
sys.stderr.write("Cannot find file %s\n" % config_path)
sys.exit(1)
kconfig = kconfiglib.Kconfig(kconfig_path)
kconfig.load_config(config_path)
kconfig.write_min_config(sys.argv[3])
sys.stdout.write("Minimized configuration written to %s.\n" % sys.argv[3])
if __name__ == "__main__":
main()

View File

@ -1,126 +0,0 @@
# Copyright (C) 2018 Intel Corporation.
# SPDX-License-Identifier: BSD-3-Clause
# This script
#
# 1. takes a Kconfig and a .config and an optional list of symbol-value pairs,
# 2. checks whether the specified symbols have the specified values in the
# given .config, and
# 3. reconstruct .config with the given list of symbol-value pairs if there
# is any disagreement.
import sys
import os
# Kconfiglib: Copyright (c) 2011-2018, Ulf Magnusson
# SPDX-License-Identifier: ISC
# Refer to scripts/kconfig/LICENSE.kconfiglib for the permission notice.
import kconfiglib
def usage():
sys.stdout.write("%s: <Kconfig file> <.config file> [<symbol1>=<value1> ...]\n" % sys.argv[0])
def main():
if len(sys.argv) < 3:
usage()
sys.exit(1)
kconfig_path = sys.argv[1]
if not os.path.isfile(kconfig_path):
sys.stderr.write("Cannot find file %s\n" % kconfig_path)
sys.exit(1)
kconfig = kconfiglib.Kconfig(kconfig_path)
# Parse the configs specified on cmdline
cmdline_conf = {}
for sym_val in sys.argv[3:]:
if sym_val.find("=") == -1:
continue
sym_name, val = sym_val.split("=")[:2]
if sym_name in kconfig.syms.keys() and val:
cmdline_conf[sym_name] = val
# Determine the base config.
#
# If either
#
# 1. no .config exists, or
# 2. the BOARD in the existing .config is different from the BOARD
# specified in the environment variable
#
# the defconfig will be used as the base config. Otherwise the existing
# .config is used as the base.
#
# If .config does not exist, it is required that Kconfig specifies an
# existing defconfig, otherwise this script will refuse to generate a
# .config.
config_path = sys.argv[2]
defconfig_path = kconfig.defconfig_filename
if defconfig_path and os.path.isfile(defconfig_path):
kdefconfig = kconfiglib.Kconfig(kconfig_path)
kdefconfig.load_config(defconfig_path)
else:
kdefconfig = None
need_update = False
if os.path.isfile(config_path):
kconfig.load_config(config_path)
# The BOARD given by the environment variable may be different from what
# is specified in the corresponding defconfig. So compare the value of
# CONFIG_BOARD directly. This is applicable only when CONFIG_BOARD
# exists in the Kconfig.
if kdefconfig and 'BOARD' in kconfig.syms and \
kconfig.syms['BOARD'].str_value != kdefconfig.syms['BOARD'].str_value:
kconfig = kdefconfig
sys.stdout.write("Overwrite with default configuration based on %s.\n" % defconfig_path)
need_update = True
else:
# Use the existing .config as the base.
#
# Mark need_update if any visible symbol picks a different value
# from what is specified in .config.
for sym in [x for x in kconfig.unique_defined_syms if x.visibility]:
if sym.type in [kconfiglib.BOOL, kconfiglib.TRISTATE]:
picked_value = sym.tri_value
else:
picked_value = sym.str_value
need_update = (picked_value != sym.user_value)
if need_update:
break
else:
# base on a default configuration
if kdefconfig:
kconfig = kdefconfig
sys.stdout.write("Default configuration based on %s.\n" % defconfig_path)
need_update = True
else:
# report an error if no known defconfig exists
sys.stderr.write(".config does not exist and no defconfig available for BOARD %s on SCENARIO %s.\n"
% (os.environ['BOARD'], os.environ['SCENARIO']))
sys.exit(1)
# Update the old .config with those specified on cmdline
#
# Note: the user shall be careful what configuration symbols to overwrite by
# silentoldconfig. After changing a symbol value, the invisible symbols are
# updated accordingly because they always use the default value, while
# visible symbols keep their original value in the old .config. This may
# lead to invalid .config for a specific platform.
#
# Currently it is recommended to use the following update only for
# RELEASE. For PLATFORM reinvoke defconfig is preferred.
for sym_name, val in cmdline_conf.items():
sym = kconfig.syms[sym_name]
if sym.str_value and sym.str_value != val:
kconfig.syms[sym_name].set_value(val)
need_update = True
if need_update:
kconfig.write_config(config_path)
sys.stdout.write("Configuration written to %s.\n" % config_path)
if __name__ == "__main__":
main()