Set default block size to 1 when block size is not set for FD or FV.
authorlgao4 <lgao4@7335b38e-4728-0410-8992-fb3ffe349368>
Wed, 30 Dec 2009 01:18:42 +0000 (01:18 +0000)
committerlgao4 <lgao4@7335b38e-4728-0410-8992-fb3ffe349368>
Wed, 30 Dec 2009 01:18:42 +0000 (01:18 +0000)
git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@1785 7335b38e-4728-0410-8992-fb3ffe349368

Source/Python/GenFds/FdfParser.py
Source/Python/GenFds/Fv.py
Source/Python/GenFds/GenFds.py

index 24732a0..c0b48a5 100644 (file)
@@ -1312,8 +1312,7 @@ class FdfParser:
         if not Status:\r
             raise Warning("FD name error", self.FileName, self.CurrentLineNumber)\r
 \r
-        if not self.__GetTokenStatements(FdObj):\r
-            return False\r
+        self.__GetTokenStatements(FdObj)\r
 \r
         self.__GetDefineStatements(FdObj)\r
 \r
@@ -1368,8 +1367,6 @@ class FdfParser:
     #\r
     #   @param  self        The object pointer\r
     #   @param  Obj         for whom token statement is got\r
-    #   @retval True        Successfully find a token statement\r
-    #   @retval False       Not able to find a token statement\r
     #\r
     def __GetTokenStatements(self, Obj):\r
         if not self.__IsKeyword( "BaseAddress"):\r
@@ -1419,8 +1416,7 @@ class FdfParser:
 \r
         Obj.ErasePolarity = self.__Token\r
 \r
-        Status = self.__GetBlockStatements(Obj)\r
-        return Status\r
+        self.__GetBlockStatements(Obj)\r
 \r
     ## __GetAddressStatements() method\r
     #\r
@@ -1459,17 +1455,20 @@ class FdfParser:
     #\r
     #   @param  self        The object pointer\r
     #   @param  Obj         for whom block statement is got\r
-    #   @retval True        Successfully find\r
-    #   @retval False       Not able to find\r
     #\r
     def __GetBlockStatements(self, Obj):\r
 \r
         if not self.__GetBlockStatement(Obj):\r
-            raise Warning("expected block statement", self.FileName, self.CurrentLineNumber)\r
+            #set default block size is 1\r
+            Obj.BlockSizeList.append((1, Obj.Size, None))\r
+            return\r
 \r
         while self.__GetBlockStatement(Obj):\r
             pass\r
-        return True\r
+        \r
+        for Item in Obj.BlockSizeList:\r
+            if Item[0] == None or Item[1] == None:\r
+                raise Warning("expected block statement for Fd Section", self.FileName, self.CurrentLineNumber)\r
 \r
     ## __GetBlockStatement() method\r
     #\r
index 8605ac7..976516c 100644 (file)
@@ -221,6 +221,10 @@ class FV (FvClassObject):
                                       ' 0x%X' %BlockNum    + \\r
                                       T_CHAR_LF)\r
         else:\r
+            if self.BlockSizeList == []:\r
+                #set default block size is 1\r
+                self.FvInfFile.writelines("EFI_BLOCK_SIZE  = 0x1" + T_CHAR_LF)\r
+            \r
             for BlockSize in self.BlockSizeList :\r
                 if BlockSize[0] != None:\r
                     self.FvInfFile.writelines("EFI_BLOCK_SIZE  = "  + \\r
index 1df1910..171f7b4 100644 (file)
@@ -372,7 +372,7 @@ class GenFds :
     #   @retval int             Block size value
     #
     def GetFvBlockSize(FvObj):
-        DefaultBlockSize = 0x10000
+        DefaultBlockSize = 0x1
         FdObj = None
         if GenFds.OnlyGenerateThisFd != None and GenFds.OnlyGenerateThisFd.upper() in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():
             FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[GenFds.OnlyGenerateThisFd.upper()]