* Help Required legacy booting from an EFI @ 2016-09-19 15:00 Saqib Khan 2016-09-19 17:49 ` Laszlo Ersek 0 siblings, 1 reply; 7+ messages in thread From: Saqib Khan @ 2016-09-19 15:00 UTC (permalink / raw) To: edk2-devel Hello all, this is my first post to this list and i am very new to edk2 development. I started by building BootManagerMenuApp with following functionality - Boot from BootManagerManueApp - Run an Helloworld EFI - Run windows 7 EFI to boot windows 7 Now i want to develop an EFI which will first run Helloworld EFI then it will boot windows 7 which is installed on legacy boot (NOT EFI). I have looked through http://bluestop.org/edk2/docs/trunk/ documentation thoroughly but i am not able to get any thing for legacy boot from an EFI. It will be helpful if someone guide me the flow for legacy booting from an EFI . -- Regards saqib khan ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Help Required legacy booting from an EFI 2016-09-19 15:00 Help Required legacy booting from an EFI Saqib Khan @ 2016-09-19 17:49 ` Laszlo Ersek 2016-09-20 18:38 ` Saqib Khan 0 siblings, 1 reply; 7+ messages in thread From: Laszlo Ersek @ 2016-09-19 17:49 UTC (permalink / raw) To: Saqib Khan; +Cc: edk2-devel On 09/19/16 17:00, Saqib Khan wrote: > Hello all, this is my first post to this list and i am very new to edk2 > development. > > I started by building BootManagerMenuApp with following functionality > > - Boot from BootManagerManueApp > - Run an Helloworld EFI > - Run windows 7 EFI to boot windows 7 > > Now i want to develop an EFI which will first run Helloworld EFI then it > will boot windows 7 which is installed on legacy boot (NOT EFI). > > I have looked through http://bluestop.org/edk2/docs/trunk/ documentation > thoroughly but i am not able to get any thing for legacy boot from an EFI. > > > It will be helpful if someone guide me the flow for legacy booting from an > EFI . You can add your EFI application to a SysPrep#### load option, then the legacy-booted Windows OS to a normal Boot#### load option. See "3.1.7 Required System Preparation Applications" in the UEFI-2.6 spec, about the ordering between SysPrep#### and Boot####. Furthermore, legacy boot can be triggered by using a BBS (BIOS Boot Specification) device path in the Boot#### option. This devpath node type is documented in UEFI-2.6 "Table 98. Device Node Table", and in the Compatibility Support Module Specification, rev 0.98, "3.2.1 Legacy BIOS Protocol", near BBS_BBS_DEVICE_PATH. For legacy boot to work, your platform firmware must of course include a Compatibility Support Module. As an example platform, SeaBIOS can be built as a CSM, then embedded into OVMF with the -D CSM_ENABLE build switch. (Grep OvmfPkg/OvmfPkg*.{dsc,fdf} for CSM_ENABLE.) Specifically for Windows 7 though, you don't need a full CSM in order to boot it under UEFI. You can boot it in UEFI mode just fine, as long as you have some VBE services installed in the C segment. Windows 7 will run those functions in its internal real-mode emulator, for setting up the display: https://en.wikipedia.org/wiki/Virtual_DOS_machine That is, the VBE functions will not be executed natively, they will be interpreted / emulated. We utilized this fact for booting UEFI Windows 7 without a CSM on QEMU, on the virtual QXL video card; see OvmfPkg/QemuVideoDxe/VbeShim.*. Thanks Laszlo ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Help Required legacy booting from an EFI 2016-09-19 17:49 ` Laszlo Ersek @ 2016-09-20 18:38 ` Saqib Khan 2016-09-20 19:13 ` Laszlo Ersek 2016-09-20 19:41 ` Rod Smith 0 siblings, 2 replies; 7+ messages in thread From: Saqib Khan @ 2016-09-20 18:38 UTC (permalink / raw) To: Laszlo Ersek; +Cc: edk2-devel On Mon, Sep 19, 2016 at 10:49 PM, Laszlo Ersek <lersek@redhat.com> wrote: > On 09/19/16 17:00, Saqib Khan wrote: > > Hello all, this is my first post to this list and i am very new to edk2 > > development. > > > > I started by building BootManagerMenuApp with following functionality > > > > - Boot from BootManagerManueApp > > - Run an Helloworld EFI > > - Run windows 7 EFI to boot windows 7 > > > > Now i want to develop an EFI which will first run Helloworld EFI then it > > will boot windows 7 which is installed on legacy boot (NOT EFI). > > > > I have looked through http://bluestop.org/edk2/docs/trunk/ documentation > > thoroughly but i am not able to get any thing for legacy boot from an > EFI. > > > > > > It will be helpful if someone guide me the flow for legacy booting from > an > > EFI . > > You can add your EFI application to a SysPrep#### load option, then the > legacy-booted Windows OS to a normal Boot#### load option. > Sysprep is not my option . :-( > > > See "3.1.7 Required System Preparation Applications" in the UEFI-2.6 > spec, about the ordering between SysPrep#### and Boot####. > > Furthermore, legacy boot can be triggered by using a BBS (BIOS Boot > Specification) device path in the Boot#### option. This devpath node > type is documented in UEFI-2.6 "Table 98. Device Node Table", and in the > Compatibility Support Module Specification, rev 0.98, "3.2.1 Legacy BIOS > Protocol", near BBS_BBS_DEVICE_PATH. > Booting using BBS is my option,i was already looking for this and I have attempted to modify EFIBootManagerMenuApp to work with legacy boot used (). I have system with CSM support so essentially i will be doing all my work on physical system not on virtual machine. The detail you provided about BBS device path and then adding it to boot menu is abstract for me .if you can detail this procedure a bit it will be helpful, if required I can share the code snippet with you Apart from this I am facing another issue, i created a boot-able USB with EFI 2.0 shell in it . I have gabby motherboard(gigabyte h97- hd3) , I am not able to launch EFI shell with any configuration it directly boots windows no matter what I do, I attempted all USB port, and all configuration like "boot from UEFI only" disabling secure boot. when I plug US B in another system which support UEFI but not CSM it works fine after adding shell entry from USB. what might I be missing here?can you guide in this case? > > For legacy boot to work, your platform firmware must of course include a > Compatibility Support Module. > > As an example platform, SeaBIOS can be built as a CSM, then embedded > into OVMF with the -D CSM_ENABLE build switch. (Grep > OvmfPkg/OvmfPkg*.{dsc,fdf} for CSM_ENABLE.) > > Specifically for Windows 7 though, you don't need a full CSM in order to > boot it under UEFI. You can boot it in UEFI mode just fine, as long as > you have some VBE services installed in the C segment. Windows 7 will > run those functions in its internal real-mode emulator, for setting up > the display: > > https://en.wikipedia.org/wiki/Virtual_DOS_machine > > That is, the VBE functions will not be executed natively, they will be > interpreted / emulated. > > We utilized this fact for booting UEFI Windows 7 without a CSM on QEMU, > on the virtual QXL video card; see OvmfPkg/QemuVideoDxe/VbeShim.*. > > Thanks > Laszlo > > -- Regards Saqib ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Help Required legacy booting from an EFI 2016-09-20 18:38 ` Saqib Khan @ 2016-09-20 19:13 ` Laszlo Ersek 2016-09-22 11:25 ` Saqib Khan 2016-09-20 19:41 ` Rod Smith 1 sibling, 1 reply; 7+ messages in thread From: Laszlo Ersek @ 2016-09-20 19:13 UTC (permalink / raw) To: Saqib Khan; +Cc: edk2-devel, Ni, Ruiyu CC'ing Ray On 09/20/16 20:38, Saqib Khan wrote: > > > On Mon, Sep 19, 2016 at 10:49 PM, Laszlo Ersek <lersek@redhat.com > <mailto:lersek@redhat.com>> wrote: > > On 09/19/16 17:00, Saqib Khan wrote: > > Hello all, this is my first post to this list and i am very new to edk2 > > development. > > > > I started by building BootManagerMenuApp with following functionality > > > > - Boot from BootManagerManueApp > > - Run an Helloworld EFI > > - Run windows 7 EFI to boot windows 7 > > > > Now i want to develop an EFI which will first run Helloworld EFI then it > > will boot windows 7 which is installed on legacy boot (NOT EFI). > > > > I have looked through http://bluestop.org/edk2/docs/trunk/ > <http://bluestop.org/edk2/docs/trunk/> documentation > > thoroughly but i am not able to get any thing for legacy boot from an EFI. > > > > > > It will be helpful if someone guide me the flow for legacy booting from an > > EFI . > > You can add your EFI application to a SysPrep#### load option, then the > legacy-booted Windows OS to a normal Boot#### load option. > > > Sysprep is not my option . :-( > > > > > See "3.1.7 Required System Preparation Applications" in the UEFI-2.6 > spec, about the ordering between SysPrep#### and Boot####. > > Furthermore, legacy boot can be triggered by using a BBS (BIOS Boot > Specification) device path in the Boot#### option. This devpath node > type is documented in UEFI-2.6 "Table 98. Device Node Table", and in the > Compatibility Support Module Specification, rev 0.98, "3.2.1 Legacy BIOS > Protocol", near BBS_BBS_DEVICE_PATH. > > > > Booting using BBS is my option,i was already looking for this and I have > attempted to modify EFIBootManagerMenuApp to work with legacy boot used (). > > I have system with CSM support so essentially i will be doing all my > work on physical system not on virtual machine. > > The detail you provided about BBS device path and then adding it to boot > menu is abstract for me .if you can detail this procedure a bit it will > be helpful, if required I can share the code snippet with you It's been some time since I last tried CSM / legacy boot, but I think when your platform BDS (= PlatformBootManagerLib instance) calls the UefiBootManagerLib function called EfiBootManagerRefreshAllBootOption(), that should generate (among other boot options) BBS boot options for all suitable legacy OSes. It seems that for this, you should link IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBootManagerLib.inf into all the drivers and modules in your firmware -- via NULL library resolution -- that consume UefiBootManagerLib. In OVMF's case at least, the set of affected drivers is: MdeModulePkg/Application/UiApp/UiApp.inf MdeModulePkg/Universal/BdsDxe/BdsDxe.inf MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf NetworkPkg/HttpBootDxe/HttpBootDxe.inf The important ones from these modules are likely the first two, UiApp and BdsDxe. (Theoretically any consumer of UefiBootManagerLib could call EfiBootManagerRefreshAllBootOption(), and at that point you might want LegacyBootManagerLib to have registered its "RefreshLegacyBootOption" callback at construction time.) In addition, IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUiLib.inf should likely be linked, via NULL resolution, into MdeModulePkg/Application/UiApp/UiApp.inf minimally. (Example: please see the CSM_ENABLE parts under "MdeModulePkg/Universal/BdsDxe/BdsDxe.inf" and "MdeModulePkg/Application/UiApp/UiApp.inf" in OvmfPkg/OvmfPkg*dsc. You'll find the above NULL library resolutions there.) > > Apart from this I am facing another issue, i created a boot-able USB > with EFI 2.0 shell in it . I have gabby motherboard(gigabyte h97- hd3) , > I am not able to launch EFI shell with any configuration it directly > boots windows no matter what I do, I attempted all USB port, and all > configuration like "boot from UEFI only" disabling secure boot. when I > plug US > B in another system which support UEFI but not CSM it works fine after > adding shell entry from USB. what might I be missing here?can you guide > in this case? No clue. My take would have been "disable secure boot because your shell binary is not signed", but you already tried that. Platform BDS is platform-dependent, as its name says. Get another development board? Laszlo ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Help Required legacy booting from an EFI 2016-09-20 19:13 ` Laszlo Ersek @ 2016-09-22 11:25 ` Saqib Khan 2016-09-23 3:33 ` Laszlo Ersek 0 siblings, 1 reply; 7+ messages in thread From: Saqib Khan @ 2016-09-22 11:25 UTC (permalink / raw) To: Laszlo Ersek; +Cc: edk2-devel okay so i started with "MdeModulePkg\Application\BootManagerMenuApp" addded follwoing package in inf file 1. IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec 2. IntelFrameworkPkg/IntelFrameworkPkg.dec and follwing libraries 1. LegacyBootManagerLib 2. LegacyBootMaintUiLib and then i added library reference in C:\efi\test\edk2\DuetPkg/DuetPkgX6.dsc 1. LegacyBootManagerLib|IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBootManagerLib.inf 2. LegacyBootMaintUiLib|IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUiLib.inf Then in included <Library/LegacyBootMaintUi.h> in \MdeModulePkg\Application\BootManagerMenuApp\BootManagerMenuApp.h then i attempted top call " GetLegacyOptions " then i built it with *Build -a X64 -p DuetPkg/DuetPkgX64.dsc * It is unable to find LegacyBootMaintUi.h also .i am unable find where i am wrong ...i have followed build path from https://github.com/tianocore/tianocore.github.io/wiki/Getting-Started-Writing-Simple-Application can any one point out where i am wrong? On Wed, Sep 21, 2016 at 12:13 AM, Laszlo Ersek <lersek@redhat.com> wrote: > CC'ing Ray > > On 09/20/16 20:38, Saqib Khan wrote: > > > > > > On Mon, Sep 19, 2016 at 10:49 PM, Laszlo Ersek <lersek@redhat.com > > <mailto:lersek@redhat.com>> wrote: > > > > On 09/19/16 17:00, Saqib Khan wrote: > > > Hello all, this is my first post to this list and i am very new to > edk2 > > > development. > > > > > > I started by building BootManagerMenuApp with following > functionality > > > > > > - Boot from BootManagerManueApp > > > - Run an Helloworld EFI > > > - Run windows 7 EFI to boot windows 7 > > > > > > Now i want to develop an EFI which will first run Helloworld EFI > then it > > > will boot windows 7 which is installed on legacy boot (NOT EFI). > > > > > > I have looked through http://bluestop.org/edk2/docs/trunk/ > > <http://bluestop.org/edk2/docs/trunk/> documentation > > > thoroughly but i am not able to get any thing for legacy boot from > an EFI. > > > > > > > > > It will be helpful if someone guide me the flow for legacy booting > from an > > > EFI . > > > > You can add your EFI application to a SysPrep#### load option, then > the > > legacy-booted Windows OS to a normal Boot#### load option. > > > > > > Sysprep is not my option . :-( > > > > > > > > > > See "3.1.7 Required System Preparation Applications" in the UEFI-2.6 > > spec, about the ordering between SysPrep#### and Boot####. > > > > Furthermore, legacy boot can be triggered by using a BBS (BIOS Boot > > Specification) device path in the Boot#### option. This devpath node > > type is documented in UEFI-2.6 "Table 98. Device Node Table", and in > the > > Compatibility Support Module Specification, rev 0.98, "3.2.1 Legacy > BIOS > > Protocol", near BBS_BBS_DEVICE_PATH. > > > > > > > > Booting using BBS is my option,i was already looking for this and I have > > attempted to modify EFIBootManagerMenuApp to work with legacy boot used > (). > > > > I have system with CSM support so essentially i will be doing all my > > work on physical system not on virtual machine. > > > > The detail you provided about BBS device path and then adding it to boot > > menu is abstract for me .if you can detail this procedure a bit it will > > be helpful, if required I can share the code snippet with you > > It's been some time since I last tried CSM / legacy boot, but I think > when your platform BDS (= PlatformBootManagerLib instance) calls the > UefiBootManagerLib function called EfiBootManagerRefreshAllBootOption(), > that should generate (among other boot options) BBS boot options for all > suitable legacy OSes. > > It seems that for this, you should link > > IntelFrameworkModulePkg/Library/LegacyBootManagerLib/ > LegacyBootManagerLib.inf > > into all the drivers and modules in your firmware -- via NULL library > resolution -- that consume UefiBootManagerLib. In OVMF's case at least, > the set of affected drivers is: > > MdeModulePkg/Application/UiApp/UiApp.inf > MdeModulePkg/Universal/BdsDxe/BdsDxe.inf > MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf > NetworkPkg/HttpBootDxe/HttpBootDxe.inf > > The important ones from these modules are likely the first two, UiApp > and BdsDxe. > > (Theoretically any consumer of UefiBootManagerLib could call > EfiBootManagerRefreshAllBootOption(), and at that point you might want > LegacyBootManagerLib to have registered its "RefreshLegacyBootOption" > callback at construction time.) > > In addition, > > IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/ > LegacyBootMaintUiLib.inf > > should likely be linked, via NULL resolution, into > > MdeModulePkg/Application/UiApp/UiApp.inf > > minimally. > > (Example: please see the CSM_ENABLE parts under > "MdeModulePkg/Universal/BdsDxe/BdsDxe.inf" and > "MdeModulePkg/Application/UiApp/UiApp.inf" in OvmfPkg/OvmfPkg*dsc. > You'll find the above NULL library resolutions there.) > > > > > Apart from this I am facing another issue, i created a boot-able USB > > with EFI 2.0 shell in it . I have gabby motherboard(gigabyte h97- hd3) , > > I am not able to launch EFI shell with any configuration it directly > > boots windows no matter what I do, I attempted all USB port, and all > > configuration like "boot from UEFI only" disabling secure boot. when I > > plug US > > B in another system which support UEFI but not CSM it works fine after > > adding shell entry from USB. what might I be missing here?can you guide > > in this case? > > No clue. My take would have been "disable secure boot because your shell > binary is not signed", but you already tried that. Platform BDS is > platform-dependent, as its name says. Get another development board? > > Laszlo > -- Regards Saqib Ahmed Khanzada ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Help Required legacy booting from an EFI 2016-09-22 11:25 ` Saqib Khan @ 2016-09-23 3:33 ` Laszlo Ersek 0 siblings, 0 replies; 7+ messages in thread From: Laszlo Ersek @ 2016-09-23 3:33 UTC (permalink / raw) To: Saqib Khan; +Cc: edk2-devel On 09/22/16 13:25, Saqib Khan wrote: > okay so i started with "MdeModulePkg\Application\BootManagerMenuApp" > addded follwoing package in inf file > > 1. IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec > 2. IntelFrameworkPkg/IntelFrameworkPkg.dec > > and follwing libraries > > 1. LegacyBootManagerLib > 2. LegacyBootMaintUiLib > > and then i added library reference in C:\efi\test\edk2\DuetPkg/DuetPkgX6.dsc > > 1. LegacyBootManagerLib|IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBootManagerLib.inf > 2. LegacyBootMaintUiLib|IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUiLib.inf > > Then in included <Library/LegacyBootMaintUi.h> in > \MdeModulePkg\Application\BootManagerMenuApp\BootManagerMenuApp.h then > i attempted top call " GetLegacyOptions > " > > > then i built it with *Build -a X64 -p DuetPkg/DuetPkgX64.dsc > * > > > It is unable to find LegacyBootMaintUi.h also .i am unable find where i > am wrong ...i have followed build path from > > https://github.com/tianocore/tianocore.github.io/wiki/Getting-Started-Writing-Simple-Application > > > can any one point out where i am wrong? The header file that you are trying to include, in the source code of another module, is actually a library-internal header file: IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUi.h Library class header files that define public APIs always have pathnames with the pattern FooPkg/Include/Library/BarLib.h I'm getting confused about what you want to achieve. You wrote "Now i want to develop an EFI which will first run Helloworld EFI then it will boot windows 7 which is installed on legacy boot (NOT EFI)." To my knowledge, if you have a UEFI boot option for a legacy OS (with the BBS devpath stuff in it), then EfiBootManagerBoot() in UefiBootManagerLib can boot it transparently, assuming all the legacy support has been built in (see my previous email). Ultimately the legacy OS is booted with the EFI_LEGACY_BIOS_PROTOCOL.LegacyBoot(), which takes the BBS device path as a parameter. See LegacyBmBoot() in "IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBm.c". Anyway I think this would be best discussed with Ray, as I'm just another user of UefiBootManagerLib, through OVMF's PlatformBDS. What you are trying to do doesn't seem like regular boot manager / Platform BDS behavior. Laszlo ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Help Required legacy booting from an EFI 2016-09-20 18:38 ` Saqib Khan 2016-09-20 19:13 ` Laszlo Ersek @ 2016-09-20 19:41 ` Rod Smith 1 sibling, 0 replies; 7+ messages in thread From: Rod Smith @ 2016-09-20 19:41 UTC (permalink / raw) To: edk2-devel, saqib.khan2011 On 09/20/2016 02:38 PM, Saqib Khan wrote: > > Booting using BBS is my option,i was already looking for this and I have > attempted to modify EFIBootManagerMenuApp to work with legacy boot used (). > > I have system with CSM support so essentially i will be doing all my work > on physical system not on virtual machine. > > The detail you provided about BBS device path and then adding it to boot > menu is abstract for me .if you can detail this procedure a bit it will be > helpful, if required I can share the code snippet with you You may want to look at the relevant bits of code in my rEFInd boot manager: https://sourceforge.net/projects/refind/ In particular, look at the functions in EfiLib/legacy.c and refind/legacy.c. One big caveat is that rEFInd includes TWO code paths for launching BIOS-mode boot loaders -- one it inherits from its predecessor project, rEFIt, and works only on Macs; and the other was contributed by John Bressler and works only on UEFI-based PCs. Since I wrote neither, I can't offer a lot of insight into how either one works. (The Mac side, in particular, is pretty mysterious to me.) There may be a better way to do it than what rEFInd does, but at least rEFInd's code does work. Thus, if you need a concrete example, the rEFInd code might be helpful. -- Rod Smith rodsmith@rodsbooks.com http://www.rodsbooks.com ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-09-23 3:33 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-09-19 15:00 Help Required legacy booting from an EFI Saqib Khan 2016-09-19 17:49 ` Laszlo Ersek 2016-09-20 18:38 ` Saqib Khan 2016-09-20 19:13 ` Laszlo Ersek 2016-09-22 11:25 ` Saqib Khan 2016-09-23 3:33 ` Laszlo Ersek 2016-09-20 19:41 ` Rod Smith
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox