Platform/Intel/build.cfg | 5 +++-- Platform/Intel/build_bios.py | 11 +++++++---- 2 files changed, 10 insertions(+), 6 deletions(-)
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Eric Dong <eric.dong@intel.com>
Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
---
Platform/Intel/build.cfg | 5 +++--
Platform/Intel/build_bios.py | 11 +++++++----
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/Platform/Intel/build.cfg b/Platform/Intel/build.cfg
index 2ff536bb3e..6ab2ced1a5 100644
--- a/Platform/Intel/build.cfg
+++ b/Platform/Intel/build.cfg
@@ -1,7 +1,7 @@
# @ build.cfg
# This is the main/default build configuration file
#
-# Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2019 - 2023, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2021 - 2022, American Megatrends International LLC.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@@ -13,7 +13,8 @@ WORKSPACE_FSP_BIN = FSP
EDK_TOOLS_BIN = edk2-BaseTools-win32
EDK_BASETOOLS = BaseTools
WORKSPACE_DRIVERS = edk2-platforms/Drivers
-WORKSPACE_FEATURES = edk2-platforms/Features/Intel
+WORKSPACE_FEATURES = edk2-platforms/Features
+WORKSPACE_FEATURES_INTEL = edk2-platforms/Features/Intel
WORKSPACE_PLATFORM = edk2-platforms/Platform/Intel
WORKSPACE_SILICON = edk2-platforms/Silicon/Intel
WORKSPACE_PLATFORM_BIN =
diff --git a/Platform/Intel/build_bios.py b/Platform/Intel/build_bios.py
index 43a241c837..c79a653f4d 100755
--- a/Platform/Intel/build_bios.py
+++ b/Platform/Intel/build_bios.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python3
#
# @ build_bios.py
# Builds BIOS using configuration files and dynamically
@@ -109,6 +109,8 @@ def pre_build(build_config, build_type="DEBUG", silent=False, toolchain=None):
config["WORKSPACE_SILICON"])
config["WORKSPACE_FEATURES"] = os.path.join(config["WORKSPACE"],
config["WORKSPACE_FEATURES"])
+ config["WORKSPACE_FEATURES_INTEL"] = os.path.join(config["WORKSPACE"],
+ config["WORKSPACE_FEATURES_INTEL"])
config["WORKSPACE_DRIVERS"] = os.path.join(config["WORKSPACE"],
config["WORKSPACE_DRIVERS"])
config["WORKSPACE_PLATFORM_BIN"] = \
@@ -123,9 +125,10 @@ def pre_build(build_config, build_type="DEBUG", silent=False, toolchain=None):
config["PACKAGES_PATH"] += os.pathsep + config["WORKSPACE_SILICON"]
config["PACKAGES_PATH"] += os.pathsep + config["WORKSPACE_SILICON_BIN"]
config["PACKAGES_PATH"] += os.pathsep + config["WORKSPACE_FEATURES"]
- # add all feature domains in WORKSPACE_FEATURES to package path
- for filename in os.listdir(config["WORKSPACE_FEATURES"]):
- filepath = os.path.join(config["WORKSPACE_FEATURES"], filename)
+ config["PACKAGES_PATH"] += os.pathsep + config["WORKSPACE_FEATURES_INTEL"]
+ # add all feature domains in WORKSPACE_FEATURES_INTEL to package path
+ for filename in os.listdir(config["WORKSPACE_FEATURES_INTEL"]):
+ filepath = os.path.join(config["WORKSPACE_FEATURES_INTEL"], filename)
# feature domains folder does not contain dec file
if os.path.isdir(filepath) and \
not glob.glob(os.path.join(filepath, "*.dec")):
--
2.39.2.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111771): https://edk2.groups.io/g/devel/message/111771
Mute This Topic: https://groups.io/mt/102842749/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com> Thanks, Chasel > -----Original Message----- > From: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com> > Sent: Monday, November 27, 2023 5:04 PM > To: devel@edk2.groups.io > Cc: Chiu, Chasel <chasel.chiu@intel.com>; Gao, Liming > <gaoliming@byosoft.com.cn>; Dong, Eric <eric.dong@intel.com> > Subject: [edk2-platforms][PATCH v1] MinPlatformPkg: Add edk2- > platforms/Features to PACKAGES_PATH > > Cc: Chasel Chiu <chasel.chiu@intel.com> > Cc: Liming Gao <gaoliming@byosoft.com.cn> > Cc: Eric Dong <eric.dong@intel.com> > Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com> > --- > Platform/Intel/build.cfg | 5 +++-- > Platform/Intel/build_bios.py | 11 +++++++---- > 2 files changed, 10 insertions(+), 6 deletions(-) > > diff --git a/Platform/Intel/build.cfg b/Platform/Intel/build.cfg index > 2ff536bb3e..6ab2ced1a5 100644 > --- a/Platform/Intel/build.cfg > +++ b/Platform/Intel/build.cfg > @@ -1,7 +1,7 @@ > # @ build.cfg > # This is the main/default build configuration file # -# Copyright (c) 2019 - 2021, > Intel Corporation. All rights reserved.<BR> > +# Copyright (c) 2019 - 2023, Intel Corporation. All rights > +reserved.<BR> > # Copyright (c) 2021 - 2022, American Megatrends International LLC.<BR> # > SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -13,7 +13,8 @@ > WORKSPACE_FSP_BIN = FSP EDK_TOOLS_BIN = edk2-BaseTools-win32 > EDK_BASETOOLS = BaseTools WORKSPACE_DRIVERS = edk2-platforms/Drivers - > WORKSPACE_FEATURES = edk2-platforms/Features/Intel > +WORKSPACE_FEATURES = edk2-platforms/Features > WORKSPACE_FEATURES_INTEL = > +edk2-platforms/Features/Intel > WORKSPACE_PLATFORM = edk2-platforms/Platform/Intel WORKSPACE_SILICON > = edk2-platforms/Silicon/Intel WORKSPACE_PLATFORM_BIN = diff --git > a/Platform/Intel/build_bios.py b/Platform/Intel/build_bios.py index > 43a241c837..c79a653f4d 100755 > --- a/Platform/Intel/build_bios.py > +++ b/Platform/Intel/build_bios.py > @@ -1,4 +1,4 @@ > -#!/usr/bin/env python3 > +#!/usr/bin/env python3 > # > # @ build_bios.py > # Builds BIOS using configuration files and dynamically @@ -109,6 +109,8 @@ > def pre_build(build_config, build_type="DEBUG", silent=False, toolchain=None): > config["WORKSPACE_SILICON"]) > config["WORKSPACE_FEATURES"] = os.path.join(config["WORKSPACE"], > config["WORKSPACE_FEATURES"]) > + config["WORKSPACE_FEATURES_INTEL"] = > os.path.join(config["WORKSPACE"], > + > + config["WORKSPACE_FEATURES_INTEL"]) > config["WORKSPACE_DRIVERS"] = os.path.join(config["WORKSPACE"], > config["WORKSPACE_DRIVERS"]) > config["WORKSPACE_PLATFORM_BIN"] = \ @@ -123,9 +125,10 @@ def > pre_build(build_config, build_type="DEBUG", silent=False, toolchain=None): > config["PACKAGES_PATH"] += os.pathsep + config["WORKSPACE_SILICON"] > config["PACKAGES_PATH"] += os.pathsep + > config["WORKSPACE_SILICON_BIN"] > config["PACKAGES_PATH"] += os.pathsep + config["WORKSPACE_FEATURES"] > - # add all feature domains in WORKSPACE_FEATURES to package path > - for filename in os.listdir(config["WORKSPACE_FEATURES"]): > - filepath = os.path.join(config["WORKSPACE_FEATURES"], filename) > + config["PACKAGES_PATH"] += os.pathsep + > config["WORKSPACE_FEATURES_INTEL"] > + # add all feature domains in WORKSPACE_FEATURES_INTEL to package path > + for filename in os.listdir(config["WORKSPACE_FEATURES_INTEL"]): > + filepath = os.path.join(config["WORKSPACE_FEATURES_INTEL"], > + filename) > # feature domains folder does not contain dec file > if os.path.isdir(filepath) and \ > not glob.glob(os.path.join(filepath, "*.dec")): > -- > 2.39.2.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111786): https://edk2.groups.io/g/devel/message/111786 Mute This Topic: https://groups.io/mt/102842749/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
Updates Microcode and Silicon FV sizes so
they can accomodate the newest content.
Cc: Chasel Chiu <chasel.chiu@intel.com>
Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
---
.../BoardMtOlympus/OpenBoardPkg.fdf | 25 +++++++++++--------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.fdf b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.fdf
index 413d98a070..86d1673458 100644
--- a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.fdf
+++ b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.fdf
@@ -1,7 +1,7 @@
## @file
# FDF file for the MtOlympus board.
#
-# Copyright (c) 2018 - 2021, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2018 - 2023, Intel Corporation. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@@ -43,11 +43,11 @@ FV = FvOsBoot
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspUBase|gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspUSize
FV = FvLateSiliconCompressed
-0x00900000|0x00400000
+0x00900000|0x00300000
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootBase|gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootSize
FV = FvUefiBoot
-0x00D00000|0x0007C000
+0x00C00000|0x0007C000
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
#NV_VARIABLE_STORE
DATA = {
@@ -86,10 +86,10 @@ DATA = {
0x5A, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
}
-0x00D7C000|0x00002000
+0x00C7C000|0x00002000
#NV_EVENT_LOG
-0x00D7E000|0x00002000
+0x00C7E000|0x00002000
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
#NV_FTW_WORKING
DATA = {
@@ -103,28 +103,28 @@ DATA = {
0xE0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
}
-0x00D80000|0x00080000
+0x00C80000|0x00080000
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
#NV_FTW_SPARE
-0x00E00000|0x00010000
+0x00D00000|0x00030000
gCpuUncoreTokenSpaceGuid.PcdFlashNvStorageMicrocodeBase|gCpuUncoreTokenSpaceGuid.PcdFlashNvStorageMicrocodeSize
FV = MICROCODE_FV
-0x00E10000|0x00010000
+0x00D30000|0x00010000
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemoryBase|gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemorySize
FV = FvPostMemory
-0x00E20000|0x00030000
+0x00D40000|0x00020000
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSBase|gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSSize
FILE = $(PLATFORM_SI_BIN_PACKAGE)/FV/FvPostMemorySilicon/$(TARGET)/FvPostMemorySilicon.Fv
-0x00E50000|0x00060000
+0x00D60000|0x00050000
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryBase|gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize
FV = FvPreMemory
-0x00EB0000|0x00130000
+0x00DB0000|0x00230000
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMBase|gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMSize
FILE = $(PLATFORM_SI_BIN_PACKAGE)/FV/FvPreMemorySilicon/$(TARGET)/FvPreMemorySilicon.Fv
@@ -135,6 +135,9 @@ FILE = $(PLATFORM_SI_BIN_PACKAGE)/FV/FvTempMemorySilicon/$(TARGET)/FvTempMemoryS
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvMicrocodeBase = gEfiPchTokenSpaceGuid.PcdFlashAreaBaseAddress + gCpuUncoreTokenSpaceGuid.PcdFlashNvStorageMicrocodeBase
SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvMicrocodeSize = gCpuUncoreTokenSpaceGuid.PcdFlashNvStorageMicrocodeSize
+SET gIntelSiliconPkgTokenSpaceGuid.PcdFlashMicrocodeFvBase = gCpuUncoreTokenSpaceGuid.PcdFlashNvStorageMicrocodeBase
+SET gIntelSiliconPkgTokenSpaceGuid.PcdFlashMicrocodeFvSize = gCpuUncoreTokenSpaceGuid.PcdFlashNvStorageMicrocodeSize
+
SET gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchAddress = gEfiPchTokenSpaceGuid.PcdFlashAreaBaseAddress + gCpuUncoreTokenSpaceGuid.PcdFlashNvStorageMicrocodeBase + 0x60
SET gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchRegionSize = gCpuUncoreTokenSpaceGuid.PcdFlashNvStorageMicrocodeSize - 0x60
--
2.39.2.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111772): https://edk2.groups.io/g/devel/message/111772
Mute This Topic: https://groups.io/mt/102842750/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com> Thanks, Chasel > -----Original Message----- > From: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com> > Sent: Monday, November 27, 2023 5:04 PM > To: devel@edk2.groups.io > Cc: Chiu, Chasel <chasel.chiu@intel.com> > Subject: [edk2-platforms][PATCH v1] PurleyOpenBoardPkg/BoardMtOlympus: Fix > Build > > Updates Microcode and Silicon FV sizes so they can accomodate the newest > content. > > Cc: Chasel Chiu <chasel.chiu@intel.com> > Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com> > --- > .../BoardMtOlympus/OpenBoardPkg.fdf | 25 +++++++++++-------- > 1 file changed, 14 insertions(+), 11 deletions(-) > > diff --git > a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.fdf > b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.fdf > index 413d98a070..86d1673458 100644 > --- a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.fdf > +++ b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.fdf > @@ -1,7 +1,7 @@ > ## @file > # FDF file for the MtOlympus board. > # > -# Copyright (c) 2018 - 2021, Intel Corporation. All rights reserved.<BR> > +# Copyright (c) 2018 - 2023, Intel Corporation. All rights > +reserved.<BR> > # > # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -43,11 +43,11 @@ FV = > FvOsBoot > gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspUBase|gMinPlatformPkgTokenSp > aceGuid.PcdFlashFvFspUSize > FV = FvLateSiliconCompressed > > -0x00900000|0x00400000 > +0x00900000|0x00300000 > > gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootBase|gMinPlatformPkgToke > nSpaceGuid.PcdFlashFvUefiBootSize > FV = FvUefiBoot > > -0x00D00000|0x0007C000 > +0x00C00000|0x0007C000 > > gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|gEfiMdeMo > dulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize > #NV_VARIABLE_STORE > DATA = { > @@ -86,10 +86,10 @@ DATA = { > 0x5A, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } > > -0x00D7C000|0x00002000 > +0x00C7C000|0x00002000 > #NV_EVENT_LOG > > -0x00D7E000|0x00002000 > +0x00C7E000|0x00002000 > > gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|gEfiMde > ModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize > #NV_FTW_WORKING > DATA = { > @@ -103,28 +103,28 @@ DATA = { > 0xE0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } > > -0x00D80000|0x00080000 > +0x00C80000|0x00080000 > > gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|gEfiMdeM > odulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize > #NV_FTW_SPARE > > > -0x00E00000|0x00010000 > +0x00D00000|0x00030000 > > gCpuUncoreTokenSpaceGuid.PcdFlashNvStorageMicrocodeBase|gCpuUncoreTok > enSpaceGuid.PcdFlashNvStorageMicrocodeSize > FV = MICROCODE_FV > > -0x00E10000|0x00010000 > +0x00D30000|0x00010000 > > gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemoryBase|gMinPlatformPkgT > okenSpaceGuid.PcdFlashFvPostMemorySize > FV = FvPostMemory > > -0x00E20000|0x00030000 > +0x00D40000|0x00020000 > > gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSBase|gMinPlatformPkgTokenSp > aceGuid.PcdFlashFvFspSSize > FILE = > $(PLATFORM_SI_BIN_PACKAGE)/FV/FvPostMemorySilicon/$(TARGET)/FvPostMe > morySilicon.Fv > > -0x00E50000|0x00060000 > +0x00D60000|0x00050000 > > gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryBase|gMinPlatformPkgT > okenSpaceGuid.PcdFlashFvPreMemorySize > FV = FvPreMemory > > -0x00EB0000|0x00130000 > +0x00DB0000|0x00230000 > > gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMBase|gMinPlatformPkgTokenSp > aceGuid.PcdFlashFvFspMSize > FILE = > $(PLATFORM_SI_BIN_PACKAGE)/FV/FvPreMemorySilicon/$(TARGET)/FvPreMemo > rySilicon.Fv > > @@ -135,6 +135,9 @@ FILE = > $(PLATFORM_SI_BIN_PACKAGE)/FV/FvTempMemorySilicon/$(TARGET)/FvTempM > emoryS > SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvMicrocodeBase = > gEfiPchTokenSpaceGuid.PcdFlashAreaBaseAddress + > gCpuUncoreTokenSpaceGuid.PcdFlashNvStorageMicrocodeBase > SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvMicrocodeSize = > gCpuUncoreTokenSpaceGuid.PcdFlashNvStorageMicrocodeSize > > +SET gIntelSiliconPkgTokenSpaceGuid.PcdFlashMicrocodeFvBase = > gCpuUncoreTokenSpaceGuid.PcdFlashNvStorageMicrocodeBase > +SET gIntelSiliconPkgTokenSpaceGuid.PcdFlashMicrocodeFvSize = > gCpuUncoreTokenSpaceGuid.PcdFlashNvStorageMicrocodeSize > + > SET gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchAddress = > gEfiPchTokenSpaceGuid.PcdFlashAreaBaseAddress + > gCpuUncoreTokenSpaceGuid.PcdFlashNvStorageMicrocodeBase + 0x60 > SET gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchRegionSize = > gCpuUncoreTokenSpaceGuid.PcdFlashNvStorageMicrocodeSize - 0x60 > > -- > 2.39.2.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111789): https://edk2.groups.io/g/devel/message/111789 Mute This Topic: https://groups.io/mt/102842750/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
Adds SmmLockBox driver which is needed to
build with the newest version of MinPlatformPkg
Cc: Chasel Chiu <chasel.chiu@intel.com>
Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
---
.../Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.dsc | 3 ++-
.../Intel/PurleyOpenBoardPkg/BoardTiogaPass/OpenBoardPkg.dsc | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.dsc b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.dsc
index 39c5cf78ab..65f22bb90e 100644
--- a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.dsc
+++ b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.dsc
@@ -1,7 +1,7 @@
## @file
# The main build description file for the MtOlympus board.
#
-# Copyright (c) 2018 - 2021, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2018 - 2023, Intel Corporation. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@@ -195,6 +195,7 @@
$(PLATFORM_PACKAGE)/PlatformInit/PlatformInitSmm/PlatformInitSmm.inf
$(PLATFORM_BOARD_PACKAGE)/Policy/S3NvramSave/S3NvramSave.inf
+ MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf
#
# Shell
diff --git a/Platform/Intel/PurleyOpenBoardPkg/BoardTiogaPass/OpenBoardPkg.dsc b/Platform/Intel/PurleyOpenBoardPkg/BoardTiogaPass/OpenBoardPkg.dsc
index 5747717ecb..64e8978942 100644
--- a/Platform/Intel/PurleyOpenBoardPkg/BoardTiogaPass/OpenBoardPkg.dsc
+++ b/Platform/Intel/PurleyOpenBoardPkg/BoardTiogaPass/OpenBoardPkg.dsc
@@ -1,7 +1,7 @@
## @file
# The main build description file for the TiogaPass board.
#
-# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2018 - 2023, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2021, American Megatrends International LLC.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@@ -226,6 +226,7 @@
$(PLATFORM_BOARD_PACKAGE)/Policy/S3NvramSave/S3NvramSave.inf
BoardModulePkg/BoardBdsHookDxe/BoardBdsHookDxe.inf
+ MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf
#
# Shell
--
2.39.2.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111774): https://edk2.groups.io/g/devel/message/111774
Mute This Topic: https://groups.io/mt/102842752/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com> Thanks, Chasel > -----Original Message----- > From: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com> > Sent: Monday, November 27, 2023 5:04 PM > To: devel@edk2.groups.io > Cc: Chiu, Chasel <chasel.chiu@intel.com> > Subject: [edk2-platforms][PATCH v1] PurleyOpenBoardPkg: Fix Build > > Adds SmmLockBox driver which is needed to build with the newest version of > MinPlatformPkg > > Cc: Chasel Chiu <chasel.chiu@intel.com> > Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com> > --- > .../Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.dsc | 3 ++- > .../Intel/PurleyOpenBoardPkg/BoardTiogaPass/OpenBoardPkg.dsc | 3 ++- > 2 files changed, 4 insertions(+), 2 deletions(-) > > diff --git > a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.dsc > b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.dsc > index 39c5cf78ab..65f22bb90e 100644 > --- a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.dsc > +++ b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.dsc > @@ -1,7 +1,7 @@ > ## @file > # The main build description file for the MtOlympus board. > # > -# Copyright (c) 2018 - 2021, Intel Corporation. All rights reserved.<BR> > +# Copyright (c) 2018 - 2023, Intel Corporation. All rights > +reserved.<BR> > # > # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -195,6 +195,7 @@ > $(PLATFORM_PACKAGE)/PlatformInit/PlatformInitSmm/PlatformInitSmm.inf > > $(PLATFORM_BOARD_PACKAGE)/Policy/S3NvramSave/S3NvramSave.inf > + MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf > > # > # Shell > diff --git > a/Platform/Intel/PurleyOpenBoardPkg/BoardTiogaPass/OpenBoardPkg.dsc > b/Platform/Intel/PurleyOpenBoardPkg/BoardTiogaPass/OpenBoardPkg.dsc > index 5747717ecb..64e8978942 100644 > --- a/Platform/Intel/PurleyOpenBoardPkg/BoardTiogaPass/OpenBoardPkg.dsc > +++ b/Platform/Intel/PurleyOpenBoardPkg/BoardTiogaPass/OpenBoardPkg.dsc > @@ -1,7 +1,7 @@ > ## @file > # The main build description file for the TiogaPass board. > # > -# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR> > +# Copyright (c) 2018 - 2023, Intel Corporation. All rights > +reserved.<BR> > # Copyright (c) 2021, American Megatrends International LLC.<BR> # SPDX- > License-Identifier: BSD-2-Clause-Patent # @@ -226,6 +226,7 @@ > > $(PLATFORM_BOARD_PACKAGE)/Policy/S3NvramSave/S3NvramSave.inf > BoardModulePkg/BoardBdsHookDxe/BoardBdsHookDxe.inf > + MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf > > # > # Shell > -- > 2.39.2.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111788): https://edk2.groups.io/g/devel/message/111788 Mute This Topic: https://groups.io/mt/102842752/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
PatchFv tools now run on Python 3.x
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Eric Dong <eric.dong@intel.com>
Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
---
.../MinPlatformPkg/Tools/PatchFv/PatchBfv.py | 35 ++++----
.../Tools/PatchFv/PatchBinFv.py | 69 ++++++++--------
.../Tools/PatchFv/RebaseBinFv.py | 82 +++++++++----------
3 files changed, 92 insertions(+), 94 deletions(-)
diff --git a/Platform/Intel/MinPlatformPkg/Tools/PatchFv/PatchBfv.py b/Platform/Intel/MinPlatformPkg/Tools/PatchFv/PatchBfv.py
index 1312bfc328..f05480b91f 100644
--- a/Platform/Intel/MinPlatformPkg/Tools/PatchFv/PatchBfv.py
+++ b/Platform/Intel/MinPlatformPkg/Tools/PatchFv/PatchBfv.py
@@ -1,6 +1,6 @@
## @ PatchBfv.py
#
-# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2017 - 2023, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
@@ -11,8 +11,7 @@ import sys
import time
import shutil
import struct
-import binascii
-from ctypes import *
+from ctypes import *
class FileChecker:
def __init__(self):
@@ -21,17 +20,17 @@ class FileChecker:
self.pcd = ["", "", ""]
def PrintPcd(self):
- print "PCD: " + self.pcd[0] + "|" + self.pcd[1] + "(" + self.pcd[2] + ")"
+ print("PCD: {0}|{1}({2})".format(*(self.pcd)))
def ProcessReport(self):
try :
file = open(self.reportFile)
except Exception:
- print "fail to open " + self.reportFile
+ print("fail to open " + self.reportFile)
return
try:
file.seek(0)
- print "checking - " + self.pcd[0]
+ print("checking - " + self.pcd[0])
ValuePair = self.GetPcdFromReport (file, self.pcd[0])
self.pcd[1] = ValuePair[0]
self.pcd[2] = ValuePair[1]
@@ -42,12 +41,12 @@ class FileChecker:
def PatchFd(self):
fileName = self.fdName
- print "patching BFV - " + fileName
+ print("patching BFV - " + fileName)
try :
file = open(fileName, "rb")
except Exception:
- print "fail to open " + fileName
+ print("fail to open " + fileName)
return
try:
buffer = file.read()
@@ -57,7 +56,7 @@ class FileChecker:
offset = -4
l = struct.pack("L", int(self.pcd[1],16))
- print " [" + hex(offset) + "] " + binascii.hexlify(data[-4:]) + " <= " + binascii.hexlify(l)
+ print(" [" + hex(offset) + "] " + bytes(data[-4:]).hex() + " <= " + bytes(l).hex())
data[-4:] = l
file = open(fileName, "wb")
@@ -77,36 +76,36 @@ class FileChecker:
newline = line[:-1]
- if (cmp (newline, TargetPkg) == 0):
+ if newline == TargetPkg:
FoundPkg = True
continue
- if (cmp (newline, "") == 0) or ((cmp (newline[0], " ") != 0) and (cmp (newline[0], "0") != 0)):
+ if newline == "" or (newline[0] != " " and newline[0] != "0"):
FoundPkg = False
if (FoundPkg == True) :
newline = newline.strip()
splitLine = newline.split(" ", 2)
- if (cmp (splitLine[0], "*F") == 0) or (cmp (splitLine[0], "*P") == 0) :
- if (cmp (splitLine[1], TargetPcd) == 0):
- print "found - " + TargetPkg + "." + TargetPcd
+ if splitLine[0] == "*F" or splitLine[0] == "*P":
+ if splitLine[1] == TargetPcd:
+ print("found - " + TargetPkg + "." + TargetPcd)
splitLine = splitLine[2].strip()[1:].strip().split(" ", 1)
- if (cmp (splitLine[0], "FIXED") == 0) or (cmp (splitLine[0], "PATCH") == 0):
+ if splitLine[0] == "FIXED" or splitLine[0] == "PATCH":
SplitLine = splitLine[1].strip()[1:].split(")", 1)
Type = SplitLine[0]
Value = SplitLine[1].strip()[1:].strip().split()[0]
- print " Type - (" + Type + "), Value - (" + Value + ")"
+ print(" Type - (" + Type + "), Value - (" + Value + ")")
return [Value, Type]
return ["", ""]
-
+
def main():
global FileChecker
fileChecker = FileChecker()
if (len(sys.argv) != 4) :
- print "usage: PatchBfv <FdFile> <ReportFile> <BfvPcdName>"
+ print("usage: PatchBfv <FdFile> <ReportFile> <BfvPcdName>")
return 0
fileChecker.fdName = sys.argv[1]
diff --git a/Platform/Intel/MinPlatformPkg/Tools/PatchFv/PatchBinFv.py b/Platform/Intel/MinPlatformPkg/Tools/PatchFv/PatchBinFv.py
index b98c951b45..78576a3029 100644
--- a/Platform/Intel/MinPlatformPkg/Tools/PatchFv/PatchBinFv.py
+++ b/Platform/Intel/MinPlatformPkg/Tools/PatchFv/PatchBinFv.py
@@ -1,6 +1,6 @@
## @ PatchBinFv.py
#
-# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2017 - 2023, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
@@ -11,7 +11,6 @@ import sys
import time
import shutil
import struct
-import binascii
from ctypes import *
class FileChecker:
@@ -30,20 +29,20 @@ class FileChecker:
def IsSyncSection(self, line):
name = self.GetSectionName(line)
for sectionName in self.SyncSectionList:
- if (cmp (sectionName, name) == 0) :
+ if sectionName == name:
return True
return False
def PrintPcdList(self, pcdList):
for pcd in pcdList:
- print "PCD: " + pcd[0] + "|" + pcd[1] + "|" + pcd[2] + " <== " + pcd[3] + "(" + pcd[4] + ")"
+ print(("PCD: {0} | {1} | {2} <== {3}({4})".format(*pcd)))
def GetInfFileGuid(self, fileName):
guid = ""
try :
file = open(fileName)
except Exception:
- print "fail to open " + fileName
+ print("fail to open " + fileName)
return
try:
while 1:
@@ -53,7 +52,7 @@ class FileChecker:
newline = line[:-1]
- if cmp (line[:11], " FILE_GUID") == 0:
+ if line[:11] == " FILE_GUID":
splitLine = line.split("=")
templine = splitLine[1]
guid = templine[1:1+36]
@@ -66,7 +65,7 @@ class FileChecker:
try :
file = open(fileName)
except Exception:
- print "fail to open " + fileName
+ print("fail to open " + fileName)
return
try:
while 1:
@@ -76,23 +75,23 @@ class FileChecker:
newline = line[:-1]
- if cmp (line[0], "#") == 0:
+ if line[0] == "#":
continue
- if cmp (line[0], "[") == 0:
+ if line[0] == "[":
SyncToDest = self.IsSyncSection(line)
PatchOffset = False
- if (cmp (self.GetSectionName(line), "PatchPcd") == 0) :
+ if (self.GetSectionName(line) == "PatchPcd"):
PatchOffset = True
continue
if SyncToDest == True :
line = line.strip()
- if (cmp (line, "") == 0) :
+ if line == "":
continue
- if (cmp (line[0], "#") == 0) :
+ if line[0] == "#":
continue
splitLine = line.split(" ")
@@ -108,9 +107,9 @@ class FileChecker:
def ProcessFvInf(self, fvName):
sourceFileName = os.path.join(self.sourceRoot,fvName,self.target,fvName+".inf")
- print "\nprocessing - " + sourceFileName
+ print("\nprocessing - " + sourceFileName)
fileGuid = self.GetInfFileGuid (sourceFileName)
- print "FV NAME GUID - " + fileGuid
+ print("FV NAME GUID - " + fileGuid)
self.InfPcdList = []
self.ParseInfFile(sourceFileName)
@@ -122,12 +121,12 @@ class FileChecker:
try :
file = open(self.reportFile)
except Exception:
- print "fail to open " + self.reportFile
+ print("fail to open " + self.reportFile)
return
try:
for pcd in self.InfPcdList:
file.seek(0)
- print "checking - " + pcd[0]
+ print("checking - " + pcd[0])
ValuePair = self.GetPcdFromReport (file, pcd[0])
pcd[3] = ValuePair[0]
pcd[4] = ValuePair[1]
@@ -138,12 +137,12 @@ class FileChecker:
def PatchFv(self, fvName):
sourceFileName = os.path.join(self.sourceRoot,fvName,self.target,fvName+".Fv")
- print "patching - " + sourceFileName
+ print("patching - " + sourceFileName)
try :
file = open(sourceFileName, "rb")
except Exception:
- print "fail to open " + sourceFileName
+ print("fail to open " + sourceFileName)
return
try:
buffer = file.read()
@@ -152,21 +151,21 @@ class FileChecker:
for pcd in self.InfPcdList:
offset = int(pcd[2], 16)
- if (cmp (pcd[4], "BOOLEAN") == 0) or (cmp (pcd[4], "UINT8") == 0):
+ if (pcd[4] == "BOOLEAN") or (pcd[4] == "UINT8"):
b = struct.pack("B", int(pcd[3],16))
- print " [" + hex(offset) + "] " + binascii.hexlify(data[offset:offset+1]) + " <= " + binascii.hexlify(b)
+ print(" [" + hex(offset) + "] " + bytes(data[offset:offset+1]).hex() + " <= " + bytes(b).hex())
data[offset:offset+1] = b
- elif (cmp (pcd[4], "UINT16") == 0):
+ elif (pcd[4] == "UINT16"):
h = struct.pack("H", int(pcd[3],16))
- print " [" + hex(offset) + "] " + binascii.hexlify(data[offset:offset+2]) + " <= " + binascii.hexlify(h)
+ print(" [" + hex(offset) + "] " + bytes(data[offset:offset+2]).hex() + " <= " + bytes(h).hex())
data[offset:offset+2] = h
- elif (cmp (pcd[4], "UINT32") == 0):
+ elif (pcd[4] == "UINT32"):
l = struct.pack("I", int(pcd[3],16))
- print " [" + hex(offset) + "] " + binascii.hexlify(data[offset:offset+4]) + " <= " + binascii.hexlify(l)
+ print(" [" + hex(offset) + "] " + bytes(data[offset:offset+4]).hex() + " <= " + bytes(l).hex())
data[offset:offset+4] = l
- elif (cmp (pcd[4], "UINT64") == 0):
+ elif (pcd[4] == "UINT64"):
q = struct.pack("Q", int(pcd[3],16))
- print " [" + hex(offset) + "] " + binascii.hexlify(data[offset:offset+8]) + " <= " + binascii.hexlify(q)
+ print(" [" + hex(offset) + "] " + bytes(data[offset:offset+8]).hex() + " <= " + bytes(q).hex())
data[offset:offset+8] = q
file = open(sourceFileName, "wb")
file.write(data)
@@ -185,36 +184,36 @@ class FileChecker:
newline = line[:-1]
- if (cmp (newline, TargetPkg) == 0):
+ if (newline == TargetPkg):
FoundPkg = True
continue
- if (cmp (newline, "") == 0) or ((cmp (newline[0], " ") != 0) and (cmp (newline[0], "0") != 0)):
+ if (newline == "") or ((newline[0] != " ") and (newline[0] != "0")):
FoundPkg = False
if (FoundPkg == True) :
newline = newline.strip()
splitLine = newline.split(" ", 2)
- if (cmp (splitLine[0], "*F") == 0) or (cmp (splitLine[0], "*P") == 0):
- if (cmp (splitLine[1], TargetPcd) == 0):
- print "found - " + TargetPkg + "." + TargetPcd
+ if (splitLine[0] == "*F") or (splitLine[0] == "*P"):
+ if (splitLine[1] == TargetPcd):
+ print("found - " + TargetPkg + "." + TargetPcd)
splitLine = splitLine[2].strip()[1:].strip().split(" ", 1)
- if (cmp (splitLine[0], "FIXED") == 0) or (cmp (splitLine[0], "PATCH") == 0):
+ if (splitLine[0] == "FIXED") or (splitLine[0] == "PATCH"):
SplitLine = splitLine[1].strip()[1:].split(")", 1)
Type = SplitLine[0]
Value = SplitLine[1].strip()[1:].strip().split()[0]
- print " Type - (" + Type + "), Value - (" + Value + ")"
+ print(" Type - (" + Type + "), Value - (" + Value + ")")
return [Value, Type]
return ["", ""]
-
+
def main():
global FileChecker
fileChecker = FileChecker()
if (len(sys.argv) != 5) :
- print "usage: PatchBinFv <Target> <SourceRoot> <ReportFile> <FvName>"
+ print("usage: PatchBinFv <Target> <SourceRoot> <ReportFile> <FvName>")
return 0
fileChecker.target = sys.argv[1]
diff --git a/Platform/Intel/MinPlatformPkg/Tools/PatchFv/RebaseBinFv.py b/Platform/Intel/MinPlatformPkg/Tools/PatchFv/RebaseBinFv.py
index 149630e4ef..2cea491f41 100644
--- a/Platform/Intel/MinPlatformPkg/Tools/PatchFv/RebaseBinFv.py
+++ b/Platform/Intel/MinPlatformPkg/Tools/PatchFv/RebaseBinFv.py
@@ -1,6 +1,6 @@
## @ PatchBinFv.py
#
-# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2017 - 2023, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@@ -10,8 +10,8 @@ import sys
import time
import shutil
import struct
-import binascii
-from ctypes import *
+from ctypes import *
+from functools import reduce
class GUID(Structure):
_fields_ = [
@@ -380,9 +380,9 @@ class PeTeImage:
def __init__(self, offset, data):
self.Offset = offset
tehdr = EFI_TE_IMAGE_HEADER.from_buffer (data, 0)
- if tehdr.Signature == 'VZ': # TE image
+ if tehdr.Signature == b'VZ': # TE image
self.TeHdr = tehdr
- elif tehdr.Signature == 'MZ': # PE32 image
+ elif tehdr.Signature == b'MZ': # PE32 image
self.TeHdr = None
self.DosHdr = EFI_IMAGE_DOS_HEADER.from_buffer (data, 0)
self.PeHdr = EFI_IMAGE_NT_HEADERS32.from_buffer (data, self.DosHdr.e_lfanew)
@@ -397,7 +397,7 @@ class PeTeImage:
self.RelocList = []
def IsTeImage(self):
- return self.TeHdr is not None
+ return self.TeHdr is not None
def ParseReloc(self):
if self.IsTeImage():
@@ -415,7 +415,7 @@ class PeTeImage:
offset += sizeof(blkhdr)
# Read relocation type,offset pairs
rlen = blkhdr.BlockSize - sizeof(PE_RELOC_BLOCK_HEADER)
- rnum = rlen/sizeof(c_uint16)
+ rnum = rlen // sizeof(c_uint16)
rdata = (c_uint16 * rnum).from_buffer(self.Data, offset)
for each in rdata:
roff = each & 0xfff
@@ -532,21 +532,21 @@ class FileChecker:
def IsSyncSection(self, line):
name = self.GetSectionName(line)
for sectionName in self.SyncSectionList:
- if (cmp (sectionName, name) == 0) :
+ if sectionName == name:
return True
return False
def PrintRebasePcd(self, pcd):
- print "PCD: " + pcd[0] + "|" + pcd[3] + " <== " + pcd[1] + "(" + pcd[2] + ")"
+ print("PCD: {0} | {3} <== {1}({2})".format(*pcd))
def RebaseFv(self, fvName, rebasePcd):
sourceFileName = os.path.join(self.sourceRoot,fvName,self.target,fvName+".Fv")
- print "rebasing(FV) - " + sourceFileName
+ print("rebasing(FV) - " + sourceFileName)
try :
file = open(sourceFileName, "rb")
except Exception:
- print "fail to open " + sourceFileName
+ print("fail to open " + sourceFileName)
return
try:
buffer = file.read()
@@ -554,15 +554,15 @@ class FileChecker:
file.close()
FvHeader = EFI_FIRMWARE_VOLUME_HEADER.from_buffer (data, 0)
- print "HeaderLength - " + hex(FvHeader.HeaderLength)
- print "ExtHeaderOffset - " + hex(FvHeader.ExtHeaderOffset)
+ print("HeaderLength - " + hex(FvHeader.HeaderLength))
+ print("ExtHeaderOffset - " + hex(FvHeader.ExtHeaderOffset))
if (FvHeader.ExtHeaderOffset == 0):
Offset = FvHeader.HeaderLength
else:
FvExHeader = EFI_FIRMWARE_VOLUME_EXT_HEADER.from_buffer(data, FvHeader.ExtHeaderOffset)
- print " FvName - %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x" % (FvExHeader.FvName.Guid1, FvExHeader.FvName.Guid2, FvExHeader.FvName.Guid3, FvExHeader.FvName.Guid4[0], FvExHeader.FvName.Guid4[1], FvExHeader.FvName.Guid4[2], FvExHeader.FvName.Guid4[3], FvExHeader.FvName.Guid4[4], FvExHeader.FvName.Guid4[5], FvExHeader.FvName.Guid4[6], FvExHeader.FvName.Guid4[7])
- print " ExtHeaderSize - " + hex(FvExHeader.ExtHeaderSize)
+ print(" FvName - %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x" % (FvExHeader.FvName.Guid1, FvExHeader.FvName.Guid2, FvExHeader.FvName.Guid3, FvExHeader.FvName.Guid4[0], FvExHeader.FvName.Guid4[1], FvExHeader.FvName.Guid4[2], FvExHeader.FvName.Guid4[3], FvExHeader.FvName.Guid4[4], FvExHeader.FvName.Guid4[5], FvExHeader.FvName.Guid4[6], FvExHeader.FvName.Guid4[7]))
+ print(" ExtHeaderSize - " + hex(FvExHeader.ExtHeaderSize))
Offset = FvHeader.ExtHeaderOffset + FvExHeader.ExtHeaderSize
Offset = (Offset + 0x7) & ~0x7
@@ -576,20 +576,20 @@ class FileChecker:
if (FfsHeader.Type == 0xFF) or (FfsHeader.Type == EFI_FV_FILETYPE_FFS_PAD) :
Offset = (FfsOffset + FfsSize + 7) & ~0x7
continue
- print "Ffs - %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x" % (FfsHeader.Name.Guid1, FfsHeader.Name.Guid2, FfsHeader.Name.Guid3, FfsHeader.Name.Guid4[0], FfsHeader.Name.Guid4[1], FfsHeader.Name.Guid4[2], FfsHeader.Name.Guid4[3], FfsHeader.Name.Guid4[4], FfsHeader.Name.Guid4[5], FfsHeader.Name.Guid4[6], FfsHeader.Name.Guid4[7])
+ print("Ffs - %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x" % (FfsHeader.Name.Guid1, FfsHeader.Name.Guid2, FfsHeader.Name.Guid3, FfsHeader.Name.Guid4[0], FfsHeader.Name.Guid4[1], FfsHeader.Name.Guid4[2], FfsHeader.Name.Guid4[3], FfsHeader.Name.Guid4[4], FfsHeader.Name.Guid4[5], FfsHeader.Name.Guid4[6], FfsHeader.Name.Guid4[7]))
Offset = Offset + sizeof(EFI_FFS_FILE_HEADER)
while (Offset < FfsOffset + FfsSize) :
SectionHeader = EFI_COMMON_SECTION_HEADER.from_buffer (data, Offset)
#print " Section - " + hex(Offset)
if (SectionHeader.Type == EFI_SECTION_PE32) or (SectionHeader.Type == EFI_SECTION_TE) :
PeOffset = Offset + sizeof(EFI_COMMON_SECTION_HEADER)
- print " PE - " + hex(PeOffset) + "(" + binascii.hexlify(data[PeOffset:PeOffset+2]) + ")"
+ print(" PE - " + hex(PeOffset) + "(" + bytes(data[PeOffset:PeOffset+2]).hex() + ")")
newbase = int(rebasePcd[1],16)
oldbase = int(rebasePcd[3],16)
delta = newbase - oldbase
- print " delta - " + hex(delta) + "(" + hex(oldbase) + " <== " + hex(newbase) + ")"
+ print(" delta - " + hex(delta) + "(" + hex(oldbase) + " <== " + hex(newbase) + ")")
PeLength = FfsSize-sizeof(EFI_FFS_FILE_HEADER);
@@ -618,26 +618,26 @@ class FileChecker:
newline = line[:-1].replace('\r','')
- if (cmp (newline, TargetPkg) == 0):
+ if newline == TargetPkg:
FoundPkg = True
continue
- if (cmp (newline, "") == 0) or ((cmp (newline[0], " ") != 0) and (cmp (newline[0], "0") != 0)):
+ if newline == "" or (newline[0] != " " and newline[0] != "0"):
FoundPkg = False
if (FoundPkg == True) :
newline = newline.strip()
splitLine = newline.split(" ", 2)
- if (cmp (splitLine[0], "*F") == 0) or (cmp (splitLine[0], "*P") == 0):
- if (cmp (splitLine[1], TargetPcd) == 0):
- print "found - " + TargetPkg + "." + TargetPcd
+ if (splitLine[0] == "*F") or (splitLine[0] == "*P"):
+ if splitLine[1] == TargetPcd:
+ print("found - " + TargetPkg + "." + TargetPcd)
splitLine = splitLine[2].strip()[1:].strip().split(" ", 1)
- if (cmp (splitLine[0], "FIXED") == 0) or (cmp (splitLine[0], "PATCH") == 0):
+ if splitLine[0] == "FIXED" or splitLine[0] == "PATCH":
SplitLine = splitLine[1].strip()[1:].split(")", 1)
Type = SplitLine[0]
Value = SplitLine[1].strip()[1:].strip().split()[0]
- print " Type - (" + Type + "), Value - (" + Value + ")"
+ print(" Type - (" + Type + "), Value - (" + Value + ")")
return [Value, Type]
return ["", ""]
@@ -648,7 +648,7 @@ class FileChecker:
try :
file = open(fileName)
except Exception:
- print "fail to open " + fileName
+ print("fail to open " + fileName)
return
try:
while 1:
@@ -658,21 +658,21 @@ class FileChecker:
newline = line[:-1].replace('\r','')
- if cmp (newline, "") == 0:
+ if newline == "":
continue
- if cmp (newline, "#![Pcd]") == 0:
+ if newline == "#![Pcd]":
ParseBase = True
continue
if ParseBase == True :
- if (cmp (line[0:2], "#!") != 0) :
+ if line[0:2] != "#!":
ParseBase = False
continue
newline = newline[2:].strip()
splitLine = newline.split("|")
- if cmp (PcdName, splitLine[0]) == 0:
+ if PcdName == splitLine[0]:
Value = splitLine[1]
finally:
file.close()
@@ -681,11 +681,11 @@ class FileChecker:
def SetNewFvBase (self, fvName, PcdName, OldFvBase, NewFvBase):
fileName = os.path.join(self.sourceRoot,fvName,self.target,fvName+".inf")
- print "update - " + fileName
+ print("update - " + fileName)
try :
file = open(fileName, "r")
except Exception:
- print "fail to open " + fileName
+ print("fail to open " + fileName)
return
try:
lines = file.readlines()
@@ -699,23 +699,23 @@ class FileChecker:
newline = line[:-1].strip()
- if cmp (newline, "") == 0:
+ if newline == "":
continue
- if cmp (newline, "#![Pcd]") == 0:
+ if newline == "#![Pcd]":
ParseBase = True
continue
if ParseBase == True :
- if (cmp (line[0:2], "#!") != 0) :
+ if line[0:2] != "#!":
ParseBase = False
continue
newline = newline[2:].strip()
splitLine = newline.split("|")
- if cmp (PcdName, splitLine[0]) == 0:
- if cmp (OldFvBase, splitLine[1]) != 0:
- print "ERROR: OldFvBase mismatch!"
+ if PcdName == splitLine[0]:
+ if OldFvBase != splitLine[1]:
+ print("ERROR: OldFvBase mismatch!")
else:
lines[index] = "#! " + PcdName + "|" + NewFvBase + "\n"
break
@@ -730,11 +730,11 @@ class FileChecker:
try :
file = open(self.reportFile)
except Exception:
- print "fail to open " + self.reportFile
+ print("fail to open " + self.reportFile)
return
try:
file.seek(0)
- print "checking - " + self.RebasePcd[0]
+ print("checking - " + self.RebasePcd[0])
ValuePair = self.GetPcdFromReport (file, self.RebasePcd[0])
self.RebasePcd[1] = ValuePair[0]
self.RebasePcd[2] = ValuePair[1]
@@ -747,7 +747,7 @@ def main():
fileChecker = FileChecker()
if (len(sys.argv) != 6) :
- print "usage: RebaseBinFv <Target> <SourceRoot> <ReportFile> <FvName> <RebasePcdName>"
+ print("usage: RebaseBinFv <Target> <SourceRoot> <ReportFile> <FvName> <RebasePcdName>")
return 0
fileChecker.target = sys.argv[1]
--
2.39.2.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111773): https://edk2.groups.io/g/devel/message/111773
Mute This Topic: https://groups.io/mt/102842751/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com> Thanks, Chasel > -----Original Message----- > From: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com> > Sent: Monday, November 27, 2023 5:04 PM > To: devel@edk2.groups.io > Cc: Chiu, Chasel <chasel.chiu@intel.com>; Gao, Liming > <gaoliming@byosoft.com.cn>; Dong, Eric <eric.dong@intel.com> > Subject: [edk2-platforms][PATCH v1] MinPlatformPkg: Update PatchFv Tools for > Python 3.x > > PatchFv tools now run on Python 3.x > > Cc: Chasel Chiu <chasel.chiu@intel.com> > Cc: Liming Gao <gaoliming@byosoft.com.cn> > Cc: Eric Dong <eric.dong@intel.com> > Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com> > --- > .../MinPlatformPkg/Tools/PatchFv/PatchBfv.py | 35 ++++---- > .../Tools/PatchFv/PatchBinFv.py | 69 ++++++++-------- > .../Tools/PatchFv/RebaseBinFv.py | 82 +++++++++---------- > 3 files changed, 92 insertions(+), 94 deletions(-) > > diff --git a/Platform/Intel/MinPlatformPkg/Tools/PatchFv/PatchBfv.py > b/Platform/Intel/MinPlatformPkg/Tools/PatchFv/PatchBfv.py > index 1312bfc328..f05480b91f 100644 > --- a/Platform/Intel/MinPlatformPkg/Tools/PatchFv/PatchBfv.py > +++ b/Platform/Intel/MinPlatformPkg/Tools/PatchFv/PatchBfv.py > @@ -1,6 +1,6 @@ > ## @ PatchBfv.py > # > -# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR> > +# Copyright (c) 2017 - 2023, Intel Corporation. All rights > +reserved.<BR> > # SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -11,8 +11,7 @@ > import sys import time import shutil import struct -import binascii > -from ctypes import * > +from ctypes import * > > class FileChecker: > def __init__(self): > @@ -21,17 +20,17 @@ class FileChecker: > self.pcd = ["", "", ""] > > def PrintPcd(self): > - print "PCD: " + self.pcd[0] + "|" + self.pcd[1] + "(" + self.pcd[2] + ")" > + print("PCD: {0}|{1}({2})".format(*(self.pcd))) > > def ProcessReport(self): > try : > file = open(self.reportFile) > except Exception: > - print "fail to open " + self.reportFile > + print("fail to open " + self.reportFile) > return > try: > file.seek(0) > - print "checking - " + self.pcd[0] > + print("checking - " + self.pcd[0]) > ValuePair = self.GetPcdFromReport (file, self.pcd[0]) > self.pcd[1] = ValuePair[0] > self.pcd[2] = ValuePair[1] > @@ -42,12 +41,12 @@ class FileChecker: > > def PatchFd(self): > fileName = self.fdName > - print "patching BFV - " + fileName > + print("patching BFV - " + fileName) > > try : > file = open(fileName, "rb") > except Exception: > - print "fail to open " + fileName > + print("fail to open " + fileName) > return > try: > buffer = file.read() > @@ -57,7 +56,7 @@ class FileChecker: > offset = -4 > > l = struct.pack("L", int(self.pcd[1],16)) > - print " [" + hex(offset) + "] " + binascii.hexlify(data[-4:]) + " <= " + > binascii.hexlify(l) > + print(" [" + hex(offset) + "] " + bytes(data[-4:]).hex() + > + " <= " + bytes(l).hex()) > data[-4:] = l > > file = open(fileName, "wb") @@ -77,36 +76,36 @@ class FileChecker: > > newline = line[:-1] > > - if (cmp (newline, TargetPkg) == 0): > + if newline == TargetPkg: > FoundPkg = True > continue > > - if (cmp (newline, "") == 0) or ((cmp (newline[0], " ") != 0) and (cmp > (newline[0], "0") != 0)): > + if newline == "" or (newline[0] != " " and newline[0] != "0"): > FoundPkg = False > > if (FoundPkg == True) : > newline = newline.strip() > splitLine = newline.split(" ", 2) > - if (cmp (splitLine[0], "*F") == 0) or (cmp (splitLine[0], "*P") == 0) : > - if (cmp (splitLine[1], TargetPcd) == 0): > - print "found - " + TargetPkg + "." + TargetPcd > + if splitLine[0] == "*F" or splitLine[0] == "*P": > + if splitLine[1] == TargetPcd: > + print("found - " + TargetPkg + "." + TargetPcd) > > splitLine = splitLine[2].strip()[1:].strip().split(" ", 1) > - if (cmp (splitLine[0], "FIXED") == 0) or (cmp (splitLine[0], "PATCH") > == 0): > + if splitLine[0] == "FIXED" or splitLine[0] == "PATCH": > SplitLine = splitLine[1].strip()[1:].split(")", 1) > Type = SplitLine[0] > Value = SplitLine[1].strip()[1:].strip().split()[0] > - print " Type - (" + Type + "), Value - (" + Value + ")" > + print(" Type - (" + Type + "), Value - (" > + + Value + ")") > return [Value, Type] > return ["", ""] > - > + > def main(): > global FileChecker > > fileChecker = FileChecker() > > if (len(sys.argv) != 4) : > - print "usage: PatchBfv <FdFile> <ReportFile> <BfvPcdName>" > + print("usage: PatchBfv <FdFile> <ReportFile> <BfvPcdName>") > return 0 > > fileChecker.fdName = sys.argv[1] > diff --git a/Platform/Intel/MinPlatformPkg/Tools/PatchFv/PatchBinFv.py > b/Platform/Intel/MinPlatformPkg/Tools/PatchFv/PatchBinFv.py > index b98c951b45..78576a3029 100644 > --- a/Platform/Intel/MinPlatformPkg/Tools/PatchFv/PatchBinFv.py > +++ b/Platform/Intel/MinPlatformPkg/Tools/PatchFv/PatchBinFv.py > @@ -1,6 +1,6 @@ > ## @ PatchBinFv.py > # > -# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR> > +# Copyright (c) 2017 - 2023, Intel Corporation. All rights > +reserved.<BR> > # SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -11,7 +11,6 @@ > import sys import time import shutil import struct -import binascii > from ctypes import * > > class FileChecker: > @@ -30,20 +29,20 @@ class FileChecker: > def IsSyncSection(self, line): > name = self.GetSectionName(line) > for sectionName in self.SyncSectionList: > - if (cmp (sectionName, name) == 0) : > + if sectionName == name: > return True > return False > > def PrintPcdList(self, pcdList): > for pcd in pcdList: > - print "PCD: " + pcd[0] + "|" + pcd[1] + "|" + pcd[2] + " <== " + pcd[3] + "(" > + pcd[4] + ")" > + print(("PCD: {0} | {1} | {2} <== {3}({4})".format(*pcd))) > > def GetInfFileGuid(self, fileName): > guid = "" > try : > file = open(fileName) > except Exception: > - print "fail to open " + fileName > + print("fail to open " + fileName) > return > try: > while 1: > @@ -53,7 +52,7 @@ class FileChecker: > > newline = line[:-1] > > - if cmp (line[:11], " FILE_GUID") == 0: > + if line[:11] == " FILE_GUID": > splitLine = line.split("=") > templine = splitLine[1] > guid = templine[1:1+36] @@ -66,7 +65,7 @@ class FileChecker: > try : > file = open(fileName) > except Exception: > - print "fail to open " + fileName > + print("fail to open " + fileName) > return > try: > while 1: > @@ -76,23 +75,23 @@ class FileChecker: > > newline = line[:-1] > > - if cmp (line[0], "#") == 0: > + if line[0] == "#": > continue > > > - if cmp (line[0], "[") == 0: > + if line[0] == "[": > SyncToDest = self.IsSyncSection(line) > PatchOffset = False > > - if (cmp (self.GetSectionName(line), "PatchPcd") == 0) : > + if (self.GetSectionName(line) == "PatchPcd"): > PatchOffset = True > continue > > if SyncToDest == True : > line = line.strip() > - if (cmp (line, "") == 0) : > + if line == "": > continue > - if (cmp (line[0], "#") == 0) : > + if line[0] == "#": > continue > > splitLine = line.split(" ") @@ -108,9 +107,9 @@ class FileChecker: > > def ProcessFvInf(self, fvName): > sourceFileName = > os.path.join(self.sourceRoot,fvName,self.target,fvName+".inf") > - print "\nprocessing - " + sourceFileName > + print("\nprocessing - " + sourceFileName) > fileGuid = self.GetInfFileGuid (sourceFileName) > - print "FV NAME GUID - " + fileGuid > + print("FV NAME GUID - " + fileGuid) > > self.InfPcdList = [] > self.ParseInfFile(sourceFileName) @@ -122,12 +121,12 @@ class > FileChecker: > try : > file = open(self.reportFile) > except Exception: > - print "fail to open " + self.reportFile > + print("fail to open " + self.reportFile) > return > try: > for pcd in self.InfPcdList: > file.seek(0) > - print "checking - " + pcd[0] > + print("checking - " + pcd[0]) > ValuePair = self.GetPcdFromReport (file, pcd[0]) > pcd[3] = ValuePair[0] > pcd[4] = ValuePair[1] > @@ -138,12 +137,12 @@ class FileChecker: > > def PatchFv(self, fvName): > sourceFileName = > os.path.join(self.sourceRoot,fvName,self.target,fvName+".Fv") > - print "patching - " + sourceFileName > + print("patching - " + sourceFileName) > > try : > file = open(sourceFileName, "rb") > except Exception: > - print "fail to open " + sourceFileName > + print("fail to open " + sourceFileName) > return > try: > buffer = file.read() > @@ -152,21 +151,21 @@ class FileChecker: > > for pcd in self.InfPcdList: > offset = int(pcd[2], 16) > - if (cmp (pcd[4], "BOOLEAN") == 0) or (cmp (pcd[4], "UINT8") == 0): > + if (pcd[4] == "BOOLEAN") or (pcd[4] == "UINT8"): > b = struct.pack("B", int(pcd[3],16)) > - print " [" + hex(offset) + "] " + binascii.hexlify(data[offset:offset+1]) + > " <= " + binascii.hexlify(b) > + print(" [" + hex(offset) + "] " + > + bytes(data[offset:offset+1]).hex() + " <= " + bytes(b).hex()) > data[offset:offset+1] = b > - elif (cmp (pcd[4], "UINT16") == 0): > + elif (pcd[4] == "UINT16"): > h = struct.pack("H", int(pcd[3],16)) > - print " [" + hex(offset) + "] " + binascii.hexlify(data[offset:offset+2]) + > " <= " + binascii.hexlify(h) > + print(" [" + hex(offset) + "] " + > + bytes(data[offset:offset+2]).hex() + " <= " + bytes(h).hex()) > data[offset:offset+2] = h > - elif (cmp (pcd[4], "UINT32") == 0): > + elif (pcd[4] == "UINT32"): > l = struct.pack("I", int(pcd[3],16)) > - print " [" + hex(offset) + "] " + binascii.hexlify(data[offset:offset+4]) + > " <= " + binascii.hexlify(l) > + print(" [" + hex(offset) + "] " + > + bytes(data[offset:offset+4]).hex() + " <= " + bytes(l).hex()) > data[offset:offset+4] = l > - elif (cmp (pcd[4], "UINT64") == 0): > + elif (pcd[4] == "UINT64"): > q = struct.pack("Q", int(pcd[3],16)) > - print " [" + hex(offset) + "] " + binascii.hexlify(data[offset:offset+8]) + > " <= " + binascii.hexlify(q) > + print(" [" + hex(offset) + "] " + > + bytes(data[offset:offset+8]).hex() + " <= " + bytes(q).hex()) > data[offset:offset+8] = q > file = open(sourceFileName, "wb") > file.write(data) > @@ -185,36 +184,36 @@ class FileChecker: > > newline = line[:-1] > > - if (cmp (newline, TargetPkg) == 0): > + if (newline == TargetPkg): > FoundPkg = True > continue > > - if (cmp (newline, "") == 0) or ((cmp (newline[0], " ") != 0) and (cmp > (newline[0], "0") != 0)): > + if (newline == "") or ((newline[0] != " ") and (newline[0] != "0")): > FoundPkg = False > > if (FoundPkg == True) : > newline = newline.strip() > splitLine = newline.split(" ", 2) > - if (cmp (splitLine[0], "*F") == 0) or (cmp (splitLine[0], "*P") == 0): > - if (cmp (splitLine[1], TargetPcd) == 0): > - print "found - " + TargetPkg + "." + TargetPcd > + if (splitLine[0] == "*F") or (splitLine[0] == "*P"): > + if (splitLine[1] == TargetPcd): > + print("found - " + TargetPkg + "." + TargetPcd) > > splitLine = splitLine[2].strip()[1:].strip().split(" ", 1) > - if (cmp (splitLine[0], "FIXED") == 0) or (cmp (splitLine[0], "PATCH") > == 0): > + if (splitLine[0] == "FIXED") or (splitLine[0] == "PATCH"): > SplitLine = splitLine[1].strip()[1:].split(")", 1) > Type = SplitLine[0] > Value = SplitLine[1].strip()[1:].strip().split()[0] > - print " Type - (" + Type + "), Value - (" + Value + ")" > + print(" Type - (" + Type + "), Value - (" > + + Value + ")") > return [Value, Type] > return ["", ""] > - > + > def main(): > global FileChecker > > fileChecker = FileChecker() > > if (len(sys.argv) != 5) : > - print "usage: PatchBinFv <Target> <SourceRoot> <ReportFile> <FvName>" > + print("usage: PatchBinFv <Target> <SourceRoot> <ReportFile> > + <FvName>") > return 0 > > fileChecker.target = sys.argv[1] > diff --git a/Platform/Intel/MinPlatformPkg/Tools/PatchFv/RebaseBinFv.py > b/Platform/Intel/MinPlatformPkg/Tools/PatchFv/RebaseBinFv.py > index 149630e4ef..2cea491f41 100644 > --- a/Platform/Intel/MinPlatformPkg/Tools/PatchFv/RebaseBinFv.py > +++ b/Platform/Intel/MinPlatformPkg/Tools/PatchFv/RebaseBinFv.py > @@ -1,6 +1,6 @@ > ## @ PatchBinFv.py > # > -# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR> > +# Copyright (c) 2017 - 2023, Intel Corporation. All rights > +reserved.<BR> > # SPDX-License-Identifier: BSD-2-Clause-Patent # > > @@ -10,8 +10,8 @@ import sys > import time > import shutil > import struct > -import binascii > -from ctypes import * > +from ctypes import * > +from functools import reduce > > class GUID(Structure): > _fields_ = [ > @@ -380,9 +380,9 @@ class PeTeImage: > def __init__(self, offset, data): > self.Offset = offset > tehdr = EFI_TE_IMAGE_HEADER.from_buffer (data, 0) > - if tehdr.Signature == 'VZ': # TE image > + if tehdr.Signature == b'VZ': # TE image > self.TeHdr = tehdr > - elif tehdr.Signature == 'MZ': # PE32 image > + elif tehdr.Signature == b'MZ': # PE32 image > self.TeHdr = None > self.DosHdr = EFI_IMAGE_DOS_HEADER.from_buffer (data, 0) > self.PeHdr = EFI_IMAGE_NT_HEADERS32.from_buffer (data, > self.DosHdr.e_lfanew) > @@ -397,7 +397,7 @@ class PeTeImage: > self.RelocList = [] > > def IsTeImage(self): > - return self.TeHdr is not None > + return self.TeHdr is not None > > def ParseReloc(self): > if self.IsTeImage(): > @@ -415,7 +415,7 @@ class PeTeImage: > offset += sizeof(blkhdr) > # Read relocation type,offset pairs > rlen = blkhdr.BlockSize - sizeof(PE_RELOC_BLOCK_HEADER) > - rnum = rlen/sizeof(c_uint16) > + rnum = rlen // sizeof(c_uint16) > rdata = (c_uint16 * rnum).from_buffer(self.Data, offset) > for each in rdata: > roff = each & 0xfff > @@ -532,21 +532,21 @@ class FileChecker: > def IsSyncSection(self, line): > name = self.GetSectionName(line) > for sectionName in self.SyncSectionList: > - if (cmp (sectionName, name) == 0) : > + if sectionName == name: > return True > return False > > def PrintRebasePcd(self, pcd): > - print "PCD: " + pcd[0] + "|" + pcd[3] + " <== " + pcd[1] + "(" + pcd[2] + ")" > + print("PCD: {0} | {3} <== {1}({2})".format(*pcd)) > > def RebaseFv(self, fvName, rebasePcd): > sourceFileName = > os.path.join(self.sourceRoot,fvName,self.target,fvName+".Fv") > - print "rebasing(FV) - " + sourceFileName > + print("rebasing(FV) - " + sourceFileName) > > try : > file = open(sourceFileName, "rb") > except Exception: > - print "fail to open " + sourceFileName > + print("fail to open " + sourceFileName) > return > try: > buffer = file.read() > @@ -554,15 +554,15 @@ class FileChecker: > file.close() > > FvHeader = EFI_FIRMWARE_VOLUME_HEADER.from_buffer (data, 0) > - print "HeaderLength - " + hex(FvHeader.HeaderLength) > - print "ExtHeaderOffset - " + hex(FvHeader.ExtHeaderOffset) > + print("HeaderLength - " + hex(FvHeader.HeaderLength)) > + print("ExtHeaderOffset - " + hex(FvHeader.ExtHeaderOffset)) > > if (FvHeader.ExtHeaderOffset == 0): > Offset = FvHeader.HeaderLength > else: > FvExHeader = > EFI_FIRMWARE_VOLUME_EXT_HEADER.from_buffer(data, > FvHeader.ExtHeaderOffset) > - print " FvName - %08x-%04x-%04x-%02x%02x- > %02x%02x%02x%02x%02x%02x" % (FvExHeader.FvName.Guid1, > FvExHeader.FvName.Guid2, FvExHeader.FvName.Guid3, > FvExHeader.FvName.Guid4[0], FvExHeader.FvName.Guid4[1], > FvExHeader.FvName.Guid4[2], FvExHeader.FvName.Guid4[3], > FvExHeader.FvName.Guid4[4], FvExHeader.FvName.Guid4[5], > FvExHeader.FvName.Guid4[6], FvExHeader.FvName.Guid4[7]) > - print " ExtHeaderSize - " + hex(FvExHeader.ExtHeaderSize) > + print(" FvName - %08x-%04x-%04x-%02x%02x- > %02x%02x%02x%02x%02x%02x" % (FvExHeader.FvName.Guid1, > FvExHeader.FvName.Guid2, FvExHeader.FvName.Guid3, > FvExHeader.FvName.Guid4[0], FvExHeader.FvName.Guid4[1], > FvExHeader.FvName.Guid4[2], FvExHeader.FvName.Guid4[3], > FvExHeader.FvName.Guid4[4], FvExHeader.FvName.Guid4[5], > FvExHeader.FvName.Guid4[6], FvExHeader.FvName.Guid4[7])) > + print(" ExtHeaderSize - " + > + hex(FvExHeader.ExtHeaderSize)) > Offset = FvHeader.ExtHeaderOffset + FvExHeader.ExtHeaderSize > Offset = (Offset + 0x7) & ~0x7 > > @@ -576,20 +576,20 @@ class FileChecker: > if (FfsHeader.Type == 0xFF) or (FfsHeader.Type == > EFI_FV_FILETYPE_FFS_PAD) : > Offset = (FfsOffset + FfsSize + 7) & ~0x7 > continue > - print "Ffs - %08x-%04x-%04x-%02x%02x- > %02x%02x%02x%02x%02x%02x" % (FfsHeader.Name.Guid1, > FfsHeader.Name.Guid2, FfsHeader.Name.Guid3, FfsHeader.Name.Guid4[0], > FfsHeader.Name.Guid4[1], FfsHeader.Name.Guid4[2], FfsHeader.Name.Guid4[3], > FfsHeader.Name.Guid4[4], FfsHeader.Name.Guid4[5], FfsHeader.Name.Guid4[6], > FfsHeader.Name.Guid4[7]) > + print("Ffs - > + %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x" % > + (FfsHeader.Name.Guid1, FfsHeader.Name.Guid2, FfsHeader.Name.Guid3, > + FfsHeader.Name.Guid4[0], FfsHeader.Name.Guid4[1], > + FfsHeader.Name.Guid4[2], FfsHeader.Name.Guid4[3], > + FfsHeader.Name.Guid4[4], FfsHeader.Name.Guid4[5], > + FfsHeader.Name.Guid4[6], FfsHeader.Name.Guid4[7])) > Offset = Offset + sizeof(EFI_FFS_FILE_HEADER) > while (Offset < FfsOffset + FfsSize) : > SectionHeader = EFI_COMMON_SECTION_HEADER.from_buffer > (data, Offset) > #print " Section - " + hex(Offset) > if (SectionHeader.Type == EFI_SECTION_PE32) or (SectionHeader.Type > == EFI_SECTION_TE) : > PeOffset = Offset + sizeof(EFI_COMMON_SECTION_HEADER) > - print " PE - " + hex(PeOffset) + "(" + > binascii.hexlify(data[PeOffset:PeOffset+2]) + ")" > + print(" PE - " + hex(PeOffset) + "(" + > bytes(data[PeOffset:PeOffset+2]).hex() + ")") > > newbase = int(rebasePcd[1],16) > oldbase = int(rebasePcd[3],16) > > delta = newbase - oldbase > - print " delta - " + hex(delta) + "(" + hex(oldbase) + " <== " + > hex(newbase) + ")" > + print(" delta - " + hex(delta) + "(" + hex(oldbase) + " <== " + > hex(newbase) + ")") > > PeLength = FfsSize-sizeof(EFI_FFS_FILE_HEADER); > > @@ -618,26 +618,26 @@ class FileChecker: > > newline = line[:-1].replace('\r','') > > - if (cmp (newline, TargetPkg) == 0): > + if newline == TargetPkg: > FoundPkg = True > continue > > - if (cmp (newline, "") == 0) or ((cmp (newline[0], " ") != 0) and (cmp > (newline[0], "0") != 0)): > + if newline == "" or (newline[0] != " " and newline[0] != "0"): > FoundPkg = False > > if (FoundPkg == True) : > newline = newline.strip() > splitLine = newline.split(" ", 2) > - if (cmp (splitLine[0], "*F") == 0) or (cmp (splitLine[0], "*P") == 0): > - if (cmp (splitLine[1], TargetPcd) == 0): > - print "found - " + TargetPkg + "." + TargetPcd > + if (splitLine[0] == "*F") or (splitLine[0] == "*P"): > + if splitLine[1] == TargetPcd: > + print("found - " + TargetPkg + "." + TargetPcd) > > splitLine = splitLine[2].strip()[1:].strip().split(" ", 1) > - if (cmp (splitLine[0], "FIXED") == 0) or (cmp (splitLine[0], "PATCH") > == 0): > + if splitLine[0] == "FIXED" or splitLine[0] == "PATCH": > SplitLine = splitLine[1].strip()[1:].split(")", 1) > Type = SplitLine[0] > Value = SplitLine[1].strip()[1:].strip().split()[0] > - print " Type - (" + Type + "), Value - (" + Value + ")" > + print(" Type - (" + Type + "), Value - (" > + + Value + ")") > return [Value, Type] > return ["", ""] > > @@ -648,7 +648,7 @@ class FileChecker: > try : > file = open(fileName) > except Exception: > - print "fail to open " + fileName > + print("fail to open " + fileName) > return > try: > while 1: > @@ -658,21 +658,21 @@ class FileChecker: > > newline = line[:-1].replace('\r','') > > - if cmp (newline, "") == 0: > + if newline == "": > continue > > - if cmp (newline, "#![Pcd]") == 0: > + if newline == "#![Pcd]": > ParseBase = True > continue > > if ParseBase == True : > - if (cmp (line[0:2], "#!") != 0) : > + if line[0:2] != "#!": > ParseBase = False > continue > newline = newline[2:].strip() > > splitLine = newline.split("|") > - if cmp (PcdName, splitLine[0]) == 0: > + if PcdName == splitLine[0]: > Value = splitLine[1] > finally: > file.close() > @@ -681,11 +681,11 @@ class FileChecker: > > def SetNewFvBase (self, fvName, PcdName, OldFvBase, NewFvBase): > fileName = os.path.join(self.sourceRoot,fvName,self.target,fvName+".inf") > - print "update - " + fileName > + print("update - " + fileName) > try : > file = open(fileName, "r") > except Exception: > - print "fail to open " + fileName > + print("fail to open " + fileName) > return > try: > lines = file.readlines() > @@ -699,23 +699,23 @@ class FileChecker: > > newline = line[:-1].strip() > > - if cmp (newline, "") == 0: > + if newline == "": > continue > > - if cmp (newline, "#![Pcd]") == 0: > + if newline == "#![Pcd]": > ParseBase = True > continue > > if ParseBase == True : > - if (cmp (line[0:2], "#!") != 0) : > + if line[0:2] != "#!": > ParseBase = False > continue > newline = newline[2:].strip() > > splitLine = newline.split("|") > - if cmp (PcdName, splitLine[0]) == 0: > - if cmp (OldFvBase, splitLine[1]) != 0: > - print "ERROR: OldFvBase mismatch!" > + if PcdName == splitLine[0]: > + if OldFvBase != splitLine[1]: > + print("ERROR: OldFvBase mismatch!") > else: > lines[index] = "#! " + PcdName + "|" + NewFvBase + "\n" > break > @@ -730,11 +730,11 @@ class FileChecker: > try : > file = open(self.reportFile) > except Exception: > - print "fail to open " + self.reportFile > + print("fail to open " + self.reportFile) > return > try: > file.seek(0) > - print "checking - " + self.RebasePcd[0] > + print("checking - " + self.RebasePcd[0]) > ValuePair = self.GetPcdFromReport (file, self.RebasePcd[0]) > self.RebasePcd[1] = ValuePair[0] > self.RebasePcd[2] = ValuePair[1] @@ -747,7 +747,7 @@ def main(): > fileChecker = FileChecker() > > if (len(sys.argv) != 6) : > - print "usage: RebaseBinFv <Target> <SourceRoot> <ReportFile> <FvName> > <RebasePcdName>" > + print("usage: RebaseBinFv <Target> <SourceRoot> <ReportFile> > + <FvName> <RebasePcdName>") > return 0 > > fileChecker.target = sys.argv[1] > -- > 2.39.2.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111787): https://edk2.groups.io/g/devel/message/111787 Mute This Topic: https://groups.io/mt/102842751/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
© 2016 - 2024 Red Hat, Inc.