diff options
| -rw-r--r-- | meta/recipes-core/ovmf/ovmf/reproducible.patch | 165 | ||||
| -rw-r--r-- | meta/recipes-core/ovmf/ovmf_git.bb | 1 |
2 files changed, 166 insertions, 0 deletions
diff --git a/meta/recipes-core/ovmf/ovmf/reproducible.patch b/meta/recipes-core/ovmf/ovmf/reproducible.patch new file mode 100644 index 0000000000..5d2aeaacfe --- /dev/null +++ b/meta/recipes-core/ovmf/ovmf/reproducible.patch | |||
| @@ -0,0 +1,165 @@ | |||
| 1 | This patch fixes various things which make the build more reproducible. Some changes | ||
| 2 | here only change intermediate artefacts but that means when you have two build trees | ||
| 3 | giving differing results, the differences can be isolated more easily. The issues here | ||
| 4 | usually become apparent with longer paths. | ||
| 5 | |||
| 6 | This was all debugged with: | ||
| 7 | TMPDIR = "${TOPDIR}/tmp" | ||
| 8 | vs. | ||
| 9 | TMPDIR = "${TOPDIR}/tmp-inital-mylongpath-mylongpath-mylongpath-mylongpath-mylongpath-mylongpath-mylongpath-mylongpath-mylongpath" | ||
| 10 | |||
| 11 | The patch specifically: | ||
| 12 | |||
| 13 | * Sorts output in GNUmakefile | ||
| 14 | * Always generates indirect flags files used to avoid pathlength issues else the | ||
| 15 | compile commands suddenly change when using longer paths | ||
| 16 | * Sorts the AutoGenTimeStamp file contents | ||
| 17 | * Makes the TargetDescBlock objects from BuildEngine sortable to allow the makefile fix | ||
| 18 | * Fix ElfConvert within GenFw so that only the basename of the binary being converted | ||
| 19 | is used, else the output from "GenFw XXX.bin" differs from "GenFw /long/path/XXX.bin" | ||
| 20 | with sufficiently long paths | ||
| 21 | |||
| 22 | Upstream-Status: Pending [At least some of this might be interesting to upstream] | ||
| 23 | Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> | ||
| 24 | |||
| 25 | Index: git/BaseTools/Source/Python/AutoGen/GenMake.py | ||
| 26 | =================================================================== | ||
| 27 | --- git.orig/BaseTools/Source/Python/AutoGen/GenMake.py | ||
| 28 | +++ git/BaseTools/Source/Python/AutoGen/GenMake.py | ||
| 29 | @@ -571,7 +571,7 @@ cleanlib: | ||
| 30 | os.remove(RespFileList) | ||
| 31 | |||
| 32 | # convert source files and binary files to build targets | ||
| 33 | - self.ResultFileList = [str(T.Target) for T in MyAgo.CodaTargetList] | ||
| 34 | + self.ResultFileList = sorted([str(T.Target) for T in MyAgo.CodaTargetList]) | ||
| 35 | if len(self.ResultFileList) == 0 and len(MyAgo.SourceFileList) != 0: | ||
| 36 | EdkLogger.error("build", AUTOGEN_ERROR, "Nothing to build", | ||
| 37 | ExtraData="[%s]" % str(MyAgo)) | ||
| 38 | @@ -722,7 +722,7 @@ cleanlib: | ||
| 39 | OutputFile = '' | ||
| 40 | DepsFileList = [] | ||
| 41 | |||
| 42 | - for Cmd in self.GenFfsList: | ||
| 43 | + for Cmd in sorted(self.GenFfsList): | ||
| 44 | if Cmd[2]: | ||
| 45 | for CopyCmd in Cmd[2]: | ||
| 46 | Src, Dst = CopyCmd | ||
| 47 | @@ -755,7 +755,7 @@ cleanlib: | ||
| 48 | self.BuildTargetList.append('\t%s' % CmdString) | ||
| 49 | |||
| 50 | self.ParseSecCmd(DepsFileList, Cmd[1]) | ||
| 51 | - for SecOutputFile, SecDepsFile, SecCmd in self.FfsOutputFileList : | ||
| 52 | + for SecOutputFile, SecDepsFile, SecCmd in sorted(self.FfsOutputFileList): | ||
| 53 | self.BuildTargetList.append('%s : %s' % (self.ReplaceMacro(SecOutputFile), self.ReplaceMacro(SecDepsFile))) | ||
| 54 | self.BuildTargetList.append('\t%s' % self.ReplaceMacro(SecCmd)) | ||
| 55 | self.FfsOutputFileList = [] | ||
| 56 | @@ -794,13 +794,13 @@ cleanlib: | ||
| 57 | |||
| 58 | def CommandExceedLimit(self): | ||
| 59 | FlagDict = { | ||
| 60 | - 'CC' : { 'Macro' : '$(CC_FLAGS)', 'Value' : False}, | ||
| 61 | - 'PP' : { 'Macro' : '$(PP_FLAGS)', 'Value' : False}, | ||
| 62 | - 'APP' : { 'Macro' : '$(APP_FLAGS)', 'Value' : False}, | ||
| 63 | - 'ASLPP' : { 'Macro' : '$(ASLPP_FLAGS)', 'Value' : False}, | ||
| 64 | - 'VFRPP' : { 'Macro' : '$(VFRPP_FLAGS)', 'Value' : False}, | ||
| 65 | - 'ASM' : { 'Macro' : '$(ASM_FLAGS)', 'Value' : False}, | ||
| 66 | - 'ASLCC' : { 'Macro' : '$(ASLCC_FLAGS)', 'Value' : False}, | ||
| 67 | + 'CC' : { 'Macro' : '$(CC_FLAGS)', 'Value' : True}, | ||
| 68 | + 'PP' : { 'Macro' : '$(PP_FLAGS)', 'Value' : True}, | ||
| 69 | + 'APP' : { 'Macro' : '$(APP_FLAGS)', 'Value' : True}, | ||
| 70 | + 'ASLPP' : { 'Macro' : '$(ASLPP_FLAGS)', 'Value' : True}, | ||
| 71 | + 'VFRPP' : { 'Macro' : '$(VFRPP_FLAGS)', 'Value' : True}, | ||
| 72 | + 'ASM' : { 'Macro' : '$(ASM_FLAGS)', 'Value' : True}, | ||
| 73 | + 'ASLCC' : { 'Macro' : '$(ASLCC_FLAGS)', 'Value' : True}, | ||
| 74 | } | ||
| 75 | |||
| 76 | RespDict = {} | ||
| 77 | @@ -1003,9 +1003,9 @@ cleanlib: | ||
| 78 | if not self.ObjTargetDict.get(T.Target.SubDir): | ||
| 79 | self.ObjTargetDict[T.Target.SubDir] = set() | ||
| 80 | self.ObjTargetDict[T.Target.SubDir].add(NewFile) | ||
| 81 | - for Type in self._AutoGenObject.Targets: | ||
| 82 | + for Type in sorted(self._AutoGenObject.Targets): | ||
| 83 | resp_file_number = 0 | ||
| 84 | - for T in self._AutoGenObject.Targets[Type]: | ||
| 85 | + for T in sorted(self._AutoGenObject.Targets[Type]): | ||
| 86 | # Generate related macros if needed | ||
| 87 | if T.GenFileListMacro and T.FileListMacro not in self.FileListMacros: | ||
| 88 | self.FileListMacros[T.FileListMacro] = [] | ||
| 89 | Index: git/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py | ||
| 90 | =================================================================== | ||
| 91 | --- git.orig/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py | ||
| 92 | +++ git/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py | ||
| 93 | @@ -1484,6 +1484,9 @@ class ModuleAutoGen(AutoGen): | ||
| 94 | for File in Files: | ||
| 95 | if File.lower().endswith('.pdb'): | ||
| 96 | AsBuiltInfDict['binary_item'].append('DISPOSABLE|' + File) | ||
| 97 | + | ||
| 98 | + AsBuiltInfDict['binary_item'] = sorted(AsBuiltInfDict['binary_item']) | ||
| 99 | + | ||
| 100 | HeaderComments = self.Module.HeaderComments | ||
| 101 | StartPos = 0 | ||
| 102 | for Index in range(len(HeaderComments)): | ||
| 103 | @@ -1759,7 +1762,7 @@ class ModuleAutoGen(AutoGen): | ||
| 104 | if os.path.exists (self.TimeStampPath): | ||
| 105 | os.remove (self.TimeStampPath) | ||
| 106 | |||
| 107 | - SaveFileOnChange(self.TimeStampPath, "\n".join(FileSet), False) | ||
| 108 | + SaveFileOnChange(self.TimeStampPath, "\n".join(sorted(FileSet)), False) | ||
| 109 | |||
| 110 | # Ignore generating makefile when it is a binary module | ||
| 111 | if self.IsBinaryModule: | ||
| 112 | Index: git/BaseTools/Source/Python/AutoGen/BuildEngine.py | ||
| 113 | =================================================================== | ||
| 114 | --- git.orig/BaseTools/Source/Python/AutoGen/BuildEngine.py | ||
| 115 | +++ git/BaseTools/Source/Python/AutoGen/BuildEngine.py | ||
| 116 | @@ -70,6 +70,9 @@ class TargetDescBlock(object): | ||
| 117 | else: | ||
| 118 | return str(Other) == self.Target.Path | ||
| 119 | |||
| 120 | + def __lt__(self, other): | ||
| 121 | + return str(self) < str(other) | ||
| 122 | + | ||
| 123 | def AddInput(self, Input): | ||
| 124 | if Input not in self.Inputs: | ||
| 125 | self.Inputs.append(Input) | ||
| 126 | Index: git/BaseTools/Source/C/GenFw/Elf64Convert.c | ||
| 127 | =================================================================== | ||
| 128 | --- git.orig/BaseTools/Source/C/GenFw/Elf64Convert.c | ||
| 129 | +++ git/BaseTools/Source/C/GenFw/Elf64Convert.c | ||
| 130 | @@ -14,6 +14,8 @@ SPDX-License-Identifier: BSD-2-Clause-Pa | ||
| 131 | #ifndef __GNUC__ | ||
| 132 | #include <windows.h> | ||
| 133 | #include <io.h> | ||
| 134 | +#else | ||
| 135 | +#define _GNU_SOURCE | ||
| 136 | #endif | ||
| 137 | #include <assert.h> | ||
| 138 | #include <stdio.h> | ||
| 139 | @@ -770,7 +772,7 @@ ScanSections64 ( | ||
| 140 | } | ||
| 141 | mCoffOffset = mDebugOffset + sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY) + | ||
| 142 | sizeof(EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY) + | ||
| 143 | - strlen(mInImageName) + 1; | ||
| 144 | + strlen(basename(mInImageName)) + 1; | ||
| 145 | |||
| 146 | mCoffOffset = CoffAlign(mCoffOffset); | ||
| 147 | if (SectionCount == 0) { | ||
| 148 | @@ -1609,7 +1611,7 @@ WriteDebug64 ( | ||
| 149 | EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *Dir; | ||
| 150 | EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY *Nb10; | ||
| 151 | |||
| 152 | - Len = strlen(mInImageName) + 1; | ||
| 153 | + Len = strlen(basename(mInImageName)) + 1; | ||
| 154 | |||
| 155 | Dir = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY*)(mCoffFile + mDebugOffset); | ||
| 156 | Dir->Type = EFI_IMAGE_DEBUG_TYPE_CODEVIEW; | ||
| 157 | @@ -1619,7 +1621,7 @@ WriteDebug64 ( | ||
| 158 | |||
| 159 | Nb10 = (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY*)(Dir + 1); | ||
| 160 | Nb10->Signature = CODEVIEW_SIGNATURE_NB10; | ||
| 161 | - strcpy ((char *)(Nb10 + 1), mInImageName); | ||
| 162 | + strcpy ((char *)(Nb10 + 1), basename(mInImageName)); | ||
| 163 | |||
| 164 | |||
| 165 | NtHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(mCoffFile + mNtHdrOffset); | ||
diff --git a/meta/recipes-core/ovmf/ovmf_git.bb b/meta/recipes-core/ovmf/ovmf_git.bb index ef5545bf70..696c234035 100644 --- a/meta/recipes-core/ovmf/ovmf_git.bb +++ b/meta/recipes-core/ovmf/ovmf_git.bb | |||
| @@ -18,6 +18,7 @@ SRC_URI = "gitsm://github.com/tianocore/edk2.git;branch=master;protocol=https \ | |||
| 18 | file://0004-ovmf-Update-to-latest.patch \ | 18 | file://0004-ovmf-Update-to-latest.patch \ |
| 19 | file://zero.patch \ | 19 | file://zero.patch \ |
| 20 | file://debug_prefix_map.patch \ | 20 | file://debug_prefix_map.patch \ |
| 21 | file://reproducible.patch \ | ||
| 21 | " | 22 | " |
| 22 | 23 | ||
| 23 | PV = "edk2-stable202102" | 24 | PV = "edk2-stable202102" |
