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 62ED3AC0E43 for ; Wed, 27 Mar 2024 08:21:54 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=xnSMPuy705/VoOIbDvzkMlTEeV/Zfo7FXGPMYVu9raI=; 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=1711527712; v=1; b=Dcu9wfzsSQAH4y+TzE2RSK4Hdg3H6fHCy4GFwq5O2dd6wqkB2O88HC89WhxnEoX9pwjmf5Ei Z8ebYxdetWExOKb9z76pUIXQCUReZejIsm5uN9GLrgdqr6q73LYEbRR5d9Bk5NyPaTAFS/2q5RN 3m5rirKz7Zr1lVGRdNwqX2m5JGZpvOHZ6LGXUjkHbJy2b6T8ebV7Q6Ic1LlRheSyORo3DHZbW0Q om+jB1F1dzc8IcVgT8uVrnVoM6WxqDxppdowbDIdaMULJWsfJHII5bficAku8OBtqyaBfK5Ugzq jl2ARYOUoDO5mKQhkl53W1YeVo9jg8S72Sqkauw2dxKiA== X-Received: by 127.0.0.2 with SMTP id j31DYY7687511x52vMHOPw3s; Wed, 27 Mar 2024 01:21:52 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) by mx.groups.io with SMTP id smtpd.web10.32487.1711527712062231704 for ; Wed, 27 Mar 2024 01:21:52 -0700 X-CSE-ConnectionGUID: OEv+RbipQJiZDT2tN5tOjw== X-CSE-MsgGUID: TcOM5NWjTKGtGWAf5zfhXg== X-IronPort-AV: E=McAfee;i="6600,9927,11025"; a="10393652" X-IronPort-AV: E=Sophos;i="6.07,158,1708416000"; d="scan'208";a="10393652" X-Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2024 01:21:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,158,1708416000"; d="scan'208";a="16317309" X-Received: from sh0701bl-hv01.ccr.corp.intel.com ([10.239.220.156]) by fmviesa008.fm.intel.com with ESMTP; 27 Mar 2024 01:21:50 -0700 From: "Yuting Yang" To: devel@edk2.groups.io Cc: Rebecca Cran , Liming Gao , Bob Feng , Yuwei Chen Subject: [edk2-devel] [PATCH] [edk2-staging] BaseTools: Update ReadMe in Python VfrCompiler Tool Date: Wed, 27 Mar 2024 01:21:46 -0700 Message-Id: <20240327082146.9-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:21:52 -0700 Reply-To: devel@edk2.groups.io,yuting2.yang@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: RGesBGovst13E9mbfCVdGQFKx7686176AA= 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=Dcu9wfzs; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Cc: Rebecca Cran Cc: Liming Gao Cc: Bob Feng Cc: Yuwei Chen Signed-off-by: Yuting Yang --- BaseTools/BinWrappers/PosixLike/PyVfrCompile | 22 +++++++-------- BaseTools/Source/Python/VfrCompiler/README.md | 27 ++++++++++++------- 2 files changed, 28 insertions(+), 21 deletions(-) mode change 100644 =3D> 100755 BaseTools/BinWrappers/PosixLike/PyVfrCompile diff --git a/BaseTools/BinWrappers/PosixLike/PyVfrCompile b/BaseTools/BinWr= appers/PosixLike/PyVfrCompile old mode 100644 new mode 100755 index 1f241482d4..18119fa2a9 --- 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/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 (#117159): https://edk2.groups.io/g/devel/message/117159 Mute This Topic: https://groups.io/mt/105173564/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-