From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 7753ED8119E for ; Wed, 27 Mar 2024 08:43:02 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=JDlWrbjq4IaFoMq//JvXtoXIbgf2YoRBm5AGGAy3pt0=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20240206; t=1711528981; v=1; b=MXYsHysHB+ddBUHebb0rQEjxjJ6FgDnR3KSp9YpATP4UQhR3kE0F61ffcs5A/Oi0DN0OEjGt OliAKkhAatjlo4oEGgj/SRwGqwLbrhUK7KUXyQpeawjbmT/ae77wg/f2BqWGtPbnjSeT3NDxGqA 6FU/VMCLLJVnlxXcnb7jAFJKC/1DItvJrwGcdde2Reasx3gU5z2ePuVVp3DiCrOazODTUUSiYRS QeJqGnuXsP3ohyvZe9dgNL9S7etKzyzc9+T9p5qHDzqwHIcFJ2lb7QZPCfdjz5P0vTU5/OGFg4N 1cMdeUh211Hl4SEQqslOMGqqdpr9uIsQfMeInGST3wOvA== X-Received: by 127.0.0.2 with SMTP id YVZhYY7687511xRfFTS3ZMlz; Wed, 27 Mar 2024 01:43:01 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by mx.groups.io with SMTP id smtpd.web10.32721.1711528980401905081 for ; Wed, 27 Mar 2024 01:43:00 -0700 X-CSE-ConnectionGUID: S6pIDZmzRx+Uo7eoY1C71g== X-CSE-MsgGUID: Sr0qfMb6QHieNzQqV782Lw== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="17247126" X-IronPort-AV: E=Sophos;i="6.07,158,1708416000"; d="scan'208";a="17247126" X-Received: from orviesa010.jf.intel.com ([10.64.159.150]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2024 01:42:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,158,1708416000"; d="scan'208";a="16071483" X-Received: from sh0701bl-hv01.ccr.corp.intel.com ([10.239.220.156]) by orviesa010.jf.intel.com with ESMTP; 27 Mar 2024 01:42:57 -0700 From: "Yuting Yang" To: devel@edk2.groups.io Cc: Rebecca Cran , Liming Gao , Bob Feng , Yuwei Chen Subject: [edk2-devel] [Patch V2] [edk2-staging] BaseTools: Update ReadMe in Python VfrCompiler Tool Date: Wed, 27 Mar 2024 01:42:53 -0700 Message-Id: <20240327084254.307-1-yuting2.yang@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Wed, 27 Mar 2024 01:43:00 -0700 Reply-To: devel@edk2.groups.io,yuting2.yang@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: bwRr6wTSMYwb0LUakHNOcwu9x7686176AA= Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=MXYsHysH; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none) Cc: Rebecca Cran Cc: Liming Gao Cc: Bob Feng Cc: Yuwei Chen Signed-off-by: Yuting Yang --- BaseTools/BinWrappers/PosixLike/PyVfrCompile | 22 +++++++++++----------- BaseTools/Conf/build_rule.template | 2 -- BaseTools/Source/Python/VfrCompiler/README.md | 27 +++++++++++++++++------= ---- 3 files changed, 28 insertions(+), 23 deletions(-) diff --git a/BaseTools/BinWrappers/PosixLike/PyVfrCompile b/BaseTools/BinWr= appers/PosixLike/PyVfrCompile old mode 100644 new mode 100755 index 1f241482d4..53a32733fa --- a/BaseTools/BinWrappers/PosixLike/PyVfrCompile +++ b/BaseTools/BinWrappers/PosixLike/PyVfrCompile @@ -1,13 +1,13 @@ - #!/usr/bin/env bash=0D - #python `dirname $0`/RunToolFromSource.py `basename $0` $*=0D +#!/usr/bin/env bash=0D +#python `dirname $0`/RunToolFromSource.py `basename $0` $*=0D =0D - # If a ${PYTHON_COMMAND} command is available, use it in preference to= python=0D - if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then=0D - python_exe=3D${PYTHON_COMMAND}=0D - fi=0D - full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ= /028 for a discussion of why $0 is not a good choice here=0D - dir=3D$(dirname "$full_cmd")=0D - cmd=3D${full_cmd##*/}=0D +# If a ${PYTHON_COMMAND} command is available, use it in preference to pyt= hon=0D +if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then=0D + python_exe=3D${PYTHON_COMMAND}=0D +fi=0D +full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here=0D +dir=3D$(dirname "$full_cmd")=0D +cmd=3D${full_cmd##*/}=0D =0D - export PYTHONPATH=3D"$dir/../../Source/Python:$dir/../../Source/Python= /VfrCompiler:$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"=0D - exec "${python_exe:-python}" -m IfrCompiler "$@"=0D \ No newline at end of file +export PYTHONPATH=3D"$dir/../../Source/Python:$dir/../../Source/Python/Vfr= Compiler:$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"=0D +exec "${python_exe:-python}" -m IfrCompiler "$@"=0D \ No newline at end of file diff --git a/BaseTools/Conf/build_rule.template b/BaseTools/Conf/build_rule= .template index 0e19133589..b2fa2032e3 100755 --- a/BaseTools/Conf/build_rule.template +++ b/BaseTools/Conf/build_rule.template @@ -257,7 +257,6 @@ =0D "$(VFRPP)" $(DEPS_FLAGS) $(VFRPP_FLAGS) $(INC) ${src} > $(OUTPUT_D= IR)(+)${s_base}.i=0D "$(VFR)" $(VFR_FLAGS) --string-db $(OUTPUT_DIR)(+)$(MODULE_NAME)St= rDefs.hpk --output-directory ${d_path} $(OUTPUT_DIR)(+)${s_base}.i=0D - "$(PYVFR)" ${src} --string-db $(OUTPUT_DIR)(+)$(MODULE_NAME)StrDef= s.hpk -w $(WORKSPACE) -m $(MODULE_NAME) -o $(OUTPUT_DIR) --vfr=0D =0D [Object-File]=0D =0D @@ -629,7 +628,6 @@ =0D "$(VFRPP)" $(DEPS_FLAGS) $(VFRPP_FLAGS) $(INC) ${src} > $(OUTPUT_D= IR)(+)${s_dir}(+)${s_base}.i=0D "$(VFR)" $(VFR_FLAGS) --create-ifr-package --string-db $(OUTPUT_DI= R)(+)$(MODULE_NAME)StrDefs.hpk --output-directory $(OUTPUT_DIR)(+)${s_dir} = $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i=0D - "$(PYVFR)" ${src} --string-db $(OUTPUT_DIR)(+)$(MODULE_NAME)StrDef= s.hpk -w $(WORKSPACE) -m $(MODULE_NAME) -o $(OUTPUT_DIR) --vfr=0D =0D [Hii-Binary-Package.UEFI_HII]=0D =0D diff --git a/BaseTools/Source/Python/VfrCompiler/README.md b/BaseTools/Sour= ce/Python/VfrCompiler/README.md index 7bdc85023a..473482f936 100644 --- a/BaseTools/Source/Python/VfrCompiler/README.md +++ b/BaseTools/Source/Python/VfrCompiler/README.md @@ -29,12 +29,10 @@ The core function of the original C VfrCompiler tool is= to convert VFR files int - Future extension=0D - The tool will extend new functions, which is able to compile yaml file= s. This feature will be added in future update.=0D =0D -### Use with Build System=0D -To use the VfrCompiler Python Tool with Build System, please do the follo= wing steps in the build command.=0D +### Implementation method=0D +=0D +To apply the VfrCompiler python tool with Build System, the code modifies = the following steps in the build command.=0D 1. Locate the **VfrCompiler** folder to path **'\edk2\BaseTools\Source\Pyt= hon'.**=0D -1. Open **'build_rule.template'** file in path **'\edk2\BaseTools\Conf\= '.**=0D - - Find the C VFR command line `$(VFR)" $(VFR_FLAGS) --string-db $(OUTPUT= _DIR)(+)$(MODULE_NAME)StrDefs.hpk --output-directory ${d_path} $(OUTPUT_DIR= )(+)${s_base}.i` in **build_rule.template** file. There are two C VFR comma= nds in it.=0D - - Add new command line `"$(PYVFR)" ${src} --string-db $(OUTPUT_DIR)(+)$(= MODULE_NAME)StrDefs.hpk -w $(WORKSPACE) -m $(MODULE_NAME) -o $(OUTPUT_DIR) = --vfr` after each VFR command lines.=0D 2. Open **'tools_def.template'** file in path **'\edk2\BaseTools\Conf\'= .**=0D - Find the C VFR_PATH command line `*_*_*_VFR_PATH = =3D VfrCompile` in **tools_def.template** file.=0D - Add new command line `*_*_*_PYVFR_PATH =3D PyVfrCom= pile` after the VFR_PATH command line.=0D @@ -51,7 +49,7 @@ To use the VfrCompiler Python Tool with Build System, pl= ease do the following s ```=0D #!/usr/bin/env bash=0D #python `dirname $0`/RunToolFromSource.py `basename $0` $*=0D -=0D + =0D # If a ${PYTHON_COMMAND} command is available, use it in preference to= python=0D if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then=0D python_exe=3D${PYTHON_COMMAND}=0D @@ -59,10 +57,19 @@ To use the VfrCompiler Python Tool with Build System, = please do the following s full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ= /028 for a discussion of why $0 is not a good choice here=0D dir=3D$(dirname "$full_cmd")=0D cmd=3D${full_cmd##*/}=0D -=0D + =0D export PYTHONPATH=3D"$dir/../../Source/Python:$dir/../../Source/Python= /VfrCompiler:$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"=0D exec "${python_exe:-python}" -m IfrCompiler "$@"=0D ```=0D -5. Add Env: run `pip install antlr4-python3-runtime=3D=3D4.7.1` based on t= he original build environment.=0D -6. Run Build Command: `build -p OvmfPkg\OvmfPkgIa32X64.dsc -a IA32 -a X64 = -j build.log`=0D -`=0D +### How to use=0D +=0D +1. Add Env: run `pip install antlr4-python3-runtime=3D=3D4.7.1` based on t= he original build environment.=0D +2. Open **'build_rule.template'** file in path **'\edk2\BaseTools\Conf\= '.**=0D + - Find the C VFR command line `$(VFR)" $(VFR_FLAGS) --string-db $(OUTPU= T_DIR)(+)$(MODULE_NAME)StrDefs.hpk --output-directory ${d_path} $(OUTPUT_DI= R)(+)${s_base}.i` in **build_rule.template** file. There are two C VFR comm= ands in it.=0D + - Add new command line `"$(PYVFR)" ${src} --string-db $(OUTPUT_DIR)(+)$= (MODULE_NAME)StrDefs.hpk -w $(WORKSPACE) -m $(MODULE_NAME) -o $(OUTPUT_DIR)= --vfr` after each VFR command lines.=0D +3. Run Build Command: `build -p OvmfPkg\OvmfPkgIa32X64.dsc -a IA32 -a X64 = -j build.log` to have a try.=0D +=0D +### Tips=0D +=0D +1. The output of the python tool will not override the output of the origi= nal C tool. Instead, it will be prefixed with "PyVfr".=0D +2. If you want to activate/deactivate the python tool, please locate and a= dd/delete all `"$(PYVFR)" ${src} --string-db $(OUTPUT_DIR)(+)$(MODULE_NAME)= StrDefs.hpk -w $(WORKSPACE) -m $(MODULE_NAME) -o $(OUTPUT_DIR) --vfr` comma= nd lines in **'build_rule.template'**.=0D --=20 2.26.2.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117162): https://edk2.groups.io/g/devel/message/117162 Mute This Topic: https://groups.io/mt/105173659/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-