Meta-comment: when formatting a patch series with "git format-patch",
please pass the "--numbered" and "--cover-letter" options to the
utility. See also
<http://thread.gmane.org/gmane.comp.bios.edk2.devel/4841/focus=4848>.

(No need to resend this series just because of that, of course.)

Thanks
Laszlo

On 12/02/15 09:45, Yonghong Zhu wrote:
> When two vtf files in one FV image, no FV file can be generated, but it
> report the stack trace info. so we enhance the tool to report error
> message directly but not the stack trace info.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Yonghong Zhu <yonghong....@intel.com>
> ---
>  Source/C/GenFv/GenFvInternalLib.c | 23 +++++++++++----------
>  Source/Python/GenFds/Fv.py        | 43 
> +++++++++++++++++++++------------------
>  2 files changed, 35 insertions(+), 31 deletions(-)
> 
> diff --git a/Source/C/GenFv/GenFvInternalLib.c 
> b/Source/C/GenFv/GenFvInternalLib.c
> index 6d2d5d1..10bb88b 100644
> --- a/Source/C/GenFv/GenFvInternalLib.c
> +++ b/Source/C/GenFv/GenFvInternalLib.c
> @@ -2852,21 +2852,22 @@ Returns:
>      // close file
>      //
>      fclose (fpin);
>      
>      if (FvInfoPtr->IsPiFvImage) {
> -         //
> -         // Check whether this ffs file is vtf file
> -         //
> -         if (IsVtfFile (&FfsHeader)) {
> -           if (VtfFileFlag) {
> -             //
> -             // One Fv image can't have two vtf files.
> -             //
> -             return EFI_ABORTED;
> -           }
> -           VtfFileFlag = TRUE;
> +        //
> +        // Check whether this ffs file is vtf file
> +        //
> +        if (IsVtfFile (&FfsHeader)) {
> +          if (VtfFileFlag) {
> +            //
> +            // One Fv image can't have two vtf files.
> +            //
> +            Error (NULL, 0, 3000,"Invalid", "One Fv image can't have two vtf 
> files.");
> +            return EFI_ABORTED;
> +          }
> +          VtfFileFlag = TRUE;
>          VtfFileSize = FfsFileSize;
>          continue;
>        }
>  
>        //
> diff --git a/Source/Python/GenFds/Fv.py b/Source/Python/GenFds/Fv.py
> index 163ccd3..df97ccb 100644
> --- a/Source/Python/GenFds/Fv.py
> +++ b/Source/Python/GenFds/Fv.py
> @@ -179,34 +179,37 @@ class FV (FvClassObject):
>                                          )
>  
>          #
>          # Write the Fv contents to Buffer
>          #
> -        FvFileObj = open ( FvOutputFile,'r+b')
> +        if os.path.isfile(FvOutputFile):
> +            FvFileObj = open ( FvOutputFile,'r+b')
>  
> -        GenFdsGlobalVariable.VerboseLogger( "\nGenerate %s FV Successfully" 
> %self.UiFvName)
> -        GenFdsGlobalVariable.SharpCounter = 0
> +            GenFdsGlobalVariable.VerboseLogger( "\nGenerate %s FV 
> Successfully" %self.UiFvName)
> +            GenFdsGlobalVariable.SharpCounter = 0
>  
> -        Buffer.write(FvFileObj.read())
> -        FvFileObj.seek(0)
> -        # PI FvHeader is 0x48 byte
> -        FvHeaderBuffer = FvFileObj.read(0x48)
> -        # FV alignment position.
> -        FvAlignmentValue = 1 << (ord (FvHeaderBuffer[0x2E]) & 0x1F)
> -        # FvAlignmentValue is larger than or equal to 1K
> -        if FvAlignmentValue >= 0x400:
> -            if FvAlignmentValue >= 0x10000:
> -                #The max alignment supported by FFS is 64K.
> -                self.FvAlignment = "64K"
> +            Buffer.write(FvFileObj.read())
> +            FvFileObj.seek(0)
> +            # PI FvHeader is 0x48 byte
> +            FvHeaderBuffer = FvFileObj.read(0x48)
> +            # FV alignment position.
> +            FvAlignmentValue = 1 << (ord (FvHeaderBuffer[0x2E]) & 0x1F)
> +            # FvAlignmentValue is larger than or equal to 1K
> +            if FvAlignmentValue >= 0x400:
> +                if FvAlignmentValue >= 0x10000:
> +                    #The max alignment supported by FFS is 64K.
> +                    self.FvAlignment = "64K"
> +                else:
> +                    self.FvAlignment = str (FvAlignmentValue / 0x400) + "K"
>              else:
> -                self.FvAlignment = str (FvAlignmentValue / 0x400) + "K"
> +                # FvAlignmentValue is less than 1K
> +                self.FvAlignment = str (FvAlignmentValue)
> +            FvFileObj.close()
> +            GenFds.ImageBinDict[self.UiFvName.upper() + 'fv'] = FvOutputFile
> +            GenFdsGlobalVariable.LargeFileInFvFlags.pop()
>          else:
> -            # FvAlignmentValue is less than 1K
> -            self.FvAlignment = str (FvAlignmentValue)
> -        FvFileObj.close()
> -        GenFds.ImageBinDict[self.UiFvName.upper() + 'fv'] = FvOutputFile
> -        GenFdsGlobalVariable.LargeFileInFvFlags.pop()
> +            GenFdsGlobalVariable.ErrorLogger("Failed to generate %s FV 
> file." %self.UiFvName)
>          return FvOutputFile
>  
>      ## _GetBlockSize()
>      #
>      #   Calculate FV's block size
> 

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

Reply via email to