Jump to content

Clover Problems and Solutions


ErmaC
3,206 posts in this topic

Recommended Posts

I'll download Xcode 7.2 and try reproduce the problem. It's not high priority to support older build environments though.

BTW, is the hang only with boot6? Does boot7 work with older compiler? (boot7 is -mc --no-usb)

I think the same thing. Do not waste your Time 
this is work well in El Capitan
Edit I am not test boot7
I am at work now , I test tonight
Thanks 
Link to comment
Share on other sites

I tried the uploaded boot files.

The one from post #686 hangs on blank screen.

The one from post #689 Xcode62 hangs on blank screen.

The one from post *689 Xcode73 works.

 

So it's a different problem.  Since the Xcode 7.3 works, I tend to think it's the VA_LIST problem again.  Can you help me check if this is it as follows:

modify edk2/MdePkg/Include/Base.h like this

 

 

diff a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h
--- a/MdePkg/Include/Base.h
+++ b/MdePkg/Include/Base.h
@@ -501,7 +501,7 @@ struct _LIST_ENTRY {
 #define VA_COPY(Dest, Start)          __va_copy (Dest, Start)
 
 //#elif defined(__GNUC__) && !defined(NO_BUILTIN_VA_FUNCS)
-#elif defined(USE_CLANG_BUILTIN_VA_LIST) || (defined(__GNUC__) && !defined(__x86_64__))
+#elif 1 // defined(USE_CLANG_BUILTIN_VA_LIST) || (defined(__GNUC__) && !defined(__x86_64__))^M
 //
 // Use GCC built-in macros for variable argument lists.
 //
@@ -521,6 +521,7 @@ typedef __builtin_va_list VA_LIST;
 #define VA_COPY(Dest, Start)         __builtin_va_copy (Dest, Start)
 
 #elif defined(USE_CLANG_BUILTIN_MS_VA_LIST) || (defined(__GNUC__) && defined(__x86_64__) && (GCC_VERSION >= 48))
+#error 1^M
 
   typedef __builtin_ms_va_list VA_LIST;
 

 

don't save it. Just modify it to make a build. Then build boot6 with xcode 7.3, try and see it hangs or gets to the menu. If it gets to the menu, try starting the EFI shell and see if it hangs. Thanks.

 

Update: never mind, I tried it myself with xcode 7.3 - and the boot works ok.  It's some other problem.

I compiled clover  on 10.11.4 (Xcode73) with your changes.
1.Normal boot option- loaded on 10.11.4 but visual changes are not seen. It's   okey.
2.GUI->ShelEfi->Run Cloverx64.efi->Gui>Desktop - After Gui don’t no progress bar and apple, black screen and then the desktop.
3.Gui->ShellEfi->Exit->Gui-> normal  loading with the progress bar and apple.
 
post-617057-0-27696000-1462186553_thumb.jpg
  • Like 1
Link to comment
Share on other sites

2.GUI->ShelEfi->Run Cloverx64.efi->Gui>Desktop - After Gui don’t no progress bar and apple, black screen and then the desktop.

I'm not sure running nested CloverX64.efi from shell is supported in normal conditions. To return to Clover GUI I just do "exit" in the shell.

 

Anyway, thank. I'll try to reproduce non-working version with older Xcode.

Link to comment
Share on other sites

So here's my experience...

 

Tried Xcode 7.2

segmentation fault in ld because of CPUInterrupt.S and ASMFuncsX64.S.  ld crashes trying to link object files assembled by clang.

 

Modified inf files for CpuDxe and OsxAptioFixDrv to use CPUInterrupt.nasm and ASMFuncsX64.nasm.  Everything works great including shell.

 

Slice - what's your opinion about this?

 

Next experience...

Xcode 4.6.3.

Reproduces hang exprienced by chris1111 and droples on boot6.

Tried boot6 from xcode 4.6.3 with clover GUI from xcode 7.3 - also hangs

Tried boot6 from xcode 7.3 with clover GUI from xcode 4.6.3 - also hangs.

 

Remove -flto - everything works great including shell.

chris1111, droples: try changing build settings like this

 

diff a/Clover.dsc b/Clover.dsc
--- a/Clover.dsc
+++ b/Clover.dsc
@@ -575,7 +575,7 @@
   #MSFT:*_*_*_CC_FLAGS  = /FAcs /FR$(@R).SBR /wd4701 /wd4703 $(BUILD_OPTIONS)
   MSFT:*_*_*_CC_FLAGS  = /FAcs /FR$(@R).SBR /W2 $(BUILD_OPTIONS) -Dinline=__inline
   
-  XCODE:*_*_*_CC_FLAGS = -fno-unwind-tables -Os $(BUILD_OPTIONS) -Wno-msvc-include
+  XCODE:*_*_*_CC_FLAGS = -fno-unwind-tables -Os $(BUILD_OPTIONS) -fno-lto
   GCC:*_*_*_CC_FLAGS   = $(BUILD_OPTIONS) 
   #-Wunused-but-set-variable
   # -Os -fno-omit-frame-pointer -maccumulate-outgoing-args
diff a/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf b/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
--- a/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
+++ b/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
@@ -61,6 +61,6 @@
   ExtractGuidedSectionLib
 
 [BuildOptions]
-  XCODE:*_*_*_CC_FLAGS = -O0 -DMDEPKG_NDEBUG -Wno-msvc-include
+  XCODE:*_*_*_CC_FLAGS = -O0 -DMDEPKG_NDEBUG
   GCC:*_*_*_CC_FLAGS = -O0 -DMDEPKG_NDEBUG

 

Note: the -Wno-msvc-include is not related to the hang. Xcode 4.6.3 does not recognize this option, so I had to remove it to compile.

 

So now what?

Spend time finding out why -flto hangs on old Xcode? I doubt it.

Remove -flto completely so it's not used even on new Xcode? Not sure.

  • Like 2
Link to comment
Share on other sites

So here's my experience...

 

Tried Xcode 7.2

segmentation fault in ld because of CPUInterrupt.S and ASMFuncsX64.S.  ld crashes trying to link object files assembled by clang.

 

Modified inf files for CpuDxe and OsxAptioFixDrv to use CPUInterrupt.nasm and ASMFuncsX64.nasm.  Everything works great including shell.

 

Slice - what's your opinion about this?

 

Next experience...

Xcode 4.6.3.

Reproduces hang exprienced by chris1111 and droples on boot6.

Tried boot6 from xcode 4.6.3 with clover GUI from xcode 7.3 - also hangs

Tried boot6 from xcode 7.3 with clover GUI from xcode 4.6.3 - also hangs.

 

Remove -flto - everything works great including shell.

chris1111, droples: try changing build settings like this

 

 



diff a/Clover.dsc b/Clover.dsc
--- a/Clover.dsc
+++ b/Clover.dsc
@@ -575,7 +575,7 @@
   #MSFT:*_*_*_CC_FLAGS  = /FAcs /FR$(@R).SBR /wd4701 /wd4703 $(BUILD_OPTIONS)
   MSFT:*_*_*_CC_FLAGS  = /FAcs /FR$(@R).SBR /W2 $(BUILD_OPTIONS) -Dinline=__inline
   
-  XCODE:*_*_*_CC_FLAGS = -fno-unwind-tables -Os $(BUILD_OPTIONS) -Wno-msvc-include
+  XCODE:*_*_*_CC_FLAGS = -fno-unwind-tables -Os $(BUILD_OPTIONS) -fno-lto
   GCC:*_*_*_CC_FLAGS   = $(BUILD_OPTIONS) 
   #-Wunused-but-set-variable
   # -Os -fno-omit-frame-pointer -maccumulate-outgoing-args
diff a/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf b/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
--- a/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
+++ b/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
@@ -61,6 +61,6 @@
   ExtractGuidedSectionLib
 
 [BuildOptions]
-  XCODE:*_*_*_CC_FLAGS = -O0 -DMDEPKG_NDEBUG -Wno-msvc-include
+  XCODE:*_*_*_CC_FLAGS = -O0 -DMDEPKG_NDEBUG
   GCC:*_*_*_CC_FLAGS = -O0 -DMDEPKG_NDEBUG

 

Note: the -Wno-msvc-include is not related to the hang. Xcode 4.6.3 does not recognize this option, so I had to remove it to compile.

 

So now what?

Spend time finding out why -flto hangs on old Xcode? I doubt it.

Remove -flto completely so it's not used even on new Xcode? Not sure.

 

Yes! Boot6 (-t  XCODE5)_OSX10.10.5XCODE6.4 Works good.Thanks.

PS Boot6 - (-t  XCODE5) (OSX10.11.4XCODE73,OSX10.9.5XCODE6.2) there is no problem.

Everything  compiles (-t XCODE5,-t  XCLANG,-t  GCC53) with the latest patches.

post-617057-0-47597000-1462215663_thumb.jpg

post-617057-0-76906300-1462215615_thumb.jpg

b6Clover_X64_3498_BootLog.txt

  • Like 1
Link to comment
Share on other sites

Tried boot6 from xcode 4.6.3 with clover GUI from xcode 7.3 - also hangs

Tried boot6 from xcode 7.3 with clover GUI from xcode 4.6.3 - also hangs.

 

Remove -flto - everything works great including shell.

chris1111, droples: try changing build settings like this

 

Thanks! This works OK now!

Xcode 6.2, Mavericks 10.9.5

Link to comment
Share on other sites

Error compile again with Xcode 7.2 always the same 

Grrrr,,,,,

 

clang: error: unable to execute command: Segmentation fault: 11

clang: error: linker command failed due to signal (use -v to see invocation)

make: *** [/users/chris/src/edk2/Build/Clover/RELEASE_XCODE5/X64/Clover/CpuDxe/Cpu/DEBUG/Cpu.dll] Error 254

 

build.py...

 : error 7000: Failed to execute command

make tbuild [/users/chris/src/edk2/Build/Clover/RELEASE_XCODE5/X64/Clover/CpuDxe/Cpu]

 

Sorry Zenith432

Now trying Xcode 6.3

EDIT*** same 

 

EDIT**

Xcode 6.4

no luck! Feel like a noob

 

trying multiple time 

Build looks ok but this is my error 

Build Package

 

Building CloverUpdater application...

[XCODE]

Building CloverPrefpane preference...

[XCODE]

================= Making all in fdisk440 =================

[MKDIR] /Users/chris/src/edk2/Clover/CloverPackage/sym/build/fdisk440

[CC32] auto.c

[CC32] cmd.c

[CC32] disk.c

[CC32] fdisk.c

[CC32] getrawpartition.c

[CC32] mbr.c

[CC32] misc.c

[CC32] opendev.c

[CC32] part.c

[CC32] user.c

[CC64] auto.c

[CC64] cmd.c

[CC64] disk.c

[CC64] fdisk.c

[CC64] getrawpartition.c

[CC64] mbr.c

[CC64] misc.c

[CC64] opendev.c

[CC64] part.c

[CC64] user.c

[LD32] fdisk440_32

ld: library not found for -lgcc_s.10.5

clang: error: linker command failed with exit code 1 (use -v to see invocation)

make[1]: *** [/users/chris/src/edk2/Clover/CloverPackage/sym/utils/fdisk440] Error 1

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

 

Back to El Capitan  :lol:  :P 

​Maybe need to reinstall Yosemite brand new and retrying all the steps?

Link to comment
Share on other sites

I mentioned this.

In CpuDxe/Cpu.inf, comment out (#) lines containing CPUInterrupt.S.

In OsxAptioFixDrv/, two inf files - comment out line containing AsmFuncsX64.S.

Error compile again with Xcode 7.2 always the same

Attached are two scripts

  1. Modification of buildnasm.sh that downloads nasm-2.12.02rc1, patches it to fix the relocation bug, and builds it.
  2. A script buildmtoc.sh, similar to buildnasm.sh that downloads cctools and builds mtoc.NEW.

Caveats:

 

mtoc.NEW is installed in $TOOLCHAIN_DIR/bin instead of /usr/local/bin. Reason is /usr/local/bin requires sudo - so it's up to user to copy it there.

 

no LTO support in mtoc.NEW (don't think it's needed.)

 

Based on stuff in post #669

scripts.tar.gz

  • Like 3
Link to comment
Share on other sites

So here's my experience...

 

Tried Xcode 7.2

segmentation fault in ld because of CPUInterrupt.S and ASMFuncsX64.S.  ld crashes trying to link object files assembled by clang.

 

Modified inf files for CpuDxe and OsxAptioFixDrv to use CPUInterrupt.nasm and ASMFuncsX64.nasm.  Everything works great including shell.

 

Slice - what's your opinion about this?

It was something about linking optimization by XCODE that is possible with S and not with NASM. But now I agree it is better to compile with NASM.

As well scripts should be modified to use newer NASM version.

Next experience...

Xcode 4.6.3.

Reproduces hang exprienced by chris1111 and droples on boot6.

Tried boot6 from xcode 4.6.3 with clover GUI from xcode 7.3 - also hangs

Tried boot6 from xcode 7.3 with clover GUI from xcode 4.6.3 - also hangs.

 

Remove -flto - everything works great including shell.

chris1111, droples: try changing build settings like this

 

 

diff a/Clover.dsc b/Clover.dsc
--- a/Clover.dsc
+++ b/Clover.dsc
@@ -575,7 +575,7 @@
   #MSFT:*_*_*_CC_FLAGS  = /FAcs /FR$(@R).SBR /wd4701 /wd4703 $(BUILD_OPTIONS)
   MSFT:*_*_*_CC_FLAGS  = /FAcs /FR$(@R).SBR /W2 $(BUILD_OPTIONS) -Dinline=__inline
   
-  XCODE:*_*_*_CC_FLAGS = -fno-unwind-tables -Os $(BUILD_OPTIONS) -Wno-msvc-include
+  XCODE:*_*_*_CC_FLAGS = -fno-unwind-tables -Os $(BUILD_OPTIONS) -fno-lto
   GCC:*_*_*_CC_FLAGS   = $(BUILD_OPTIONS) 
   #-Wunused-but-set-variable
   # -Os -fno-omit-frame-pointer -maccumulate-outgoing-args
diff a/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf b/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
--- a/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
+++ b/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
@@ -61,6 +61,6 @@
   ExtractGuidedSectionLib
 
 [BuildOptions]
-  XCODE:*_*_*_CC_FLAGS = -O0 -DMDEPKG_NDEBUG -Wno-msvc-include
+  XCODE:*_*_*_CC_FLAGS = -O0 -DMDEPKG_NDEBUG
   GCC:*_*_*_CC_FLAGS = -O0 -DMDEPKG_NDEBUG

 

Note: the -Wno-msvc-include is not related to the hang. Xcode 4.6.3 does not recognize this option, so I had to remove it to compile.

 

So now what?

Spend time finding out why -flto hangs on old Xcode? I doubt it.

Remove -flto completely so it's not used even on new Xcode? Not sure.

 

 

I think this is all about Clang internal mistakes that was corrected in XCode7.3 (clang-3.8). We can fight with them or invent workarounds but globally we should keep working solutions to be working.

For official releases I am using ElCapitan + Xcode 7.3 -> XCODE5. It seems to be fully working solution. Switch to NASM requires a test.

I was using 10.9.5 + Xcode??? -> GCC49 before. And it was fine working toolset.

For custom build a user can use a toolset that works good for his software. Mavericks or Yosemite -> GCC.

Strange but in my Lion Xcode 4.4.1 also works fine producing working boot6. XCODE5 toolset. Funny that 4.4.1

 

About -flto/-fno-lto I will test today evening and I think we can introduce additional script parameter to switch it.

 

PS. As I see --no-usb always used with -mc and never without? Can we merge these flags? 

Link to comment
Share on other sites

 

Attached are two scripts

  1. Modification of buildnasm.sh that downloads nasm-2.12.02rc1, patches it to fix the relocation bug, and builds it.
  2.  

both work

but why do we check for gcc if Xcode tools are used instead of?

if [[ ! -x "$TOOLCHAIN_DIR"/bin/gcc || \
      ! -x "$TOOLCHAIN_DIR"/bin/g++ ]]; then
    echo "No clover toolchain found !" >&2
,,,

removed this part, works without it

it seems that they are partners that cannot be separated :D

they are different keys not related one to other

Link to comment
Share on other sites

 

mtoc.NEW is installed in $TOOLCHAIN_DIR/bin instead of /usr/local/bin. Reason is /usr/local/bin requires sudo - so it's up to user to copy it there.

 

 

 

can we run and use it from TOOLCHAIN DIR not from /usr/local/bin without copying?

Link to comment
Share on other sites

#      *_*_*_MTOC_PATH  = /usr/local/bin/mtoc.NEW
       *_*_*_MTOC_PATH  = ~/src/opt/local/bin/mtoc.NEW

this way?

 

No, ~/.. impossible here.

  • Like 1
Link to comment
Share on other sites

About -flto/-fno-lto I will test today evening and I think we can introduce additional script parameter to switch it.

Good idea.

Maybe also add --with-nasm to ebuild.sh to change xcode/clang buildruleorder to "nasm S s". That way users of older Xcode can modify with ebuild.sh options instead of patching.

 

PS. As I see --no-usb always used with -mc and never without? Can we merge these flags?

There is a certain logic in providing option to use just "--no-usb".

USB support loads Ehci/Uhci/Ohci (Xhci is not built-in, only in drivers folders).

Loading these Dxe does has 2 side effects -

1) turns off USB legacy, so following no longer work

BiosKeyboard (KeyboardDxe)

PS2Keyboard

[similar for mouse if used]

BiosBlockIO no longer has access to USB drives via int13.

2) several second delay to GUI for USB bus enumeration.

 

Using -mc with USB support probably works in way, but not very useful. Keyboard or mouse can still work via USB. BiosBlockIO still used for AHCI/IDE, but not for USB drive.  USB drive is accessible via the USB drivers.  There is no upside to this combination, because native EFI AHCI and IDE drivers works just as well as INT13, and user gets the delay for USB enumeration.

 

Using --no-usb without BiosBlockIO also works in way, but partially.  Keyboard (or mouse) accessible via BiosKeyboard or PS2Keyboard.  AHCI/IDE drives are accessible via native drivers.  USB drives are not accessible in this combo.  (That's only needed for booting USB anyway).  The upside is that --no-usb saves several second delay of USB enumeration.

 

So the hybrid combos can be used, but are not mainstream.

  • Like 1
Link to comment
Share on other sites

if $PATH contains it just "mtoc.NEW" should be enough (?), but each makefile/.inf files must be adjusted:

 

cd ~/src

for i in `grep -rl /usr/local/bin/mtoc.NEW . 2> /dev/null`; do sed -i "" 's:/usr/local/bin/mtoc.NEW:mtoc.NEW:g' $i; done

 

*not tested, I'll try to run it tonight. (backup the src folder firstly)

 

EDIT

 

* the commad works fine to replace all the occurrences recursively, I mean that I have not tested to compile Clover yet.. no time now

 

EDIT II

paths must be existing:

 

 

checkMTOCK() {

    # ensure custom paths exists to be used with buildgettex/nasm script

    mkdir -p ~/src/opt/local/bin

    mkdir -p ~/src/tools/download

    mkdir -p ~/src/tools/logs

    # NOTE: buildgettex script already add this custom path to $PATH, otherwise must be exported

 

    echo "[ mtoc.NEW ]";

 

    if [[ ! -f ~/src/opt/local/bin/mtoc.NEW ]] ; then

        # Slice added mtoc.NEW binary.. using it!

        ditto -xk ~/src/edk2/Clover/BuildTools/usr/local/bin/mtoc.NEW.zip ~/src/opt/local/bin && chmod +x ~/src/opt/local/bin/mtoc.NEW

        # patch Clover files to use mtoc from ~/src/opt/local/bin, no installation that require sudo is needed!

        cd ~/src

        for i in `grep -rl /usr/local/bin/mtoc.NEW . 2> /dev/null`; do sed -i "" 's:/usr/local/bin/mtoc.NEW:mtoc.NEW:g' $i; done

        

    fi

 

}

 

checkMTOCK

 

 

..just an idea..

Link to comment
Share on other sites

The idea is good but I don't know for a what you checked "/usr/local/bin/mtoc.NEW"?

the command I posted modify all occurences found inside the rsc folder including any makefiles (some are automatically generates.. but each time?) or other config file that contains this path to be only "mtoc.NEW", so if a file contains:

 

MTOC = /usr/local/bin/mtoc.NEW

 

after will be:

 

MTOC = mtoc.NEW

 

as I said not yet tested to compile Clover, I'm doing something else today with my PC (writing from a secondary System because the lappy is under stylographic design on the Lid by a friend of mine :D )

 

EDIT

got it. Ok, normally I'm sharing Clover, yet, built with gcc 4.9 so I have a lot of MakeFiles created by the build tool, from this the part that replace the full path to mtoc in the function I posted .

 

Something on the fly (un)load "/EFI/CLOVER/ACPI/patched/*.AML"

 

 

 

<plist version="1.0">
<dict>
<key>ACPI</key>
<dict>
  ...
  <key>DisabledAML</key>
  <array>
    <string>SSDT-3.aml</string>
    <string>SSDT-11.aml</string>
    <string>SSDT-2.aml</string>
  </array>
  <key>SortedOrder</key>
  <array>
    <string>SSDT-3.aml</string>
    <string>SSDT-1.aml</string>
    <string>SSDT-2.aml</string>
  </array>
</dict>

 

Cool... going to wrote code for Ares.app in the eventually.. just yesterday I finished to implement your Graphics->NVIDIA/ATI

Edited by Micky1979
  • Like 1
Link to comment
Share on other sites

×
×
  • Create New...