[edk2-devel] [Patch V2] 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/20201116022422.1597-1-bob.c.feng@intel.com
IntelFsp2Pkg/Tools/PatchFv.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
[edk2-devel] [Patch V2] 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>
---
V2: Support both the old Fv map file format and new Fv map file format.

 IntelFsp2Pkg/Tools/PatchFv.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/IntelFsp2Pkg/Tools/PatchFv.py b/IntelFsp2Pkg/Tools/PatchFv.py
index 0c8d908063..112de4077a 100644
--- a/IntelFsp2Pkg/Tools/PatchFv.py
+++ b/IntelFsp2Pkg/Tools/PatchFv.py
@@ -359,20 +359,23 @@ class Symbols:
         rptLine  = fdIn.readline()
         modName  = ""
         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)
+                #DxeIpl (Fixed Flash Address, BaseAddress=0x00fffb4310, EntryPoint=0x00fffb4958,Type=PE)
+                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 None:
+                    #DxeIpl (Fixed Flash Address, BaseAddress=0x00fffb4310, EntryPoint=0x00fffb4958)
+                    match = re.match("([_a-zA-Z0-9\-]+)\s\(.+BaseAddress=(0x[0-9a-fA-F]+),\s+EntryPoint=(0x[0-9a-fA-F]+)\)", rptLine)
                 if match is not None:
                     foundModHdr = True
                     modName = match.group(1)
                     if len(modName) == 36:
                        modName = self.dictGuidNameXref[modName.upper()]
                     self.dictModBase['%s:BASE'  % modName] = int (match.group(2), 16)
                     self.dictModBase['%s:ENTRY' % modName] = int (match.group(3), 16)
+                #(GUID=86D70125-BAA3-4296-A62F-602BEBBB9081 .textbaseaddress=0x00fffb4398 .databaseaddress=0x00fffb4178)
                 match = re.match("\(GUID=([A-Z0-9\-]+)\s+\.textbaseaddress=(0x[0-9a-fA-F]+)\s+\.databaseaddress=(0x[0-9a-fA-F]+)\)", rptLine)
                 if match is not None:
                     if foundModHdr:
                         foundModHdr = False
                     else:
-- 
2.29.1.windows.1



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


Re: [edk2-devel] [Patch V2] IntelFsp2Pkg/Tools: Fixed PatchFv.py to parse new Fv map file format
Posted by Zeng, Star 3 years, 5 months ago
Reviewed-by: Star Zeng <star.zeng@intel.com> with a very minor comment inline.

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Bob
> Feng
> Sent: Monday, November 16, 2020 10:24 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 V2] 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>
> ---
> 
> V2: Support both the old Fv map file format and new Fv map file format.
> 
> 
>  IntelFsp2Pkg/Tools/PatchFv.py | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/IntelFsp2Pkg/Tools/PatchFv.py b/IntelFsp2Pkg/Tools/PatchFv.py
> index 0c8d908063..112de4077a 100644
> --- a/IntelFsp2Pkg/Tools/PatchFv.py
> +++ b/IntelFsp2Pkg/Tools/PatchFv.py
> @@ -359,20 +359,23 @@ class Symbols:
>          rptLine  = fdIn.readline()
> 
>          modName  = ""
> 
>          foundModHdr = False
> 
>          while (rptLine != "" ):
> 
>              if rptLine[0] != ' ':
> 
> -                #DxeIpl (Fixed Flash Address, BaseAddress=0x00fffb4310,
> EntryPoint=0x00fffb4958)
> 
> -                #(GUID=86D70125-BAA3-4296-A62F-
> 602BEBBB9081 .textbaseaddress=0x00fffb4398 .databaseaddress=0x00fffb41
> 78)
> 
> -                match = re.match("([_a-zA-Z0-9\-]+)\s\(.+BaseAddress=(0x[0-9a-fA-
> F]+),\s+EntryPoint=(0x[0-9a-fA-F]+)\)", rptLine)
> 
> +                #DxeIpl (Fixed Flash Address, BaseAddress=0x00fffb4310,
> EntryPoint=0x00fffb4958,Type=PE)
> 
> +                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 None:
> 
> +                    #DxeIpl (Fixed Flash Address, BaseAddress=0x00fffb4310,
> EntryPoint=0x00fffb4958)
> 
> +                    match = re.match("([_a-zA-Z0-9\-]+)\s\(.+BaseAddress=(0x[0-9a-
> fA-F]+),\s+EntryPoint=(0x[0-9a-fA-F]+)\)", rptLine)
> 
>                  if match is not None:

Could here use 'else' ?

Thanks,
Star

> 
>                      foundModHdr = True
> 
>                      modName = match.group(1)
> 
>                      if len(modName) == 36:
> 
>                         modName = self.dictGuidNameXref[modName.upper()]
> 
>                      self.dictModBase['%s:BASE'  % modName] = int (match.group(2),
> 16)
> 
>                      self.dictModBase['%s:ENTRY' % modName] = int (match.group(3),
> 16)
> 
> +                #(GUID=86D70125-BAA3-4296-A62F-
> 602BEBBB9081 .textbaseaddress=0x00fffb4398 .databaseaddress=0x00fffb41
> 78)
> 
>                  match = re.match("\(GUID=([A-Z0-9\-
> ]+)\s+\.textbaseaddress=(0x[0-9a-fA-F]+)\s+\.databaseaddress=(0x[0-9a-fA-
> F]+)\)", rptLine)
> 
>                  if match is not None:
> 
>                      if foundModHdr:
> 
>                          foundModHdr = False
> 
>                      else:
> 
> --
> 2.29.1.windows.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#67597): https://edk2.groups.io/g/devel/message/67597
> Mute This Topic: https://groups.io/mt/78284512/1779220
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [star.zeng@intel.com]
> -=-=-=-=-=-=
> 



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


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

Thanks for review. This patch try to match the new .map file format, if not match, it will try to match the old format and then do the original logic. I think it would be better not changing the original logic in this patch.

Thanks,
Bob

-----Original Message-----
From: Zeng, Star <star.zeng@intel.com> 
Sent: Wednesday, November 18, 2020 10:24 AM
To: devel@edk2.groups.io; Feng, Bob C <bob.c.feng@intel.com>
Cc: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Yunhua Feng <fengyunhua@byosoft.com.cn>; Liu, Zhiguang <zhiguang.liu@intel.com>; Zeng, Star <star.zeng@intel.com>
Subject: RE: [edk2-devel] [Patch V2] IntelFsp2Pkg/Tools: Fixed PatchFv.py to parse new Fv map file format

Reviewed-by: Star Zeng <star.zeng@intel.com> with a very minor comment inline.

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Bob 
> Feng
> Sent: Monday, November 16, 2020 10:24 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 V2] 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>
> ---
> 
> V2: Support both the old Fv map file format and new Fv map file format.
> 
> 
>  IntelFsp2Pkg/Tools/PatchFv.py | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/IntelFsp2Pkg/Tools/PatchFv.py 
> b/IntelFsp2Pkg/Tools/PatchFv.py index 0c8d908063..112de4077a 100644
> --- a/IntelFsp2Pkg/Tools/PatchFv.py
> +++ b/IntelFsp2Pkg/Tools/PatchFv.py
> @@ -359,20 +359,23 @@ class Symbols:
>          rptLine  = fdIn.readline()
> 
>          modName  = ""
> 
>          foundModHdr = False
> 
>          while (rptLine != "" ):
> 
>              if rptLine[0] != ' ':
> 
> -                #DxeIpl (Fixed Flash Address, BaseAddress=0x00fffb4310,
> EntryPoint=0x00fffb4958)
> 
> -                #(GUID=86D70125-BAA3-4296-A62F-
> 602BEBBB9081 .textbaseaddress=0x00fffb4398 .databaseaddress=0x00fffb41
> 78)
> 
> -                match = re.match("([_a-zA-Z0-9\-]+)\s\(.+BaseAddress=(0x[0-9a-fA-
> F]+),\s+EntryPoint=(0x[0-9a-fA-F]+)\)", rptLine)
> 
> +                #DxeIpl (Fixed Flash Address, 
> + BaseAddress=0x00fffb4310,
> EntryPoint=0x00fffb4958,Type=PE)
> 
> +                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 None:
> 
> +                    #DxeIpl (Fixed Flash Address, 
> + BaseAddress=0x00fffb4310,
> EntryPoint=0x00fffb4958)
> 
> +                    match = 
> + re.match("([_a-zA-Z0-9\-]+)\s\(.+BaseAddress=(0x[0-9a-
> fA-F]+),\s+EntryPoint=(0x[0-9a-fA-F]+)\)", rptLine)
> 
>                  if match is not None:

Could here use 'else' ?

Thanks,
Star

> 
>                      foundModHdr = True
> 
>                      modName = match.group(1)
> 
>                      if len(modName) == 36:
> 
>                         modName = 
> self.dictGuidNameXref[modName.upper()]
> 
>                      self.dictModBase['%s:BASE'  % modName] = int 
> (match.group(2),
> 16)
> 
>                      self.dictModBase['%s:ENTRY' % modName] = int 
> (match.group(3),
> 16)
> 
> +                #(GUID=86D70125-BAA3-4296-A62F-
> 602BEBBB9081 .textbaseaddress=0x00fffb4398 .databaseaddress=0x00fffb41
> 78)
> 
>                  match = re.match("\(GUID=([A-Z0-9\-
> ]+)\s+\.textbaseaddress=(0x[0-9a-fA-F]+)\s+\.databaseaddress=(0x[0-9a-
> fA-
> F]+)\)", rptLine)
> 
>                  if match is not None:
> 
>                      if foundModHdr:
> 
>                          foundModHdr = False
> 
>                      else:
> 
> --
> 2.29.1.windows.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#67597): 
> https://edk2.groups.io/g/devel/message/67597
> Mute This Topic: https://groups.io/mt/78284512/1779220
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub 
> [star.zeng@intel.com] -=-=-=-=-=-=
> 



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


Re: [edk2-devel] [Patch V2] IntelFsp2Pkg/Tools: Fixed PatchFv.py to parse new Fv map file format
Posted by Zeng, Star 3 years, 5 months ago
Oh, get the point.

-----Original Message-----
From: Feng, Bob C <bob.c.feng@intel.com> 
Sent: Wednesday, November 18, 2020 10:41 AM
To: Zeng, Star <star.zeng@intel.com>; devel@edk2.groups.io
Cc: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Yunhua Feng <fengyunhua@byosoft.com.cn>; Liu, Zhiguang <zhiguang.liu@intel.com>
Subject: RE: [edk2-devel] [Patch V2] IntelFsp2Pkg/Tools: Fixed PatchFv.py to parse new Fv map file format

Star, 

Thanks for review. This patch try to match the new .map file format, if not match, it will try to match the old format and then do the original logic. I think it would be better not changing the original logic in this patch.

Thanks,
Bob

-----Original Message-----
From: Zeng, Star <star.zeng@intel.com>
Sent: Wednesday, November 18, 2020 10:24 AM
To: devel@edk2.groups.io; Feng, Bob C <bob.c.feng@intel.com>
Cc: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Yunhua Feng <fengyunhua@byosoft.com.cn>; Liu, Zhiguang <zhiguang.liu@intel.com>; Zeng, Star <star.zeng@intel.com>
Subject: RE: [edk2-devel] [Patch V2] IntelFsp2Pkg/Tools: Fixed PatchFv.py to parse new Fv map file format

Reviewed-by: Star Zeng <star.zeng@intel.com> with a very minor comment inline.

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Bob 
> Feng
> Sent: Monday, November 16, 2020 10:24 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 V2] 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>
> ---
> 
> V2: Support both the old Fv map file format and new Fv map file format.
> 
> 
>  IntelFsp2Pkg/Tools/PatchFv.py | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/IntelFsp2Pkg/Tools/PatchFv.py 
> b/IntelFsp2Pkg/Tools/PatchFv.py index 0c8d908063..112de4077a 100644
> --- a/IntelFsp2Pkg/Tools/PatchFv.py
> +++ b/IntelFsp2Pkg/Tools/PatchFv.py
> @@ -359,20 +359,23 @@ class Symbols:
>          rptLine  = fdIn.readline()
> 
>          modName  = ""
> 
>          foundModHdr = False
> 
>          while (rptLine != "" ):
> 
>              if rptLine[0] != ' ':
> 
> -                #DxeIpl (Fixed Flash Address, BaseAddress=0x00fffb4310,
> EntryPoint=0x00fffb4958)
> 
> -                #(GUID=86D70125-BAA3-4296-A62F-
> 602BEBBB9081 .textbaseaddress=0x00fffb4398 .databaseaddress=0x00fffb41
> 78)
> 
> -                match = re.match("([_a-zA-Z0-9\-]+)\s\(.+BaseAddress=(0x[0-9a-fA-
> F]+),\s+EntryPoint=(0x[0-9a-fA-F]+)\)", rptLine)
> 
> +                #DxeIpl (Fixed Flash Address, 
> + BaseAddress=0x00fffb4310,
> EntryPoint=0x00fffb4958,Type=PE)
> 
> +                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 None:
> 
> +                    #DxeIpl (Fixed Flash Address, 
> + BaseAddress=0x00fffb4310,
> EntryPoint=0x00fffb4958)
> 
> +                    match =
> + re.match("([_a-zA-Z0-9\-]+)\s\(.+BaseAddress=(0x[0-9a-
> fA-F]+),\s+EntryPoint=(0x[0-9a-fA-F]+)\)", rptLine)
> 
>                  if match is not None:

Could here use 'else' ?

Thanks,
Star

> 
>                      foundModHdr = True
> 
>                      modName = match.group(1)
> 
>                      if len(modName) == 36:
> 
>                         modName =
> self.dictGuidNameXref[modName.upper()]
> 
>                      self.dictModBase['%s:BASE'  % modName] = int 
> (match.group(2),
> 16)
> 
>                      self.dictModBase['%s:ENTRY' % modName] = int 
> (match.group(3),
> 16)
> 
> +                #(GUID=86D70125-BAA3-4296-A62F-
> 602BEBBB9081 .textbaseaddress=0x00fffb4398 .databaseaddress=0x00fffb41
> 78)
> 
>                  match = re.match("\(GUID=([A-Z0-9\-
> ]+)\s+\.textbaseaddress=(0x[0-9a-fA-F]+)\s+\.databaseaddress=(0x[0-9a-
> fA-
> F]+)\)", rptLine)
> 
>                  if match is not None:
> 
>                      if foundModHdr:
> 
>                          foundModHdr = False
> 
>                      else:
> 
> --
> 2.29.1.windows.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#67597): 
> https://edk2.groups.io/g/devel/message/67597
> Mute This Topic: https://groups.io/mt/78284512/1779220
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [star.zeng@intel.com] -=-=-=-=-=-=
> 



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


回复: [edk2-devel] [Patch V2] IntelFsp2Pkg/Tools: Fixed PatchFv.py to parse new Fv map file format
Posted by gaoliming 3 years, 5 months ago
Bob:
  Thanks for your fix. This is a regression bug. I request to merge it for
this stable tag. Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>

Thanks
Liming
> -----邮件原件-----
> 发件人: bounce+27952+67670+4905953+8761045@groups.io
> <bounce+27952+67670+4905953+8761045@groups.io> 代表 Zeng, Star
> 发送时间: 2020年11月18日 11:48
> 收件人: Feng, Bob C <bob.c.feng@intel.com>; devel@edk2.groups.io
> 抄送: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L
> <nathaniel.l.desimone@intel.com>; Yunhua Feng
> <fengyunhua@byosoft.com.cn>; Liu, Zhiguang <zhiguang.liu@intel.com>;
> Zeng, Star <star.zeng@intel.com>
> 主题: Re: [edk2-devel] [Patch V2] IntelFsp2Pkg/Tools: Fixed PatchFv.py to
> parse new Fv map file format
> 
> Oh, get the point.
> 
> -----Original Message-----
> From: Feng, Bob C <bob.c.feng@intel.com>
> Sent: Wednesday, November 18, 2020 10:41 AM
> To: Zeng, Star <star.zeng@intel.com>; devel@edk2.groups.io
> Cc: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L
> <nathaniel.l.desimone@intel.com>; Yunhua Feng
> <fengyunhua@byosoft.com.cn>; Liu, Zhiguang <zhiguang.liu@intel.com>
> Subject: RE: [edk2-devel] [Patch V2] IntelFsp2Pkg/Tools: Fixed PatchFv.py
to
> parse new Fv map file format
> 
> Star,
> 
> Thanks for review. This patch try to match the new .map file format, if
not
> match, it will try to match the old format and then do the original logic.
I think
> it would be better not changing the original logic in this patch.
> 
> Thanks,
> Bob
> 
> -----Original Message-----
> From: Zeng, Star <star.zeng@intel.com>
> Sent: Wednesday, November 18, 2020 10:24 AM
> To: devel@edk2.groups.io; Feng, Bob C <bob.c.feng@intel.com>
> Cc: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L
> <nathaniel.l.desimone@intel.com>; Yunhua Feng
> <fengyunhua@byosoft.com.cn>; Liu, Zhiguang <zhiguang.liu@intel.com>;
> Zeng, Star <star.zeng@intel.com>
> Subject: RE: [edk2-devel] [Patch V2] IntelFsp2Pkg/Tools: Fixed PatchFv.py
to
> parse new Fv map file format
> 
> Reviewed-by: Star Zeng <star.zeng@intel.com> with a very minor comment
> inline.
> 
> > -----Original Message-----
> > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Bob
> > Feng
> > Sent: Monday, November 16, 2020 10:24 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 V2] 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>
> > ---
> >
> > V2: Support both the old Fv map file format and new Fv map file format.
> >
> >
> >  IntelFsp2Pkg/Tools/PatchFv.py | 9 ++++++---
> >  1 file changed, 6 insertions(+), 3 deletions(-)
> >
> > diff --git a/IntelFsp2Pkg/Tools/PatchFv.py
> > b/IntelFsp2Pkg/Tools/PatchFv.py index 0c8d908063..112de4077a 100644
> > --- a/IntelFsp2Pkg/Tools/PatchFv.py
> > +++ b/IntelFsp2Pkg/Tools/PatchFv.py
> > @@ -359,20 +359,23 @@ class Symbols:
> >          rptLine  = fdIn.readline()
> >
> >          modName  = ""
> >
> >          foundModHdr = False
> >
> >          while (rptLine != "" ):
> >
> >              if rptLine[0] != ' ':
> >
> > -                #DxeIpl (Fixed Flash Address,
> BaseAddress=0x00fffb4310,
> > EntryPoint=0x00fffb4958)
> >
> > -                #(GUID=86D70125-BAA3-4296-A62F-
> >
> 602BEBBB9081 .textbaseaddress=0x00fffb4398 .databaseaddress=0x00fffb41
> > 78)
> >
> > -                match =
> re.match("([_a-zA-Z0-9\-]+)\s\(.+BaseAddress=(0x[0-9a-fA-
> > F]+),\s+EntryPoint=(0x[0-9a-fA-F]+)\)", rptLine)
> >
> > +                #DxeIpl (Fixed Flash Address,
> > + BaseAddress=0x00fffb4310,
> > EntryPoint=0x00fffb4958,Type=PE)
> >
> > +                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 None:
> >
> > +                    #DxeIpl (Fixed Flash Address,
> > + BaseAddress=0x00fffb4310,
> > EntryPoint=0x00fffb4958)
> >
> > +                    match =
> > + re.match("([_a-zA-Z0-9\-]+)\s\(.+BaseAddress=(0x[0-9a-
> > fA-F]+),\s+EntryPoint=(0x[0-9a-fA-F]+)\)", rptLine)
> >
> >                  if match is not None:
> 
> Could here use 'else' ?
> 
> Thanks,
> Star
> 
> >
> >                      foundModHdr = True
> >
> >                      modName = match.group(1)
> >
> >                      if len(modName) == 36:
> >
> >                         modName =
> > self.dictGuidNameXref[modName.upper()]
> >
> >                      self.dictModBase['%s:BASE'  % modName] = int
> > (match.group(2),
> > 16)
> >
> >                      self.dictModBase['%s:ENTRY' % modName] = int
> > (match.group(3),
> > 16)
> >
> > +                #(GUID=86D70125-BAA3-4296-A62F-
> >
> 602BEBBB9081 .textbaseaddress=0x00fffb4398 .databaseaddress=0x00fffb41
> > 78)
> >
> >                  match = re.match("\(GUID=([A-Z0-9\-
> > ]+)\s+\.textbaseaddress=(0x[0-9a-fA-F]+)\s+\.databaseaddress=(0x[0-9a-
> > fA-
> > F]+)\)", rptLine)
> >
> >                  if match is not None:
> >
> >                      if foundModHdr:
> >
> >                          foundModHdr = False
> >
> >                      else:
> >
> > --
> > 2.29.1.windows.1
> >
> >
> >
> > -=-=-=-=-=-=
> > Groups.io Links: You receive all messages sent to this group.
> > View/Reply Online (#67597):
> > https://edk2.groups.io/g/devel/message/67597
> > Mute This Topic: https://groups.io/mt/78284512/1779220
> > Group Owner: devel+owner@edk2.groups.io
> > Unsubscribe: https://edk2.groups.io/g/devel/unsub
> > [star.zeng@intel.com] -=-=-=-=-=-=
> >
> 
> 
> 
> 
> 





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


Re: [edk2-devel] [Patch V2] IntelFsp2Pkg/Tools: Fixed PatchFv.py to parse new Fv map file format
Posted by Chiu, Chasel 3 years, 5 months ago
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Bob Feng
> Sent: Monday, November 16, 2020 10:24 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 V2] 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>
> ---V2: Support both the old Fv map file format and new Fv map file format.
>  IntelFsp2Pkg/Tools/PatchFv.py | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/IntelFsp2Pkg/Tools/PatchFv.py b/IntelFsp2Pkg/Tools/PatchFv.py
> index 0c8d908063..112de4077a 100644
> --- a/IntelFsp2Pkg/Tools/PatchFv.py
> +++ b/IntelFsp2Pkg/Tools/PatchFv.py
> @@ -359,20 +359,23 @@ class Symbols:
>          rptLine  = fdIn.readline()         modName  = ""         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)+                #DxeIpl (Fixed Flash
> Address, BaseAddress=0x00fffb4310, EntryPoint=0x00fffb4958,Type=PE)+
> 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 None:+                    #DxeIpl (Fixed Flash Address, BaseAddress=0x00fffb4310,
> EntryPoint=0x00fffb4958)+                    match = re.match("([_a-zA-Z0-9\-
> ]+)\s\(.+BaseAddress=(0x[0-9a-fA-F]+),\s+EntryPoint=(0x[0-9a-fA-F]+)\)", rptLine)
> if match is not None:                     foundModHdr = True                     modName =
> match.group(1)                     if len(modName) == 36:                        modName =
> self.dictGuidNameXref[modName.upper()]
> self.dictModBase['%s:BASE'  % modName] = int (match.group(2), 16)
> self.dictModBase['%s:ENTRY' % modName] = int (match.group(3), 16)+
> #(GUID=86D70125-BAA3-4296-A62F-
> 602BEBBB9081 .textbaseaddress=0x00fffb4398 .databaseaddress=0x00fffb4178)
> match = re.match("\(GUID=([A-Z0-9\-]+)\s+\.textbaseaddress=(0x[0-9a-fA-
> F]+)\s+\.databaseaddress=(0x[0-9a-fA-F]+)\)", rptLine)                 if match is not
> None:                     if foundModHdr:                         foundModHdr = False
> else:--
> 2.29.1.windows.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#67597): https://edk2.groups.io/g/devel/message/67597
> Mute This Topic: https://groups.io/mt/78284512/1777047
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [chasel.chiu@intel.com] -=-
> =-=-=-=-=
> 



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


Re: [edk2-devel] [Patch V2] IntelFsp2Pkg/Tools: Fixed PatchFv.py to parse new Fv map file format
Posted by Bob Feng 3 years, 5 months ago
I created a PR. https://github.com/tianocore/edk2/pull/1135

-----Original Message-----
From: Chiu, Chasel <chasel.chiu@intel.com> 
Sent: Thursday, November 19, 2020 2:24 PM
To: devel@edk2.groups.io; Feng, Bob C <bob.c.feng@intel.com>
Cc: 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: RE: [edk2-devel] [Patch V2] IntelFsp2Pkg/Tools: Fixed PatchFv.py to parse new Fv map file format


Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Bob 
> Feng
> Sent: Monday, November 16, 2020 10:24 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 V2] 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>
> ---V2: Support both the old Fv map file format and new Fv map file format.
>  IntelFsp2Pkg/Tools/PatchFv.py | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/IntelFsp2Pkg/Tools/PatchFv.py 
> b/IntelFsp2Pkg/Tools/PatchFv.py index 0c8d908063..112de4077a 100644
> --- a/IntelFsp2Pkg/Tools/PatchFv.py
> +++ b/IntelFsp2Pkg/Tools/PatchFv.py
> @@ -359,20 +359,23 @@ class Symbols:
>          rptLine  = fdIn.readline()         modName  = ""         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)+                #DxeIpl (Fixed Flash
> Address, BaseAddress=0x00fffb4310, EntryPoint=0x00fffb4958,Type=PE)+ 
> 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 None:+                    #DxeIpl (Fixed Flash Address, BaseAddress=0x00fffb4310,
> EntryPoint=0x00fffb4958)+                    match = re.match("([_a-zA-Z0-9\-
> ]+)\s\(.+BaseAddress=(0x[0-9a-fA-F]+),\s+EntryPoint=(0x[0-9a-fA-F]+)\)", rptLine)
> if match is not None:                     foundModHdr = True                     modName =
> match.group(1)                     if len(modName) == 36:                        modName =
> self.dictGuidNameXref[modName.upper()]
> self.dictModBase['%s:BASE'  % modName] = int (match.group(2), 16) 
> self.dictModBase['%s:ENTRY' % modName] = int (match.group(3), 16)+
> #(GUID=86D70125-BAA3-4296-A62F-
> 602BEBBB9081 .textbaseaddress=0x00fffb4398 
> .databaseaddress=0x00fffb4178) match = re.match("\(GUID=([A-Z0-9\-]+)\s+\.textbaseaddress=(0x[0-9a-fA-
> F]+)\s+\.databaseaddress=(0x[0-9a-fA-F]+)\)", rptLine)                 if match is not
> None:                     if foundModHdr:                         foundModHdr = False
> else:--
> 2.29.1.windows.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#67597): 
> https://edk2.groups.io/g/devel/message/67597
> Mute This Topic: https://groups.io/mt/78284512/1777047
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub 
> [chasel.chiu@intel.com] -=- =-=-=-=-=
> 



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