Install UEFI target patched version lazarus / 1-Linux ---------------------------------------------------------------------- Coldfire · 2019-07-25 05:39 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 ---------------------------------------------------------------------- Thaddy · 2019-07-25 05:53 It looks abandoned. ---------------------------------------------------------------------- PascalDragon · 2019-07-25 07:34 Quote from: Coldfire on July 25, 2019, 07:39:08 amI'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. Quote from: Coldfire on July 25, 2019, 07:39:08 am-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. Quote from: Coldfire on July 25, 2019, 07:39:08 amTo 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? Quote from: Thaddy on July 25, 2019, 07:53:15 amIt looks abandoned. "no activity" does not necessarily mean "not working". ---------------------------------------------------------------------- Coldfire · 2019-07-27 02:52 I'm trying to compile with this Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ./ppcross386 holaprofe.pas -Fu/home/coldfire/Descargas/fpc/uefi/fpc/uefi/rtl/uefi/ -Fu/home/coldf ire/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  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 · 2019-07-27 07:51 Quote from: Coldfire on July 27, 2019, 04:52:41 amI'm trying to compile with this Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ./ppcross386 holaprofe.pas -Fu/home/coldfire/Descargas/fpc/uefi/fpc/uefi/rtl/uefi/ -Fu/home/coldf ire/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  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 · 2019-07-27 08:12 Quote from: Coldfire on July 27, 2019, 04:52:41 amI'm trying to compile with this Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ./ppcross386 holaprofe.pas -Fu/home/coldfire/Descargas/fpc/uefi/fpc/uefi/rtl/uefi/ -Fu/home/coldf ire/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  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.pasThe 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 ---------------------------------------------------------------------- nouzi · 2019-07-27 10:53 I want to share this https://youtu.be/OPCZ57udbQA and this https://www.google.com/url?q=https://fosdem.org/2018/schedule/event/hw enablement_uefi_for_dummies/attachments/slides/2081/export/events/atta chments/hwenablement_uefi_for_dummies/slides/2081/Programming_UEFI_For _Dummies.odp&sa=U&ved=2ahUKEwiEgOKK9tTjAhUMJ8AKHXkxDY4QFjADegQICBAB&us g=AOvVaw3wwV5EOYTSrxPrWjlHb-iu ---------------------------------------------------------------------- Coldfire · 2019-07-27 19:56 Quote from: PascalDragon on July 27, 2019, 10:12:32 amQuote from: Coldfire on July 27, 2019, 04:52:41 amI'm trying to compile with this Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ./ppcross386 holaprofe.pas -Fu/home/coldfire/Descargas/fpc/uefi/fpc/uefi/rtl/uefi/ -Fu/home/coldf ire/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  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.pasThe 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][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program holaprofe;  begin    writeln('Hola profe, este es un programa uefi hecho con freepascal');end.  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.