+ \r
+ //\r
+ // Update FV Alignment attribute to the largest alignment of all the FFS files in the FV\r
+ //\r
+ if (FvHeader->Attributes | EFI_FVB_ALIGNMENT_CAP) {\r
+ for (Index = 1; Index <= 16; Index ++) {\r
+ if ((1 << Index) < MaxFfsAlignment) {\r
+ //\r
+ // Unset the unsupported alignment attribute.\r
+ //\r
+ FvHeader->Attributes = FvHeader->Attributes & ~((1 << Index) * EFI_FVB_ALIGNMENT_CAP);\r
+ } else {\r
+ //\r
+ // Set the supported alignment attribute.\r
+ //\r
+ FvHeader->Attributes = FvHeader->Attributes | ((1 << Index) * EFI_FVB_ALIGNMENT_CAP);\r
+ }\r
+ }\r
+ \r
+ //\r
+ // Update Checksum for FvHeader\r
+ //\r
+ FvHeader->Checksum = 0;\r
+ FvHeader->Checksum = CalculateChecksum16 ((UINT16 *) FvHeader, FvHeader->HeaderLength / sizeof (UINT16));\r
+ }\r