[edk2-devel] [Patch] [edk2-staging]BaseTools/Fmmt: Fixed FMMT Linux build break issue

Bob Feng posted 1 patch 1 week ago
Failed in applying to current master (apply log)
.../Source/C/FMMT/FirmwareModuleManagement.c      | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)

[edk2-devel] [Patch] [edk2-staging]BaseTools/Fmmt: Fixed FMMT Linux build break issue

Posted by Bob Feng 1 week ago
Fixed the FMMT Linux build issue which was introduced
by the commit 950333853b5fe2b73a7b5148501458cc97a01481

Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Yunhua Feng <fengyunhua@byosoft.com.cn>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
---
 .../Source/C/FMMT/FirmwareModuleManagement.c      | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c b/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c
index 20663ba163..8a7ae096d0 100644
--- a/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c
+++ b/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c
@@ -9,11 +9,14 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 #include "FirmwareModuleManagement.h"
 #include "Rebase.h"
 #include <stdlib.h>
 #include <wchar.h>
-
+#if defined(__linux__)
+#include <limits.h>
+#define _MAX_DIR PATH_MAX
+#endif
 CHAR8*      mGuidToolDefinition     = "FmmtConf.ini";
 extern EFI_FIRMWARE_VOLUME_HEADER  *mFvHeader;
 extern UINT32                      mFvLength;
 
 //
@@ -1715,15 +1718,10 @@ FmmtImageExtract (
   EFI_STATUS                  Status;
   FIRMWARE_DEVICE             *FdData;
   FV_INFORMATION              *FvInFd;
   UINT32                      Index;
   UINT32                      FfsFoundFlag;
-  FFS_INFORMATION             *OutputFileName;
-  FILE*                       NewFdFile;
-  FILE*                       NewFvFile;
-  UINT64                      NewFvLength;
-  VOID*                       Buffer;
   CHAR8                       *TemDir;
   UINT8                       FvNumInFd;
   UINT32                      Offset;
   UINT8                       *FdBuffer;
   EFI_FFS_FILE_HEADER2        *CurrentFile;
@@ -1738,18 +1736,13 @@ FmmtImageExtract (
   int                         j;
   CHAR8                       FfsOutputFileName[_MAX_DIR];
 
   FdSize                      = 0;
   Index                       = 0;
-  NewFvLength                 = 0;
   FfsFoundFlag                = 0;
   FdData                      = NULL;
   FvInFd                      = NULL;
-  OutputFileName              = NULL;
-  NewFdFile                   = NULL;
-  NewFvFile                   = NULL;
-  Buffer                      = NULL;
   TemDir                      = NULL;
   FvNumInFd                   = 0;
   Offset                      = 0;
   FdBuffer                    = NULL;
   if (sizeof(FfsOutFileOrDirName) > _MAX_DIR) {
-- 
2.20.1.windows.1



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


回复: [edk2-devel] [Patch] [edk2-staging]BaseTools/Fmmt: Fixed FMMT Linux build break issue

Posted by gaoliming 1 week ago
Bob:
  I add my comments. 

Thanks
Liming
> -----邮件原件-----
> 发件人: bounce+27952+66170+4905953+8761045@groups.io
> <bounce+27952+66170+4905953+8761045@groups.io> 代表 Bob Feng
> 发送时间: 2020年10月13日 17:21
> 收件人: devel@edk2.groups.io
> 抄送: Yunhua Feng <fengyunhua@byosoft.com.cn>; Liming Gao
> <gaoliming@byosoft.com.cn>
> 主题: [edk2-devel] [Patch] [edk2-staging]BaseTools/Fmmt: Fixed FMMT Linux
> build break issue
> 
> Fixed the FMMT Linux build issue which was introduced
> by the commit 950333853b5fe2b73a7b5148501458cc97a01481
> 
> Signed-off-by: Bob Feng <bob.c.feng@intel.com>
> Cc: Yunhua Feng <fengyunhua@byosoft.com.cn>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> ---
>  .../Source/C/FMMT/FirmwareModuleManagement.c      | 15
> ++++-----------
>  1 file changed, 4 insertions(+), 11 deletions(-)
> 
> diff --git a/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c
> b/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c
> index 20663ba163..8a7ae096d0 100644
> --- a/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c
> +++ b/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c
> @@ -9,11 +9,14 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  #include "FirmwareModuleManagement.h"
>  #include "Rebase.h"
>  #include <stdlib.h>
>  #include <wchar.h>
> -
> +#if defined(__linux__)
> +#include <limits.h>

What's purpose for the header file limits.h?

> +#define _MAX_DIR PATH_MAX

Can you use _MAX_PATH in the code to replace _MAX_DIR? _MAX_PATH is defined
here. 

Thanks
Liming
> +#endif
>  CHAR8*      mGuidToolDefinition     = "FmmtConf.ini";
>  extern EFI_FIRMWARE_VOLUME_HEADER  *mFvHeader;
>  extern UINT32                      mFvLength;
> 
>  //
> @@ -1715,15 +1718,10 @@ FmmtImageExtract (
>    EFI_STATUS                  Status;
>    FIRMWARE_DEVICE             *FdData;
>    FV_INFORMATION              *FvInFd;
>    UINT32                      Index;
>    UINT32                      FfsFoundFlag;
> -  FFS_INFORMATION             *OutputFileName;
> -  FILE*                       NewFdFile;
> -  FILE*                       NewFvFile;
> -  UINT64                      NewFvLength;
> -  VOID*                       Buffer;
>    CHAR8                       *TemDir;
>    UINT8                       FvNumInFd;
>    UINT32                      Offset;
>    UINT8                       *FdBuffer;
>    EFI_FFS_FILE_HEADER2        *CurrentFile;
> @@ -1738,18 +1736,13 @@ FmmtImageExtract (
>    int                         j;
>    CHAR8                       FfsOutputFileName[_MAX_DIR];
> 
>    FdSize                      = 0;
>    Index                       = 0;
> -  NewFvLength                 = 0;
>    FfsFoundFlag                = 0;
>    FdData                      = NULL;
>    FvInFd                      = NULL;
> -  OutputFileName              = NULL;
> -  NewFdFile                   = NULL;
> -  NewFvFile                   = NULL;
> -  Buffer                      = NULL;
>    TemDir                      = NULL;
>    FvNumInFd                   = 0;
>    Offset                      = 0;
>    FdBuffer                    = NULL;
>    if (sizeof(FfsOutFileOrDirName) > _MAX_DIR) {
> --
> 2.20.1.windows.1
> 
> 
> 
> 
> 





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


Re: [edk2-devel] [Patch] [edk2-staging]BaseTools/Fmmt: Fixed FMMT Linux build break issue

Posted by Bob Feng 1 week ago
Hi Liming,

What's purpose for the header file limits.h?
Bob: To get the Macro PATH_MAX definition. There is no _MAX_DIR or _MAX_PATH Macro on Linux.

Can you use _MAX_PATH in the code to replace _MAX_DIR? _MAX_PATH is defined here.
Bob: The original code use _MAX_DIR. It does not cause the build break.  If you and Yunhua confirm there should be _MAX_PATH, I can create another patch to change the _MAX_DIR to _MAX_PATH

Thanks,
Bob

-----Original Message-----
From: gaoliming <gaoliming@byosoft.com.cn> 
Sent: Tuesday, October 13, 2020 6:01 PM
To: devel@edk2.groups.io; Feng, Bob C <bob.c.feng@intel.com>
Cc: 'Yunhua Feng' <fengyunhua@byosoft.com.cn>
Subject: 回复: [edk2-devel] [Patch] [edk2-staging]BaseTools/Fmmt: Fixed FMMT Linux build break issue

Bob:
  I add my comments. 

Thanks
Liming
> -----邮件原件-----
> 发件人: bounce+27952+66170+4905953+8761045@groups.io
> <bounce+27952+66170+4905953+8761045@groups.io> 代表 Bob Feng
> 发送时间: 2020年10月13日 17:21
> 收件人: devel@edk2.groups.io
> 抄送: Yunhua Feng <fengyunhua@byosoft.com.cn>; Liming Gao 
> <gaoliming@byosoft.com.cn>
> 主题: [edk2-devel] [Patch] [edk2-staging]BaseTools/Fmmt: Fixed FMMT 
> Linux build break issue
> 
> Fixed the FMMT Linux build issue which was introduced by the commit 
> 950333853b5fe2b73a7b5148501458cc97a01481
> 
> Signed-off-by: Bob Feng <bob.c.feng@intel.com>
> Cc: Yunhua Feng <fengyunhua@byosoft.com.cn>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> ---
>  .../Source/C/FMMT/FirmwareModuleManagement.c      | 15
> ++++-----------
>  1 file changed, 4 insertions(+), 11 deletions(-)
> 
> diff --git a/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c
> b/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c
> index 20663ba163..8a7ae096d0 100644
> --- a/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c
> +++ b/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c
> @@ -9,11 +9,14 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  #include "FirmwareModuleManagement.h"
>  #include "Rebase.h"
>  #include <stdlib.h>
>  #include <wchar.h>
> -
> +#if defined(__linux__)
> +#include <limits.h>

What's purpose for the header file limits.h?

> +#define _MAX_DIR PATH_MAX

Can you use _MAX_PATH in the code to replace _MAX_DIR? _MAX_PATH is defined here. 

Thanks
Liming
> +#endif
>  CHAR8*      mGuidToolDefinition     = "FmmtConf.ini";
>  extern EFI_FIRMWARE_VOLUME_HEADER  *mFvHeader;
>  extern UINT32                      mFvLength;
> 
>  //
> @@ -1715,15 +1718,10 @@ FmmtImageExtract (
>    EFI_STATUS                  Status;
>    FIRMWARE_DEVICE             *FdData;
>    FV_INFORMATION              *FvInFd;
>    UINT32                      Index;
>    UINT32                      FfsFoundFlag;
> -  FFS_INFORMATION             *OutputFileName;
> -  FILE*                       NewFdFile;
> -  FILE*                       NewFvFile;
> -  UINT64                      NewFvLength;
> -  VOID*                       Buffer;
>    CHAR8                       *TemDir;
>    UINT8                       FvNumInFd;
>    UINT32                      Offset;
>    UINT8                       *FdBuffer;
>    EFI_FFS_FILE_HEADER2        *CurrentFile;
> @@ -1738,18 +1736,13 @@ FmmtImageExtract (
>    int                         j;
>    CHAR8                       FfsOutputFileName[_MAX_DIR];
> 
>    FdSize                      = 0;
>    Index                       = 0;
> -  NewFvLength                 = 0;
>    FfsFoundFlag                = 0;
>    FdData                      = NULL;
>    FvInFd                      = NULL;
> -  OutputFileName              = NULL;
> -  NewFdFile                   = NULL;
> -  NewFvFile                   = NULL;
> -  Buffer                      = NULL;
>    TemDir                      = NULL;
>    FvNumInFd                   = 0;
>    Offset                      = 0;
>    FdBuffer                    = NULL;
>    if (sizeof(FfsOutFileOrDirName) > _MAX_DIR) {
> --
> 2.20.1.windows.1
> 
> 
> 
> 
> 





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


回复: [edk2-devel] [Patch] [edk2-staging]BaseTools/Fmmt: Fixed FMMT Linux build break issue

Posted by gaoliming 1 week ago
Got it. Here should be _MAX_PATH. Yunhua, can you fix this build issue on Linux? 

Thanks
Liming
> -----邮件原件-----
> 发件人: Feng, Bob C <bob.c.feng@intel.com>
> 发送时间: 2020年10月13日 18:35
> 收件人: gaoliming <gaoliming@byosoft.com.cn>; devel@edk2.groups.io
> 抄送: 'Yunhua Feng' <fengyunhua@byosoft.com.cn>
> 主题: RE: [edk2-devel] [Patch] [edk2-staging]BaseTools/Fmmt: Fixed FMMT
> Linux build break issue
> 
> Hi Liming,
> 
> What's purpose for the header file limits.h?
> Bob: To get the Macro PATH_MAX definition. There is no _MAX_DIR or
> _MAX_PATH Macro on Linux.
> 
> Can you use _MAX_PATH in the code to replace _MAX_DIR? _MAX_PATH is
> defined here.
> Bob: The original code use _MAX_DIR. It does not cause the build break.  If
> you and Yunhua confirm there should be _MAX_PATH, I can create another
> patch to change the _MAX_DIR to _MAX_PATH
> 
> Thanks,
> Bob
> 
> -----Original Message-----
> From: gaoliming <gaoliming@byosoft.com.cn>
> Sent: Tuesday, October 13, 2020 6:01 PM
> To: devel@edk2.groups.io; Feng, Bob C <bob.c.feng@intel.com>
> Cc: 'Yunhua Feng' <fengyunhua@byosoft.com.cn>
> Subject: 回复: [edk2-devel] [Patch] [edk2-staging]BaseTools/Fmmt: Fixed
> FMMT Linux build break issue
> 
> Bob:
>   I add my comments.
> 
> Thanks
> Liming
> > -----邮件原件-----
> > 发件人: bounce+27952+66170+4905953+8761045@groups.io
> > <bounce+27952+66170+4905953+8761045@groups.io> 代表 Bob Feng
> > 发送时间: 2020年10月13日 17:21
> > 收件人: devel@edk2.groups.io
> > 抄送: Yunhua Feng <fengyunhua@byosoft.com.cn>; Liming Gao
> > <gaoliming@byosoft.com.cn>
> > 主题: [edk2-devel] [Patch] [edk2-staging]BaseTools/Fmmt: Fixed FMMT
> > Linux build break issue
> >
> > Fixed the FMMT Linux build issue which was introduced by the commit
> > 950333853b5fe2b73a7b5148501458cc97a01481
> >
> > Signed-off-by: Bob Feng <bob.c.feng@intel.com>
> > Cc: Yunhua Feng <fengyunhua@byosoft.com.cn>
> > Cc: Liming Gao <gaoliming@byosoft.com.cn>
> > ---
> >  .../Source/C/FMMT/FirmwareModuleManagement.c      | 15
> > ++++-----------
> >  1 file changed, 4 insertions(+), 11 deletions(-)
> >
> > diff --git a/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c
> > b/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c
> > index 20663ba163..8a7ae096d0 100644
> > --- a/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c
> > +++ b/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c
> > @@ -9,11 +9,14 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
> >
> >  #include "FirmwareModuleManagement.h"
> >  #include "Rebase.h"
> >  #include <stdlib.h>
> >  #include <wchar.h>
> > -
> > +#if defined(__linux__)
> > +#include <limits.h>
> 
> What's purpose for the header file limits.h?
> 
> > +#define _MAX_DIR PATH_MAX
> 
> Can you use _MAX_PATH in the code to replace _MAX_DIR? _MAX_PATH is
> defined here.
> 
> Thanks
> Liming
> > +#endif
> >  CHAR8*      mGuidToolDefinition     = "FmmtConf.ini";
> >  extern EFI_FIRMWARE_VOLUME_HEADER  *mFvHeader;
> >  extern UINT32                      mFvLength;
> >
> >  //
> > @@ -1715,15 +1718,10 @@ FmmtImageExtract (
> >    EFI_STATUS                  Status;
> >    FIRMWARE_DEVICE             *FdData;
> >    FV_INFORMATION              *FvInFd;
> >    UINT32                      Index;
> >    UINT32                      FfsFoundFlag;
> > -  FFS_INFORMATION             *OutputFileName;
> > -  FILE*                       NewFdFile;
> > -  FILE*                       NewFvFile;
> > -  UINT64                      NewFvLength;
> > -  VOID*                       Buffer;
> >    CHAR8                       *TemDir;
> >    UINT8                       FvNumInFd;
> >    UINT32                      Offset;
> >    UINT8                       *FdBuffer;
> >    EFI_FFS_FILE_HEADER2        *CurrentFile;
> > @@ -1738,18 +1736,13 @@ FmmtImageExtract (
> >    int                         j;
> >    CHAR8                       FfsOutputFileName[_MAX_DIR];
> >
> >    FdSize                      = 0;
> >    Index                       = 0;
> > -  NewFvLength                 = 0;
> >    FfsFoundFlag                = 0;
> >    FdData                      = NULL;
> >    FvInFd                      = NULL;
> > -  OutputFileName              = NULL;
> > -  NewFdFile                   = NULL;
> > -  NewFvFile                   = NULL;
> > -  Buffer                      = NULL;
> >    TemDir                      = NULL;
> >    FvNumInFd                   = 0;
> >    Offset                      = 0;
> >    FdBuffer                    = NULL;
> >    if (sizeof(FfsOutFileOrDirName) > _MAX_DIR) {
> > --
> > 2.20.1.windows.1
> >
> >
> >
> > 
> >
> 
> 





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