[edk2-devel] [Patch] IntelFsp2Pkg/Tools: Fixed PatchFv.py to parse new Fv map file format

Bob Feng posted 1 patch 3 years, 5 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/edk2 tags/patchew/20201113135716.159-1-bob.c.feng@intel.com
There is a newer version of this series
IntelFsp2Pkg/Tools/PatchFv.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[edk2-devel] [Patch] IntelFsp2Pkg/Tools: Fixed PatchFv.py to parse new Fv map file format
Posted by Bob Feng 3 years, 5 months ago
The commit 76e8aac158b0717fa27f12e4d008f79161ddb050 changed Fv map format.
It added the image type to better support source level debug. But it broke
the function of PatchFv.py because PatchFv.py also consume Fv map file.

This patch is to update PatchFv.py to make it work again.

Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Yunhua Feng <fengyunhua@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
---
 IntelFsp2Pkg/Tools/PatchFv.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/IntelFsp2Pkg/Tools/PatchFv.py b/IntelFsp2Pkg/Tools/PatchFv.py
index 0c8d908063..f4c390a17b 100644
--- a/IntelFsp2Pkg/Tools/PatchFv.py
+++ b/IntelFsp2Pkg/Tools/PatchFv.py
@@ -361,11 +361,11 @@ class Symbols:
         foundModHdr = False
         while (rptLine != "" ):
             if rptLine[0] != ' ':
                 #DxeIpl (Fixed Flash Address, BaseAddress=0x00fffb4310, EntryPoint=0x00fffb4958)
                 #(GUID=86D70125-BAA3-4296-A62F-602BEBBB9081 .textbaseaddress=0x00fffb4398 .databaseaddress=0x00fffb4178)
-                match = re.match("([_a-zA-Z0-9\-]+)\s\(.+BaseAddress=(0x[0-9a-fA-F]+),\s+EntryPoint=(0x[0-9a-fA-F]+)\)", rptLine)
+                match = re.match("([_a-zA-Z0-9\-]+)\s\(.+BaseAddress=(0x[0-9a-fA-F]+),\s+EntryPoint=(0x[0-9a-fA-F]+),\s*Type=\w+\)", rptLine)
                 if match is not None:
                     foundModHdr = True
                     modName = match.group(1)
                     if len(modName) == 36:
                        modName = self.dictGuidNameXref[modName.upper()]
-- 
2.29.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#67527): https://edk2.groups.io/g/devel/message/67527
Mute This Topic: https://groups.io/mt/78229423/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [Patch] IntelFsp2Pkg/Tools: Fixed PatchFv.py to parse new Fv map file format
Posted by Nate DeSimone 3 years, 5 months ago
Hi Bob,

Does it make sense to have two regular expressions, one for the new format and one for the old format? The user might be using a .map file generated by an older version of BaseTools.

Thanks,
Nate

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Bob
> Feng
> Sent: Friday, November 13, 2020 5:57 AM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L
> <nathaniel.l.desimone@intel.com>; Zeng, Star <star.zeng@intel.com>;
> Yunhua Feng <fengyunhua@byosoft.com.cn>; Liu, Zhiguang
> <zhiguang.liu@intel.com>
> Subject: [edk2-devel] [Patch] IntelFsp2Pkg/Tools: Fixed PatchFv.py to parse
> new Fv map file format
> 
> The commit 76e8aac158b0717fa27f12e4d008f79161ddb050 changed Fv map
> format.
> It added the image type to better support source level debug. But it broke
> the function of PatchFv.py because PatchFv.py also consume Fv map file.
> 
> This patch is to update PatchFv.py to make it work again.
> 
> Signed-off-by: Bob Feng <bob.c.feng@intel.com>
> Cc: Chasel Chiu <chasel.chiu@intel.com>
> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Cc: Yunhua Feng <fengyunhua@byosoft.com.cn>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> ---
>  IntelFsp2Pkg/Tools/PatchFv.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/IntelFsp2Pkg/Tools/PatchFv.py b/IntelFsp2Pkg/Tools/PatchFv.py
> index 0c8d908063..f4c390a17b 100644
> --- a/IntelFsp2Pkg/Tools/PatchFv.py
> +++ b/IntelFsp2Pkg/Tools/PatchFv.py
> @@ -361,11 +361,11 @@ class Symbols:
>          foundModHdr = False         while (rptLine != "" ):             if rptLine[0] != ' ':
> #DxeIpl (Fixed Flash Address, BaseAddress=0x00fffb4310,
> EntryPoint=0x00fffb4958)                 #(GUID=86D70125-BAA3-4296-A62F-
> 602BEBBB9081 .textbaseaddress=0x00fffb4398
> .databaseaddress=0x00fffb4178)-                match = re.match("([_a-zA-Z0-9\-
> ]+)\s\(.+BaseAddress=(0x[0-9a-fA-F]+),\s+EntryPoint=(0x[0-9a-fA-F]+)\)",
> rptLine)+                match = re.match("([_a-zA-Z0-9\-
> ]+)\s\(.+BaseAddress=(0x[0-9a-fA-F]+),\s+EntryPoint=(0x[0-9a-fA-
> F]+),\s*Type=\w+\)", rptLine)                 if match is not None:
> foundModHdr = True                     modName = match.group(1)                     if
> len(modName) == 36:                        modName =
> self.dictGuidNameXref[modName.upper()]--
> 2.29.1.windows.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#67527): https://edk2.groups.io/g/devel/message/67527
> Mute This Topic: https://groups.io/mt/78229423/1767664
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [nathaniel.l.desimone@intel.com] -=-=-=-=-=-=
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#67577): https://edk2.groups.io/g/devel/message/67577
Mute This Topic: https://groups.io/mt/78229423/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [Patch] IntelFsp2Pkg/Tools: Fixed PatchFv.py to parse new Fv map file format
Posted by Nate DeSimone 3 years, 5 months ago
Hi Bob,

Does it make sense to have two regular expressions, one for the new format and one for the old format? The user might be using a .map file generated by an older version of BaseTools.

Thanks,
Nate

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Bob
> Feng
> Sent: Friday, November 13, 2020 5:57 AM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L
> <nathaniel.l.desimone@intel.com>; Zeng, Star <star.zeng@intel.com>;
> Yunhua Feng <fengyunhua@byosoft.com.cn>; Liu, Zhiguang
> <zhiguang.liu@intel.com>
> Subject: [edk2-devel] [Patch] IntelFsp2Pkg/Tools: Fixed PatchFv.py to parse
> new Fv map file format
> 
> The commit 76e8aac158b0717fa27f12e4d008f79161ddb050 changed Fv map
> format.
> It added the image type to better support source level debug. But it broke
> the function of PatchFv.py because PatchFv.py also consume Fv map file.
> 
> This patch is to update PatchFv.py to make it work again.
> 
> Signed-off-by: Bob Feng <bob.c.feng@intel.com>
> Cc: Chasel Chiu <chasel.chiu@intel.com>
> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Cc: Yunhua Feng <fengyunhua@byosoft.com.cn>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> ---
>  IntelFsp2Pkg/Tools/PatchFv.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/IntelFsp2Pkg/Tools/PatchFv.py b/IntelFsp2Pkg/Tools/PatchFv.py
> index 0c8d908063..f4c390a17b 100644
> --- a/IntelFsp2Pkg/Tools/PatchFv.py
> +++ b/IntelFsp2Pkg/Tools/PatchFv.py
> @@ -361,11 +361,11 @@ class Symbols:
>          foundModHdr = False         while (rptLine != "" ):             if rptLine[0] != ' ':
> #DxeIpl (Fixed Flash Address, BaseAddress=0x00fffb4310,
> EntryPoint=0x00fffb4958)                 #(GUID=86D70125-BAA3-4296-A62F-
> 602BEBBB9081 .textbaseaddress=0x00fffb4398
> .databaseaddress=0x00fffb4178)-                match = re.match("([_a-zA-Z0-9\-
> ]+)\s\(.+BaseAddress=(0x[0-9a-fA-F]+),\s+EntryPoint=(0x[0-9a-fA-F]+)\)",
> rptLine)+                match = re.match("([_a-zA-Z0-9\-
> ]+)\s\(.+BaseAddress=(0x[0-9a-fA-F]+),\s+EntryPoint=(0x[0-9a-fA-
> F]+),\s*Type=\w+\)", rptLine)                 if match is not None:
> foundModHdr = True                     modName = match.group(1)                     if
> len(modName) == 36:                        modName =
> self.dictGuidNameXref[modName.upper()]--
> 2.29.1.windows.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#67527): https://edk2.groups.io/g/devel/message/67527
> Mute This Topic: https://groups.io/mt/78229423/1767664
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [nathaniel.l.desimone@intel.com] -=-=-=-=-=-=
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#67578): https://edk2.groups.io/g/devel/message/67578
Mute This Topic: https://groups.io/mt/78229423/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-