Re: [edk2] difficulties getting started with EDK2 Development

Subject: Re: [edk2] difficulties getting started with EDK2 Development

From: Isakov Sergey <isakov-sl@bk.ru>

To: edk2-devel@lists.sourceforge.net

Date: 2013-01-17 06:06:26

Thank Anrew for the quick reply but I saw this as well as all your other patches.
The only questionable is 
Ops. rev14058
/Users/Sergey/src/edk2/Build/OvmfX64/DEBUG_XCLANG/X64/OvmfPkg/Library/LoadLinuxLib/LoadLinuxLib/OUTPUT/X64/JumpToKernel.iii:37:no such instruction: `retfq'
/Users/Sergey/src/edk2/Build/OvmfX64/DEBUG_XCLANG/X64/OvmfPkg/Library/LoadLinuxLib/LoadLinuxLib/OUTPUT/X64/JumpToKernel.iii:13:bad register name `%rcx'
/Users/Sergey/src/edk2/Build/OvmfX64/DEBUG_XCLANG/X64/OvmfPkg/Library/LoadLinuxLib/LoadLinuxLib/OUTPUT/X64/JumpToKernel.iii:14:bad register name `%rdx'
/Users/Sergey/src/edk2/Build/OvmfX64/DEBUG_XCLANG/X64/OvmfPkg/Library/LoadLinuxLib/LoadLinuxLib/OUTPUT/X64/JumpToKernel.iii:15:bad register name `%r8'
/Users/Sergey/src/edk2/Build/OvmfX64/DEBUG_XCLANG/X64/OvmfPkg/Library/LoadLinuxLib/LoadLinuxLib/OUTPUT/X64/JumpToKernel.iii:16:bad register name `%rax'
/Users/Sergey/src/edk2/Build/OvmfX64/DEBUG_XCLANG/X64/OvmfPkg/Library/LoadLinuxLib/LoadLinuxLib/OUTPUT/X64/JumpToKernel.iii:17:bad register name `%r8)'
/Users/Sergey/src/edk2/Build/OvmfX64/DEBUG_XCLANG/X64/OvmfPkg/Library/LoadLinuxLib/LoadLinuxLib/OUTPUT/X64/JumpToKernel.iii:18:bad register name `%rax'
/Users/Sergey/src/edk2/Build/OvmfX64/DEBUG_XCLANG/X64/OvmfPkg/Library/LoadLinuxLib/LoadLinuxLib/OUTPUT/X64/JumpToKernel.iii:19:bad register name `%r9'
/Users/Sergey/src/edk2/Build/OvmfX64/DEBUG_XCLANG/X64/OvmfPkg/Library/LoadLinuxLib/LoadLinuxLib/OUTPUT/X64/JumpToKernel.iii:20:bad register name `%r9'
make: *** [/Users/Sergey/src/edk2/Build/OvmfX64/DEBUG_XCLANG/X64/OvmfPkg/Library/LoadLinuxLib/LoadLinuxLib/OUTPUT/X64/JumpToKernel.obj] Error 1


On 16.01.2013, at 21:36, Andrew Fish wrote:


On Jan 16, 2013, at 9:04 AM, Isakov Sergey <isakov-sl@bk.ru> wrote:

Andrew,
I can't compile OvmfPkg with XCLANG (OSX 10.7.5, Xcode 4.4.1 + CLT 4.5.2)
---------------
Building ... /Users/Sergey/src/edk2/OvmfPkg/AcpiTables/AcpiTables.inf [X64]
ld: warning: -macosx_version_min not specificed, assuming 10.6
Undefined symbols for architecture x86_64:
  "_main", referenced from:
     -u command line option
ld: symbol(s) not found for inferred architecture x86_64
make: *** [/Users/Sergey/src/edk2/Build/OvmfX64/DEBUG_XCLANG/X64/OvmfPkg/AcpiTables/AcpiTables/OUTPUT/Facs.acpi] Error 1

---------------
What is wrong? It works fine with GCC47.


The ACPI support in the XCLANG has not been updated in a while.  I posed info on how to change the Conf/build_rule.txt and Conf/tools_def.txt to fix this issue yesterday. 

The following changes fix 3 different bugs with ACPI support. You want to add the changes with < to you Conf/*.txt files. After the changes the ACPI tables should compile. 

edk2TOT>diff Conf/build_rule.txt BaseTools/Conf/build_rule.template 
364,369d363
<     <Command.XCODE>
<         Trim --asl-file -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i -i $(INC_LIST) ${src}
<         "$(ASLPP)" $(ASLPP_FLAGS) $(INC) -I${s_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
<         Trim --source-code -l -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii 
<         "$(ASL)" $(ASL_FLAGS) $(ASL_OUTFLAGS)${dst} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii

edk2TOT>diff Conf/tools_def.txt BaseTools/Conf/tools_def.template 
4621c4621
< *_XCLANG_*_ASLDLINK_FLAGS   = -e _ReferenceAcpiTable -preload -segalign 0x20  -pie -seg1addr 0x240 -read_only_relocs suppress -map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
---
> *_XCLANG_*_ASLDLINK_FLAGS   = -e _main -preload -segalign 0x20  -pie -seg1addr 0x240 -read_only_relocs suppress -map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
4624d4623
< *_XCLANG_*_ASL_OUTFLAGS     = DEF(IASL_OUTFLAGS)

Thanks,

Andrew Fish

<Re: [edk2] difficulties getting started with EDK2 Development.eml>

On 16.01.2013, at 3:16, Andrew Fish wrote:

Piker,

If you integrate my patches from the mailing list today and update your Conf/build_rule.txt and Conf/tools_def.txt you should be able to build the OvmfPkg on Mac OS X with Xcode.  I don't currently have a copy of qemu installed so I did not try and run it. 

I will check in the updated .template files into the BaseTools project and it will sync with edk2 project at some point in the future. 

Seems like the ACPI build support has rotted out a bit and needs fixing. 

Andrew Fish

edk2TOT>diff Conf/build_rule.txt BaseTools/Conf/build_rule.template 
364,369d363
<     <Command.XCODE>
<         Trim --asl-file -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i -i $(INC_LIST) ${src}
<         "$(ASLPP)" $(ASLPP_FLAGS) $(INC) -I${s_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
<         Trim --source-code -l -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii 
<         "$(ASL)" $(ASL_FLAGS) $(ASL_OUTFLAGS)${dst} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii

edk2TOT>diff Conf/tools_def.txt BaseTools/Conf/tools_def.template 
4621c4621
< *_XCLANG_*_ASLDLINK_FLAGS   = -e _ReferenceAcpiTable -preload -segalign 0x20  -pie -seg1addr 0x240 -read_only_relocs suppress -map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
---
> *_XCLANG_*_ASLDLINK_FLAGS   = -e _main -preload -segalign 0x20  -pie -seg1addr 0x240 -read_only_relocs suppress -map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
4624d4623
< *_XCLANG_*_ASL_OUTFLAGS     = DEF(IASL_OUTFLAGS)




On Jan 15, 2013, at 5:39 AM, Piker Alpha <pikeralpha@yahoo.com> wrote:

I would like to add my $0.02

Now. I don't want to offend anyone here, nor their hard work, but I use OS X and that platform is even more behind. I was stunned to find out that while Apple is using EFI for years, one cannot even compile stuff properly.

I presume that Apple is using Windows in a virtual machine, or use BootCamp for their development. But in any event. This should change, because for someone like me, living in a non-windows world using Linux since age 7 and OS X since 2007 this is total madness. Won't ever use Windows. Not even in a virtual machine.
 
Note: Anything expressed here is my own personal view and not that of my employer.

Regards,

Pike


Van: Mauro Faccenda <faccenda@gmail.com>
Aan: edk2-devel@lists.sourceforge.net
Verzonden: dinsdag 15 januari 13:40 2013
Onderwerp: Re: [edk2] difficulties getting started with EDK2 Development

Hi ,

Thanks for your answer. I've noticed that the whole environment is on
a 'unstable' state and I was about to send a new message reporting the
a problem I am having when I call gethostbyname() (I guess it is the
same you mentioned with the GetHostByDns.efi) it makes qemu (with a
DEBUG enabled OVMF) hangs with some messages, and i still couldn't
find a workaround. But it seems it is a known problem.

You mentioned that Linux isn't a stable platform for development, it
should be my preferred platform (licencing issues), but we can also
use any other. What would you (or anyone else) recommend?

Regards,

Mauro

On Tue, Jan 15, 2013 at 5:18 AM,
<okosmynin@kraftway.ru> wrote:
> Sadly, Linux is not a platform for stable development, there are at least 2 bugs we found in toolchain (gcc46), one is critical, i reported it but no answers.
> One bug with debug sections (check your log for: cannot fill debug link section) - it will stop DEBUG() macro from working, and another bug simply corrupt pointer in some cases (try to run GetHostByDns.efi and it will ASSERT). gcc45 & gcc44 not work at all on my setup (ubuntu 12.10, latest svn rev).
>
> Errors in StdLib you mentioned really exist, can't comment on your main (  IN int Argc,  IN char **Argv  ) issue.
>
> Overall, after 2.5 months of studying/developing for UEFI implementation from Intel I got impression it is in pre-alpha stage and you should expect lots of bugs.
>
> Good luck in your work
>
> ________________________________________
> From: Mauro Faccenda [faccenda@gmail.com]
> Sent: 11 January 2013 18:24
> To: edk2-devel@lists.sourceforge.net
> Subject: [edk2] difficulties getting started with EDK2 Development
>
> Hi all,
>
> I am trying to get started with EDK2 development and I'd like to
> report some difficulties I had and am having.
>
> If any of you can point to some way to fix or even better way of doing
> anything, I'd appreciate.
>
> I am willing to use a plain Ubuntu 12.04 64bits as development
> platform as it comes with GCC 4.6 which seems to be well supported by
> the EDK2 and BaseTools.
>
> But here comes to me the first question: which (if any) are the
> recommended (default) platform for development? I guess it is using
> Windows with VS since the configuration comes with all parameters set
> to use it. But I'd like to know If there is any 'better supported'
> Linux platform (distro, distro version+gcc version).
>
> The Project Wiki mentions Ubuntu 9.10, 10.10 and 10.04, and GCC 4.4,
> but doesn't recommend any.
>
> For instance, I followed this documentation:
> http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=Using_EDK_II_with_Native_GCC_4.4
>
> Moving on, as I want to play with network connections, I built my own
> OVMF with the Intel's E1000 Network drivers successfully using the
> sources from EDK2 trunk.
>
> I already could run qemu with network support (using tap + bridge with
> host physical interface) and use ping.efi (from the EDK2 Toolkit)
> against devices on my network, also no problems besides the latency
> being a bit high (>400ms, from the host I get less than 1ms).
>
> Then I started building some applications to test running in the
> environment. I've built the MdeModulePkg and could run some of them.
> But when I tried to build AppPkg I got the following error:
> $ build -t GCC46 -a X64 -p AppPkg/AppPkg.dsc
> [...]
> edk2/StdLib/LibC/Containers/Queues/Fifo.c:508:27: error: assignment
> from incompatible pointer type [-Werror]
> cc1: all warnings being treated as errors
>
> As it seems to be a warning promoted to an error, I manually ran the
> same gcc command removing the -Werror parameter and it compiled
> successfully.
>
> Is this a bug? Should I report?
>
> Then I ran the build command again, which brought another error:
>
> edk2/StdLib/LibC/Uefi/InteractiveIO/IIOutilities.c:269:1: error:
> conflicting types for IIO_CursorDelta
> edk2/StdLib/LibC/Uefi/InteractiveIO/IIOutilities.h:122:1: note:
> previous declaration of IIO_CursorDelta was here
>
> I opened both files looking for the definition of IIO_CursorDelta and
> in .h file I got:
> --
> int
> EFIAPI
> IIO_CursorDelta (
>  cIIO        *This,
>  CURSOR_XY    *StartXY,
>  CURSOR_XY    *EndXY
>  );
> --
> while in the .c I got:
> --
> UINT32
> EFIAPI
> IIO_CursorDelta (
>  cIIO        *This,
>  CURSOR_XY    *StartXY,
>  CURSOR_XY    *EndXY
> ) [...]
> --
>
> So I changed the .h from int to UINT32 and ran the build again. This
> time with success. Should I report this?
>
> After that, I started to play with AppPkg/Applications/Main/Main.c,
> trying to poke around to see what I can or can't do and got something
> strange. I've changed the Main.c to just print the Argc value:
> --
> #include  <stdio.h>
> int
> EFIAPI
> main (
>  IN int Argc,
>  IN char **Argv
>  )
> {
>  printf("\nArgc=%d\n", Argc);
>  return 0;
> }
> --
> And whenever I run it on UEFI Shell (using qemu), I always get really
> big values (> 37000000) no matter with how many parameter I run and if
> I run with the same parameter multiple times, the value sometimes
> changes, as you can see on the image below:
>
> http://s1.postimage.org/dxeg7ahdr/argc.png
>
> This isn't exactly a problem, since I still can successfully run
> normal code but I'd like to know if am I doing something stupid, if
> this is some kind of bug or if it is a side effect of something I
> couldn't see yet.
>
> Any tips or clarifications will be really appreciated.
>
> Anyway, thanks for the good job you all have been doing on this project. =)
>
> Mauro Faccenda
>
> ------------------------------------------------------------------------------
> Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
> much more. Get web development skills now with LearnDevNow -
> 350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
> SALE $99.99 this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122812
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
>
> ------------------------------------------------------------------------------
> Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
> and more. Get SQL Server skills now (including 2012) with LearnDevNow -
> 200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
> SALE $99.99 this month only - learn more at:
> http://p.sf.net/sfu/learnmore_122512
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery
and much more. Keep your Java skills current with LearnJavaNow -
200+ hours of step-by-step video tutorials by Java experts.
SALE $49.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122612 _______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery
and much more. Keep your Java skills current with LearnJavaNow -
200+ hours of step-by-step video tutorials by Java experts.
SALE $49.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122612 _______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel