config_tools: change representation of build types

Instead of using a Boolean variable indicating whether a build is for debug
or release, it is more intuitive to specify the build types as "debug" or
"release".

This patch converts the config item RELEASE to BUILD_TYPE which takes
"debug" or "release" as of now.

The generated header and makefile still uses RELEASE, and the command line
option RELEASE=<y or n> is also preserved.

Tracked-On: #6690
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
Junjie Mao 2022-02-25 21:59:48 +08:00 committed by acrnsi-robot
parent 7a1fbcf51f
commit 7ad9596dd6
28 changed files with 58 additions and 34 deletions

View File

@ -741,12 +741,9 @@ example:
.. code-block:: xml
<xs:element name="RELEASE" type="Boolean" default="n">
<xs:annotation>
<xs:documentation>Build an image for release (``y``) or debug (``n``).
In a **release** image, assertions are not enforced and debugging
features are disabled, including logs, serial console, and the
hypervisor shell.</xs:documentation>
<xs:element name="BUILD_TYPE" type="BuildType" default="debug">
<xs:annotation acrn:title="Build type" acrn:views="basic">
<xs:documentation>Identify build type. Debug mode enables debug shell, prints, and logs. Release mode optimizes the ACRN binary for deployment and turns off all debug infrastructure. These can only be changed at build time.</xs:documentation>
</xs:annotation>
</xs:element>
@ -755,8 +752,8 @@ in the ``.xsd`` files are extracted and transformed into reStructuredText using
an XSLT transformation found in ``doc/scripts/configdoc.xsl``. The generated
option documentation is organized and formatted to make it easy to create links
to specific option descriptions using an ``:option:`` role, for example,
``:option:`hv.DEBUG_OPTIONS.RELEASE``` would link to
:option:`hv.DEBUG_OPTIONS.RELEASE`.
``:option:`hv.DEBUG_OPTIONS.BUILD_TYPE``` would link to
:option:`hv.DEBUG_OPTIONS.BUILD_TYPE`.
The transformed option documentation is
created in the ``_build/rst/reference/configdoc.txt`` file and included by

View File

@ -92,7 +92,11 @@ ifdef RELEASE
ifneq ($(RELEASE),$(CONFIG_RELEASE))
$$(warning The command line sets RELEASE to be '$(RELEASE)', but an existing build is configured with '$(CONFIG_RELEASE)')
$$(warning The configuration will be modified for RELEASE=$(RELEASE))
$$(shell sed -i "s@\(<RELEASE.*>\)[yn]\(</RELEASE>\)@\1$(RELEASE)\2@g" $(HV_SCENARIO_XML))
ifeq ($(RELEASE),y)
$$(shell sed -i "s@\(<BUILD_TYPE.*>\).*\(</BUILD_TYPE>\)@\1release\2@g" $(HV_SCENARIO_XML))
else
$$(shell sed -i "s@\(<BUILD_TYPE.*>\).*\(</BUILD_TYPE>\)@\1debug\2@g" $(HV_SCENARIO_XML))
endif
endif
endif
else

View File

@ -1,7 +1,7 @@
<acrn-config board="cfl-k700-i7" scenario="hybrid">
<hv>
<DEBUG_OPTIONS>
<RELEASE>n</RELEASE>
<BUILD_TYPE>debug</BUILD_TYPE>
<SERIAL_CONSOLE>/dev/ttyS0</SERIAL_CONSOLE>
<MEM_LOGLEVEL>5</MEM_LOGLEVEL>
<NPK_LOGLEVEL>5</NPK_LOGLEVEL>

View File

@ -1,7 +1,7 @@
<acrn-config board="cfl-k700-i7" scenario="hybrid_rt">
<hv>
<DEBUG_OPTIONS>
<RELEASE>n</RELEASE>
<BUILD_TYPE>debug</BUILD_TYPE>
<SERIAL_CONSOLE>/dev/ttyS0</SERIAL_CONSOLE>
<MEM_LOGLEVEL>5</MEM_LOGLEVEL>
<NPK_LOGLEVEL>5</NPK_LOGLEVEL>

View File

@ -1,7 +1,7 @@
<acrn-config board="cfl-k700-i7" scenario="partitioned">
<hv>
<DEBUG_OPTIONS>
<RELEASE>n</RELEASE>
<BUILD_TYPE>debug</BUILD_TYPE>
<SERIAL_CONSOLE>/dev/ttyS0</SERIAL_CONSOLE>
<MEM_LOGLEVEL>5</MEM_LOGLEVEL>
<NPK_LOGLEVEL>5</NPK_LOGLEVEL>

View File

@ -1,7 +1,7 @@
<acrn-config board="cfl-k700-i7" scenario="shared">
<hv>
<DEBUG_OPTIONS>
<RELEASE>n</RELEASE>
<BUILD_TYPE>debug</BUILD_TYPE>
<SERIAL_CONSOLE>/dev/ttyS0</SERIAL_CONSOLE>
<MEM_LOGLEVEL>5</MEM_LOGLEVEL>
<NPK_LOGLEVEL>5</NPK_LOGLEVEL>

View File

@ -1,7 +1,7 @@
<acrn-config board="generic_board" scenario="hybrid">
<hv>
<DEBUG_OPTIONS>
<RELEASE>n</RELEASE>
<BUILD_TYPE>debug</BUILD_TYPE>
<SERIAL_CONSOLE>/dev/ttyS0</SERIAL_CONSOLE>
<MEM_LOGLEVEL>5</MEM_LOGLEVEL>
<NPK_LOGLEVEL>5</NPK_LOGLEVEL>

View File

@ -1,7 +1,7 @@
<acrn-config board="generic_board" scenario="hybrid_rt">
<hv>
<DEBUG_OPTIONS>
<RELEASE>n</RELEASE>
<BUILD_TYPE>debug</BUILD_TYPE>
<SERIAL_CONSOLE>/dev/ttyS0</SERIAL_CONSOLE>
<MEM_LOGLEVEL>5</MEM_LOGLEVEL>
<NPK_LOGLEVEL>5</NPK_LOGLEVEL>

View File

@ -1,7 +1,7 @@
<acrn-config board="generic_board" scenario="partitioned">
<hv>
<DEBUG_OPTIONS>
<RELEASE>n</RELEASE>
<BUILD_TYPE>debug</BUILD_TYPE>
<SERIAL_CONSOLE>/dev/ttyS0</SERIAL_CONSOLE>
<MEM_LOGLEVEL>5</MEM_LOGLEVEL>
<NPK_LOGLEVEL>5</NPK_LOGLEVEL>

View File

@ -1,7 +1,7 @@
<acrn-config board="generic_board" scenario="shared">
<hv>
<DEBUG_OPTIONS>
<RELEASE>n</RELEASE>
<BUILD_TYPE>debug</BUILD_TYPE>
<SERIAL_CONSOLE>/dev/ttyS0</SERIAL_CONSOLE>
<MEM_LOGLEVEL>5</MEM_LOGLEVEL>
<NPK_LOGLEVEL>5</NPK_LOGLEVEL>

View File

@ -1,7 +1,7 @@
<acrn-config board="nuc11tnbi5" scenario="hybrid">
<hv>
<DEBUG_OPTIONS>
<RELEASE>n</RELEASE>
<BUILD_TYPE>debug</BUILD_TYPE>
<SERIAL_CONSOLE>/dev/ttyS0</SERIAL_CONSOLE>
<MEM_LOGLEVEL>5</MEM_LOGLEVEL>
<NPK_LOGLEVEL>5</NPK_LOGLEVEL>

View File

@ -1,7 +1,7 @@
<acrn-config board="nuc11tnbi5" scenario="partitioned">
<hv>
<DEBUG_OPTIONS>
<RELEASE>n</RELEASE>
<BUILD_TYPE>debug</BUILD_TYPE>
<SERIAL_CONSOLE>/dev/ttyS0</SERIAL_CONSOLE>
<MEM_LOGLEVEL>5</MEM_LOGLEVEL>
<NPK_LOGLEVEL>5</NPK_LOGLEVEL>

View File

@ -1,7 +1,7 @@
<acrn-config board="nuc11tnbi5" scenario="shared">
<hv>
<DEBUG_OPTIONS>
<RELEASE>n</RELEASE>
<BUILD_TYPE>debug</BUILD_TYPE>
<SERIAL_CONSOLE>/dev/ttyS0</SERIAL_CONSOLE>
<MEM_LOGLEVEL>5</MEM_LOGLEVEL>
<NPK_LOGLEVEL>5</NPK_LOGLEVEL>

View File

@ -1,7 +1,7 @@
<acrn-config board="qemu" scenario="shared">
<hv>
<DEBUG_OPTIONS>
<RELEASE>n</RELEASE>
<BUILD_TYPE>debug</BUILD_TYPE>
<SERIAL_CONSOLE>/dev/ttyS0</SERIAL_CONSOLE>
<MEM_LOGLEVEL>5</MEM_LOGLEVEL>
<NPK_LOGLEVEL>5</NPK_LOGLEVEL>

View File

@ -1,7 +1,7 @@
<acrn-config board="tgl-vecow-spc-7100-Corei7" scenario="hybrid">
<hv>
<DEBUG_OPTIONS>
<RELEASE>n</RELEASE>
<BUILD_TYPE>debug</BUILD_TYPE>
<SERIAL_CONSOLE>/dev/ttyS0</SERIAL_CONSOLE>
<MEM_LOGLEVEL>5</MEM_LOGLEVEL>
<NPK_LOGLEVEL>5</NPK_LOGLEVEL>

View File

@ -1,7 +1,7 @@
<acrn-config board="tgl-vecow-spc-7100-Corei7" scenario="partitioned">
<hv>
<DEBUG_OPTIONS>
<RELEASE>n</RELEASE>
<BUILD_TYPE>debug</BUILD_TYPE>
<SERIAL_CONSOLE>/dev/ttyS0</SERIAL_CONSOLE>
<MEM_LOGLEVEL>5</MEM_LOGLEVEL>
<NPK_LOGLEVEL>5</NPK_LOGLEVEL>

View File

@ -1,7 +1,7 @@
<acrn-config board="tgl-vecow-spc-7100-Corei7" scenario="shared">
<hv>
<DEBUG_OPTIONS>
<RELEASE>n</RELEASE>
<BUILD_TYPE>debug</BUILD_TYPE>
<SERIAL_CONSOLE>/dev/ttyS0</SERIAL_CONSOLE>
<MEM_LOGLEVEL>5</MEM_LOGLEVEL>
<NPK_LOGLEVEL>5</NPK_LOGLEVEL>

View File

@ -1,7 +1,7 @@
<acrn-config board="whl-ipc-i5" scenario="hybrid">
<hv>
<DEBUG_OPTIONS>
<RELEASE>n</RELEASE>
<BUILD_TYPE>debug</BUILD_TYPE>
<SERIAL_CONSOLE>/dev/ttyS0</SERIAL_CONSOLE>
<MEM_LOGLEVEL>5</MEM_LOGLEVEL>
<NPK_LOGLEVEL>5</NPK_LOGLEVEL>

View File

@ -1,7 +1,7 @@
<acrn-config board="whl-ipc-i5" scenario="hybrid_rt">
<hv>
<DEBUG_OPTIONS>
<RELEASE>n</RELEASE>
<BUILD_TYPE>debug</BUILD_TYPE>
<SERIAL_CONSOLE>/dev/ttyS0</SERIAL_CONSOLE>
<MEM_LOGLEVEL>5</MEM_LOGLEVEL>
<NPK_LOGLEVEL>5</NPK_LOGLEVEL>

View File

@ -1,7 +1,7 @@
<acrn-config board="whl-ipc-i5" scenario="partitioned">
<hv>
<DEBUG_OPTIONS>
<RELEASE>n</RELEASE>
<BUILD_TYPE>debug</BUILD_TYPE>
<SERIAL_CONSOLE>/dev/ttyS0</SERIAL_CONSOLE>
<MEM_LOGLEVEL>5</MEM_LOGLEVEL>
<NPK_LOGLEVEL>5</NPK_LOGLEVEL>

View File

@ -1,7 +1,7 @@
<acrn-config board="whl-ipc-i5" scenario="sdc">
<hv>
<DEBUG_OPTIONS>
<RELEASE>n</RELEASE>
<BUILD_TYPE>debug</BUILD_TYPE>
<SERIAL_CONSOLE>/dev/ttyS0</SERIAL_CONSOLE>
<MEM_LOGLEVEL>5</MEM_LOGLEVEL>
<NPK_LOGLEVEL>5</NPK_LOGLEVEL>

View File

@ -1,7 +1,7 @@
<acrn-config board="whl-ipc-i5" scenario="shared">
<hv>
<DEBUG_OPTIONS>
<RELEASE>n</RELEASE>
<BUILD_TYPE>debug</BUILD_TYPE>
<SERIAL_CONSOLE>/dev/ttyS0</SERIAL_CONSOLE>
<MEM_LOGLEVEL>5</MEM_LOGLEVEL>
<NPK_LOGLEVEL>5</NPK_LOGLEVEL>

View File

@ -220,6 +220,17 @@ class ScenarioUpgrader(ScenarioTransformer):
old_data_node = old_hv_vm_node.xpath(xpath)
return old_data_node
def move_build_type(self, xsd_element_node, xml_parent_node, new_nodes):
old_data_node = self.get_node(self.old_xml_etree, f"//hv//RELEASE")
if old_data_node is not None:
new_node = etree.Element(xsd_element_node.get("name"))
new_node.text = "release" if old_data_node.text == "y" else "debug"
new_nodes.append(new_node)
self.old_data_nodes.discard(old_data_node)
else:
self.move_data_by_xpath(".//BUILD_TYPE", xsd_element_node, xml_parent_node, new_nodes)
return False
def move_legacy_vuart(self, xsd_element_node, xml_parent_node, new_nodes):
# Preserve the legacy vuart for console only.
legacy_vuart = self.get_from_old_data(xml_parent_node, ".//legacy_vuart[@id = '0']")
@ -357,6 +368,7 @@ class ScenarioUpgrader(ScenarioTransformer):
"hide_mtrr_support": partialmethod(move_guest_flag, "GUEST_FLAG_HIDE_MTRR"),
"security_vm": partialmethod(move_guest_flag, "GUEST_FLAG_SECURITY_VM"),
"BUILD_TYPE": move_build_type,
"legacy_vuart": move_legacy_vuart,
"vuart_connections": move_vuart_connections,
"IVSHMEM": move_ivshmem,

View File

@ -13,8 +13,8 @@
</xs:annotation>
<xs:all>
<xs:element name="RELEASE" type="Boolean" default="n">
<xs:annotation>
<xs:element name="BUILD_TYPE" type="BuildType" default="debug">
<xs:annotation acrn:title="Build type" acrn:views="basic">
<xs:documentation>Build an image for release (``y``) or debug (``n``).
In a **release** image, assertions are not enforced and debugging
features are disabled, including logs, serial console, and the

View File

@ -26,6 +26,16 @@
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="BuildType">
<xs:annotation>
<xs:documentation>A string that indicates the build type of the hypervisor.</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="release" />
<xs:enumeration value="debug" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="KernLoadAddr">
<xs:annotation>
<xs:documentation>Either empty, or an Integer value in hexadecimal format.</xs:documentation>

View File

@ -60,7 +60,7 @@
<xsl:param name="key" />
<xsl:param name="value" />
<xsl:if test="$value = 'y'">
<xsl:if test="($value = 'true') or ($value = 'y')">
<xsl:call-template name="entry-by-key-value">
<xsl:with-param name="key" select="$key" />
<xsl:with-param name="value" select="1" />

View File

@ -63,7 +63,7 @@
<xsl:when test="($key = 'RELEASE')">
<xsl:call-template name="entry-by-key-value">
<xsl:with-param name="key" select="$key" />
<xsl:with-param name="value" select="$value" />
<xsl:with-param name="value" select="'n'" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>

View File

@ -43,8 +43,9 @@
</xsl:template>
<xsl:template match="DEBUG_OPTIONS">
<xsl:call-template name="boolean-by-key">
<xsl:call-template name="boolean-by-key-value">
<xsl:with-param name="key" select="'RELEASE'" />
<xsl:with-param name="value" select="BUILD_TYPE = 'release'" />
</xsl:call-template>
<xsl:call-template name="integer-by-key-value">