To parse your FV file (embedded in your FD file), you can use
'./BaseTools/BinWrappers/PosixLike/VolInfo <location of your FV file>'
If you want to debug the early stage of your UEFI boot process, you can only
use (you do not need -m (...,...)):
source edk2/ArmPlatformPkg/Scripts/Ds5/cmd_load_symbols.py -f (..,...) -a -v
At the early stage of the boot, the UEFI firmware has not loaded its
binaries into DRAM yet.
The UEFI System Table will not be found in System Memory.
Where your UEFI firmware lives when started? In DRAM or in Flash/ROM memory?
> -----Original Message-----
> From: Sharma Bhupesh-B45370 [mailto:B45370@freescale.com]
> Sent: 23 October 2013 06:33
> To: Olivier Martin; edk2-devel(a)lists.sourceforge.net; 'Andrew Fish'
> Cc: 'Kim Phillips'; boot-architecture(a)lists.linaro.org; Kushwaha
> Prabhakar-B32579
> Subject: RE: [edk2] Debugging Sec and PI phases {Source symbols}
>
> Hi Olivier,
>
> I tried to use the DS-5 scripts, but landed in some issues, like:
> "System table not found in System Memory".
>
> It seems there is some issue with the .FD gets generated for my
> BoardPkg.
>
> I am also now trying to understand if there is some documentation/tool
> available that
> can parse my .FD and .FV files and can tell me about the sections in
> this particular output
> file. For e.g. something like 'readelf -a XXX.ELF' produces as an
> output.
>
> Also I am using the following method to build the .FD to allow
> debugging of the source
> using the DS5 scripts:
> - export EDK2_DSC, EDK2_TOOLCHAIN, EDK2_ARCH, EDK2_BUILD.
>
> - Run 'make -f ArmPlatformPkg/Scripts/Makefile'
>
> - This will generate a .FD specific to my Board Pkg in
> 'Build/Board_Pkg_Name/DEBUG_ARMGCC/..'
>
> - Load this .FD using the DS5 and then try to load source symbols
> using:
> source edk2/ArmPlatformPkg/Scripts/Ds5/cmd_load_symbols.py -f (..,...)
> -m (..,...) -a
>
> - This gives me an error:
> "System table not found in System Memory".
>
> Any pointers on the above two points..
>
> Regards,
> Bhupesh
>
> > -----Original Message-----
> > From: boot-architecture-bounces(a)lists.linaro.org [mailto:boot-
> > architecture-bounces(a)lists.linaro.org] On Behalf Of Olivier Martin
> > Sent: Tuesday, October 22, 2013 2:27 PM
> > To: edk2-devel(a)lists.sourceforge.net; 'Andrew Fish'
> > Cc: 'Kim Phillips'; boot-architecture(a)lists.linaro.org; Kushwaha
> > Prabhakar-B32579
> > Subject: RE: [edk2] Debugging Sec and PI phases {Source symbols}
> >
> > Hi Bhupesh,
> > Yes, if you are using ARM DS-5, this is the wikipage to look at to
> setup
> > your environment to debug UEFI. Let me know if you have issue.
> > Regards,
> > Olivier
> >
> > > -----Original Message-----
> > > From: Sharma Bhupesh-B45370 [mailto:B45370@freescale.com]
> > > Sent: 22 October 2013 07:56
> > > To: 'Andrew Fish'; 'edk2-devel(a)lists.sourceforge.net'
> > > Cc: 'Kim Phillips'; 'boot-architecture(a)lists.linaro.org'; Kushwaha
> > > Prabhakar-B32579
> > > Subject: Re: [edk2] Debugging Sec and PI phases {Source symbols}
> > >
> > >
> > > > -----Original Message-----
> > > > From: boot-architecture-bounces(a)lists.linaro.org [mailto:boot-
> > > > architecture-bounces(a)lists.linaro.org] On Behalf Of Andrew Fish
> > > > Sent: Tuesday, October 22, 2013 2:07 AM
> > > > To: edk2-devel(a)lists.sourceforge.net
> > > > Cc: 'Kim Phillips'; 'boot-architecture(a)lists.linaro.org';
> Kushwaha
> > > > Prabhakar-B32579
> > > > Subject: Re: [edk2] Debugging Sec and PI phases {Source symbols}
> > > >
> > > >
> > > >
> > > > On Oct 21, 2013, at 11:38 AM, Sharma Bhupesh-B45370
> > > > <B45370(a)freescale.com> wrote:
> > > >
> > > > > [Resending as I got a 'You must be subscribed to post messages
> to
> > > this
> > > > > mailing list' message from edk2 list]
> > > > >
> > > > > Hi List,
> > > > >
> > > > > I am new to UEFI and am trying to debug my UEFI ported code
> (from
> > > u-
> > > > boot) on a ARMv7 based SoC.
> > > > > I am able to do some basic debugging of the ARM CPU init code
> > > > > using
> > > a
> > > > DS-5 debugger attached to the board.
> > > > >
> > > > > I see that the ported code crashes somewhere while making a
> > > transition
> > > > from Sec to PI phase.
> > > > > However, I can only verify this by seeing instruction level
> > > > > disassembly. I cannot figure out a way to load the source code
> > > using
> > > > the DS-5 debugger.
> > > > >
> > > > > I am used to seeing ELF files which have the debug information
> and
> > > > which can be loaded via the debugger.
> > > > > Using the 'file' command I cannot find any ELF file in the
> output
> > > > > directory 'Build/..'. The FV and FD files don't seem to be ELF
> > > files as
> > > > well.
> > > > >
> > > >
> > > > FD is short for Flash Device. So it is usually the layout of the
> ROM.
> > > You
> > > > could have multiple ROMs, but the most common thing is to just
> have
> > > > a single FD.
> > > > FV is a Firmware Volume. Basically a simple Flash Filesystem that
> > > allows
> > > > files, named by GUIDs to be discovered.
> > > >
> > > > EFI is a collection of relocatable PE/COFF images, and in general
> an
> > > INF
> > > > file (no for a library) in your project maps to a PE/COFF file
> > > getting
> > > > generated.
> > > >
> > > > It can vary by compiler, but it is common for the *.dll file to
> be
> > > the
> > > > native image with the debug info. So that is the file you want to
> > > load
> > > > symbols for.
> > > >
> > > > There are various schemes on how to do this. Some platforms print
> > > > out debug messages that map into the commands you need to load
> > symbols.
> > > Some
> > > > platforms have scripts that can load symbols.
> > > >
> > > > Sorry I don't remember the latest recommendation on which scheme
> to
> > > use
> > > > for your platform? Try looking at the *.Fv.map file as I think it
> > > > has info about how to load symbols. You would need a script to
> > > > convert
> > > this
> > > > into some format the DS-5 understands.
> > > >
> > > > Maybe the scripts in
> > > >
> > >
> https://svn.code.sf.net/p/edk2/code/trunk/edk2/ArmPlatformPkg/Scripts/
> > > D
> > > s5
> > > > / are what you are looking for?
> > >
> > > Many thanks Andrew. It seems the DS5 scripts will work for me. I
> found
> > > the wiki for the same here:
> > >
> http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=ArmPkg
> > > /
> > > Ds5
> > >
> > > I will try to debug the target using these scripts and get back
> with
> > > my results.
> > >
> > > Regards,
> > > Bhupesh
> > >
> > > > Thanks,
> > > >
> > > > Andrew Fish
> > > >
> > > > > Any pointers to which ELF file is generated while compiling a
> UEFI
> > > > > BoardPkg and how it can be loaded via the debugger.
> > > > >
> > > > > Thanks for your help.
> > > > > Regards,
> > > > > Bhupesh
> > > > >
> > > > >
> > > > > ---------------------------------------------------------------
> ---
> > > > > -
> > > ---
> > > > > -------- October Webinars: Code for Performance Free Intel
> > > > > webinars can help you accelerate application performance.
> > > > > Explore tips for MPI, OpenMP, advanced profiling, and more. Get
> > > > > the most from the latest Intel processors and coprocessors. See
> > > abstracts
> > > > > and register >
> > > > >
> > >
> http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.c
> > > > > lktrk _______________________________________________
> > > > > edk2-devel mailing list
> > > > > edk2-devel(a)lists.sourceforge.net
> > > > > https://lists.sourceforge.net/lists/listinfo/edk2-devel
> > > >
> > > >
> > > > _______________________________________________
> > > > boot-architecture mailing list
> > > > boot-architecture(a)lists.linaro.org
> > > > http://lists.linaro.org/mailman/listinfo/boot-architecture
> > >
> > >
> > >
> > > -------------------------------------------------------------------
> ---
> > > -
> > > -------
> > > October Webinars: Code for Performance Free Intel webinars can help
> > > you accelerate application performance.
> > > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the
> > > most from the latest Intel processors and coprocessors. See
> abstracts
> > > and register >
> > >
> http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.c
> > > l
> > > ktrk
> > > _______________________________________________
> > > edk2-devel mailing list
> > > edk2-devel(a)lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/edk2-devel
> >
> >
> >
> >
> >
> > _______________________________________________
> > boot-architecture mailing list
> > boot-architecture(a)lists.linaro.org
> > http://lists.linaro.org/mailman/listinfo/boot-architecture
>
>
Hi Bhupesh,
Yes, if you are using ARM DS-5, this is the wikipage to look at to setup
your environment to debug UEFI. Let me know if you have issue.
Regards,
Olivier
> -----Original Message-----
> From: Sharma Bhupesh-B45370 [mailto:B45370@freescale.com]
> Sent: 22 October 2013 07:56
> To: 'Andrew Fish'; 'edk2-devel(a)lists.sourceforge.net'
> Cc: 'Kim Phillips'; 'boot-architecture(a)lists.linaro.org'; Kushwaha
> Prabhakar-B32579
> Subject: Re: [edk2] Debugging Sec and PI phases {Source symbols}
>
>
> > -----Original Message-----
> > From: boot-architecture-bounces(a)lists.linaro.org [mailto:boot-
> > architecture-bounces(a)lists.linaro.org] On Behalf Of Andrew Fish
> > Sent: Tuesday, October 22, 2013 2:07 AM
> > To: edk2-devel(a)lists.sourceforge.net
> > Cc: 'Kim Phillips'; 'boot-architecture(a)lists.linaro.org'; Kushwaha
> > Prabhakar-B32579
> > Subject: Re: [edk2] Debugging Sec and PI phases {Source symbols}
> >
> >
> >
> > On Oct 21, 2013, at 11:38 AM, Sharma Bhupesh-B45370
> > <B45370(a)freescale.com> wrote:
> >
> > > [Resending as I got a 'You must be subscribed to post messages to
> this
> > > mailing list' message from edk2 list]
> > >
> > > Hi List,
> > >
> > > I am new to UEFI and am trying to debug my UEFI ported code (from
> u-
> > boot) on a ARMv7 based SoC.
> > > I am able to do some basic debugging of the ARM CPU init code using
> a
> > DS-5 debugger attached to the board.
> > >
> > > I see that the ported code crashes somewhere while making a
> transition
> > from Sec to PI phase.
> > > However, I can only verify this by seeing instruction level
> > > disassembly. I cannot figure out a way to load the source code
> using
> > the DS-5 debugger.
> > >
> > > I am used to seeing ELF files which have the debug information and
> > which can be loaded via the debugger.
> > > Using the 'file' command I cannot find any ELF file in the output
> > > directory 'Build/..'. The FV and FD files don't seem to be ELF
> files as
> > well.
> > >
> >
> > FD is short for Flash Device. So it is usually the layout of the ROM.
> You
> > could have multiple ROMs, but the most common thing is to just have a
> > single FD.
> > FV is a Firmware Volume. Basically a simple Flash Filesystem that
> allows
> > files, named by GUIDs to be discovered.
> >
> > EFI is a collection of relocatable PE/COFF images, and in general an
> INF
> > file (no for a library) in your project maps to a PE/COFF file
> getting
> > generated.
> >
> > It can vary by compiler, but it is common for the *.dll file to be
> the
> > native image with the debug info. So that is the file you want to
> load
> > symbols for.
> >
> > There are various schemes on how to do this. Some platforms print out
> > debug messages that map into the commands you need to load symbols.
> Some
> > platforms have scripts that can load symbols.
> >
> > Sorry I don't remember the latest recommendation on which scheme to
> use
> > for your platform? Try looking at the *.Fv.map file as I think it has
> > info about how to load symbols. You would need a script to convert
> this
> > into some format the DS-5 understands.
> >
> > Maybe the scripts in
> >
> https://svn.code.sf.net/p/edk2/code/trunk/edk2/ArmPlatformPkg/Scripts/D
> s5
> > / are what you are looking for?
>
> Many thanks Andrew. It seems the DS5 scripts will work for me. I found
> the wiki
> for the same here:
> http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=ArmPkg/
> Ds5
>
> I will try to debug the target using these scripts and get back with my
> results.
>
> Regards,
> Bhupesh
>
> > Thanks,
> >
> > Andrew Fish
> >
> > > Any pointers to which ELF file is generated while compiling a UEFI
> > > BoardPkg and how it can be loaded via the debugger.
> > >
> > > Thanks for your help.
> > > Regards,
> > > Bhupesh
> > >
> > >
> > > -------------------------------------------------------------------
> ---
> > > -------- October Webinars: Code for Performance Free Intel webinars
> > > can help you accelerate application performance.
> > > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the
> > > most from the latest Intel processors and coprocessors. See
> abstracts
> > > and register >
> > >
> http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.c
> > > lktrk _______________________________________________
> > > edk2-devel mailing list
> > > edk2-devel(a)lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/edk2-devel
> >
> >
> > _______________________________________________
> > boot-architecture mailing list
> > boot-architecture(a)lists.linaro.org
> > http://lists.linaro.org/mailman/listinfo/boot-architecture
>
>
>
> -----------------------------------------------------------------------
> -------
> October Webinars: Code for Performance
> Free Intel webinars can help you accelerate application performance.
> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the
> most from
> the latest Intel processors and coprocessors. See abstracts and
> register >
> http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.cl
> ktrk
> _______________________________________________
> edk2-devel mailing list
> edk2-devel(a)lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
On Oct 21, 2013, at 11:38 AM, Sharma Bhupesh-B45370 <B45370(a)freescale.com> wrote:
> [Resending as I got a 'You must be subscribed to post messages to this mailing list' message from edk2 list]
>
> Hi List,
>
> I am new to UEFI and am trying to debug my UEFI ported code (from u-boot) on a ARMv7 based SoC.
> I am able to do some basic debugging of the ARM CPU init code using a DS-5 debugger attached to the board.
>
> I see that the ported code crashes somewhere while making a transition from Sec to PI phase.
> However, I can only verify this by seeing instruction level disassembly. I cannot figure out a way to load
> the source code using the DS-5 debugger.
>
> I am used to seeing ELF files which have the debug information and which can be loaded via the debugger.
> Using the 'file' command I cannot find any ELF file in the output directory 'Build/..'. The FV and FD
> files don't seem to be ELF files as well.
>
FD is short for Flash Device. So it is usually the layout of the ROM. You could have multiple ROMs, but the most common thing is to just have a single FD.
FV is a Firmware Volume. Basically a simple Flash Filesystem that allows files, named by GUIDs to be discovered.
EFI is a collection of relocatable PE/COFF images, and in general an INF file (no for a library) in your project maps to a PE/COFF file getting generated.
It can vary by compiler, but it is common for the *.dll file to be the native image with the debug info. So that is the file you want to load symbols for.
There are various schemes on how to do this. Some platforms print out debug messages that map into the commands you need to load symbols. Some platforms have scripts that can load symbols.
Sorry I don't remember the latest recommendation on which scheme to use for your platform? Try looking at the *.Fv.map file as I think it has info about how to load symbols. You would need a script to convert this into some format the DS-5 understands.
Maybe the scripts in https://svn.code.sf.net/p/edk2/code/trunk/edk2/ArmPlatformPkg/Scripts/Ds5/ are what you are looking for?
Thanks,
Andrew Fish
> Any pointers to which ELF file is generated while compiling a UEFI BoardPkg and how it can be loaded
> via the debugger.
>
> Thanks for your help.
> Regards,
> Bhupesh
>
>
> ------------------------------------------------------------------------------
> October Webinars: Code for Performance
> Free Intel webinars can help you accelerate application performance.
> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
> the latest Intel processors and coprocessors. See abstracts and register >
> http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
> _______________________________________________
> edk2-devel mailing list
> edk2-devel(a)lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
Hi Steven,
Please find attached two patches used for aarch64 work. Each patch goes
into a different topic branch in the end, not in the linaro-topic-fvp
branch as we discussed earlier. Still, they are quite simple, so shouldn't
cause much of a problem.
0001-tools_def-AARCH64-use-CROSS_COMPILE-variable.patch
The above patch goes into linaro-topic-misc.
0002-FVP-Add-support-for-EDK2_USE_ANDROID_CONFIG-build-pa.patch
The above patch goes into linaro-topic-fvp.
Please let me know if these cause you any problems, but it would be good to
get them into uefi.git for the -rc4 and the -03 release respin.
You can also pull both patches/branches from my tree:
https://git.linaro.org/gitweb?p=people/ryanharkin/uefi-next.git;a=summary
Thanks,
Ryan.
On Mon, Sep 30, 2013 at 10:28:49PM +0100, Grant Likely wrote:
> > > load image protocol. In that case the sub should override the setting in
> the
> > > FDT if the initrd argument is present.
> >
> > Hmm, well, it's slightly worse than that - it will have one; only it
> > will be GRUB's command line.
> >
> > The way that can be resolved is:
> > - FDT present?
> > - Commandline present in FDT chosen node?
> > - Yes
> > - Use that.
> > - No
> > - EFI_LOADED_IMAGE command line present?
> > - Yes
> > - Use that.
> > - No
> > - Fail miserably.
> That doesn't handle the case where firmware provides the fdt, but the kernel is
> loaded via the UEFI shell or gummiboot. In that case the stub must process both
> the loaded image arguments.
Well, unless the firmware-provided device tree contains a kernel
command line, that should work fine?
If you mean that there are two command lines to parse for the
EFI_LOADED_IMAGE (one for shell/gummiboot), surely there is a handle
in there to identify the "current" one.
/
Leif
On Mon, Sep 30, 2013 at 09:05:04PM +0100, Grant Likely wrote:
> > Handling the 2 cases is not a problem. I just don't want to handle
> > 'mixed' cases where
> > a command line and an FDT are passed to the stub, and information from
> > both is used.
> >
> > As I understand it, the two cases are:
> >
> > FDT_GUID present == GRUB case
> > * GRUB loads initrd if present
> > * GRUB provides complete FDT to stub (includes command line, hardware
> > description, initrd entry, etc.)
> > * EFI stub loads FDT using FDT_GUID, adds memory map and system table
> > pointer to FDT, starts kernel.
> > * (any command line present in EFI_LOADED_IMAGE is ignored.)
> >
> > FDT_GUID absent == current case
> > * stub loads FDT and initrd from system partition
> > * stub adds command line from EFI_LOADED_IMAGE to FDT
> > * stub adds initrd entry to FDT
> > * stub adds memory map and system table pointer to FDT, starts kernel.
> >
> > In the case of UEFI owning the FDT, and providing it to the stub,
> > where does the initrd come from? I think this adds
> > another case to handle...
> The stub will still need to process a command line if it is given one via the
> load image protocol. In that case the sub should override the setting in the
> FDT if the initrd argument is present.
Hmm, well, it's slightly worse than that - it will have one; only it
will be GRUB's command line.
The way that can be resolved is:
- FDT present?
- Commandline present in FDT chosen node?
- Yes
- Use that.
- No
- EFI_LOADED_IMAGE command line present?
- Yes
- Use that.
- No
- Fail miserably.
/
Leif
On Mon, Sep 30, 2013 at 11:27 AM, Grant Likely <grant.likely(a)linaro.org> wrote:
> On Mon, Sep 30, 2013 at 5:46 PM, Leif Lindholm <leif.lindholm(a)linaro.org> wrote:
>> On Mon, Sep 30, 2013 at 08:05:59AM -0700, Roy Franz wrote:
>>> > I was thinking that the stub would want to use the FDT passed by grub
>>> > if one is passed, but I hadn't thought about the case where grub wants
>>> > to pass information to the stub, but the stub still loads the FDT. The
>>> > easiest thing would be to straight out say that if GRUB is loading the
>>> > initrd, then it is mandatory for GRUB to also load the FDT. That
>>> > eliminates the corner case and I can't think of any situation where
>>> > we'd want GRUB loading the initrd, but use the stub to load the FDT.
>>>
>>> I'd also like to avoid having the stub merge FDT contents from different trees.
>>>
>>> If we add this table, then it seems this would be the right way to
>>> handle passing
>>> the FDT to the EFI stub, even without GRUB involved. Is there a reason not to
>>> move to this method in general?
>>
>> Not really.
>> So ... I guess that would modify the stub behaviour to:
>> - Look for an FDT_GUID configuration table.
>> - If there, use it.
>> - If not there, require one to be loaded based on command line.
>
> Create a mostly empty one for passing freeform data to the kernel
> proper; this is what it will look like on ACPI systems.
So for ACPI systems the stub will package the ACPI data into the FDT?
What would the stub be putting into the FDT that an ACPI/UEFI aware kernel
couldn't get itself at runtime from UEFI?
>
>> And the GRUB behaviour to:
>> - If no FDT_GUID, require FDT if initrd.
>> - If FDT_GUID, copy FDT + add initrd information.
>>
>> The x86 code uses bootparam to pass the kernel command line.
>> Could we use the FDT exists) for the kernel command line
>> too? This would make more code shared between x86 and ARM*, since
>> otherwise we would need to explicitly implement (UCS?) command line
>> passing to stub?
>
> Yes, I think that makes sense. That also means GRUB will need to
> always create an FDT, even if it is empty.
I'm not following something here - why would GRUB create an empty FDT?
Is GRUB going to be responsible for the complete FDT, or just passing the
initrd and/or command line in an FDT?
>
> The other option would be to pass the command line via the LoadOptions
> from the EFI_LOADED_IMAGE protocol. I believe that is what Roy's
> patches currently rely on for getting a command line.
Yes, both my implementation and the x86 implementation get the command line
from the EFI_LOADED_IMAGE protocol, and do conversion from UCS-2 (I think)
to ASCII/UTF-8 to pass to the kernel. The format of the command line does not
seem to be specified by UEFI.
>
> g.
On Mon, Sep 30, 2013 at 07:27:58PM +0100, Grant Likely wrote:
> > So ... I guess that would modify the stub behaviour to:
> > - Look for an FDT_GUID configuration table.
> > - If there, use it.
> > - If not there, require one to be loaded based on command line.
>
> Create a mostly empty one for passing freeform data to the kernel
> proper; this is what it will look like on ACPI systems.
OK. So we push the actual error condition of missing tree down to stub?
Makes sense.
> > The x86 code uses bootparam to pass the kernel command line.
> > Could we use the FDT exists) for the kernel command line
> > too? This would make more code shared between x86 and ARM*, since
> > otherwise we would need to explicitly implement (UCS?) command line
> > passing to stub?
>
> Yes, I think that makes sense. That also means GRUB will need to
> always create an FDT, even if it is empty.
Yes. This would be my preference.
> The other option would be to pass the command line via the LoadOptions
> from the EFI_LOADED_IMAGE protocol. I believe that is what Roy's
> patches currently rely on for getting a command line.
Since the current code doesn't UEFI-wise "load" the stub image, we'd
effectively need to reverse-reconstruct GRUB's runtime environment,
which I really wouldn't like.
/
Leif
On Mon, Sep 30, 2013 at 7:51 AM, Grant Likely <grant.likely(a)linaro.org> wrote:
> On Mon, Sep 30, 2013 at 2:59 PM, Leif Lindholm <leif.lindholm(a)linaro.org> wrote:
>> Hi guys,
>>
>> I've been looking at the patches Matthew Garrett wrote for loading a
>> UEFI stub kernel through GRUB, and noticed one thing that may require
>> updates to the stub code: it uses GRUB to load the initrd.
>> Doing this of course means the initrd does not need to go into the EFI
>> System Partition, which is a lot nicer from the distros' position.
>>
>> Now, in x86 land GRUB just passes the stub a bootparam structure, and
>> I assume it just keeps filling the same structure in before passing it
>> on to the kernel .
>>
>> On ARM*, we would need to get this information over "some other way",
>> where the obvious candidate would be FDT.
>>
>> GRUB could register an empty devicetree, with only the initrd
>> information in it, as a UEFI configuration table. (Getting a UUID for
>> this was discussed in New Orleans.)
>
> Right. It would be a trivial feature to have a UUID in the system
> table pointing to an allocated block of memory containing an FDT. It
> would also be nice to give the FDT some extra space when loaded so
> that the libfdt functions can work in-place... but I digress; the flat
> tree structure already contains enough information to do that.
>
>> Or, on systems using FDT for hardware description, once firmware
>> becomes mature enough to do this themselves - add this information to
>> the system-provided one.
>>
>> The stub would then need to look for this devicetree, and if present,
>> copy the initrd nodes across into the one it loads itself.
>
> I was thinking that the stub would want to use the FDT passed by grub
> if one is passed, but I hadn't thought about the case where grub wants
> to pass information to the stub, but the stub still loads the FDT. The
> easiest thing would be to straight out say that if GRUB is loading the
> initrd, then it is mandatory for GRUB to also load the FDT. That
> eliminates the corner case and I can't think of any situation where
> we'd want GRUB loading the initrd, but use the stub to load the FDT.
I'd also like to avoid having the stub merge FDT contents from different trees.
If we add this table, then it seems this would be the right way to
handle passing
the FDT to the EFI stub, even without GRUB involved. Is there a reason not to
move to this method in general?
>
>> Alternatively, we could define a special protocol for passing
>> additional parameters to the stubbed kernel ... or a special protocol
>> to pass a special FDT but I'm not sure we want yet another interface.
>
> Indeed. I definitely don't want to do this.
Agreed...
>
> g.
Hi guys,
I've been looking at the patches Matthew Garrett wrote for loading a
UEFI stub kernel through GRUB, and noticed one thing that may require
updates to the stub code: it uses GRUB to load the initrd.
Doing this of course means the initrd does not need to go into the EFI
System Partition, which is a lot nicer from the distros' position.
Now, in x86 land GRUB just passes the stub a bootparam structure, and
I assume it just keeps filling the same structure in before passing it
on to the kernel .
On ARM*, we would need to get this information over "some other way",
where the obvious candidate would be FDT.
GRUB could register an empty devicetree, with only the initrd
information in it, as a UEFI configuration table. (Getting a UUID for
this was discussed in New Orleans.)
Or, on systems using FDT for hardware description, once firmware
becomes mature enough to do this themselves - add this information to
the system-provided one.
The stub would then need to look for this devicetree, and if present,
copy the initrd nodes across into the one it loads itself.
Alternatively, we could define a special protocol for passing
additional parameters to the stubbed kernel ... or a special protocol
to pass a special FDT but I'm not sure we want yet another interface.
Thoughts?
/
Leif