Recent

Author Topic: Install UEFI target patched version  (Read 418 times)

Coldfire

  • New member
  • *
  • Posts: 13
Install UEFI target patched version
« on: July 25, 2019, 07:39:08 am »
Hi

I'm trying to install from source the UEFI target patched version  https://svn.freepascal.org/cgi-bin/viewvc.cgi/branches/olivier/uefi/. With a bootstrap compiler (with debian 9) the patched version compilation goes fine, however I Have some questions

-Is necesary to install (Make Install) the compiler to produce executables? How I can do this with another version installed previously?
-How I can ensure that I'm compiling an UEFI executable? (force by command line that the output will be an EFI PE executable)


To the moment, when I try to compile a Non-installed version, specifying the include and unit paths ion the command line, sa normal X86_64 executable is produced successfully. However, when I try to compile one with a UEFI target version(I believe that), header and dependence resolution fails (I'm just trying to make a helloworld program, open a text file, appending some stuff and close it, nothing serious yet).

I understand that this isn't supported yet. I want to test it just for academical purpose. (I feel tianocore/EDkII is quite wordy)

Thanks for any answer
« Last Edit: July 25, 2019, 07:45:02 am by Coldfire »

Thaddy

  • Hero Member
  • *****
  • Posts: 8457
Re: Install UEFI target patched version
« Reply #1 on: July 25, 2019, 07:53:15 am »
It looks abandoned.
Read the manuals and if you are a professional get a proper education in computer science. Makes the forum a lot cleaner.

PascalDragon

  • Hero Member
  • *****
  • Posts: 505
  • Compiler Developer
Re: Install UEFI target patched version
« Reply #2 on: July 25, 2019, 09:34:01 am »
I'm trying to install from source the UEFI target patched version  https://svn.freepascal.org/cgi-bin/viewvc.cgi/branches/olivier/uefi/. With a bootstrap compiler (with debian 9) the patched version compilation goes fine, however I Have some questions

-Is necesary to install (Make Install) the compiler to produce executables? How I can do this with another version installed previously?
It is possible to use the compiler without installing it, especially if not many unit directories of the packages directory are requires, however it is suggested to install it and to adjust your fpc.cfg. You can influence the location using the INSTALL_PREFIX variable. If you have a installation of a different version then those two shouldn't conflict (though you should probably do a make crossinstall instead of a make install. If you have a installation of the same version the compiler binary itself (e.g. ppcx64) will be overwritten, but the units for any other target (e.g. x86_64-linux) remain untouched and the compiler can still be used to compile for another target.

-How I can ensure that I'm compiling an UEFI executable? (force by command line that the output will be an EFI PE executable)
You need to pass the correct target to the compiler using the -T option. I have not checked the patched compiler, but I assume the target to be uefi, so it would be -Tuefi.

To the moment, when I try to compile a Non-installed version, specifying the include and unit paths ion the command line, sa normal X86_64 executable is produced successfully. However, when I try to compile one with a UEFI target version(I believe that), header and dependence resolution fails (I'm just trying to make a helloworld program, open a text file, appending some stuff and close it, nothing serious yet).
What commands did you try exactly?

It looks abandoned.
"no activity" does not necessarily mean "not working".

Coldfire

  • New member
  • *
  • Posts: 13
Re: Install UEFI target patched version
« Reply #3 on: July 27, 2019, 04:52:41 am »
I'm trying to compile with this

Code: Text  [Select]
  1. ./ppcross386 holaprofe.pas -Fu/home/coldfire/Descargas/fpc/uefi/fpc/uefi/rtl/uefi/ -Fu/home/coldfire/Descargas/fpc/uefi/fpc/uefi/compiler/i386/units/i386-uefi/ -Fi/home/coldfire/Descargas/fpc/uefi/fpc/uefi/rtl/inc -Fi/home/coldfire/Descargas/fpc/uefi/fpc/uefi/rtl/uefi/ -Tuefi
  2.  


output is


Free Pascal Compiler version 3.1.1 [2019/07/17] for i386
Copyright (c) 1993-2017 by Florian Klaempfl and others
Target OS: UEFI for i386
Compiling holaprofe.pas
Compiling /home/coldfire/Descargas/fpc/uefi/fpc/uefi/rtl/uefi/system.pp
systemh.inc(1545,2) Fatal: Cannot open include file "setjumph.inc"
Fatal: Compilation aborted

ccrause

  • Full Member
  • ***
  • Posts: 158
Re: Install UEFI target patched version
« Reply #4 on: July 27, 2019, 09:51:11 am »
I'm trying to compile with this

Code: Text  [Select]
  1. ./ppcross386 holaprofe.pas -Fu/home/coldfire/Descargas/fpc/uefi/fpc/uefi/rtl/uefi/ -Fu/home/coldfire/Descargas/fpc/uefi/fpc/uefi/compiler/i386/units/i386-uefi/ -Fi/home/coldfire/Descargas/fpc/uefi/fpc/uefi/rtl/inc -Fi/home/coldfire/Descargas/fpc/uefi/fpc/uefi/rtl/uefi/ -Tuefi
  2.  


output is


Free Pascal Compiler version 3.1.1 [2019/07/17] for i386
Copyright (c) 1993-2017 by Florian Klaempfl and others
Target OS: UEFI for i386
Compiling holaprofe.pas
Compiling /home/coldfire/Descargas/fpc/uefi/fpc/uefi/rtl/uefi/system.pp
systemh.inc(1545,2) Fatal: Cannot open include file "setjumph.inc"
Fatal: Compilation aborted

Did you already build the RTL for i386-uefi? If you did then you only need to specify the path to the compiled RTL when compiling your project.

PascalDragon

  • Hero Member
  • *****
  • Posts: 505
  • Compiler Developer
Re: Install UEFI target patched version
« Reply #5 on: July 27, 2019, 10:12:32 am »
I'm trying to compile with this

Code: Text  [Select]
  1. ./ppcross386 holaprofe.pas -Fu/home/coldfire/Descargas/fpc/uefi/fpc/uefi/rtl/uefi/ -Fu/home/coldfire/Descargas/fpc/uefi/fpc/uefi/compiler/i386/units/i386-uefi/ -Fi/home/coldfire/Descargas/fpc/uefi/fpc/uefi/rtl/inc -Fi/home/coldfire/Descargas/fpc/uefi/fpc/uefi/rtl/uefi/ -Tuefi
  2.  


output is


Free Pascal Compiler version 3.1.1 [2019/07/17] for i386
Copyright (c) 1993-2017 by Florian Klaempfl and others
Target OS: UEFI for i386
Compiling holaprofe.pas
Compiling /home/coldfire/Descargas/fpc/uefi/fpc/uefi/rtl/uefi/system.pp
systemh.inc(1545,2) Fatal: Cannot open include file "setjumph.inc"
Fatal: Compilation aborted
If you only need the RTL (currently none of the packages are enabled anyway) you can do the following (starting directory is assumed to be the checkout directory):
Code: [Select]
cd compiler
make cycle CPU_TARGET=i386 OS_TARGET=uefi
cd ..
./compiler/ppcross386 -n -Tuefi -Furtl/units/i386-uefi -FEyouroutputdir -viwn yourprogram.pas
The make cycle builds both the cross compiler as well as the cross compiled RTL so that you only need to reference the precompiled units in the RTL's output directory (the rtl/units/i386-uefi). For x86_64 you need to replace all the i386 with x86_64 of course. ;)

You can also make a configuration file that contains the above options (mainly -Fu (with an absolute path) and the -viwn) and then call the compiler like this:
Code: [Select]
ppcross386 @yourcfg -FEyouroutputdir yourprogram.pas


Coldfire

  • New member
  • *
  • Posts: 13
Re: Install UEFI target patched version
« Reply #7 on: July 27, 2019, 09:56:39 pm »
I'm trying to compile with this

Code: Text  [Select]
  1. ./ppcross386 holaprofe.pas -Fu/home/coldfire/Descargas/fpc/uefi/fpc/uefi/rtl/uefi/ -Fu/home/coldfire/Descargas/fpc/uefi/fpc/uefi/compiler/i386/units/i386-uefi/ -Fi/home/coldfire/Descargas/fpc/uefi/fpc/uefi/rtl/inc -Fi/home/coldfire/Descargas/fpc/uefi/fpc/uefi/rtl/uefi/ -Tuefi
  2.  


output is


Free Pascal Compiler version 3.1.1 [2019/07/17] for i386
Copyright (c) 1993-2017 by Florian Klaempfl and others
Target OS: UEFI for i386
Compiling holaprofe.pas
Compiling /home/coldfire/Descargas/fpc/uefi/fpc/uefi/rtl/uefi/system.pp
systemh.inc(1545,2) Fatal: Cannot open include file "setjumph.inc"
Fatal: Compilation aborted
If you only need the RTL (currently none of the packages are enabled anyway) you can do the following (starting directory is assumed to be the checkout directory):
Code: [Select]
cd compiler
make cycle CPU_TARGET=i386 OS_TARGET=uefi
cd ..
./compiler/ppcross386 -n -Tuefi -Furtl/units/i386-uefi -FEyouroutputdir -viwn yourprogram.pas
The make cycle builds both the cross compiler as well as the cross compiled RTL so that you only need to reference the precompiled units in the RTL's output directory (the rtl/units/i386-uefi). For x86_64 you need to replace all the i386 with x86_64 of course. ;)

You can also make a configuration file that contains the above options (mainly -Fu (with an absolute path) and the -viwn) and then call the compiler like this:
Code: [Select]
ppcross386 @yourcfg -FEyouroutputdir yourprogram.pas



Thaanks dude, kinda worked


Code: Pascal  [Select]
  1. program holaprofe;
  2.  
  3.  
  4. begin
  5.  
  6.    writeln('Hola profe, este es un programa uefi hecho con freepascal');
  7. end.
  8.  

coldfire@casav:~/Descargas/fpc/uefi/fpc/uefi$ ./compiler/ppcrossx64 -n -Tuefi -Furtl/units/x86_64-uefi  -viwn holaprofe.pas
Target OS: UEFI for x86_64
Compiling holaprofe.pas
Linking holaprofe.efi
7 lines compiled, 0.0 sec, 33296 bytes code, 4020 bytes data

However, the output executable is "defective". Does  not load properly when called from the uefi Shell, and staates that the executable is not supported (Isn't a shell problem because I'm developing samples with EDKII/Tianocore and they run properly, not matter the architecture). I suspect that I missed something.
« Last Edit: July 27, 2019, 10:03:32 pm by Coldfire »