Jump to content

Clover Problems and Solutions


ErmaC
3,206 posts in this topic

Recommended Posts

droples, you may have some stale object files from previous builds that are being mixed with new object files created by GCC 5.3.  Try doing a clean build.  If it still doesn't work, I'll try reproduce this problem when I have time.

(LTO = Link Time Optimization)

 

Edit: I tested building Clover/AtaAtapi/AtaAtapiPassThru.inf with a clean build + GCC 5.3 and it works.

Edited by Zenith432
Link to comment
Share on other sites

droples, you may have some stale object files from previous builds that are being mixed with new object files created by GCC 5.3.  Try doing a clean build.  If it still doesn't work, I'll try reproduce this problem when I have time.

(LTO = Link Time Optimization)

 

Edit: I tested building Clover/AtaAtapi/AtaAtapiPassThru.inf with a clean build + GCC 5.3 and it works.

I'm sorry. I was wrong.Everything compiles, but there is a nuance

Generate Loader Image ...
Created /Users/droplets/src/edk2/Build/Clover/RELEASE_GCC49/FV/Efildr64
GenPage...
/Users/droplets/src/edk2/Build/Clover/RELEASE_GCC49/FV/Efildr20Pure: ERROR 16386: Invalid parameter option
  Input file size (0x6ab7d) exceeds the Page Table Offset (0x68000)
iMac-Droplets:Clover droplets$
Link to comment
Share on other sites

 

I'm sorry. I was wrong.Everything compiles, but there is a nuance

Generate Loader Image ...
Created /Users/droplets/src/edk2/Build/Clover/RELEASE_GCC49/FV/Efildr64
GenPage...
/Users/droplets/src/edk2/Build/Clover/RELEASE_GCC49/FV/Efildr20Pure: ERROR 16386: Invalid parameter option
  Input file size (0x6ab7d) exceeds the Page Table Offset (0x68000)
iMac-Droplets:Clover droplets$

Use --std-ebda flag

 

./ebuild.sh --std-ebda

Link to comment
Share on other sites

droples, either what Slice said, or set "GCC:*_*_*_CC_FLAGS   = $(BUILD_OPTIONS) -Os" in Clover.dsc near the end of the file.  See the discussion in posts #365 - #367, #371 - #372.

 

[bTW, this overflow also happened to me with GCC 5.2, so the change 5.2 -> 5.3 is not a regression.  In fact, I upgraded from 5.2 to 5.3 to check if it makes the overflow go away.]

Link to comment
Share on other sites

do we now use build_gcc5.sh instead of buildgcc-4.9.sh?

LOL. It's up to you. As long as you give the toolchain the same name, gcc 5.3 works as a drop-in replacement for 4.9 with the caveat of possibly needing to use --std-ebda or -Os. gcc 4.9 works without this mod.

  • Like 1
Link to comment
Share on other sites

Use --std-ebda flag

 

./ebuild.sh --std-ebda

 

droples, either what Slice said, or set "GCC:*_*_*_CC_FLAGS   = $(BUILD_OPTIONS) -Os" in Clover.dsc near the end of the file.  See the discussion in posts #365 - #367, #371 - #372.

 

Thank you! All compiled.

post-617057-0-18516100-1459421819_thumb.jpg

LogCompileClover3391_GCC5.3(--std-ebda).txt

Clover3391_gcc53_LogCompile(B.._O..-Os).txt

  • Like 1
Link to comment
Share on other sites

do we now use build_gcc5.sh instead of buildgcc-4.9.sh?

If someone find new property due to gcc-5.

For example, moving from 4.8 to 4.9 gives me LTO, code reducing and possibility of LOW_EBDA.

What news expected with gcc-5?

Link to comment
Share on other sites

getting an error with compilation of clover-genconfig with v 3394?

edk2 is 20424

gcc 4.9

 

a recent change in this source file and it won't compile.

 

[XCODE] clover-genconfig
** INSTALL FAILED **

The following build commands failed:
CompileC /Extra/Clover_Install/CloverGrowerPro/edk2/Clover/CloverPackage/sym/build/clover-genconfig/clover-genconfig.build/Release/clover-genconfig.build/Objects-normal/x86_64/clover-genconfig.o clover-genconfig.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler
CompileC /Extra/Clover_Install/CloverGrowerPro/edk2/Clover/CloverPackage/sym/build/clover-genconfig/clover-genconfig.build/Release/clover-genconfig.build/Objects-normal/i386/clover-genconfig.o clover-genconfig.c normal i386 c com.apple.compilers.llvm.clang.1_0.compiler
(2 failures)
make[1]: *** [/Extra/Clover_Install/CloverGrowerPro/edk2/Clover/CloverPackage/sym/utils/clover-genconfig] Error 65
make: *** [all-recursive] Error 1

Link to comment
Share on other sites

@Slice

Accepted without check ;) I trust you.

getting an error with compilation of clover-genconfig with v 3394?

edk2 is 20424

gcc 4.9

 

a recent change in this source file and it won't compile.

 

[XCODE] clover-genconfig

** INSTALL FAILED **

The following build commands failed:

CompileC /Extra/Clover_Install/CloverGrowerPro/edk2/Clover/CloverPackage/sym/build/clover-genconfig/clover-genconfig.build/Release/clover-genconfig.build/Objects-normal/x86_64/clover-genconfig.o clover-genconfig.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler

CompileC /Extra/Clover_Install/CloverGrowerPro/edk2/Clover/CloverPackage/sym/build/clover-genconfig/clover-genconfig.build/Release/clover-genconfig.build/Objects-normal/i386/clover-genconfig.o clover-genconfig.c normal i386 c com.apple.compilers.llvm.clang.1_0.compiler

(2 failures)

make[1]: *** [/Extra/Clover_Install/CloverGrowerPro/edk2/Clover/CloverPackage/sym/utils/clover-genconfig] Error 65

make: *** [all-recursive] Error 1

Corrected in 3395

Link to comment
Share on other sites

 

Slice

do we still need to do this?

cp -R Clover/Patches_for_EDK2/* ./

Yes. Patches for EDK2 exists for this purpose. If they will be not needed then I'll delete them.

  • Like 1
Link to comment
Share on other sites

 

I've found a bug with picopng but have no idea how to resolve the issue so instead I've worked around it by changing the theme files.

 

Overview:

I’ve now looked in to this issue further and have found the reason for my optimised BGM256 theme volume icons failing to load in Clover’s GUI is due to an issue with picopng.

 
I’ve been using pngquant to optimise the PNG images in themes and while all has been good with 128px images, it turns out that the 256px images are resaved with more than one IDAT (data) chunks, which is legal. According to the PNG spec, in particular 
 
There can be multiple IDAT chunks; if so, they must appear consecutively with no other intervening chunks. The compressed datastream is then the concatenation of the contents of all the IDAT chunks. The encoder can divide the compressed datastream into IDAT chunks however it wishes. (Multiple IDAT chunks are allowed so that encoders can work in a fixed amount of memory; typically the chunk size will correspond to the encoder's buffer size.) It is important to emphasize that IDAT chunk boundaries have no semantic significance and can occur at any point in the compressed datastream.
 
This however causes a problem for picopng and although I haven’t worked out the exact reason I think to have at least, from a few hours of testing, narrowed the issue down to reallocating memory for more data in function vector8_resize().
 
Each time function PNG_decode() reads an IDAT chunk, it stores the data in memory until it finds either another IDAT chunk or IEND. I’ve found that after finding two IDAT chunks, a third IDAT chunk requires a reallocaton of memory and this process seems to be where the data read so far is lost.
 
Before line #236
data = png_alloc_realloc(p->data, newsize);
the data in memory correctly contains the IDAT data read so far. I added a debug statement to print the first entry; p->data[0]=78. 78 is the first byte of the PNG image data.
 
But after lines #237-241
if (data) 
{
p->allocsize = newsize;
p->data = (UINT8 *) data;
p->size = size;
the data in memory is lost and p->data[0]=0
 
My head was spinning at this point and I couldn’t fathom any more out so instead I looked to see if I could optimise the PNG images while retaining just a single IDAT chunk. 
 
In the end, the only method I have found to do this is to use https://tinypng.com which turns out even out-performs pngquant for compression. Using this I’ve managed to downsize BGM256 to 2.9MB, from 4.5MB and have a working theme for Clover. I'll upload the revised BGM256 theme to the theme repo. (EDIT: Done). But with this optimisation, and the option to skip linux scanning, this 256px theme loads way faster then it did at the beginning of the week :P
 
EDIT: If anyone is interested in looking at my tests and maybe trying to fix the problem with multiple IDAT chunks, I'm attaching a .zip containing:
- test os_cap.icns (the PNG file with .icns extension)
- the modified picopng.c with added debug print statements
- the relevant log section from Clover.

 

 

Hi blackosx,

 

I've found your bug.

As you said, it was in function png_alloc_realloc.

 

The function should be something like :

void *png_alloc_realloc(void *addr, UINT32 oldSize, UINT32 newSize)
{
    if (!addr) {
        return png_alloc_malloc(newSize);
    }
    if ( newSize <= oldSize ) {
        return addr;
    }
    png_alloc_node_t *old_node;
    old_node = png_alloc_find_node(addr, oldSize);
    if (old_node) {
        void *new_addr = ReallocatePool(oldSize, newSize, addr);
        old_node->addr = new_addr;
        old_node->size = newSize;
        return new_addr;
    }
    else {
        png_alloc_node_t* node = png_alloc_malloc(newSize);
        CopyMem(node->addr, addr, oldSize); // here, newSize is > oldSize
        return node->addr;
    }
}

and then you have to change the call to that function passing the old size (there is 2 calls).

 

The problem was that png_alloc_realloc wasn't retaining data. ReallocatePool do.

 

Now I can load my PNG from GIMP !!!

 

I'd like to commit this change. Where and how should I do it ? Do you know ?

The picopng.c to modify is the one in edk2/Clover/rEFIt_UEFI/Platform, not sure about the one in edk2/Clover/AppleImageCodec (I modified both, actually)

 

Jief

picopng.c.zip

  • Like 3
Link to comment
Share on other sites

@blackosx : You're welcome. Too bad I didn't find your post before, It would have saved me few hours or diagnosis  :) .

 

@Slice : For my information, could you tell me why there is 2 picopng (edk2/Clover/rEFIt_UEFI/Platform and edk2/Clover/AppleImageCodec) ?

Link to comment
Share on other sites

 

 

@Slice : For my information, could you tell me why there is 2 picopng (edk2/Clover/rEFIt_UEFI/Platform and edk2/Clover/AppleImageCodec) ?

They are in two different modules and AppleImageCodec needs two additional procedures egCreateImage and egFreeImage.

It can be optimized by placing picopng into common library if someone do this.

Link to comment
Share on other sites

while cannot sleep, @slice please review

I am on weekend and will look this on Monday. Anyway I will not comment out NVCAP. May be it is not needed for GTX650 in ElCapitan but it is essencial achievement for other systems.

  • Like 1
Link to comment
Share on other sites

×
×
  • Create New...