[edk2-devel] [PATCH] BaseTools: Add FMMT Return Code for Error checking

2024-04-11 Thread Yuwei Chen
Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
Signed-off-by: Yuwei Chen 
---
 BaseTools/Source/Python/FMMT/FMMT.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/BaseTools/Source/Python/FMMT/FMMT.py 
b/BaseTools/Source/Python/FMMT/FMMT.py
index 26fc4c5792..d9f1c265a7 100644
--- a/BaseTools/Source/Python/FMMT/FMMT.py
+++ b/BaseTools/Source/Python/FMMT/FMMT.py
@@ -153,8 +153,10 @@ def main():
 fmmt.Shrink(args.ShrinkFv[0], args.ShrinkFv[1])
 else:
 parser.print_help()
+status=2
 except Exception as e:
 print(e)
+status=1
 
 return status
 
-- 
2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117627): https://edk2.groups.io/g/devel/message/117627
Mute This Topic: https://groups.io/mt/105458907/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [Patch V2] [edk2-staging] BaseTools: Update ReadMe in Python VfrCompiler Tool

2024-03-27 Thread Yuwei Chen
Reviewed-by: Yuwei Chen 

> -Original Message-
> From: Yang, Yuting2 
> Sent: Wednesday, March 27, 2024 4:43 PM
> To: devel@edk2.groups.io
> Cc: Rebecca Cran ; Liming Gao
> ; Feng, Bob C ; Chen,
> Christine 
> Subject: [Patch V2] [edk2-staging] BaseTools: Update ReadMe in Python
> VfrCompiler Tool
> 
> 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/BinWrappers/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
> 
> -#python `dirname $0`/RunToolFromSource.py `basename $0` $*
> 
> +#!/usr/bin/env bash
> 
> +#python `dirname $0`/RunToolFromSource.py `basename $0` $*
> 
> 
> 
> -# If a ${PYTHON_COMMAND} command is available, use it in preference to
> python
> 
> -if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
> 
> -python_exe=${PYTHON_COMMAND}
> 
> -fi
> 
> -full_cmd=${BASH_SOURCE:-$0} # see
> http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a
> good choice here
> 
> -dir=$(dirname "$full_cmd")
> 
> -cmd=${full_cmd##*/}
> 
> +# If a ${PYTHON_COMMAND} command is available, use it in preference to
> python
> 
> +if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
> 
> +python_exe=${PYTHON_COMMAND}
> 
> +fi
> 
> +full_cmd=${BASH_SOURCE:-$0} # see
> http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a
> good choice here
> 
> +dir=$(dirname "$full_cmd")
> 
> +cmd=${full_cmd##*/}
> 
> 
> 
> -export
> PYTHONPATH="$dir/../../Source/Python:$dir/../../Source/Python/VfrCompiler
> :$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
> 
> -exec "${python_exe:-python}" -m IfrCompiler "$@"
> 
> \ No newline at end of file
> +export
> PYTHONPATH="$dir/../../Source/Python:$dir/../../Source/Python/VfrCompiler
> :$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
> 
> +exec "${python_exe:-python}" -m IfrCompiler "$@"
> 
> \ 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 @@
>  
> 
>  "$(VFRPP)" $(DEPS_FLAGS) $(VFRPP_FLAGS) $(INC) ${src} >
> $(OUTPUT_DIR)(+)${s_base}.i
> 
>  "$(VFR)" $(VFR_FLAGS) --string-db
> $(OUTPUT_DIR)(+)$(MODULE_NAME)StrDefs.hpk --output-directory
> ${d_path} $(OUTPUT_DIR)(+)${s_base}.i
> 
> -"$(PYVFR)" ${src} --string-db
> $(OUTPUT_DIR)(+)$(MODULE_NAME)StrDefs.hpk -w $(WORKSPACE) -m
> $(MODULE_NAME) -o $(OUTPUT_DIR) --vfr
> 
> 
> 
>  [Object-File]
> 
>  
> 
> @@ -629,7 +628,6 @@
>  
> 
>  "$(VFRPP)" $(DEPS_FLAGS) $(VFRPP_FLAGS) $(INC) ${src} >
> $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
> 
>  "$(VFR)" $(VFR_FLAGS) --create-ifr-package --string-db
> $(OUTPUT_DIR)(+)$(MODULE_NAME)StrDefs.hpk --output-directory
> $(OUTPUT_DIR)(+)${s_dir} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
> 
> -"$(PYVFR)" ${src} --string-db
> $(OUTPUT_DIR)(+)$(MODULE_NAME)StrDefs.hpk -w $(WORKSPACE) -m
> $(MODULE_NAME) -o $(OUTPUT_DIR) --vfr
> 
> 
> 
>  [Hii-Binary-Package.UEFI_HII]
> 
>  
> 
> diff --git a/BaseTools/Source/Python/VfrCompiler/README.md
> b/BaseTools/Source/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
> 
>- The tool will extend new functions, which is able to compile yaml files.
> This feature will be added in future update.
> 
> 
> 
> -### Use with Build System
> 
> -To use the VfrCompiler Python Tool with Build System,  please do the
>

Re: [edk2-devel] [PATCH] BaseTools: FMMT Skip empty Lines while parsing FMMTConfig.ini

2024-03-11 Thread Yuwei Chen
Ali, please also create PR in BaseTools repo.
Reviewed-by: Yuwei Chen 

> -Original Message-
> From: S, Ashraf Ali 
> Sent: Wednesday, February 28, 2024 5:57 PM
> To: devel@edk2.groups.io
> Cc: S, Ashraf Ali ; Rebecca Cran
> ; Liming Gao ; Feng, Bob
> C ; Chen, Christine ;
> Chaganty, Rangasai V 
> Subject: [PATCH] BaseTools: FMMT Skip empty Lines while parsing
> FMMTConfig.ini
> 
> When the FMMTConf.ini file has empty lines then it used to throw errors
> GuidTool load error!, this patch is to skip checking for empty lines in the 
> ini
> file
> 
> Cc: Rebecca Cran 
> Cc: Liming Gao 
> Cc: Bob Feng 
> Cc: Yuwei Chen 
> Cc: Chen Christine 
> Cc: Chaganty Rangasai V 
> 
> Signed-off-by: Ashraf Ali 
> ---
>  BaseTools/Source/Python/FMMT/core/GuidTools.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Source/Python/FMMT/core/GuidTools.py
> b/BaseTools/Source/Python/FMMT/core/GuidTools.py
> index f6bdeffa50..f9cfd4ead0 100644
> --- a/BaseTools/Source/Python/FMMT/core/GuidTools.py
> +++ b/BaseTools/Source/Python/FMMT/core/GuidTools.py
> @@ -153,7 +153,7 @@ class GUIDTools:
>  config_data = fd.readlines()
>  for line in config_data:
>  try:
> -if not line.startswith("#"):
> +if not line.startswith("#") and line.strip():
>  guid, short_name, command = line.split()
>  new_format_guid =
> struct2stream(ModifyGuidFormat(guid.strip()))
>  self.tooldef[new_format_guid] = GUIDTool(
> --
> 2.42.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116582): https://edk2.groups.io/g/devel/message/116582
Mute This Topic: https://groups.io/mt/104620514/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] Fixing edk2-basetools CI

2024-02-22 Thread Yuwei Chen
Thanks a lot Rebecca~~

Thanks,
Christine

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Michael
> D Kinney
> Sent: Saturday, February 17, 2024 1:24 AM
> To: Rebecca Cran ; Joey Vagedes
> ; Rebecca Cran
> ; devel@edk2.groups.io; Sean
> ; Michael Kubacki
> 
> Cc: Kinney, Michael D 
> Subject: Re: [edk2-devel] Fixing edk2-basetools CI
> 
> Hi Rebecca,
> 
> This approach makes a lot of sense.  Thank you for the updated.  I have
> approved.
> 
> Can we open some new Issues to re-enable flake8/ruf  and codecov so those
> tasks are not forgotten.
> 
> Thanks,
> 
> Mike
> 
> > -Original Message-
> > From: Rebecca Cran 
> > Sent: Thursday, February 15, 2024 11:51 PM
> > To: Joey Vagedes ; Rebecca Cran
> > ; devel@edk2.groups.io; Kinney,
> > Michael D ; Sean ;
> > Michael Kubacki 
> > Subject: Re: [EXTERNAL] Re: [edk2-devel] Fixing edk2-basetools CI
> >
> > I've updated the PR
> > https://github.com/tianocore/edk2-basetools/pull/116/ to include
> > commits from the pyflake8 disable PR and a couple more commits that
> > cause CI to start passing. I realize that disabling both flake8 and
> > codecov isn't good, but my thinking is to get builds working again
> > then we can work on fixing the issues in the background. The
> > edk2-basetools project needs lots of work.
> >
> >
> > Add pyproject.toml and fix setup.py deprecation warnings
> >
> > Disable running Pyflakes in CI since it's blocking releases
> >
> > Fix comments in build-publish-whl-steps.yml
> >
> > Update basic-setup-steps.yml to require Python 3.10
> >
> > Disable codecov to fix CI and due to very low coverage
> >
> >
> > --
> > Rebecca Cran
> >
> >
> > On 2/13/24 12:42, Joey Vagedes wrote:
> > > I agree - there are multiple blocking issues that will require some
> > fixes - One additional thing I noted is that multiple areas still
> > perform relative path imports - i.e. the import starts with `from .`.
> > >
> > > These will all need to be updated to import from edk2basetools as
> > some point soon as importing via relative paths can result in it
> > importing the wrong file if the pypath environment variable is
> > influenced. This open issue actually stems from that:
> > https://github.com/tianocore/edk2-basetools/issues/110 as the end
> > result is that edk2-basetools pip module can unexpectedly end up using
> > the BaseTools/* source code rather than the pip module source code.
> > >
> > > Thanks,
> > > Joey
> > >
> > > -Original Message-
> > > From: Rebecca Cran 
> > > Sent: Tuesday, February 13, 2024 11:28 AM
> > > To: Joey Vagedes ; Rebecca Cran
> > ; devel@edk2.groups.io; Kinney,
> > Michael D ; Sean ;
> > Michael Kubacki 
> > > Subject: Re: [EXTERNAL] Re: [edk2-devel] Fixing edk2-basetools CI
> > >
> > > [You don't often get email from rebe...@bsdio.com. Learn why this is
> > important at https://aka.ms/LearnAboutSenderIdentification ]
> > >
> > > Thanks, I've updated
> > > https://github.com/tianocore/edk2-basetools/pull/116 with the
> > > changes
> > you suggested.
> > >
> > > Unfortunately several of the tools don't work with the
> > projects.scripts section because they don't have Main etc. It turns
> > out even Ecc is currently broken in the edk2-basetools PyPI package
> > because PYTHONPATH doesn't contain the parent directory. I'll plan to
> > fix the issues in the near future, once I've worked through the other PRs.
> > >
> > >
> > > --
> > >
> > > Rebecca Cran
> > >
> > >
> > > On 2/12/24 10:06, Joey Vagedes wrote:
> > >> Hello! Regarding flake8, I see. That will take some time to work
> > through - I completely understand.
> > >>
> > >> When ready to work through that, I suggest switching to ruff. It
> > >> can
> > resolve some errors automatically for you and allows you to customize
> > it more than flake8 (it is also faster).
> > >>
> > >> I just ran ruff on the project, showing about 11k errors. One nice
> > thing is that a large majority of it is regarding importing using *.
> > By fixing those, you can reduce the errors by almost 70% (to 3400
> > errors), so it is not *quite* as bad as it seems (though 3400 is still A 
> > LOT).
> > >>
> > >> ---
> > >> -
> > --
> > >> -
> > >>
> > >> Regarding the setup tools question, the build-backend part of
> > >> pytoml
> > (L3) is the entry point that is invoked - so we are still invoking
> > setuptools. However, it pulls the necessary metadata from
> > pyproject.toml rather than setup.py's setup() function. The main thing
> > that is different is the "get_version" functionality, which we
> > replicate in the pyproject.toml with setuptools-scm[toml] which simply
> > uses the latest tag to set the version.
> > >>
> > >> ---
> > >> -
> > --
> > >> -
> > >>
> > >> Additionally, I wanted to comment on the wrappers that you

Re: [edk2-devel] [edk2-stable202311][PATCH] BaseTools: Python VfrCompiler implementation

2024-01-09 Thread Yuwei Chen
Hi Liming,

Have you tried with the new python tool? Any comments or concerns?

Thanks,
Christine

> -Original Message-
> From: Kinney, Michael D 
> Sent: Saturday, December 16, 2023 1:31 AM
> To: Pedro Falcato ; devel@edk2.groups.io; Chen,
> Christine 
> Cc: Gao, Liming ; Rebecca Cran
> ; Zimmer, Vincent ; Leif
> Lindholm ; Andrew Fish ;
> Feng, Bob C ; Yang, Yuting2
> ; Hartung, Stephen ;
> Kinney, Michael D 
> Subject: RE: [edk2-devel] [edk2-stable202311][PATCH] BaseTools: Python
> VfrCompiler implementation
> 
> There are several advantages for this direction:
> 
> 
> * Current VFR compiler in C has dependencies on very old libs that
>   have not been updated.
> 
> * The movement to python will remove the pre-build step that requires
>   some of the build tools to be built using host C compiler before
>   running edk2 build command.
> 
> * The other element is moving all the python code into edk2-basetools
>   repo with a published pip package.  This enables the use of
>   pip-requirements.txt to provide developers all the content needed
>   to build.
> 
> I agree that we should not have both VFR compilers.  We need to make sure
> the new one in Python is 100% compatible with the C version and make the
> decision to simultaneously add Python one and delete the C one and commit
> to the Python one.  I provided this feedback to the VFR developers in the
> TianoCore Tools/CI meeting earlier this year.
> 
> The perf question is very good. It would be good for the VFR developers to
> provide some perf comparisons.  I do not expect any significant different that
> would impact overall platform build times.
> 
> Mike
> 
> > -Original Message-
> > From: Pedro Falcato 
> > Sent: Friday, December 15, 2023 9:04 AM
> > To: devel@edk2.groups.io; Chen, Christine 
> > Cc: Gao, Liming ; Rebecca Cran
> > ; Zimmer, Vincent ;
> > Kinney, Michael D ; Leif Lindholm
> > ; Andrew Fish ; Feng, Bob
> > C ; Yang, Yuting2 ;
> > Hartung, Stephen 
> > Subject: Re: [edk2-devel] [edk2-stable202311][PATCH] BaseTools: Python
> > VfrCompiler implementation
> >
> > On Thu, Dec 7, 2023 at 9:08 AM Yuwei Chen 
> wrote:
> > >
> > > Hi Liming,
> > >
> > >
> > >
> > > Is this feature been tested and reviewed these two weeks? 
> >
> > Two questions:
> >
> > 1) What testing strategy do you have to test for regressions in such a
> > huge rewrite?
> > 2) What's the point in shipping this to upstream if you're not aiming
> > for the replacement of the original VfrCompiler?
> > 3) What's the value of rewriting this in Python? If the existing
> > VfrCompiler is already working fine (AFAIK?), a python version will
> > likely just be slower (unless the original C version is super badly
> > written).
> > I *seriously* struggle to understand what this Python movement is
> > supposed to do, except gratuitously rewrite large bits of BaseTools
> > for a net loss (performance)
> >
> > --
> > Pedro


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113430): https://edk2.groups.io/g/devel/message/113430
Mute This Topic: https://groups.io/mt/102486097/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v1 1/1] BaseTools: Fix raw strings containing valid escape characters

2024-01-09 Thread Yuwei Chen
Liming:
PR has been created: BaseTools: Fix raw strings containing valid escape 
characters by YuweiChen1110 · Pull Request #5238 · tianocore/edk2 
(github.com)<https://github.com/tianocore/edk2/pull/5238>
Thanks for reviewing.

Thanks,
Christine
From: gaoliming 
Sent: Tuesday, January 9, 2024 10:01 AM
To: devel@edk2.groups.io; joeyvage...@microsoft.com; Huang, Yanbo 

Cc: Chen, Christine ; Feng, Bob C ; 
Kinney, Michael D ; 'Rebecca Cran' 

Subject: 回复: [edk2-devel] [PATCH v1 1/1] BaseTools: Fix raw strings containing 
valid escape characters

Joey and Yanbo:
 Thanks for your update. So, this one is new introduced issue. I agree to 
resolve it asap.

Christine:
 Can you create Pull Request to merge it?

Thanks
Liming
发件人: devel@edk2.groups.io<mailto:devel@edk2.groups.io> 
mailto:devel@edk2.groups.io>> 代表 Joey Vagedes via 
groups.io
发送时间: 2024年1月8日 23:09
收件人: Huang, Yanbo mailto:yanbo.hu...@intel.com>>
抄送: Chen, Christine mailto:yuwei.c...@intel.com>>; Feng, 
Bob C mailto:bob.c.f...@intel.com>>; Gao, Liming 
mailto:gaolim...@byosoft.com.cn>>; Kinney, Michael D 
mailto:michael.d.kin...@intel.com>>; Rebecca Cran 
mailto:rebe...@bsdio.com>>; 
devel@edk2.groups.io<mailto:devel@edk2.groups.io>
主题: Re: [edk2-devel] [PATCH v1 1/1] BaseTools: Fix raw strings containing valid 
escape characters

Hi Liming,

It was introduced due to the fact that a few of the regex strings with invalid 
escape sequences (due to regex using their own escape sequences) also included 
valid escape sequences - for handling new lines. I did not see the valid escape 
characters in the strings, and the virtual platforms (Ovmf, etc) did not have 
the circumstances to catch this, so it slipped through the cracks.

Some platform DSCs do, and cause the break that the patch is resolving. I’ve 
already verified this fix resolves the issue on numerous platforms.

thanks,
Joey

On Mon, Jan 8, 2024 at 5:59 AM Huang, Yanbo 
mailto:yanbo.hu...@intel.com>> wrote:
Hi Liming,

This issue is introduced by this commit:
SHA-1: 9f0061a03b61d282fbc0ba5be22155d06a5e64a1

* BaseTools: Resolve regex syntax warnings

Switches regex patterns to raw text to resolve python 3.12 syntax
warnings in regards to invalid escape sequences, as is suggested by the
re (regex) module in python.

Best Regards,
Yanbo Huang

-Original Message-
From: gaoliming mailto:gaolim...@byosoft.com.cn>>
Sent: Monday, January 8, 2024 9:25 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Chen, Christine 
mailto:yuwei.c...@intel.com>>; 'Joey Vagedes' 
mailto:joey.vage...@gmail.com>>
Cc: 'Rebecca Cran' mailto:rebe...@bsdio.com>>; Feng, Bob C 
mailto:bob.c.f...@intel.com>>; Huang, Yanbo 
mailto:yanbo.hu...@intel.com>>; Kinney, Michael D 
mailto:michael.d.kin...@intel.com>>
Subject: 回复: [edk2-devel] [PATCH v1 1/1] BaseTools: Fix raw strings containing 
valid escape characters

Christine:
  Is this a regression issue? Or does it resolve new usage? I am curious why it 
is not reported before.

Thanks
Liming
> -邮件原件-
> 发件人: devel@edk2.groups.io<mailto:devel@edk2.groups.io> 
> mailto:devel@edk2.groups.io>> 代表 Yuwei Chen
> 发送时间: 2024年1月8日 13:37
> 收件人: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Chen, Christine 
> mailto:yuwei.c...@intel.com>>;
> Joey Vagedes mailto:joey.vage...@gmail.com>>
> 抄送: Rebecca Cran mailto:rebe...@bsdio.com>>; Gao, Liming
> mailto:gaolim...@byosoft.com.cn>>; Feng, Bob C 
> mailto:bob.c.f...@intel.com>>; Huang,
> Yanbo mailto:yanbo.hu...@intel.com>>; Kinney, Michael D
> mailto:michael.d.kin...@intel.com>>
> 主题: Re: [edk2-devel] [PATCH v1 1/1] BaseTools: Fix raw strings
containing
> valid escape characters
>
> Hi Liming and Cran,
>
> We should merge this fixing patch asap as it influences BaseTool's usage.
>
> Thanks,
> Christine
>
> > -Original Message-
> > From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> 
> > mailto:devel@edk2.groups.io>> On Behalf Of Yuwei
> > Chen
> > Sent: Monday, January 8, 2024 9:16 AM
> > To: Joey Vagedes mailto:joey.vage...@gmail.com>>; 
> > devel@edk2.groups.io<mailto:devel@edk2.groups.io>
> > Cc: Rebecca Cran mailto:rebe...@bsdio.com>>; Gao, Liming
> > mailto:gaolim...@byosoft.com.cn>>; Feng, Bob C 
> > mailto:bob.c.f...@intel.com>>
> > Subject: Re: [edk2-devel] [PATCH v1 1/1] BaseTools: Fix raw strings
> containing
> > valid escape characters
> >
> > Hi Joey,
> >
> > Thanks for fixing.
> >
> > Reviewed-by: Yuwei Chen mailto:yuwei.c...@intel.com>>
> >
> > > -Original Message-
> > > From: Joey Vagedes mailto:joey.vage...@gmail.com>>
> > > Sent: Friday, December 2

Re: [edk2-devel] [PATCH v1 1/1] BaseTools: Fix raw strings containing valid escape characters

2024-01-07 Thread Yuwei Chen
Hi Liming and Cran,

We should merge this fixing patch asap as it influences BaseTool's usage.

Thanks,
Christine

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Yuwei
> Chen
> Sent: Monday, January 8, 2024 9:16 AM
> To: Joey Vagedes ; devel@edk2.groups.io
> Cc: Rebecca Cran ; Gao, Liming
> ; Feng, Bob C 
> Subject: Re: [edk2-devel] [PATCH v1 1/1] BaseTools: Fix raw strings containing
> valid escape characters
> 
> Hi Joey,
> 
> Thanks for fixing.
> 
> Reviewed-by: Yuwei Chen 
> 
> > -Original Message-
> > From: Joey Vagedes 
> > Sent: Friday, December 29, 2023 12:48 AM
> > To: devel@edk2.groups.io
> > Cc: Rebecca Cran ; Gao, Liming
> > ; Feng, Bob C ; Chen,
> > Christine 
> > Subject: [PATCH v1 1/1] BaseTools: Fix raw strings containing valid
> > escape characters
> >
> > Fixes raw regex strings that contain valid (and purposeful) escape
> > characters as they are being treated as individual characters rather
> > than the single escaped character they represent (i.e. '\t' is being 
> > treated as
> a '\' and a 't'
> > rather than a single tab character).
> >
> > Signed-off-by: Joey Vagedes 
> > Cc: Rebecca Cran 
> > Cc: Liming Gao 
> > Cc: Bob Feng 
> > Cc: Yuwei Chen 
> > ---
> >  BaseTools/Source/Python/AutoGen/GenMake.py| 2 +-
> >  BaseTools/Source/Python/Common/Misc.py| 2 +-
> >  BaseTools/Source/Python/Workspace/DscBuildData.py | 4 ++--
> >  3 files changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py
> > b/BaseTools/Source/Python/AutoGen/GenMake.py
> > index c416fe172fe5..fbd35d498923 100755
> > --- a/BaseTools/Source/Python/AutoGen/GenMake.py
> > +++ b/BaseTools/Source/Python/AutoGen/GenMake.py
> > @@ -28,7 +28,7 @@ from Common.DataType import
> TAB_COMPILER_MSFT
> > gIncludePattern = re.compile(r"^[ \t]*[#%]?[ \t]*include(?:[
> > \t]*(?:\\(?:\r\n|\r|\n))*[ \t]*)*(?:\(?[ \"<]?[ \t]*)([-\w.\\/()
> > \t]+)(?:[ \t]*[\">]?\)?)", re.MULTILINE | re.UNICODE |
> > re.IGNORECASE)  ## Regular expression for matching macro used in
> > header file inclusion-gMacroPattern = re.compile(r"([_A-Z][_A-Z0-9]*)[
> > \t]*\((.+)\)", re.UNICODE)+gMacroPattern =
> > re.compile("([_A-Z][_A-Z0-9]*)[ \t]*\\((.+)\\)",
> > re.UNICODE)  gIsFileMap = {} diff --git
> > a/BaseTools/Source/Python/Common/Misc.py
> > b/BaseTools/Source/Python/Common/Misc.py
> > index f87d9dbdba39..34bfc90abd94 100755
> > --- a/BaseTools/Source/Python/Common/Misc.py
> > +++ b/BaseTools/Source/Python/Common/Misc.py
> > @@ -1926,4 +1926,4 @@ def CopyDict(ori_dict):
> >  # Remove the c/c++ comments: // and /* */ # def
> > RemoveCComments(ctext):-return re.sub(r'//.*?\n|/\*.*?\*/', '\n', ctext,
> > flags=re.S)+return re.sub('//.*?\n|/\\*.*?\\*/', '\n', ctext, 
> > flags=re.S)diff --
> git
> > a/BaseTools/Source/Python/Workspace/DscBuildData.py
> > b/BaseTools/Source/Python/Workspace/DscBuildData.py
> > index 817cdbe5f19c..4768099343e5 100644
> > --- a/BaseTools/Source/Python/Workspace/DscBuildData.py
> > +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
> > @@ -2840,7 +2840,7 @@ class DscBuildData(PlatformBuildClassObject):
> >  # start generating makefile MakeApp = PcdMakefileHeader
> >  if
> > sys.platform == "win32":-MakeApp = MakeApp + r'APPFILE
> > = %s\%s.exe\n' % (self.OutputPath, PcdValueInitName) + r'APPNAME =
> > %s\n' % (PcdValueInitName) + r'OBJECTS = %s\%s.obj %s.obj\n' %
> > (self.OutputPath, PcdValueInitName, os.path.join(self.OutputPath,
> > PcdValueCommonName)) + 'INC = '+MakeApp = MakeApp + 'APPFILE
> > = %s\\%s.exe\n' % (self.OutputPath, PcdValueInitName) + 'APPNAME =
> > %s\n' % (PcdValueInitName) + 'OBJECTS = %s\\%s.obj %s.obj\n' %
> > (self.OutputPath, PcdValueInitName, os.path.join(self.OutputPath,
> > PcdValueCommonName)) + 'INC = ' else: MakeApp = MakeApp 
> > +
> > PcdGccMakefile MakeApp = MakeApp + 'APPFILE = %s/%s\n' %
> > (self.OutputPath, PcdValueInitName) + 'APPNAME = %s\n' %
> > (PcdValueInitName) + 'OBJECTS = %s/%s.o %s.o\n' % (self.OutputPath,
> > PcdValueInitName, os.path.join(self.OutputPath, PcdValueCommonName))
> +
> > \@@ -2950,7 +2950,7 @@ class DscBuildData(PlatformBuildClassObject):
> >  MakeApp += "$(OBJECTS) : %s\n" % include_file if 
> > sys.platform
> ==
> > "win32": PcdValueCommonP

Re: [edk2-devel] [PATCH v1 1/1] BaseTools: Fix raw strings containing valid escape characters

2024-01-07 Thread Yuwei Chen
Hi Joey,

Thanks for fixing.

Reviewed-by: Yuwei Chen 

> -Original Message-
> From: Joey Vagedes 
> Sent: Friday, December 29, 2023 12:48 AM
> To: devel@edk2.groups.io
> Cc: Rebecca Cran ; Gao, Liming
> ; Feng, Bob C ; Chen,
> Christine 
> Subject: [PATCH v1 1/1] BaseTools: Fix raw strings containing valid escape
> characters
> 
> Fixes raw regex strings that contain valid (and purposeful) escape characters
> as they are being treated as individual characters rather than the single
> escaped character they represent (i.e. '\t' is being treated as a '\' and a 
> 't'
> rather than a single tab character).
> 
> Signed-off-by: Joey Vagedes 
> Cc: Rebecca Cran 
> Cc: Liming Gao 
> Cc: Bob Feng 
> Cc: Yuwei Chen 
> ---
>  BaseTools/Source/Python/AutoGen/GenMake.py| 2 +-
>  BaseTools/Source/Python/Common/Misc.py| 2 +-
>  BaseTools/Source/Python/Workspace/DscBuildData.py | 4 ++--
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py
> b/BaseTools/Source/Python/AutoGen/GenMake.py
> index c416fe172fe5..fbd35d498923 100755
> --- a/BaseTools/Source/Python/AutoGen/GenMake.py
> +++ b/BaseTools/Source/Python/AutoGen/GenMake.py
> @@ -28,7 +28,7 @@ from Common.DataType import TAB_COMPILER_MSFT
> gIncludePattern =
> re.compile(r"^[ \t]*[#%]?[ \t]*include(?:[ \t]*(?:\\(?:\r\n|\r|\n))*[ 
> \t]*)*(?:\(?[
> \"<]?[ \t]*)([-\w.\\/() \t]+)(?:[ \t]*[\">]?\)?)", re.MULTILINE | re.UNICODE |
> re.IGNORECASE)  ## Regular expression for matching macro used in header
> file inclusion-gMacroPattern = re.compile(r"([_A-Z][_A-Z0-9]*)[ \t]*\((.+)\)",
> re.UNICODE)+gMacroPattern = re.compile("([_A-Z][_A-Z0-9]*)[ \t]*\\((.+)\\)",
> re.UNICODE)  gIsFileMap = {} diff --git
> a/BaseTools/Source/Python/Common/Misc.py
> b/BaseTools/Source/Python/Common/Misc.py
> index f87d9dbdba39..34bfc90abd94 100755
> --- a/BaseTools/Source/Python/Common/Misc.py
> +++ b/BaseTools/Source/Python/Common/Misc.py
> @@ -1926,4 +1926,4 @@ def CopyDict(ori_dict):
>  # Remove the c/c++ comments: // and /* */ # def
> RemoveCComments(ctext):-return re.sub(r'//.*?\n|/\*.*?\*/', '\n', ctext,
> flags=re.S)+return re.sub('//.*?\n|/\\*.*?\\*/', '\n', ctext, 
> flags=re.S)diff --git
> a/BaseTools/Source/Python/Workspace/DscBuildData.py
> b/BaseTools/Source/Python/Workspace/DscBuildData.py
> index 817cdbe5f19c..4768099343e5 100644
> --- a/BaseTools/Source/Python/Workspace/DscBuildData.py
> +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
> @@ -2840,7 +2840,7 @@ class DscBuildData(PlatformBuildClassObject):
>  # start generating makefile MakeApp = PcdMakefileHeader  
>if
> sys.platform == "win32":-MakeApp = MakeApp + r'APPFILE
> = %s\%s.exe\n' % (self.OutputPath, PcdValueInitName) + r'APPNAME
> = %s\n' % (PcdValueInitName) + r'OBJECTS = %s\%s.obj %s.obj\n' %
> (self.OutputPath, PcdValueInitName, os.path.join(self.OutputPath,
> PcdValueCommonName)) + 'INC = '+MakeApp = MakeApp + 'APPFILE
> = %s\\%s.exe\n' % (self.OutputPath, PcdValueInitName) + 'APPNAME
> = %s\n' % (PcdValueInitName) + 'OBJECTS = %s\\%s.obj %s.obj\n' %
> (self.OutputPath, PcdValueInitName, os.path.join(self.OutputPath,
> PcdValueCommonName)) + 'INC = ' else: MakeApp = MakeApp +
> PcdGccMakefile MakeApp = MakeApp + 'APPFILE = %s/%s\n' %
> (self.OutputPath, PcdValueInitName) + 'APPNAME = %s\n' %
> (PcdValueInitName) + 'OBJECTS = %s/%s.o %s.o\n' % (self.OutputPath,
> PcdValueInitName, os.path.join(self.OutputPath, PcdValueCommonName)) +
> \@@ -2950,7 +2950,7 @@ class DscBuildData(PlatformBuildClassObject):
>  MakeApp += "$(OBJECTS) : %s\n" % include_file if 
> sys.platform ==
> "win32": PcdValueCommonPath =
> os.path.normpath(mws.join(GlobalData.gGlobalDefines["EDK_TOOLS_PATH"]
> , "Source\C\Common\PcdValueCommon.c"))-MakeApp = MakeApp +
> r'%s\PcdValueCommon.c : %s\n' % (self.OutputPath, PcdValueCommonPath)+
> MakeApp = MakeApp + '%s\\PcdValueCommon.c : %s\n' % (self.OutputPath,
> PcdValueCommonPath) MakeApp = MakeApp + '\tcopy /y %s $@\n' %
> (PcdValueCommonPath) else: PcdValueCommonPath =
> os.path.normpath(mws.join(GlobalData.gGlobalDefines["EDK_TOOLS_PATH"]
> , "Source/C/Common/PcdValueCommon.c"))--
> 2.43.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113338): https://edk2.groups.io/g/devel/message/113338
Mute This Topic: https://groups.io/mt/103403582/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH] BaseTools: Remove Duplicate sets of SkuName and SkuId from allskuset

2024-01-07 Thread Yuwei Chen
Reviewed-by: Yuwei Chen 

> -Original Message-
> From: S, Ashraf Ali 
> Sent: Monday, December 25, 2023 11:28 PM
> To: devel@edk2.groups.io
> Cc: S, Ashraf Ali ; Chen, Christine
> ; Rebecca Cran ; Gao, Liming
> ; Feng, Bob C ; Chan,
> Amy ; Chaganty, Rangasai V
> 
> Subject: [PATCH] BaseTools: Remove Duplicate sets of SkuName and SkuId
> from allskuset
> 
> Currently when the platform has many SKUs then allskuset will be having so
> many duplicate. and while parsing the allskuset will take longer time while
> assing Pcd.SkuInfoList.
> This patch is to eliminate those duplicate entires to reduce the build time
> 
> Cc: Yuwei Chen 
> Cc: Rebecca Cran 
> Cc: Liming Gao 
> Cc: Bob Feng 
> Cc: Amy Chan 
> Cc: Sai Chaganty 
> Signed-off-by: Ashraf Ali S 
> ---
>  BaseTools/Source/Python/AutoGen/PlatformAutoGen.py | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
> b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
> index 592d4824a4..dac81454a9 100644
> --- a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
> +++ b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
> @@ -707,6 +707,8 @@ class PlatformAutoGen(AutoGen):
>  self._DynamicPcdList.extend(list(OtherPcdArray))
>  self._DynamicPcdList.sort()
>  allskuset = [(SkuName, Sku.SkuId) for pcd in self._DynamicPcdList for
> (SkuName, Sku) in pcd.SkuInfoList.items()]
> +# Remove duplicate sets in the list
> +allskuset = list(set(allskuset))
>  for pcd in self._DynamicPcdList:
>  if len(pcd.SkuInfoList) == 1:
>  for (SkuName, SkuId) in allskuset:
> --
> 2.39.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113334): https://edk2.groups.io/g/devel/message/113334
Mute This Topic: https://groups.io/mt/103360241/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH V2 1/1] Silicon/Intel/FitGen:FIT change for FBM entry.

2023-12-17 Thread Yuwei Chen
Reviewed-by: Yuwei Chen 

> -Original Message-
> From: Liu, Liqi 
> Sent: Tuesday, December 12, 2023 4:42 PM
> To: devel@edk2.groups.io
> Cc: Liu, Liqi ; Chen, Christine ;
> Feng, Bob C ; Chaganty, Rangasai V
> ; Gao, Liming 
> Subject: [PATCH V2 1/1] Silicon/Intel/FitGen:FIT change for FBM entry.
> 
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4621
> 
> 1)Refer to FIT spec change, add a new entry in FIT table - FSP Boot
> Manifest(Type 0xD) to store the location of FBM.
> 2)We found that 0xD was occupied by FIT_TABLE_TYPE_BIOS_DATA_AREA.
> But all FIT specs in archive show record 0xD as reserved.After confirming with
> architect,we will use 0xD for FBM and update FitGen.c accordingly.
> 
> Signed-off-by: Liqi Liu 
> Cc: Chen Christine 
> Cc: Feng Bob C 
> Cc: Chagnanty Rangasai V 
> Cc: Liming Gao 
> ---
>  .../IndustryStandard/FirmwareInterfaceTable.h|  1 +
>  Silicon/Intel/Tools/FitGen/FitGen.c  | 16 
>  2 files changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git
> a/Silicon/Intel/IntelSiliconPkg/Include/IndustryStandard/FirmwareInterfaceTa
> ble.h
> b/Silicon/Intel/IntelSiliconPkg/Include/IndustryStandard/FirmwareInterfaceTa
> ble.h
> index f65779eb3778..27d83f5f72ea 100644
> ---
> a/Silicon/Intel/IntelSiliconPkg/Include/IndustryStandard/FirmwareInterfaceTa
> ble.h
> +++ b/Silicon/Intel/IntelSiliconPkg/Include/IndustryStandard/FirmwareInt
> +++ erfaceTable.h
> @@ -24,6 +24,7 @@
>  #define FIT_TYPE_0A_TXT_POLICY  0x0A
>  #define FIT_TYPE_0B_KEY_MANIFEST0x0B
>  #define FIT_TYPE_0C_BOOT_POLICY_MANIFEST0x0C
> +#define FIT_TYPE_0D_FSP_BOOT_MANIFEST   0x0D
>  #define FIT_TYPE_10_CSE_SECURE_BOOT 0x10
>  #define FIT_TYPE_2D_TXTSX_POLICY0x2D
>  #define FIT_TYPE_2F_JMP_DEBUG_POLICY0x2F
> diff --git a/Silicon/Intel/Tools/FitGen/FitGen.c
> b/Silicon/Intel/Tools/FitGen/FitGen.c
> index 16c8b9b026f5..055ffd4cf8b9 100644
> --- a/Silicon/Intel/Tools/FitGen/FitGen.c
> +++ b/Silicon/Intel/Tools/FitGen/FitGen.c
> @@ -285,7 +285,7 @@ typedef struct {
>  #define FIT_TABLE_TYPE_TXT_POLICY  10
>  #define FIT_TABLE_TYPE_KEY_MANIFEST11
>  #define FIT_TABLE_TYPE_BOOT_POLICY_MANIFEST12
> -#define FIT_TABLE_TYPE_BIOS_DATA_AREA  13
> +#define FIT_TABLE_TYPE_FSP_BOOT_MANIFEST   13
>  #define FIT_TABLE_TYPE_CSE_SECURE_BOOT 16
>  #define FIT_TABLE_SUBTYPE_FIT_PATCH_MANIFEST   12
>  #define FIT_TABLE_SUBTYPE_ACM_MANIFEST 13
> @@ -1444,7 +1444,7 @@ GetFitEntryNumber (
>  case FIT_TABLE_TYPE_TXT_POLICY:
>  case FIT_TABLE_TYPE_KEY_MANIFEST:
>  case FIT_TABLE_TYPE_BOOT_POLICY_MANIFEST:
> -case FIT_TABLE_TYPE_BIOS_DATA_AREA:
> +case FIT_TABLE_TYPE_FSP_BOOT_MANIFEST:
>  case FIT_TABLE_TYPE_CSE_SECURE_BOOT:
>  default :
>if (BiosInfoStruct[BiosInfoIndex].Version != 0) { @@ -2126,7 
> +2126,7
> @@ GetFitEntryNumber (
>  if ((gFitTableContext.OptionalModule[Index].Type ==
> FIT_TABLE_TYPE_BIOS_POLICY) ||
>  (gFitTableContext.OptionalModule[Index].Type ==
> FIT_TABLE_TYPE_KEY_MANIFEST) ||
>  (gFitTableContext.OptionalModule[Index].Type ==
> FIT_TABLE_TYPE_BOOT_POLICY_MANIFEST) ||
> -(gFitTableContext.OptionalModule[Index].Type ==
> FIT_TABLE_TYPE_BIOS_DATA_AREA) ||
> +(gFitTableContext.OptionalModule[Index].Type ==
> + FIT_TABLE_TYPE_FSP_BOOT_MANIFEST) ||
>  (gFitTableContext.OptionalModule[Index].Type ==
> FIT_TABLE_TYPE_CSE_SECURE_BOOT) ||
>  (gFitTableContext.OptionalModule[Index].Type ==
> FIT_TABLE_TYPE_VAB_PROVISION_TABLE) ||
>  (gFitTableContext.OptionalModule[Index].Type ==
> FIT_TABLE_TYPE_VAB_BOOT_IMAGE_MANIFEST) || @@ -2311,7 +2311,7
> @@ GetFreeSpaceForFit (
>if ((gFitTableContext.OptionalModule[Index].Type ==
> FIT_TABLE_TYPE_BIOS_POLICY) ||
>(gFitTableContext.OptionalModule[Index].Type ==
> FIT_TABLE_TYPE_KEY_MANIFEST) ||
>(gFitTableContext.OptionalModule[Index].Type ==
> FIT_TABLE_TYPE_BOOT_POLICY_MANIFEST) ||
> -  (gFitTableContext.OptionalModule[Index].Type ==
> FIT_TABLE_TYPE_BIOS_DATA_AREA) ||
> +  (gFitTableContext.OptionalModule[Index].Type ==
> + FIT_TABLE_TYPE_FSP_BOOT_MANIFEST) ||
>(gFitTableContext.OptionalModule[Index].Type ==
> FIT_TABLE_TYPE_CSE_SECURE_BOOT) ||
>(gFitTableContext.OptionalModule[Index].Type ==
> FIT_TABLE_TYPE_VAB_PROVISION_TABLE) ||
>(gFitTableContext.OptionalModule[Index].Type ==
> FIT_TABLE_TYPE_VAB_BOOT_IMAGE_MANIFEST) || @@ -2326,7 +2326,7
&

Re: [edk2-devel] [PATCH] BaseTools: FMMT GuidTool Auto Select Config file Enabling

2023-12-15 Thread Yuwei Chen
Edk2-basetools repo PR link: 
https://github.com/tianocore/edk2-basetools/pull/100

Thanks,
Christine

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Yuwei
> Chen
> Sent: Friday, December 15, 2023 5:12 PM
> To: devel@edk2.groups.io
> Cc: Rebecca Cran ; Gao, Liming
> ; Feng, Bob C 
> Subject: [edk2-devel] [PATCH] BaseTools: FMMT GuidTool Auto Select Config
> file Enabling
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4624
> 
> Currently, Python FMMT tool does not support automatically select
> FMMTConf.ini file which saves GuidTool settings.
> This patch supports this features.
> 
> Cc: Rebecca Cran 
> Cc: Liming Gao 
> Cc: Bob Feng 
> 
> Signed-off-by: Yuwei Chen 
> ---
>  BaseTools/Source/Python/FMMT/core/GuidTools.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Source/Python/FMMT/core/GuidTools.py
> b/BaseTools/Source/Python/FMMT/core/GuidTools.py
> index a25681709b..f6bdeffa50 100644
> --- a/BaseTools/Source/Python/FMMT/core/GuidTools.py
> +++ b/BaseTools/Source/Python/FMMT/core/GuidTools.py
> @@ -110,7 +110,7 @@ class GUIDTools:
>  if os.environ['FmmtConfPath']: self.tooldef_file =
> os.path.join(os.environ['FmmtConfPath'], 'FmmtConf.ini') else:-
> PathList = os.environ['PATH']+PathList =
> os.environ['PATH'].split(os.pathsep) for CurrentPath in PathList:
> if os.path.exists(os.path.join(CurrentPath, 'FmmtConf.ini')):
> self.tooldef_file = os.path.join(CurrentPath, 'FmmtConf.ini')--
> 2.42.0.windows.2
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#112587):
> https://edk2.groups.io/g/devel/message/112587
> Mute This Topic: https://groups.io/mt/103187642/4546272
> Group Owner: devel+ow...@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [yuwei.c...@intel.com] -
> =-=-=-=-=-=
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112588): https://edk2.groups.io/g/devel/message/112588
Mute This Topic: https://groups.io/mt/103187642/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] BaseTools: FMMT GuidTool Auto Select Config file Enabling

2023-12-15 Thread Yuwei Chen
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4624

Currently, Python FMMT tool does not support automatically
select FMMTConf.ini file which saves GuidTool settings.
This patch supports this features.

Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 

Signed-off-by: Yuwei Chen 
---
 BaseTools/Source/Python/FMMT/core/GuidTools.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/FMMT/core/GuidTools.py 
b/BaseTools/Source/Python/FMMT/core/GuidTools.py
index a25681709b..f6bdeffa50 100644
--- a/BaseTools/Source/Python/FMMT/core/GuidTools.py
+++ b/BaseTools/Source/Python/FMMT/core/GuidTools.py
@@ -110,7 +110,7 @@ class GUIDTools:
 if os.environ['FmmtConfPath']:
 self.tooldef_file = os.path.join(os.environ['FmmtConfPath'], 
'FmmtConf.ini')
 else:
-PathList = os.environ['PATH']
+PathList = os.environ['PATH'].split(os.pathsep)
 for CurrentPath in PathList:
 if os.path.exists(os.path.join(CurrentPath, 'FmmtConf.ini')):
 self.tooldef_file = os.path.join(CurrentPath, 
'FmmtConf.ini')
-- 
2.42.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112587): https://edk2.groups.io/g/devel/message/112587
Mute This Topic: https://groups.io/mt/103187642/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError Feature

2023-12-12 Thread Yuwei Chen
+Cc Yang, Yuting2

> -Original Message-
> From: Yang, Yuting2 
> Sent: Tuesday, December 12, 2023 5:01 PM
> To: devel@edk2.groups.io
> Cc: Rebecca Cran ; Gao, Liming
> ; Feng, Bob C ; Chen,
> Christine 
> Subject: [Patch V2] BaseTools: VfrCompiler Adds DefaultValueError Feature
> 
> Add --catch_default option
> Raise a DefaultValueError when encountering VFR default definitions to help
> remove default variables.
> Add --except_list option
> Exclude packages that don't require enabling the catch_default function.
> 
> Cc: Rebecca Cran 
> Cc: Liming Gao 
> Cc: Bob Feng 
> Cc: Christine Chen 
> Cc: Yuting Yang 
> 
> Signed-off-by: Yuting Yang 
> ---
>  BaseTools/Source/C/VfrCompile/VfrCompiler.cpp |  40 ++-
>  BaseTools/Source/C/VfrCompile/VfrCompiler.h   |   3 +
>  BaseTools/Source/C/VfrCompile/VfrError.cpp|   3 +-
>  BaseTools/Source/C/VfrCompile/VfrError.h  |   3 +-
>  BaseTools/Source/C/VfrCompile/VfrFormPkg.h|   1 +
>  BaseTools/Source/C/VfrCompile/VfrSyntax.g | 238 ++
>  6 files changed, 184 insertions(+), 104 deletions(-)
> 
> diff --git a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> index 5f4d262d85..e97cebff65 100644
> --- a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> +++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
> @@ -78,6 +78,9 @@ CVfrCompiler::OptionInitialization (
>mOptions.WarningAsError= FALSE;   mOptions.AutoDefault
> = FALSE;   mOptions.CheckDefault  = FALSE;+
> mOptions.IsCatchDefaultEnable  = FALSE;+  mOptions.ExceptionList
> = NULL;+  mOptions.ExceptionListSize = 0;   memset
> (, 0, sizeof (EFI_GUID));if (Argc == 1) {@@ -
> 95,6 +98,23 @@ CVfrCompiler::OptionInitialization (
>Version ();   SET_RUN_STATUS (STATUS_DEAD);   return;+} 
> else if
> (stricmp(Argv[Index], "--catch_default") == 0){+
> mOptions.IsCatchDefaultEnable = TRUE;+} else if (stricmp(Argv[Index], "--
> except_list") == 0){+  INT32 Start = ++Index;+  if ((Start >= Argc) ||
> (Argv[Start][0] == '-')) {+DebugError (NULL, 0, 1001, "Missing 
> option", "-
> exception_list missing except list");+goto Fail;+  }+  while
> ((Argv[Index][0] != '-') && (Index < Argc - 1)) {+Index++;+  }+   
>INT32
> End = Index--;+  mOptions.ExceptionListSize = End - Start;+  for 
> (INT32 i =
> Start; i < End; i++) {+mOptions.ExceptionList = (CHAR8**)
> realloc(mOptions.ExceptionList, (i - Start + 1) * sizeof(CHAR8*));+
> mOptions.ExceptionList[i-Start] = Argv[i];+  } } else if 
> (stricmp(Argv[Index],
> "-l") == 0) {   mOptions.CreateRecordListFile = TRUE;
> gCIfrRecordInfoDB.TurnOn ();@@ -179,7 +199,11 @@
> CVfrCompiler::OptionInitialization (
>goto Fail; } strcpy (mOptions.VfrFileName, Argv[Index]);-+
> for (int i =
> 0; i < mOptions.ExceptionListSize; i++) {+  if 
> (strstr(mOptions.VfrFileName,
> mOptions.ExceptionList[i]) != NULL) {+mOptions.IsCatchDefaultEnable =
> FALSE;+  }+} if (mOptions.OutputDirectory == NULL)
> {   mOptions.OutputDirectory = (CHAR8 *) malloc (1);   if
> (mOptions.OutputDirectory == NULL) {@@ -217,6 +241,11 @@ Fail:
>  free (mOptions.VfrFileName); mOptions.VfrFileName =
> NULL;   }+  if (mOptions.ExceptionList != NULL) {+
> free(mOptions.ExceptionList);+mOptions.ExceptionList   = 
> NULL;++  }
> if (mOptions.VfrBaseFileName != NULL) { free (mOptions.VfrBaseFileName);
> mOptions.VfrBaseFileName = NULL;@@ -496,6 +525,11 @@
> CVfrCompiler::~CVfrCompiler (
>  mOptions.VfrBaseFileName = NULL;   } +  if (mOptions.ExceptionList !=
> NULL) {+free (mOptions.ExceptionList);+mOptions.ExceptionList =
> NULL;+  }+   if (mOptions.OutputDirectory != NULL) { free
> (mOptions.OutputDirectory); mOptions.OutputDirectory = NULL;@@ -679,7
> +713,7 @@ CVfrCompiler::Compile (
>  DebugError (NULL, 0, 0001, "Error opening the input file", "%s",
> InFileName); goto Fail;   }-+  InputInfo.IsCatchDefaultEnable =
> mOptions.IsCatchDefaultEnable;   if (mOptions.HasOverrideClassGuid)
> { InputInfo.OverrideClassGuid =} else
> {@@ -937,5 +971,3 @@ main (
> return GetUtilityStatus (); }--diff --git
> a/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> b/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> index b6e207d2ce..39e0a89a29 100644
> --- a/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> +++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.h
> @@ -52,6 +52,9 @@ typedef struct {
>BOOLEAN WarningAsError;   BOOLEAN AutoDefault;   BOOLEAN
> CheckDefault;+  BOOLEAN IsCatchDefaultEnable;+  CHAR8**  ExceptionList;+
> INT16ExceptionListSize; } OPTIONS;  typedef enum {diff --git
> a/BaseTools/Source/C/VfrCompile/VfrError.cpp
> b/BaseTools/Source/C/VfrCompile/VfrError.cpp
> index 65bb8e34fd..8a706f929b 100644
> --- a/BaseTools/Source/C/VfrCompile/VfrError.cpp
> 

Re: [edk2-devel] [Patch V2 1/4] BaseTools: fixing FMMT ShrinkFv issue

2023-12-11 Thread Yuwei Chen
Thanks a lot~

> -Original Message-
> From: gaoliming 
> Sent: Monday, December 11, 2023 5:04 PM
> To: Chen, Christine ; devel@edk2.groups.io; Feng,
> Bob C 
> Cc: 'Rebecca Cran' ; Guo, Gua 
> Subject: 回复: [edk2-devel] [Patch V2 1/4] BaseTools: fixing FMMT ShrinkFv
> issue
> 
> Christine:
>   I add PUSH label for this PR.
> 
> Thanks
> Liming
> > -邮件原件-
> > 发件人: Chen, Christine 
> > 发送时间: 2023年12月4日 10:59
> > 收件人: Gao, Liming ; devel@edk2.groups.io;
> > Feng, Bob C 
> > 抄送: 'Rebecca Cran' ; Guo, Gua
> 
> > 主题: RE: [edk2-devel] [Patch V2 1/4] BaseTools: fixing FMMT ShrinkFv
> > issue
> >
> > Hi Liming,
> > To avoid wrong operation. I create a new PR for this patch series with
> > Reviewed-by.
> > Please help adding push label. Thanks.
> > https://github.com/tianocore/edk2/pull/5102
> >
> > Thanks,
> > Christine
> >
> > > -Original Message-
> > > From: gaoliming 
> > > Sent: Wednesday, November 29, 2023 11:53 PM
> > > To: devel@edk2.groups.io; Chen, Christine ;
> > > Feng, Bob C 
> > > Cc: 'Rebecca Cran' ; Guo, Gua
> 
> > > Subject: 回复: [edk2-devel] [Patch V2 1/4] BaseTools: fixing FMMT
> > ShrinkFv
> > > issue
> > >
> > > Yuwei:
> > >   Please update commit message with reviewed-by info, then I will
> > > add
> > push
> > > label for this patch set.
> > >
> > > Thanks
> > > Liming
> > > > -邮件原件-
> > > > 发件人: devel@edk2.groups.io  代表 Yuwei
> > Chen
> > > > 发送时间: 2023年11月29日 16:26
> > > > 收件人: Gao, Liming ; Feng, Bob C
> > > > 
> > > > 抄送: 'Rebecca Cran' ; devel@edk2.groups.io;
> > Chen,
> > > > Christine ; Guo, Gua 
> > > > 主题: Re: [edk2-devel] [Patch V2 1/4] BaseTools: fixing FMMT
> > > > ShrinkFv issue
> > > >
> > > > Hi Liming and Cran,
> > > >
> > > > I have created the Edk2 PR for this one:
> > > > https://github.com/tianocore/edk2/pull/5009
> > > > As it has been reviewed, please help merge that. Thanks~
> > > >
> > > > Thanks,
> > > > Yuwei (Christine)
> > > >
> > > > > -Original Message-
> > > > > From: devel@edk2.groups.io  On Behalf Of
> > Yuwei
> > > > > Chen
> > > > > Sent: Monday, September 11, 2023 9:23 AM
> > > > > To: Gao, Liming ;
> > > > > devel@edk2.groups.io; Feng, Bob C 
> > > > > Cc: 'Rebecca Cran' 
> > > > > Subject: Re: [edk2-devel] [Patch V2 1/4] BaseTools: fixing FMMT
> > > > > ShrinkFv issue
> > > > >
> > > > > Thanks liming~ Hope it will be merged soon~ 
> > > > >
> > > > > Many thanks,
> > > > > Christine
> > > > >
> > > > > > -Original Message-
> > > > > > From: gaoliming 
> > > > > > Sent: Wednesday, August 30, 2023 4:43 PM
> > > > > > To: devel@edk2.groups.io; Feng, Bob C ;
> > > > > > Chen, Christine 
> > > > > > Cc: 'Rebecca Cran' 
> > > > > > Subject: 回复: [edk2-devel] [Patch V2 1/4] BaseTools: fixing
> > > > > > FMMT ShrinkFv issue
> > > > > >
> > > > > > Christine:
> > > > > >   I have no comments for this patch set. Reviewed-by: Liming
> > > > > > Gao 
> > > > > >
> > > > > > Thanks
> > > > > > Liming
> > > > > > > -邮件原件-
> > > > > > > 发件人: devel@edk2.groups.io  代表 Bob
> > > > Feng
> > > > > > > 发送时间: 2023年6月29日 14:54
> > > > > > > 收件人: Chen, Christine ;
> > > > devel@edk2.groups.io
> > > > > > > 抄送: Rebecca Cran ; Gao, Liming
> > > > > > > 
> > > > > > > 主题: Re: [edk2-devel] [Patch V2 1/4] BaseTools: fixing FMMT
> > > > > > > ShrinkFv
> > > > > > issue
> > > > > > >
> > > > > > > Reviewed-by: Bob Feng 
> > > > > > >
> > > > > > > -Original Message-
> > > > > > > From: Chen, Christine 
> > > > > > > Sent: Thursday, June 29, 2023 11:34 AM
> > > > > > > To: devel@edk2.groups.io
> > > > > > > Cc: Rebecca C

[edk2-devel] [PATCH] [edk2-staging]BaseTools: Python VfrCompiler Tool Update

2023-12-07 Thread Yuwei Chen



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112216): https://edk2.groups.io/g/devel/message/112216
Mute This Topic: https://groups.io/mt/103051162/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [edk2-stable202311][PATCH] BaseTools: Python VfrCompiler implementation

2023-12-07 Thread Yuwei Chen
Hi Liming,

Is this feature been tested and reviewed these two weeks? 

Thanks,
Christine
From: devel@edk2.groups.io  On Behalf Of Yuwei Chen
Sent: Monday, November 13, 2023 8:32 AM
To: Gao, Liming ; 'Rebecca Cran' ; 
Gao, Liming ; Zimmer, Vincent 
; Kinney, Michael D ; 
'Leif Lindholm' ; 'Andrew Fish' 
Cc: Feng, Bob C ; Yang, Yuting2 ; 
devel@edk2.groups.io; Hartung, Stephen 
Subject: Re: [edk2-devel] [edk2-stable202311][PATCH] BaseTools: Python 
VfrCompiler implementation

Hi Liming,

I know your point. Would you like to start reviewing it and give us more 
feedbacks? We really hope it can be merged as soon as possible.
We can do the merging after the stable tag, but just like you said, maybe we 
need to review it firstly.

Looking forward to your feedbacks, and I think this one is a very big step for 
BaseTools. Thanks a lot for your help and contribution on this.
I have created a BZ for this feature: 
https://bugzilla.tianocore.org/show_bug.cgi?id=4596
Will update the patch with Bugzilla link. (This step should not influence the 
reviewing)

Thanks,
Christine

From: gaoliming mailto:gaolim...@byosoft.com.cn>>
Sent: Thursday, November 9, 2023 10:19 PM
To: 'Rebecca Cran' mailto:rebe...@bsdio.com>>; Gao, Liming 
mailto:gaolim...@byosoft.com.cn>>; Zimmer, Vincent 
mailto:vincent.zim...@intel.com>>; Chen, Christine 
mailto:yuwei.c...@intel.com>>; Kinney, Michael D 
mailto:michael.d.kin...@intel.com>>; 'Leif 
Lindholm' mailto:quic_llind...@quicinc.com>>; 
'Andrew Fish' mailto:af...@apple.com>>
Cc: Feng, Bob C mailto:bob.c.f...@intel.com>>; Yang, 
Yuting2 mailto:yuting2.y...@intel.com>>; 
devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Hartung, Stephen 
mailto:stephen.hart...@intel.com>>
Subject: RE: [edk2-stable202311][PATCH] BaseTools: Python VfrCompiler 
implementation


Christine:

 I can’t directly reply to the original mail because it is too large. This is a 
new feature to add python version VfrCompiler. I don’t think we have enough 
time to review the design and implementation. Although it has no real impact, 
its code may have many change in future. So, I suggest to merge it after this 
stable tag.



Thanks

Liming



Below is your request.



Hi Liming and Cran,



Could you help on quick reviewing this new VfrCompiler python tool, it has the 
same functions with origin C version VfrCompiler, meanwhile it supports more 
new features such as generated Vfr files config info into Yaml format.



This feature is urgent for us to use, and we really hope it can be merged into 
this stable tag. This patch is linked to the edk2-basetools PR: 
https://github.com/tianocore/edk2-basetools/pull/109. We list all the known 
issues which will be enhanced in the ReadMe file. And will enhance them one by 
one after the patch merged.



For the code quality, in this patch, the new tool is not enabled in build 
process, it just saves in the basetools python folder, which will not influence 
the current edk2 behaviors. We will enable it with a new patch when everything 
is ready.



Many thanks~



Hi Vincent, please help add more information if necessary~ Thanks a lot~



Thanks,

Christine




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112173): https://edk2.groups.io/g/devel/message/112173
Mute This Topic: https://groups.io/mt/102486097/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [Patch V2 1/4] BaseTools: fixing FMMT ShrinkFv issue

2023-12-03 Thread Yuwei Chen
Hi Liming,
To avoid wrong operation. I create a new PR for this patch series with 
Reviewed-by. 
Please help adding push label. Thanks.
https://github.com/tianocore/edk2/pull/5102

Thanks,
Christine

> -Original Message-
> From: gaoliming 
> Sent: Wednesday, November 29, 2023 11:53 PM
> To: devel@edk2.groups.io; Chen, Christine ; Feng,
> Bob C 
> Cc: 'Rebecca Cran' ; Guo, Gua 
> Subject: 回复: [edk2-devel] [Patch V2 1/4] BaseTools: fixing FMMT ShrinkFv
> issue
> 
> Yuwei:
>   Please update commit message with reviewed-by info, then I will add push
> label for this patch set.
> 
> Thanks
> Liming
> > -----邮件原件-
> > 发件人: devel@edk2.groups.io  代表 Yuwei Chen
> > 发送时间: 2023年11月29日 16:26
> > 收件人: Gao, Liming ; Feng, Bob C
> > 
> > 抄送: 'Rebecca Cran' ; devel@edk2.groups.io; Chen,
> > Christine ; Guo, Gua 
> > 主题: Re: [edk2-devel] [Patch V2 1/4] BaseTools: fixing FMMT ShrinkFv
> > issue
> >
> > Hi Liming and Cran,
> >
> > I have created the Edk2 PR for this one:
> > https://github.com/tianocore/edk2/pull/5009
> > As it has been reviewed, please help merge that. Thanks~
> >
> > Thanks,
> > Yuwei (Christine)
> >
> > > -Original Message-
> > > From: devel@edk2.groups.io  On Behalf Of Yuwei
> > > Chen
> > > Sent: Monday, September 11, 2023 9:23 AM
> > > To: Gao, Liming ; devel@edk2.groups.io;
> > > Feng, Bob C 
> > > Cc: 'Rebecca Cran' 
> > > Subject: Re: [edk2-devel] [Patch V2 1/4] BaseTools: fixing FMMT
> > > ShrinkFv issue
> > >
> > > Thanks liming~ Hope it will be merged soon~ 
> > >
> > > Many thanks,
> > > Christine
> > >
> > > > -Original Message-
> > > > From: gaoliming 
> > > > Sent: Wednesday, August 30, 2023 4:43 PM
> > > > To: devel@edk2.groups.io; Feng, Bob C ;
> > > > Chen, Christine 
> > > > Cc: 'Rebecca Cran' 
> > > > Subject: 回复: [edk2-devel] [Patch V2 1/4] BaseTools: fixing FMMT
> > > > ShrinkFv issue
> > > >
> > > > Christine:
> > > >   I have no comments for this patch set. Reviewed-by: Liming Gao
> > > > 
> > > >
> > > > Thanks
> > > > Liming
> > > > > -邮件原件-
> > > > > 发件人: devel@edk2.groups.io  代表 Bob
> > Feng
> > > > > 发送时间: 2023年6月29日 14:54
> > > > > 收件人: Chen, Christine ;
> > devel@edk2.groups.io
> > > > > 抄送: Rebecca Cran ; Gao, Liming
> > > > > 
> > > > > 主题: Re: [edk2-devel] [Patch V2 1/4] BaseTools: fixing FMMT
> > > > > ShrinkFv
> > > > issue
> > > > >
> > > > > Reviewed-by: Bob Feng 
> > > > >
> > > > > -Original Message-
> > > > > From: Chen, Christine 
> > > > > Sent: Thursday, June 29, 2023 11:34 AM
> > > > > To: devel@edk2.groups.io
> > > > > Cc: Rebecca Cran ; Gao, Liming
> > > > > ; Feng, Bob C 
> > > > > Subject: [Patch V2 1/4] BaseTools: fixing FMMT ShrinkFv issue
> > > > >
> > > > > 1. FvLength not change issue;
> > > > > 2. FileSystemGuid align with File Size;
> > > > >
> > > > > Cc: Rebecca Cran 
> > > > > Cc: Liming Gao 
> > > > > Cc: Bob Feng 
> > > > > Signed-off-by: Yuwei Chen 
> > > > > ---
> > > > >  BaseTools/Source/Python/FMMT/core/FMMTOperation.py |  2 +-
> > > > >  BaseTools/Source/Python/FMMT/core/FvHandler.py | 10
> > +++---
> > > > >  2 files changed, 8 insertions(+), 4 deletions(-)
> > > > >
> > > > > diff --git a/BaseTools/Source/Python/FMMT/core/FMMTOperation.py
> > > > > b/BaseTools/Source/Python/FMMT/core/FMMTOperation.py
> > > > > index a86f8dda9a1a..d4aa3397036d 100644
> > > > > --- a/BaseTools/Source/Python/FMMT/core/FMMTOperation.py
> > > > > +++ b/BaseTools/Source/Python/FMMT/core/FMMTOperation.py
> > > > > @@ -188,7 +188,7 @@ def ExtractFfs(inputfile: str, Ffs_name:
> > > > > str,
> > > > outputfile:
> > > > > str, Fv_name: str=None
> > > > >
> > > > >
> > FmmtParser.WholeFvTree.Findlist.remove(FmmtParser.WholeFvTree.Findli
> > > > > st
> > > > > [i
> > > > > ndex])
> > > > >  if FmmtParser.WholeFvTree.Findlist != []

Re: [edk2-devel] [Patch V2 1/4] BaseTools: fixing FMMT ShrinkFv issue

2023-11-29 Thread Yuwei Chen
Hi Liming and Cran,

I have created the Edk2 PR for this one: 
https://github.com/tianocore/edk2/pull/5009
As it has been reviewed, please help merge that. Thanks~

Thanks,
Yuwei (Christine)

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Yuwei
> Chen
> Sent: Monday, September 11, 2023 9:23 AM
> To: Gao, Liming ; devel@edk2.groups.io; Feng,
> Bob C 
> Cc: 'Rebecca Cran' 
> Subject: Re: [edk2-devel] [Patch V2 1/4] BaseTools: fixing FMMT ShrinkFv
> issue
> 
> Thanks liming~ Hope it will be merged soon~ 
> 
> Many thanks,
> Christine
> 
> > -Original Message-
> > From: gaoliming 
> > Sent: Wednesday, August 30, 2023 4:43 PM
> > To: devel@edk2.groups.io; Feng, Bob C ; Chen,
> > Christine 
> > Cc: 'Rebecca Cran' 
> > Subject: 回复: [edk2-devel] [Patch V2 1/4] BaseTools: fixing FMMT
> > ShrinkFv issue
> >
> > Christine:
> >   I have no comments for this patch set. Reviewed-by: Liming Gao
> > 
> >
> > Thanks
> > Liming
> > > -邮件原件-
> > > 发件人: devel@edk2.groups.io  代表 Bob Feng
> > > 发送时间: 2023年6月29日 14:54
> > > 收件人: Chen, Christine ; devel@edk2.groups.io
> > > 抄送: Rebecca Cran ; Gao, Liming
> > > 
> > > 主题: Re: [edk2-devel] [Patch V2 1/4] BaseTools: fixing FMMT ShrinkFv
> > issue
> > >
> > > Reviewed-by: Bob Feng 
> > >
> > > -Original Message-
> > > From: Chen, Christine 
> > > Sent: Thursday, June 29, 2023 11:34 AM
> > > To: devel@edk2.groups.io
> > > Cc: Rebecca Cran ; Gao, Liming
> > > ; Feng, Bob C 
> > > Subject: [Patch V2 1/4] BaseTools: fixing FMMT ShrinkFv issue
> > >
> > > 1. FvLength not change issue;
> > > 2. FileSystemGuid align with File Size;
> > >
> > > Cc: Rebecca Cran 
> > > Cc: Liming Gao 
> > > Cc: Bob Feng 
> > > Signed-off-by: Yuwei Chen 
> > > ---
> > >  BaseTools/Source/Python/FMMT/core/FMMTOperation.py |  2 +-
> > >  BaseTools/Source/Python/FMMT/core/FvHandler.py | 10 +++---
> > >  2 files changed, 8 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/BaseTools/Source/Python/FMMT/core/FMMTOperation.py
> > > b/BaseTools/Source/Python/FMMT/core/FMMTOperation.py
> > > index a86f8dda9a1a..d4aa3397036d 100644
> > > --- a/BaseTools/Source/Python/FMMT/core/FMMTOperation.py
> > > +++ b/BaseTools/Source/Python/FMMT/core/FMMTOperation.py
> > > @@ -188,7 +188,7 @@ def ExtractFfs(inputfile: str, Ffs_name: str,
> > outputfile:
> > > str, Fv_name: str=None
> > >
> > > FmmtParser.WholeFvTree.Findlist.remove(FmmtParser.WholeFvTree.Findli
> > > st
> > > [i
> > > ndex])
> > >  if FmmtParser.WholeFvTree.Findlist != []:
> > >  TargetNode = FmmtParser.WholeFvTree.Findlist[0]
> > > -if TargetNode.type == FV_TREE or SEC_FV_TREE or
> > > DATA_FV_TREE:
> > > +if TargetNode.type == FV_TREE or TargetNode.type ==
> > > SEC_FV_TREE or TargetNode.type == DATA_FV_TREE:
> > >  FinalData = struct2stream(TargetNode.Data.Header) +
> > > TargetNode.Data.Data
> > >  with open(outputfile, "wb") as f:
> > >  f.write(FinalData)
> > > diff --git a/BaseTools/Source/Python/FMMT/core/FvHandler.py
> > > b/BaseTools/Source/Python/FMMT/core/FvHandler.py
> > > index ff3d637623f8..b0cc1951a1c6 100644
> > > --- a/BaseTools/Source/Python/FMMT/core/FvHandler.py
> > > +++ b/BaseTools/Source/Python/FMMT/core/FvHandler.py
> > > @@ -279,7 +279,7 @@ class FvHandler:
> > >  ParTree.Child.remove(ParTree.Child[-1])
> > >  ParTree.Data.Free_Space = 0
> > >  ParTree.Data.Size += Needed_Space
> > > -ParTree.Data.Header.Fvlength =
> > > ParTree.Data.Size
> > > +ParTree.Data.Header.FvLength =
> > > ParTree.Data.Size
> > >  ModifyFvSystemGuid(ParTree)
> > >  for item in ParTree.Child:
> > >  if item.type == FFS_FREE_SPACE:
> > > @@ -650,8 +650,12 @@ class FvHandler:
> > >  Removed_Space = TargetFv.Data.Free_Space - New_Free_Space
> > >  TargetFv.Child[-1].Data.Data = b'\xff' * New_Free_Space
> > >  TargetFv.Data.Size -= Removed_Space
> > > -TargetFv.Data.Header.Fvlength = TargetFv.Data.Size
> &g

Re: [edk2-devel] [PATCH v1 1/1] BaseTools/Conf/target.template: Use VS2019 as default tool chain

2023-11-28 Thread Yuwei Chen
Reviewed-by: Yuwei Chen 

> -Original Message-
> From: mikub...@linux.microsoft.com 
> Sent: Wednesday, November 29, 2023 3:49 AM
> To: devel@edk2.groups.io
> Cc: Feng, Bob C ; Gao, Liming
> ; Rebecca Cran ; Chen,
> Christine 
> Subject: [PATCH v1 1/1] BaseTools/Conf/target.template: Use VS2019 as
> default tool chain
> 
> From: Michael Kubacki 
> 
> Updates the default tool chain from VS2015x86 to VS2019.
> 
> This is the VS tool chain used in CI and more likely to be installed on
> developer's systems. This is used in stuart commands when a toolchain is not
> explicitly specified.
> 
> Cc: Bob Feng 
> Cc: Liming Gao 
> Cc: Rebecca Cran 
> Cc: Yuwei Chen 
> Signed-off-by: Michael Kubacki 
> ---
>  BaseTools/Conf/target.template | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/BaseTools/Conf/target.template b/BaseTools/Conf/target.template
> index d4a3b53b7f3e..592febf55762 100644
> --- a/BaseTools/Conf/target.template
> +++ b/BaseTools/Conf/target.template
> @@ -22,8 +22,8 @@ ACTIVE_PLATFORM   = EmulatorPkg/EmulatorPkg.dsc
>  #  TARGETList   OptionalZero or more of the 
> following: DEBUG,
> RELEASE, NOOPT
>  #   UserDefined; separated by a 
> space character.
>  #   If the line is missing or no 
> value is specified, all
> -#   valid targets specified in 
> the platform description
> file
> -#   will attempt to be built. 
> The following line will
> build
> +#   valid targets specified in 
> the platform description
> file
> +#   will attempt to be built. 
> The following line will
> build
>  #   DEBUG platform target.
>  TARGET= DEBUG
> 
> @@ -32,7 +32,7 @@ TARGET= DEBUG
>  #   or AArch64.
>  #   Multiple values can be 
> specified on a single line,
> using
>  #   space characters to separate 
> the values.  These
> are used
> -#   during the parsing of a 
> platform description file,
> +#   during the parsing of a 
> platform description file,
>  #   restricting the build output 
> target(s.)
>  #   The Build Target ARCH is 
> determined by
> (precedence high to low):
>  # Command-line: -a ARCH 
> option
> @@ -51,7 +51,7 @@ TOOL_CHAIN_CONF   = Conf/tools_def.txt
>  #  TAGNAME   List  Optional   Specify the name(s) of the 
> tools_def.txt
> TagName to use.
>  # If not specified, all 
> applicable TagName tools will
> be
>  # used for the build.  The list 
> uses space character
> separation.
> -TOOL_CHAIN_TAG= VS2015x86
> +TOOL_CHAIN_TAG= VS2019
> 
>  # MAX_CONCURRENT_THREAD_NUMBER  NUMBER  Optional  The number
> of concurrent threads. If not specified or set
>  # to zero, tool 
> automatically detect number of
> processor
> @@ -64,7 +64,7 @@ TOOL_CHAIN_TAG= VS2015x86
> 
> 
>  # BUILD_RULE_CONF  Filename Optional  Specify the file name to use for the
> build rules that are followed
> -# when generating Makefiles. If not 
> specified, the file:
> +# when generating Makefiles. If not 
> specified, the file:
>  # WORKSPACE/Conf/build_rule.txt will be 
> used
>  BUILD_RULE_CONF = Conf/build_rule.txt
> 
> --
> 2.42.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111835): https://edk2.groups.io/g/devel/message/111835
Mute This Topic: https://groups.io/mt/102858057/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 1/1] BaseTools/Scripts/PatchCheck.py: Check for Change-id

2023-11-28 Thread Yuwei Chen
Ray do you mean set it as default checking?
It is a good point.

> -Original Message-
> From: Ni, Ray 
> Sent: Wednesday, November 29, 2023 8:56 AM
> To: devel@edk2.groups.io; Chen, Christine ; Pierre
> Gondois 
> Cc: Rebecca Cran ; Gao, Liming
> ; Feng, Bob C ; Sami
> Mujawar ; yeoreum@arm.com
> Subject: RE: [edk2-devel] [PATCH 1/1] BaseTools/Scripts/PatchCheck.py: Check
> for Change-id
> 
> It's good. But I am curious why --ignore-change-id is needed?
> 
> Thanks,
> Ray
> > -Original Message-
> > From: devel@edk2.groups.io  On Behalf Of Yuwei
> > Chen
> > Sent: Wednesday, November 29, 2023 8:23 AM
> > To: Pierre Gondois ; devel@edk2.groups.io
> > Cc: Rebecca Cran ; Gao, Liming
> > ; Feng, Bob C ; Sami
> > Mujawar ; yeoreum@arm.com
> > Subject: Re: [edk2-devel] [PATCH 1/1] BaseTools/Scripts/PatchCheck.py:
> > Check for Change-id
> >
> > The patch is good for me.
> >
> > Reviewed-by: Yuwei Chen 
> >
> > > -Original Message-
> > > From: Pierre Gondois 
> > > Sent: Wednesday, November 22, 2023 9:15 PM
> > > To: devel@edk2.groups.io
> > > Cc: Rebecca Cran ; Gao, Liming
> > > ; Feng, Bob C ;
> > > Chen, Christine ; Sami Mujawar
> > > ; yeoreum@arm.com
> > > Subject: [PATCH 1/1] BaseTools/Scripts/PatchCheck.py: Check for
> > > Change-id
> > >
> > > Code review tools like gerrit might use a 'Change-id' tag to track
> > > the evolution of patches. This tag should be removed before
> > > submitting a patch to the mailing-list.
> > > It has been observed that contributors sometimes forget to remove this
> tag.
> > > Add a check in PatchCheck.py to automate this.
> > >
> > > Also add a '--ignore-change-id' command line parameter to ignore the
> > > above check.
> > >
> > > Signed-off-by: Pierre Gondois 
> > > ---
> > >  BaseTools/Scripts/PatchCheck.py | 18 +-
> > >  1 file changed, 17 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/BaseTools/Scripts/PatchCheck.py
> > > b/BaseTools/Scripts/PatchCheck.py index 7f372d40b570..7770d1e37318
> > > 100755
> > > --- a/BaseTools/Scripts/PatchCheck.py
> > > +++ b/BaseTools/Scripts/PatchCheck.py
> > > @@ -3,7 +3,7 @@
> > >  # #  Copyright (c) 2015 - 2021, Intel Corporation. All rights
> > > reserved. # Copyright (C) 2020, Red Hat, Inc.-#  Copyright
> > > (c) 2020, ARM Ltd. All
> > rights
> > > reserved.+#  Copyright (c) 2020 - 2023, Arm Limited. All rights
> > > reserved. # #  SPDX-License-Identifier: BSD-2-Clause-Patent #@@
> > > -26,6
> > > +26,9 @@ class Verbose:
> > >  SILENT, ONELINE, NORMAL = range(3) level = NORMAL +class
> > > PatchCheckConf:+ignore_change_id = False+ class EmailAddressCheck:
> > > """Checks an email address.""" @@ -111,6 +114,8 @@ class
> > > CommitMessageCheck:
> > >  self.check_signed_off_by() 
> > > self.check_misc_signatures()
> > > self.check_overall_format()+if not
> PatchCheckConf.ignore_change_id:+
> > > self.check_change_id_format() self.report_message_result()  
> > > url =
> > > 'https://github.com/tianocore/tianocore.github.io/wiki/Commit-Messag
> > > e- Format'@@ -307,6 +312,12 @@ class CommitMessageCheck:
> > >  break last_sig_line = line.strip() +def
> > > check_change_id_format(self):+cid='Change-Id:'+if
> > > self.msg.find(cid) != -1:+self.error('\"%s\" found in commit
> > message:' %
> > > cid)+return+ (START, PRE_PATCH, PATCH) = range(3)  class
> > > GitDiffCheck:@@ -780,11 +791,16 @@ class PatchCheckApp:
> > >  group.add_argument("--silent",
> > > action="store_true",
> > > help="Print nothing")+group.add_argument("--ignore-change-id",+
> > > action="store_true",+   help="Ignore the presence 
> > > of
> 'Change-
> > > id:' tags in commit message") self.args = parser.parse_args() 
> > > if
> > > self.args.oneline: Verbose.level = Verbose.ONELINE if
> > > self.args.silent: Verbose.level = Verbose.SILENT+if
> > > self.args.ignore_change_id:+PatchCheckConf.ignore_change_id =
> True
> > > if __name__ == "__main__": sys.exit(PatchCheckApp().retval)--
> > > 2.25.1
> >
> >
> >
> > 
> >



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111833): https://edk2.groups.io/g/devel/message/111833
Mute This Topic: https://groups.io/mt/102748141/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 1/1] BaseTools/Scripts/PatchCheck.py: Check for Change-id

2023-11-28 Thread Yuwei Chen
The patch is good for me.

Reviewed-by: Yuwei Chen 

> -Original Message-
> From: Pierre Gondois 
> Sent: Wednesday, November 22, 2023 9:15 PM
> To: devel@edk2.groups.io
> Cc: Rebecca Cran ; Gao, Liming
> ; Feng, Bob C ; Chen,
> Christine ; Sami Mujawar
> ; yeoreum@arm.com
> Subject: [PATCH 1/1] BaseTools/Scripts/PatchCheck.py: Check for Change-id
> 
> Code review tools like gerrit might use a 'Change-id' tag to track the 
> evolution
> of patches. This tag should be removed before submitting a patch to the
> mailing-list.
> It has been observed that contributors sometimes forget to remove this tag.
> Add a check in PatchCheck.py to automate this.
> 
> Also add a '--ignore-change-id' command line parameter to ignore the above
> check.
> 
> Signed-off-by: Pierre Gondois 
> ---
>  BaseTools/Scripts/PatchCheck.py | 18 +-
>  1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Scripts/PatchCheck.py
> b/BaseTools/Scripts/PatchCheck.py index 7f372d40b570..7770d1e37318
> 100755
> --- a/BaseTools/Scripts/PatchCheck.py
> +++ b/BaseTools/Scripts/PatchCheck.py
> @@ -3,7 +3,7 @@
>  # #  Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved. #
> Copyright (C) 2020, Red Hat, Inc.-#  Copyright (c) 2020, ARM Ltd. All 
> rights
> reserved.+#  Copyright (c) 2020 - 2023, Arm Limited. All rights
> reserved. # #  SPDX-License-Identifier: BSD-2-Clause-Patent #@@ -26,6
> +26,9 @@ class Verbose:
>  SILENT, ONELINE, NORMAL = range(3) level = NORMAL +class
> PatchCheckConf:+ignore_change_id = False+ class EmailAddressCheck:
> """Checks an email address.""" @@ -111,6 +114,8 @@ class
> CommitMessageCheck:
>  self.check_signed_off_by() 
> self.check_misc_signatures()
> self.check_overall_format()+if not 
> PatchCheckConf.ignore_change_id:+
> self.check_change_id_format() self.report_message_result()  url =
> 'https://github.com/tianocore/tianocore.github.io/wiki/Commit-Message-
> Format'@@ -307,6 +312,12 @@ class CommitMessageCheck:
>  break last_sig_line = line.strip() +def
> check_change_id_format(self):+cid='Change-Id:'+if
> self.msg.find(cid) != -1:+self.error('\"%s\" found in commit 
> message:' %
> cid)+return+ (START, PRE_PATCH, PATCH) = range(3)  class
> GitDiffCheck:@@ -780,11 +791,16 @@ class PatchCheckApp:
>  group.add_argument("--silent",
> action="store_true",
> help="Print nothing")+group.add_argument("--ignore-change-id",+
> action="store_true",+   help="Ignore the presence of 
> 'Change-
> id:' tags in commit message") self.args = parser.parse_args() 
> if
> self.args.oneline: Verbose.level = Verbose.ONELINE if
> self.args.silent: Verbose.level = Verbose.SILENT+if
> self.args.ignore_change_id:+PatchCheckConf.ignore_change_id = True
> if __name__ == "__main__": sys.exit(PatchCheckApp().retval)--
> 2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111830): https://edk2.groups.io/g/devel/message/111830
Mute This Topic: https://groups.io/mt/102748141/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [edk2-stable202311][PATCH] BaseTools: Python VfrCompiler implementation

2023-11-12 Thread Yuwei Chen
Hi Liming,

I know your point. Would you like to start reviewing it and give us more 
feedbacks? We really hope it can be merged as soon as possible.
We can do the merging after the stable tag, but just like you said, maybe we 
need to review it firstly.

Looking forward to your feedbacks, and I think this one is a very big step for 
BaseTools. Thanks a lot for your help and contribution on this.
I have created a BZ for this feature: 
https://bugzilla.tianocore.org/show_bug.cgi?id=4596
Will update the patch with Bugzilla link. (This step should not influence the 
reviewing)

Thanks,
Christine

From: gaoliming 
Sent: Thursday, November 9, 2023 10:19 PM
To: 'Rebecca Cran' ; Gao, Liming ; 
Zimmer, Vincent ; Chen, Christine 
; Kinney, Michael D ; 'Leif 
Lindholm' ; 'Andrew Fish' 
Cc: Feng, Bob C ; Yang, Yuting2 ; 
devel@edk2.groups.io; Hartung, Stephen 
Subject: RE: [edk2-stable202311][PATCH] BaseTools: Python VfrCompiler 
implementation


Christine:

 I can't directly reply to the original mail because it is too large. This is a 
new feature to add python version VfrCompiler. I don't think we have enough 
time to review the design and implementation. Although it has no real impact, 
its code may have many change in future. So, I suggest to merge it after this 
stable tag.



Thanks

Liming



Below is your request.



Hi Liming and Cran,



Could you help on quick reviewing this new VfrCompiler python tool, it has the 
same functions with origin C version VfrCompiler, meanwhile it supports more 
new features such as generated Vfr files config info into Yaml format.



This feature is urgent for us to use, and we really hope it can be merged into 
this stable tag. This patch is linked to the edk2-basetools PR: 
https://github.com/tianocore/edk2-basetools/pull/109. We list all the known 
issues which will be enhanced in the ReadMe file. And will enhance them one by 
one after the patch merged.



For the code quality, in this patch, the new tool is not enabled in build 
process, it just saves in the basetools python folder, which will not influence 
the current edk2 behaviors. We will enable it with a new patch when everything 
is ready.



Many thanks~



Hi Vincent, please help add more information if necessary~ Thanks a lot~



Thanks,

Christine



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#15): https://edk2.groups.io/g/devel/message/15
Mute This Topic: https://groups.io/mt/102486097/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v3 2/7] BaseTools/Plugin/CodeQL: Add CodeQL build plugin

2023-10-24 Thread Yuwei Chen
Reviewed-by: Yuwei Chen 

> -Original Message-
> From: mikub...@linux.microsoft.com 
> Sent: Wednesday, October 18, 2023 9:05 AM
> To: devel@edk2.groups.io
> Cc: Feng, Bob C ; Gao, Liming
> ; Kinney, Michael D
> ; Rebecca Cran ; Sean
> Brogan ; Chen, Christine
> 
> Subject: [PATCH v3 2/7] BaseTools/Plugin/CodeQL: Add CodeQL build plugin
> 
> From: Michael Kubacki 
> 
> Adds a CodeQL plugin that supports CodeQL in the build system.
> 
> 1. CodeQlBuildPlugin - Generates a CodeQL database for a given build.
> 2. CodeQlAnalyzePlugin - Analyzes a CodeQL database and interprets
>results.
> 3. External dependencies - Assist with downloading the CodeQL CLI and
>making it available to the CodeQL plugins.
> 4. CodeQlQueries.qls - A C/C++ CodeQL query set run against the code.
> 5. Readme.md - A comprehensive readme file to help:
>- Platform integrators understand how to configure the plugin
>- Developers understand how to modify the plugin
>- Users understand how to use the plugin
> 
> Read Readme.md for additional details.
> 
> Cc: Bob Feng 
> Cc: Liming Gao 
> Cc: Michael D Kinney 
> Cc: Rebecca Cran 
> Cc: Sean Brogan 
> Cc: Yuwei Chen 
> Signed-off-by: Michael Kubacki 
> ---
>  BaseTools/Plugin/CodeQL/CodeQlAnalyzePlugin.py | 222 +++
>  BaseTools/Plugin/CodeQL/CodeQlAnalyze_plug_in.yaml |  13 +
>  BaseTools/Plugin/CodeQL/CodeQlBuildPlugin.py   | 172 +
>  BaseTools/Plugin/CodeQL/CodeQlBuild_plug_in.yaml   |  13 +
>  BaseTools/Plugin/CodeQL/CodeQlQueries.qls  |  75 
>  BaseTools/Plugin/CodeQL/Readme.md  | 388
> 
>  BaseTools/Plugin/CodeQL/analyze/__init__.py|   0
>  BaseTools/Plugin/CodeQL/analyze/analyze_filter.py  | 176 +
>  BaseTools/Plugin/CodeQL/analyze/globber.py | 132 +++
>  BaseTools/Plugin/CodeQL/codeqlcli_ext_dep.yaml |  26 ++
>  BaseTools/Plugin/CodeQL/codeqlcli_linux_ext_dep.yaml   |  24 ++
>  BaseTools/Plugin/CodeQL/codeqlcli_windows_ext_dep.yaml |  24 ++
>  BaseTools/Plugin/CodeQL/common/__init__.py |   0
>  BaseTools/Plugin/CodeQL/common/codeql_plugin.py|  74 
>  14 files changed, 1339 insertions(+)
> 
> diff --git a/BaseTools/Plugin/CodeQL/CodeQlAnalyzePlugin.py
> b/BaseTools/Plugin/CodeQL/CodeQlAnalyzePlugin.py
> new file mode 100644
> index ..199b0ad478ed
> --- /dev/null
> +++ b/BaseTools/Plugin/CodeQL/CodeQlAnalyzePlugin.py
> @@ -0,0 +1,222 @@
> +# @file CodeQAnalyzePlugin.py
> +#
> +# A build plugin that analyzes a CodeQL database.
> +#
> +# Copyright (c) Microsoft Corporation. All rights reserved.
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> +##
> +
> +import json
> +import logging
> +import os
> +import yaml
> +
> +from analyze import analyze_filter
> +from common import codeql_plugin
> +
> +from edk2toolext import edk2_logging
> +from edk2toolext.environment.plugintypes.uefi_build_plugin import \
> +IUefiBuildPlugin
> +from edk2toolext.environment.uefi_build import UefiBuilder
> +from edk2toollib.uefi.edk2.path_utilities import Edk2Path
> +from edk2toollib.utility_functions import RunCmd
> +from pathlib import Path
> +
> +
> +class CodeQlAnalyzePlugin(IUefiBuildPlugin):
> +
> +def do_post_build(self, builder: UefiBuilder) -> int:
> +"""CodeQL analysis post-build functionality.
> +
> +Args:
> +builder (UefiBuilder): A UEFI builder object for this build.
> +
> +Returns:
> +int: The number of CodeQL errors found. Zero indicates that
> +AuditOnly mode is enabled or no failures were found.
> +"""
> +
> +pp = builder.pp.split(os.pathsep)
> +edk2_path = Edk2Path(builder.ws, pp)
> +
> +self.builder = builder
> +self.package = edk2_path.GetContainingPackage(
> +builder.mws.join(builder.ws,
> + builder.env.GetValue(
> +"ACTIVE_PLATFORM")))
> +self.package_path = Path(
> +edk2_path.GetAbsolutePathOnThisSystemFromEdk2RelativePath(
> +self.package))
> +self.target = builder.env.GetValue("TARGET")
> +
> +self.codeql_db_path = codeql_plugin.get_codeql_db_path(
> +builder.ws, self.package, self.target,
> +new_path=False)
> +
> +self.codeql_path = codeql_plugin.get_codeql_cli_path()
> +if not self.codeql_path:
> +   

[edk2-devel] [PATCH 1/1] BaseTools: trim warning to error

2023-09-22 Thread Yuwei Chen
As the error is changed to warning, Trim.py will skip the build
error when the source code have exactly issue.
This patch change warning to error to opens the checking.

Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
Signed-off-by: Yuwei Chen 
---
 BaseTools/Source/Python/Trim/Trim.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/Trim/Trim.py 
b/BaseTools/Source/Python/Trim/Trim.py
index c479f7d2b2e7..416935df5e90 100644
--- a/BaseTools/Source/Python/Trim/Trim.py
+++ b/BaseTools/Source/Python/Trim/Trim.py
@@ -281,10 +281,10 @@ def DoInclude(Source, Indent='', IncludePathList=[], 
LocalSearchPath=None, Inclu
 F = File.readlines()
 break
 else:
-EdkLogger.warn("Trim", "Failed to find include file %s" % Source)
+EdkLogger.error("Trim", "Failed to find include file %s" % Source)
 return []
 except:
-EdkLogger.warn("Trim", FILE_OPEN_FAILURE, ExtraData=Source)
+EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Source)
 return []
 
 
-- 
2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108979): https://edk2.groups.io/g/devel/message/108979
Mute This Topic: https://groups.io/mt/101516516/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH] Platform/Intel: Enhance the BOARD_ID without PCH_TYPE support

2023-09-15 Thread Yuwei Chen
Reviewed-by: Yuwei Chen 

> -Original Message-
> From: Srinivasan, ManickamX 
> Sent: Wednesday, September 13, 2023 4:56 PM
> To: devel@edk2.groups.io
> Cc: Srinivasan, ManickamX ; Feng, Bob C
> ; Gao, Liming ; Chen,
> Christine ; T V, Krishnamoorthy
> 
> Subject: [PATCH] Platform/Intel: Enhance the BOARD_ID without PCH_TYPE
> support
> 
> The length of the Board ID is being updated based on the BOARD_ID string. If
> the PCH_TYPE is empty space/single quotes(''), removing the empty
> space/single quotes('') and concatenating the TARGET_PLATFORM_SHORT
> and BUILD flag strings.
> 
> Cc: Bob Feng 
> Cc: Liming Gao 
> Cc: Yuwei Chen 
> Cc: T V Krishnamoorthy 
> Signed-off-by: ManickamX Srinivasan 
> ---
>  Platform/Intel/Tools/GenBiosId/GenBiosId.py | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/Platform/Intel/Tools/GenBiosId/GenBiosId.py
> b/Platform/Intel/Tools/GenBiosId/GenBiosId.py
> index fa3689867..54503fdfc 100644
> --- a/Platform/Intel/Tools/GenBiosId/GenBiosId.py
> +++ b/Platform/Intel/Tools/GenBiosId/GenBiosId.py
> @@ -141,14 +141,16 @@ def ParserInputFile(InputDict, NoTimestamp):
>  if Item not in _ConfigItem:
>  EdkLogger("GenBiosId", FORMAT_INVALID,
> ExtraData=_ConfigItemInvalid % Item)
>  _ConfigItem[Item]['Value'] = InputDict[Item]
> -if len(_ConfigItem[Item]['Value']) != _ConfigItem[Item]['Length']:
> +if ((len(_ConfigItem[Item]['Value']) !=
> _ConfigItem[Item]['Length'])|(_ConfigItem["BOARD_ID"]['Value'][3:4] == " ")):
>  # The length of the Board ID is being updated based on the 
> BOARD_ID
> string
>  #If the PCH_TYPE is empty space/single quotes(''), removing the 
> empty
> space/single quotes('') and concatenating the TARGET_PLATFORM_SHORT
> and BUILD flag strings
>  if(_ConfigItem["BOARD_ID"]['Value'][3:5] == "\'\'"):
> 
> _ConfigItem["BOARD_ID"]['Value']=_ConfigItem["BOARD_ID"]['Value'][0:3]+_
> ConfigItem["BOARD_ID"]['Value'][5:len(_ConfigItem["BOARD_ID"]['Value'])]
> -
> _ConfigItem["BOARD_ID"]['Length']=len(_ConfigItem["BOARD_ID"]['Value'])
> +elif (_ConfigItem["BOARD_ID"]['Value'][3:4] == " "):
> +
> + _ConfigItem["BOARD_ID"]['Value']=_ConfigItem["BOARD_ID"]['Value'][0:3]
> + +_ConfigItem["BOARD_ID"]['Value'][4:len(_ConfigItem["BOARD_ID"]['Value
> + '])]
>  else:
>  EdkLogger("GenBiosId", FORMAT_INVALID,
> ExtraData=_ConfigLenInvalid % Item)
> +
> + _ConfigItem["BOARD_ID"]['Length']=len(_ConfigItem["BOARD_ID"]['Value']
> + )
>  for Item in _ConfigItem:
>  if not _ConfigItem[Item]['Value']:
>  EdkLogger("GenBiosId", FORMAT_UNKNOWN_ERROR,
> ExtraData="Item %s is missing" % Item)
> --
> 2.30.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108713): https://edk2.groups.io/g/devel/message/108713
Mute This Topic: https://groups.io/mt/10112/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [Patch V2 1/4] BaseTools: fixing FMMT ShrinkFv issue

2023-09-10 Thread Yuwei Chen
Thanks liming~ Hope it will be merged soon~ 

Many thanks,
Christine

> -Original Message-
> From: gaoliming 
> Sent: Wednesday, August 30, 2023 4:43 PM
> To: devel@edk2.groups.io; Feng, Bob C ; Chen,
> Christine 
> Cc: 'Rebecca Cran' 
> Subject: 回复: [edk2-devel] [Patch V2 1/4] BaseTools: fixing FMMT ShrinkFv
> issue
> 
> Christine:
>   I have no comments for this patch set. Reviewed-by: Liming Gao
> 
> 
> Thanks
> Liming
> > -邮件原件-
> > 发件人: devel@edk2.groups.io  代表 Bob Feng
> > 发送时间: 2023年6月29日 14:54
> > 收件人: Chen, Christine ; devel@edk2.groups.io
> > 抄送: Rebecca Cran ; Gao, Liming
> > 
> > 主题: Re: [edk2-devel] [Patch V2 1/4] BaseTools: fixing FMMT ShrinkFv
> issue
> >
> > Reviewed-by: Bob Feng 
> >
> > -Original Message-
> > From: Chen, Christine 
> > Sent: Thursday, June 29, 2023 11:34 AM
> > To: devel@edk2.groups.io
> > Cc: Rebecca Cran ; Gao, Liming
> > ; Feng, Bob C 
> > Subject: [Patch V2 1/4] BaseTools: fixing FMMT ShrinkFv issue
> >
> > 1. FvLength not change issue;
> > 2. FileSystemGuid align with File Size;
> >
> > Cc: Rebecca Cran 
> > Cc: Liming Gao 
> > Cc: Bob Feng 
> > Signed-off-by: Yuwei Chen 
> > ---
> >  BaseTools/Source/Python/FMMT/core/FMMTOperation.py |  2 +-
> >  BaseTools/Source/Python/FMMT/core/FvHandler.py | 10 +++---
> >  2 files changed, 8 insertions(+), 4 deletions(-)
> >
> > diff --git a/BaseTools/Source/Python/FMMT/core/FMMTOperation.py
> > b/BaseTools/Source/Python/FMMT/core/FMMTOperation.py
> > index a86f8dda9a1a..d4aa3397036d 100644
> > --- a/BaseTools/Source/Python/FMMT/core/FMMTOperation.py
> > +++ b/BaseTools/Source/Python/FMMT/core/FMMTOperation.py
> > @@ -188,7 +188,7 @@ def ExtractFfs(inputfile: str, Ffs_name: str,
> outputfile:
> > str, Fv_name: str=None
> >
> > FmmtParser.WholeFvTree.Findlist.remove(FmmtParser.WholeFvTree.Findlist
> > [i
> > ndex])
> >  if FmmtParser.WholeFvTree.Findlist != []:
> >  TargetNode = FmmtParser.WholeFvTree.Findlist[0]
> > -if TargetNode.type == FV_TREE or SEC_FV_TREE or
> > DATA_FV_TREE:
> > +if TargetNode.type == FV_TREE or TargetNode.type ==
> > SEC_FV_TREE or TargetNode.type == DATA_FV_TREE:
> >  FinalData = struct2stream(TargetNode.Data.Header) +
> > TargetNode.Data.Data
> >  with open(outputfile, "wb") as f:
> >  f.write(FinalData)
> > diff --git a/BaseTools/Source/Python/FMMT/core/FvHandler.py
> > b/BaseTools/Source/Python/FMMT/core/FvHandler.py
> > index ff3d637623f8..b0cc1951a1c6 100644
> > --- a/BaseTools/Source/Python/FMMT/core/FvHandler.py
> > +++ b/BaseTools/Source/Python/FMMT/core/FvHandler.py
> > @@ -279,7 +279,7 @@ class FvHandler:
> >  ParTree.Child.remove(ParTree.Child[-1])
> >  ParTree.Data.Free_Space = 0
> >  ParTree.Data.Size += Needed_Space
> > -ParTree.Data.Header.Fvlength =
> > ParTree.Data.Size
> > +ParTree.Data.Header.FvLength =
> > ParTree.Data.Size
> >  ModifyFvSystemGuid(ParTree)
> >  for item in ParTree.Child:
> >  if item.type == FFS_FREE_SPACE:
> > @@ -650,8 +650,12 @@ class FvHandler:
> >  Removed_Space = TargetFv.Data.Free_Space - New_Free_Space
> >  TargetFv.Child[-1].Data.Data = b'\xff' * New_Free_Space
> >  TargetFv.Data.Size -= Removed_Space
> > -TargetFv.Data.Header.Fvlength = TargetFv.Data.Size
> > -ModifyFvSystemGuid(TargetFv)
> > +TargetFv.Data.Header.FvLength = TargetFv.Data.Size
> > +if struct2stream(TargetFv.Data.Header.FileSystemGuid) ==
> > EFI_FIRMWARE_FILE_SYSTEM3_GUID_BYTE:
> > +if TargetFv.Data.Size <= 0xFF:
> > +TargetFv.Data.Header.FileSystemGuid =
> > ModifyGuidFormat(
> > +"8c8ce578-8a3d-4f1c-9935-896185c32dd3")
> > +
> >  for item in TargetFv.Child:
> >  if item.type == FFS_FREE_SPACE:
> >  TargetFv.Data.Data += item.Data.Data +
> > item.Data.PadData
> > --
> > 2.27.0.windows.1
> >
> >
> >
> > 
> >
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108471): https://edk2.groups.io/g/devel/message/108471
Mute This Topic: https://groups.io/mt/101284551/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH] Platform/Intel: Enhance the BOARD_ID without PCH_TYPE support

2023-08-29 Thread Yuwei Chen
Reviewed-by: Yuwei Chen 

> -Original Message-
> From: Srinivasan, ManickamX 
> Sent: Wednesday, August 23, 2023 3:29 PM
> To: devel@edk2.groups.io
> Cc: Srinivasan, ManickamX ; Feng, Bob C
> ; Gao, Liming ; Chen,
> Christine ; T V, Krishnamoorthy
> 
> Subject: [PATCH] Platform/Intel: Enhance the BOARD_ID without PCH_TYPE
> support
> 
> The length of the Board ID is being updated based on the BOARD_ID string. If
> the PCH_TYPE is empty space/single quotes(''), removing the empty
> space/single quotes('') and concatenating the TARGET_PLATFORM_SHORT
> and BUILD flag strings.
> 
> Cc: Bob Feng 
> Cc: Liming Gao 
> Cc: Yuwei Chen 
> Cc: T V Krishnamoorthy 
> Signed-off-by: ManickamX Srinivasan 
> ---
>  Platform/Intel/Tools/GenBiosId/GenBiosId.py | 8 +++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/Platform/Intel/Tools/GenBiosId/GenBiosId.py
> b/Platform/Intel/Tools/GenBiosId/GenBiosId.py
> index f823fdcad..fa3689867 100644
> --- a/Platform/Intel/Tools/GenBiosId/GenBiosId.py
> +++ b/Platform/Intel/Tools/GenBiosId/GenBiosId.py
> @@ -142,7 +142,13 @@ def ParserInputFile(InputDict, NoTimestamp):
>  EdkLogger("GenBiosId", FORMAT_INVALID,
> ExtraData=_ConfigItemInvalid % Item)
>  _ConfigItem[Item]['Value'] = InputDict[Item]
>  if len(_ConfigItem[Item]['Value']) != _ConfigItem[Item]['Length']:
> -EdkLogger("GenBiosId", FORMAT_INVALID,
> ExtraData=_ConfigLenInvalid % Item)
> +# The length of the Board ID is being updated based on the
> BOARD_ID string
> +#If the PCH_TYPE is empty space/single quotes(''), removing the
> empty space/single quotes('') and concatenating the
> TARGET_PLATFORM_SHORT and BUILD flag strings
> +if(_ConfigItem["BOARD_ID"]['Value'][3:5] == "\'\'"):
> +
> _ConfigItem["BOARD_ID"]['Value']=_ConfigItem["BOARD_ID"]['Value'][0:3]+_
> ConfigItem["BOARD_ID"]['Value'][5:len(_ConfigItem["BOARD_ID"]['Value'])]
> +
> _ConfigItem["BOARD_ID"]['Length']=len(_ConfigItem["BOARD_ID"]['Value'])
> +else:
> +EdkLogger("GenBiosId", FORMAT_INVALID,
> + ExtraData=_ConfigLenInvalid % Item)
>  for Item in _ConfigItem:
>  if not _ConfigItem[Item]['Value']:
>  EdkLogger("GenBiosId", FORMAT_UNKNOWN_ERROR,
> ExtraData="Item %s is missing" % Item)
> --
> 2.30.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108086): https://edk2.groups.io/g/devel/message/108086
Mute This Topic: https://groups.io/mt/100916084/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] BaseTools: Add FMMT BinPipWrappers

2023-07-26 Thread Yuwei Chen
Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
Signed-off-by: Yuwei Chen 
---
 BaseTools/BinPipWrappers/PosixLike/FMMT   | 12 
 BaseTools/BinPipWrappers/WindowsLike/FMMT.bat |  3 +++
 2 files changed, 15 insertions(+)
 create mode 100755 BaseTools/BinPipWrappers/PosixLike/FMMT
 create mode 100644 BaseTools/BinPipWrappers/WindowsLike/FMMT.bat

diff --git a/BaseTools/BinPipWrappers/PosixLike/FMMT 
b/BaseTools/BinPipWrappers/PosixLike/FMMT
new file mode 100755
index 00..9d143c7fc6
--- /dev/null
+++ b/BaseTools/BinPipWrappers/PosixLike/FMMT
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+#python `dirname $0`/RunToolFromSource.py `basename $0` $*
+
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
+cmd=${full_cmd##*/}
+
+exec "${python_exe:-python}" -m edk2basetools.$cmd.$cmd "$@"
diff --git a/BaseTools/BinPipWrappers/WindowsLike/FMMT.bat 
b/BaseTools/BinPipWrappers/WindowsLike/FMMT.bat
new file mode 100644
index 00..d347d64844
--- /dev/null
+++ b/BaseTools/BinPipWrappers/WindowsLike/FMMT.bat
@@ -0,0 +1,3 @@
+@setlocal
+@set ToolName=%~n0%
+@%PYTHON_COMMAND% -m edk2basetools.%ToolName%.%ToolName% %*
-- 
2.39.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107262): https://edk2.groups.io/g/devel/message/107262
Mute This Topic: https://groups.io/mt/100366342/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [Patch V3] [edk2-staging] BaseTools/FMMT: C FMMT match new version machine defines

2023-07-09 Thread Yuwei Chen
Thanks Liming for your support~

Thanks,
Christine

> -Original Message-
> From: gaoliming 
> Sent: Monday, July 10, 2023 9:51 AM
> To: devel@edk2.groups.io; Chen, Christine 
> Cc: 'Rebecca Cran' ; Feng, Bob C
> ; Chan, Amy ; Huang, Yanbo
> 
> Subject: 回复: [edk2-devel] [Patch V3] [edk2-staging] BaseTools/FMMT: C
> FMMT match new version machine defines
> 
> Christine:
>   I just push this patch @ bab1724cdf725b7d22869c79fa2b86ed47e01110 in
> edk2-staging.
> 
> Thanks
> Liming
> > -邮件原件-
> > 发件人: devel@edk2.groups.io  代表 Yuwei Chen
> > 发送时间: 2023年7月4日 15:52
> > 收件人: Gao, Liming ; devel@edk2.groups.io
> > 抄送: 'Rebecca Cran' ; Feng, Bob C
> > ; Chan, Amy ; Huang,
> Yanbo
> > 
> > 主题: Re: [edk2-devel] [Patch V3] [edk2-staging] BaseTools/FMMT: C FMMT
> > match new version machine defines
> >
> > Hi Liming and Cran,
> >
> > Can you help merge the code? It is urgent for us to use. 
> >
> > Thanks a lot~
> >
> > Thanks,
> > Christine
> >
> >
> > > -Original Message-
> > > From: gaoliming 
> > > Sent: Tuesday, June 27, 2023 2:14 PM
> > > To: Chen, Christine ; devel@edk2.groups.io
> > > Cc: 'Rebecca Cran' ; Feng, Bob C
> > > 
> > > Subject: 回复: [Patch V3] [edk2-staging] BaseTools/FMMT: C FMMT match
> > > new version machine defines
> > >
> > > Reviewed-by: Liming Gao 
> > >
> > > > -邮件原件-
> > > > 发件人: Yuwei Chen 
> > > > 发送时间: 2023年6月27日 10:54
> > > > 收件人: devel@edk2.groups.io
> > > > 抄送: Rebecca Cran ; Liming Gao
> > > > ; Bob Feng 
> > > > 主题: [Patch V3] [edk2-staging] BaseTools/FMMT: C FMMT match new
> > > version
> > > > machine defines
> > > >
> > > > BaseTools have switch from EFI_IMAGE_MACHINE_* to
> > > > IMAGE_FILE_MACHINE_*. Thus, match the FCE & FMMT tool in edk2-
> > > staging
> > > > repo with the new version define.
> > > >
> > > > Cc: Rebecca Cran 
> > > > Cc: Liming Gao 
> > > > Cc: Bob Feng 
> > > > Signed-off-by: Yuwei Chen 
> > > > ---
> > > >
> > > > V3 modify the patch with the correct define
> > > > BaseTools/Source/C/FMMT/Rebase.c | 12 ++--
> > > >  1 file changed, 6 insertions(+), 6 deletions(-)
> > > >
> > > > diff --git a/BaseTools/Source/C/FMMT/Rebase.c
> > > > b/BaseTools/Source/C/FMMT/Rebase.c
> > > > index d32217d18c..20f8e5a3fc 100644
> > > > --- a/BaseTools/Source/C/FMMT/Rebase.c
> > > > +++ b/BaseTools/Source/C/FMMT/Rebase.c
> > > > @@ -159,8 +159,8 @@ EFI_NOT_FOUND   No compressed
> > > > sections could be found.
> > > >return Status;
> > > >
> > > >  }
> > > >
> > > >
> > > >
> > > > -//if ((ImageContext.Machine == EFI_IMAGE_MACHINE_ARMT) ||
> > > >
> > > > -//  (ImageContext.Machine == EFI_IMAGE_MACHINE_AARCH64)) {
> > > >
> > > > +//if ((ImageContext.Machine ==
> > > > IMAGE_FILE_MACHINE_ARMTHUMB_MIXED) ||
> > > >
> > > > +//  (ImageContext.Machine == IMAGE_FILE_MACHINE_ARM64)) {
> > > >
> > > >  //  mArm = TRUE;
> > > >
> > > >  //}
> > > >
> > > >
> > > >
> > > > @@ -435,8 +435,8 @@ EFI_NOT_FOUND   No compressed
> > > > sections could be found.
> > > >return Status;
> > > >
> > > >  }
> > > >
> > > >
> > > >
> > > > -//if ((ImageContext.Machine == EFI_IMAGE_MACHINE_ARMT) ||
> > > >
> > > > -//  (ImageContext.Machine == EFI_IMAGE_MACHINE_AARCH64)) {
> > > >
> > > > +//if ((ImageContext.Machine ==
> > > > IMAGE_FILE_MACHINE_ARMTHUMB_MIXED) ||
> > > >
> > > > +//  (ImageContext.Machine == IMAGE_FILE_MACHINE_ARM64)) {
> > > >
> > > >  //  mArm = TRUE;
> > > >
> > > >  //}
> > > >
> > > >
> > > >
> > > > @@ -835,8 +835,8 @@ Returns:
> > > >//
> > > >
> > > >// Verify machine type is supported
> > > >
> > > >//
> > > >
> > > > -  if ((*MachineType != EFI_IMAGE_MACHINE_IA32) &&
> > (*MachineType !=
> > > > EFI_IMAGE_MACHINE_X64) && (*MachineType !=
> > > > EFI_IMAGE_MACHINE_EBC) &&
> > > >
> > > > -  (*MachineType != EFI_IMAGE_MACHINE_ARMT) &&
> > > > (*MachineType != EFI_IMAGE_MACHINE_AARCH64)) {
> > > >
> > > > +  if ((*MachineType != IMAGE_FILE_MACHINE_I386) &&
> > (*MachineType !=
> > > > IMAGE_FILE_MACHINE_X64) && (*MachineType !=
> > > > IMAGE_FILE_MACHINE_EBC) &&
> > > >
> > > > +  (*MachineType != IMAGE_FILE_MACHINE_ARMTHUMB_MIXED)
> > &&
> > > > (*MachineType != IMAGE_FILE_MACHINE_ARM64)) {
> > > >
> > > >  Error (NULL, 0, 3000, "Invalid", "Unrecognized machine type
> > > > in the
> > > PE32
> > > > file.");
> > > >
> > > >  return EFI_UNSUPPORTED;
> > > >
> > > >}
> > > >
> > > > --
> > > > 2.27.0.windows.1
> > >
> > >
> >
> >
> >
> > 
> >
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#106756): https://edk2.groups.io/g/devel/message/106756
Mute This Topic: https://groups.io/mt/100050995/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [Patch V3] [edk2-staging] BaseTools/FMMT: C FMMT match new version machine defines

2023-07-04 Thread Yuwei Chen
Hi Liming and Cran,

Can you help merge the code? It is urgent for us to use. 

Thanks a lot~

Thanks,
Christine


> -Original Message-
> From: gaoliming 
> Sent: Tuesday, June 27, 2023 2:14 PM
> To: Chen, Christine ; devel@edk2.groups.io
> Cc: 'Rebecca Cran' ; Feng, Bob C
> 
> Subject: 回复: [Patch V3] [edk2-staging] BaseTools/FMMT: C FMMT match
> new version machine defines
> 
> Reviewed-by: Liming Gao 
> 
> > -邮件原件-
> > 发件人: Yuwei Chen 
> > 发送时间: 2023年6月27日 10:54
> > 收件人: devel@edk2.groups.io
> > 抄送: Rebecca Cran ; Liming Gao
> > ; Bob Feng 
> > 主题: [Patch V3] [edk2-staging] BaseTools/FMMT: C FMMT match new
> version
> > machine defines
> >
> > BaseTools have switch from EFI_IMAGE_MACHINE_* to
> > IMAGE_FILE_MACHINE_*. Thus, match the FCE & FMMT tool in edk2-
> staging
> > repo with the new version define.
> >
> > Cc: Rebecca Cran 
> > Cc: Liming Gao 
> > Cc: Bob Feng 
> > Signed-off-by: Yuwei Chen 
> > ---
> >
> > V3 modify the patch with the correct define
> > BaseTools/Source/C/FMMT/Rebase.c | 12 ++--
> >  1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/BaseTools/Source/C/FMMT/Rebase.c
> > b/BaseTools/Source/C/FMMT/Rebase.c
> > index d32217d18c..20f8e5a3fc 100644
> > --- a/BaseTools/Source/C/FMMT/Rebase.c
> > +++ b/BaseTools/Source/C/FMMT/Rebase.c
> > @@ -159,8 +159,8 @@ EFI_NOT_FOUND   No compressed
> > sections could be found.
> >return Status;
> >
> >  }
> >
> >
> >
> > -//if ((ImageContext.Machine == EFI_IMAGE_MACHINE_ARMT) ||
> >
> > -//  (ImageContext.Machine == EFI_IMAGE_MACHINE_AARCH64)) {
> >
> > +//if ((ImageContext.Machine ==
> > IMAGE_FILE_MACHINE_ARMTHUMB_MIXED) ||
> >
> > +//  (ImageContext.Machine == IMAGE_FILE_MACHINE_ARM64)) {
> >
> >  //  mArm = TRUE;
> >
> >  //}
> >
> >
> >
> > @@ -435,8 +435,8 @@ EFI_NOT_FOUND   No compressed
> > sections could be found.
> >return Status;
> >
> >  }
> >
> >
> >
> > -//if ((ImageContext.Machine == EFI_IMAGE_MACHINE_ARMT) ||
> >
> > -//  (ImageContext.Machine == EFI_IMAGE_MACHINE_AARCH64)) {
> >
> > +//if ((ImageContext.Machine ==
> > IMAGE_FILE_MACHINE_ARMTHUMB_MIXED) ||
> >
> > +//  (ImageContext.Machine == IMAGE_FILE_MACHINE_ARM64)) {
> >
> >  //  mArm = TRUE;
> >
> >  //}
> >
> >
> >
> > @@ -835,8 +835,8 @@ Returns:
> >//
> >
> >// Verify machine type is supported
> >
> >//
> >
> > -  if ((*MachineType != EFI_IMAGE_MACHINE_IA32) && (*MachineType !=
> > EFI_IMAGE_MACHINE_X64) && (*MachineType !=
> > EFI_IMAGE_MACHINE_EBC) &&
> >
> > -  (*MachineType != EFI_IMAGE_MACHINE_ARMT) &&
> > (*MachineType != EFI_IMAGE_MACHINE_AARCH64)) {
> >
> > +  if ((*MachineType != IMAGE_FILE_MACHINE_I386) && (*MachineType !=
> > IMAGE_FILE_MACHINE_X64) && (*MachineType !=
> > IMAGE_FILE_MACHINE_EBC) &&
> >
> > +  (*MachineType != IMAGE_FILE_MACHINE_ARMTHUMB_MIXED) &&
> > (*MachineType != IMAGE_FILE_MACHINE_ARM64)) {
> >
> >  Error (NULL, 0, 3000, "Invalid", "Unrecognized machine type in
> > the
> PE32
> > file.");
> >
> >  return EFI_UNSUPPORTED;
> >
> >}
> >
> > --
> > 2.27.0.windows.1
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#106629): https://edk2.groups.io/g/devel/message/106629
Mute This Topic: https://groups.io/mt/99942575/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [Patch V2 4/4] BaseTools: FMMT replace new free space fixing in replace

2023-06-28 Thread Yuwei Chen
In FMMT replace function, when newffs size <= targetffs size,
the new free space is calculated wrong as loss the pad data delta size.
That will cause invalid binary generated.
This patch fixes this issue.

Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
Signed-off-by: Yuwei Chen 
---
 BaseTools/Source/Python/FMMT/core/FvHandler.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/FMMT/core/FvHandler.py 
b/BaseTools/Source/Python/FMMT/core/FvHandler.py
index 49bbc35baa4d..7a6076033681 100644
--- a/BaseTools/Source/Python/FMMT/core/FvHandler.py
+++ b/BaseTools/Source/Python/FMMT/core/FvHandler.py
@@ -456,7 +456,7 @@ class FvHandler:
 # Start free space calculating and moving process.
 self.ModifyTest(TargetFv.Parent, Needed_Space)
 else:
-New_Free_Space = self.TargetFfs.Data.Size - self.NewFfs.Data.Size
+New_Free_Space = self.TargetFfs.Data.Size + 
len(self.TargetFfs.Data.PadData) - self.NewFfs.Data.Size - 
len(self.NewFfs.Data.PadData)
 # If TargetFv already have free space, move the new free space 
into it.
 if TargetFv.Data.Free_Space:
 TargetFv.Child[-1].Data.Data += b'\xff' * New_Free_Space
-- 
2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#106493): https://edk2.groups.io/g/devel/message/106493
Mute This Topic: https://groups.io/mt/99845068/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [Patch V2 3/4] BaseTools: FMMT support ELF UPLD parser

2023-06-28 Thread Yuwei Chen
FMMT add new function to support the .elf file parsing.
Using '-v' option, the UPLD info will be printed out.

'''
- UNIVERSAL_PAYLOAD_INFO
  - 4 bytes align (BOOLEAN)
- Identifier
- SpecRevision
- Attribute
- Revision
- Capability
- ProducerId
- ImageId
UPLD Buffer
'''

Cc: Rebecca Cran 
Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yuwei Chen 
---
 BaseTools/Source/Python/FMMT/FMMT.py   |   2 ++
 BaseTools/Source/Python/FMMT/core/BinaryFactoryProduct.py  |  36 
+++-
 BaseTools/Source/Python/FMMT/core/BiosTree.py  |  48 
++--
 BaseTools/Source/Python/FMMT/core/BiosTreeNode.py  |  56 
+++-
 BaseTools/Source/Python/FMMT/core/FMMTParser.py|   2 +-
 BaseTools/Source/Python/FirmwareStorageFormat/UPLHeader.py | 244 

 6 files changed, 383 insertions(+), 5 deletions(-)

diff --git a/BaseTools/Source/Python/FMMT/FMMT.py 
b/BaseTools/Source/Python/FMMT/FMMT.py
index bf580b3843a8..26fc4c5792c4 100644
--- a/BaseTools/Source/Python/FMMT/FMMT.py
+++ b/BaseTools/Source/Python/FMMT/FMMT.py
@@ -84,6 +84,8 @@ class FMMT():
 ROOT_TYPE = ROOT_FFS_TREE
 elif filetype == '.sec':
 ROOT_TYPE = ROOT_SECTION_TREE
+elif filetype == '.elf':
+ROOT_TYPE = ROOT_ELF_TREE
 else:
 ROOT_TYPE = ROOT_TREE
 ViewFile(inputfile, ROOT_TYPE, layoutfilename, outputfile)
diff --git a/BaseTools/Source/Python/FMMT/core/BinaryFactoryProduct.py 
b/BaseTools/Source/Python/FMMT/core/BinaryFactoryProduct.py
index 2d4e6d9276d7..de174f26ab23 100644
--- a/BaseTools/Source/Python/FMMT/core/BinaryFactoryProduct.py
+++ b/BaseTools/Source/Python/FMMT/core/BinaryFactoryProduct.py
@@ -15,10 +15,13 @@ from core.GuidTools import GUIDTools
 from utils.FmmtLogger import FmmtLogger as logger
 
 ROOT_TREE = 'ROOT'
+ROOT_ELF_TREE = 'ROOT_ELF_TREE'
 ROOT_FV_TREE = 'ROOT_FV_TREE'
 ROOT_FFS_TREE = 'ROOT_FFS_TREE'
 ROOT_SECTION_TREE = 'ROOT_SECTION_TREE'
 
+ELF_TREE = 'ELF'
+ELF_SECTION_TREE = 'ELF_SECTION_TREE'
 FV_TREE = 'FV'
 DATA_FV_TREE = 'DATA_FV'
 FFS_TREE = 'FFS'
@@ -49,6 +52,12 @@ class BinaryProduct():
 def ParserData():
 pass
 
+class ElfFactory(BinaryFactory):
+type = [ROOT_ELF_TREE, ELF_TREE]
+
+def Create_Product():
+return ElfProduct()
+
 class SectionFactory(BinaryFactory):
 type = [SECTION_TREE]
 
@@ -354,6 +363,30 @@ class FdProduct(BinaryProduct):
 tmp_index += 1
 return Fd_Struct
 
+class ElfSectionProduct(BinaryProduct):
+## Decompress the compressed section.
+def ParserData(self, Section_Tree, whole_Data: bytes, Rel_Whole_Offset: 
int=0) -> None:
+pass
+def ParserSectionData(self, Section_Tree, whole_Data: bytes, 
Rel_Whole_Offset: int=0) -> None:
+pass
+def ParserProgramData(self, Section_Tree, whole_Data: bytes, 
Rel_Whole_Offset: int=0) -> None:
+pass
+
+class ElfProduct(BinaryProduct):
+
+def ParserData(self, ParTree, Whole_Data: bytes, Rel_Whole_Offset: int=0) 
-> None:
+Elf_Info = ElfNode(Whole_Data)
+if Elf_Info.Header.ELF_PHOff != 0:
+Elf_Info.GetProgramList(Whole_Data[Elf_Info.Header.ELF_PHOff:])
+if Elf_Info.Header.ELF_SHOff != 0:
+Elf_Info.GetSectionList(Whole_Data[Elf_Info.Header.ELF_SHOff:])
+Elf_Info.FindUPLDSection(Whole_Data)
+Elf_Tree = BIOSTREE(Elf_Info.Name)
+Elf_Tree.type = ELF_TREE
+Elf_Info.Data = Whole_Data[Elf_Info.HeaderLength:]
+Elf_Tree.Data = Elf_Info
+ParTree.insertChild(Elf_Tree)
+
 class ParserEntry():
 FactoryTable:dict = {
 SECTION_TREE: SectionFactory,
@@ -364,6 +397,7 @@ class ParserEntry():
 SEC_FV_TREE: FvFactory,
 ROOT_FV_TREE: FdFactory,
 ROOT_TREE: FdFactory,
+ROOT_ELF_TREE: ElfFactory,
 }
 
 def GetTargetFactory(self, Tree_type: str) -> BinaryFactory:
@@ -377,4 +411,4 @@ class ParserEntry():
 def DataParser(self, Tree, Data: bytes, Offset: int) -> None:
 TargetFactory = self.GetTargetFactory(Tree.type)
 if TargetFactory:
-self.Generate_Product(TargetFactory, Tree, Data, Offset)
\ No newline at end of file
+self.Generate_Product(TargetFactory, Tree, Data, Offset)
diff --git a/BaseTools/Source/Python/FMMT/core/BiosTree.py 
b/BaseTools/Source/Python/FMMT/core/BiosTree.py
index 137f49748b09..c5a7b017f4b1 100644
--- a/BaseTools/Source/Python/FMMT/core/BiosTree.py
+++ b/BaseTools/Source/Python/FMMT/core/BiosTree.py
@@ -12,6 +12,7 @@ ROOT_TREE = 'ROOT'
 ROOT_FV_TREE = 'ROOT_FV_TR

[edk2-devel] [Patch V2 2/4] BaseTools: FMMT replace output file is not generated successfully

2023-06-28 Thread Yuwei Chen
For replace function, when target Ffs and new ffs are with
same size, the output file can not be generated successfully.
This patch fixes this issue.

Cc: Rebecca Cran 
Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yuwei Chen 
---
 BaseTools/Source/Python/FMMT/core/BiosTree.py  |  4 ++--
 BaseTools/Source/Python/FMMT/core/FvHandler.py | 19 ---
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/BaseTools/Source/Python/FMMT/core/BiosTree.py 
b/BaseTools/Source/Python/FMMT/core/BiosTree.py
index d8fa4743354a..137f49748b09 100644
--- a/BaseTools/Source/Python/FMMT/core/BiosTree.py
+++ b/BaseTools/Source/Python/FMMT/core/BiosTree.py
@@ -56,7 +56,7 @@ class BIOSTREE:
 if len(self.Child) == 0:
 self.Child.append(newNode)
 else:
-if not pos:
+if not pos or pos == len(self.Child):
 LastTree = self.Child[-1]
 self.Child.append(newNode)
 LastTree.NextRel = newNode
@@ -195,4 +195,4 @@ class BIOSTREE:
 for item in self.Child:
 TreeInfo[key].setdefault('Files',[]).append( item.ExportTree())
 
-return TreeInfo
\ No newline at end of file
+return TreeInfo
diff --git a/BaseTools/Source/Python/FMMT/core/FvHandler.py 
b/BaseTools/Source/Python/FMMT/core/FvHandler.py
index b0cc1951a1c6..49bbc35baa4d 100644
--- a/BaseTools/Source/Python/FMMT/core/FvHandler.py
+++ b/BaseTools/Source/Python/FMMT/core/FvHandler.py
@@ -387,7 +387,21 @@ class FvHandler:
 if self.NewFfs.Data.Size >= self.TargetFfs.Data.Size:
 Needed_Space = self.NewFfs.Data.Size + 
len(self.NewFfs.Data.PadData) - self.TargetFfs.Data.Size - 
len(self.TargetFfs.Data.PadData)
 # If TargetFv have enough free space, just move part of the free 
space to NewFfs.
-if TargetFv.Data.Free_Space >= Needed_Space:
+if Needed_Space == 0:
+Target_index = TargetFv.Child.index(self.TargetFfs)
+TargetFv.Child.remove(self.TargetFfs)
+TargetFv.insertChild(self.NewFfs, Target_index)
+# Modify TargetFv Header and ExtHeader info.
+TargetFv.Data.ModFvExt()
+TargetFv.Data.ModFvSize()
+TargetFv.Data.ModExtHeaderData()
+ModifyFvExtData(TargetFv)
+TargetFv.Data.ModCheckSum()
+# Recompress from the Fv node to update all the related node 
data.
+self.CompressData(TargetFv)
+# return the Status
+self.Status = True
+elif TargetFv.Data.Free_Space >= Needed_Space:
 # Modify TargetFv Child info and BiosTree.
 TargetFv.Child[-1].Data.Data = b'\xff' * 
(TargetFv.Data.Free_Space - Needed_Space)
 TargetFv.Data.Free_Space -= Needed_Space
@@ -450,7 +464,6 @@ class FvHandler:
 Target_index = TargetFv.Child.index(self.TargetFfs)
 TargetFv.Child.remove(self.TargetFfs)
 TargetFv.insertChild(self.NewFfs, Target_index)
-self.Status = True
 # If TargetFv do not have free space, create free space for Fv.
 else:
 New_Free_Space_Tree = BIOSTREE('FREE_SPACE')
@@ -461,7 +474,6 @@ class FvHandler:
 Target_index = TargetFv.Child.index(self.TargetFfs)
 TargetFv.Child.remove(self.TargetFfs)
 TargetFv.insertChild(self.NewFfs, Target_index)
-self.Status = True
 # Modify TargetFv Header and ExtHeader info.
 TargetFv.Data.ModFvExt()
 TargetFv.Data.ModFvSize()
@@ -470,6 +482,7 @@ class FvHandler:
 TargetFv.Data.ModCheckSum()
 # Recompress from the Fv node to update all the related node data.
 self.CompressData(TargetFv)
+self.Status = True
 logger.debug('Done!')
 return self.Status
 
-- 
2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#106491): https://edk2.groups.io/g/devel/message/106491
Mute This Topic: https://groups.io/mt/99845058/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [Patch V2 1/4] BaseTools: fixing FMMT ShrinkFv issue

2023-06-28 Thread Yuwei Chen
1. FvLength not change issue;
2. FileSystemGuid align with File Size;

Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
Signed-off-by: Yuwei Chen 
---
 BaseTools/Source/Python/FMMT/core/FMMTOperation.py |  2 +-
 BaseTools/Source/Python/FMMT/core/FvHandler.py | 10 +++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Source/Python/FMMT/core/FMMTOperation.py 
b/BaseTools/Source/Python/FMMT/core/FMMTOperation.py
index a86f8dda9a1a..d4aa3397036d 100644
--- a/BaseTools/Source/Python/FMMT/core/FMMTOperation.py
+++ b/BaseTools/Source/Python/FMMT/core/FMMTOperation.py
@@ -188,7 +188,7 @@ def ExtractFfs(inputfile: str, Ffs_name: str, outputfile: 
str, Fv_name: str=None
 
FmmtParser.WholeFvTree.Findlist.remove(FmmtParser.WholeFvTree.Findlist[index])
 if FmmtParser.WholeFvTree.Findlist != []:
 TargetNode = FmmtParser.WholeFvTree.Findlist[0]
-if TargetNode.type == FV_TREE or SEC_FV_TREE or DATA_FV_TREE:
+if TargetNode.type == FV_TREE or TargetNode.type == SEC_FV_TREE or 
TargetNode.type == DATA_FV_TREE:
 FinalData = struct2stream(TargetNode.Data.Header) + 
TargetNode.Data.Data
 with open(outputfile, "wb") as f:
 f.write(FinalData)
diff --git a/BaseTools/Source/Python/FMMT/core/FvHandler.py 
b/BaseTools/Source/Python/FMMT/core/FvHandler.py
index ff3d637623f8..b0cc1951a1c6 100644
--- a/BaseTools/Source/Python/FMMT/core/FvHandler.py
+++ b/BaseTools/Source/Python/FMMT/core/FvHandler.py
@@ -279,7 +279,7 @@ class FvHandler:
 ParTree.Child.remove(ParTree.Child[-1])
 ParTree.Data.Free_Space = 0
 ParTree.Data.Size += Needed_Space
-ParTree.Data.Header.Fvlength = ParTree.Data.Size
+ParTree.Data.Header.FvLength = ParTree.Data.Size
 ModifyFvSystemGuid(ParTree)
 for item in ParTree.Child:
 if item.type == FFS_FREE_SPACE:
@@ -650,8 +650,12 @@ class FvHandler:
 Removed_Space = TargetFv.Data.Free_Space - New_Free_Space
 TargetFv.Child[-1].Data.Data = b'\xff' * New_Free_Space
 TargetFv.Data.Size -= Removed_Space
-TargetFv.Data.Header.Fvlength = TargetFv.Data.Size
-ModifyFvSystemGuid(TargetFv)
+TargetFv.Data.Header.FvLength = TargetFv.Data.Size
+if struct2stream(TargetFv.Data.Header.FileSystemGuid) == 
EFI_FIRMWARE_FILE_SYSTEM3_GUID_BYTE:
+if TargetFv.Data.Size <= 0xFF:
+TargetFv.Data.Header.FileSystemGuid = ModifyGuidFormat(
+"8c8ce578-8a3d-4f1c-9935-896185c32dd3")
+
 for item in TargetFv.Child:
 if item.type == FFS_FREE_SPACE:
 TargetFv.Data.Data += item.Data.Data + item.Data.PadData
-- 
2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#106490): https://edk2.groups.io/g/devel/message/106490
Mute This Topic: https://groups.io/mt/99845056/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [Patch V3] [edk2-staging] BaseTools/FMMT: C FMMT match new version machine defines

2023-06-26 Thread Yuwei Chen
BaseTools have switch from EFI_IMAGE_MACHINE_*
to IMAGE_FILE_MACHINE_*. Thus, match the FCE & FMMT
tool in edk2-staging repo with the new version define.

Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
Signed-off-by: Yuwei Chen 
---
V3 modify the patch with the correct define
 BaseTools/Source/C/FMMT/Rebase.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/BaseTools/Source/C/FMMT/Rebase.c b/BaseTools/Source/C/FMMT/Rebase.c
index d32217d18c..20f8e5a3fc 100644
--- a/BaseTools/Source/C/FMMT/Rebase.c
+++ b/BaseTools/Source/C/FMMT/Rebase.c
@@ -159,8 +159,8 @@ EFI_NOT_FOUND   No compressed sections could be 
found.
   return Status;
 }
 
-//if ((ImageContext.Machine == EFI_IMAGE_MACHINE_ARMT) ||
-//  (ImageContext.Machine == EFI_IMAGE_MACHINE_AARCH64)) {
+//if ((ImageContext.Machine == IMAGE_FILE_MACHINE_ARMTHUMB_MIXED) ||
+//  (ImageContext.Machine == IMAGE_FILE_MACHINE_ARM64)) {
 //  mArm = TRUE;
 //}
 
@@ -435,8 +435,8 @@ EFI_NOT_FOUND   No compressed sections could be 
found.
   return Status;
 }
 
-//if ((ImageContext.Machine == EFI_IMAGE_MACHINE_ARMT) ||
-//  (ImageContext.Machine == EFI_IMAGE_MACHINE_AARCH64)) {
+//if ((ImageContext.Machine == IMAGE_FILE_MACHINE_ARMTHUMB_MIXED) ||
+//  (ImageContext.Machine == IMAGE_FILE_MACHINE_ARM64)) {
 //  mArm = TRUE;
 //}
 
@@ -835,8 +835,8 @@ Returns:
   //
   // Verify machine type is supported
   //
-  if ((*MachineType != EFI_IMAGE_MACHINE_IA32) && (*MachineType != 
EFI_IMAGE_MACHINE_X64) && (*MachineType != EFI_IMAGE_MACHINE_EBC) &&
-  (*MachineType != EFI_IMAGE_MACHINE_ARMT) && (*MachineType != 
EFI_IMAGE_MACHINE_AARCH64)) {
+  if ((*MachineType != IMAGE_FILE_MACHINE_I386) && (*MachineType != 
IMAGE_FILE_MACHINE_X64) && (*MachineType != IMAGE_FILE_MACHINE_EBC) &&
+  (*MachineType != IMAGE_FILE_MACHINE_ARMTHUMB_MIXED) && (*MachineType != 
IMAGE_FILE_MACHINE_ARM64)) {
 Error (NULL, 0, 3000, "Invalid", "Unrecognized machine type in the PE32 
file.");
 return EFI_UNSUPPORTED;
   }
-- 
2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#106416): https://edk2.groups.io/g/devel/message/106416
Mute This Topic: https://groups.io/mt/99802865/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [Patch V2] [edk2-staging] BaseTools/FMMT: C FMMT match new version machine defines

2023-06-21 Thread Yuwei Chen
BaseTools have switch from EFI_IMAGE_MACHINE_*
to IMAGE_FILE_MACHINE_*. Thus, match the FCE & FMMT
tool in edk2-staging repo with the new version define.

Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
Signed-off-by: Yuwei Chen 
---
 BaseTools/Source/C/FMMT/Rebase.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

Update V2 for correct conditional checking.
diff --git a/BaseTools/Source/C/FMMT/Rebase.c b/BaseTools/Source/C/FMMT/Rebase.c
index d32217d18c..ba1429d73a 100644
--- a/BaseTools/Source/C/FMMT/Rebase.c
+++ b/BaseTools/Source/C/FMMT/Rebase.c
@@ -159,8 +159,8 @@ EFI_NOT_FOUND   No compressed sections could be 
found.
   return Status;
 }
 
-//if ((ImageContext.Machine == EFI_IMAGE_MACHINE_ARMT) ||
-//  (ImageContext.Machine == EFI_IMAGE_MACHINE_AARCH64)) {
+//if ((ImageContext.Machine == IMAGE_FILE_MACHINE_ARMT) ||
+//  (ImageContext.Machine == IMAGE_FILE_MACHINE_AARCH64)) {
 //  mArm = TRUE;
 //}
 
@@ -435,8 +435,8 @@ EFI_NOT_FOUND   No compressed sections could be 
found.
   return Status;
 }
 
-//if ((ImageContext.Machine == EFI_IMAGE_MACHINE_ARMT) ||
-//  (ImageContext.Machine == EFI_IMAGE_MACHINE_AARCH64)) {
+//if ((ImageContext.Machine == IMAGE_FILE_MACHINE_ARMT) ||
+//  (ImageContext.Machine == IMAGE_FILE_MACHINE_AARCH64)) {
 //  mArm = TRUE;
 //}
 
@@ -835,8 +835,8 @@ Returns:
   //
   // Verify machine type is supported
   //
-  if ((*MachineType != EFI_IMAGE_MACHINE_IA32) && (*MachineType != 
EFI_IMAGE_MACHINE_X64) && (*MachineType != EFI_IMAGE_MACHINE_EBC) &&
-  (*MachineType != EFI_IMAGE_MACHINE_ARMT) && (*MachineType != 
EFI_IMAGE_MACHINE_AARCH64)) {
+  if ((*MachineType != IMAGE_FILE_MACHINE_I386) && (*MachineType != 
IMAGE_FILE_MACHINE_X64) && (*MachineType != IMAGE_FILE_MACHINE_EBC) &&
+  (*MachineType != IMAGE_FILE_MACHINE_ARMTHUMB_MIXED) && (*MachineType != 
IMAGE_FILE_MACHINE_ARM64 )) {
 Error (NULL, 0, 3000, "Invalid", "Unrecognized machine type in the PE32 
file.");
 return EFI_UNSUPPORTED;
   }
-- 
2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#106266): https://edk2.groups.io/g/devel/message/106266
Mute This Topic: https://groups.io/mt/99677103/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 1/1] BaseTools: FMMT GuidTool Auto Select Config file

2023-06-21 Thread Yuwei Chen
Hi Rebecca,

Thanks for reminder. Will update the patch later.

Thanks,
Christine

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Rebecca
> Cran
> Sent: Saturday, June 10, 2023 9:04 AM
> To: Chen, Christine ; devel@edk2.groups.io
> Cc: Gao, Liming ; Feng, Bob C
> 
> Subject: Re: [edk2-devel] [PATCH 1/1] BaseTools: FMMT GuidTool Auto Select
> Config file
> 
> That won't work on Unix, where the separator is ':', not ';'.
> 
> 
> --
> 
> Rebecca Cran
> 
> 
> On 6/5/23 02:12, Yuwei Chen wrote:
> > Currently, Python FMMT tool does not support automatically select
> > FMMTConf.ini file which saves GuidTool settings.
> > This patch support this features.
> >
> > Cc: Rebecca Cran 
> > Cc: Liming Gao 
> > Cc: Bob Feng 
> > Signed-off-by: Yuwei Chen 
> > ---
> >   BaseTools/Source/Python/FMMT/core/GuidTools.py | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/BaseTools/Source/Python/FMMT/core/GuidTools.py
> > b/BaseTools/Source/Python/FMMT/core/GuidTools.py
> > index a25681709bc8..671d77c47de9 100644
> > --- a/BaseTools/Source/Python/FMMT/core/GuidTools.py
> > +++ b/BaseTools/Source/Python/FMMT/core/GuidTools.py
> > @@ -110,7 +110,7 @@ class GUIDTools:
> >   if os.environ['FmmtConfPath']:
> >   self.tooldef_file = os.path.join(os.environ['FmmtConfPath'],
> 'FmmtConf.ini')
> >   else:
> > -PathList = os.environ['PATH']
> > +PathList = os.environ['PATH'].split(';')
> >   for CurrentPath in PathList:
> >   if os.path.exists(os.path.join(CurrentPath, 
> > 'FmmtConf.ini')):
> >   self.tooldef_file = os.path.join(CurrentPath,
> > 'FmmtConf.ini')
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#106255): https://edk2.groups.io/g/devel/message/106255
Mute This Topic: https://groups.io/mt/99336046/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] [edk2-staging]BaseTools/FMMT: C FMMT match new version machine defines

2023-06-15 Thread Yuwei Chen
BaseTools have switch from EFI_IMAGE_MACHINE_*
to IMAGE_FILE_MACHINE_*. Thus, match the FCE & FMMT
tool in edk2-staging repo with the new version define.

Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
Signed-off-by: Yuwei Chen 
---
 BaseTools/Source/C/FMMT/Rebase.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/BaseTools/Source/C/FMMT/Rebase.c b/BaseTools/Source/C/FMMT/Rebase.c
index d32217d18c..059f39900d 100644
--- a/BaseTools/Source/C/FMMT/Rebase.c
+++ b/BaseTools/Source/C/FMMT/Rebase.c
@@ -159,8 +159,8 @@ EFI_NOT_FOUND   No compressed sections could be 
found.
   return Status;
 }
 
-//if ((ImageContext.Machine == EFI_IMAGE_MACHINE_ARMT) ||
-//  (ImageContext.Machine == EFI_IMAGE_MACHINE_AARCH64)) {
+//if ((ImageContext.Machine == IMAGE_FILE_MACHINE_ARMT) ||
+//  (ImageContext.Machine == IMAGE_FILE_MACHINE_AARCH64)) {
 //  mArm = TRUE;
 //}
 
@@ -435,8 +435,8 @@ EFI_NOT_FOUND   No compressed sections could be 
found.
   return Status;
 }
 
-//if ((ImageContext.Machine == EFI_IMAGE_MACHINE_ARMT) ||
-//  (ImageContext.Machine == EFI_IMAGE_MACHINE_AARCH64)) {
+//if ((ImageContext.Machine == IMAGE_FILE_MACHINE_ARMT) ||
+//  (ImageContext.Machine == IMAGE_FILE_MACHINE_AARCH64)) {
 //  mArm = TRUE;
 //}
 
@@ -835,8 +835,8 @@ Returns:
   //
   // Verify machine type is supported
   //
-  if ((*MachineType != EFI_IMAGE_MACHINE_IA32) && (*MachineType != 
EFI_IMAGE_MACHINE_X64) && (*MachineType != EFI_IMAGE_MACHINE_EBC) &&
-  (*MachineType != EFI_IMAGE_MACHINE_ARMT) && (*MachineType != 
EFI_IMAGE_MACHINE_AARCH64)) {
+  if ((*MachineType != IMAGE_FILE_MACHINE_IA32) && (*MachineType != 
IMAGE_FILE_MACHINE_X64) && (*MachineType != IMAGE_FILE_MACHINE_EBC) &&
+  (*MachineType != IMAGE_FILE_MACHINE_ARMT) && (*MachineType != 
IMAGE_FILE_MACHINE_AARCH64)) {
 Error (NULL, 0, 3000, "Invalid", "Unrecognized machine type in the PE32 
file.");
 return EFI_UNSUPPORTED;
   }
-- 
2.39.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#106131): https://edk2.groups.io/g/devel/message/106131
Mute This Topic: https://groups.io/mt/99562392/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 1/1] BaseTools: FMMT GuidTool Auto Select Config file

2023-06-05 Thread Yuwei Chen
Currently, Python FMMT tool does not support automatically
select FMMTConf.ini file which saves GuidTool settings.
This patch support this features.

Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
Signed-off-by: Yuwei Chen 
---
 BaseTools/Source/Python/FMMT/core/GuidTools.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/FMMT/core/GuidTools.py 
b/BaseTools/Source/Python/FMMT/core/GuidTools.py
index a25681709bc8..671d77c47de9 100644
--- a/BaseTools/Source/Python/FMMT/core/GuidTools.py
+++ b/BaseTools/Source/Python/FMMT/core/GuidTools.py
@@ -110,7 +110,7 @@ class GUIDTools:
 if os.environ['FmmtConfPath']:
 self.tooldef_file = os.path.join(os.environ['FmmtConfPath'], 
'FmmtConf.ini')
 else:
-PathList = os.environ['PATH']
+PathList = os.environ['PATH'].split(';')
 for CurrentPath in PathList:
 if os.path.exists(os.path.join(CurrentPath, 'FmmtConf.ini')):
 self.tooldef_file = os.path.join(CurrentPath, 
'FmmtConf.ini')
-- 
2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#105703): https://edk2.groups.io/g/devel/message/105703
Mute This Topic: https://groups.io/mt/99336046/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [Patch V1 1/3] BaseTools: fixing FMMT ShrinkFv issue

2023-04-18 Thread Yuwei Chen
For edk2-basetools repo, have made a PR for these three patches:
https://github.com/tianocore/edk2-basetools/pull/95

Thanks,
Christine (Yuwei)

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Yuwei
> Chen
> Sent: Tuesday, April 18, 2023 5:53 PM
> To: devel@edk2.groups.io
> Cc: Rebecca Cran ; Gao, Liming
> ; Feng, Bob C 
> Subject: [edk2-devel] [Patch V1 1/3] BaseTools: fixing FMMT ShrinkFv issue
> 
> 1. FvLength not change issue;
> 2. FileSystemGuid align with File Size;
> 
> Cc: Rebecca Cran 
> Cc: Liming Gao 
> Cc: Bob Feng 
> Signed-off-by: Yuwei Chen 
> ---
>  BaseTools/Source/Python/FMMT/core/FMMTOperation.py |  2 +-
>  BaseTools/Source/Python/FMMT/core/FvHandler.py | 10 +++---
>  2 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/FMMT/core/FMMTOperation.py
> b/BaseTools/Source/Python/FMMT/core/FMMTOperation.py
> index a86f8dda9a..d4aa339703 100644
> --- a/BaseTools/Source/Python/FMMT/core/FMMTOperation.py
> +++ b/BaseTools/Source/Python/FMMT/core/FMMTOperation.py
> @@ -188,7 +188,7 @@ def ExtractFfs(inputfile: str, Ffs_name: str, outputfile:
> str, Fv_name: str=None
> 
> FmmtParser.WholeFvTree.Findlist.remove(FmmtParser.WholeFvTree.Findlist
> [index])
>  if FmmtParser.WholeFvTree.Findlist != []:
>  TargetNode = FmmtParser.WholeFvTree.Findlist[0]
> -if TargetNode.type == FV_TREE or SEC_FV_TREE or DATA_FV_TREE:
> +if TargetNode.type == FV_TREE or TargetNode.type == SEC_FV_TREE or
> TargetNode.type == DATA_FV_TREE:
>  FinalData = struct2stream(TargetNode.Data.Header) +
> TargetNode.Data.Data
>  with open(outputfile, "wb") as f:
>  f.write(FinalData)
> diff --git a/BaseTools/Source/Python/FMMT/core/FvHandler.py
> b/BaseTools/Source/Python/FMMT/core/FvHandler.py
> index ff3d637623..b0cc1951a1 100644
> --- a/BaseTools/Source/Python/FMMT/core/FvHandler.py
> +++ b/BaseTools/Source/Python/FMMT/core/FvHandler.py
> @@ -279,7 +279,7 @@ class FvHandler:
>  ParTree.Child.remove(ParTree.Child[-1])
>  ParTree.Data.Free_Space = 0
>  ParTree.Data.Size += Needed_Space
> -ParTree.Data.Header.Fvlength = ParTree.Data.Size
> +ParTree.Data.Header.FvLength = ParTree.Data.Size
>  ModifyFvSystemGuid(ParTree)
>  for item in ParTree.Child:
>  if item.type == FFS_FREE_SPACE:
> @@ -650,8 +650,12 @@ class FvHandler:
>  Removed_Space = TargetFv.Data.Free_Space - New_Free_Space
>  TargetFv.Child[-1].Data.Data = b'\xff' * New_Free_Space
>  TargetFv.Data.Size -= Removed_Space
> -TargetFv.Data.Header.Fvlength = TargetFv.Data.Size
> -ModifyFvSystemGuid(TargetFv)
> +TargetFv.Data.Header.FvLength = TargetFv.Data.Size
> +if struct2stream(TargetFv.Data.Header.FileSystemGuid) ==
> EFI_FIRMWARE_FILE_SYSTEM3_GUID_BYTE:
> +if TargetFv.Data.Size <= 0xFF:
> +TargetFv.Data.Header.FileSystemGuid = ModifyGuidFormat(
> +"8c8ce578-8a3d-4f1c-9935-896185c32dd3")
> +
>  for item in TargetFv.Child:
>  if item.type == FFS_FREE_SPACE:
>  TargetFv.Data.Data += item.Data.Data + item.Data.PadData
> --
> 2.39.1.windows.1
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103159): https://edk2.groups.io/g/devel/message/103159
Mute This Topic: https://groups.io/mt/98340347/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [Patch V1 3/3] BaseTools: FMMT support ELF UPLD parser

2023-04-18 Thread Yuwei Chen
FMMT add new function to support the .elf file parsing.
Using '-v' option, the UPLD info will be printed out.

'''
- UNIVERSAL_PAYLOAD_INFO
  - 4 bytes align (BOOLEAN)
- Identifier
- SpecRevision
- Attribute
- Revision
- Capability
- ProducerId
- ImageId
UPLD Buffer
'''

Cc: Rebecca Cran 
Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yuwei Chen 
---
 BaseTools/Source/Python/FMMT/FMMT.py   |   2 ++
 BaseTools/Source/Python/FMMT/core/BinaryFactoryProduct.py  |  36 
+++-
 BaseTools/Source/Python/FMMT/core/BiosTree.py  |  48 
++--
 BaseTools/Source/Python/FMMT/core/BiosTreeNode.py  |  56 
+++-
 BaseTools/Source/Python/FMMT/core/FMMTParser.py|   2 +-
 BaseTools/Source/Python/FirmwareStorageFormat/UPLHeader.py | 244 

 6 files changed, 383 insertions(+), 5 deletions(-)

diff --git a/BaseTools/Source/Python/FMMT/FMMT.py 
b/BaseTools/Source/Python/FMMT/FMMT.py
index bf580b3843..26fc4c5792 100644
--- a/BaseTools/Source/Python/FMMT/FMMT.py
+++ b/BaseTools/Source/Python/FMMT/FMMT.py
@@ -84,6 +84,8 @@ class FMMT():
 ROOT_TYPE = ROOT_FFS_TREE
 elif filetype == '.sec':
 ROOT_TYPE = ROOT_SECTION_TREE
+elif filetype == '.elf':
+ROOT_TYPE = ROOT_ELF_TREE
 else:
 ROOT_TYPE = ROOT_TREE
 ViewFile(inputfile, ROOT_TYPE, layoutfilename, outputfile)
diff --git a/BaseTools/Source/Python/FMMT/core/BinaryFactoryProduct.py 
b/BaseTools/Source/Python/FMMT/core/BinaryFactoryProduct.py
index 2d4e6d9276..de174f26ab 100644
--- a/BaseTools/Source/Python/FMMT/core/BinaryFactoryProduct.py
+++ b/BaseTools/Source/Python/FMMT/core/BinaryFactoryProduct.py
@@ -15,10 +15,13 @@ from core.GuidTools import GUIDTools
 from utils.FmmtLogger import FmmtLogger as logger
 
 ROOT_TREE = 'ROOT'
+ROOT_ELF_TREE = 'ROOT_ELF_TREE'
 ROOT_FV_TREE = 'ROOT_FV_TREE'
 ROOT_FFS_TREE = 'ROOT_FFS_TREE'
 ROOT_SECTION_TREE = 'ROOT_SECTION_TREE'
 
+ELF_TREE = 'ELF'
+ELF_SECTION_TREE = 'ELF_SECTION_TREE'
 FV_TREE = 'FV'
 DATA_FV_TREE = 'DATA_FV'
 FFS_TREE = 'FFS'
@@ -49,6 +52,12 @@ class BinaryProduct():
 def ParserData():
 pass
 
+class ElfFactory(BinaryFactory):
+type = [ROOT_ELF_TREE, ELF_TREE]
+
+def Create_Product():
+return ElfProduct()
+
 class SectionFactory(BinaryFactory):
 type = [SECTION_TREE]
 
@@ -354,6 +363,30 @@ class FdProduct(BinaryProduct):
 tmp_index += 1
 return Fd_Struct
 
+class ElfSectionProduct(BinaryProduct):
+## Decompress the compressed section.
+def ParserData(self, Section_Tree, whole_Data: bytes, Rel_Whole_Offset: 
int=0) -> None:
+pass
+def ParserSectionData(self, Section_Tree, whole_Data: bytes, 
Rel_Whole_Offset: int=0) -> None:
+pass
+def ParserProgramData(self, Section_Tree, whole_Data: bytes, 
Rel_Whole_Offset: int=0) -> None:
+pass
+
+class ElfProduct(BinaryProduct):
+
+def ParserData(self, ParTree, Whole_Data: bytes, Rel_Whole_Offset: int=0) 
-> None:
+Elf_Info = ElfNode(Whole_Data)
+if Elf_Info.Header.ELF_PHOff != 0:
+Elf_Info.GetProgramList(Whole_Data[Elf_Info.Header.ELF_PHOff:])
+if Elf_Info.Header.ELF_SHOff != 0:
+Elf_Info.GetSectionList(Whole_Data[Elf_Info.Header.ELF_SHOff:])
+Elf_Info.FindUPLDSection(Whole_Data)
+Elf_Tree = BIOSTREE(Elf_Info.Name)
+Elf_Tree.type = ELF_TREE
+Elf_Info.Data = Whole_Data[Elf_Info.HeaderLength:]
+Elf_Tree.Data = Elf_Info
+ParTree.insertChild(Elf_Tree)
+
 class ParserEntry():
 FactoryTable:dict = {
 SECTION_TREE: SectionFactory,
@@ -364,6 +397,7 @@ class ParserEntry():
 SEC_FV_TREE: FvFactory,
 ROOT_FV_TREE: FdFactory,
 ROOT_TREE: FdFactory,
+ROOT_ELF_TREE: ElfFactory,
 }
 
 def GetTargetFactory(self, Tree_type: str) -> BinaryFactory:
@@ -377,4 +411,4 @@ class ParserEntry():
 def DataParser(self, Tree, Data: bytes, Offset: int) -> None:
 TargetFactory = self.GetTargetFactory(Tree.type)
 if TargetFactory:
-self.Generate_Product(TargetFactory, Tree, Data, Offset)
\ No newline at end of file
+self.Generate_Product(TargetFactory, Tree, Data, Offset)
diff --git a/BaseTools/Source/Python/FMMT/core/BiosTree.py 
b/BaseTools/Source/Python/FMMT/core/BiosTree.py
index 137f49748b..c5a7b017f4 100644
--- a/BaseTools/Source/Python/FMMT/core/BiosTree.py
+++ b/BaseTools/Source/Python/FMMT/core/BiosTree.py
@@ -12,6 +12,7 @@ ROOT_TREE = 'ROOT'
 ROOT_FV_TREE = 'ROOT_FV_TREE'
 ROOT_FFS_TRE

[edk2-devel] [Patch V1 3/3] BaseTools: FMMT support ELF UPLD parser

2023-04-18 Thread Yuwei Chen



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103156): https://edk2.groups.io/g/devel/message/103156
Mute This Topic: https://groups.io/mt/98340352/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [Patch V1 2/3] BaseTools: FMMT replace output file is not generated successfully

2023-04-18 Thread Yuwei Chen
For replace function, when target Ffs and new ffs are with
same size, the output file can not be generated successfully.
This patch fixes this issue.

Cc: Rebecca Cran 
Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yuwei Chen 
---
 BaseTools/Source/Python/FMMT/core/BiosTree.py  |  4 ++--
 BaseTools/Source/Python/FMMT/core/FvHandler.py | 19 ---
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/BaseTools/Source/Python/FMMT/core/BiosTree.py 
b/BaseTools/Source/Python/FMMT/core/BiosTree.py
index d8fa474335..137f49748b 100644
--- a/BaseTools/Source/Python/FMMT/core/BiosTree.py
+++ b/BaseTools/Source/Python/FMMT/core/BiosTree.py
@@ -56,7 +56,7 @@ class BIOSTREE:
 if len(self.Child) == 0:
 self.Child.append(newNode)
 else:
-if not pos:
+if not pos or pos == len(self.Child):
 LastTree = self.Child[-1]
 self.Child.append(newNode)
 LastTree.NextRel = newNode
@@ -195,4 +195,4 @@ class BIOSTREE:
 for item in self.Child:
 TreeInfo[key].setdefault('Files',[]).append( item.ExportTree())
 
-return TreeInfo
\ No newline at end of file
+return TreeInfo
diff --git a/BaseTools/Source/Python/FMMT/core/FvHandler.py 
b/BaseTools/Source/Python/FMMT/core/FvHandler.py
index b0cc1951a1..49bbc35baa 100644
--- a/BaseTools/Source/Python/FMMT/core/FvHandler.py
+++ b/BaseTools/Source/Python/FMMT/core/FvHandler.py
@@ -387,7 +387,21 @@ class FvHandler:
 if self.NewFfs.Data.Size >= self.TargetFfs.Data.Size:
 Needed_Space = self.NewFfs.Data.Size + 
len(self.NewFfs.Data.PadData) - self.TargetFfs.Data.Size - 
len(self.TargetFfs.Data.PadData)
 # If TargetFv have enough free space, just move part of the free 
space to NewFfs.
-if TargetFv.Data.Free_Space >= Needed_Space:
+if Needed_Space == 0:
+Target_index = TargetFv.Child.index(self.TargetFfs)
+TargetFv.Child.remove(self.TargetFfs)
+TargetFv.insertChild(self.NewFfs, Target_index)
+# Modify TargetFv Header and ExtHeader info.
+TargetFv.Data.ModFvExt()
+TargetFv.Data.ModFvSize()
+TargetFv.Data.ModExtHeaderData()
+ModifyFvExtData(TargetFv)
+TargetFv.Data.ModCheckSum()
+# Recompress from the Fv node to update all the related node 
data.
+self.CompressData(TargetFv)
+# return the Status
+self.Status = True
+elif TargetFv.Data.Free_Space >= Needed_Space:
 # Modify TargetFv Child info and BiosTree.
 TargetFv.Child[-1].Data.Data = b'\xff' * 
(TargetFv.Data.Free_Space - Needed_Space)
 TargetFv.Data.Free_Space -= Needed_Space
@@ -450,7 +464,6 @@ class FvHandler:
 Target_index = TargetFv.Child.index(self.TargetFfs)
 TargetFv.Child.remove(self.TargetFfs)
 TargetFv.insertChild(self.NewFfs, Target_index)
-self.Status = True
 # If TargetFv do not have free space, create free space for Fv.
 else:
 New_Free_Space_Tree = BIOSTREE('FREE_SPACE')
@@ -461,7 +474,6 @@ class FvHandler:
 Target_index = TargetFv.Child.index(self.TargetFfs)
 TargetFv.Child.remove(self.TargetFfs)
 TargetFv.insertChild(self.NewFfs, Target_index)
-self.Status = True
 # Modify TargetFv Header and ExtHeader info.
 TargetFv.Data.ModFvExt()
 TargetFv.Data.ModFvSize()
@@ -470,6 +482,7 @@ class FvHandler:
 TargetFv.Data.ModCheckSum()
 # Recompress from the Fv node to update all the related node data.
 self.CompressData(TargetFv)
+self.Status = True
 logger.debug('Done!')
 return self.Status
 
-- 
2.39.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103155): https://edk2.groups.io/g/devel/message/103155
Mute This Topic: https://groups.io/mt/98340349/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [Patch V1 1/3] BaseTools: fixing FMMT ShrinkFv issue

2023-04-18 Thread Yuwei Chen
1. FvLength not change issue;
2. FileSystemGuid align with File Size;

Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
Signed-off-by: Yuwei Chen 
---
 BaseTools/Source/Python/FMMT/core/FMMTOperation.py |  2 +-
 BaseTools/Source/Python/FMMT/core/FvHandler.py | 10 +++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Source/Python/FMMT/core/FMMTOperation.py 
b/BaseTools/Source/Python/FMMT/core/FMMTOperation.py
index a86f8dda9a..d4aa339703 100644
--- a/BaseTools/Source/Python/FMMT/core/FMMTOperation.py
+++ b/BaseTools/Source/Python/FMMT/core/FMMTOperation.py
@@ -188,7 +188,7 @@ def ExtractFfs(inputfile: str, Ffs_name: str, outputfile: 
str, Fv_name: str=None
 
FmmtParser.WholeFvTree.Findlist.remove(FmmtParser.WholeFvTree.Findlist[index])
 if FmmtParser.WholeFvTree.Findlist != []:
 TargetNode = FmmtParser.WholeFvTree.Findlist[0]
-if TargetNode.type == FV_TREE or SEC_FV_TREE or DATA_FV_TREE:
+if TargetNode.type == FV_TREE or TargetNode.type == SEC_FV_TREE or 
TargetNode.type == DATA_FV_TREE:
 FinalData = struct2stream(TargetNode.Data.Header) + 
TargetNode.Data.Data
 with open(outputfile, "wb") as f:
 f.write(FinalData)
diff --git a/BaseTools/Source/Python/FMMT/core/FvHandler.py 
b/BaseTools/Source/Python/FMMT/core/FvHandler.py
index ff3d637623..b0cc1951a1 100644
--- a/BaseTools/Source/Python/FMMT/core/FvHandler.py
+++ b/BaseTools/Source/Python/FMMT/core/FvHandler.py
@@ -279,7 +279,7 @@ class FvHandler:
 ParTree.Child.remove(ParTree.Child[-1])
 ParTree.Data.Free_Space = 0
 ParTree.Data.Size += Needed_Space
-ParTree.Data.Header.Fvlength = ParTree.Data.Size
+ParTree.Data.Header.FvLength = ParTree.Data.Size
 ModifyFvSystemGuid(ParTree)
 for item in ParTree.Child:
 if item.type == FFS_FREE_SPACE:
@@ -650,8 +650,12 @@ class FvHandler:
 Removed_Space = TargetFv.Data.Free_Space - New_Free_Space
 TargetFv.Child[-1].Data.Data = b'\xff' * New_Free_Space
 TargetFv.Data.Size -= Removed_Space
-TargetFv.Data.Header.Fvlength = TargetFv.Data.Size
-ModifyFvSystemGuid(TargetFv)
+TargetFv.Data.Header.FvLength = TargetFv.Data.Size
+if struct2stream(TargetFv.Data.Header.FileSystemGuid) == 
EFI_FIRMWARE_FILE_SYSTEM3_GUID_BYTE:
+if TargetFv.Data.Size <= 0xFF:
+TargetFv.Data.Header.FileSystemGuid = ModifyGuidFormat(
+"8c8ce578-8a3d-4f1c-9935-896185c32dd3")
+
 for item in TargetFv.Child:
 if item.type == FFS_FREE_SPACE:
 TargetFv.Data.Data += item.Data.Data + item.Data.PadData
-- 
2.39.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103154): https://edk2.groups.io/g/devel/message/103154
Mute This Topic: https://groups.io/mt/98340347/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] Maintainers: Add 'Yuwei Chen' as BaseTools maintainer.

2023-03-08 Thread Yuwei Chen
Add myself as maintainer for the BaseTools Pkg.

Cc: Michael D Kinney 
Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yuwei Chen 
---
 Maintainers.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Maintainers.txt b/Maintainers.txt
index d4607a..463d9567e1 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -179,7 +179,7 @@ F: BaseTools/
 W: https://github.com/tianocore/tianocore.github.io/wiki/BaseTools
 M: Bob Feng  [BobCF]
 M: Liming Gao  [lgao4]
-R: Yuwei Chen  [YuweiChen1110]
+M: Yuwei Chen  [YuweiChen1110]
 
 CryptoPkg
 F: CryptoPkg/
-- 
2.39.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#100894): https://edk2.groups.io/g/devel/message/100894
Mute This Topic: https://groups.io/mt/97489080/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel][PATCH V1 1/1] BaseTools: Generate compile information in build report

2023-02-14 Thread Yuwei Chen
Hi Mike, thanks for reminder.

Hi Willy, currently, BaseTools related changes will be implemented on the 
edk2-basetools repo. Please send the patch based on the edk2-basetools repo~ 

Thanks,
Christine

> -Original Message-
> From: Kinney, Michael D 
> Sent: Wednesday, February 15, 2023 11:43 AM
> To: devel@edk2.groups.io; Chen, Christine ;
> Palomino Sosa, Guillermo A 
> Cc: Feng, Bob C ; Gao, Liming
> ; Kinney, Michael D
> 
> Subject: RE: [edk2-devel][PATCH V1 1/1] BaseTools: Generate compile
> information in build report
> 
> Has this been reviewed for edk2-basetools repo?
> 
> Mike
> 
> > -Original Message-
> > From: devel@edk2.groups.io  On Behalf Of Yuwei
> > Chen
> > Sent: Tuesday, February 14, 2023 6:44 PM
> > To: Palomino Sosa, Guillermo A ;
> > devel@edk2.groups.io
> > Cc: Feng, Bob C ; Gao, Liming
> > 
> > Subject: Re: [edk2-devel][PATCH V1 1/1] BaseTools: Generate compile
> > information in build report
> >
> > Reviewed-by: Yuwei Chen 
> >
> > > -Original Message-
> > > From: Palomino Sosa, Guillermo A
> > > 
> > > Sent: Tuesday, February 7, 2023 11:07 AM
> > > To: devel@edk2.groups.io
> > > Cc: Feng, Bob C ; Gao, Liming
> > > ; Chen, Christine 
> > > Subject: [edk2-devel][PATCH V1 1/1] BaseTools: Generate compile
> > > information in build report
> > >
> > > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2850
> > >
> > > Add "-Y REPORT_INFO" option to build command to generate compile
> > > information as part of BuildReport.
> > > This option generates files to be used by external tools as IDE's to
> > > enhance functionality.
> > > Files are created inside build folder:
> > > ///CompileInfo
> > >
> > > Files created:
> > > * compile_commands.json - Compilation Database. To be used by IDE's
> > >   to enable advance features
> > > * cscope.files - List of files used in compilation. Used by Cscope to 
> > > parse
> > >   C code and provide browse functionality.
> > > * module_report.json - Module data form buildReport in Json format.
> > >
> > > Signed-off-by: Guillermo Antonio Palomino Sosa
> > > 
> > > ---
> > >  BaseTools/Source/Python/build/BuildReport.py  | 139
> > > +++-
> > >  BaseTools/Source/Python/build/buildoptions.py |   4 +-
> > >  2 files changed, 140 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/BaseTools/Source/Python/build/BuildReport.py
> > > b/BaseTools/Source/Python/build/BuildReport.py
> > > index 468772930c..33b43d471f 100644
> > > --- a/BaseTools/Source/Python/build/BuildReport.py
> > > +++ b/BaseTools/Source/Python/build/BuildReport.py
> > > @@ -10,6 +10,8 @@
> > >
> > >  ## Import Modules
> > >  #
> > > +import json
> > > +from pathlib import Path
> > >  import Common.LongFilePathOs as os
> > >  import re
> > >  import platform
> > > @@ -41,6 +43,7 @@ from Common.DataType import *  import
> collections
> > > from Common.Expression import *  from GenFds.AprioriSection import
> > > DXE_APRIORI_GUID, PEI_APRIORI_GUID
> > > +from AutoGen.IncludesAutoGen import IncludesAutoGen
> > >
> > >  ## Pattern to extract contents in EDK DXS files
> > > gDxsDependencyPattern =
> > > re.compile(r"DEPENDENCY_START(.+)DEPENDENCY_END", re.DOTALL)
> @@ -
> > > 2298,6 +2301,10 @@ class BuildReport(object):
> > >  def GenerateReport(self, BuildDuration, AutoGenTime, MakeTime,
> > > GenFdsTime):
> > >  if self.ReportFile:
> > >  try:
> > > +
> > > +if "COMPILE_INFO" in self.ReportType:
> > > +self.GenerateCompileInfo()
> > > +
> > >  File = []
> > >  for (Wa, MaList) in self.ReportList:
> > >  PlatformReport(Wa, MaList,
> > > self.ReportType).GenerateReport(File, BuildDuration, AutoGenTime,
> > > MakeTime, GenFdsTime, self.ReportType) @@ -2310,7 +2317,137 @@
> class
> > > BuildReport(object):
> > >  EdkLogger.error("BuildReport", CODE_ERROR, "Unknown
> > > fatal error when generating build report",
> > > ExtraData=self.ReportFile,
> > > RaiseError=False)
> > >  EdkLogger.quiet("(Python %s on %s\n

Re: [edk2-devel][PATCH V1 1/1] BaseTools: Generate compile information in build report

2023-02-14 Thread Yuwei Chen
Reviewed-by: Yuwei Chen 

> -Original Message-
> From: Palomino Sosa, Guillermo A 
> Sent: Tuesday, February 7, 2023 11:07 AM
> To: devel@edk2.groups.io
> Cc: Feng, Bob C ; Gao, Liming
> ; Chen, Christine 
> Subject: [edk2-devel][PATCH V1 1/1] BaseTools: Generate compile
> information in build report
> 
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2850
> 
> Add "-Y REPORT_INFO" option to build command to generate compile
> information as part of BuildReport.
> This option generates files to be used by external tools as IDE's to enhance
> functionality.
> Files are created inside build folder:
> ///CompileInfo
> 
> Files created:
> * compile_commands.json - Compilation Database. To be used by IDE's
>   to enable advance features
> * cscope.files - List of files used in compilation. Used by Cscope to parse
>   C code and provide browse functionality.
> * module_report.json - Module data form buildReport in Json format.
> 
> Signed-off-by: Guillermo Antonio Palomino Sosa
> 
> ---
>  BaseTools/Source/Python/build/BuildReport.py  | 139
> +++-
>  BaseTools/Source/Python/build/buildoptions.py |   4 +-
>  2 files changed, 140 insertions(+), 3 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/build/BuildReport.py
> b/BaseTools/Source/Python/build/BuildReport.py
> index 468772930c..33b43d471f 100644
> --- a/BaseTools/Source/Python/build/BuildReport.py
> +++ b/BaseTools/Source/Python/build/BuildReport.py
> @@ -10,6 +10,8 @@
> 
>  ## Import Modules
>  #
> +import json
> +from pathlib import Path
>  import Common.LongFilePathOs as os
>  import re
>  import platform
> @@ -41,6 +43,7 @@ from Common.DataType import *  import collections
> from Common.Expression import *  from GenFds.AprioriSection import
> DXE_APRIORI_GUID, PEI_APRIORI_GUID
> +from AutoGen.IncludesAutoGen import IncludesAutoGen
> 
>  ## Pattern to extract contents in EDK DXS files  gDxsDependencyPattern =
> re.compile(r"DEPENDENCY_START(.+)DEPENDENCY_END", re.DOTALL) @@ -
> 2298,6 +2301,10 @@ class BuildReport(object):
>  def GenerateReport(self, BuildDuration, AutoGenTime, MakeTime,
> GenFdsTime):
>  if self.ReportFile:
>  try:
> +
> +if "COMPILE_INFO" in self.ReportType:
> +self.GenerateCompileInfo()
> +
>  File = []
>  for (Wa, MaList) in self.ReportList:
>  PlatformReport(Wa, MaList,
> self.ReportType).GenerateReport(File, BuildDuration, AutoGenTime,
> MakeTime, GenFdsTime, self.ReportType) @@ -2310,7 +2317,137 @@ class
> BuildReport(object):
>  EdkLogger.error("BuildReport", CODE_ERROR, "Unknown fatal
> error when generating build report", ExtraData=self.ReportFile,
> RaiseError=False)
>  EdkLogger.quiet("(Python %s on %s\n%s)" %
> (platform.python_version(), sys.platform, traceback.format_exc()))
> 
> +
> +##
> +# Generates compile data files to be used by external tools.
> +# Compile information will be generated in
> ///CompileInfo
> +# Files generated: compile_commands.json, cscope.files,
> modules_report.json
> +#
> +# @param selfThe object pointer
> +#
> +def GenerateCompileInfo(self):
> +try:
> +# Lists for the output elements
> +compile_commands = []
> +used_files = set()
> +module_report = []
> +
> +for (Wa, MaList) in self.ReportList:
> +# Obtain list of all processed Workspace files
> +for file_path in Wa._GetMetaFiles(Wa.BuildTarget, 
> Wa.ToolChain):
> +used_files.add(file_path)
> +
> +for autoGen in Wa.AutoGenObjectList:
> +
> +# Loop through all modules
> +for module in (autoGen.LibraryAutoGenList +
> autoGen.ModuleAutoGenList):
> +
> +used_files.add(module.MetaFile.Path)
> +
> +# Main elements of module report
> +module_report_data = {}
> +module_report_data["Name"] = module.Name
> +module_report_data["Arch"] = module.Arch
> +module_report_data["Path"] = module.MetaFile.Path
> +module_report_data["Guid"] = module.Guid
> +module_report_data["BuildType"] = module.BuildType
> +module_report_data["IsLibrary"] = module.IsLibrary
> +m

[edk2-devel] [Patch V1 2/2] BaseTools: FMMT support ELF UPLD parser

2023-01-30 Thread Yuwei Chen
FMMT add new function to support the .elf file parsing.
Using '-v' option, the UPLD info will be printed out.

'''
- UNIVERSAL_PAYLOAD_INFO
  - 4 bytes align (BOOLEAN)
- Identifier
- SpecRevision
- Attribute
- Revision
- Capability
- ProducerId
- ImageId
UPLD Buffer
'''

Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yuwei Chen 
---
 edk2basetools/FMMT/FMMT.py   |   2 ++
 edk2basetools/FMMT/core/BinaryFactoryProduct.py  |  36 
+++-
 edk2basetools/FMMT/core/BiosTree.py  |  49 
+++--
 edk2basetools/FMMT/core/BiosTreeNode.py  |  56 
+++-
 edk2basetools/FMMT/core/FMMTParser.py|   2 +-
 edk2basetools/FirmwareStorageFormat/UPLHeader.py | 244 

 6 files changed, 384 insertions(+), 5 deletions(-)

diff --git a/edk2basetools/FMMT/FMMT.py b/edk2basetools/FMMT/FMMT.py
index 5f2c8eb9f3..29aec65f35 100644
--- a/edk2basetools/FMMT/FMMT.py
+++ b/edk2basetools/FMMT/FMMT.py
@@ -84,6 +84,8 @@ def View(self, inputfile: str, layoutfilename: str=None, 
outputfile: str=None) -
 ROOT_TYPE = ROOT_FFS_TREE
 elif filetype == '.sec':
 ROOT_TYPE = ROOT_SECTION_TREE
+elif filetype == '.elf':
+ROOT_TYPE = ROOT_ELF_TREE
 else:
 ROOT_TYPE = ROOT_TREE
 ViewFile(inputfile, ROOT_TYPE, layoutfilename, outputfile)
diff --git a/edk2basetools/FMMT/core/BinaryFactoryProduct.py 
b/edk2basetools/FMMT/core/BinaryFactoryProduct.py
index ecae1ca94a..dde1f3b64e 100644
--- a/edk2basetools/FMMT/core/BinaryFactoryProduct.py
+++ b/edk2basetools/FMMT/core/BinaryFactoryProduct.py
@@ -15,10 +15,13 @@
 from utils.FmmtLogger import FmmtLogger as logger
 
 ROOT_TREE = 'ROOT'
+ROOT_ELF_TREE = 'ROOT_ELF_TREE'
 ROOT_FV_TREE = 'ROOT_FV_TREE'
 ROOT_FFS_TREE = 'ROOT_FFS_TREE'
 ROOT_SECTION_TREE = 'ROOT_SECTION_TREE'
 
+ELF_TREE = 'ELF'
+ELF_SECTION_TREE = 'ELF_SECTION_TREE'
 FV_TREE = 'FV'
 DATA_FV_TREE = 'DATA_FV'
 FFS_TREE = 'FFS'
@@ -73,6 +76,12 @@ class FdFactory(BinaryFactory):
 def Create_Product():
 return FdProduct()
 
+class ElfFactory(BinaryFactory):
+type = [ROOT_ELF_TREE, ELF_TREE]
+
+def Create_Product():
+return ElfProduct()
+
 class SectionProduct(BinaryProduct):
 ## Decompress the compressed section.
 def ParserData(self, Section_Tree, whole_Data: bytes, Rel_Whole_Offset: 
int=0) -> None:
@@ -354,6 +363,30 @@ def GetFvFromFd(self, whole_data: bytes=b'') -> list:
 tmp_index += 1
 return Fd_Struct
 
+class ElfSectionProduct(BinaryProduct):
+## Decompress the compressed section.
+def ParserData(self, Section_Tree, whole_Data: bytes, Rel_Whole_Offset: 
int=0) -> None:
+pass
+def ParserSectionData(self, Section_Tree, whole_Data: bytes, 
Rel_Whole_Offset: int=0) -> None:
+pass
+def ParserProgramData(self, Section_Tree, whole_Data: bytes, 
Rel_Whole_Offset: int=0) -> None:
+pass
+
+class ElfProduct(BinaryProduct):
+
+def ParserData(self, ParTree, Whole_Data: bytes, Rel_Whole_Offset: int=0) 
-> None:
+Elf_Info = ElfNode(Whole_Data)
+if Elf_Info.Header.ELF_PHOff != 0:
+Elf_Info.GetProgramList(Whole_Data[Elf_Info.Header.ELF_PHOff:])
+if Elf_Info.Header.ELF_SHOff != 0:
+Elf_Info.GetSectionList(Whole_Data[Elf_Info.Header.ELF_SHOff:])
+Elf_Info.FindUPLDSection(Whole_Data)
+Elf_Tree = BIOSTREE(Elf_Info.Name)
+Elf_Tree.type = ELF_TREE
+Elf_Info.Data = Whole_Data[Elf_Info.HeaderLength:]
+Elf_Tree.Data = Elf_Info
+ParTree.insertChild(Elf_Tree)
+
 class ParserEntry():
 FactoryTable:dict = {
 SECTION_TREE: SectionFactory,
@@ -364,6 +397,7 @@ class ParserEntry():
 SEC_FV_TREE: FvFactory,
 ROOT_FV_TREE: FdFactory,
 ROOT_TREE: FdFactory,
+ROOT_ELF_TREE: ElfFactory,
 }
 
 def GetTargetFactory(self, Tree_type: str) -> BinaryFactory:
@@ -377,4 +411,4 @@ def Generate_Product(self, TargetFactory: BinaryFactory, 
Tree, Data: bytes, Offs
 def DataParser(self, Tree, Data: bytes, Offset: int) -> None:
 TargetFactory = self.GetTargetFactory(Tree.type)
 if TargetFactory:
-self.Generate_Product(TargetFactory, Tree, Data, Offset)

\ No newline at end of file
+self.Generate_Product(TargetFactory, Tree, Data, Offset)
diff --git a/edk2basetools/FMMT/core/BiosTree.py 
b/edk2basetools/FMMT/core/BiosTree.py
index 14fb007b14..bed9533cb1 100644
--- a/edk2basetools/FMMT/core/BiosTree.py
+++ b/edk2basetools/FMMT/core/BiosTree.py
@@ -12,6 +12,7 @@
 ROOT

[edk2-devel] [Patch V1 1/2] BaseTools: Fix FMMT FvHandler replace status bug

2023-01-30 Thread Yuwei Chen
For replace function, when target Ffs and new ffs are with
same size, the output file can not be generated successfully.
This patch fixes this issue.

Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yuwei Chen 
---
 edk2basetools/FMMT/core/BiosTree.py  |  4 ++--
 edk2basetools/FMMT/core/FvHandler.py | 20 +---
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/edk2basetools/FMMT/core/BiosTree.py 
b/edk2basetools/FMMT/core/BiosTree.py
index ae889f68da..14fb007b14 100644
--- a/edk2basetools/FMMT/core/BiosTree.py
+++ b/edk2basetools/FMMT/core/BiosTree.py
@@ -56,7 +56,7 @@ def insertChild(self, newNode, pos: int=None) -> None:
 if len(self.Child) == 0:
 self.Child.append(newNode)
 else:
-if not pos:
+if not pos or pos == len(self.Child):
 LastTree = self.Child[-1]
 self.Child.append(newNode)
 LastTree.NextRel = newNode
@@ -195,4 +195,4 @@ def ExportTree(self,TreeInfo: dict=None) -> dict:
 for item in self.Child:
 TreeInfo[key].setdefault('Files',[]).append( item.ExportTree())
 
-return TreeInfo
\ No newline at end of file
+return TreeInfo
diff --git a/edk2basetools/FMMT/core/FvHandler.py 
b/edk2basetools/FMMT/core/FvHandler.py
index dc303c2c44..0ce573091e 100644
--- a/edk2basetools/FMMT/core/FvHandler.py
+++ b/edk2basetools/FMMT/core/FvHandler.py
@@ -387,7 +387,22 @@ def ReplaceFfs(self) -> bool:
 if self.NewFfs.Data.Size >= self.TargetFfs.Data.Size:
 Needed_Space = self.NewFfs.Data.Size + 
len(self.NewFfs.Data.PadData) - self.TargetFfs.Data.Size - 
len(self.TargetFfs.Data.PadData)
 # If TargetFv have enough free space, just move part of the free 
space to NewFfs.
-if TargetFv.Data.Free_Space >= Needed_Space:
+if Needed_Space == 0:
+Target_index = TargetFv.Child.index(self.TargetFfs)
+TargetFv.Child.remove(self.TargetFfs)
+TargetFv.insertChild(self.NewFfs, Target_index)
+# Modify TargetFv Header and ExtHeader info.
+TargetFv.Data.ModFvExt()
+TargetFv.Data.ModFvSize()
+TargetFv.Data.ModExtHeaderData()
+ModifyFvExtData(TargetFv)
+TargetFv.Data.ModCheckSum()
+# Recompress from the Fv node to update all the related node 
data.
+self.CompressData(TargetFv)
+# return the Status
+self.Status = True
+elif TargetFv.Data.Free_Space >= Needed_Space:
+ # Modify TargetFv Child info and BiosTree.
 # Modify TargetFv Child info and BiosTree.
 TargetFv.Child[-1].Data.Data = b'\xff' * 
(TargetFv.Data.Free_Space - Needed_Space)
 TargetFv.Data.Free_Space -= Needed_Space
@@ -450,7 +465,6 @@ def ReplaceFfs(self) -> bool:
 Target_index = TargetFv.Child.index(self.TargetFfs)
 TargetFv.Child.remove(self.TargetFfs)
 TargetFv.insertChild(self.NewFfs, Target_index)
-self.Status = True
 # If TargetFv do not have free space, create free space for Fv.
 else:
 New_Free_Space_Tree = BIOSTREE('FREE_SPACE')
@@ -461,7 +475,6 @@ def ReplaceFfs(self) -> bool:
 Target_index = TargetFv.Child.index(self.TargetFfs)
 TargetFv.Child.remove(self.TargetFfs)
 TargetFv.insertChild(self.NewFfs, Target_index)
-self.Status = True
 # Modify TargetFv Header and ExtHeader info.
 TargetFv.Data.ModFvExt()
 TargetFv.Data.ModFvSize()
@@ -470,6 +483,7 @@ def ReplaceFfs(self) -> bool:
 TargetFv.Data.ModCheckSum()
 # Recompress from the Fv node to update all the related node data.
 self.CompressData(TargetFv)
+self.Status = True
 logger.debug('Done!')
 return self.Status
 
-- 
2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#99292): https://edk2.groups.io/g/devel/message/99292
Mute This Topic: https://groups.io/mt/96624020/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [Patch V2 3/3] [edk2-staging]BaseTools: Add new build option for Variable default value generation

2023-01-29 Thread Yuwei Chen
Add new build option "--gen-default-variable-bin" for Variable
default value generation from Python VFR tool's extended json
output file.

Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yuwei Chen 
---
 BaseTools/Source/Python/AutoGen/DataPipe.py |   2 ++
 BaseTools/Source/Python/AutoGen/GenDefaultVar.py| 577 
+
 BaseTools/Source/Python/AutoGen/ModuleAutoGen.py|   8 
 BaseTools/Source/Python/Common/GlobalData.py|   5 +
 BaseTools/Source/Python/VfrCompiler/VfrSyntaxVisitor.py |  12 ++--
 BaseTools/Source/Python/build/build.py  |  19 
++-
 BaseTools/Source/Python/build/buildoptions.py   |   1 +
 7 files changed, 617 insertions(+), 7 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/DataPipe.py 
b/BaseTools/Source/Python/AutoGen/DataPipe.py
index c700baf7b7..e45b4a928a 100755
--- a/BaseTools/Source/Python/AutoGen/DataPipe.py
+++ b/BaseTools/Source/Python/AutoGen/DataPipe.py
@@ -173,3 +173,5 @@ class MemoryDataPipe(DataPipe):
 self.DataContainer = 
{"gPlatformFinalPcds":GlobalData.gPlatformFinalPcds}
 
 self.DataContainer = {"VfrYamlEnable": GlobalData.gVfrYamlEnable}
+
+self.DataContainer = {"GenDefaultVarBin": GlobalData.gGenDefaultVarBin}
diff --git a/BaseTools/Source/Python/AutoGen/GenDefaultVar.py 
b/BaseTools/Source/Python/AutoGen/GenDefaultVar.py
new file mode 100644
index 00..859d4f25eb
--- /dev/null
+++ b/BaseTools/Source/Python/AutoGen/GenDefaultVar.py
@@ -0,0 +1,577 @@
+import json
+from ctypes import *
+import re
+import copy
+from struct import unpack
+import os
+import Common.EdkLogger as EdkLogger
+
+class GUID(Structure):
+_fields_ = [
+('Guid1',c_uint32),
+('Guid2',c_uint16),
+('Guid3',c_uint16),
+('Guid4',ARRAY(c_uint8, 8)),
+]
+
+def from_list(self, listformat):
+self.Guid1 = listformat[0]
+self.Guid2 = listformat[1]
+self.Guid3 = listformat[2]
+for i in range(8):
+self.Guid4[i] = listformat[i+3]
+
+def __cmp__(self, otherguid):
+if isinstance(otherguid, GUID):
+return 1
+rt = False
+if self.Guid1 == otherguid.Guid1 and self.Guid2 == otherguid.Guid2 and 
self.Guid3 == otherguid.Guid3:
+rt = True
+for i in range(8):
+rt = rt & (self.Guid4[i] == otherguid.Guid4[i])
+return rt
+
+
+class TIME(Structure):
+_fields_ = [
+('Year', c_uint16),
+('Month',c_uint8),
+('Day',  c_uint8),
+('Hour', c_uint8),
+('Minute',   c_uint8),
+('Second',   c_uint8),
+('Pad1', c_uint8),
+('Nanosecond',   c_uint32),
+('TimeZone', c_uint16),
+('Daylight', c_uint8),
+('Pad2', c_uint8),
+]
+def __init__(self):
+self.Year = 0x0
+self.Month = 0x0
+self.Day = 0x0
+self.Hour = 0x0
+self.Minute = 0x0
+self.Second = 0x0
+self.Pad1 = 0x0
+self.Nanosecond = 0x0
+self.TimeZone = 0x0
+self.Daylight = 0x0
+self.Pad2 = 0x0
+
+
+EFI_VARIABLE_GUID = [0xddcf3616, 0x3275, 0x4164,
+ 0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d]
+EFI_AUTHENTICATED_VARIABLE_GUID = [
+0xaaf32c78, 0x947b, 0x439a, 0xa1, 0x80, 0x2e, 0x14, 0x4e, 0xc3, 0x77, 0x92]
+
+AuthVarGuid = GUID()
+AuthVarGuid.from_list(EFI_AUTHENTICATED_VARIABLE_GUID)
+VarGuid = GUID()
+VarGuid.from_list(EFI_VARIABLE_GUID)
+
+# Variable Store Header Format.
+VARIABLE_STORE_FORMATTED = 0x5a
+# Variable Store Header State.
+VARIABLE_STORE_HEALTHY = 0xfe
+
+
+class VARIABLE_STORE_HEADER(Structure):
+_fields_ = [
+('Signature',GUID),
+('Size', c_uint32),
+('Format',   c_uint8),
+('State',c_uint8),
+('Reserved', c_uint16),
+('Reserved1',c_uint32),
+]
+
+
+# Variable data start flag.
+VARIABLE_DATA = 0x55AA
+
+# Variable State flags.
+VAR_IN_DELETED_TRANSITION = 0xfe
+VAR_DELETED = 0xfd
+VAR_HEADER_VALID_ONLY = 0x7f
+VAR_ADDED = 0x3f
+
+
+cla

[edk2-devel] [Patch V2 2/3] [edk2-staging]BaseTools: Add new build option for PyVfrCompiler yaml generation

2023-01-29 Thread Yuwei Chen
Add new build option "--vfr-yaml-enable" for Python VfrCompiler
extended output yaml file generation.

Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yuwei Chen 
---
 BaseTools/Source/Python/AutoGen/DataPipe.py  |  2 ++
 BaseTools/Source/Python/AutoGen/ModuleAutoGen.py |  8 
 BaseTools/Source/Python/Common/GlobalData.py |  4 
 BaseTools/Source/Python/build/build.py   | 33 
+
 BaseTools/Source/Python/build/buildoptions.py|  1 +
 5 files changed, 48 insertions(+)

diff --git a/BaseTools/Source/Python/AutoGen/DataPipe.py 
b/BaseTools/Source/Python/AutoGen/DataPipe.py
index 848c7a8296..c700baf7b7 100755
--- a/BaseTools/Source/Python/AutoGen/DataPipe.py
+++ b/BaseTools/Source/Python/AutoGen/DataPipe.py
@@ -171,3 +171,5 @@ class MemoryDataPipe(DataPipe):
 self.DataContainer = 
{"EnableGenfdsMultiThread":GlobalData.gEnableGenfdsMultiThread}
 
 self.DataContainer = 
{"gPlatformFinalPcds":GlobalData.gPlatformFinalPcds}
+
+self.DataContainer = {"VfrYamlEnable": GlobalData.gVfrYamlEnable}
diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py 
b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
index d05410b329..eb81c3f3af 100755
--- a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
@@ -434,6 +434,14 @@ class ModuleAutoGen(AutoGen):
 def DebugDir(self):
 return _MakeDir((self.BuildDir, "DEBUG"))
 
+@cached_property
+def VarIFiles(self):
+rt = []
+for SrcFile in self.SourceFileList:
+if SrcFile.Ext.lower() == '.vfr':
+rt.append(os.path.join(self.OutputDir, 
"{}.i".format(SrcFile.BaseName)))
+return rt
+
 ## Return the path of custom file
 @cached_property
 def CustomMakefile(self):
diff --git a/BaseTools/Source/Python/Common/GlobalData.py 
b/BaseTools/Source/Python/Common/GlobalData.py
index 197bd83666..039a9648aa 100755
--- a/BaseTools/Source/Python/Common/GlobalData.py
+++ b/BaseTools/Source/Python/Common/GlobalData.py
@@ -123,3 +123,7 @@ gSikpAutoGenCache = set()
 # Common lock for the file access in multiple process AutoGens
 file_lock = None
 
+#
+# Build flag for generate Yaml file from Vfr file
+#
+gVfrYamlEnable = False
diff --git a/BaseTools/Source/Python/build/build.py 
b/BaseTools/Source/Python/build/build.py
index 51fb1f433e..7e2f25686d 100755
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -748,6 +748,7 @@ class Build():
 GlobalData.gBinCacheSource = BuildOptions.BinCacheSource
 GlobalData.gEnableGenfdsMultiThread = not 
BuildOptions.NoGenfdsMultiThread
 GlobalData.gDisableIncludePathCheck = 
BuildOptions.DisableIncludePathCheck
+GlobalData.gVfrYamlEnable = BuildOptions.VfrYamlEnable
 
 if GlobalData.gBinCacheDest and not GlobalData.gUseHashCache:
 EdkLogger.error("build", OPTION_NOT_SUPPORTED, 
ExtraData="--binary-destination must be used together with --hash.")
@@ -1460,6 +1461,17 @@ class Build():
 
 # genfds
 if Target == 'fds':
+if GlobalData.gVfrYamlEnable:
+from VfrCompiler.main import VfrParse
+variable_i_filelist = 
os.path.join(AutoGenObject.BuildDir,"variable_i_filelist.txt")
+if os.path.exists(variable_i_filelist):
+with open(variable_i_filelist) as file:
+i_filelist = file.readlines()
+for i_file in i_filelist:
+inputfile = i_file.replace("\n", "")
+yamloutputfile = inputfile.split(".")[0] + '.yaml'
+jsonoutputfile = inputfile.split(".")[0] + '.json'
+VfrParse(inputfile, yamloutputfile, jsonoutputfile)
 if GenFdsApi(AutoGenObject.GenFdsCommandDict, self.Db):
 EdkLogger.error("build", COMMAND_FAILURE)
 Threshold = self.GetFreeSizeThreshold()
@@ -2246,6 +2258,15 @@ class Build():
 fw.write("Arch=%s\n" % "|".join((Wa.ArchList)))
 fw.write("BuildDir=%s\n" % Wa.BuildDir)
 fw.write("PlatformGuid=%s\n" % str(Wa.AutoGenObjectList[0].Guid))
+variable_i_filelist = 
os.path.join(Wa.BuildDir,"variable_i_filelist.txt")
+vfr_var_i = []
+if GlobalData.gVfrYamlEnable:
+for ma in self.AllModules:
+vfr_var_i.extend(ma.VarIFiles)
+SaveFileOnChange(variable_i_filelist, "\n".join(vfr_var_i), False)
+else:
+if os.path.exists(variable_i_filelist):
+os.remove(variable_i_filelist)
 
 if GlobalData.gBinCac

[edk2-devel] [Patch V1 3/3] BaseTools: Add new build option for Variable default value generation

2023-01-29 Thread Yuwei Chen
Add new build option "--gen-default-variable-bin" for Variable
default value generation from Python VFR tool's extended json
output file.

Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yuwei Chen 
---
 edk2basetools/AutoGen/DataPipe.py |   2 ++
 edk2basetools/AutoGen/GenDefaultVar.py| 577 
+
 edk2basetools/AutoGen/ModuleAutoGen.py|   8 
 edk2basetools/Common/GlobalData.py|   5 +
 edk2basetools/VfrCompiler/VfrSyntaxVisitor.py |  12 ++--
 edk2basetools/build/build.py  |  18 ++
 edk2basetools/build/buildoptions.py   |   1 +
 7 files changed, 617 insertions(+), 6 deletions(-)

diff --git a/edk2basetools/AutoGen/DataPipe.py 
b/edk2basetools/AutoGen/DataPipe.py
index 01a90dd..a9bd168 100755
--- a/edk2basetools/AutoGen/DataPipe.py
+++ b/edk2basetools/AutoGen/DataPipe.py
@@ -173,3 +173,5 @@ def FillData(self,PlatformInfo):
 self.DataContainer = 
{"gPlatformFinalPcds":GlobalData.gPlatformFinalPcds}
 
 self.DataContainer = {"VfrYamlEnable": GlobalData.gVfrYamlEnable}
+
+self.DataContainer = {"GenDefaultVarBin": GlobalData.gGenDefaultVarBin}
diff --git a/edk2basetools/AutoGen/GenDefaultVar.py 
b/edk2basetools/AutoGen/GenDefaultVar.py
new file mode 100644
index 000..6be898a
--- /dev/null
+++ b/edk2basetools/AutoGen/GenDefaultVar.py
@@ -0,0 +1,577 @@
+import json
+from ctypes import *
+import re
+import copy
+from struct import unpack
+import os
+import Common.EdkLogger as EdkLogger
+
+class GUID(Structure):
+_fields_ = [
+('Guid1',c_uint32),
+('Guid2',c_uint16),
+('Guid3',c_uint16),
+('Guid4',ARRAY(c_uint8, 8)),
+]
+
+def from_list(self, listformat):
+self.Guid1 = listformat[0]
+self.Guid2 = listformat[1]
+self.Guid3 = listformat[2]
+for i in range(8):
+self.Guid4[i] = listformat[i+3]
+
+def __cmp__(self, otherguid):
+if isinstance(otherguid, GUID):
+return 1
+rt = False
+if self.Guid1 == otherguid.Guid1 and self.Guid2 == otherguid.Guid2 and 
self.Guid3 == otherguid.Guid3:
+rt = True
+for i in range(8):
+rt = rt & (self.Guid4[i] == otherguid.Guid4[i])
+return rt
+
+
+class TIME(Structure):
+_fields_ = [
+('Year', c_uint16),
+('Month',c_uint8),
+('Day',  c_uint8),
+('Hour', c_uint8),
+('Minute',   c_uint8),
+('Second',   c_uint8),
+('Pad1', c_uint8),
+('Nanosecond',   c_uint32),
+('TimeZone', c_uint16),
+('Daylight', c_uint8),
+('Pad2', c_uint8),
+]
+def __init__(self):
+self.Year = 0x0
+self.Month = 0x0
+self.Day = 0x0
+self.Hour = 0x0
+self.Minute = 0x0
+self.Second = 0x0
+self.Pad1 = 0x0
+self.Nanosecond = 0x0
+self.TimeZone = 0x0
+self.Daylight = 0x0
+self.Pad2 = 0x0
+
+
+EFI_VARIABLE_GUID = [0xddcf3616, 0x3275, 0x4164,
+ 0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d]
+EFI_AUTHENTICATED_VARIABLE_GUID = [
+0xaaf32c78, 0x947b, 0x439a, 0xa1, 0x80, 0x2e, 0x14, 0x4e, 0xc3, 0x77, 0x92]
+
+AuthVarGuid = GUID()
+AuthVarGuid.from_list(EFI_AUTHENTICATED_VARIABLE_GUID)
+VarGuid = GUID()
+VarGuid.from_list(EFI_VARIABLE_GUID)
+
+# Variable Store Header Format.
+VARIABLE_STORE_FORMATTED = 0x5a
+# Variable Store Header State.
+VARIABLE_STORE_HEALTHY = 0xfe
+
+
+class VARIABLE_STORE_HEADER(Structure):
+_fields_ = [
+('Signature',GUID),
+('Size', c_uint32),
+('Format',   c_uint8),
+('State',c_uint8),
+('Reserved', c_uint16),
+('Reserved1',c_uint32),
+]
+
+
+# Variable data start flag.
+VARIABLE_DATA = 0x55AA
+
+# Variable State flags.
+VAR_IN_DELETED_TRANSITION = 0xfe
+VAR_DELETED = 0xfd
+VAR_HEADER_VALID_ONLY = 0x7f
+VAR_ADDED = 0x3f
+
+
+class VARIABLE_HEADER(Structure):
+_fields_ = [
+('StartId',  c_uint16),
+('State',c_uint8),
+

[edk2-devel] [Patch V1 2/3] BaseTools: Add new build option for PyVfrCompiler yaml generation

2023-01-29 Thread Yuwei Chen
Add new build option "--vfr-yaml-enable" for Python VfrCompiler
extended output yaml file generation.

Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yuwei Chen 
---
 edk2basetools/AutoGen/DataPipe.py  |  2 ++
 edk2basetools/AutoGen/ModuleAutoGen.py |  8 
 edk2basetools/Common/GlobalData.py |  4 
 edk2basetools/build/build.py   | 32 
 edk2basetools/build/buildoptions.py|  1 +
 5 files changed, 47 insertions(+)

diff --git a/edk2basetools/AutoGen/DataPipe.py 
b/edk2basetools/AutoGen/DataPipe.py
index f562deb..01a90dd 100755
--- a/edk2basetools/AutoGen/DataPipe.py
+++ b/edk2basetools/AutoGen/DataPipe.py
@@ -171,3 +171,5 @@ def FillData(self,PlatformInfo):
 self.DataContainer = 
{"EnableGenfdsMultiThread":GlobalData.gEnableGenfdsMultiThread}
 
 self.DataContainer = 
{"gPlatformFinalPcds":GlobalData.gPlatformFinalPcds}
+
+self.DataContainer = {"VfrYamlEnable": GlobalData.gVfrYamlEnable}
diff --git a/edk2basetools/AutoGen/ModuleAutoGen.py 
b/edk2basetools/AutoGen/ModuleAutoGen.py
index a7ca949..679a989 100755
--- a/edk2basetools/AutoGen/ModuleAutoGen.py
+++ b/edk2basetools/AutoGen/ModuleAutoGen.py
@@ -434,6 +434,14 @@ def FfsOutputDir(self):
 def DebugDir(self):
 return _MakeDir((self.BuildDir, "DEBUG"))
 
+@cached_property
+def VarIFiles(self):
+rt = []
+for SrcFile in self.SourceFileList:
+if SrcFile.Ext.lower() == '.vfr':
+rt.append(os.path.join(self.OutputDir, 
"{}.i".format(SrcFile.BaseName)))
+return rt
+
 ## Return the path of custom file
 @cached_property
 def CustomMakefile(self):
diff --git a/edk2basetools/Common/GlobalData.py 
b/edk2basetools/Common/GlobalData.py
index fcde26b..475193e 100755
--- a/edk2basetools/Common/GlobalData.py
+++ b/edk2basetools/Common/GlobalData.py
@@ -123,3 +123,7 @@
 # Common lock for the file access in multiple process AutoGens
 file_lock = None
 
+#
+# Build flag for generate Yaml file from Vfr file
+#
+gVfrYamlEnable = False
diff --git a/edk2basetools/build/build.py b/edk2basetools/build/build.py
index 1ccb4be..f737172 100755
--- a/edk2basetools/build/build.py
+++ b/edk2basetools/build/build.py
@@ -750,6 +750,7 @@ def __init__(self, Target, WorkspaceDir, 
BuildOptions,log_q):
 GlobalData.gBinCacheSource = BuildOptions.BinCacheSource
 GlobalData.gEnableGenfdsMultiThread = not 
BuildOptions.NoGenfdsMultiThread
 GlobalData.gDisableIncludePathCheck = 
BuildOptions.DisableIncludePathCheck
+GlobalData.gVfrYamlEnable = BuildOptions.VfrYamlEnable
 
 if GlobalData.gBinCacheDest and not GlobalData.gUseHashCache:
 EdkLogger.error("build", OPTION_NOT_SUPPORTED, 
ExtraData="--binary-destination must be used together with --hash.")
@@ -1462,6 +1463,17 @@ def _Build(self, Target, AutoGenObject, 
CreateDepsCodeFile=True, CreateDepsMakeF
 
 # genfds
 if Target == 'fds':
+if GlobalData.gVfrYamlEnable:
+from VfrCompiler.main import VfrParse
+variable_i_filelist = 
os.path.join(AutoGenObject.BuildDir,"variable_i_filelist.txt")
+if os.path.exists(variable_i_filelist):
+with open(variable_i_filelist) as file:
+i_filelist = file.readlines()
+for i_file in i_filelist:
+inputfile = i_file.replace("\n", "")
+yamloutputfile = inputfile.split(".")[0] + '.yaml'
+jsonoutputfile = inputfile.split(".")[0] + '.json'
+VfrParse(inputfile, yamloutputfile, jsonoutputfile)
 if GenFdsApi(AutoGenObject.GenFdsCommandDict, self.Db):
 EdkLogger.error("build", COMMAND_FAILURE)
 Threshold = self.GetFreeSizeThreshold()
@@ -2248,6 +2260,15 @@ def PerformAutoGen(self,BuildTarget,ToolChain):
 fw.write("Arch=%s\n" % "|".join((Wa.ArchList)))
 fw.write("BuildDir=%s\n" % Wa.BuildDir)
 fw.write("PlatformGuid=%s\n" % str(Wa.AutoGenObjectList[0].Guid))
+variable_i_filelist = 
os.path.join(Wa.BuildDir,"variable_i_filelist.txt")
+vfr_var_i = []
+if GlobalData.gVfrYamlEnable:
+for ma in self.AllModules:
+vfr_var_i.extend(ma.VarIFiles)
+SaveFileOnChange(variable_i_filelist, "\n".join(vfr_var_i), False)
+else:
+if os.path.exists(variable_i_filelist):
+os.remove(variable_i_filelist)
 
 if GlobalData.gBinCacheSource:
 BuildModules.extend(self.MakeCacheMiss)
@@ -2360,6 +2381,17 @@ def _MultiThreadBuildPlatform(self):
 #
 

[edk2-devel] [Patch V1 1/3] BaseTools: Add Python VfrCompiler tool

2023-01-29 Thread Yuwei Chen



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#99275): https://edk2.groups.io/g/devel/message/99275
Mute This Topic: https://groups.io/mt/96622973/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [Patch V1 3/3] BaseTools: Add new build option for Variable default value generation

2022-11-15 Thread Yuwei Chen
Add new build option "--gen-default-variable-bin" for Variable
default value generation from Python VFR tool's extended json
output file.

Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yuwei Chen 
---
 edk2basetools/AutoGen/DataPipe.py |   2 ++
 edk2basetools/AutoGen/GenDefaultVar.py| 577 
+
 edk2basetools/AutoGen/ModuleAutoGen.py|   8 
 edk2basetools/Common/GlobalData.py|   5 +
 edk2basetools/VfrCompiler/VfrSyntaxVisitor.py |  12 ++--
 edk2basetools/build/build.py  |  18 ++
 edk2basetools/build/buildoptions.py   |   1 +
 7 files changed, 617 insertions(+), 6 deletions(-)

diff --git a/edk2basetools/AutoGen/DataPipe.py 
b/edk2basetools/AutoGen/DataPipe.py
index 01a90dd..a9bd168 100755
--- a/edk2basetools/AutoGen/DataPipe.py
+++ b/edk2basetools/AutoGen/DataPipe.py
@@ -173,3 +173,5 @@ def FillData(self,PlatformInfo):
 self.DataContainer = 
{"gPlatformFinalPcds":GlobalData.gPlatformFinalPcds}
 
 self.DataContainer = {"VfrYamlEnable": GlobalData.gVfrYamlEnable}
+
+self.DataContainer = {"GenDefaultVarBin": GlobalData.gGenDefaultVarBin}
diff --git a/edk2basetools/AutoGen/GenDefaultVar.py 
b/edk2basetools/AutoGen/GenDefaultVar.py
new file mode 100644
index 000..6be898a
--- /dev/null
+++ b/edk2basetools/AutoGen/GenDefaultVar.py
@@ -0,0 +1,577 @@
+import json
+from ctypes import *
+import re
+import copy
+from struct import unpack
+import os
+import Common.EdkLogger as EdkLogger
+
+class GUID(Structure):
+_fields_ = [
+('Guid1',c_uint32),
+('Guid2',c_uint16),
+('Guid3',c_uint16),
+('Guid4',ARRAY(c_uint8, 8)),
+]
+
+def from_list(self, listformat):
+self.Guid1 = listformat[0]
+self.Guid2 = listformat[1]
+self.Guid3 = listformat[2]
+for i in range(8):
+self.Guid4[i] = listformat[i+3]
+
+def __cmp__(self, otherguid):
+if isinstance(otherguid, GUID):
+return 1
+rt = False
+if self.Guid1 == otherguid.Guid1 and self.Guid2 == otherguid.Guid2 and 
self.Guid3 == otherguid.Guid3:
+rt = True
+for i in range(8):
+rt = rt & (self.Guid4[i] == otherguid.Guid4[i])
+return rt
+
+
+class TIME(Structure):
+_fields_ = [
+('Year', c_uint16),
+('Month',c_uint8),
+('Day',  c_uint8),
+('Hour', c_uint8),
+('Minute',   c_uint8),
+('Second',   c_uint8),
+('Pad1', c_uint8),
+('Nanosecond',   c_uint32),
+('TimeZone', c_uint16),
+('Daylight', c_uint8),
+('Pad2', c_uint8),
+]
+def __init__(self):
+self.Year = 0x0
+self.Month = 0x0
+self.Day = 0x0
+self.Hour = 0x0
+self.Minute = 0x0
+self.Second = 0x0
+self.Pad1 = 0x0
+self.Nanosecond = 0x0
+self.TimeZone = 0x0
+self.Daylight = 0x0
+self.Pad2 = 0x0
+
+
+EFI_VARIABLE_GUID = [0xddcf3616, 0x3275, 0x4164,
+ 0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d]
+EFI_AUTHENTICATED_VARIABLE_GUID = [
+0xaaf32c78, 0x947b, 0x439a, 0xa1, 0x80, 0x2e, 0x14, 0x4e, 0xc3, 0x77, 0x92]
+
+AuthVarGuid = GUID()
+AuthVarGuid.from_list(EFI_AUTHENTICATED_VARIABLE_GUID)
+VarGuid = GUID()
+VarGuid.from_list(EFI_VARIABLE_GUID)
+
+# Variable Store Header Format.
+VARIABLE_STORE_FORMATTED = 0x5a
+# Variable Store Header State.
+VARIABLE_STORE_HEALTHY = 0xfe
+
+
+class VARIABLE_STORE_HEADER(Structure):
+_fields_ = [
+('Signature',GUID),
+('Size', c_uint32),
+('Format',   c_uint8),
+('State',c_uint8),
+('Reserved', c_uint16),
+('Reserved1',c_uint32),
+]
+
+
+# Variable data start flag.
+VARIABLE_DATA = 0x55AA
+
+# Variable State flags.
+VAR_IN_DELETED_TRANSITION = 0xfe
+VAR_DELETED = 0xfd
+VAR_HEADER_VALID_ONLY = 0x7f
+VAR_ADDED = 0x3f
+
+
+class VARIABLE_HEADER(Structure):
+_fields_ = [
+('StartId',  c_uint16),
+('State',c_uint8),
+

[edk2-devel] [Patch V1 2/3] BaseTools: Add new build option for PyVfrCompiler yaml generation

2022-11-15 Thread Yuwei Chen
Add new build option "--vfr-yaml-enable" for Python VfrCompiler
extended output yaml file generation.

Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yuwei Chen 
---
 edk2basetools/AutoGen/DataPipe.py  |  2 ++
 edk2basetools/AutoGen/ModuleAutoGen.py |  8 
 edk2basetools/Common/GlobalData.py |  4 
 edk2basetools/build/build.py   | 32 
 edk2basetools/build/buildoptions.py|  1 +
 5 files changed, 47 insertions(+)

diff --git a/edk2basetools/AutoGen/DataPipe.py 
b/edk2basetools/AutoGen/DataPipe.py
index f562deb..01a90dd 100755
--- a/edk2basetools/AutoGen/DataPipe.py
+++ b/edk2basetools/AutoGen/DataPipe.py
@@ -171,3 +171,5 @@ def FillData(self,PlatformInfo):
 self.DataContainer = 
{"EnableGenfdsMultiThread":GlobalData.gEnableGenfdsMultiThread}
 
 self.DataContainer = 
{"gPlatformFinalPcds":GlobalData.gPlatformFinalPcds}
+
+self.DataContainer = {"VfrYamlEnable": GlobalData.gVfrYamlEnable}
diff --git a/edk2basetools/AutoGen/ModuleAutoGen.py 
b/edk2basetools/AutoGen/ModuleAutoGen.py
index a7ca949..679a989 100755
--- a/edk2basetools/AutoGen/ModuleAutoGen.py
+++ b/edk2basetools/AutoGen/ModuleAutoGen.py
@@ -434,6 +434,14 @@ def FfsOutputDir(self):
 def DebugDir(self):
 return _MakeDir((self.BuildDir, "DEBUG"))
 
+@cached_property
+def VarIFiles(self):
+rt = []
+for SrcFile in self.SourceFileList:
+if SrcFile.Ext.lower() == '.vfr':
+rt.append(os.path.join(self.OutputDir, 
"{}.i".format(SrcFile.BaseName)))
+return rt
+
 ## Return the path of custom file
 @cached_property
 def CustomMakefile(self):
diff --git a/edk2basetools/Common/GlobalData.py 
b/edk2basetools/Common/GlobalData.py
index fcde26b..475193e 100755
--- a/edk2basetools/Common/GlobalData.py
+++ b/edk2basetools/Common/GlobalData.py
@@ -123,3 +123,7 @@
 # Common lock for the file access in multiple process AutoGens
 file_lock = None
 
+#
+# Build flag for generate Yaml file from Vfr file
+#
+gVfrYamlEnable = False
diff --git a/edk2basetools/build/build.py b/edk2basetools/build/build.py
index 1ccb4be..f737172 100755
--- a/edk2basetools/build/build.py
+++ b/edk2basetools/build/build.py
@@ -750,6 +750,7 @@ def __init__(self, Target, WorkspaceDir, 
BuildOptions,log_q):
 GlobalData.gBinCacheSource = BuildOptions.BinCacheSource
 GlobalData.gEnableGenfdsMultiThread = not 
BuildOptions.NoGenfdsMultiThread
 GlobalData.gDisableIncludePathCheck = 
BuildOptions.DisableIncludePathCheck
+GlobalData.gVfrYamlEnable = BuildOptions.VfrYamlEnable
 
 if GlobalData.gBinCacheDest and not GlobalData.gUseHashCache:
 EdkLogger.error("build", OPTION_NOT_SUPPORTED, 
ExtraData="--binary-destination must be used together with --hash.")
@@ -1462,6 +1463,17 @@ def _Build(self, Target, AutoGenObject, 
CreateDepsCodeFile=True, CreateDepsMakeF
 
 # genfds
 if Target == 'fds':
+if GlobalData.gVfrYamlEnable:
+from VfrCompiler.main import VfrParse
+variable_i_filelist = 
os.path.join(AutoGenObject.BuildDir,"variable_i_filelist.txt")
+if os.path.exists(variable_i_filelist):
+with open(variable_i_filelist) as file:
+i_filelist = file.readlines()
+for i_file in i_filelist:
+inputfile = i_file.replace("\n", "")
+yamloutputfile = inputfile.split(".")[0] + '.yaml'
+jsonoutputfile = inputfile.split(".")[0] + '.json'
+VfrParse(inputfile, yamloutputfile, jsonoutputfile)
 if GenFdsApi(AutoGenObject.GenFdsCommandDict, self.Db):
 EdkLogger.error("build", COMMAND_FAILURE)
 Threshold = self.GetFreeSizeThreshold()
@@ -2248,6 +2260,15 @@ def PerformAutoGen(self,BuildTarget,ToolChain):
 fw.write("Arch=%s\n" % "|".join((Wa.ArchList)))
 fw.write("BuildDir=%s\n" % Wa.BuildDir)
 fw.write("PlatformGuid=%s\n" % str(Wa.AutoGenObjectList[0].Guid))
+variable_i_filelist = 
os.path.join(Wa.BuildDir,"variable_i_filelist.txt")
+vfr_var_i = []
+if GlobalData.gVfrYamlEnable:
+for ma in self.AllModules:
+vfr_var_i.extend(ma.VarIFiles)
+SaveFileOnChange(variable_i_filelist, "\n".join(vfr_var_i), False)
+else:
+if os.path.exists(variable_i_filelist):
+os.remove(variable_i_filelist)
 
 if GlobalData.gBinCacheSource:
 BuildModules.extend(self.MakeCacheMiss)
@@ -2360,6 +2381,17 @@ def _MultiThreadBuildPlatform(self):
 #
 

[edk2-devel] [Patch V2 3/3] [edk2-staging]BaseTools: Add new build option for Variable default value generation

2022-11-15 Thread Yuwei Chen
Add new build option "--gen-default-variable-bin" for Variable
default value generation from Python VFR tool's extended json
output file.

Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yuwei Chen 
---
 BaseTools/Source/Python/AutoGen/DataPipe.py |   2 ++
 BaseTools/Source/Python/AutoGen/GenDefaultVar.py| 577 
+
 BaseTools/Source/Python/AutoGen/ModuleAutoGen.py|   8 
 BaseTools/Source/Python/Common/GlobalData.py|   5 +
 BaseTools/Source/Python/VfrCompiler/VfrSyntaxVisitor.py |  12 ++--
 BaseTools/Source/Python/build/build.py  |  19 
++-
 BaseTools/Source/Python/build/buildoptions.py   |   1 +
 7 files changed, 617 insertions(+), 7 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/DataPipe.py 
b/BaseTools/Source/Python/AutoGen/DataPipe.py
index c700baf7b7..e45b4a928a 100755
--- a/BaseTools/Source/Python/AutoGen/DataPipe.py
+++ b/BaseTools/Source/Python/AutoGen/DataPipe.py
@@ -173,3 +173,5 @@ class MemoryDataPipe(DataPipe):
 self.DataContainer = 
{"gPlatformFinalPcds":GlobalData.gPlatformFinalPcds}
 
 self.DataContainer = {"VfrYamlEnable": GlobalData.gVfrYamlEnable}
+
+self.DataContainer = {"GenDefaultVarBin": GlobalData.gGenDefaultVarBin}
diff --git a/BaseTools/Source/Python/AutoGen/GenDefaultVar.py 
b/BaseTools/Source/Python/AutoGen/GenDefaultVar.py
new file mode 100644
index 00..859d4f25eb
--- /dev/null
+++ b/BaseTools/Source/Python/AutoGen/GenDefaultVar.py
@@ -0,0 +1,577 @@
+import json
+from ctypes import *
+import re
+import copy
+from struct import unpack
+import os
+import Common.EdkLogger as EdkLogger
+
+class GUID(Structure):
+_fields_ = [
+('Guid1',c_uint32),
+('Guid2',c_uint16),
+('Guid3',c_uint16),
+('Guid4',ARRAY(c_uint8, 8)),
+]
+
+def from_list(self, listformat):
+self.Guid1 = listformat[0]
+self.Guid2 = listformat[1]
+self.Guid3 = listformat[2]
+for i in range(8):
+self.Guid4[i] = listformat[i+3]
+
+def __cmp__(self, otherguid):
+if isinstance(otherguid, GUID):
+return 1
+rt = False
+if self.Guid1 == otherguid.Guid1 and self.Guid2 == otherguid.Guid2 and 
self.Guid3 == otherguid.Guid3:
+rt = True
+for i in range(8):
+rt = rt & (self.Guid4[i] == otherguid.Guid4[i])
+return rt
+
+
+class TIME(Structure):
+_fields_ = [
+('Year', c_uint16),
+('Month',c_uint8),
+('Day',  c_uint8),
+('Hour', c_uint8),
+('Minute',   c_uint8),
+('Second',   c_uint8),
+('Pad1', c_uint8),
+('Nanosecond',   c_uint32),
+('TimeZone', c_uint16),
+('Daylight', c_uint8),
+('Pad2', c_uint8),
+]
+def __init__(self):
+self.Year = 0x0
+self.Month = 0x0
+self.Day = 0x0
+self.Hour = 0x0
+self.Minute = 0x0
+self.Second = 0x0
+self.Pad1 = 0x0
+self.Nanosecond = 0x0
+self.TimeZone = 0x0
+self.Daylight = 0x0
+self.Pad2 = 0x0
+
+
+EFI_VARIABLE_GUID = [0xddcf3616, 0x3275, 0x4164,
+ 0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d]
+EFI_AUTHENTICATED_VARIABLE_GUID = [
+0xaaf32c78, 0x947b, 0x439a, 0xa1, 0x80, 0x2e, 0x14, 0x4e, 0xc3, 0x77, 0x92]
+
+AuthVarGuid = GUID()
+AuthVarGuid.from_list(EFI_AUTHENTICATED_VARIABLE_GUID)
+VarGuid = GUID()
+VarGuid.from_list(EFI_VARIABLE_GUID)
+
+# Variable Store Header Format.
+VARIABLE_STORE_FORMATTED = 0x5a
+# Variable Store Header State.
+VARIABLE_STORE_HEALTHY = 0xfe
+
+
+class VARIABLE_STORE_HEADER(Structure):
+_fields_ = [
+('Signature',GUID),
+('Size', c_uint32),
+('Format',   c_uint8),
+('State',c_uint8),
+('Reserved', c_uint16),
+('Reserved1',c_uint32),
+]
+
+
+# Variable data start flag.
+VARIABLE_DATA = 0x55AA
+
+# Variable State flags.
+VAR_IN_DELETED_TRANSITION = 0xfe
+VAR_DELETED = 0xfd
+VAR_HEADER_VALID_ONLY = 0x7f
+VAR_ADDED = 0x3f
+
+
+cla

[edk2-devel] [Patch V2 2/3] [edk2-staging]BaseTools: Add new build option for PyVfrCompiler yaml generation

2022-11-15 Thread Yuwei Chen
Add new build option "--vfr-yaml-enable" for Python VfrCompiler
extended output yaml file generation.

Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yuwei Chen 
---
 BaseTools/Source/Python/AutoGen/DataPipe.py  |  2 ++
 BaseTools/Source/Python/AutoGen/ModuleAutoGen.py |  8 
 BaseTools/Source/Python/Common/GlobalData.py |  4 
 BaseTools/Source/Python/build/build.py   | 33 
+
 BaseTools/Source/Python/build/buildoptions.py|  1 +
 5 files changed, 48 insertions(+)

diff --git a/BaseTools/Source/Python/AutoGen/DataPipe.py 
b/BaseTools/Source/Python/AutoGen/DataPipe.py
index 848c7a8296..c700baf7b7 100755
--- a/BaseTools/Source/Python/AutoGen/DataPipe.py
+++ b/BaseTools/Source/Python/AutoGen/DataPipe.py
@@ -171,3 +171,5 @@ class MemoryDataPipe(DataPipe):
 self.DataContainer = 
{"EnableGenfdsMultiThread":GlobalData.gEnableGenfdsMultiThread}
 
 self.DataContainer = 
{"gPlatformFinalPcds":GlobalData.gPlatformFinalPcds}
+
+self.DataContainer = {"VfrYamlEnable": GlobalData.gVfrYamlEnable}
diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py 
b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
index d05410b329..eb81c3f3af 100755
--- a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
@@ -434,6 +434,14 @@ class ModuleAutoGen(AutoGen):
 def DebugDir(self):
 return _MakeDir((self.BuildDir, "DEBUG"))
 
+@cached_property
+def VarIFiles(self):
+rt = []
+for SrcFile in self.SourceFileList:
+if SrcFile.Ext.lower() == '.vfr':
+rt.append(os.path.join(self.OutputDir, 
"{}.i".format(SrcFile.BaseName)))
+return rt
+
 ## Return the path of custom file
 @cached_property
 def CustomMakefile(self):
diff --git a/BaseTools/Source/Python/Common/GlobalData.py 
b/BaseTools/Source/Python/Common/GlobalData.py
index 197bd83666..039a9648aa 100755
--- a/BaseTools/Source/Python/Common/GlobalData.py
+++ b/BaseTools/Source/Python/Common/GlobalData.py
@@ -123,3 +123,7 @@ gSikpAutoGenCache = set()
 # Common lock for the file access in multiple process AutoGens
 file_lock = None
 
+#
+# Build flag for generate Yaml file from Vfr file
+#
+gVfrYamlEnable = False
diff --git a/BaseTools/Source/Python/build/build.py 
b/BaseTools/Source/Python/build/build.py
index 51fb1f433e..7e2f25686d 100755
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -748,6 +748,7 @@ class Build():
 GlobalData.gBinCacheSource = BuildOptions.BinCacheSource
 GlobalData.gEnableGenfdsMultiThread = not 
BuildOptions.NoGenfdsMultiThread
 GlobalData.gDisableIncludePathCheck = 
BuildOptions.DisableIncludePathCheck
+GlobalData.gVfrYamlEnable = BuildOptions.VfrYamlEnable
 
 if GlobalData.gBinCacheDest and not GlobalData.gUseHashCache:
 EdkLogger.error("build", OPTION_NOT_SUPPORTED, 
ExtraData="--binary-destination must be used together with --hash.")
@@ -1460,6 +1461,17 @@ class Build():
 
 # genfds
 if Target == 'fds':
+if GlobalData.gVfrYamlEnable:
+from VfrCompiler.main import VfrParse
+variable_i_filelist = 
os.path.join(AutoGenObject.BuildDir,"variable_i_filelist.txt")
+if os.path.exists(variable_i_filelist):
+with open(variable_i_filelist) as file:
+i_filelist = file.readlines()
+for i_file in i_filelist:
+inputfile = i_file.replace("\n", "")
+yamloutputfile = inputfile.split(".")[0] + '.yaml'
+jsonoutputfile = inputfile.split(".")[0] + '.json'
+VfrParse(inputfile, yamloutputfile, jsonoutputfile)
 if GenFdsApi(AutoGenObject.GenFdsCommandDict, self.Db):
 EdkLogger.error("build", COMMAND_FAILURE)
 Threshold = self.GetFreeSizeThreshold()
@@ -2246,6 +2258,15 @@ class Build():
 fw.write("Arch=%s\n" % "|".join((Wa.ArchList)))
 fw.write("BuildDir=%s\n" % Wa.BuildDir)
 fw.write("PlatformGuid=%s\n" % str(Wa.AutoGenObjectList[0].Guid))
+variable_i_filelist = 
os.path.join(Wa.BuildDir,"variable_i_filelist.txt")
+vfr_var_i = []
+if GlobalData.gVfrYamlEnable:
+for ma in self.AllModules:
+vfr_var_i.extend(ma.VarIFiles)
+SaveFileOnChange(variable_i_filelist, "\n".join(vfr_var_i), False)
+else:
+if os.path.exists(variable_i_filelist):
+os.remove(variable_i_filelist)
 
 if GlobalData.gBinCac

[edk2-devel] [Patch V1 3/3] [edk2-staging]BaseTools: Add new build option for Variable default value generation

2022-11-14 Thread Yuwei Chen
Add new build option "--gen-default-variable-bin" for Variable
default value generation from Python VFR tool's extended json
output file.

Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yuwei Chen 
---
 BaseTools/Source/Python/AutoGen/DataPipe.py |   2 ++
 BaseTools/Source/Python/AutoGen/GenDefaultVar.py| 575 
+++
 BaseTools/Source/Python/AutoGen/ModuleAutoGen.py|   8 
 BaseTools/Source/Python/Common/GlobalData.py|   5 +
 BaseTools/Source/Python/VfrCompiler/VfrSyntaxVisitor.py |  14 +++---
 BaseTools/Source/Python/build/build.py  |  19 
++-
 BaseTools/Source/Python/build/buildoptions.py   |   1 +
 7 files changed, 616 insertions(+), 8 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/DataPipe.py 
b/BaseTools/Source/Python/AutoGen/DataPipe.py
index c700baf7b7..e45b4a928a 100755
--- a/BaseTools/Source/Python/AutoGen/DataPipe.py
+++ b/BaseTools/Source/Python/AutoGen/DataPipe.py
@@ -173,3 +173,5 @@ class MemoryDataPipe(DataPipe):
 self.DataContainer = 
{"gPlatformFinalPcds":GlobalData.gPlatformFinalPcds}
 
 self.DataContainer = {"VfrYamlEnable": GlobalData.gVfrYamlEnable}
+
+self.DataContainer = {"GenDefaultVarBin": GlobalData.gGenDefaultVarBin}
diff --git a/BaseTools/Source/Python/AutoGen/GenDefaultVar.py 
b/BaseTools/Source/Python/AutoGen/GenDefaultVar.py
new file mode 100644
index 00..374a34ffde
--- /dev/null
+++ b/BaseTools/Source/Python/AutoGen/GenDefaultVar.py
@@ -0,0 +1,575 @@
+import json
+from ctypes import *
+import re
+import copy
+from struct import unpack
+import os
+import Common.EdkLogger as EdkLogger
+
+class GUID(Structure):
+_fields_ = [
+('Guid1',c_uint32),
+('Guid2',c_uint16),
+('Guid3',c_uint16),
+('Guid4',ARRAY(c_uint8, 8)),
+]
+
+def from_list(self, listformat):
+self.Guid1 = listformat[0]
+self.Guid2 = listformat[1]
+self.Guid3 = listformat[2]
+for i in range(8):
+self.Guid4[i] = listformat[i+3]
+
+def __cmp__(self, otherguid):
+if isinstance(otherguid, GUID):
+return 1
+rt = False
+if self.Guid1 == otherguid.Guid1 and self.Guid2 == otherguid.Guid2 and 
self.Guid3 == otherguid.Guid3:
+rt = True
+for i in range(8):
+rt = rt & (self.Guid4[i] == otherguid.Guid4[i])
+return rt
+
+
+class TIME(Structure):
+_fields_ = [
+('Year', c_uint16),
+('Month',c_uint8),
+('Day',  c_uint8),
+('Hour', c_uint8),
+('Minute',   c_uint8),
+('Second',   c_uint8),
+('Pad1', c_uint8),
+('Nanosecond',   c_uint32),
+('TimeZone', c_uint16),
+('Daylight', c_uint8),
+('Pad2', c_uint8),
+]
+def __init__(self):
+self.Year = 0x0
+self.Month = 0x0
+self.Day = 0x0
+self.Hour = 0x0
+self.Minute = 0x0
+self.Second = 0x0
+self.Pad1 = 0x0
+self.Nanosecond = 0x0
+self.TimeZone = 0x0
+self.Daylight = 0x0
+self.Pad2 = 0x0
+
+
+EFI_VARIABLE_GUID = [0xddcf3616, 0x3275, 0x4164,
+ 0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d]
+EFI_AUTHENTICATED_VARIABLE_GUID = [
+0xaaf32c78, 0x947b, 0x439a, 0xa1, 0x80, 0x2e, 0x14, 0x4e, 0xc3, 0x77, 0x92]
+
+AuthVarGuid = GUID()
+AuthVarGuid.from_list(EFI_AUTHENTICATED_VARIABLE_GUID)
+VarGuid = GUID()
+VarGuid.from_list(EFI_VARIABLE_GUID)
+
+# Variable Store Header Format.
+VARIABLE_STORE_FORMATTED = 0x5a
+# Variable Store Header State.
+VARIABLE_STORE_HEALTHY = 0xfe
+
+
+class VARIABLE_STORE_HEADER(Structure):
+_fields_ = [
+('Signature',GUID),
+('Size', c_uint32),
+('Format',   c_uint8),
+('State',c_uint8),
+('Reserved', c_uint16),
+('Reserved1',c_uint32),
+]
+
+
+# Variable data start flag.
+VARIABLE_DATA = 0x55AA
+
+# Variable State flags.
+VAR_IN_DELETED_TRANSITION = 0xfe
+VAR_DELETED = 0xfd
+VAR_HEADER_VALID_ONLY = 0x7f
+VAR_ADDED = 0x3f
+
+
+cla

[edk2-devel] [Patch V1 2/3] [edk2-staging]BaseTools: Add new build option for PyVfrCompiler yaml generation

2022-11-14 Thread Yuwei Chen
Add new build option "--vfr-yaml-enable" for Python VfrCompiler
extended output yaml file generation.

Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yuwei Chen 
---
 BaseTools/Source/Python/AutoGen/DataPipe.py  |  2 ++
 BaseTools/Source/Python/AutoGen/ModuleAutoGen.py |  8 
 BaseTools/Source/Python/Common/GlobalData.py |  4 
 BaseTools/Source/Python/build/build.py   | 33 
+
 BaseTools/Source/Python/build/buildoptions.py|  1 +
 5 files changed, 48 insertions(+)

diff --git a/BaseTools/Source/Python/AutoGen/DataPipe.py 
b/BaseTools/Source/Python/AutoGen/DataPipe.py
index 848c7a8296..c700baf7b7 100755
--- a/BaseTools/Source/Python/AutoGen/DataPipe.py
+++ b/BaseTools/Source/Python/AutoGen/DataPipe.py
@@ -171,3 +171,5 @@ class MemoryDataPipe(DataPipe):
 self.DataContainer = 
{"EnableGenfdsMultiThread":GlobalData.gEnableGenfdsMultiThread}
 
 self.DataContainer = 
{"gPlatformFinalPcds":GlobalData.gPlatformFinalPcds}
+
+self.DataContainer = {"VfrYamlEnable": GlobalData.gVfrYamlEnable}
diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py 
b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
index d05410b329..eb81c3f3af 100755
--- a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
@@ -434,6 +434,14 @@ class ModuleAutoGen(AutoGen):
 def DebugDir(self):
 return _MakeDir((self.BuildDir, "DEBUG"))
 
+@cached_property
+def VarIFiles(self):
+rt = []
+for SrcFile in self.SourceFileList:
+if SrcFile.Ext.lower() == '.vfr':
+rt.append(os.path.join(self.OutputDir, 
"{}.i".format(SrcFile.BaseName)))
+return rt
+
 ## Return the path of custom file
 @cached_property
 def CustomMakefile(self):
diff --git a/BaseTools/Source/Python/Common/GlobalData.py 
b/BaseTools/Source/Python/Common/GlobalData.py
index 197bd83666..039a9648aa 100755
--- a/BaseTools/Source/Python/Common/GlobalData.py
+++ b/BaseTools/Source/Python/Common/GlobalData.py
@@ -123,3 +123,7 @@ gSikpAutoGenCache = set()
 # Common lock for the file access in multiple process AutoGens
 file_lock = None
 
+#
+# Build flag for generate Yaml file from Vfr file
+#
+gVfrYamlEnable = False
diff --git a/BaseTools/Source/Python/build/build.py 
b/BaseTools/Source/Python/build/build.py
index 51fb1f433e..7e2f25686d 100755
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -748,6 +748,7 @@ class Build():
 GlobalData.gBinCacheSource = BuildOptions.BinCacheSource
 GlobalData.gEnableGenfdsMultiThread = not 
BuildOptions.NoGenfdsMultiThread
 GlobalData.gDisableIncludePathCheck = 
BuildOptions.DisableIncludePathCheck
+GlobalData.gVfrYamlEnable = BuildOptions.VfrYamlEnable
 
 if GlobalData.gBinCacheDest and not GlobalData.gUseHashCache:
 EdkLogger.error("build", OPTION_NOT_SUPPORTED, 
ExtraData="--binary-destination must be used together with --hash.")
@@ -1460,6 +1461,17 @@ class Build():
 
 # genfds
 if Target == 'fds':
+if GlobalData.gVfrYamlEnable:
+from VfrCompiler.main import VfrParse
+variable_i_filelist = 
os.path.join(AutoGenObject.BuildDir,"variable_i_filelist.txt")
+if os.path.exists(variable_i_filelist):
+with open(variable_i_filelist) as file:
+i_filelist = file.readlines()
+for i_file in i_filelist:
+inputfile = i_file.replace("\n", "")
+yamloutputfile = inputfile.split(".")[0] + '.yaml'
+jsonoutputfile = inputfile.split(".")[0] + '.json'
+VfrParse(inputfile, yamloutputfile, jsonoutputfile)
 if GenFdsApi(AutoGenObject.GenFdsCommandDict, self.Db):
 EdkLogger.error("build", COMMAND_FAILURE)
 Threshold = self.GetFreeSizeThreshold()
@@ -2246,6 +2258,15 @@ class Build():
 fw.write("Arch=%s\n" % "|".join((Wa.ArchList)))
 fw.write("BuildDir=%s\n" % Wa.BuildDir)
 fw.write("PlatformGuid=%s\n" % str(Wa.AutoGenObjectList[0].Guid))
+variable_i_filelist = 
os.path.join(Wa.BuildDir,"variable_i_filelist.txt")
+vfr_var_i = []
+if GlobalData.gVfrYamlEnable:
+for ma in self.AllModules:
+vfr_var_i.extend(ma.VarIFiles)
+SaveFileOnChange(variable_i_filelist, "\n".join(vfr_var_i), False)
+else:
+if os.path.exists(variable_i_filelist):
+os.remove(variable_i_filelist)
 
 if GlobalData.gBinCac

Re: [edk2-devel] [PATCH] BaseTools: Fix build option overrides Pcd Feature Flag issue

2022-10-28 Thread Yuwei Chen
 Cc Mike.

Thanks,
Christine

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Yuwei
> Chen
> Sent: Tuesday, October 25, 2022 4:51 PM
> To: devel@edk2.groups.io
> Cc: Feng, Bob C ; Gao, Liming
> 
> Subject: [edk2-devel] [PATCH] BaseTools: Fix build option overrides Pcd
> Feature Flag issue
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4081
> 
> INF [Sources] section Feature Flag Expressions do not use override values
> from build --pcd option currently.
> This patch fix this issue.
> 
> Cc: Bob Feng 
> Cc: Liming Gao 
> Signed-off-by: Yuwei Chen 
> ---
>  edk2basetools/Workspace/InfBuildData.py | 17 +
>  1 file changed, 17 insertions(+)
> 
> diff --git a/edk2basetools/Workspace/InfBuildData.py
> b/edk2basetools/Workspace/InfBuildData.py
> index c97a70e..8631373 100644
> --- a/edk2basetools/Workspace/InfBuildData.py
> +++ b/edk2basetools/Workspace/InfBuildData.py
> @@ -1055,6 +1055,7 @@ def IsBinaryModule(self):
>  return False
>  def CheckFeatureFlagPcd(self,Instance):
>  Pcds = GlobalData.gPlatformFinalPcds.copy()
> +BuildOptionPcds = GlobalData.BuildOptionPcd
>  if PcdPattern.search(Instance):
>  PcdTuple = tuple(Instance.split('.')[::-1])
>  if PcdTuple in self.Pcds:
> @@ -1062,6 +1063,14 @@ def CheckFeatureFlagPcd(self,Instance):
>  EdkLogger.error('build', FORMAT_INVALID,
>  "\nFeatureFlagPcd must be defined in a 
> [PcdsFeatureFlag]
> or [PcdsFixedAtBuild] section of Dsc or Dec file",
>  File=str(self), ExtraData=Instance)
> +for item in BuildOptionPcds:
> +if self.Pcds[PcdTuple].TokenCName in item:
> +if type(item) == type(()):
> +# ('gEfiCryptoPkgTokenSpaceGuid', 
> 'PcdOpensslEcEnabled', '',
> '1', ('build command options', 1)
> +Pcds[Instance] = list(item)[3]
> +elif type(item) == type(''):
> +# 
> gEfiCryptoPkgTokenSpaceGuid.PcdOpensslEcEnabled=1
> +Pcds[Instance] = item.split('=')[1]
>  if not Instance in Pcds:
>  Pcds[Instance] = self.Pcds[PcdTuple].DefaultValue
>  else: #if PcdTuple not in self.Pcds:
> @@ -1085,6 +1094,14 @@ def CheckFeatureFlagPcd(self,Instance):
>  for Name, Guid in self.Pcds:
>  if self.Pcds[(Name, Guid)].Type == 'FeatureFlag' or 
> self.Pcds[(Name,
> Guid)].Type == 'FixedAtBuild':
>  PcdFullName = '%s.%s' % (Guid, Name);
> +for item in BuildOptionPcds:
> +if Name in item:
> +if type(item) == type(()):
> +# ('gEfiCryptoPkgTokenSpaceGuid', 
> 'PcdOpensslEcEnabled',
> '', '1', ('build command options', 1)
> +Pcds[PcdFullName] = list(item)[3]
> +elif type(item) == type(''):
> +# 
> gEfiCryptoPkgTokenSpaceGuid.PcdOpensslEcEnabled=1
> +Pcds[PcdFullName] = item.split('=')[1]
>  if not PcdFullName in Pcds:
>  Pcds[PcdFullName] = self.Pcds[(Name, 
> Guid)].DefaultValue
>  try:
> --
> 2.27.0.windows.1
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#95672): https://edk2.groups.io/g/devel/message/95672
Mute This Topic: https://groups.io/mt/94554387/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] BaseTools: Fix build option overrides Pcd Feature Flag issue

2022-10-25 Thread Yuwei Chen
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4081

INF [Sources] section Feature Flag Expressions do not use
override values from build --pcd option currently.
This patch fix this issue.

Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yuwei Chen 
---
 edk2basetools/Workspace/InfBuildData.py | 17 +
 1 file changed, 17 insertions(+)

diff --git a/edk2basetools/Workspace/InfBuildData.py 
b/edk2basetools/Workspace/InfBuildData.py
index c97a70e..8631373 100644
--- a/edk2basetools/Workspace/InfBuildData.py
+++ b/edk2basetools/Workspace/InfBuildData.py
@@ -1055,6 +1055,7 @@ def IsBinaryModule(self):
 return False
 def CheckFeatureFlagPcd(self,Instance):
 Pcds = GlobalData.gPlatformFinalPcds.copy()
+BuildOptionPcds = GlobalData.BuildOptionPcd
 if PcdPattern.search(Instance):
 PcdTuple = tuple(Instance.split('.')[::-1])
 if PcdTuple in self.Pcds:
@@ -1062,6 +1063,14 @@ def CheckFeatureFlagPcd(self,Instance):
 EdkLogger.error('build', FORMAT_INVALID,
 "\nFeatureFlagPcd must be defined in a 
[PcdsFeatureFlag] or [PcdsFixedAtBuild] section of Dsc or Dec file",
 File=str(self), ExtraData=Instance)
+for item in BuildOptionPcds:
+if self.Pcds[PcdTuple].TokenCName in item:
+if type(item) == type(()):
+# ('gEfiCryptoPkgTokenSpaceGuid', 
'PcdOpensslEcEnabled', '', '1', ('build command options', 1)
+Pcds[Instance] = list(item)[3]
+elif type(item) == type(''):
+# gEfiCryptoPkgTokenSpaceGuid.PcdOpensslEcEnabled=1
+Pcds[Instance] = item.split('=')[1]
 if not Instance in Pcds:
 Pcds[Instance] = self.Pcds[PcdTuple].DefaultValue
 else: #if PcdTuple not in self.Pcds:
@@ -1085,6 +1094,14 @@ def CheckFeatureFlagPcd(self,Instance):
 for Name, Guid in self.Pcds:
 if self.Pcds[(Name, Guid)].Type == 'FeatureFlag' or 
self.Pcds[(Name, Guid)].Type == 'FixedAtBuild':
 PcdFullName = '%s.%s' % (Guid, Name);
+for item in BuildOptionPcds:
+if Name in item:
+if type(item) == type(()):
+# ('gEfiCryptoPkgTokenSpaceGuid', 
'PcdOpensslEcEnabled', '', '1', ('build command options', 1)
+Pcds[PcdFullName] = list(item)[3]
+elif type(item) == type(''):
+# 
gEfiCryptoPkgTokenSpaceGuid.PcdOpensslEcEnabled=1
+Pcds[PcdFullName] = item.split('=')[1]
 if not PcdFullName in Pcds:
 Pcds[PcdFullName] = self.Pcds[(Name, 
Guid)].DefaultValue
 try:
-- 
2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#95553): https://edk2.groups.io/g/devel/message/95553
Mute This Topic: https://groups.io/mt/94554387/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 1/1] pip-requirement: Upgrade the edk2-basetools version from 0.1.29 to 0.1.39

2022-10-18 Thread Yuwei Chen
Reviewed-by: Yuwei Chen

> -Original Message-
> From: Feng, Bob C 
> Sent: Sunday, October 16, 2022 8:11 PM
> To: devel@edk2.groups.io
> Cc: Feng, Bob C ; Gao, Liming
> ; Chen, Christine 
> Subject: [PATCH 1/1] pip-requirement: Upgrade the edk2-basetools version
> from 0.1.29 to 0.1.39
> 
> features and bug fixes:
> 1. Revert "BaseTools: Fix DSC LibraryClass precedence rule"
> 2. BaseTools: Correct BPDG tool error prints 3. BaseTools: Remove duplicated
> words in Python tools 4. BaseTools/FMMT: Add Extract FV function 5.
> BaseTools/FMMT: Add Shrink Fv function 6. BaseTools: Add support for
> SUBTYPE_GUID section generation 7. BaseTools: Support COMPAT16 section
> generation 8. BaseTools/GenFds: Correct file type set for the PIC section 9.
> BaseTools: Correct initialization data size check for array PCDs 10. 
> BaseTools:
> Add missing spaces for PCD expression values in AutoGenC
> 
> Signed-off-by: Bob Feng 
> Cc: Liming Gao 
> Cc: Yuwei Chen 
> ---
>  pip-requirements.txt | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/pip-requirements.txt b/pip-requirements.txt index
> 967da7cb3783..40e9ad72ee4f 100644
> --- a/pip-requirements.txt
> +++ b/pip-requirements.txt
> @@ -14,5 +14,5 @@
> 
>  edk2-pytool-library==0.11.2
>  edk2-pytool-extensions~=0.16.0
> -edk2-basetools==0.1.29
> +edk2-basetools==0.1.39
>  antlr4-python3-runtime==4.7.1
> --
> 2.37.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#95354): https://edk2.groups.io/g/devel/message/95354
Mute This Topic: https://groups.io/mt/94360785/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] BaseTools: FMMT replace output file is not generated successfully

2022-10-18 Thread Yuwei Chen
For replace function, when target Ffs and new ffs are with
same size, the output file can not be generated successfully.
This patch fixes this issue.

Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yuwei Chen 
---
 edk2basetools/FMMT/core/BiosTree.py  |  4 ++--
 edk2basetools/FMMT/core/FvHandler.py | 19 ---
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/edk2basetools/FMMT/core/BiosTree.py 
b/edk2basetools/FMMT/core/BiosTree.py
index ae889f6..14fb007 100644
--- a/edk2basetools/FMMT/core/BiosTree.py
+++ b/edk2basetools/FMMT/core/BiosTree.py
@@ -56,7 +56,7 @@ def insertChild(self, newNode, pos: int=None) -> None:
 if len(self.Child) == 0:
 self.Child.append(newNode)
 else:
-if not pos:
+if not pos or pos == len(self.Child):
 LastTree = self.Child[-1]
 self.Child.append(newNode)
 LastTree.NextRel = newNode
@@ -195,4 +195,4 @@ def ExportTree(self,TreeInfo: dict=None) -> dict:
 for item in self.Child:
 TreeInfo[key].setdefault('Files',[]).append( item.ExportTree())
 
-return TreeInfo
\ No newline at end of file
+return TreeInfo
diff --git a/edk2basetools/FMMT/core/FvHandler.py 
b/edk2basetools/FMMT/core/FvHandler.py
index dc303c2..25f0929 100644
--- a/edk2basetools/FMMT/core/FvHandler.py
+++ b/edk2basetools/FMMT/core/FvHandler.py
@@ -387,7 +387,21 @@ def ReplaceFfs(self) -> bool:
 if self.NewFfs.Data.Size >= self.TargetFfs.Data.Size:
 Needed_Space = self.NewFfs.Data.Size + 
len(self.NewFfs.Data.PadData) - self.TargetFfs.Data.Size - 
len(self.TargetFfs.Data.PadData)
 # If TargetFv have enough free space, just move part of the free 
space to NewFfs.
-if TargetFv.Data.Free_Space >= Needed_Space:
+if Needed_Space == 0:
+Target_index = TargetFv.Child.index(self.TargetFfs)
+TargetFv.Child.remove(self.TargetFfs)
+TargetFv.insertChild(self.NewFfs, Target_index)
+# Modify TargetFv Header and ExtHeader info.
+TargetFv.Data.ModFvExt()
+TargetFv.Data.ModFvSize()
+TargetFv.Data.ModExtHeaderData()
+ModifyFvExtData(TargetFv)
+TargetFv.Data.ModCheckSum()
+# Recompress from the Fv node to update all the related node 
data.
+self.CompressData(TargetFv)
+# return the Status
+self.Status = True
+elif TargetFv.Data.Free_Space >= Needed_Space:
 # Modify TargetFv Child info and BiosTree.
 TargetFv.Child[-1].Data.Data = b'\xff' * 
(TargetFv.Data.Free_Space - Needed_Space)
 TargetFv.Data.Free_Space -= Needed_Space
@@ -450,7 +464,6 @@ def ReplaceFfs(self) -> bool:
 Target_index = TargetFv.Child.index(self.TargetFfs)
 TargetFv.Child.remove(self.TargetFfs)
 TargetFv.insertChild(self.NewFfs, Target_index)
-self.Status = True
 # If TargetFv do not have free space, create free space for Fv.
 else:
 New_Free_Space_Tree = BIOSTREE('FREE_SPACE')
@@ -461,7 +474,6 @@ def ReplaceFfs(self) -> bool:
 Target_index = TargetFv.Child.index(self.TargetFfs)
 TargetFv.Child.remove(self.TargetFfs)
 TargetFv.insertChild(self.NewFfs, Target_index)
-self.Status = True
 # Modify TargetFv Header and ExtHeader info.
 TargetFv.Data.ModFvExt()
 TargetFv.Data.ModFvSize()
@@ -470,6 +482,7 @@ def ReplaceFfs(self) -> bool:
 TargetFv.Data.ModCheckSum()
 # Recompress from the Fv node to update all the related node data.
 self.CompressData(TargetFv)
+self.Status = True
 logger.debug('Done!')
 return self.Status
 
-- 
2.26.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#95312): https://edk2.groups.io/g/devel/message/95312
Mute This Topic: https://groups.io/mt/94403776/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 2/2] BaseTools/FMMT: Add Shrink Fv function

2022-09-15 Thread Yuwei Chen
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3938

This function is used to remove the useless FV free space.
Usage: FMMT -s Inputfile Outputfile

Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yuwei Chen 
---
 BaseTools/Source/Python/FMMT/FMMT.py  |  7 +
 .../Source/Python/FMMT/core/FMMTOperation.py  | 26 +
 .../Source/Python/FMMT/core/FvHandler.py  | 28 ++-
 3 files changed, 60 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/FMMT/FMMT.py 
b/BaseTools/Source/Python/FMMT/FMMT.py
index 3590f3340ec3..bf580b3843a8 100644
--- a/BaseTools/Source/Python/FMMT/FMMT.py
+++ b/BaseTools/Source/Python/FMMT/FMMT.py
@@ -41,6 +41,8 @@ parser.add_argument("-c", "--ConfigFilePath", 
dest="ConfigFilePath", nargs='+',
 FmmtConf file saves the target guidtool used in 
compress/uncompress process.\
 If do not provide, FMMT tool will search the inputfile 
folder for FmmtConf.ini firstly, if not found,\
 the FmmtConf.ini saved in FMMT tool's folder will be 
used as default.")
+parser.add_argument("-s", "--ShrinkFv", dest="ShrinkFv", nargs='+',
+help="Shrink the Fv file: '-s InputFvfile OutputFvfile")
 
 def print_banner():
 print("")
@@ -111,6 +113,9 @@ class FMMT():
 else:
 ReplaceFfs(inputfile, self.CheckFfsName(Ffs_name), newffsfile, 
outputfile)
 
+def Shrink(self,inputfile: str, outputfile: str) -> None:
+self.SetDestPath(inputfile)
+ShrinkFv(inputfile, outputfile)
 
 def main():
 args=parser.parse_args()
@@ -142,6 +147,8 @@ def main():
 
fmmt.Replace(args.Replace[0],args.Replace[2],args.Replace[3],args.Replace[4],args.Replace[1])
 else:
 
fmmt.Replace(args.Replace[0],args.Replace[1],args.Replace[2],args.Replace[3])
+elif args.ShrinkFv:
+fmmt.Shrink(args.ShrinkFv[0], args.ShrinkFv[1])
 else:
 parser.print_help()
 except Exception as e:
diff --git a/BaseTools/Source/Python/FMMT/core/FMMTOperation.py 
b/BaseTools/Source/Python/FMMT/core/FMMTOperation.py
index 4e58c91b5c41..a86f8dda9a1a 100644
--- a/BaseTools/Source/Python/FMMT/core/FMMTOperation.py
+++ b/BaseTools/Source/Python/FMMT/core/FMMTOperation.py
@@ -204,3 +204,29 @@ def ExtractFfs(inputfile: str, Ffs_name: str, outputfile: 
str, Fv_name: str=None
 logger.debug('Extract ffs data is saved in {}.'.format(outputfile))
 else:
 logger.error('Target Ffs/Fv not found!!!')
+
+def ShrinkFv(inputfile: str, outputfile: str) -> None:
+if not os.path.exists(inputfile):
+logger.error("Invalid inputfile, can not open {}.".format(inputfile))
+raise Exception("Process Failed: Invalid inputfile!")
+# 1. Data Prepare
+with open(inputfile, "rb") as f:
+whole_data = f.read()
+FmmtParser = FMMTParser(inputfile, ROOT_TREE)
+# 2. DataTree Create
+logger.debug('Parsing inputfile data..')
+FmmtParser.ParserFromRoot(FmmtParser.WholeFvTree, whole_data)
+logger.debug('Done!')
+TargetFv = FmmtParser.WholeFvTree.Child[0]
+if TargetFv:
+FvMod = FvHandler(TargetFv)
+Status = FvMod.ShrinkFv()
+else:
+logger.error('Target Fv not found!!!')
+# 4. Data Encapsulation
+if Status:
+logger.debug('Start encapsulating data..')
+FmmtParser.Encapsulation(FmmtParser.WholeFvTree, False)
+with open(outputfile, "wb") as f:
+f.write(FmmtParser.FinalData)
+logger.debug('Encapsulated data is saved in {}.'.format(outputfile))
diff --git a/BaseTools/Source/Python/FMMT/core/FvHandler.py 
b/BaseTools/Source/Python/FMMT/core/FvHandler.py
index e8b848009878..ff3d637623f8 100644
--- a/BaseTools/Source/Python/FMMT/core/FvHandler.py
+++ b/BaseTools/Source/Python/FMMT/core/FvHandler.py
@@ -145,7 +145,7 @@ def ModifyFvSystemGuid(TargetFv) -> None:
 TargetFv.Data.Data += struct2stream(item.Data.Header)+ 
item.Data.Data + item.Data.PadData
 
 class FvHandler:
-def __init__(self, NewFfs, TargetFfs) -> None:
+def __init__(self, NewFfs, TargetFfs=None) -> None:
 self.NewFfs = NewFfs
 self.TargetFfs = TargetFfs
 self.Status = False
@@ -638,3 +638,29 @@ class FvHandler:
 self.Status = True
 logger.debug('Done!')
 return self.Status
+
+def ShrinkFv(self) -> bool:
+TargetFv = self.NewFfs
+TargetFv.Data.Data = b''
+if not TargetFv.Data.Free_Space:
+self.Status = True
+else:
+BlockSize = TargetFv.Data.Header.BlockMap[0].Length
+New_Free_Space = TargetFv.Data.Free_Space%BlockSize
+Removed_Space = TargetFv.Data.Free_Space - New_Free_Space
+TargetFv.Child[-1].Data.D

[edk2-devel] [PATCH 1/2] BaseTools/FMMT: Add Extract FV function

2022-09-15 Thread Yuwei Chen
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3938

With this patch "-e" parameter supports extract FV function.
Usage: FMMT -e Inputfile TargetFv Outputfile

Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yuwei Chen 
---
 BaseTools/Source/Python/FMMT/FMMT.py  |  3 +-
 .../Source/Python/FMMT/core/FMMTOperation.py  | 45 +++
 .../Source/Python/FMMT/core/FvHandler.py  |  5 +--
 3 files changed, 31 insertions(+), 22 deletions(-)

diff --git a/BaseTools/Source/Python/FMMT/FMMT.py 
b/BaseTools/Source/Python/FMMT/FMMT.py
index 10800e776a72..3590f3340ec3 100644
--- a/BaseTools/Source/Python/FMMT/FMMT.py
+++ b/BaseTools/Source/Python/FMMT/FMMT.py
@@ -24,7 +24,8 @@ parser.add_argument("-d", "--Delete", dest="Delete", 
nargs='+',
 If not given TargetFvName, all the existed target Ffs 
will be deleted'")
 parser.add_argument("-e", "--Extract", dest="Extract", nargs='+',
 help="Extract a Ffs Info: '-e inputfile 
TargetFvName(Optional) TargetFfsName outputfile\
-If not given TargetFvName, the first found target Ffs 
will be extracted'")
+If not given TargetFvName, the first found target Ffs 
will be extracted.\
+If only given TargetFvName, not given TargetFfsName, 
the TargetFv will be extracted to output file'")
 parser.add_argument("-a", "--Add", dest="Add", nargs='+',
 help="Add a Ffs into a FV:'-a inputfile TargetFvName 
newffsfile outputfile'")
 parser.add_argument("-r", "--Replace", dest="Replace", nargs='+',
diff --git a/BaseTools/Source/Python/FMMT/core/FMMTOperation.py 
b/BaseTools/Source/Python/FMMT/core/FMMTOperation.py
index c2cc2e246740..4e58c91b5c41 100644
--- a/BaseTools/Source/Python/FMMT/core/FMMTOperation.py
+++ b/BaseTools/Source/Python/FMMT/core/FMMTOperation.py
@@ -63,9 +63,10 @@ def DeleteFfs(inputfile: str, TargetFfs_name: str, 
outputfile: str, Fv_name: str
 FmmtParser.WholeFvTree.FindNode(TargetFfs_name, 
FmmtParser.WholeFvTree.Findlist)
 # Choose the Specfic DeleteFfs with Fv info
 if Fv_name:
-for item in FmmtParser.WholeFvTree.Findlist:
-if item.Parent.key != Fv_name and item.Parent.Data.Name != Fv_name:
-FmmtParser.WholeFvTree.Findlist.remove(item)
+FindNum = len(FmmtParser.WholeFvTree.Findlist)
+for index in range(FindNum-1, -1, -1):
+if FmmtParser.WholeFvTree.Findlist[index].Parent.key != Fv_name 
and FmmtParser.WholeFvTree.Findlist[index].Parent.Data.Name != Fv_name:
+
FmmtParser.WholeFvTree.Findlist.remove(FmmtParser.WholeFvTree.Findlist[index])
 Status = False
 if FmmtParser.WholeFvTree.Findlist != []:
 for Delete_Ffs in FmmtParser.WholeFvTree.Findlist:
@@ -149,9 +150,10 @@ def ReplaceFfs(inputfile: str, Ffs_name: str, newffsfile: 
str, outputfile: str,
 new_ffs.Data.PadData = GetPadSize(new_ffs.Data.Size, FFS_COMMON_ALIGNMENT) 
* b'\xff'
 FmmtParser.WholeFvTree.FindNode(Ffs_name, FmmtParser.WholeFvTree.Findlist)
 if Fv_name:
-for item in FmmtParser.WholeFvTree.Findlist:
-if item.Parent.key != Fv_name and item.Parent.Data.Name != Fv_name:
-FmmtParser.WholeFvTree.Findlist.remove(item)
+FindNum = len(FmmtParser.WholeFvTree.Findlist)
+for index in range(FindNum-1, -1, -1):
+if FmmtParser.WholeFvTree.Findlist[index].Parent.key != Fv_name 
and FmmtParser.WholeFvTree.Findlist[index].Parent.Data.Name != Fv_name:
+
FmmtParser.WholeFvTree.Findlist.remove(FmmtParser.WholeFvTree.Findlist[index])
 if FmmtParser.WholeFvTree.Findlist != []:
 for TargetFfs in FmmtParser.WholeFvTree.Findlist:
 FfsMod = FvHandler(newFmmtParser.WholeFvTree.Child[0], TargetFfs)
@@ -180,18 +182,25 @@ def ExtractFfs(inputfile: str, Ffs_name: str, outputfile: 
str, Fv_name: str=None
 logger.debug('Done!')
 FmmtParser.WholeFvTree.FindNode(Ffs_name, FmmtParser.WholeFvTree.Findlist)
 if Fv_name:
-for item in FmmtParser.WholeFvTree.Findlist:
-if item.Parent.key != Fv_name and item.Parent.Data.Name != Fv_name:
-FmmtParser.WholeFvTree.Findlist.remove(item)
+FindNum = len(FmmtParser.WholeFvTree.Findlist)
+for index in range(FindNum-1, -1, -1):
+if FmmtParser.WholeFvTree.Findlist[index].Parent.key != Fv_name 
and FmmtParser.WholeFvTree.Findlist[index].Parent.Data.Name != Fv_name:
+
FmmtParser.WholeFvTree.Findlist.remove(FmmtParser.WholeFvTree.Findlist[index])
 if FmmtParser.WholeFvTree.Findlist != []:
 TargetNode = FmmtParser.WholeFvTree.Findlist[0]
-TargetFv = TargetNode.Parent
-if TargetFv.Data.Header.Attributes & EFI_FVB2_ERASE_POLARITY:
-Target

Re: [edk2-devel] [PATCH 1/1] pip-requirement: Upgrade the edk2-basetools version from 0.1.24 to 0.1.28

2022-09-05 Thread Yuwei Chen
Reviewed-by: Yuwei Chen

> -Original Message-
> From: Feng, Bob C 
> Sent: Friday, September 2, 2022 2:18 PM
> To: devel@edk2.groups.io
> Cc: Feng, Bob C ; Gao, Liming
> ; Chen, Christine ;
> Kinney, Michael D 
> Subject: [PATCH 1/1] pip-requirement: Upgrade the edk2-basetools version
> from 0.1.24 to 0.1.28
> 
> features and bug fixes:
> 1. Fix the incremental build issue on Linux @176016387f 2. Fix DSC
> LibraryClass precedence rule @039bdb4d3e 3. INF should use latest Pcd
> value instead of default value @a512913 4. Support signtool input subject
> name to sign capsule @594b795
> 
> Signed-off-by: Bob Feng 
> Cc: Liming Gao 
> Cc: Yuwei Chen 
> Cc: Michael D Kinney 
> ---
>  pip-requirements.txt | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/pip-requirements.txt b/pip-requirements.txt index
> 29424b08bd88..353c01ff71ed 100644
> --- a/pip-requirements.txt
> +++ b/pip-requirements.txt
> @@ -14,5 +14,5 @@
> 
>  edk2-pytool-library==0.11.2
>  edk2-pytool-extensions~=0.16.0
> -edk2-basetools==0.1.24
> +edk2-basetools==0.1.28
>  antlr4-python3-runtime==4.7.1
> --
> 2.37.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#93180): https://edk2.groups.io/g/devel/message/93180
Mute This Topic: https://groups.io/mt/93414024/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH] BaseTools/VolInfo: Correct buffer for GenCrc32 tool

2022-07-28 Thread Yuwei Chen
Hi Konstantin, this is really an issue need to be solved.

When GenSec tool uses the guidtools to encode the section, it differentiates 
how GenCrc32 is used from other tools..

GenSec defines a CRC32_SECTION_HEADER structure for GenCrc32, and calculate the 
DataOffset of the Section with this header.

However other guidtools just use the EFI_GUID_DEFINED_SECTION header and 
calculate the DataOffset with it.



"
typedef struct {
  EFI_GUID_DEFINED_SECTION  GuidSectionHeader;
  UINT32CRC32Checksum;
} CRC32_SECTION_HEADER;


Crc32GuidSect->GuidSectionHeader.DataOffset  = sizeof (CRC32_SECTION_HEADER);



"

Personally think that is the root cause of the 4 bytes issue.



I do not know why the GenCrc32 usage is different from other tools in origin 
design.

Propose to solve this issue from GenSec side to keep all the guidtool with same 
function.



Thanks,

Christine



> -Original Message-

> From: devel@edk2.groups.io  On Behalf Of

> Konstantin Aladyshev

> Sent: Tuesday, July 19, 2022 9:45 PM

> To: devel@edk2.groups.io

> Cc: Feng, Bob C ; Gao, Liming

> ; Chen, Christine ;

> Konstantin Aladyshev 

> Subject: [edk2-devel] [PATCH] BaseTools/VolInfo: Correct buffer for

> GenCrc32 tool

>

> If the guided section was encoded with GenCrc32 tool the resulting

> 'EFI_GUID_DEFINED_SECTION.DataOffset' field points to the start of the

> meaningfull data that follows the CRC32 value.

> But if we want to decode the section with GenCrc32 tool we need to provide

> a buffer that includes the CRC32 value itself.

>

> Signed-off-by: Konstantin Aladyshev 
> mailto:aladyshe...@gmail.com>>

> ---

>  BaseTools/Source/C/VolInfo/VolInfo.c | 7 +++

>  1 file changed, 7 insertions(+)

>

> diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c

> b/BaseTools/Source/C/VolInfo/VolInfo.c

> index f450796f9c..47a8f80f46 100644

> --- a/BaseTools/Source/C/VolInfo/VolInfo.c

> +++ b/BaseTools/Source/C/VolInfo/VolInfo.c

> @@ -1999,6 +1999,13 @@ Returns:

>); free (ExtractionTool); +if (!CompareGuid (+ 
>   EfiGuid,+

> +   )+   ) {+

> DataOffset -= 4;+} Status =   PutFileImage (  
>ToolInputFile,--

> 2.25.1

>

>

>

> -=-=-=-=-=-=

> Groups.io Links: You receive all messages sent to this group.

> View/Reply Online (#91530): https://edk2.groups.io/g/devel/message/91530

> Mute This Topic: https://groups.io/mt/92482555/4546272

> Group Owner: devel+ow...@edk2.groups.io

> Unsubscribe: https://edk2.groups.io/g/devel/unsub [yuwei.c...@intel.com]

> -=-=-=-=-=-=

>




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91960): https://edk2.groups.io/g/devel/message/91960
Mute This Topic: https://groups.io/mt/92482555/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH] BaseTools/VolInfo: Increase define for highest section value

2022-07-22 Thread Yuwei Chen
Reviewed-by: Yuwei Chen

> -Original Message-
> From: Konstantin Aladyshev 
> Sent: Monday, July 18, 2022 8:56 PM
> To: devel@edk2.groups.io
> Cc: Feng, Bob C ; Gao, Liming
> ; Chen, Christine ;
> Konstantin Aladyshev 
> Subject: [PATCH] BaseTools/VolInfo: Increase define for highest section
> value
> 
> Currently sections with unknown types are displayed as
> `EFI_SECTION_SMM_DEPEX` which is wrong.
> Increase the highest value for the section type to 0x1C for correct parsing.
> 
> Signed-off-by: Konstantin Aladyshev 
> ---
>  BaseTools/Source/C/VolInfo/VolInfo.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/BaseTools/Source/C/VolInfo/VolInfo.h
> b/BaseTools/Source/C/VolInfo/VolInfo.h
> index 624ac38f0e..377cde80f7 100644
> --- a/BaseTools/Source/C/VolInfo/VolInfo.h
> +++ b/BaseTools/Source/C/VolInfo/VolInfo.h
> @@ -22,8 +22,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>  #define EFI_DEP_END   0x08 #define EFI_DEP_SOR   0x09 -#define
> EFI_SECTION_LAST_LEAF_SECTION_TYPE  0x1B-#define
> EFI_SECTION_LAST_SECTION_TYPE   0x1B+#define
> EFI_SECTION_LAST_LEAF_SECTION_TYPE  0x1C+#define
> EFI_SECTION_LAST_SECTION_TYPE   0x1C  #define
> OPENSSL_COMMAND_FORMAT_STRING   "%s sha1 -out %s %s" #define
> EXTRACT_COMMAND_FORMAT_STRING   "%s -d -o %s %s"--
> 2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91688): https://edk2.groups.io/g/devel/message/91688
Mute This Topic: https://groups.io/mt/92457706/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH] BaseTools/VolInfo: Correct alignment attributes display

2022-07-22 Thread Yuwei Chen
Reviewed-by: Yuwei Chen

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of
> Konstantin Aladyshev
> Sent: Wednesday, July 13, 2022 9:11 PM
> To: devel@edk2.groups.io
> Cc: Feng, Bob C ; Gao, Liming
> ; Chen, Christine ;
> Konstantin Aladyshev 
> Subject: [edk2-devel] [PATCH] BaseTools/VolInfo: Correct alignment
> attributes display
> 
> Alignment attribute is not a bitmask, therefore we need to compare field
> value with all alignment defines.
> Remove duplicate print statements. Unify indent with other attribute print
> statements.
> 
> Signed-off-by: Konstantin Aladyshev 
> ---
>  BaseTools/Source/C/VolInfo/VolInfo.c | 198 +--
>  1 file changed, 96 insertions(+), 102 deletions(-)
> 
> diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c
> b/BaseTools/Source/C/VolInfo/VolInfo.c
> index 2457ddd2e7..8b6fcffa48 100644
> --- a/BaseTools/Source/C/VolInfo/VolInfo.c
> +++ b/BaseTools/Source/C/VolInfo/VolInfo.c
> @@ -911,140 +911,134 @@ Returns:
>  printf ("   EFI_FVB2_WRITE_LOCK_STATUS\n");   } -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_1) {+  switch
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT) {+case
> EFI_FVB2_ALIGNMENT_1: printf ("   EFI_FVB2_ALIGNMENT_1\n");-  }--  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2) {-printf ("
> EFI_FVB2_ALIGNMENT_2\n");-  }--  if (VolumeHeader.Attributes &
> EFI_FVB2_ALIGNMENT_4) {-printf ("EFI_FVB2_ALIGNMENT_4\n");-  }+
> break; -  if (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_8) {-printf
> ("EFI_FVB2_ALIGNMENT_8\n");-  }+case EFI_FVB2_ALIGNMENT_2:+
> printf ("   EFI_FVB2_ALIGNMENT_2\n");+break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_16) {-printf ("
> EFI_FVB2_ALIGNMENT_16\n");-  }+case EFI_FVB2_ALIGNMENT_4:+
> printf ("   EFI_FVB2_ALIGNMENT_4\n");+break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_32) {-printf ("
> EFI_FVB2_ALIGNMENT_32\n");-  }+case EFI_FVB2_ALIGNMENT_8:+
> printf ("   EFI_FVB2_ALIGNMENT_8\n");+break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64) {-printf ("
> EFI_FVB2_ALIGNMENT_64\n");-  }+case EFI_FVB2_ALIGNMENT_16:+
> printf ("   EFI_FVB2_ALIGNMENT_16\n");+break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_128) {-printf ("
> EFI_FVB2_ALIGNMENT_128\n");-  }+case EFI_FVB2_ALIGNMENT_32:+
> printf ("   EFI_FVB2_ALIGNMENT_32\n");+break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_256) {-printf ("
> EFI_FVB2_ALIGNMENT_256\n");-  }+case EFI_FVB2_ALIGNMENT_64:+
> printf ("   EFI_FVB2_ALIGNMENT_64\n");+break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_512) {-printf ("
> EFI_FVB2_ALIGNMENT_512\n");-  }+case EFI_FVB2_ALIGNMENT_128:+
> printf ("   EFI_FVB2_ALIGNMENT_128\n");+break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_1K) {-printf ("
> EFI_FVB2_ALIGNMENT_1K\n");-  }+case EFI_FVB2_ALIGNMENT_256:+
> printf ("   EFI_FVB2_ALIGNMENT_256\n");+break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_2K) {-printf ("
> EFI_FVB2_ALIGNMENT_2K\n");-  }+case EFI_FVB2_ALIGNMENT_512:+
> printf ("   EFI_FVB2_ALIGNMENT_512\n");+break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_4K) {-printf ("
> EFI_FVB2_ALIGNMENT_4K\n");-  }+case EFI_FVB2_ALIGNMENT_1K:+
> printf ("   EFI_FVB2_ALIGNMENT_1K\n");+break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_8K) {-printf ("
> EFI_FVB2_ALIGNMENT_8K\n");-  }+case EFI_FVB2_ALIGNMENT_2K:+
> printf ("   EFI_FVB2_ALIGNMENT_2K\n");+break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_16K) {-printf ("
> EFI_FVB2_ALIGNMENT_16K\n");-  }+case EFI_FVB2_ALIGNMENT_4K:+
> printf ("   EFI_FVB2_ALIGNMENT_4K\n");+break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_32K) {-printf ("
> EFI_FVB2_ALIGNMENT_32K\n");-  }+case EFI_FVB2_ALIGNMENT_8K:+
> printf ("   EFI_FVB2_ALIGNMENT_8K\n");+break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_64K) {-printf ("
> EFI_FVB2_ALIGNMENT_64K\n");-  }+case EFI_FVB2_ALIGNMENT_16K:+
> printf ("   EFI_FVB2_ALIGNMENT_16K\n");+break; -  if
> (VolumeHeader.Attributes & EFI_FVB2_ALIGNMENT_128K) {-printf ("
> EFI_FVB2_ALIGNMENT_128K\n");-

Re: [edk2-devel] [PATCH 1/1] BaseTools: INF should use latest Pcd value instead of default value

2022-07-21 Thread Yuwei Chen
Hi Yi,

Could you describe the bug with an example? In which scenario the dsc defined 
pcd will not override the dec definition? 

Thanks,
Christine
> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of yi1 li
> Sent: Monday, July 11, 2022 1:48 PM
> To: devel@edk2.groups.io
> Cc: Li, Yi1 ; Feng, Bob C ; Gao,
> Liming 
> Subject: [edk2-devel] [PATCH 1/1] BaseTools: INF should use latest Pcd value
> instead of default value
> 
> This patch is a bug fix about FeatureFlagExpression in INF file:
>  INF [Source] section now unconditionally use Pcd default value in DEC  when
> handling FeatureFlagExpression, it is wrong.
>  If a Pcd value has been set in the DSC file, we should use latest  value in 
> DSC
> instead of default value.
> 
> Cc: Bob Feng 
> Cc: Liming Gao 
> 
> Signed-off-by: Yi Li 
> ---
>  BaseTools/Source/Python/Workspace/InfBuildData.py | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py
> b/BaseTools/Source/Python/Workspace/InfBuildData.py
> index 5b9b3d7b4f..e4ff1c6686 100644
> --- a/BaseTools/Source/Python/Workspace/InfBuildData.py
> +++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
> @@ -1084,7 +1084,9 @@ class InfBuildData(ModuleBuildClassObject):
>  else:
>  for Name, Guid in self.Pcds:
>  if self.Pcds[(Name, Guid)].Type == 'FeatureFlag' or 
> self.Pcds[(Name,
> Guid)].Type == 'FixedAtBuild':
> -Pcds['%s.%s' % (Guid, Name)] = self.Pcds[(Name,
> Guid)].DefaultValue
> +PcdFullName = '%s.%s' % (Guid, Name);
> +if not PcdFullName in Pcds:
> +Pcds[PcdFullName] = self.Pcds[(Name,
> + Guid)].DefaultValue
>  try:
>  Value = ValueExpression(Instance, Pcds)()
>  if Value == True:
> --
> 2.31.1.windows.1
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91684): https://edk2.groups.io/g/devel/message/91684
Mute This Topic: https://groups.io/mt/92304285/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [Patch V3 1/1] BaseTools: remove directly calling for gcc command

2022-07-21 Thread Yuwei Chen
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4003

In some environment, the directly calling for gcc is not supported.
This patch fixes the issue.

Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yuwei Chen 
---
 BaseTools/Source/C/DevicePath/GNUmakefile | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/BaseTools/Source/C/DevicePath/GNUmakefile 
b/BaseTools/Source/C/DevicePath/GNUmakefile
old mode 100644
new mode 100755
index c217674345b1..5944e80bd2b4
--- a/BaseTools/Source/C/DevicePath/GNUmakefile
+++ b/BaseTools/Source/C/DevicePath/GNUmakefile
@@ -13,12 +13,15 @@ OBJECTS = DevicePath.o UefiDevicePathLib.o 
DevicePathFromText.o  DevicePathUtili
 
 include $(MAKEROOT)/Makefiles/app.makefile
 
-GCCVERSION = $(shell gcc -dumpversion | awk -F'.' '{print $$1}')
+GCCVERSION=0
+ifneq ($(CXX), gcc)
+  GCCVERSION = $(shell $(CXX) -dumpversion | awk -F'.' '{print $$1}')
+endif
 ifneq ("$(GCCVERSION)", "5")
-ifneq ($(CXX), llvm)
-# gcc 12 trips over device path handling
-BUILD_CFLAGS += -Wno-error=stringop-overflow
-endif
+  ifneq ($(CXX), llvm)
+# gcc 12 trips over device path handling
+BUILD_CFLAGS += -Wno-error=stringop-overflow
+  endif
 endif
 
 LIBS = -lCommon
-- 
2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91683): https://edk2.groups.io/g/devel/message/91683
Mute This Topic: https://groups.io/mt/92539013/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [Patch V2 1/1] BaseTools: remove directly calling for gcc command

2022-07-19 Thread Yuwei Chen
In some environment, the directly calling for gcc is not supported.
This patch fixes the issue.

Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yuwei Chen 
---
 BaseTools/Source/C/DevicePath/GNUmakefile | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/BaseTools/Source/C/DevicePath/GNUmakefile 
b/BaseTools/Source/C/DevicePath/GNUmakefile
old mode 100644
new mode 100755
index c217674345b1..5944e80bd2b4
--- a/BaseTools/Source/C/DevicePath/GNUmakefile
+++ b/BaseTools/Source/C/DevicePath/GNUmakefile
@@ -13,12 +13,15 @@ OBJECTS = DevicePath.o UefiDevicePathLib.o 
DevicePathFromText.o  DevicePathUtili
 
 include $(MAKEROOT)/Makefiles/app.makefile
 
-GCCVERSION = $(shell gcc -dumpversion | awk -F'.' '{print $$1}')
+GCCVERSION=0
+ifneq ($(CXX), gcc)
+  GCCVERSION = $(shell $(CXX) -dumpversion | awk -F'.' '{print $$1}')
+endif
 ifneq ("$(GCCVERSION)", "5")
-ifneq ($(CXX), llvm)
-# gcc 12 trips over device path handling
-BUILD_CFLAGS += -Wno-error=stringop-overflow
-endif
+  ifneq ($(CXX), llvm)
+# gcc 12 trips over device path handling
+BUILD_CFLAGS += -Wno-error=stringop-overflow
+  endif
 endif
 
 LIBS = -lCommon
-- 
2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91558): https://edk2.groups.io/g/devel/message/91558
Mute This Topic: https://groups.io/mt/92495597/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 1/1] BaseTools: add '-p' for Linux 'cp' command.

2022-07-08 Thread Yuwei Chen
Currently BaseTools use 'cp' command for PcdValueInit and GenMake
process, as the command can not keep the time info of the source
file, which will cause incremental build issue in Linux system,
thus the '-p' need be added to keep the source file's attributes
in copy process.

This patch fixes this issue.

Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yuwei Chen 
---
 BaseTools/Source/Python/AutoGen/GenMake.py| 2 +-
 BaseTools/Source/Python/Workspace/DscBuildData.py | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py 
b/BaseTools/Source/Python/AutoGen/GenMake.py
index 92c7bf0cdad5..daec9c6d54b2 100755
--- a/BaseTools/Source/Python/AutoGen/GenMake.py
+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -120,7 +120,7 @@ class BuildFile(object):
 },
 
 POSIX_PLATFORM : {
-"CP":   "cp -f",
+"CP":   "cp -p -f",
 "MV":   "mv -f",
 "RM":   "rm -f",
 "MD":   "mkdir -p",
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index a599c5bb7688..e9f68384b429 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -2932,7 +2932,7 @@ class DscBuildData(PlatformBuildClassObject):
 MakeApp = MakeApp + PcdMakefileEnd
 MakeApp = MakeApp + AppTarget % ("""\tcopy $(APPLICATION) 
$(APPFILE) /y """)
 else:
-MakeApp = MakeApp + AppTarget % ("""\tcp $(APPLICATION) $(APPFILE) 
""")
+MakeApp = MakeApp + AppTarget % ("""\tcp -p $(APPLICATION) 
$(APPFILE) """)
 MakeApp = MakeApp + '\n'
 IncludeFileFullPaths = []
 for includefile in IncludeFiles:
@@ -2955,7 +2955,7 @@ class DscBuildData(PlatformBuildClassObject):
 else:
 PcdValueCommonPath = 
os.path.normpath(mws.join(GlobalData.gGlobalDefines["EDK_TOOLS_PATH"], 
"Source/C/Common/PcdValueCommon.c"))
 MakeApp = MakeApp + '%s/PcdValueCommon.c : %s\n' % 
(self.OutputPath, PcdValueCommonPath)
-MakeApp = MakeApp + '\tcp -f %s %s/PcdValueCommon.c\n' % 
(PcdValueCommonPath, self.OutputPath)
+MakeApp = MakeApp + '\tcp -p -f %s %s/PcdValueCommon.c\n' % 
(PcdValueCommonPath, self.OutputPath)
 MakeFileName = os.path.join(self.OutputPath, 'Makefile')
 MakeApp += "$(OBJECTS) : %s\n" % MakeFileName
 SaveFileOnChange(MakeFileName, MakeApp, False)
-- 
2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91182): https://edk2.groups.io/g/devel/message/91182
Mute This Topic: https://groups.io/mt/92250878/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 1/1] BaseTools: remove directly calling for gcc command

2022-07-07 Thread Yuwei Chen
In some environment, the directly calling for gcc is not supported.
Thus replace gcc to $(CC).

Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yuwei Chen 
---
 BaseTools/Source/C/DevicePath/GNUmakefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/C/DevicePath/GNUmakefile 
b/BaseTools/Source/C/DevicePath/GNUmakefile
index c217674345b1..f683efc5648a 100644
--- a/BaseTools/Source/C/DevicePath/GNUmakefile
+++ b/BaseTools/Source/C/DevicePath/GNUmakefile
@@ -13,7 +13,7 @@ OBJECTS = DevicePath.o UefiDevicePathLib.o 
DevicePathFromText.o  DevicePathUtili
 
 include $(MAKEROOT)/Makefiles/app.makefile
 
-GCCVERSION = $(shell gcc -dumpversion | awk -F'.' '{print $$1}')
+GCCVERSION = $(shell $(CC) -dumpversion | awk -F'.' '{print $$1}')
 ifneq ("$(GCCVERSION)", "5")
 ifneq ($(CXX), llvm)
 # gcc 12 trips over device path handling
-- 
2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91176): https://edk2.groups.io/g/devel/message/91176
Mute This Topic: https://groups.io/mt/92246093/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v3 3/3] [edk2-platforms] Silicon/Intel/FitGen: Support Startup ACM entries (Type 2) 0x200 Version

2022-07-03 Thread Yuwei Chen
Reviewed-by: Yuwei Chen

> -Original Message-
> From: Lin, Jason1 
> Sent: Friday, July 1, 2022 11:10 PM
> To: devel@edk2.groups.io
> Cc: Lin, Jason1 ; Feng, Bob C ;
> Gao, Liming ; Chen, Christine
> ; Oram, Isaac W ;
> Chaganty, Rangasai V ; Chiang, Dakota
> 
> Subject: [PATCH v3 3/3] [edk2-platforms] Silicon/Intel/FitGen: Support
> Startup ACM entries (Type 2) 0x200 Version
> 
> From: Jason1 Lin 
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3959
> 
> As per FIT BIOS Specification 1.2 Rules, the size bytes (3 bytes) / reserved
> byte (1 byte) / CheckSum byte (1 byte) in type 2 are must-be-zero (MBZ).
> These bytes could be override for the other usages.
> This change is used to support the Type 02 (ACM) Ver. 0x200.
> 
> Command:
> [-S |] [-I
> ] [-V ]
> 
> Signed-off-by: Jason1 Lin 
> Cc: Bob Feng 
> Cc: Liming Gao 
> Cc: Yuwei Chen 
> Cc: Isaac W Oram 
> Cc: Rangasai V Chaganty 
> Cc: Dakota Chiang 
> ---
>  Silicon/Intel/Tools/FitGen/FitGen.c | 183 ++--
>  Silicon/Intel/Tools/FitGen/FitGen.h |   2 +-
>  2 files changed, 165 insertions(+), 20 deletions(-)
> 
> diff --git a/Silicon/Intel/Tools/FitGen/FitGen.c
> b/Silicon/Intel/Tools/FitGen/FitGen.c
> index 01b4f82518..577ce48b10 100644
> --- a/Silicon/Intel/Tools/FitGen/FitGen.c
> +++ b/Silicon/Intel/Tools/FitGen/FitGen.c
> @@ -55,6 +55,7 @@ typedef struct {
>  #define ACM_MODULE_FLAG_PREPRODUCTION   0x4000 #define
> ACM_MODULE_FLAG_DEBUG_SIGN  0x8000 +#define
> NIBBLES_TO_BYTE(A, B)  (UINT8)(((A & (0x0F)) << 4) | (B & 0x0F))  typedef
> struct {   UINT16 ModuleType;@@ -149,6 +150,20 @@ typedef struct {
>ACM_PROCESSOR_ID ProcessorID[1]; } PROCESSOR_ID_LIST; +typedef
> union {+  struct {+UINT32  Stepping  : 4;+UINT32  Model : 
> 4;+
> UINT32  Family: 4;+UINT32  Type  : 2;+UINT32  
> Reserved1 : 2;+
> UINT32  ExtendedModel : 4;+UINT32  ExtendedFamily: 8;+UINT32
> Reserved2 : 4;+  } Bits;+  UINT32  Uint32;+} PROCESSOR_ID;+ #pragma pack
> ()  @@ -210,6 +225,7 @@ typedef struct {
>   #define DEFAULT_FIT_TABLE_POINTER_OFFSET  0x40 #define
> DEFAULT_FIT_ENTRY_VERSION 0x0100+#define
> STARTUP_ACM_FIT_ENTRY_200_VERSION 0x0200  #define
> TOP_FLASH_ADDRESS  (gFitTableContext.TopFlashAddressRemapValue) @@
> -247,6 +263,8 @@ typedef struct {
>UINT8   *Buffer; // Used by OptionalModule only   UINT32  Size;   UINT32
> Version; // Used by OptionalModule and PortModule only+  UINT32  FMS;
> // Used by Entry Type 02 (ACM) Ver. 0x200 only+  UINT32  FMSMask; // Used
> by Entry Type 02 (ACM) Ver. 0x200 only } FIT_TABLE_CONTEXT_ENTRY;
> typedef struct {@@ -262,7 +280,7 @@ typedef struct {
>UINT32 GlobalVersion;   UINT32 
> FitHeaderVersion;
> FIT_TABLE_CONTEXT_ENTRYStartupAcm[MAX_STARTUP_ACM_ENTRY];-
> UINT32 StartupAcmVersion;+  UINT32
> StartupAcmVersion[MAX_STARTUP_ACM_ENTRY];
> FIT_TABLE_CONTEXT_ENTRYDiagnstAcm;   UINT32
> DiagnstAcmVersion;   FIT_TABLE_CONTEXT_ENTRY
> BiosModule[MAX_BIOS_MODULE_ENTRY];@@ -341,7 +359,7 @@ Returns:
>"\t[-L  ]\n"   "\t[-LF
> ]\n"   "\t[-I ]\n"-  "\t[-S
> |] [-V
> ]\n"+  "\t[-S  StartupAcmSize>|] [-I  StartupAcmFMSMask>] [-V ]\n"   "\t[-U
> |]\n"   "\t[-B
> ] [-B ...] [-V ]\n"
> "\t[-M ] [-M ...]|[-U  MicrocodeBase>| MicrocodeRegionSize>|] [-V ]\n"@@ -
> 356,8 +374,11 @@ Returns:
>printf ("\tFitTablePointerOffset  - FIT table pointer offset. 0x%x as 
> default.
> 0x18 for current soon to be obsoleted CPUs. User can set both.\n",
> DEFAULT_FIT_TABLE_POINTER_OFFSET);   printf ("\tBiosInfoGuid   - Guid
> of BiosInfo Module. If this module exists, StartupAcm/Bios/Microcode can be
> optional.\n");   printf ("\tStartupAcmAddress  - Address of
> StartupAcm.\n");-  printf ("\tStartupAcmSize - Size of 
> StartupAcm.\n");+
> printf ("\tStartupAcmSize - The maximum size value that could place 
> the
> StartupAcm in.\n");   printf ("\tStartupAcmGuid - Guid of StartupAcm
> Module, if StartupAcm is in a BiosModule, it will be excluded form that.\n");+
> printf ("\tStartupAcmFMS  - Value of PROCESSOR ID
> (Family/Model/Stepping value called \"FMS\") - see detail on FIT spec
> (1.3).\n");+  printf ("\tStartupAcmFMSMask  - Value use for uCode (if it
> recognizes 0x200 Type2 entry) to do bitmask logic operation with CPU
> processor ID.\n");+  pr

Re: [edk2-devel] [PATCH v3 2/3] [edk2-platforms] Silicon/Intel/FitGen: Reduce the typecasting and pointer usage

2022-07-03 Thread Yuwei Chen
Reviewed-by: Yuwei Chen

> -Original Message-
> From: Lin, Jason1 
> Sent: Friday, July 1, 2022 11:10 PM
> To: devel@edk2.groups.io
> Cc: Lin, Jason1 ; Feng, Bob C ;
> Gao, Liming ; Chen, Christine
> ; Oram, Isaac W ;
> Chaganty, Rangasai V ; Chiang, Dakota
> 
> Subject: [PATCH v3 2/3] [edk2-platforms] Silicon/Intel/FitGen: Reduce the
> typecasting and pointer usage
> 
> From: Jason1 Lin 
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3958
> 
> FitGen tool exists lots of typecasting and pointer usage.
> This code change is used to reduce these in FillFitTable () and 
> GetFitEntryInfo
> ().
> To make code more clearly and easy to read.
> 
> Signed-off-by: Jason1 Lin 
> Cc: Bob Feng 
> Cc: Liming Gao 
> Cc: Yuwei Chen 
> Cc: Isaac W Oram 
> Cc: Rangasai V Chaganty 
> Cc: Dakota Chiang 
> ---
>  Silicon/Intel/Tools/FitGen/FitGen.c | 125 
>  1 file changed, 78 insertions(+), 47 deletions(-)
> 
> diff --git a/Silicon/Intel/Tools/FitGen/FitGen.c
> b/Silicon/Intel/Tools/FitGen/FitGen.c
> index eac8fa8715..01b4f82518 100644
> --- a/Silicon/Intel/Tools/FitGen/FitGen.c
> +++ b/Silicon/Intel/Tools/FitGen/FitGen.c
> @@ -2768,6 +2768,7 @@ Returns:
>  {   FIRMWARE_INTERFACE_TABLE_ENTRY *FitEntry;   UINT32
> FitIndex;+  UINT32  FitEntrySizeValue;   UINT32
> Index;   UINT8   Checksum;   UINTN
>SubIndex;@@
> -2788,27 +2789,35 @@ Returns:
>//   // 2. FitHeader   //-  FitEntry[FitIndex].Address = 
> *(UINT64
> *)"_FIT_   ";-  *(UINT32 *)[FitIndex].Size[0] =
> gFitTableContext.FitEntryNumber;-  FitEntry[FitIndex].Version =
> (UINT16)gFitTableContext.FitHeaderVersion;-  FitEntry[FitIndex].Type
> = FIT_TABLE_TYPE_HEADER;-  FitEntry[FitIndex].C_V = 1;+
> FitEntrySizeValue   = gFitTableContext.FitEntryNumber;+
> FitEntry[FitIndex].Address  = *(UINT64 *)"_FIT_   ";+  
> FitEntry[FitIndex].Size[0]
> = (UINT8)FitEntrySizeValue;+  FitEntry[FitIndex].Size[1]  =
> (UINT8)(FitEntrySizeValue >> 8);+  FitEntry[FitIndex].Size[2]  =
> (UINT8)(FitEntrySizeValue >> 16);+  FitEntry[FitIndex].Rsvd = 0;+
> FitEntry[FitIndex].Version  = (UINT16)gFitTableContext.FitHeaderVersion;+
> FitEntry[FitIndex].Type = FIT_TABLE_TYPE_HEADER;+
> FitEntry[FitIndex].C_V  = 1;   //   // Checksum will be updated later...  
>  //-
> FitEntry[FitIndex].Checksum= 0;+  FitEntry[FitIndex].Checksum = 
> 0;//
> // 3. Microcode   //   FitIndex++;   for (Index = 0; Index <
> gFitTableContext.MicrocodeNumber; Index++) {-FitEntry[FitIndex].Address
> = gFitTableContext.Microcode[Index].Address;-*(UINT32
> *)[FitIndex].Size[0] = 0; //gFitTableContext.Microcode[Index].Size /
> 16;-FitEntry[FitIndex].Version =
> (UINT16)gFitTableContext.MicrocodeVersion;-FitEntry[FitIndex].Type
> = FIT_TABLE_TYPE_MICROCODE;-FitEntry[FitIndex].C_V = 0;-
> FitEntry[FitIndex].Checksum= 0;+FitEntrySizeValue   = 
> 0; //
> gFitTableContext.Microcode[Index].Size / 16+FitEntry[FitIndex].Address  =
> gFitTableContext.Microcode[Index].Address;+FitEntry[FitIndex].Size[0]  =
> (UINT8)FitEntrySizeValue;+FitEntry[FitIndex].Size[1]  =
> (UINT8)(FitEntrySizeValue >> 8);+FitEntry[FitIndex].Size[2]  =
> (UINT8)(FitEntrySizeValue >> 16);+FitEntry[FitIndex].Rsvd = 0;+
> FitEntry[FitIndex].Version  = (UINT16)gFitTableContext.MicrocodeVersion;+
> FitEntry[FitIndex].Type = FIT_TABLE_TYPE_MICROCODE;+
> FitEntry[FitIndex].C_V  = 0;+FitEntry[FitIndex].Checksum = 0;
> FitIndex++;   } @@ -2816,12 +2825,16 @@ Returns:
>// 4. StartupAcm   //   for (Index = 0; Index <
> gFitTableContext.StartupAcmNumber; Index++) {-
> FitEntry[FitIndex].Address =
> gFitTableContext.StartupAcm[Index].Address;-*(UINT32
> *)[FitIndex].Size[0] = 0; //gFitTableContext.StartupAcm.Size / 16;-
> FitEntry[FitIndex].Version =
> (UINT16)gFitTableContext.StartupAcmVersion;-FitEntry[FitIndex].Type
> = FIT_TABLE_TYPE_STARTUP_ACM;-FitEntry[FitIndex].C_V = 0;-
> FitEntry[FitIndex].Checksum= 0;+FitEntrySizeValue   = 
> 0; //
> gFitTableContext.StartupAcm.Size / 16+FitEntry[FitIndex].Address  =
> gFitTableContext.StartupAcm[Index].Address;+FitEntry[FitIndex].Size[0]  =
> (UINT8)FitEntrySizeValue;+FitEntry[FitIndex].Size[1]  =
> (UINT8)(FitEntrySizeValue >> 8);+FitEntry[FitIndex].Size[2]  =
> (UINT8)(FitEntrySizeValue >> 16);+FitEntry[FitIndex].Rsvd = 0;+
> FitEntry[FitIndex].Vers

Re: [edk2-devel] [PATCH v3 1/3] [edk2-platforms] Silicon/Intel/FitGen: Support multiple Startup ACM Type 2 entries in FitGen tool

2022-07-03 Thread Yuwei Chen
Reviewed-by: Yuwei Chen

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Lin,
> Jason1
> Sent: Friday, July 1, 2022 11:10 PM
> To: devel@edk2.groups.io
> Cc: Lin, Jason1 ; Feng, Bob C ;
> Gao, Liming ; Chen, Christine
> ; Oram, Isaac W ;
> Chaganty, Rangasai V ; Chiang, Dakota
> 
> Subject: [edk2-devel] [PATCH v3 1/3] [edk2-platforms] Silicon/Intel/FitGen:
> Support multiple Startup ACM Type 2 entries in FitGen tool
> 
> From: Jason1 Lin 
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3958
> 
> Within current FitGen tool there had limitation only allow one S-ACM to
> generate the Type 2 entry.
> This code change is used to support multiple type 2 entries up to 0x20.
> 
> Signed-off-by: Jason1 Lin 
> Cc: Bob Feng 
> Cc: Liming Gao 
> Cc: Yuwei Chen 
> Cc: Isaac W Oram 
> Cc: Rangasai V Chaganty 
> Cc: Dakota Chiang 
> ---
>  Silicon/Intel/Tools/FitGen/FitGen.c | 89 +++-
> Silicon/Intel/Tools/FitGen/FitGen.h |  4 +-
>  2 files changed, 50 insertions(+), 43 deletions(-)
> 
> diff --git a/Silicon/Intel/Tools/FitGen/FitGen.c
> b/Silicon/Intel/Tools/FitGen/FitGen.c
> index 4de72ea422..eac8fa8715 100644
> --- a/Silicon/Intel/Tools/FitGen/FitGen.c
> +++ b/Silicon/Intel/Tools/FitGen/FitGen.c
> @@ -2,7 +2,7 @@
>  This utility is part of build process for IA32/X64 FD. It generates FIT 
> table. -
> Copyright (c) 2010-2021, Intel Corporation. All rights
> reserved.+Copyright (c) 2010-2022, Intel Corporation. All rights
> reserved. SPDX-License-Identifier: BSD-2-Clause-Patent  **/@@ -204,6
> +204,7 @@ typedef struct {
>   #define MAX_BIOS_MODULE_ENTRY  0x20 #define
> MAX_MICROCODE_ENTRY0x20+#define MAX_STARTUP_ACM_ENTRY  0x20
> #define MAX_OPTIONAL_ENTRY 0x20 #define MAX_PORT_ENTRY 0x20
> @@ -255,11 +256,12 @@ typedef struct {
>UINT32 FitEntryNumber;   UINT32
> BiosModuleNumber;   UINT32 MicrocodeNumber;+  UINT32
> StartupAcmNumber;   UINT32 OptionalModuleNumber;   UINT32
> PortModuleNumber;   UINT32 GlobalVersion;   UINT32
> FitHeaderVersion;-  FIT_TABLE_CONTEXT_ENTRYStartupAcm;+
> FIT_TABLE_CONTEXT_ENTRYStartupAcm[MAX_STARTUP_ACM_ENTRY];
> UINT32 StartupAcmVersion;   FIT_TABLE_CONTEXT_ENTRY
> DiagnstAcm;   UINT32 DiagnstAcmVersion;@@ -1149,14 
> +1151,15
> @@ Returns:
>Error (NULL, 0, 0, "-I Parameter incorrect, Header Type 
> unsupported!",
> NULL);   return 0; case FIT_TABLE_TYPE_STARTUP_ACM:-  
> if
> (gFitTableContext.StartupAcm.Type != 0) {-Error (NULL, 0, 0, "-I
> Parameter incorrect, Duplicated StartupAcm!", NULL);+  if
> (gFitTableContext.StartupAcmNumber >= MAX_STARTUP_ACM_ENTRY) {+
> Error (NULL, 0, 0, "-I Parameter incorrect, too many StartupAcm!", NULL);
> return 0;   }-  gFitTableContext.StartupAcm.Type=
> FIT_TABLE_TYPE_STARTUP_ACM;-
> gFitTableContext.StartupAcm.Address =
> (UINT32)BiosInfoStruct[BiosInfoIndex].Address;-
> gFitTableContext.StartupAcm.Size=
> (UINT32)BiosInfoStruct[BiosInfoIndex].Size;-
> gFitTableContext.StartupAcmVersion  =
> BiosInfoStruct[BiosInfoIndex].Version;+
> gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Type=
> FIT_TABLE_TYPE_STARTUP_ACM;+
> gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Address
> = (UINT32)BiosInfoStruct[BiosInfoIndex].Address;+
> gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Size=
> (UINT32)BiosInfoStruct[BiosInfoIndex].Size;+
> gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Version
> = BiosInfoStruct[BiosInfoIndex].Version;+
> gFitTableContext.StartupAcmNumber ++;
> gFitTableContext.FitEntryNumber ++;   break; case
> FIT_TABLE_TYPE_DIAGNST_ACM:@@ -1351,16 +1354,15 @@ Returns:
>//   // 1. StartupAcm   //-  do {+  while (TRUE) { if ((Index + 1 >= 
> argc) ||
> ((strcmp (argv[Index], "-S") != 0) &&  (strcmp (argv[Index], "-s") != 
> 0)) ) {-
> if (BiosInfoExist && (gFitTableContext.StartupAcm.Type ==
> FIT_TABLE_TYPE_STARTUP_ACM)) {-break;+  if
> (gFitTableContext.StartupAcmNumber == 0) {+printf ("-S not found.
> WARNING!\n");   } //  Error (NULL, 0, 0, "-S Parameter incorrect, 
> expect -
> S!", NULL); //  return 0;-  printf ("-S not found. WARNING!\n");
> break; } if (IsGuidData (argv[Index + 1], )) {@@ -1381,14 
> +1383,13
> @@ Returns:
>FileSize = xtoi (argv[Index + 2]);   Index += 3; }-if
> (gFitTableContext.S

Re: [edk2-devel] [Patch V2] pip-requirements.txt: Update basetools version to 0.1.24

2022-07-03 Thread Yuwei Chen
Reviewed-by: Yuwei Chen

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Bob
> Feng
> Sent: Thursday, June 30, 2022 12:11 PM
> To: devel@edk2.groups.io
> Cc: Kinney, Michael D ; Kubacki, Michael
> 
> Subject: [edk2-devel] [Patch V2] pip-requirements.txt: Update basetools
> version to 0.1.24
> 
> Upgrade the edk2-basetools version from 0.1.17 to 0.1.24
> 
> features and bug fixes:
> 1. Add FMMT Python Tool
> 2. Remove RVCT support
> 3. Fix dependency issue in PcdValueInit
> 4. Output the intermediate library instance when error occurs 5. Ecc: Fix
> grammar in Ecc error message 6. Fix the GenMake bug for .cpp source file
> 
> Signed-off-by: Bob Feng 
> Reviewed-by: Michael D Kinney 
> Acked-by: Michael Kubacki  ---update the
> commit message.
>  pip-requirements.txt | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/pip-requirements.txt b/pip-requirements.txt index
> 6585df201d..29424b08bd 100644
> --- a/pip-requirements.txt
> +++ b/pip-requirements.txt
> @@ -12,7 +12,7 @@
>  # https://www.python.org/dev/peps/pep-0440/#version-specifiers ##  edk2-
> pytool-library==0.11.2 edk2-pytool-extensions~=0.16.0-edk2-
> basetools==0.1.17+edk2-basetools==0.1.24 antlr4-python3-runtime==4.7.1--
> 2.29.1.windows.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#90926): https://edk2.groups.io/g/devel/message/90926
> Mute This Topic: https://groups.io/mt/92080401/4546272
> Group Owner: devel+ow...@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [yuwei.c...@intel.com]
> -=-=-=-=-=-=
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91014): https://edk2.groups.io/g/devel/message/91014
Mute This Topic: https://groups.io/mt/92080401/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 1/1] BaseTools: Fix DSC LibraryClass precedence rule

2022-06-30 Thread Yuwei Chen
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3965

Currently DSC LibraryClass precedence rule is not align with DSC Spec.

The expectation rule should be:
[LibraryClasses.$(ARCH)] < [LibraryClasses.Common.$(MODULE_TYPE)]

The actual behavior is:
[LibraryClasses.$(ARCH)] > [LibraryClasses.Common.$(MODULE_TYPE)]

This patch fixes the issue.

Cc: Bob Feng 
Cc: Liming Gao 
Cc: Long1 Huang 
Cc: Ray Ni 
Signed-off-by: Yuwei Chen 
---
 BaseTools/Source/Python/Workspace/DscBuildData.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index a599c5bb7688..7a56b2b2e972 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -872,7 +872,7 @@ class DscBuildData(PlatformBuildClassObject):
 if ModuleType != TAB_COMMON and ModuleType not in 
SUP_MODULE_LIST:
 EdkLogger.error('build', OPTION_UNKNOWN, "Unknown module 
type [%s]" % ModuleType,
 File=self.MetaFile, 
ExtraData=LibraryInstance, Line=LineNo)
-LibraryClassDict[Arch, ModuleType, LibraryClass] = 
LibraryInstance
+LibraryClassDict[ModuleType, Arch, LibraryClass] = 
LibraryInstance
 if LibraryInstance not in self._LibraryInstances:
 self._LibraryInstances.append(LibraryInstance)
 
@@ -881,7 +881,7 @@ class DscBuildData(PlatformBuildClassObject):
 for LibraryClass in LibraryClassSet:
 # try all possible module types
 for ModuleType in SUP_MODULE_LIST:
-LibraryInstance = LibraryClassDict[self._Arch, ModuleType, 
LibraryClass]
+LibraryInstance = LibraryClassDict[ModuleType, self._Arch, 
LibraryClass]
 if LibraryInstance is None:
 continue
 self._LibraryClasses[LibraryClass, ModuleType] = 
LibraryInstance
-- 
2.26.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#90928): https://edk2.groups.io/g/devel/message/90928
Mute This Topic: https://groups.io/mt/92082564/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [Patch] BaseTools: Fix the GenMake bug for .cpp source file

2022-06-26 Thread Yuwei Chen
Reviewed-by: Yuwei Chen

> -Original Message-
> From: Feng, Bob C 
> Sent: Saturday, June 25, 2022 1:12 PM
> To: devel@edk2.groups.io
> Cc: Feng, Bob C ; Gao, Liming
> ; Chen, Christine 
> Subject: [Patch] BaseTools: Fix the GenMake bug for .cpp source file
> 
> From: "Feng, Bob C" 
> 
> Build-rules.txt lists .cc and .cpp as supported file extensions.
> BaseTools commit 05217d210e introduce a regression issue that ignore
> the .cc and .cpp file type.
> 
> This patch is to fix this bug.
> 
> Signed-off-by: Bob Feng 
> Cc: Liming Gao 
> Cc: Yuwei Chen 
> ---
>  BaseTools/Source/Python/AutoGen/GenMake.py | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py
> b/BaseTools/Source/Python/AutoGen/GenMake.py
> index da406e6ff4..92c7bf0cda 100755
> --- a/BaseTools/Source/Python/AutoGen/GenMake.py
> +++ b/BaseTools/Source/Python/AutoGen/GenMake.py
> @@ -1108,11 +1108,12 @@ cleanlib:
>  else: # CmdTargetDict[CmdSign] = 
> "%s %s" %
> (CmdTargetDict[CmdSign], SingleCommandList[-1])
> CmdTargetDict[CmdSign].append(SingleCommandList[-1]) 
> Index =
> CommandList.index(Item) CommandList.pop(Index)-   
>  if
> SingleCommandList[-1].endswith("%s%s.c" % (TAB_SLASH,
> CmdSumDict[CmdSign[3:].rsplit(TAB_SLASH, 1)[0]])):+
> BaseName =
> SingleCommandList[-1].rsplit('.',1)[0]+if
> BaseName.endswith("%s%s" % (TAB_SLASH,
> CmdSumDict[CmdSign[3:].rsplit(TAB_SLASH, 1)[0]])): 
> Cpplist =
> CmdCppDict[T.Target.SubDir] Cpplist.insert(0, 
> '$(OBJLIST_%d): ' %
> list(self.ObjTargetDict.keys()).index(T.Target.SubDir))
> source_files = CmdTargetDict[CmdSign][1:] 
> source_files.insert(0,
> " ") if len(source_files)>2:--
> 2.29.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#90762): https://edk2.groups.io/g/devel/message/90762
Mute This Topic: https://groups.io/mt/91979266/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] BaseTools: Current status of BaseTools/Source/Python

2022-06-23 Thread Yuwei Chen
Hi Ayush,

The migration is still working in progress. 
In order to ensure the normal use of users, the current bug fixes are still 
based on BaseTools in edk2. 
After all the migrations are completed, an official notification will be sent, 
and the developments and bug fixing works will be transferred to the 
edk2-basetools repo.

Thanks,
Christine (Yuwei)

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Ayush
> Singh
> Sent: Saturday, June 11, 2022 11:31 PM
> To: edk2-devel-groups-io 
> Cc: Michael Kubacki 
> Subject: [edk2-devel] BaseTools: Current status of BaseTools/Source/Python
> 
> Hello everyone,
> 
> I have been poking around the BaseTools to understand its implementation
> since I will have to add Rust build support as a part of my GSoC project. The
> `BaseTools/Source/Python` directory contains a README file that states that
> the folder was supposed to be removed from the repo on 202102.
> 
> It is still present in the repo, but more importantly, it still seems to be 
> getting
> commits. Initially, I thought that maybe it was a mirror kind of situation but
> the commit history does not match, so I'm not sure.
> 
> Can anyone tell me what the current status of migration is, or if it has been
> canceled?
> 
> Yours Sincerely,
> Ayush Singh
> 
> [1] https://github.com/tianocore/edk2
> [2] https://github.com/tianocore/edk2-basetools
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#90739): https://edk2.groups.io/g/devel/message/90739
Mute This Topic: https://groups.io/mt/91690261/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 1/1] BaseTools/Ecc: Fix grammar in Ecc error message

2022-06-23 Thread Yuwei Chen
Reviewed-by: Yuwei Chen

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Rebecca
> Cran
> Sent: Monday, June 20, 2022 6:07 AM
> To: devel@edk2.groups.io; Feng, Bob C ; Gao, Liming
> ; Chen, Christine 
> Cc: Rebecca Cran 
> Subject: [edk2-devel] [PATCH 1/1] BaseTools/Ecc: Fix grammar in Ecc error
> message
> 
> Signed-off-by: Rebecca Cran 
> ---
>  BaseTools/Source/Python/Ecc/c.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/Ecc/c.py
> b/BaseTools/Source/Python/Ecc/c.py
> index 4a82e5e76003..61ad084fcc5b 100644
> --- a/BaseTools/Source/Python/Ecc/c.py
> +++ b/BaseTools/Source/Python/Ecc/c.py
> @@ -2612,8 +2612,8 @@ def
> CheckFunctionHeaderConsistentWithDoxygenComment(FuncModifier,
> FuncHeader, Fu
> 
> 
>  if Tag.find(ParamName) == -1 and ParamName != 'VOID' and
> ParamName != 'void':
> -ErrorMsgList.append('Line %d : in Comment, <%s> does NOT
> consistent with parameter name %s ' % (CommentStartLine, (TagPartList[0] +
> ' ' + TagPartList[1]).replace('\n', '').replace('\r', ''), ParamName))
> -PrintErrorMsg(ERROR_DOXYGEN_CHECK_FUNCTION_HEADER, 'in
> Comment, <%s> does NOT consistent with parameter name %s ' %
> ((TagPartList[0] + ' ' + TagPartList[1]).replace('\n', '').replace('\r', ''),
> ParamName), TableName, CommentId)
> +ErrorMsgList.append('Line %d : in Comment, <%s> is NOT
> consistent with parameter name %s ' % (CommentStartLine, (TagPartList[0] +
> ' ' + TagPartList[1]).replace('\n', '').replace('\r', ''), ParamName))
> +PrintErrorMsg(ERROR_DOXYGEN_CHECK_FUNCTION_HEADER, 'in
> Comment, <%s> is NOT consistent with parameter name %s ' %
> ((TagPartList[0] + ' ' + TagPartList[1]).replace('\n', '').replace('\r', ''),
> ParamName), TableName, CommentId)
>  Index += 1
> 
>  if Index < ParamNumber:
> --
> 2.35.3
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#90737): https://edk2.groups.io/g/devel/message/90737
Mute This Topic: https://groups.io/mt/91866114/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] [edk2-staging] BaseTools:Remove useless FMMT entry file

2022-05-08 Thread Yuwei Chen
FMMT can be directly used as its compiled binary path saved in PATH,
the FMMT in BaseTools/BinWrappers/PosixLike is useless now.

This patch remove the useless file.

Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yuwei Chen 
---
 BaseTools/BinWrappers/PosixLike/FMMT | 29 
 1 file changed, 29 deletions(-)
 delete mode 100755 BaseTools/BinWrappers/PosixLike/FMMT

diff --git a/BaseTools/BinWrappers/PosixLike/FMMT 
b/BaseTools/BinWrappers/PosixLike/FMMT
deleted file mode 100755
index 0945d86d92..00
--- a/BaseTools/BinWrappers/PosixLike/FMMT
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env bash
-
-full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
-dir=$(dirname "$full_cmd")
-cmd=${full_cmd##*/}
-
-if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
-then
-  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
-elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
-then
-  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
-  then
-echo "BaseTools C Tool binary was not found ($cmd)"
-echo "You may need to run:"
-echo "  make -C $EDK_TOOLS_PATH/Source/C"
-  else
-exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
-  fi
-elif [ -e "$dir/../../Source/C/bin/$cmd" ]
-then
-  exec "$dir/../../Source/C/bin/$cmd" "$@"
-else
-  echo "Unable to find the real '$cmd' to run"
-  echo "This message was printed by"
-  echo "  $0"
-  exit 127
-fi
-
-- 
2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89588): https://edk2.groups.io/g/devel/message/89588
Mute This Topic: https://groups.io/mt/90980955/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] [edk2-staging] BaseTools: Modify FMMT GNUmakefile

2022-05-08 Thread Yuwei Chen
Currently the path of compiled FMMT binary is not saved in PATH,
this patch modified FMMT binary path for directly using.

Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yuwei Chen 
---
 BaseTools/Source/C/FMMT/GNUmakefile  |  2 +-
 BaseTools/Source/C/FMMT/app.makefile | 25 +
 2 files changed, 26 insertions(+), 1 deletion(-)
 mode change 100644 => 100755 BaseTools/Source/C/FMMT/GNUmakefile
 create mode 100755 BaseTools/Source/C/FMMT/app.makefile

diff --git a/BaseTools/Source/C/FMMT/GNUmakefile 
b/BaseTools/Source/C/FMMT/GNUmakefile
old mode 100644
new mode 100755
index 81b99f25db..d0ea601f8e
--- a/BaseTools/Source/C/FMMT/GNUmakefile
+++ b/BaseTools/Source/C/FMMT/GNUmakefile
@@ -12,5 +12,5 @@ LIBS = -lCommon
 
 OBJECTS = FmmtLib.o Rebase.o FirmwareModuleManagement.o
 
-include $(MAKEROOT)/Makefiles/app.makefile
+include $(MAKEROOT)/FMMT/app.makefile
 
diff --git a/BaseTools/Source/C/FMMT/app.makefile 
b/BaseTools/Source/C/FMMT/app.makefile
new file mode 100755
index 00..130528a97e
--- /dev/null
+++ b/BaseTools/Source/C/FMMT/app.makefile
@@ -0,0 +1,25 @@
+## @file
+# Makefiles
+#
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+MAKEROOT ?= ../..
+LINUX_BIN_PATH = ../../../Bin/Linux-x86_64
+
+include $(MAKEROOT)/Makefiles/header.makefile
+
+APPLICATION = $(MAKEROOT)/bin/$(APPNAME)
+
+.PHONY:all
+all: $(MAKEROOT)/bin $(APPLICATION)
+
+$(APPLICATION): $(OBJECTS)
+   $(LINKER) -o $(APPLICATION) $(BUILD_LFLAGS) $(OBJECTS) 
-L$(MAKEROOT)/libs $(LIBS)
+   -mkdir -p $(LINUX_BIN_PATH)
+   cp -r $(APPLICATION) $(LINUX_BIN_PATH)
+
+$(OBJECTS): $(MAKEROOT)/Include/Common/BuildVersion.h
+
+include $(MAKEROOT)/Makefiles/footer.makefile
-- 
2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89587): https://edk2.groups.io/g/devel/message/89587
Mute This Topic: https://groups.io/mt/90980949/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] Remove useless FMMT entry file

2022-05-08 Thread Yuwei Chen
FMMT can be directly used as its compiled binary path saved in PATH,
the FMMT in BaseTools/BinWrappers/PosixLike is useless now.

This patch remove the useless file.

Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yuwei Chen 
---
 BaseTools/BinWrappers/PosixLike/FMMT | 29 
 1 file changed, 29 deletions(-)
 delete mode 100755 BaseTools/BinWrappers/PosixLike/FMMT

diff --git a/BaseTools/BinWrappers/PosixLike/FMMT 
b/BaseTools/BinWrappers/PosixLike/FMMT
deleted file mode 100755
index 0945d86d92..00
--- a/BaseTools/BinWrappers/PosixLike/FMMT
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env bash
-
-full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here
-dir=$(dirname "$full_cmd")
-cmd=${full_cmd##*/}
-
-if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
-then
-  exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
-elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
-then
-  if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
-  then
-echo "BaseTools C Tool binary was not found ($cmd)"
-echo "You may need to run:"
-echo "  make -C $EDK_TOOLS_PATH/Source/C"
-  else
-exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
-  fi
-elif [ -e "$dir/../../Source/C/bin/$cmd" ]
-then
-  exec "$dir/../../Source/C/bin/$cmd" "$@"
-else
-  echo "Unable to find the real '$cmd' to run"
-  echo "This message was printed by"
-  echo "  $0"
-  exit 127
-fi
-
-- 
2.26.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89586): https://edk2.groups.io/g/devel/message/89586
Mute This Topic: https://groups.io/mt/90980660/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] BaseTools: Modify FMMT GNUmakefile

2022-05-08 Thread Yuwei Chen
Currently the path of compiled FMMT binary is not saved in PATH,
this patch modified FMMT binary path for directly using.

Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yuwei Chen 
---
 BaseTools/Source/C/FMMT/GNUmakefile  |  2 +-
 BaseTools/Source/C/FMMT/app.makefile | 25 +
 2 files changed, 26 insertions(+), 1 deletion(-)
 mode change 100644 => 100755 BaseTools/Source/C/FMMT/GNUmakefile
 create mode 100755 BaseTools/Source/C/FMMT/app.makefile

diff --git a/BaseTools/Source/C/FMMT/GNUmakefile 
b/BaseTools/Source/C/FMMT/GNUmakefile
old mode 100644
new mode 100755
index 81b99f25db..d0ea601f8e
--- a/BaseTools/Source/C/FMMT/GNUmakefile
+++ b/BaseTools/Source/C/FMMT/GNUmakefile
@@ -12,5 +12,5 @@ LIBS = -lCommon
 
 OBJECTS = FmmtLib.o Rebase.o FirmwareModuleManagement.o
 
-include $(MAKEROOT)/Makefiles/app.makefile
+include $(MAKEROOT)/FMMT/app.makefile
 
diff --git a/BaseTools/Source/C/FMMT/app.makefile 
b/BaseTools/Source/C/FMMT/app.makefile
new file mode 100755
index 00..130528a97e
--- /dev/null
+++ b/BaseTools/Source/C/FMMT/app.makefile
@@ -0,0 +1,25 @@
+## @file
+# Makefiles
+#
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+MAKEROOT ?= ../..
+LINUX_BIN_PATH = ../../../Bin/Linux-x86_64
+
+include $(MAKEROOT)/Makefiles/header.makefile
+
+APPLICATION = $(MAKEROOT)/bin/$(APPNAME)
+
+.PHONY:all
+all: $(MAKEROOT)/bin $(APPLICATION)
+
+$(APPLICATION): $(OBJECTS)
+   $(LINKER) -o $(APPLICATION) $(BUILD_LFLAGS) $(OBJECTS) 
-L$(MAKEROOT)/libs $(LIBS)
+   -mkdir -p $(LINUX_BIN_PATH)
+   cp -r $(APPLICATION) $(LINUX_BIN_PATH)
+
+$(OBJECTS): $(MAKEROOT)/Include/Common/BuildVersion.h
+
+include $(MAKEROOT)/Makefiles/footer.makefile
-- 
2.26.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89585): https://edk2.groups.io/g/devel/message/89585
Mute This Topic: https://groups.io/mt/90980657/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] Proposal to merge python FMMT tool from edk2-staging to edk2 repo

2022-04-28 Thread Yuwei Chen
Hi all,

Currently python FMMT tool has finished final tests on several scenarios and 
made some functions' optimization. All the changes have already been merged 
into edk2-staging PyFMMT branch. Since it have been under review for a long 
time Liming has ever given the agreement, I propose to move it from 
edk2-staging to edk2 BaseTools now.

Staging Link: https://github.com/tianocore/edk2-staging/tree/PyFMMT

The new Python version keeps same functions with origin C version. It has 
higher quality and better coding style, and it is much easier to
extend new functions and to maintain.

This version of FMMT Python tool does not support PEIM rebase feature, this 
feature will be added in future update.

Thanks,
Christine (Yuwei)


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89372): https://edk2.groups.io/g/devel/message/89372
Mute This Topic: https://groups.io/mt/90751927/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [Patch V2] BaseTools: Fix DevicePath tool build failure issue

2022-04-10 Thread Yuwei Chen
This patch looks good to me. 

Reviewed-by: Yuwei Chen

> -Original Message-
> From: Feng, Bob C 
> Sent: Monday, April 4, 2022 11:46 AM
> To: devel@edk2.groups.io
> Cc: Feng, Bob C ; Rebecca Cran
> ; Chen, Christine ; Gerd
> Hoffmann ; Gao, Liming 
> Subject: [Patch V2] BaseTools: Fix DevicePath tool build failure issue
> 
> From: "Feng, Bob C" 
> 
> Fix the DevicePath tool build failure that was introduced by the fixes:
> 22130dcd98b4 ("Basetools: turn off gcc12 warning").
> Failure cases are:
> 1. clang 13.1.6 on macOS
> 2. gcc5.4
> 
> Reported-by: Rebecca Cran 
> Reported-by: Yuwei Chen 
> Signed-off-by: Gerd Hoffmann 
> Signed-off-by: Bob Feng 
> Cc: Liming Gao 
> Cc: Yuwei Chen 
> Cc: Rebecca Cran 
> ---V2 update the method to get gcc version
> BaseTools/Source/C/DevicePath/GNUmakefile | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/BaseTools/Source/C/DevicePath/GNUmakefile
> b/BaseTools/Source/C/DevicePath/GNUmakefile
> index b05d2bddfa..c217674345 100644
> --- a/BaseTools/Source/C/DevicePath/GNUmakefile
> +++ b/BaseTools/Source/C/DevicePath/GNUmakefile
> @@ -11,12 +11,17 @@ APPNAME = DevicePath
>   OBJECTS = DevicePath.o UefiDevicePathLib.o DevicePathFromText.o
> DevicePathUtilities.o  include $(MAKEROOT)/Makefiles/app.makefile
> +GCCVERSION = $(shell gcc -dumpversion | awk -F'.' '{print $$1}')+ifneq
> ("$(GCCVERSION)", "5")+ifneq ($(CXX), llvm) # gcc 12 trips over device path
> handling BUILD_CFLAGS += -Wno-error=stringop-overflow+endif+endif  LIBS
> = -lCommon ifeq ($(CYGWIN), CYGWIN)   LIBS += -L/lib/e2fsprogs -luuid
> endif--
> 2.29.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88678): https://edk2.groups.io/g/devel/message/88678
Mute This Topic: https://groups.io/mt/90234472/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v2 1/1] Basetools: fix gcc workaround

2022-04-01 Thread Yuwei Chen
Hi Liming,

Have tried this option, still not works. 

Thanks,
Christine (Yuwei)

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of
> gaoliming
> Sent: Thursday, March 31, 2022 1:33 PM
> To: Chen, Christine ; devel@edk2.groups.io; 'Gerd
> Hoffmann' ; Kinney, Michael D
> ; 'Sean Brogan'
> ; Shi, Steven ; Feng,
> Bob C 
> Cc: 'Rebecca Cran' ; 'Pawel Polawski'
> ; 'Oliver Steffen' 
> Subject: 回复: [edk2-devel] [PATCH v2 1/1] Basetools: fix gcc workaround
> 
> Christine:
>   Can you try the option -Wno-unknown-warning to see whether it disables
> the warning about an unrecognized command line option?
> 
> Thanks
> Liming
> > -邮件原件-
> > 发件人: Chen, Christine 
> > 发送时间: 2022年3月31日 10:47
> > 收件人: devel@edk2.groups.io; Chen, Christine ;
> > Gerd Hoffmann ; Kinney, Michael D
> > ; Sean Brogan
> ;
> > Gao, Liming ; Shi, Steven
> > ; Feng, Bob C 
> > 抄送: Rebecca Cran ; Pawel Polawski
> > ; Oliver Steffen 
> > 主题: RE: [edk2-devel] [PATCH v2 1/1] Basetools: fix gcc workaround
> >
> > Since the gcc12 has the incompatible change from GCC5.4, I'd also
> > suggest
> we
> > could create a new TOOL CHAIN for gcc12.
> > The error reports I collected show in gcc5.4 ,
> "-Wno-error=stringop-overflow"
> > is an unrecognized command line option which is available in gcc12.
> >
> > Thanks,
> > Christine (Yuwei)
> > > -Original Message-
> > > From: devel@edk2.groups.io  On Behalf Of
> Yuwei
> > > Chen
> > > Sent: Thursday, March 31, 2022 8:51 AM
> > > To: Gerd Hoffmann ; devel@edk2.groups.io
> > > Cc: Feng, Bob C ; Rebecca Cran
> > > ; Pawel Polawski ; Oliver
> > > Steffen ; Gao, Liming
> > > 
> > > Subject: Re: [edk2-devel] [PATCH v2 1/1] Basetools: fix gcc
> > > workaround
> > >
> > > Hi Hoffmann,
> > >
> > > I received some reports that some platforms are using gcc5.4. With
> > > this
> > patch,
> > > these platform builds are still broken.
> > > Would you like to revert the original commits?
> > >
> > > Thanks,
> > > Christine (Yuwei)
> > >
> > > > -Original Message-
> > > > From: Gerd Hoffmann 
> > > > Sent: Tuesday, March 29, 2022 4:38 PM
> > > > To: devel@edk2.groups.io
> > > > Cc: Feng, Bob C ; Rebecca Cran
> > > > ; Pawel Polawski ;
> Oliver
> > > > Steffen ; Chen, Christine
> > > ;
> > > > Gao, Liming ; Gerd Hoffmann
> > > > 
> > > > Subject: [PATCH v2 1/1] Basetools: fix gcc workaround
> > > >
> > > > Apply the workaround only in case the compiler is gcc.
> > > > Fixes builds with clang.
> > > >
> > > > Fixes: 22130dcd98b4 ("Basetools: turn off gcc12 warning")
> > > > Reported-by: Rebecca Cran 
> > > > Signed-off-by: Gerd Hoffmann 
> > > > ---
> > > >  BaseTools/Source/C/DevicePath/GNUmakefile | 2 ++
> > > >  1 file changed, 2 insertions(+)
> > > >
> > > > diff --git a/BaseTools/Source/C/DevicePath/GNUmakefile
> > > > b/BaseTools/Source/C/DevicePath/GNUmakefile
> > > > index b05d2bddfa68..6323e7355cc8 100644
> > > > --- a/BaseTools/Source/C/DevicePath/GNUmakefile
> > > > +++ b/BaseTools/Source/C/DevicePath/GNUmakefile
> > > > @@ -13,8 +13,10 @@ OBJECTS = DevicePath.o UefiDevicePathLib.o
> > > > DevicePathFromText.o  DevicePathUtili
> > > >
> > > >  include $(MAKEROOT)/Makefiles/app.makefile
> > > >
> > > > +ifneq ($(CXX), llvm)
> > > >  # gcc 12 trips over device path handling  BUILD_CFLAGS += -Wno-
> > > > error=stringop-overflow
> > > > +endif
> > > >
> > > >  LIBS = -lCommon
> > > >  ifeq ($(CYGWIN), CYGWIN)
> > > > --
> > > > 2.35.1
> > >
> > >
> > >
> > >
> > >
> 
> 
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88373): https://edk2.groups.io/g/devel/message/88373
Mute This Topic: https://groups.io/mt/90196477/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v2 1/1] Basetools: fix gcc workaround

2022-03-30 Thread Yuwei Chen
Since the gcc12 has the incompatible change from GCC5.4, I'd also suggest we 
could create a new TOOL CHAIN for gcc12.
The error reports I collected show in gcc5.4 , "-Wno-error=stringop-overflow" 
is an unrecognized command line option which is available in gcc12.

Thanks,
Christine (Yuwei)
> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Yuwei
> Chen
> Sent: Thursday, March 31, 2022 8:51 AM
> To: Gerd Hoffmann ; devel@edk2.groups.io
> Cc: Feng, Bob C ; Rebecca Cran
> ; Pawel Polawski ; Oliver
> Steffen ; Gao, Liming 
> Subject: Re: [edk2-devel] [PATCH v2 1/1] Basetools: fix gcc workaround
> 
> Hi Hoffmann,
> 
> I received some reports that some platforms are using gcc5.4. With this patch,
> these platform builds are still broken.
> Would you like to revert the original commits?
> 
> Thanks,
> Christine (Yuwei)
> 
> > -Original Message-
> > From: Gerd Hoffmann 
> > Sent: Tuesday, March 29, 2022 4:38 PM
> > To: devel@edk2.groups.io
> > Cc: Feng, Bob C ; Rebecca Cran
> > ; Pawel Polawski ; Oliver
> > Steffen ; Chen, Christine
> ;
> > Gao, Liming ; Gerd Hoffmann
> > 
> > Subject: [PATCH v2 1/1] Basetools: fix gcc workaround
> >
> > Apply the workaround only in case the compiler is gcc.
> > Fixes builds with clang.
> >
> > Fixes: 22130dcd98b4 ("Basetools: turn off gcc12 warning")
> > Reported-by: Rebecca Cran 
> > Signed-off-by: Gerd Hoffmann 
> > ---
> >  BaseTools/Source/C/DevicePath/GNUmakefile | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/BaseTools/Source/C/DevicePath/GNUmakefile
> > b/BaseTools/Source/C/DevicePath/GNUmakefile
> > index b05d2bddfa68..6323e7355cc8 100644
> > --- a/BaseTools/Source/C/DevicePath/GNUmakefile
> > +++ b/BaseTools/Source/C/DevicePath/GNUmakefile
> > @@ -13,8 +13,10 @@ OBJECTS = DevicePath.o UefiDevicePathLib.o
> > DevicePathFromText.o  DevicePathUtili
> >
> >  include $(MAKEROOT)/Makefiles/app.makefile
> >
> > +ifneq ($(CXX), llvm)
> >  # gcc 12 trips over device path handling  BUILD_CFLAGS += -Wno-
> > error=stringop-overflow
> > +endif
> >
> >  LIBS = -lCommon
> >  ifeq ($(CYGWIN), CYGWIN)
> > --
> > 2.35.1
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88281): https://edk2.groups.io/g/devel/message/88281
Mute This Topic: https://groups.io/mt/90104204/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v2 1/1] Basetools: fix gcc workaround

2022-03-30 Thread Yuwei Chen
Hi Hoffmann,

I received some reports that some platforms are using gcc5.4. With this patch, 
these platform builds are still broken.
Would you like to revert the original commits?

Thanks,
Christine (Yuwei)

> -Original Message-
> From: Gerd Hoffmann 
> Sent: Tuesday, March 29, 2022 4:38 PM
> To: devel@edk2.groups.io
> Cc: Feng, Bob C ; Rebecca Cran
> ; Pawel Polawski ; Oliver
> Steffen ; Chen, Christine ;
> Gao, Liming ; Gerd Hoffmann
> 
> Subject: [PATCH v2 1/1] Basetools: fix gcc workaround
> 
> Apply the workaround only in case the compiler is gcc.
> Fixes builds with clang.
> 
> Fixes: 22130dcd98b4 ("Basetools: turn off gcc12 warning")
> Reported-by: Rebecca Cran 
> Signed-off-by: Gerd Hoffmann 
> ---
>  BaseTools/Source/C/DevicePath/GNUmakefile | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/BaseTools/Source/C/DevicePath/GNUmakefile
> b/BaseTools/Source/C/DevicePath/GNUmakefile
> index b05d2bddfa68..6323e7355cc8 100644
> --- a/BaseTools/Source/C/DevicePath/GNUmakefile
> +++ b/BaseTools/Source/C/DevicePath/GNUmakefile
> @@ -13,8 +13,10 @@ OBJECTS = DevicePath.o UefiDevicePathLib.o
> DevicePathFromText.o  DevicePathUtili
> 
>  include $(MAKEROOT)/Makefiles/app.makefile
> 
> +ifneq ($(CXX), llvm)
>  # gcc 12 trips over device path handling  BUILD_CFLAGS += -Wno-
> error=stringop-overflow
> +endif
> 
>  LIBS = -lCommon
>  ifeq ($(CYGWIN), CYGWIN)
> --
> 2.35.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88278): https://edk2.groups.io/g/devel/message/88278
Mute This Topic: https://groups.io/mt/90104204/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [Patch] BaseTools: Remove the redundant __FLEXIBLE_SIZE from PcdValueInit.c

2022-03-20 Thread Yuwei Chen
This patch reduces compilation time , it looks good to me. 

Reviewed-by: Yuwei Chen

> -Original Message-
> From: Feng, Bob C 
> Sent: Tuesday, March 15, 2022 8:17 PM
> To: devel@edk2.groups.io
> Cc: Gao, Liming ; Chen, Christine
> 
> Subject: [Patch] BaseTools: Remove the redundant __FLEXIBLE_SIZE from
> PcdValueInit.c
> 
> For the multiple SKU cases, basetools generates multiple redundant
> __FLEXIBLE_SIZE statement that is from the same line in dsc file.
> 
> This behavior causes the generated PcdValueInit.c file to have huge size, and
> the compilation time is very long.
> 
> This patch is going to fix this issue.
> 
> Signed-off-by: Bob Feng Cc: Liming Gao
> Cc: Yuwei Chen 
> ---
>  BaseTools/Source/Python/Workspace/DscBuildData.py | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py
> b/BaseTools/Source/Python/Workspace/DscBuildData.py
> index d29b9bf13d..fc1e773417 100644
> --- a/BaseTools/Source/Python/Workspace/DscBuildData.py
> +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
> @@ -1874,10 +1874,11 @@ class DscBuildData(PlatformBuildClassObject):
>  FieldName = FieldName.split(']', 1)[1]   
>   FieldName =
> NewFieldName + FieldName while '[' in FieldName and not
> Pcd.IsArray(): FieldName = FieldName.rsplit('[', 1)[0]
> CApp = CApp + '  __FLEXIBLE_SIZE(*Size, %s, %s, %d); // From %s Line %d
> Value %s\n' % (Pcd.DatumType, FieldName.strip("."), Array_Index + 1,
> FieldList[FieldName_ori][1], FieldList[FieldName_ori][2],
> FieldList[FieldName_ori][0])+flexisbale_size_statement_cache = set()
> for skuname in Pcd.SkuOverrideValues: if skuname == TAB_COMMON:
> continue for defaultstorenameitem in
> Pcd.SkuOverrideValues[skuname]: CApp = CApp + "// SkuName: %s,
> DefaultStoreName: %s \n" % (skuname, defaultstorenameitem)@@ -1886,10
> +1887,14 @@ class DscBuildData(PlatformBuildClassObject):
>  ActualCap.append(index) for 
> FieldList in
> [Pcd.SkuOverrideValues[skuname][defaultstorenameitem][index]]:
> if not FieldList: continue
>  for FieldName in
> FieldList:+fieldinfo = 
> tuple(FieldList[FieldName])+
> if fieldinfo in flexisbale_size_statement_cache:+ 
>continue+
> flexisbale_size_statement_cache.add(fieldinfo) 
> FieldName =
> "." + FieldName IsArray =
> _IsFieldValueAnArray(FieldList[FieldName.strip(".")][0])  
>if
> IsArray and not (FieldList[FieldName.strip(".")][0].startswith('{GUID') and
> FieldList[FieldName.strip(".")][0].endswith('}')):
>  try:
> Value = ValueExpressionEx(FieldList[FieldName.strip(".")][0], TAB_VOID,
> self._GuidDict)(True)--
> 2.29.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87774): https://edk2.groups.io/g/devel/message/87774
Mute This Topic: https://groups.io/mt/89796157/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] BaseTools: Catch the exception in build.py.

2022-03-01 Thread Yuwei Chen
From: MingYue Liang 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2988

In FDF file, if INF key word is wrongly written as INT,
build tool will report the execption. Build tool should
report the error message.

build.py In order to capture and handle the exception
of fdfparser, the user-defined exception class should
be imported.

Signed-off-by: Mingyue Liang 
Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yuwei Chen 
---
 BaseTools/Source/Python/build/build.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/BaseTools/Source/Python/build/build.py 
b/BaseTools/Source/Python/build/build.py
index 07187c0361..0c6f801b33 100755
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -63,6 +63,8 @@ from GenFds.FdfParser import FdfParser
 from AutoGen.IncludesAutoGen import IncludesAutoGen
 from GenFds.GenFds import resetFdsGlobalVariable
 from AutoGen.AutoGen import CalculatePriorityValue
+from GenFds.FdfParser import Warning
+
 
 ## standard targets of build command
 gSupportedTarget = ['all', 'genc', 'genmake', 'modules', 'libraries', 'fds', 
'clean', 'cleanall', 'cleanlib', 'run']
-- 
2.26.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87135): https://edk2.groups.io/g/devel/message/87135
Mute This Topic: https://groups.io/mt/89471884/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] BaseTools: Add BaseTools/Scripts to path.

2022-02-27 Thread Yuwei Chen
From: MingYue Liang 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2859

I'd like to add a git command extension to add a platform
scoped git grep. It turns out if you have git-
in your path git will find you extension.

This patch adds basetools/scripts to the path in
both windows and Linux systems.

Signed-off-by: Mingyue Liang 
Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yuwei Chen 
---
 BaseTools/BuildEnv  | 24 +---
 BaseTools/toolsetup.bat |  6 ++
 2 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/BaseTools/BuildEnv b/BaseTools/BuildEnv
index 275f4c5901..cdee304aee 100755
--- a/BaseTools/BuildEnv
+++ b/BaseTools/BuildEnv
@@ -187,7 +187,6 @@ AddDirToStartOfPath() {
 }
 
 AddEdkToolsToPath() {
-
   #
   # If EDK_TOOLS_PATH is not set, then we cannot update PATH
   #
@@ -208,9 +207,21 @@ AddEdkToolsToPath() {
 AddDirToStartOfPath $EDK_TOOLS_PATH/BinWrappers/PosixLike
   fi
 
-
   AddDirToStartOfPath $EDK_TOOLS_PATH_BIN
+}
 
+AddEdkToolsScriptsToPath() {
+  #
+  # If EDK_TOOLS_PATH is not set, then we cannot update PATH
+  #
+  if [ -z "$EDK_TOOLS_PATH" ]
+  then
+return 1
+  fi
+
+  echo Add edk2/Basetools/Scripts to path
+  EDK_TOOLS_SCRIPTS_PATH=$EDK_TOOLS_PATH/Scripts
+  AddDirToStartOfPath $EDK_TOOLS_SCRIPTS_PATH
 }
 
 CopySingleTemplateFile() {
@@ -227,7 +238,6 @@ CopySingleTemplateFile() {
   echo " to $DST_FILENAME"
   SRC_FILENAME=$EDK_TOOLS_PATH/$SRC_FILENAME
   cp $SRC_FILENAME $DST_FILENAME
-
 }
 
 CopyTemplateFiles() {
@@ -262,11 +272,19 @@ ScriptMain() {
 return 1
   fi
 
+  AddEdkToolsScriptsToPath
+  if [ $? -ne 0 ]
+  then
+echo "Failure adding EDK Tools Scripts into PATH!"
+return 1
+  fi
+
   StoreCurrentConfiguration
 
   echo WORKSPACE: $WORKSPACE
   echo EDK_TOOLS_PATH: $EDK_TOOLS_PATH
   echo CONF_PATH: $CONF_PATH
+  echo EDK_TOOLS_SCRIPTS_PATH: $EDK_TOOLS_SCRIPTS_PATH
 
   CopyTemplateFiles
 
diff --git a/BaseTools/toolsetup.bat b/BaseTools/toolsetup.bat
index 58fd26a4b5..e079a3bb68 100755
--- a/BaseTools/toolsetup.bat
+++ b/BaseTools/toolsetup.bat
@@ -145,9 +145,15 @@ if /I "%1"=="/?" goto Usage
   )
   set PATH=%EDK_TOOLS_BIN%;%PATH%
   set WORKSPACE_TOOLS_PATH=%EDK_TOOLS_PATH%
+  echo Add basetools/scripts to path...
+  set PATH=%BASE_TOOLS_PATH%\Scripts;%PATH%
+  echo Successfully added basetools/scripts to path
   goto PATH_ok
 
 :check_PATH
+  echo Add basetools/scripts to path...
+  set PATH=%BASE_TOOLS_PATH%\Scripts;%PATH%
+  echo Successfully added basetools/scripts to path.
   if "%EDK_TOOLS_PATH%"=="%WORKSPACE_TOOLS_PATH%" goto PATH_ok
   if not defined EDK_TOOLS_BIN (
 set EDK_TOOLS_BIN=%EDK_TOOLS_PATH%\Bin\Win32
-- 
2.26.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87045): https://edk2.groups.io/g/devel/message/87045
Mute This Topic: https://groups.io/mt/89445556/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v2 6/6] BaseTools: Upgrade the version of NASM tool

2022-01-16 Thread Yuwei Chen
This patch looks good to me.

Reviewed-by: Yuwei Chen

> -Original Message-
> From: Lou, Yun 
> Sent: Monday, January 10, 2022 11:13 PM
> To: devel@edk2.groups.io
> Cc: Lou, Yun ; Feng, Bob C ;
> Gao, Liming ; Chen, Christine
> 
> Subject: [PATCH v2 6/6] BaseTools: Upgrade the version of NASM tool
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3790
> 
> Upgrade the version of NASM tool to avoid compilation errors when
> compiling NASM code change.
> 
> Signed-off-by: Jason Lou 
> Cc: Bob Feng 
> Cc: Liming Gao 
> Cc: Yuwei Chen 
> ---
>  BaseTools/Conf/tools_def.template | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/BaseTools/Conf/tools_def.template
> b/BaseTools/Conf/tools_def.template
> index 2e6b382ab6..0133860fc3 100755
> --- a/BaseTools/Conf/tools_def.template
> +++ b/BaseTools/Conf/tools_def.template
> @@ -1,5 +1,5 @@
>  #-#  Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.+#
> Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved. #
> Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved. #
> Portions copyright (c) 2011 - 2019, ARM Ltd. All rights reserved. #
> Copyright (c) 2015, Hewlett-Packard Development Company, L.P.@@ -
> 368,8 +368,8 @@ DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc
>  # Other Supported Tools # = #   NASM --
> http://www.nasm.us/-#   - NASM 2.10 or later for use with the GCC toolchain
> family-#   - NASM 2.12.01 or later for use with all other toolchain families+#
> - NASM 2.15.05 or later for use with the GCC toolchain family+#   - NASM
> 2.15.05 or later for use with all other toolchain families #
> 
> 
> 
> --
> 2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#85721): https://edk2.groups.io/g/devel/message/85721
Mute This Topic: https://groups.io/mt/88325173/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [Patch] BaseTools: Fix the bug of --cmd-len build option

2021-12-27 Thread Yuwei Chen
This patch looks good to me.

Reviewed-by: Yuwei Chen

> -Original Message-
> From: Feng, Bob C 
> Sent: Friday, December 24, 2021 10:50 PM
> To: devel@edk2.groups.io
> Cc: Feng, Bob C ; Gao, Liming
> ; Chen, Christine 
> Subject: [Patch] BaseTools: Fix the bug of --cmd-len build option
> 
> currently the --cmd-len build option does not work.
> This patch is going to fix this bug.
> 
> Signed-off-by: Bob Feng 
> Cc: Liming Gao 
> Cc: Yuwei Chen 
> ---
>  BaseTools/Source/Python/AutoGen/AutoGenWorker.py | 1 +
>  BaseTools/Source/Python/AutoGen/DataPipe.py  | 2 ++
>  2 files changed, 3 insertions(+)
> 
> diff --git a/BaseTools/Source/Python/AutoGen/AutoGenWorker.py
> b/BaseTools/Source/Python/AutoGen/AutoGenWorker.py
> index 0425f1ab0b..eea15239d4 100755
> --- a/BaseTools/Source/Python/AutoGen/AutoGenWorker.py
> +++ b/BaseTools/Source/Python/AutoGen/AutoGenWorker.py
> @@ -196,10 +196,11 @@ class AutoGenWorkerInProcess(mp.Process):
>  workspacedir,active_p,target,toolchain,archlist
>  )
>  self.Wa._SrcTimeStamp =
> self.data_pipe.Get("Workspace_timestamp")
>  GlobalData.gGlobalDefines = self.data_pipe.Get("G_defines")
>  GlobalData.gCommandLineDefines = self.data_pipe.Get("CL_defines")
> +GlobalData.gCommandMaxLength =
> self.data_pipe.Get('gCommandMaxLength')
>  os.environ._data = self.data_pipe.Get("Env_Var")
>  GlobalData.gWorkspace = workspacedir
>  GlobalData.gDisableIncludePathCheck = False
>  GlobalData.gFdfParser = self.data_pipe.Get("FdfParser")
>  GlobalData.gDatabasePath = self.data_pipe.Get("DatabasePath")
> diff --git a/BaseTools/Source/Python/AutoGen/DataPipe.py
> b/BaseTools/Source/Python/AutoGen/DataPipe.py
> index 86ac2b928d..41af343f62 100755
> --- a/BaseTools/Source/Python/AutoGen/DataPipe.py
> +++ b/BaseTools/Source/Python/AutoGen/DataPipe.py
> @@ -146,10 +146,12 @@ class MemoryDataPipe(DataPipe):
> 
>  self.DataContainer = {"G_defines": GlobalData.gGlobalDefines}
> 
>  self.DataContainer = {"CL_defines": GlobalData.gCommandLineDefines}
> 
> +self.DataContainer = {"gCommandMaxLength":
> GlobalData.gCommandMaxLength}
> +
>  self.DataContainer = {"Env_Var": {k:v for k, v in 
> os.environ.items()}}
> 
>  self.DataContainer = {"PackageList": [(dec.MetaFile,dec.Arch) for 
> dec in
> PlatformInfo.PackageList]}
> 
>  self.DataContainer = {"GuidDict": PlatformInfo.Platform._GuidDict}
> --
> 2.18.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#85217): https://edk2.groups.io/g/devel/message/85217
Mute This Topic: https://groups.io/mt/87937715/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 1/1] BaseTools: Fix StructurePcd offset error.

2021-10-28 Thread Yuwei Chen
Hi Liming,

As the comments have been added to each StructurePcd 
(https://edk2.groups.io/g/devel/message/68378?p=%2C%2C%2C20%2C0%2C0%2C0%3A%3Arecentpostdate%2Fsticky%2C%2CStructurePcd%2C20%2C2%2C20%2C78773894),
 the tmp[1] will have not only the "{0x0,0x0}" value but also the "# comments". 
If not split with "#", it will generate error format for value "{0x0, 0x0}" 
StructurePcd.

Thanks,
Christine (Yuwei)

> -Original Message-
> From: gaoliming 
> Sent: Friday, October 29, 2021 10:02 AM
> To: Chen, Christine ; devel@edk2.groups.io
> Cc: Feng, Bob C 
> Subject: 回复: [PATCH 1/1] BaseTools: Fix StructurePcd offset error.
> 
> Yuwei:
> 
> > -邮件原件-
> > 发件人: Yuwei Chen 
> > 发送时间: 2021年10月27日 18:00
> > 收件人: devel@edk2.groups.io
> > 抄送: Bob Feng ; Liming Gao
> > 
> > 主题: [PATCH 1/1] BaseTools: Fix StructurePcd offset error.
> >
> > Currently when parse VFR files to get the struct info, BOOLEAN type
> > struct is ignored, which caused offset errors.
> > This patch fixed these bugs.
> >
> > Cc: Bob Feng 
> > Cc: Liming Gao 
> > Signed-off-by: Yuwei Chen 
> > ---
> >  BaseTools/Scripts/ConvertFceToStructurePcd.py | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/BaseTools/Scripts/ConvertFceToStructurePcd.py
> > b/BaseTools/Scripts/ConvertFceToStructurePcd.py
> > index 2baabf2dd521..9e7fe58768b1 100644
> > --- a/BaseTools/Scripts/ConvertFceToStructurePcd.py
> > +++ b/BaseTools/Scripts/ConvertFceToStructurePcd.py
> > @@ -142,7 +142,7 @@ class parser_lst(object):
> >line.append(struct)
> >unparse.append(line)
> >else:
> > -if uint not in ['UINT8', 'UINT16', 'UINT32',
> > 'UINT64']:
> > +if uint not in ['UINT8', 'UINT16', 'UINT32',
> 'UINT64',
> > 'BOOLEAN']:
> >line = [offset, t_name, 0, uint]
> >line.append(struct)
> >unparse.append(line) @@ -569,7 +569,7 @@ class
> > mainprocess(object):
> >  for i in List:
> >for j in i:
> >  tmp = j.split("|")
> > -if (('L"' in j) and ("[" in j)) or (tmp[1].strip() == '{0x0,
> 0x0}'):
> > +if (('L"' in j) and ("[" in j)) or
> > + (tmp[1].split("#")[0].strip()
> == '{0x0,
> > 0x0}'):
> 
> Why split '#'?
> 
> Thanks
> Liming
> >tmp[0] = tmp[0][:tmp[0].index('[')]
> >List[List.index(i)][i.index(j)] = "|".join(tmp)
> >  else:
> > --
> > 2.27.0.windows.1
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#82912): https://edk2.groups.io/g/devel/message/82912
Mute This Topic: https://groups.io/mt/86670745/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] RFC: Replace FMMT Tool from C to Python Version

2021-10-28 Thread Yuwei Chen
Hi everyone,

I would like to propose the new FMMT Python tool, which is used to replace the 
origin C version tool.
Currently the FMMT C tool is saved in edk2-staging repo, but its quality and 
coding style can't meet the Edk2 quality, which is hard to maintain 
(Hard/Duplicate Code; Regression bugs; Restrict usage).
The new Python version keeps same functions with origin C version. It has 
higher quality and better coding style, and it is much easier to extend new 
functions and to maintain.

You can get the FMMT Python tool through below link.

https://github.com/tianocore/edk2-staging/tree/PyFMMT

If you are interested in that, pls have a try.
Looking forward to your feedback~

Thanks,
Christine (Yuwei)


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#82877): https://edk2.groups.io/g/devel/message/82877
Mute This Topic: https://groups.io/mt/8556/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 1/1] BaseTools: Fix StructurePcd offset error.

2021-10-27 Thread Yuwei Chen
Currently when parse VFR files to get the struct info,
BOOLEAN type struct is ignored, which caused offset errors.
This patch fixed these bugs.

Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Yuwei Chen 
---
 BaseTools/Scripts/ConvertFceToStructurePcd.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Scripts/ConvertFceToStructurePcd.py 
b/BaseTools/Scripts/ConvertFceToStructurePcd.py
index 2baabf2dd521..9e7fe58768b1 100644
--- a/BaseTools/Scripts/ConvertFceToStructurePcd.py
+++ b/BaseTools/Scripts/ConvertFceToStructurePcd.py
@@ -142,7 +142,7 @@ class parser_lst(object):
   line.append(struct)
   unparse.append(line)
   else:
-if uint not in ['UINT8', 'UINT16', 'UINT32', 'UINT64']:
+if uint not in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 
'BOOLEAN']:
   line = [offset, t_name, 0, uint]
   line.append(struct)
   unparse.append(line)
@@ -569,7 +569,7 @@ class mainprocess(object):
 for i in List:
   for j in i:
 tmp = j.split("|")
-if (('L"' in j) and ("[" in j)) or (tmp[1].strip() == '{0x0, 0x0}'):
+if (('L"' in j) and ("[" in j)) or (tmp[1].split("#")[0].strip() == 
'{0x0, 0x0}'):
   tmp[0] = tmp[0][:tmp[0].index('[')]
   List[List.index(i)][i.index(j)] = "|".join(tmp)
 else:
-- 
2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#82741): https://edk2.groups.io/g/devel/message/82741
Mute This Topic: https://groups.io/mt/86623926/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




  1   2   >