Re: [edk2] [RFC] Edk2 BaseTools Python3 Migration Update

2018-12-28 Thread Gao, Liming
Lin:
   Thanks for your verification.  This issue has been fixed in the latest 
version of https://github.com/lgao4/edk2/tree/Python3. Could you try again?

Thanks
Liming
>-Original Message-
>From: Gary Lin [mailto:g...@suse.com]
>Sent: Friday, December 28, 2018 6:40 PM
>To: Gao, Liming 
>Cc: edk2-devel@lists.01.org; Kinney, Michael D
>; Laszlo Ersek (ler...@redhat.com)
>
>Subject: Re: [edk2] [RFC] Edk2 BaseTools Python3 Migration Update
>
>On Tue, Dec 25, 2018 at 07:50:43AM +, Gao, Liming wrote:
>> Hi, all
>>   On Python3 migration https://bugzilla.tianocore.org/show_bug.cgi?id=55,
>we update Edk2 BaseTools python source code with the compatible syntax to
>support Python2 and Python3 both. Here is code
>https://github.com/lgao4/edk2/tree/Python3 for dry run. To enable Python3,
>you just need to set PYTHON3_ENABLE environment as TRUE, then type
>edksetup.bat/edksetup.sh. Without this setting, BaseTools still run with
>Python2. So, there is no change for current usage model with Python27.
>>
>I've built OVMF with both python2 and python3 based on the branch and
>the VM crashed immediately. The only message in the debug log is:
>
>SecCoreStartupWithStack(0xFFFCC000, 0x82)
>
>The result of bisect showed the first bad commit is
>
> 500aad1a02c5a8c0f208c9422cce19de7d304faa
> BaseTools: Update windows and linux run scripts file to use Python3
>
>Cheers,
>
>Gary Lin
>
>>   But, we have no enough resource to fully verify Python2 and Python3 both.
>We will focus on Python3 validation. If anyone can help verify Python2, it will
>be great. And, if you meet with the issue on Python2, please file BZ. We still
>fix them.
>>
>> Thanks
>> Liming
>>
>> ___
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel
>>
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [patch] MdeModulePkg/NonDiscoverable: Use compare operator for comparison

2018-12-28 Thread Wang, Jian J


Reviewed-by: Jian J Wang 

> -Original Message-
> From: Bi, Dandan
> Sent: Friday, December 28, 2018 4:54 PM
> To: edk2-devel@lists.01.org
> Cc: Wang, Jian J ; Wu, Hao A 
> Subject: [patch] MdeModulePkg/NonDiscoverable: Use compare operator for
> comparison
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1422
> 
> According to EDK II C Coding Standards Specification,
> Non-Boolean comparisons must use a compare operator.
> This patch is to update the code to follow EDKII coding style.
> 
> Cc: Jian J Wang 
> Cc: Hao Wu 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Dandan Bi 
> ---
>  .../NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c| 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git
> a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciD
> eviceIo.c
> b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciD
> eviceIo.c
> index f0d3472ea5..a0fe3b9ffa 100644
> ---
> a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciD
> eviceIo.c
> +++
> b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciD
> eviceIo.c
> @@ -1274,11 +1274,11 @@ PciIoAttributes (
>#define DEV_SUPPORTED_ATTRIBUTES \
>  (EFI_PCI_DEVICE_ENABLE | EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE)
> 
>Dev = NON_DISCOVERABLE_PCI_DEVICE_FROM_PCI_IO(This);
> 
> -  if (Attributes) {
> +  if (Attributes != 0) {
>if ((Attributes & (~(DEV_SUPPORTED_ATTRIBUTES))) != 0) {
>  return EFI_UNSUPPORTED;
>}
>  }
> 
> --
> 2.18.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [RFC] Edk2 BaseTools Python3 Migration Update

2018-12-28 Thread Gary Lin
On Tue, Dec 25, 2018 at 07:50:43AM +, Gao, Liming wrote:
> Hi, all
>   On Python3 migration https://bugzilla.tianocore.org/show_bug.cgi?id=55, we 
> update Edk2 BaseTools python source code with the compatible syntax to 
> support Python2 and Python3 both. Here is code 
> https://github.com/lgao4/edk2/tree/Python3 for dry run. To enable Python3, 
> you just need to set PYTHON3_ENABLE environment as TRUE, then type 
> edksetup.bat/edksetup.sh. Without this setting, BaseTools still run with 
> Python2. So, there is no change for current usage model with Python27.
> 
I've built OVMF with both python2 and python3 based on the branch and
the VM crashed immediately. The only message in the debug log is:

SecCoreStartupWithStack(0xFFFCC000, 0x82)

The result of bisect showed the first bad commit is

 500aad1a02c5a8c0f208c9422cce19de7d304faa
 BaseTools: Update windows and linux run scripts file to use Python3

Cheers,

Gary Lin

>   But, we have no enough resource to fully verify Python2 and Python3 both. 
> We will focus on Python3 validation. If anyone can help verify Python2, it 
> will be great. And, if you meet with the issue on Python2, please file BZ. We 
> still fix them.
> 
> Thanks
> Liming
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] edk2-devel@lists.01.org

2018-12-28 Thread wang xiaofeng
Just add more information, If I comment the OBJCOPY in   of 
Static-Library-File in build_rule , the error will disapper, but I am not sure 
whether any side effort to remove objcopy?


[Static-Library-File]

*.lib



$(MAKE_FILE)



$(DEBUG_DIR)(+)$(MODULE_NAME).dll



"$(DLINK)" /OUT:${dst} $(DLINK_FLAGS) $(DLINK2_FLAGS) $(DLINK_SPATH) 
@$(STATIC_LIBRARY_FILES_LIST)
"$(DLINK)" /OUT:${dst} $(DLINK_FLAGS) $(DLINK_SPATH) 
@$(STATIC_LIBRARY_FILES_LIST)



"$(DLINK)" -o ${dst} $(DLINK_FLAGS) 
-Wl,--start-group,@$(STATIC_LIBRARY_FILES_LIST),--end-group $(CC_FLAGS) 
$(DLINK2_FLAGS)
   # "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}






At 2018-12-28 17:26:16, "wang xiaofeng"  wrote:


HI Edk2 Basetool owners,

I meet an build error when updating our efi driver tree to UDK2018.  The issue 
exists only for AARCH64 build , X64 build is ok.

I do a simple test to build MdeModulePkg package in Window10  with 
gcc-linaro-7.3.1-2018.05-win32

 

The following is my simply script:

set GCC5_AARCH64_PREFIX=C:\soft\gcc-linaro-7.3.1\bin\aarch64-linux-gnu-

set WORKSPACE=C:\code\udk201811

set PATH=C:\p4\stg\uefi\gnutools\GNUMake-3.81_win32;%PATH%

call edksetup.bat

build -a AARCH64 -p MdeModulePkg\MdeModulePkg.dsc -t GCC5 -b DEBUG

 

 

   The tool will have error when tring to link dll, it says "echo" objcopy not 
needed *.dll

'"echo"' is not recognized as an internal or external command,

   Do anyone meet this issue before? Any advice to solve this issue?

  A strange thing is if I rerun the build script again , the first dll will 
pass , and the second dll will meet same error .

 

 

"C:\soft\gcc-linaro-7.3.1\bin\aarch64-linux-gnu-gcc" -o 
c:\code\udk201811\Build\MdeModule\DEBUG_GCC5\AARCH64\MdeModulePkg\Universal\Network\UefiPxeBcDxe\UefiPxeBcDxe\DEBUG\UefiPxe4BcDxe.dll
 -Wl,--emit-relocs -nostdlib -Wl,--gc-sections -u _ModuleEntryPoint 
-Wl,-e,_ModuleEntryPoint,-Map,c:\code\udk201811\Build\MdeModule\DEBUG_GCC5\AARCH64\MdeModulePkg\Universal\Network\UefiPxeBcDxe\UefiPxeBcDxe\DEBUG/UefiPxe4BcDxe.map
 -z common-page-size=0x20 -z common-page-size=0x1000 -flto -Os 
-Lc:\code\udk201811/ArmPkg/Library/GccLto -llto-aarch64 
-Wl,-plugin-opt=-pass-through=-llto-aarch64 -Wno-lto-type-mismatch 
-mcmodel=small 
-Wl,--start-group,@c:\code\udk201811\Build\MdeModule\DEBUG_GCC5\AARCH64\MdeModulePkg\Universal\Network\UefiPxeBcDxe\UefiPxeBcDxe\OUTPUT\static_library_files.lst,--end-group
   -g -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror 
-Wno-array-bounds -ffunction-sections -fdata-sections -include AutoGen.h 
-fno-common -DSTRING_ARRAY_NAME=UefiPxe4BcDxeStrings -g -Os -fsh
 ort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-missing-braces 
-Wno-array-bounds -include AutoGen.h -fno-common -mlittle-endian 
-fno-short-enums -fverbose-asm -funsigned-char -ffunction-sections 
-fdata-sections -Wno-address -fno-asynchronous-unwind-tables -fno-pic -fno-pie 
-ffixed-x18 -flto -Wno-unused-but-set-variable -Wno-unused-const-variable 
-mcmodel=small -D DISABLE_NEW_DEPRECATED_INTERFACES 
-Wl,--script=c:\code\udk201811\basetools/Scripts/GccBase.lds 
-Wl,--defsym=PECOFF_HEADER_SIZE=0x228 -Wno-error

"echo" objcopy not needed for 
c:\code\udk201811\Build\MdeModule\DEBUG_GCC5\AARCH64\MdeModulePkg\Application\HelloWorld\HelloWorld\DEBUG\HelloWorld.dll

'"echo"' is not recognized as an internal or external command,

operable program or batch file.

make: *** 
[c:\code\udk201811\Build\MdeModule\DEBUG_GCC5\AARCH64\MdeModulePkg\Application\HelloWorld\HelloWorld\DEBUG\HelloWorld.dll]
 Error 1





 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [patch] MdeModulePkg/NonDiscoverable: Use compare operator for comparison

2018-12-28 Thread Dandan Bi
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1422

According to EDK II C Coding Standards Specification,
Non-Boolean comparisons must use a compare operator.
This patch is to update the code to follow EDKII coding style.

Cc: Jian J Wang 
Cc: Hao Wu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi 
---
 .../NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c| 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c 
b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c
index f0d3472ea5..a0fe3b9ffa 100644
--- 
a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c
+++ 
b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c
@@ -1274,11 +1274,11 @@ PciIoAttributes (
   #define DEV_SUPPORTED_ATTRIBUTES \
 (EFI_PCI_DEVICE_ENABLE | EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE)
 
   Dev = NON_DISCOVERABLE_PCI_DEVICE_FROM_PCI_IO(This);
 
-  if (Attributes) {
+  if (Attributes != 0) {
   if ((Attributes & (~(DEV_SUPPORTED_ATTRIBUTES))) != 0) {
 return EFI_UNSUPPORTED;
   }
 }
 
-- 
2.18.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [patch] BaseTools/VfrCompile: report error for Integer overflow

2018-12-28 Thread Dandan Bi
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1415

When an integer constant specified in the .vfr file is
too large for the varstore field it is being used with,
the VFR compiler reports an overflow warning like this:
Test.vfr(693): WARNING: Overflow: Value 1024 is too large to
 store in a UINT8
: String to UINT* Overflow
Since Warning does not break the build process,
and it is easy to miss it.
This patch is to update the code to report error and break
the build if meet this kind of issue.

Cc: Bob Feng 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi 
---
 BaseTools/Source/C/VfrCompile/VfrError.cpp |  2 +-
 BaseTools/Source/C/VfrCompile/VfrError.h   |  2 +-
 BaseTools/Source/C/VfrCompile/VfrSyntax.g  | 10 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/BaseTools/Source/C/VfrCompile/VfrError.cpp 
b/BaseTools/Source/C/VfrCompile/VfrError.cpp
index bbf738c217..c105d73bea 100644
--- a/BaseTools/Source/C/VfrCompile/VfrError.cpp
+++ b/BaseTools/Source/C/VfrCompile/VfrError.cpp
@@ -45,16 +45,16 @@ static SVFR_ERROR_HANDLE VFR_ERROR_HANDLE_TABLE [] = {
   { VFR_RETURN_DATA_STRING_ERROR, ": data field string error or not support"},
   { VFR_RETURN_DEFAULT_VALUE_REDEFINED, ": default value re-defined with 
different value"},
   { VFR_RETURN_CONSTANT_ONLY, ": only constant is allowed in the expression"},
   { VFR_RETURN_VARSTORE_NAME_REDEFINED_ERROR, ": Varstore name is defined by 
more than one varstores, it can't be referred as varstore, only varstore 
strucure name could be used."},
   { VFR_RETURN_BIT_WIDTH_ERROR, ": bit width must be <= sizeof (type) * 8 and 
the max width can not > 32" },
+  { VFR_RETURN_STRING_TO_UINT_OVERFLOW, ": String to UINT* Overflow"},
   { VFR_RETURN_CODEUNDEFINED, ": undefined Error Code" }
 };
 
 static SVFR_WARNING_HANDLE VFR_WARNING_HANDLE_TABLE [] = {
   { VFR_WARNING_DEFAULT_VALUE_REDEFINED, ": default value re-defined with 
different value"},
-  { VFR_WARNING_STRING_TO_UINT_OVERFLOW, ": String to UINT* Overflow"},
   { VFR_WARNING_ACTION_WITH_TEXT_TWO, ": Action opcode should not have TextTwo 
part"},
   { VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE, ": Not recommend to use obsoleted 
framework opcode"},
   { VFR_WARNING_CODEUNDEFINED, ": undefined Warning Code" }
 };
 
diff --git a/BaseTools/Source/C/VfrCompile/VfrError.h 
b/BaseTools/Source/C/VfrCompile/VfrError.h
index e83ae900fa..e795f1631d 100644
--- a/BaseTools/Source/C/VfrCompile/VfrError.h
+++ b/BaseTools/Source/C/VfrCompile/VfrError.h
@@ -43,16 +43,16 @@ typedef enum {
   VFR_RETURN_DATA_STRING_ERROR,
   VFR_RETURN_DEFAULT_VALUE_REDEFINED,
   VFR_RETURN_CONSTANT_ONLY,
   VFR_RETURN_VARSTORE_NAME_REDEFINED_ERROR,
   VFR_RETURN_BIT_WIDTH_ERROR,
+  VFR_RETURN_STRING_TO_UINT_OVERFLOW,
   VFR_RETURN_CODEUNDEFINED
 } EFI_VFR_RETURN_CODE;
 
 typedef enum {
   VFR_WARNING_DEFAULT_VALUE_REDEFINED = 0,
-  VFR_WARNING_STRING_TO_UINT_OVERFLOW,
   VFR_WARNING_ACTION_WITH_TEXT_TWO,
   VFR_WARNING_OBSOLETED_FRAMEWORK_OPCODE,
   VFR_WARNING_CODEUNDEFINED
 } EFI_VFR_WARNING_CODE;
 
diff --git a/BaseTools/Source/C/VfrCompile/VfrSyntax.g 
b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
index 84dd2c3ed3..7d8088a889 100644
--- a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
+++ b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
@@ -1,9 +1,9 @@
 /*++ @file
 Vfr Syntax
 
-Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
 http://opensource.org/licenses/bsd-license.php
 
@@ -5320,11 +5320,11 @@ EfiVfrParser::_STOU8 (
 if (c >= '0' && c <= '9') {
   Value += (c - '0');
 }
 if((IsHex && ((Value/16) != PreviousValue)) || (!IsHex && ((Value/10) != 
PreviousValue))) {
   sprintf(ErrorMsg, "Overflow: Value %s is too large to store in a UINT8", 
OrigString);
-  gCVfrErrorHandle.HandleWarning (VFR_WARNING_STRING_TO_UINT_OVERFLOW, 
LineNum, ErrorMsg);
+  mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError 
(VFR_RETURN_STRING_TO_UINT_OVERFLOW, LineNum, ErrorMsg);
 }
   }
 
   return Value;
 }
@@ -5357,11 +5357,11 @@ EfiVfrParser::_STOU16 (
 if (c >= '0' && c <= '9') {
   Value += (c - '0');
 }
 if((IsHex && ((Value/16) != PreviousValue)) || (!IsHex && ((Value/10) != 
PreviousValue))) {
   sprintf(ErrorMsg, "Overflow: Value %s is too large to store in a 
UINT16", OrigString);
-  gCVfrErrorHandle.HandleWarning (VFR_WARNING_STRING_TO_UINT_OVERFLOW, 
LineNum, ErrorMsg);
+  mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError 
(VFR_RETURN_STRING_TO_UINT_OVERFLOW, LineNum, ErrorMsg);
 }
   }
 
   return Value;
 }
@@ -5394,11 +5394,11 @@ EfiVfrParser::_STOU32 (
 if (c >= '0' && c <= '9') {
   Value += (c