Jump to content

Clover Problems and Solutions


ErmaC
3,206 posts in this topic

Recommended Posts

-  nasm-2.12.01 configure...

Error configuring nasm-2.12.01 ! Check the log /Users/slice/src/tools/logs/nasm.configure.log.txt

 
/tmp/buildnasm-ramdisk/nasm-2.12.01/configure --prefix=/Users/slice/src/opt/local
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/tmp/buildnasm-ramdisk/nasm-2.12.01':
configure: error: C compiler cannot create executables
 
gcc -v
Apple LLVM version 7.3.0 (clang-703.0.29)
:unsure:

 slice$ /usr/bin/nasm -v

 

NASM version 0.98.40 (Apple Computer, Inc. build 11) compiled on Feb 10 2016

Link to comment
Share on other sites

nasm binary --->  http://www.nasm.us/pub/nasm/releasebuilds/2.12.01/macosx

 

./buildnasm.sh

 

Status: nasm-2.12.01.tar.bz2 not found.

% Total % Received % Xferd Average Speed Time Time Time Current

Dload Upload Total Spent Left Speed

100 936k 100 936k 0 0 310k 0 0:00:03 0:00:03 --:--:-- 310k

- Creating new RAM disk

 

Initialized /dev/rdisk3 as a 300 MB case-insensitive HFS Plus volume

- nasm-2.12.01 extract...

- nasm-2.12.01 configure...

- nasm-2.12.01 make...

- nasm-2.12.01 installing...

- nasm-2.12.01 installed in /Volumes/Dev/toolchain

 

- Ejecting RAM disk

"disk3" unmounted.

"disk3" ejected.

 

/Volumes/Dev/toolchain/bin/nasm -v

NASM version 2.12.01 compiled on Apr 19 2016

WTF?
Link to comment
Share on other sites

You may find the files in this archive useful.

https://dl.dropboxusercontent.com/u/81717403/InsanelyMac/Files.zip

 

 

Contains new ebuild.sh, build_gcc5.sh and a buildextras.sh.

Also contains build_rule.txt with proper paths to GCC, nasm and iasl binaries.

 

ebuild.sh will auto-build gcc5 if its not there as well as Nasm, Iasl and gettext. 

Nasm and Iasl will always auto-build to the Latest Versions ;)0

 

These files are the guts of CloverGrower V6.66.

I appreciate your work but until full verification I will commit these scripts as optional.

Your ebuild.sh script doesn't contain latest improvements from Zenith432. It will be good to synchronize them.

And about build_gcc5.sh

You delete line

        curl -L http://www.mpfr.org/mpfr-current/allpatches | patch -N -Z -p1 --directory="${MPFR_DIR}"

you have to say it is no more needed?

Link to comment
Share on other sites

Propose change for undocumented ErmaCs Graphics -> CardList, No ATI parse yet

** injection for NVIDIA card usage e.g (to be placed in the config.plist, under graphics tag):

<key>Graphics</key>
<dict>
  <key>NVIDIA</key>
  <array>
    <dict>
      <key>Model</key>
      <string>Quadro FX 380</string>
      <key>IOPCIPrimaryMatch</key>
      <string>0x10DE0658</string>
      <key>VRAM</key>
      <integer>256</integer>
      <key>VideoPorts</key>
      <integer>2</integer>
      <key>LoadVBios</key>
      <true/>
    </dict>
    <dict>
      <key>Model</key>
      <string>YOUR_SECOND_CARD_NAME</string>
      <key>IOPCIPrimaryMatch</key>
      <string>YOUR_SECOND_CARD_ID</string>
      <key>IOPCISubDevId</key>
      <string>YOUR_SECOND_CARD_SUB_ID(if necessary)</string>
      <key>VRAM</key>
      <integer>YOUR_SECOND_CARD_VRAM_SIZE</integer>
      <key>VideoPorts</key>
      <integer>YOUR_SECOND_CARD_PORTS</integer>
      <key>LoadVBios</key>
      <true/><!--YOUR_SECOND_CARD_LOADVBIOS-->
    </dict>
  </array>
  <key>ATI</key>
  <array>
    <dict>
      <key>Model</key>
      <string>ATI Radeon HD6670</string>
      <key>IOPCIPrimaryMatch</key>
      <string>0x6758</string>
      <key>IOPCISubDevId</key>
      <string>0x1342</string>
      <key>VRAM</key>
      <integer>2048</integer>
    </dict>
  </array>
</dict>

* we could merge NVIDIA & ATI keys in the feature, since each card will be parsed / known by unique IOPCIPrimaryMatch. Please review

Link to comment
Share on other sites

Propose change for undocumented ErmaCs Graphics -> CardList, No ATI parse yet

** injection for NVIDIA card usage e.g (to be placed in the config.plist, under graphics tag):

<key>Graphics</key>
<dict>
  <key>NVIDIA</key>
  <array>
    <dict>
      <key>Model</key>
      <string>Quadro FX 380</string>
      <key>IOPCIPrimaryMatch</key>
      <string>0x10DE0658</string>
      <key>VRAM</key>
      <integer>256</integer>
      <key>VideoPorts</key>
      <integer>2</integer>
      <key>LoadVBios</key>
      <true/>
    </dict>
    <dict>
      <key>Model</key>
      <string>YOUR_SECOND_CARD_NAME</string>
      <key>IOPCIPrimaryMatch</key>
      <string>YOUR_SECOND_CARD_ID</string>
      <key>IOPCISubDevId</key>
      <string>YOUR_SECOND_CARD_SUB_ID(if necessary)</string>
      <key>VRAM</key>
      <integer>YOUR_SECOND_CARD_VRAM_SIZE</integer>
      <key>VideoPorts</key>
      <integer>YOUR_SECOND_CARD_PORTS</integer>
      <key>LoadVBios</key>
      <true/><!--YOUR_SECOND_CARD_LOADVBIOS-->
    </dict>
  </array>
  <key>ATI</key>
  <array>
    <dict>
      <key>Model</key>
      <string>ATI Radeon HD6670</string>
      <key>IOPCIPrimaryMatch</key>
      <string>0x6758</string>
      <key>IOPCISubDevId</key>
      <string>0x1342</string>
      <key>VRAM</key>
      <integer>2048</integer>
    </dict>
  </array>
</dict>

* we could merge NVIDIA & ATI keys in the feature, since each card will be parsed / known by unique IOPCIPrimaryMatch. Please review

Committed to 3456.

Check, please, there are many fails during patch.

  • Like 2
Link to comment
Share on other sites

My problem (only my?) is not in NASM version. 

See cpu.efi as a final separate module produced by gcc49, xclang and xcode5 toolsets. They are using same NASM!

gcc49

0000000000001db0 488D05F90C0000                  lea        rax, qword [ds:0x2ab0]        ; XREF=0x1c8b
0000000000001db7 488905E40C0000                  mov        qword [ds:0x2aa2], rax
0000000000001dbe 488D05DB0C0000                  lea        rax, qword [ds:0x2aa0]
0000000000001dc5 0F0110                          lgdt       fword [ds:rax]
0000000000001dc8 B818000000                      mov        eax, 0x18
0000000000001dcd 8EE8                            mov        gs, ax
0000000000001dcf 8EE0                            mov        fs, ax
0000000000001dd1 488D05300D0000                  lea        rax, qword [ds:0x2b08]
0000000000001dd8 4889051B0D0000                  mov        qword [ds:0x2afa], rax
0000000000001ddf 488D05120D0000                  lea        rax, qword [ds:0x2af8]
0000000000001de6 0F0118                          lidt       fword [ds:rax]
0000000000001de9 C3                              ret        

xcode5

0000000000001cd2 488D055A180000                  lea        rax, qword [ds:0x3533]        ; XREF=0x27b7
0000000000001cd9 48890552180000                  mov        qword [ds:0x3532], rax
0000000000001ce0 488D0549180000                  lea        rax, qword [ds:0x3530]
0000000000001ce7 0F0110                          lgdt       fword [ds:rax]
0000000000001cea B818000000                      mov        eax, 0x18
0000000000001cef 8EE8                            mov        gs, ax
0000000000001cf1 8EE0                            mov        fs, ax
0000000000001cf3 488D0591180000                  lea        rax, qword [ds:0x358b]
0000000000001cfa 48890589180000                  mov        qword [ds:0x358a], rax
0000000000001d01 488D0580180000                  lea        rax, qword [ds:0x3588]
0000000000001d08 0F0118                          lidt       fword [ds:rax]
0000000000001d0b C3                              ret        

xclang

0000000000001f34 488D05D8170000                  lea        rax, qword [ds:0x3713]        ; XREF=0x2823
0000000000001f3b 488905D0170000                  mov        qword [ds:0x3712], rax
0000000000001f42 488D05C7170000                  lea        rax, qword [ds:0x3710]
0000000000001f49 0F0110                          lgdt       fword [ds:rax]
0000000000001f4c B818000000                      mov        eax, 0x18
0000000000001f51 8EE8                            mov        gs, ax
0000000000001f53 8EE0                            mov        fs, ax
0000000000001f55 488D050F180000                  lea        rax, qword [ds:0x376b]
0000000000001f5c 48890507180000                  mov        qword [ds:0x376a], rax
0000000000001f63 488D05FE170000                  lea        rax, qword [ds:0x3768]
0000000000001f6a 0F0118                          lidt       fword [ds:rax]
0000000000001f6d C3                              ret        

The code correspond to sources

ASM_PFX(InitDescriptor):
        lea     rax, [REL GDT_BASE]             ; RAX=PHYSICAL address of gdt
        mov     [REL gdtr + 2], rax   ; Put address of gdt into the gdtr+2
        lea     rax, [REL gdtr]
        lgdt       [rax]
        mov     rax, 18h
        mov     gs, rax
        mov     fs, rax
        lea     rax, [REL IDT_BASE]             ; RAX=PHYSICAL address of idt
        mov     qword  [REL idtr + 2], rax   ; Put address of idt into the idtr
        lea     rax, [REL idtr]
        lidt      [rax]
        ret

....
SECTION .data

gdtr    dw GDT_END - GDT_BASE - 1   ; GDT limit
        dq 0   ;GDT_BASE                     ; (GDT base gets set above)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;   global descriptor table (GDT)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

         ALIGN 010h,db 0                      ; make GDT 16-byte align

global GDT_BASE
GDT_BASE:
; null descriptor
NULL_SEL        equ $-GDT_BASE          ; Selector [0x0]
        dw 0            ; limit 15:0
        dw 0            ; base 15:0
        db 0            ; base 23:16
        db 0            ; type
        db 0            ; limit 19:16, flags
        db 0            ; base 31:24

; linear data segment descriptor
LINEAR_SEL      equ $-GDT_BASE          ; Selector [0x8]
        dw 0FFFFh       ; limit 0xFFFFF
        dw 0            ; base 0

This data section looks identical in all three cases

0000000000002aa0   gdtr:                         db  0x47 ; 'G'                           ; XREF=0x1dbe 
0000000000002aa1                                 db  0x00 ; '.'
0000000000002aa2                                 dq         0x0000000000000000            ; XREF=0x1db7 gdtr+2
0000000000002aaa                                 db  0x00 ; '.'
0000000000002aab                                 db  0x00 ; '.'
0000000000002aac                                 db  0x00 ; '.'
0000000000002aad                                 db  0x00 ; '.'
0000000000002aae                                 db  0x00 ; '.'
0000000000002aaf                                 db  0x00 ; '.'
0000000000002ab0   GDT_BASE:                     dq         0x0000000000000000            ; XREF=0x1db0 
0000000000002ab8                                 db  0xff ; '.'
0000000000002ab9                                 db  0xff ; '.'
0000000000002aba                                 db  0x00 ; '.'

So clang and xcode wrongly resolved global address GDT_BASE

 

May be mtoc error?

Link to comment
Share on other sites

Does that mean you tried nasm 2.12.01 and still have this problem?

 

My problem (only my?) is not in NASM version. 

 

See cpu.efi as a final separate module produced by gcc49, xclang and xcode5 toolsets. They are using same NASM!

 

So clang and xcode wrongly resolved global address GDT_BASE

 

May be mtoc error?

I tried your mtoc with nasm 2.12.01, and didn't have this problem.

Link to comment
Share on other sites

Could it be a PATH problem?  Maybe it's using the wrong nasm?  (maybe Apple nasm.)

ebuild.sh puts $TOOLCHAIN_DIR/bin first in the PATH, so that's where it looks for it.  The tools_def.txt just says "nasm" so it looks in the PATH...

 

Could you upload the nasm 2.11.05 you were using?

 

I tried with nasm 2.11.08 on Linux, using -f macho64, after preprocessing X64/CpuInterrupt.nasm, and it can't even handle the file.  I get an error

 

 

CpuInterrupt.i:32: fatal: No section for Index 2 offset 0 found

 

This error refers to the reference to gdtr symbol in the lines

 

 

mov [REL gdtr + 2]

lea rax, [REL gdtr]

 

I tried running nasm with -f elf64 on the same source file, and it works.

Link to comment
Share on other sites

I think I have to rebuild BaseTools, They are still old.

I see follow problems:

1. BUILDRULEORDER is not working. If I have both .S and .nasm I see nasm compilation.

2. If I compile CpuInterrupt.S by clang there is build error

Undefined symbols for architecture x86_64:
  "_SystemExceptionHandler", referenced from:
      __ModuleEntryPoint in UefiDriverEntryPoint.lib(DriverEntryPoint.obj)
  "_InstallInterruptHandler", referenced from:
      __ModuleEntryPoint in UefiDriverEntryPoint.lib(DriverEntryPoint.obj)
  "_InitDescriptor", referenced from:
      __ModuleEntryPoint in UefiDriverEntryPoint.lib(DriverEntryPoint.obj)
  "_SystemTimerHandler", referenced from:
      __ModuleEntryPoint in UefiDriverEntryPoint.lib(DriverEntryPoint.obj)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/Users/slice/src/edk2/Build/Clover/RELEASE_XCODE5/X64/Clover/CpuDxe/Cpu/DEBUG/Cpu.dll] Error 1

Now I am at comp #4 in 10.7.5 that also used for Clover build. There is no good clang but I can test these problems.

nasm.zip

There is also mtoc from 2015. Not sure its origin.

mtoc.zip

Link to comment
Share on other sites

I think I have to rebuild BaseTools, They are still old.

I see follow problems:

1. BUILDRULEORDER is not working. If I have both .S and .nasm I see nasm compilation.

2. If I compile CpuInterrupt.S by clang there is build error

Undefined symbols for architecture x86_64:  "_SystemExceptionHandler", referenced from:      __ModuleEntryPoint in UefiDriverEntryPoint.lib(DriverEntryPoint.obj)  "_InstallInterruptHandler", referenced from:      __ModuleEntryPoint in UefiDriverEntryPoint.lib(DriverEntryPoint.obj)  "_InitDescriptor", referenced from:      __ModuleEntryPoint in UefiDriverEntryPoint.lib(DriverEntryPoint.obj)  "_SystemTimerHandler", referenced from:      __ModuleEntryPoint in UefiDriverEntryPoint.lib(DriverEntryPoint.obj)ld: symbol(s) not found for architecture x86_64clang: error: linker command failed with exit code 1 (use -v to see invocation)make: *** [/Users/slice/src/edk2/Build/Clover/RELEASE_XCODE5/X64/Clover/CpuDxe/Cpu/DEBUG/Cpu.dll] Error 1
do we still need to do "make -C BaseTools/Source/C" manually when compling?
Link to comment
Share on other sites

Slice, it's your nasm, and the problem is reproducible

 

 

NASM version 2.11.06 compiled on Dec  4 2014

 

    1a24: 48 8d 05 08 13 00 00 lea    0x1308(%rip),%rax        # 0x2d33

    1a2b: 48 89 05 00 13 00 00 mov    %rax,0x1300(%rip)        # 0x2d32

    1a32: 48 8d 05 f7 12 00 00 lea    0x12f7(%rip),%rax        # 0x2d30

    1a39: 0f 01 10             lgdt   (%rax)

    1a3c: b8 18 00 00 00       mov    $0x18,%eax

    1a41: 8e e8                mov    %eax,%gs

    1a43: 8e e0                mov    %eax,%fs

    1a45: 48 8d 05 3f 13 00 00 lea    0x133f(%rip),%rax        # 0x2d8b

    1a4c: 48 89 05 37 13 00 00 mov    %rax,0x1337(%rip)        # 0x2d8a

    1a53: 48 8d 05 2e 13 00 00 lea    0x132e(%rip),%rax        # 0x2d88

    1a5a: 0f 01 18             lidt   (%rax)

    1a5d: c3                   retq

NASM version 2.12.01 compiled on Mar 17 2016

 

1a24: 48 8d 05 15 13 00 00 lea 0x1315(%rip),%rax # 0x2d40

1a2b: 48 89 05 00 13 00 00 mov %rax,0x1300(%rip) # 0x2d32

1a32: 48 8d 05 f7 12 00 00 lea 0x12f7(%rip),%rax # 0x2d30

1a39: 0f 01 10 lgdt (%rax)

1a3c: b8 18 00 00 00 mov $0x18,%eax

1a41: 8e e8 mov %eax,%gs

1a43: 8e e0 mov %eax,%fs

1a45: 48 8d 05 4c 13 00 00 lea 0x134c(%rip),%rax # 0x2d98

1a4c: 48 89 05 37 13 00 00 mov %rax,0x1337(%rip) # 0x2d8a

1a53: 48 8d 05 2e 13 00 00 lea 0x132e(%rip),%rax # 0x2d88

1a5a: 0f 01 18 lidt (%rax)

1a5d: c3 retq

 

 

I tried with your mtoc and my mtoc - same result.

Link to comment
Share on other sites

Slice: problem solved rev #3461.  It builds ok with nasm 2.11.06.

So easy?  :thumbsup_anim:  Thanks!

It's a pity I am on trip and can fully check only as Saturday.

I also want to look into vanilla tools_def.txt. May be we need update our file?

Link to comment
Share on other sites

ebuild.sh 

    if [[ -d .git ]]; then
        git svn info | grep Revision | tr -cd [:digit:] >vers.txt
    else
        svnversion -n | tr -d [:alpha:] >vers.txt
    fi

why it is here?

Clover slice$ git svn info
fatal: Not a git repository (or any of the parent directories): .git
Already at toplevel, but .git not found
 at /usr/libexec/git-core/git-svn line 325

Link to comment
Share on other sites


GIT=`which git`
GITDIR=`git status 2> /dev/null`

# Bash options
set -e # errexit
set -u # Blow on unbound variable

#if [[ -x /usr/bin/git ]]; then
# PATCH_CMD="/usr/bin/git apply --whitespace=nowarn"
if [[ -n $GIT ]]; then
PATCH_CMD="${GIT} apply --whitespace=nowarn"
else
PATCH_CMD="/usr/bin/patch"
fi

...

# if [[ -d .git ]]; then
if [[ -n $GIT && -n $GITDIR ]]; then
git svn info | grep Revision | tr -cd [:digit:] >vers.txt

 

  • Like 1
Link to comment
Share on other sites

Slice: problem solved rev #3461.  It builds ok with nasm 2.11.06.

Yes, now I see good Cpu.efi. Can't test more in 10.7.5 :(

00000000000006fa 488D053F1E0000                  lea        rax, qword [ds:0x2540]        ; XREF=0x524
0000000000000701 4889052A1E0000                  mov        qword [ds:0x2532], rax
0000000000000708 488D05211E0000                  lea        rax, qword [ds:0x2530]
000000000000070f 0F0110                          lgdt       fword [ds:rax]
0000000000000712 B818000000                      mov        eax, 0x18
0000000000000717 8EE8                            mov        gs, ax
0000000000000719 8EE0                            mov        fs, ax
000000000000071b 488D05761E0000                  lea        rax, qword [ds:0x2598]
0000000000000722 488905611E0000                  mov        qword [ds:0x258a], rax
0000000000000729 488D05581E0000                  lea        rax, qword [ds:0x2588]
0000000000000730 0F0118                          lidt       fword [ds:rax]
0000000000000733 C3                              ret        

@cecekpawon

Thanks, committed!

Link to comment
Share on other sites

fyi. on 3463 - vers.txt ends up empty. 

 

seems like you are not checking for  svn vs git properly in ebuild.sh in the recent change?

#    if [[ -d .git ]]; then
    if [[ -n $GIT && -n $GITDIR ]]; then
        git svn info | grep Revision | tr -cd [:digit:] >vers.txt
    else
        svnversion -n | tr -d [:alpha:] >vers.txt
    fi

$ git --version
git version 2.8.1

cd  /Extra/Clover_Install/CloverGrowerPro/edk2/Clover
$ git svn info
svn: 'edk2/Clover' is not under version control

Link to comment
Share on other sites

With commit 3464 XCODE toolset will use CpuInterrupt.S instead of CpuInterrupt.nasm.

If it will not work revert please.

As I see binary mostly the same with a few differences in wordbyte.


do we still need to do "make -C BaseTools/Source/C" manually when compling or already builtin and no need?
For the love of clover, please reply :(

You have to do this once. Or may be after big changes in EDK2.

  • Like 1
Link to comment
Share on other sites

×
×
  • Create New...