Re: [edk2] Running EFI Shell

Subject: Re: [edk2] Running EFI Shell

From: Andrew Fish <afish@apple.com>

To: edk2-devel@lists.sourceforge.net

Date: 2012-10-31 09:29:40



On Oct 31, 2012, at 12:36 AM, wrote:

.nsh script is bad solution, because I need boot shell without pc native shell.
I think, i have to add some drivers to my ShellPkg, but how i can do it?
Which changes in dsc and inf files i have to add for this?


You can build the drivers from the MdeModulePkg or add them to your own DSC file. The problem is not building the drivers. The problem is how to combine them. We usually build the shell into a PE/COFF .EFI image that you can load directly. The drivers you need also build into .EFI PE/COFF images. The problem is there is no way to combine multiple PE/COFF images together. 

Basically there is no easy way to do what you want. When I did it I did it by hand from the old shell and I manually loaded the drivers. 

You can write an EFI application that you boot from the removable media and this application can detected if the required protocols are present and if not it can load the edk2 driver that produces that protocol. The application can then launch the edk2 shell. Note this should be an EFI application, and not a shell application. 

It is possible to combine the two drivers into the shell as a single application, but you would need to convert the drivers to libraries. So that would take adding INF files to the drivers to convert them to libraries. Then  you need to make the shell libraries depend on your new libraries, which is  modifying the shell library INF files to add the library. You then need to update the DSC file to build your new libraries. If you understand how library inheritance works in edk2 this is an OK option, but writing the EFI Application may be easier as it is just doing stuff documented in the UEFI 2.3.1 spec. 

Good luck. 

Thanks,

Andrew FIsh

--
Thanks.
Valery
2012/10/27 Andrew Fish <afish@apple.com>


Sent from my iPad

On Oct 26, 2012, at 2:47 PM, Jordan Justen <jljusten@gmail.com> wrote:

> On Fri, Oct 26, 2012 at 12:43 AM, <valner47@gmail.com> wrote:
>> I resoved that assert by additional loading Uc2OnUcThunk.efi and then Shell
>> started.
>> But now I have new question: how to load those *.efi files from Shell code?
>
> Maybe a .nsh script could be used to load them and then the shell?
>

So boot the old shell to load the new shell?

> -Jordan
>
>> 2012/10/26 <valner47@gmail.com>
>>>
>>>>> I think it might be easier to change code in the newer UEFI shell.
>>> Which newer UEFI Shell code you mean?
>>>
>>> I tried manually load HiiDatabase.efi and DevicePathDxe.efi, but after
>>> that i got new error:
>>> ASSERT_EFI_ERROR(Status= Device Error)
>>> at that lines of code
>>>  Status = ShellCommandLibConstructor (ImageHandle, SystemTable);
>>>  ASSERT_EFI_ERROR (Status);
>>> in Autogen.c
>>>
>>> P.S. to clarify, I would like to say that I will need to run builded shell
>>> not from internal shell, but separately, placing on FAT partition to a file
>>> EFI/BOOT/BOOTX64.EFI
>>>
>>> --
>>> Valery.
>>> 2012/10/26 Jordan Justen <jljusten@gmail.com>
>>>>
>>>> On Thu, Oct 25, 2012 at 11:19 AM, <valner47@gmail.com>
>>>> wrote:
>>>>> Binaries in EdkShellBinPkg works pretty good, but, unfortunately, i
>>>>> need to
>>>>> build Shell, because i want to change some things.
>>>>
>>>> I think it might be easier to change code in the newer UEFI shell.
>>>>
>>>>> 2012/10/25 Jordan Justen <jljusten@gmail.com>
>>>>>> On Thu, Oct 25, 2012 at 6:53 AM, <valner47@gmail.com>
>>>>>> wrote:
>>>>>>> I am trying to build with GCC44 and run any version of EFI Shell
>>>>>>> with
>>>>>>> edk2. When I build ShellPkg and tried to run it, i got ASSERT() at
>>>>>>> this point:
>>>>>>>
>>>>>>> //
>>>>>>>  // Retrieve the pointer to the UEFI HII String Protocol
>>>>>>>  //
>>>>>>>  Status = gBS->LocateProtocol (&gEfiHiiStringProtocolGuid, NULL,
>>>>>>> (VOID **) &gHiiString);
>>>>>>>  ASSERT_EFI_ERROR (Status);
>>>>>>
>>>>>> I believe this is what happens when you try to run the UEFI Shell on
>>>>>> an older (EFI, not UEFI) system.
>>>>
>>>> I think Andrew Fish might have previously mentioned that it was
>>>> possible to run the new shell on older systems by first loading the
>>>> HiiDatabase.efi and DevicePathDxe.efi drivers on the system first.
>>>>
>>>> To do this, first build MdeModulePkg for your architecture.
>>>>
>>>> Then locate HiiDatabase.efi and DevicePathDxe.efi under the build
>>>> directory.
>>>>
>>>> Then load the two drivers in the old EFI shell on your system:
>>>>> load HiiDatabase.efi
>>>>> load DevicePathDxe.efi
>>>>
>>>> Then run the new Shell.efi.
>>>>
>>>> Can you give this a try?
>>>>
>>>> If this is not workable for you, maybe Andrew or I could test the
>>>> current GccShellPkg to see if it working.
>>>>
>>>> -Jordan
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Everyone hates slow websites. So do we.
>>>> Make your web apps faster with AppDynamics
>>>> Download AppDynamics Lite for free today:
>>>> http://p.sf.net/sfu/appdyn_sfd2d_oct
>>>> _______________________________________________
>>>> edk2-devel mailing list
>>>> edk2-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/edk2-devel
>>
>>
>> ------------------------------------------------------------------------------
>> Everyone hates slow websites. So do we.
>> Make your web apps faster with AppDynamics
>> Download AppDynamics Lite for free today:
>> http://p.sf.net/sfu/appdyn_sfd2d_oct
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/edk2-devel
>
> ------------------------------------------------------------------------------
> WINDOWS 8 is here.
> Millions of people.  Your app in 30 days.
> Visit The Windows 8 Center at Sourceforge for all your go to resources.
> http://windows8center.sourceforge.net/
> join-generation-app-and-make-money-coding-fast/
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
The Windows 8 Center - In partnership with Sourceforge
Your idea - your app - 30 days.
Get started!
http://windows8center.sourceforge.net/
what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel