On Wed, Jul 06, 2011, Olivier Martin wrote:
Anyway, these are the build instructions to build the Tianocore project (UEFI Open Source implementation) and to test on qEmu: http://edk2.svn.sourceforge.net/viewvc/edk2/trunk/edk2/BeagleBoardPkg/readme .txt?revision=11997
I had started following these, but ran into some issues with my setup; I will try with the alternate build-next.sh approach too, to see whether I get other issues or not.
The two classes of issues I ran into was: a) variables being written to, but never read b) conditions being always true
I indeed had to apply the patch you mention; what's the state of that patch? Are these things which will get merged soonish? Without the patch, my toolchain wouldn't be properly picked up (it'd try running c:/program files/ stuff and calling a CS toolchain) and I had some error conditions like '-(' in linker invocations due to missing '' escapes. These go away with the patch and my toolchain is picked up and works.
I'm running Ubuntu oneiric (which will become 11.10) and the toolchain I've used is our packaged Linaro GCC based cross-compiler (arm-linux-gnueabi-gcc from the gcc-arm-linux-gnueabi package).
a) variables being written to, but never read
This is stuff like:
--- a/edk2/BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c +++ b/edk2/BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c @@ -181,7 +181,7 @@ Returns: CHAR8* OutputFileName = NULL; CHAR8* InputFileNames[MAX_PE_IMAGES + 1]; UINT8 InputFileCount = 0; - BOOLEAN QuietFlag = FALSE; + //BOOLEAN QuietFlag = FALSE; UINT64 DebugLevel = 0; UINT64 VerboseLevel = 0; EFI_STATUS Status = EFI_SUCCESS; @@ -220,7 +220,7 @@ Returns: }
if ((stricmp (argv[0], "-q") == 0) || (stricmp (argv[0], "--quiet") == 0)) { - QuietFlag = TRUE; + //QuietFlag = TRUE; argc --; argv ++; continue;
QuietFlag is never used (read), newer gccs detect this and report it as a fatal warning by default (not sure where this warning is configured as a fatal one, whether it's in UEFI or in the toolchain config).
There are many such cases, but some are a bit more worrying, like variables holding the return values of fread of fwrite not being checked: --- a/edk2/BaseTools/Source/C/GenVtf/GenVtf.c +++ b/edk2/BaseTools/Source/C/GenVtf/GenVtf.c @@ -1141,7 +1141,7 @@ Returns: EFI_STATUS Status; UINT64 CompStartAddress; UINT64 FileSize; - UINT64 NumByteRead; + //UINT64 NumByteRead; UINT64 NumAdjustByte; UINT8 *Buffer; FILE *Fp; @@ -1189,7 +1189,7 @@ Returns: // // Read first 64 bytes of PAL header and use it to find version info // - NumByteRead = fread (Buffer, sizeof (UINT8), SIZE_OF_PAL_HEADER, Fp); + /* NumByteRead = */fread (Buffer, sizeof (UINT8), SIZE_OF_PAL_HEADER, Fp);
// // PAL header contains the version info. Currently, we will use the header @@ -1200,7 +1200,7 @@ Returns: } }
- NumByteRead = fread (Buffer, sizeof (UINT8), (UINTN) FileSize, Fp); + /* NumByteRead = */fread (Buffer, sizeof (UINT8), (UINTN) FileSize, Fp); fclose (Fp);
//
I just quickly hacked the source to get it to build, but we should fix the code to loop until all bytes have been read or to raise an error.
The last such cases is a conditional piece of code: --- a/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c +++ b/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c @@ -1919,11 +1919,13 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, Bool useLimits, UInt32 maxPackSize static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) { UInt32 beforeSize = kNumOpts; + #ifdef COMPRESS_MF_MT Bool btMode; + #endif if (!RangeEnc_Alloc(&p->rc, alloc)) return SZ_ERROR_MEM; - btMode = (p->matchFinderBase.btMode != 0); #ifdef COMPRESS_MF_MT + btMode = (p->matchFinderBase.btMode != 0); p->mtMode = (p->multiThread && !p->fastMode && btMode); #endif
b) conditions being always true
A bunch of asserts trigger a warning in newer GCCs, essentially the ASSERT macros in question are doing multiple things: - testing whether the object is null - testing some other condition on the object, like some state being correct but the objects are guaranteed to never be null from GCC PoV, so it raises a fatal warning; as a workaround I just commented the asserts out, but I guess what we should do is review whether any of the ASSERT_LOCKED() users has a chance of getting a NULL pointer, and either drop the NULL check or replace the macro with two.
--- a/edk2/MdeModulePkg/Core/Dxe/Event/Event.c +++ b/edk2/MdeModulePkg/Core/Dxe/Event/Event.c @@ -225,7 +225,7 @@ CoreNotifyEvent ( // // Event database must be locked // - ASSERT_LOCKED (&gEventQueueLock); + //ASSERT_LOCKED (&gEventQueueLock);
// // If the event is queued somewhere, remove it
I got this for a bunch of ASSERT_LOCKED(), ASSERT_PROTOCOL_ALREADY_INSTALLED(), and ASSERT_VOLUME_LOCKED()
These are all issues in edk2, except the ASSERT_VOLUME_LOCKED() macro issue which is the only issue in FatPkg and only there.
A cleaner workaround would be to make this warnings non-fatal for now for this toolchain, but the code should also be fixed not to trigger them. What's the best way to address this? Is there some bug tracker I should report these issues at?
To try the resulting image, I just did: qemu-system-arm -mtdblock \ ../Build/BeagleBoard/DEBUG_ARMGCC/FV/BeagleBoard_EFI_flashboot.fd \ -nographic -M beagle
which sent this on the serial port: UART Enabled Magic delay to disable watchdog timers properly.
ASSERT_EFI_ERROR (Status = Unsupported) ASSERT /home/lool/git/edk2/edk2/edk2/EmbeddedPkg/Library/PrePiLib/PrePiLib.c(73): !EFI_ERROR (Status)
I didn't actually look into this issue yet.
I tried passing a barebox based SD image I had built earlier (see other message) with -sd sd.img, but that didn't change the output.
--- FatPkg/EnhancedFatDxe/DirectoryManage.c | 2 +- FatPkg/EnhancedFatDxe/FileSpace.c | 8 ++++---- FatPkg/EnhancedFatDxe/Flush.c | 2 +- FatPkg/EnhancedFatDxe/Open.c | 4 ++-- FatPkg/EnhancedFatDxe/ReadWrite.c | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/FatPkg/EnhancedFatDxe/DirectoryManage.c b/FatPkg/EnhancedFatDxe/DirectoryManage.c index 00e2bad..44d43a8 100644 --- a/FatPkg/EnhancedFatDxe/DirectoryManage.c +++ b/FatPkg/EnhancedFatDxe/DirectoryManage.c @@ -525,7 +525,7 @@ Returns: FAT_DIRECTORY_ENTRY *Entry; FAT_DATE_TIME FatLastAccess;
- ASSERT_VOLUME_LOCKED (Volume); + //ASSERT_VOLUME_LOCKED (Volume);
Size = SIZE_OF_EFI_FILE_INFO; NameSize = StrSize (DirEnt->FileString); diff --git a/FatPkg/EnhancedFatDxe/FileSpace.c b/FatPkg/EnhancedFatDxe/FileSpace.c index c609821..e88dbe2 100644 --- a/FatPkg/EnhancedFatDxe/FileSpace.c +++ b/FatPkg/EnhancedFatDxe/FileSpace.c @@ -409,7 +409,7 @@ Returns: UINTN LastCluster;
Volume = OFile->Volume; - ASSERT_VOLUME_LOCKED (Volume); + //ASSERT_VOLUME_LOCKED (Volume);
NewSize = FatSizeToClusters (Volume, OFile->FileSize);
@@ -501,7 +501,7 @@ Returns: }
Volume = OFile->Volume; - ASSERT_VOLUME_LOCKED (Volume); + //ASSERT_VOLUME_LOCKED (Volume); // // If the file is already large enough, do nothing // @@ -620,7 +620,7 @@ Returns: Volume = OFile->Volume; ClusterSize = Volume->ClusterSize;
- ASSERT_VOLUME_LOCKED (Volume); + //ASSERT_VOLUME_LOCKED (Volume);
// // If this is the fixed root dir, then compute it's position @@ -709,7 +709,7 @@ Returns: --*/ { UINTN Size; - ASSERT_VOLUME_LOCKED (Volume); + //ASSERT_VOLUME_LOCKED (Volume); // // Run the cluster chain for the OFile // diff --git a/FatPkg/EnhancedFatDxe/Flush.c b/FatPkg/EnhancedFatDxe/Flush.c index 320834c..0f239c1 100644 --- a/FatPkg/EnhancedFatDxe/Flush.c +++ b/FatPkg/EnhancedFatDxe/Flush.c @@ -156,7 +156,7 @@ Returns: OFile = IFile->OFile; Volume = OFile->Volume;
- ASSERT_VOLUME_LOCKED (Volume); + //ASSERT_VOLUME_LOCKED (Volume);
// // Remove the IFile struct diff --git a/FatPkg/EnhancedFatDxe/Open.c b/FatPkg/EnhancedFatDxe/Open.c index 6db7a50..033b845 100644 --- a/FatPkg/EnhancedFatDxe/Open.c +++ b/FatPkg/EnhancedFatDxe/Open.c @@ -46,7 +46,7 @@ Returns: { FAT_IFILE *IFile;
- ASSERT_VOLUME_LOCKED (OFile->Volume); + //ASSERT_VOLUME_LOCKED (OFile->Volume);
// // Allocate a new open instance @@ -111,7 +111,7 @@ Returns: BOOLEAN WriteMode;
Volume = OFile->Volume; - ASSERT_VOLUME_LOCKED (Volume); + //ASSERT_VOLUME_LOCKED (Volume); WriteMode = (BOOLEAN) (OpenMode & EFI_FILE_MODE_WRITE); if (Volume->ReadOnly && WriteMode) { return EFI_WRITE_PROTECTED; diff --git a/FatPkg/EnhancedFatDxe/ReadWrite.c b/FatPkg/EnhancedFatDxe/ReadWrite.c index 13b9117..aab4745 100644 --- a/FatPkg/EnhancedFatDxe/ReadWrite.c +++ b/FatPkg/EnhancedFatDxe/ReadWrite.c @@ -438,7 +438,7 @@ Returns:
BufferSize = *DataBufferSize; Volume = OFile->Volume; - ASSERT_VOLUME_LOCKED (Volume); + //ASSERT_VOLUME_LOCKED (Volume);
Status = EFI_SUCCESS; while (BufferSize > 0) {
--- edk2/BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c | 4 +- edk2/BaseTools/Source/C/GenFv/GenFvInternalLib.c | 8 +++--- edk2/BaseTools/Source/C/GenFw/Elf32Convert.c | 16 +++++++------- edk2/BaseTools/Source/C/GenFw/Elf64Convert.c | 22 ++++++++++---------- edk2/BaseTools/Source/C/GenSec/GenSec.c | 4 +- edk2/BaseTools/Source/C/GenVtf/GenVtf.c | 20 +++++++++--------- .../Source/C/GnuGenBootSector/GnuGenBootSector.c | 4 +- edk2/BaseTools/Source/C/Split/Split.c | 4 +- 8 files changed, 41 insertions(+), 41 deletions(-)
diff --git a/edk2/BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c b/edk2/BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c index a92f76d..3bfc63b 100644 --- a/edk2/BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c +++ b/edk2/BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c @@ -181,7 +181,7 @@ Returns: CHAR8* OutputFileName = NULL; CHAR8* InputFileNames[MAX_PE_IMAGES + 1]; UINT8 InputFileCount = 0; - BOOLEAN QuietFlag = FALSE; + //BOOLEAN QuietFlag = FALSE; UINT64 DebugLevel = 0; UINT64 VerboseLevel = 0; EFI_STATUS Status = EFI_SUCCESS; @@ -220,7 +220,7 @@ Returns: }
if ((stricmp (argv[0], "-q") == 0) || (stricmp (argv[0], "--quiet") == 0)) { - QuietFlag = TRUE; + //QuietFlag = TRUE; argc --; argv ++; continue; diff --git a/edk2/BaseTools/Source/C/GenFv/GenFvInternalLib.c b/edk2/BaseTools/Source/C/GenFv/GenFvInternalLib.c index 189dc43..637f7ad 100644 --- a/edk2/BaseTools/Source/C/GenFv/GenFvInternalLib.c +++ b/edk2/BaseTools/Source/C/GenFv/GenFvInternalLib.c @@ -2792,7 +2792,7 @@ Returns: PE_COFF_LOADER_IMAGE_CONTEXT OrigImageContext; EFI_PHYSICAL_ADDRESS XipBase; EFI_PHYSICAL_ADDRESS NewPe32BaseAddress; - EFI_PHYSICAL_ADDRESS *BaseToUpdate; + //EFI_PHYSICAL_ADDRESS *BaseToUpdate; UINTN Index; EFI_FILE_SECTION_POINTER CurrentPe32Section; EFI_FFS_FILE_STATE SavedState; @@ -2809,7 +2809,7 @@ Returns:
Index = 0; MemoryImagePointer = NULL; - BaseToUpdate = NULL; + //BaseToUpdate = NULL; TEImageHeader = NULL; ImgHdr = NULL; SectionHeader = NULL; @@ -2974,7 +2974,7 @@ Returns: }
NewPe32BaseAddress = XipBase + (UINTN) CurrentPe32Section.Pe32Section + sizeof (EFI_PE32_SECTION) - (UINTN)FfsFile; - BaseToUpdate = &XipBase; + //BaseToUpdate = &XipBase; break;
case EFI_FV_FILETYPE_DRIVER: @@ -2990,7 +2990,7 @@ Returns: return EFI_ABORTED; } NewPe32BaseAddress = XipBase + (UINTN) CurrentPe32Section.Pe32Section + sizeof (EFI_PE32_SECTION) - (UINTN)FfsFile; - BaseToUpdate = &XipBase; + //BaseToUpdate = &XipBase; break;
default: diff --git a/edk2/BaseTools/Source/C/GenFw/Elf32Convert.c b/edk2/BaseTools/Source/C/GenFw/Elf32Convert.c index 42ae35b..64f3c52 100644 --- a/edk2/BaseTools/Source/C/GenFw/Elf32Convert.c +++ b/edk2/BaseTools/Source/C/GenFw/Elf32Convert.c @@ -738,9 +738,9 @@ WriteRelocations32 ( UINT8 *Targ; Elf32_Phdr *DynamicSegment; Elf32_Phdr *TargetSegment; - Elf_Sym *Sym; - Elf_Shdr *SymtabShdr; - UINT8 *Symtab; + //Elf_Sym *Sym; + //Elf_Shdr *SymtabShdr; + //UINT8 *Symtab;
for (Index = 0, FoundRelocations = FALSE; Index < mEhdr->e_shnum; Index++) { @@ -750,15 +750,15 @@ WriteRelocations32 ( if (IsTextShdr(SecShdr) || IsDataShdr(SecShdr)) { UINT32 RelIdx;
- SymtabShdr = GetShdrByIndex (RelShdr->sh_link); - Symtab = (UINT8*)mEhdr + SymtabShdr->sh_offset; + //SymtabShdr = GetShdrByIndex (RelShdr->sh_link); + //Symtab = (UINT8*)mEhdr + SymtabShdr->sh_offset; FoundRelocations = TRUE; for (RelIdx = 0; RelIdx < RelShdr->sh_size; RelIdx += RelShdr->sh_entsize) { Elf_Rel *Rel = (Elf_Rel *)((UINT8*)mEhdr + RelShdr->sh_offset + RelIdx); - Elf_Shdr *SymShdr; + //Elf_Shdr *SymShdr;
- Sym = (Elf_Sym *)(Symtab + ELF_R_SYM(Rel->r_info) * SymtabShdr->sh_entsize); - SymShdr = GetShdrByIndex (Sym->st_shndx); + //Sym = (Elf_Sym *)(Symtab + ELF_R_SYM(Rel->r_info) * SymtabShdr->sh_entsize); + //SymShdr = GetShdrByIndex (Sym->st_shndx);
if (mEhdr->e_machine == EM_386) { switch (ELF_R_TYPE(Rel->r_info)) { diff --git a/edk2/BaseTools/Source/C/GenFw/Elf64Convert.c b/edk2/BaseTools/Source/C/GenFw/Elf64Convert.c index fbe6ff8..73243ae 100644 --- a/edk2/BaseTools/Source/C/GenFw/Elf64Convert.c +++ b/edk2/BaseTools/Source/C/GenFw/Elf64Convert.c @@ -637,28 +637,28 @@ WriteRelocations64 ( UINT32 Index; EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr; EFI_IMAGE_DATA_DIRECTORY *Dir; - BOOLEAN FoundRelocations; - Elf_Sym *Sym; - Elf_Shdr *SymtabShdr; - UINT8 *Symtab; + //BOOLEAN FoundRelocations; + //Elf_Sym *Sym; + //Elf_Shdr *SymtabShdr; + //UINT8 *Symtab;
- for (Index = 0, FoundRelocations = FALSE; Index < mEhdr->e_shnum; Index++) { + for (Index = 0/*, FoundRelocations = FALSE */; Index < mEhdr->e_shnum; Index++) { Elf_Shdr *RelShdr = GetShdrByIndex(Index); if ((RelShdr->sh_type == SHT_REL) || (RelShdr->sh_type == SHT_RELA)) { Elf_Shdr *SecShdr = GetShdrByIndex (RelShdr->sh_info); if (IsTextShdr(SecShdr) || IsDataShdr(SecShdr)) { UINT64 RelIdx;
- SymtabShdr = GetShdrByIndex (RelShdr->sh_link); - Symtab = (UINT8*)mEhdr + SymtabShdr->sh_offset; - FoundRelocations = TRUE; + //SymtabShdr = GetShdrByIndex (RelShdr->sh_link); + //Symtab = (UINT8*)mEhdr + SymtabShdr->sh_offset; + //FoundRelocations = TRUE; for (RelIdx = 0; RelIdx < RelShdr->sh_size; RelIdx += RelShdr->sh_entsize) { Elf_Rela *Rel = (Elf_Rela *)((UINT8*)mEhdr + RelShdr->sh_offset + RelIdx); - Elf_Shdr *SymShdr; + //Elf_Shdr *SymShdr;
- Sym = (Elf_Sym *)(Symtab + ELF_R_SYM(Rel->r_info) * SymtabShdr->sh_entsize); - SymShdr = GetShdrByIndex (Sym->st_shndx); + //Sym = (Elf_Sym *)(Symtab + ELF_R_SYM(Rel->r_info) * SymtabShdr->sh_entsize); + //SymShdr = GetShdrByIndex (Sym->st_shndx);
if (mEhdr->e_machine == EM_X86_64) { switch (ELF_R_TYPE(Rel->r_info)) { diff --git a/edk2/BaseTools/Source/C/GenSec/GenSec.c b/edk2/BaseTools/Source/C/GenSec/GenSec.c index ed34ec4..3fd61d1 100644 --- a/edk2/BaseTools/Source/C/GenSec/GenSec.c +++ b/edk2/BaseTools/Source/C/GenSec/GenSec.c @@ -915,7 +915,7 @@ Returns: { UINT32 Index; UINT32 InputFileNum; - FILE *InFile; + //FILE *InFile; FILE *OutFile; CHAR8 **InputFileName; CHAR8 *OutputFileName; @@ -944,7 +944,7 @@ Returns: SectionName = NULL; CompressionName = NULL; StringBuffer = ""; - InFile = NULL; + //InFile = NULL; OutFile = NULL; VersionNumber = 0; InputFileNum = 0; diff --git a/edk2/BaseTools/Source/C/GenVtf/GenVtf.c b/edk2/BaseTools/Source/C/GenVtf/GenVtf.c index 035c268..10e7b93 100644 --- a/edk2/BaseTools/Source/C/GenVtf/GenVtf.c +++ b/edk2/BaseTools/Source/C/GenVtf/GenVtf.c @@ -1141,7 +1141,7 @@ Returns: EFI_STATUS Status; UINT64 CompStartAddress; UINT64 FileSize; - UINT64 NumByteRead; + //UINT64 NumByteRead; UINT64 NumAdjustByte; UINT8 *Buffer; FILE *Fp; @@ -1189,7 +1189,7 @@ Returns: // // Read first 64 bytes of PAL header and use it to find version info // - NumByteRead = fread (Buffer, sizeof (UINT8), SIZE_OF_PAL_HEADER, Fp); + /* NumByteRead = */fread (Buffer, sizeof (UINT8), SIZE_OF_PAL_HEADER, Fp);
// // PAL header contains the version info. Currently, we will use the header @@ -1200,7 +1200,7 @@ Returns: } }
- NumByteRead = fread (Buffer, sizeof (UINT8), (UINTN) FileSize, Fp); + /* NumByteRead = */fread (Buffer, sizeof (UINT8), (UINTN) FileSize, Fp); fclose (Fp);
// @@ -1329,7 +1329,7 @@ Returns: UINT64 AbsAddress; UINTN RelativeAddress; UINT64 FileSize; - UINT64 NumByteRead; + //UINT64 NumByteRead; UINT8 *Buffer; FILE *Fp; FIT_TABLE *PalFitPtr; @@ -1367,7 +1367,7 @@ Returns: // // Read, Get version Info and discard the PAL header. // - NumByteRead = fread (Buffer, sizeof (UINT8), SIZE_OF_PAL_HEADER, Fp); + /*NumByteRead = */fread (Buffer, sizeof (UINT8), SIZE_OF_PAL_HEADER, Fp);
// // Extract the version info from header of PAL_A. Once done, discrad this buffer @@ -1379,7 +1379,7 @@ Returns: // // Read PAL_A file in a buffer // - NumByteRead = fread (Buffer, sizeof (UINT8), (UINTN) FileSize, Fp); + /*NumByteRead = */fread (Buffer, sizeof (UINT8), (UINTN) FileSize, Fp); fclose (Fp);
PalStartAddress = Fv1EndAddress - (SIZE_TO_OFFSET_PAL_A_END + FileSize); @@ -1759,7 +1759,7 @@ Returns: UINT8 *Buffer; UINT8 *LocalVtfBuffer; UINTN FileSize; - UINTN NumByteRead; + //UINTN NumByteRead; FILE *Fp;
if (!strcmp (FileName, "")) { @@ -1784,7 +1784,7 @@ Returns: return EFI_OUT_OF_RESOURCES; }
- NumByteRead = fread (Buffer, sizeof (UINT8), FileSize, Fp); + /* NumByteRead = */fread (Buffer, sizeof (UINT8), FileSize, Fp);
LocalVtfBuffer = (UINT8 *) Vtf1EndBuffer - SIZE_IA32_RESET_VECT; memcpy (LocalVtfBuffer, Buffer, FileSize); @@ -2121,7 +2121,7 @@ Returns: FILE *Fp; UINT64 *StartAddressPtr; UINTN FirstFwVSize; - UINTN NumByte; + //UINTN NumByte;
StartAddressPtr = malloc (sizeof (UINT64)); if (StartAddressPtr == NULL) { @@ -2141,7 +2141,7 @@ Returns:
FirstFwVSize = _filelength (fileno (Fp)); fseek (Fp, (long) (FirstFwVSize - (UINTN) (SIZE_IA32_RESET_VECT + SIZE_SALE_ENTRY_POINT)), SEEK_SET); - NumByte = fwrite ((VOID *) StartAddressPtr, sizeof (UINT64), 1, Fp); + /* NumByte = */fwrite ((VOID *) StartAddressPtr, sizeof (UINT64), 1, Fp);
if (Fp) { fclose (Fp); diff --git a/edk2/BaseTools/Source/C/GnuGenBootSector/GnuGenBootSector.c b/edk2/BaseTools/Source/C/GnuGenBootSector/GnuGenBootSector.c index 267eaa3..559c447 100644 --- a/edk2/BaseTools/Source/C/GnuGenBootSector/GnuGenBootSector.c +++ b/edk2/BaseTools/Source/C/GnuGenBootSector/GnuGenBootSector.c @@ -305,7 +305,7 @@ main ( char *argv[] ) { - CHAR8 *AppName; + //CHAR8 *AppName; INTN Index; BOOLEAN ProcessMbr; ERROR_STATUS Status; @@ -319,7 +319,7 @@ main ( ZeroMem(&InputPathInfo, sizeof(PATH_INFO)); ZeroMem(&OutputPathInfo, sizeof(PATH_INFO));
- AppName = *argv; + //AppName = *argv; argv ++; argc --;
diff --git a/edk2/BaseTools/Source/C/Split/Split.c b/edk2/BaseTools/Source/C/Split/Split.c index 930a2ad..2645b4b 100644 --- a/edk2/BaseTools/Source/C/Split/Split.c +++ b/edk2/BaseTools/Source/C/Split/Split.c @@ -229,7 +229,7 @@ Returns: CHAR8 *CurrentDir = NULL; UINT64 Index; CHAR8 CharC; - BOOLEAN QuietFlag = TRUE; + //BOOLEAN QuietFlag = TRUE; UINT64 DebugLevel = 0; UINT64 VerboseLevel = 0;
@@ -307,7 +307,7 @@ Returns: }
if ((stricmp (argv[0], "-q") == 0) || (stricmp (argv[0], "--quiet") == 0)) { - QuietFlag = TRUE; + //QuietFlag = TRUE; argc --; argv ++; continue;
--- .../Source/C/LzmaCompress/Sdk/C/LzmaEnc.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c b/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c index 529fd98..5c23a4d 100644 --- a/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c +++ b/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c @@ -1919,11 +1919,13 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, Bool useLimits, UInt32 maxPackSize static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) { UInt32 beforeSize = kNumOpts; + #ifdef COMPRESS_MF_MT Bool btMode; + #endif if (!RangeEnc_Alloc(&p->rc, alloc)) return SZ_ERROR_MEM; - btMode = (p->matchFinderBase.btMode != 0); #ifdef COMPRESS_MF_MT + btMode = (p->matchFinderBase.btMode != 0); p->mtMode = (p->multiThread && !p->fastMode && btMode); #endif
--- .../EmbeddedMonotonicCounter.c | 2 +- edk2/MdeModulePkg/Core/Dxe/Event/Event.c | 2 +- edk2/MdeModulePkg/Core/Dxe/Event/Timer.c | 2 +- edk2/MdeModulePkg/Core/Dxe/Hand/Handle.c | 4 ++-- edk2/MdeModulePkg/Core/Dxe/Hand/Notify.c | 4 ++-- edk2/MdeModulePkg/Core/Dxe/Mem/Page.c | 6 +++--- edk2/MdeModulePkg/Core/Dxe/Mem/Pool.c | 4 ++-- .../Universal/HiiDatabaseDxe/HiiDatabaseEntry.c | 10 +++++----- .../Universal/SecurityStubDxe/SecurityStub.c | 2 +- .../Universal/WatchdogTimerDxe/WatchdogTimer.c | 2 +- edk2/Omap35xxPkg/InterruptDxe/HardwareInterrupt.c | 2 +- 11 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/edk2/EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.c b/edk2/EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.c index 21397dc..8cb26e6 100644 --- a/edk2/EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.c +++ b/edk2/EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.c @@ -66,7 +66,7 @@ MonotonicCounterDriverInitialize ( EFI_HANDLE Handle = NULL;
// Make sure the Monotonic Counter Architectural Protocol is not already installed in the system - ASSERT_PROTOCOL_ALREADY_INSTALLED(NULL, &gEfiMonotonicCounterArchProtocolGuid); + //ASSERT_PROTOCOL_ALREADY_INSTALLED(NULL, &gEfiMonotonicCounterArchProtocolGuid);
// Fill in the EFI Boot Services and EFI Runtime Services Monotonic Counter Fields gBS->GetNextMonotonicCount = GetNextMonotonicCount; diff --git a/edk2/MdeModulePkg/Core/Dxe/Event/Event.c b/edk2/MdeModulePkg/Core/Dxe/Event/Event.c index d9fc758..d5a19fd 100644 --- a/edk2/MdeModulePkg/Core/Dxe/Event/Event.c +++ b/edk2/MdeModulePkg/Core/Dxe/Event/Event.c @@ -225,7 +225,7 @@ CoreNotifyEvent ( // // Event database must be locked // - ASSERT_LOCKED (&gEventQueueLock); + //ASSERT_LOCKED (&gEventQueueLock);
// // If the event is queued somewhere, remove it diff --git a/edk2/MdeModulePkg/Core/Dxe/Event/Timer.c b/edk2/MdeModulePkg/Core/Dxe/Event/Timer.c index b1a5e3c..a03c022 100644 --- a/edk2/MdeModulePkg/Core/Dxe/Event/Timer.c +++ b/edk2/MdeModulePkg/Core/Dxe/Event/Timer.c @@ -46,7 +46,7 @@ CoreInsertEventTimer ( LIST_ENTRY *Link; IEVENT *Event2;
- ASSERT_LOCKED (&mEfiTimerLock); + //ASSERT_LOCKED (&mEfiTimerLock);
// // Get the timer's trigger time diff --git a/edk2/MdeModulePkg/Core/Dxe/Hand/Handle.c b/edk2/MdeModulePkg/Core/Dxe/Hand/Handle.c index e549484..c6d1ef4 100644 --- a/edk2/MdeModulePkg/Core/Dxe/Hand/Handle.c +++ b/edk2/MdeModulePkg/Core/Dxe/Hand/Handle.c @@ -105,7 +105,7 @@ CoreFindProtocolEntry ( PROTOCOL_ENTRY *Item; PROTOCOL_ENTRY *ProtEntry;
- ASSERT_LOCKED(&gProtocolDatabaseLock); + //ASSERT_LOCKED(&gProtocolDatabaseLock);
// // Search the database for the matching GUID @@ -179,7 +179,7 @@ CoreFindProtocolInterface ( PROTOCOL_ENTRY *ProtEntry; LIST_ENTRY *Link;
- ASSERT_LOCKED(&gProtocolDatabaseLock); + //ASSERT_LOCKED(&gProtocolDatabaseLock); Prot = NULL;
// diff --git a/edk2/MdeModulePkg/Core/Dxe/Hand/Notify.c b/edk2/MdeModulePkg/Core/Dxe/Hand/Notify.c index 53780f8..e06b75e 100644 --- a/edk2/MdeModulePkg/Core/Dxe/Hand/Notify.c +++ b/edk2/MdeModulePkg/Core/Dxe/Hand/Notify.c @@ -30,7 +30,7 @@ CoreNotifyProtocolEntry ( PROTOCOL_NOTIFY *ProtNotify; LIST_ENTRY *Link;
- ASSERT_LOCKED (&gProtocolDatabaseLock); + //ASSERT_LOCKED (&gProtocolDatabaseLock);
for (Link=ProtEntry->Notify.ForwardLink; Link != &ProtEntry->Notify; Link=Link->ForwardLink) { ProtNotify = CR(Link, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE); @@ -62,7 +62,7 @@ CoreRemoveInterfaceFromProtocol ( PROTOCOL_ENTRY *ProtEntry; LIST_ENTRY *Link;
- ASSERT_LOCKED (&gProtocolDatabaseLock); + //ASSERT_LOCKED (&gProtocolDatabaseLock);
Prot = CoreFindProtocolInterface (Handle, Protocol, Interface); if (Prot != NULL) { diff --git a/edk2/MdeModulePkg/Core/Dxe/Mem/Page.c b/edk2/MdeModulePkg/Core/Dxe/Mem/Page.c index 04844e3..e54e19d 100644 --- a/edk2/MdeModulePkg/Core/Dxe/Mem/Page.c +++ b/edk2/MdeModulePkg/Core/Dxe/Mem/Page.c @@ -174,7 +174,7 @@ CoreAddRange ( ASSERT ((Start & EFI_PAGE_MASK) == 0); ASSERT (End > Start) ;
- ASSERT_LOCKED (&gMemoryLock); + //ASSERT_LOCKED (&gMemoryLock);
DEBUG ((DEBUG_PAGE, "AddRange: %lx-%lx to %d\n", Start, End, Type));
@@ -309,7 +309,7 @@ CoreFreeMemoryMapStack ( MEMORY_MAP *Entry2; LIST_ENTRY *Link2;
- ASSERT_LOCKED (&gMemoryLock); + //ASSERT_LOCKED (&gMemoryLock);
// // If already freeing the map stack, then return @@ -695,7 +695,7 @@ CoreConvertPages ( ASSERT (NumberOfPages); ASSERT ((Start & EFI_PAGE_MASK) == 0); ASSERT (End > Start) ; - ASSERT_LOCKED (&gMemoryLock); + //ASSERT_LOCKED (&gMemoryLock);
if (NumberOfPages == 0 || ((Start & EFI_PAGE_MASK) != 0) || (Start > (Start + NumberOfBytes))) { return EFI_INVALID_PARAMETER; diff --git a/edk2/MdeModulePkg/Core/Dxe/Mem/Pool.c b/edk2/MdeModulePkg/Core/Dxe/Mem/Pool.c index 2808905..dcdeeae 100644 --- a/edk2/MdeModulePkg/Core/Dxe/Mem/Pool.c +++ b/edk2/MdeModulePkg/Core/Dxe/Mem/Pool.c @@ -242,7 +242,7 @@ CoreAllocatePoolI ( UINTN Offset; UINTN NoPages;
- ASSERT_LOCKED (&gMemoryLock); + //ASSERT_LOCKED (&gMemoryLock);
// // Adjust the size by the pool header & tail overhead @@ -432,7 +432,7 @@ CoreFreePoolI ( // ASSERT (Tail->Signature == POOL_TAIL_SIGNATURE); ASSERT (Head->Size == Tail->Size); - ASSERT_LOCKED (&gMemoryLock); + //ASSERT_LOCKED (&gMemoryLock);
if (Tail->Signature != POOL_TAIL_SIGNATURE) { return EFI_INVALID_PARAMETER; diff --git a/edk2/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseEntry.c b/edk2/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseEntry.c index ae75f8c..30b9448 100644 --- a/edk2/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseEntry.c +++ b/edk2/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseEntry.c @@ -148,11 +148,11 @@ InitializeHiiDatabase ( // If there is another out there, someone is trying to install us // again. Fail that scenario. // - ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiDatabaseProtocolGuid); - ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiFontProtocolGuid); - ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiImageProtocolGuid); - ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiStringProtocolGuid); - ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiConfigRoutingProtocolGuid); + //ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiDatabaseProtocolGuid); + //ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiFontProtocolGuid); + //ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiImageProtocolGuid); + //ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiStringProtocolGuid); + //ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiConfigRoutingProtocolGuid);
InitializeListHead (&mPrivate.DatabaseList); InitializeListHead (&mPrivate.DatabaseNotifyList); diff --git a/edk2/MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.c b/edk2/MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.c index 8e81d87..8eb6dcd 100644 --- a/edk2/MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.c +++ b/edk2/MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.c @@ -99,7 +99,7 @@ SecurityStubInitialize ( // // Make sure the Security Architectural Protocol is not already installed in the system // - ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiSecurityArchProtocolGuid); + //ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiSecurityArchProtocolGuid);
// // Install the Security Architectural Protocol onto a new handle diff --git a/edk2/MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.c b/edk2/MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.c index b018eb2..8eaaebe 100644 --- a/edk2/MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.c +++ b/edk2/MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.c @@ -222,7 +222,7 @@ WatchdogTimerDriverInitialize ( // // Make sure the Watchdog Timer Architectural Protocol has not been installed in the system yet. // - ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiWatchdogTimerArchProtocolGuid); + //ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiWatchdogTimerArchProtocolGuid);
// // Create the timer event to implement a simple watchdog timer diff --git a/edk2/Omap35xxPkg/InterruptDxe/HardwareInterrupt.c b/edk2/Omap35xxPkg/InterruptDxe/HardwareInterrupt.c index 5040c4b..e99271f 100644 --- a/edk2/Omap35xxPkg/InterruptDxe/HardwareInterrupt.c +++ b/edk2/Omap35xxPkg/InterruptDxe/HardwareInterrupt.c @@ -317,7 +317,7 @@ InterruptDxeInitialize ( EFI_CPU_ARCH_PROTOCOL *Cpu;
// Make sure the Interrupt Controller Protocol is not already installed in the system. - ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gHardwareInterruptProtocolGuid); + //ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gHardwareInterruptProtocolGuid);
// Make sure all interrupts are disabled by default. MmioWrite32 (INTCPS_MIR(0), 0xFFFFFFFF);
Thanks Loic for your feedbacks, it is quite useful.
The Tianocore/EDK2 tree is divided in different packages. Each package has its own maintainer. The patches needs to be reviewed by the maintainer before to be committed. I cannot guarantee all these patches will be committed to the repository soon because I do not have control on these packages. But some of these patches are in process to be pushed upstream.
The unused variable and always true condition warnings/errors sound quite familiar to me but not on the related source files.
About this error: ASSERT_EFI_ERROR (Status = Unsupported) ASSERT /home/lool/git/edk2/edk2/edk2/EmbeddedPkg/Library/PrePiLib/PrePiLib.c(73): !EFI_ERROR (Status)
This error is due to the UEFI binary used some relocation symbols not supported by Tianocore. It could be another Tianocore bug related to the use of a newer GCC.
I will have a try with the Linaro toolchain and see if I can reproduce the issues.
Thanks again Loic, Olivier
-----Original Message----- From: Loïc Minier [mailto:loic.minier@linaro.org] Sent: 07 July 2011 17:18 To: Olivier Martin Cc: boot-architecture@lists.linaro.org Subject: Re: UEFI on BeagleBoard qEmu
On Wed, Jul 06, 2011, Olivier Martin wrote:
Anyway, these are the build instructions to build the Tianocore project (UEFI Open Source implementation) and to test on qEmu: http://edk2.svn.sourceforge.net/viewvc/edk2/trunk/edk2/BeagleBoardPkg/readme .txt?revision=11997
I had started following these, but ran into some issues with my setup; I will try with the alternate build-next.sh approach too, to see whether I get other issues or not.
The two classes of issues I ran into was: a) variables being written to, but never read b) conditions being always true
I indeed had to apply the patch you mention; what's the state of that patch? Are these things which will get merged soonish? Without the patch, my toolchain wouldn't be properly picked up (it'd try running c:/program files/ stuff and calling a CS toolchain) and I had some error conditions like '-(' in linker invocations due to missing '' escapes. These go away with the patch and my toolchain is picked up and works.
I'm running Ubuntu oneiric (which will become 11.10) and the toolchain I've used is our packaged Linaro GCC based cross-compiler (arm-linux-gnueabi-gcc from the gcc-arm-linux-gnueabi package).
a) variables being written to, but never read
This is stuff like:
--- a/edk2/BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c +++ b/edk2/BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c @@ -181,7 +181,7 @@ Returns: CHAR8* OutputFileName = NULL; CHAR8* InputFileNames[MAX_PE_IMAGES + 1]; UINT8 InputFileCount = 0; - BOOLEAN QuietFlag = FALSE; + //BOOLEAN QuietFlag = FALSE; UINT64 DebugLevel = 0; UINT64 VerboseLevel = 0; EFI_STATUS Status = EFI_SUCCESS; @@ -220,7 +220,7 @@ Returns: }
if ((stricmp (argv[0], "-q") == 0) || (stricmp (argv[0], "--quiet") == 0)) { - QuietFlag = TRUE; + //QuietFlag = TRUE; argc --; argv ++; continue;
QuietFlag is never used (read), newer gccs detect this and report it as a fatal warning by default (not sure where this warning is configured as a fatal one, whether it's in UEFI or in the toolchain config).
There are many such cases, but some are a bit more worrying, like variables holding the return values of fread of fwrite not being checked: --- a/edk2/BaseTools/Source/C/GenVtf/GenVtf.c +++ b/edk2/BaseTools/Source/C/GenVtf/GenVtf.c @@ -1141,7 +1141,7 @@ Returns: EFI_STATUS Status; UINT64 CompStartAddress; UINT64 FileSize; - UINT64 NumByteRead; + //UINT64 NumByteRead; UINT64 NumAdjustByte; UINT8 *Buffer; FILE *Fp; @@ -1189,7 +1189,7 @@ Returns: // // Read first 64 bytes of PAL header and use it to find version info // - NumByteRead = fread (Buffer, sizeof (UINT8), SIZE_OF_PAL_HEADER, Fp); + /* NumByteRead = */fread (Buffer, sizeof (UINT8), SIZE_OF_PAL_HEADER, Fp);
// // PAL header contains the version info. Currently, we will use the header @@ -1200,7 +1200,7 @@ Returns: } }
- NumByteRead = fread (Buffer, sizeof (UINT8), (UINTN) FileSize, Fp); + /* NumByteRead = */fread (Buffer, sizeof (UINT8), (UINTN) FileSize, Fp); fclose (Fp);
//
I just quickly hacked the source to get it to build, but we should fix the code to loop until all bytes have been read or to raise an error.
The last such cases is a conditional piece of code: --- a/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c +++ b/edk2/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c @@ -1919,11 +1919,13 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, Bool useLimits, UInt32 maxPackSize static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) { UInt32 beforeSize = kNumOpts; + #ifdef COMPRESS_MF_MT Bool btMode; + #endif if (!RangeEnc_Alloc(&p->rc, alloc)) return SZ_ERROR_MEM; - btMode = (p->matchFinderBase.btMode != 0); #ifdef COMPRESS_MF_MT + btMode = (p->matchFinderBase.btMode != 0); p->mtMode = (p->multiThread && !p->fastMode && btMode); #endif
b) conditions being always true
A bunch of asserts trigger a warning in newer GCCs, essentially the ASSERT macros in question are doing multiple things: - testing whether the object is null - testing some other condition on the object, like some state being correct but the objects are guaranteed to never be null from GCC PoV, so it raises a fatal warning; as a workaround I just commented the asserts out, but I guess what we should do is review whether any of the ASSERT_LOCKED() users has a chance of getting a NULL pointer, and either drop the NULL check or replace the macro with two.
--- a/edk2/MdeModulePkg/Core/Dxe/Event/Event.c +++ b/edk2/MdeModulePkg/Core/Dxe/Event/Event.c @@ -225,7 +225,7 @@ CoreNotifyEvent ( // // Event database must be locked // - ASSERT_LOCKED (&gEventQueueLock); + //ASSERT_LOCKED (&gEventQueueLock);
// // If the event is queued somewhere, remove it
I got this for a bunch of ASSERT_LOCKED(), ASSERT_PROTOCOL_ALREADY_INSTALLED(), and ASSERT_VOLUME_LOCKED()
These are all issues in edk2, except the ASSERT_VOLUME_LOCKED() macro issue which is the only issue in FatPkg and only there.
A cleaner workaround would be to make this warnings non-fatal for now for this toolchain, but the code should also be fixed not to trigger them. What's the best way to address this? Is there some bug tracker I should report these issues at?
To try the resulting image, I just did: qemu-system-arm -mtdblock \ ../Build/BeagleBoard/DEBUG_ARMGCC/FV/BeagleBoard_EFI_flashboot.fd \ -nographic -M beagle
which sent this on the serial port: UART Enabled Magic delay to disable watchdog timers properly.
ASSERT_EFI_ERROR (Status = Unsupported) ASSERT /home/lool/git/edk2/edk2/edk2/EmbeddedPkg/Library/PrePiLib/PrePiLib.c(73): !EFI_ERROR (Status)
I didn't actually look into this issue yet.
I tried passing a barebox based SD image I had built earlier (see other message) with -sd sd.img, but that didn't change the output.
-- Loïc Minier
-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
On Mon, Jul 11, 2011, Olivier Martin wrote:
The Tianocore/EDK2 tree is divided in different packages. Each package has its own maintainer. The patches needs to be reviewed by the maintainer before to be committed.
What's the best way forward here? Opening a bug with each package and/or mailing each maintainer, or perhaps there's a list I should start a discussion on? My patches aren't really patches, they just paper over the real issues at this point, but I'd rather hear from the maintainers before proposing this or that approach. If other maintainers are mostly working on other arches, like x86, am I supposed to test whether the issue affects x86 and that the patch doesn't regress x86?
I cannot guarantee all these patches will be committed to the repository soon because I do not have control on these packages. But some of these patches are in process to be pushed upstream.
That's understandable; it does bet for the question of staging changes; I see you currently maintain this patch that one applies before build; it's not ideal though because it shows as changes in the local checkout. Maybe we should be recommending the use of git-svn or bzr-svn and hosting both a clone of upstream + a modified branch with ARM/Linaro patches already applied on top?
This error is due to the UEFI binary used some relocation symbols not supported by Tianocore. It could be another Tianocore bug related to the use of a newer GCC.
Ok; I need to try with the toolchain you linked to too.
Our toolchain isn't ideally suited to build UEFI as it targets linux, but I believe we should fix issues in building UEFI with such a setup (one can build linux, barebox and u-boot fine with the Linaro linux cross toolchains). The other big difference outside of GCC versions is the default setup of our toolchain: it defaults to armv7-a and thumb.
Hi Loic, just a quick comment about this last ASSERT(), I will come back on the other points later. I think I understand what is going wrong here. It is a bit tricky ...
Before building the UEFI firmware, you have to prepare your UEFI build environment. To do that: 1) You set up the environment variables with: . edksetup.sh `pwd`/BaseTools 2) You build the Tianocore BaseTools
Unfortunately, the Tianocore BaseTools are broken as you know ... And we have to apply a patch (or a set of patches ...). I have just remembered you said you had troubles with the toolchain at the beginning. I guess it is because you did not apply the patch. What happen is this patch changes some compilation flags in the toolchains. These compilation flags are in [EDK2_ROOT]/BaseTools/Conf/tools_def.template. When you typed '. edksetup.sh `pwd`/BaseTools' the script copies [EDK2_ROOT]/BaseTools/Conf/ to [EDK2_ROOT]/Conf/. But if you change any files in [EDK2_ROOT]/BaseTools/Conf/ and you call again '. edksetup.sh `pwd`/BaseTools' the configuration files will not be overwritten.
It is I think why you have got this ASSERT(). One of my patches changes the compilation flags in [EDK2_ROOT]/BaseTools/Conf/tools_def.template to fix the generated relocation symbols. But in your case, you was still using the old configuration file. A workaround if you applied the patch after trying to build the BaseTools a first time is: 1) rm -Rf Conf/* 2) make -C BaseTools clean 3) . edksetup.sh `pwd`/BaseTools 4) make -C BaseTools
Let me know if it is better. Olivier
________________________________________ From: Loïc Minier [loic.minier@linaro.org] Sent: 07 July 2011 17:17 To: Olivier Martin Cc: boot-architecture@lists.linaro.org Subject: Re: UEFI on BeagleBoard qEmu
To try the resulting image, I just did: qemu-system-arm -mtdblock \ ../Build/BeagleBoard/DEBUG_ARMGCC/FV/BeagleBoard_EFI_flashboot.fd \ -nographic -M beagle
which sent this on the serial port: UART Enabled Magic delay to disable watchdog timers properly.
ASSERT_EFI_ERROR (Status = Unsupported) ASSERT /home/lool/git/edk2/edk2/edk2/EmbeddedPkg/Library/PrePiLib/PrePiLib.c(73): !EFI_ERROR (Status)
I didn't actually look into this issue yet.
-- Loïc Minier
-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
boot-architecture@lists.linaro.org