Installing Windows 7 on the pure UEFI systems without CSM

Discussion in 'Windows 7' started by PrimeExpert Software, Jan 2, 2020.

  1. PrimeExpert Software

    Dec 3, 2019
    27
    56
    0
    It's a well-known fact that Windows 7 works best in CSM mode, which, unfortunately, is not supported by the firmware of many modern motherboards and laptops.

    Contrary to popular belief, it's possible to install Windows 7 x64 to the pure UEFI systems without CSM support. For example, "bhyve" virtual machine manager in FreeBSD supports 64-bit editions of Windows 7 and Windows 2008 Server R2, despite the complete lack of CSM support.

    What is really important for Windows 7 is a VGA-compatible GPU with properly mapped I/O ports and INT 10H handler (the former depends mostly on the chipset and the latter is usually provided by firmware when CSM mode is enabled in the settings). By the way, Windows 7 and Windows 2008 Server R2 never directly run the INT 10H handler installed by BIOS/CSM, instead they contain an emulator in the VGA miniport driver (VIDEOPRT.SYS) which runs 16-bit BIOS code in a sandbox, without leaving 64-bit protected mode and without halting other CPU cores.

    Starting from Windows 8, everything has changed: INT 10H handler is no longer required by Windows to boot, BIOS emulator and entire VGA miniport driver both are gone, instead Windows basic display driver relies upon UEFI Graphics Output Protocol aka GOP.

    So, will it be enough to provide a custom INT 10H handler (by implementing a specialized UEFI preloader) to boot Windows 7 successfully on the modern pure UEFI systems? This custom INT 10H handler can rely on UEFI GOP to provide some sort of "mini CSM" (not a real thing, but just enough for VIDEOPRT.SYS to boot Windows 7).

    As our experiments demonstrated, this, unfortunately, is not enough. In addition to invoking VGA BIOS via INT 10H in VIDEOPRT.SYS, Windows 7 makes direct reads and writes to/from VGA I/O ports right from the OS kernel (NTOSKRNL.EXE). First of all, Windows 7 OS kernel has VgaIsPresent() function which may halt boot process indefinitely on the "glowing logo" phase if VGA-compatible GPU does not respond on the standard I/O ports (0x3C0-0x3DF). Also, Windows 7 OS kernel has several other functions, such as VidInitialize(), VgaInterpretCmdStream(), VidSolidColorFill(), SetPixel() etc, which perform direct I/O on VGA ports for drawing BSoD (blue screen of death).

    Therefore, we continued development of our preloader for Windows 7 by introducing a patch for NTOSKRNL.EXE to replace all instances of direct I/O via VGA ports with updates of framebuffer provided by UEFI GOP (in similar manner to Windows 8+). This patch is activated every time Windows boots, so NTOSKRNL.EXE is updated on the fly, only in the RAM, and on-disk version of this file is not affected (it may undergo any Windows 7 updates, it may be contained inside BOOT.WIM etc).

    Final result of our efforts: Windows 7 x64 with preloader boots fine on pure UEFI systems (without CSM and without properly mapped VGA I/O ports): we successfully tested it and confirmed to work on ASUS C8HM70-I, Dell Inspiron 3584, HP OMEN X 17-ap001ur, Atomic Pi, "bhyve" virtual machine with VGA emulation disabled, "VirtualBox" virtual machine configured in UEFI mode for Windows 8 guest OS. Thus, it is no longer necessary to disable Vga and VgaSave services in registry. It's no longer necessary to set "novesa on" option via bcdedit. Safe Mode and Windows Recovery work as expected. Last but not least: Windows 7 BSoD works as expected! :)

    The only drawback of this approach is that screen resolution is fixed at 1024x768 with black sidebars added as necessary to fill in for the native resolution of the LCD screen. But after installation of the native GPU drivers (from Intel, AMD or NVIDIA) everything goes back to normal. Black sidebars remain at boot time only, when animated OS logo is displayed by Windows 7 via standard VGA driver.

    `Windows 7 x64 preloader to provide VGA emulation on the pure UEFI systems' has become a feature of our software product (FlashBoot Pro). In addition to patching the loader, FlashBoot Pro provides a set of prepackages drivers for USB 3.x, NVMe and AHCI RAID controllers, which can be integrated to Windows 7 Setup just by a few checkboxes ticked on (driver integration is hardly a suprise for a seasoned Windows 7 installers from this forum, and was meant to simplify this matter for beginners).

    Right now we are running a giveaway of 10 licenses for FlashBoot Pro on MyDigitalLife forums, so if you are interested in this topic (installation of Windows 7 to modern motherboards and laptops without CSM support, in the pure UEFI mode), please feel free to enroll.
     
  2. #2 Deleted member 190847, Jan 2, 2020
    Last edited by a moderator: Jan 2, 2020
    Completely unnecessary.
    Just integrate vendor specific video drivers (Intel, nVidia or AMD) to Windows 7 install.wim file, then use Windows 10 installer in place of Windows 7 installer. In other words, just copy your modified install.wim from Windows 7 to Windows 10 installation DVD.

    It is also required to replace Windows 7 boot manager (bootmgr.efi) with that of Windows 10, either inside install.wim file or on an installed system (on EFI system partition).
    See my these 2 posts

    So, I see no reason to emulate INT 10h for Windows 7. As I have tested above solution on Lenovo ThinkCenter M82 with UEFI enabled and CSM disabled.
    Even Secure Boot enabled work as expected.
     
  3. PrimeExpert Software

    Dec 3, 2019
    27
    56
    0
    #3 PrimeExpert Software, Jan 2, 2020
    Last edited: Jan 2, 2020
    (OP)
    In your approach, Safe Mode / Windows Recovery won't work. And BSoDs won't be displayed (computer will just freeze). Also there may be early BSoDs like ACPI_BIOS_ERROR and INACCESSIBLE_BOOT_DEVICE which appear before video driver is loaded, so it's nice to have them as well (with all details included), instead of usual small frozen red dot above "Starting Windows".
     
  4. AFAIK, vendor specific drivers could be added to Windows Recovery (winRE.wim) in the same way as it could be added to install.wim.
    Incidentally, winRE.wim resides inside install.wim

    You are right, but I haven't seen accidental BSoD for many, many years. It never happens on properly installed OS (at least never happened to me).
    If I see it, I will be almost sure about hardware failure.
     
  5. You could use boot.wim from Windows 10 along with entire Windows 10 installation DVD, so you use its drivers.

    Only install.wim from Windows 7 is needed.
     
  6. PrimeExpert Software

    Dec 3, 2019
    27
    56
    0
    #8 PrimeExpert Software, Jan 3, 2020
    Last edited: Jan 3, 2020
    (OP)
    Last time I checked, Windows 7 UEFI loader was able to boot Windows 10 without any problems. Boot menu was presented in text mode (akin to "bootmenupolicy legacy" bcdedit option of Windows 8+), but otherwise it was fine, both in cold boot mode (via winload.efi) and dehibernation mode (via winresume.efi).

    It works fine because OS-specific boot logic is contained within \Windows\System32\winload.efi, and early bootloader bootmgfw.efi merely displays boot menu, activates recovery/dehibernation boot path if necessary, and transfers control to the next bootloader in chain.

    But, given Windows 10 bad habit to continuously update everything in sight, UEFI loader included, I'd rather moved patched Windows 7 UEFI loader along with its BCD hive to the small separate partition and added third-party boot manager like REFind to choose between Windows 7 and Windows 10 UEFI loaders in dual-boot configuration.
     
  7. nodnar

    nodnar MDL Expert

    Oct 15, 2011
    1,315
    1,040
    60
    :g: this thread looks to me like taking arms against a sea of trouble...
    at every occasion m$ is yelping about EOL of seven...they even invented a nagscreen/popup for it.
    i still have good hopes that 7 wil lbe as longlived as xp has proved to be, but i have no intention to
    continue to use it, seeing that 7 is a decently-stable os,-as opposed to the aggressively promoted/marketied of 10-
    there is absolutely no need for a new install of 7. [possibly a virusinfection or a bad harddisk could provoke that,]
    or the use of safe mode...[and i never had to use safe mode since 2012 or therabouts.
    while i can appreciate the giveaway very much, my machine will be on linux mint very soon. bye bye m$ malwaremakers....
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. Reducer

    Reducer MDL Junior Member

    Jul 30, 2014
    51
    69
    0
    Not sure what you mean in "use its (boot.wim) drivers". After deploying OS ("extracting" OS from WIM/ESD file to target storage media) via official Setup app from ISO or other means, user then boots the OS for 1st time. There is a "device configuration" stage (PnP stage) where devices like (i)VGA are detected and, if they exist in the deployed OS driver store, suitable drivers (native/OEM) are installed. They won't install (will be ignored/rejected, specially in Win x64 scenarios) if they don't meet the described properties.

    Actually I've never tried to boot full Win10 OS via Win7 efi bootloader, but I can't boot my custom Win10 PE with Win7 efi bootloader, so I'm using Win10 one. I will try again using untouched boot.wim from one of the recent Win10 releases, just to be sure it's not just my specific Win10 PE. In any case, that sounds great, you have it covered.

    Also, I like rEFInd :)

    Some users like to boot in Safe Mode to DDU VGA drivers. Other scenarios might be borderline, I have to agree here, but as I've said having it available is better than not.
     
  9. Atak_Snajpera

    Atak_Snajpera MDL Member

    Feb 2, 2018
    159
    252
    10
    Does this method also solve that annoying message saying that bios is not acpi compilant?

    The BIOS in this system is not fully ACPI compliant. Prease contact your system vendor for an updated BIOS.
    Technical information:
    Stop: 0x000000A5 (0x0000000000000011, 0x0000000000000008, 0xFFFFFA80074416E8, 0x0000000020160422)
     
  10. daniel_k

    daniel_k MDL Member

    Jan 21, 2019
    176
    370
    10
    @Atak_Snajpera
    No.

    Happens with Ryzen APU, right?
    It's another issue, nothing to do with the UEFI booting subject of this topic.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  11. The Freeman

    The Freeman MDL Novice

    Dec 7, 2018
    18
    10
    0
    I wonder if there is a forum where people discuss their success or failure when using the FlashBoot software. I searched with Google but I wasn't able to find anything.
     
  12. daniel_k

    daniel_k MDL Member

    Jan 21, 2019
    176
    370
    10
    That is really odd.

    @LostED, please let us know if the no CSM fix does really work.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  13. CiprianPtr

    CiprianPtr MDL Novice

    Feb 29, 2020
    3
    1
    0

    I have the same problem, albeit trying with Flashboot PRO on an ASUS G731GU with i7-9750H (CannonLake-H?? I believe..)

    Software (flashboot pro) works fine with some standard ~3GB size Win7 x64 SP1 iso, adding USB, NVME and whatnot as well as the preloader as said in OP - although(!) a newer, bigger 5.5GB ISO downloaded with Windows-ISO-Downloader (August 2018 version) is creating problems during driver & preloader integration (size errors, not enough space etc, probably some file exceeds fat32 limitation?).

    USB memory boots fine in pure uefi (3.0) mode, no more red bar on top but i get the acpi error :(( Don't know what drivers (if any) to integrate, I've tried some varios acpi / chipser drivers from win-raid forums, like canonkong's ACPITME / EHCI(AMT) driver for win7 64bit of new Intel chipset systems, or Fernando's Latest "pure" Intel Chipset Device *.INF files for all Intel systems from 6-Series up (including CannonLake-H), as well as the ones from asus's support page (although those are for win10).

    I'm stuck atm at what more can I do to use this method which seems very easy and hassle free for me (not a pro as many of you) :(


    In any case, do you guys believe I have a better chance eventually with wkeller's suggested method, of using Windows 10 installer instead of 7's albeit with the necessary changes? Seems a lot to do, and I do not have the required knowledge I fear, if there's a (as much as possible) simple how-to on this (starting from a Win7x64 ISO and a say, Win19x64 1909 ISO, what comamnds to execute, what files to replace, from start to end - I would greatly appreciate. Right now I don't have the will anymore to try varios acpi or chipset drivers blindly, rebuilding USB sticks time and again, it's tiresome :(
     
  14. daniel_k

    daniel_k MDL Member

    Jan 21, 2019
    176
    370
    10
    Stop error A5 is related to ACPI DSDT table of BIOS.
    Flashboot Pro won't help you with this.

    Intel and manufacturers are building a DSDT table that is not compatible with Windows 7. Yes, it's on purpose.

    Please try Windows 8.1 to see if it is also affected.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  15. CiprianPtr

    CiprianPtr MDL Novice

    Feb 29, 2020
    3
    1
    0
    Updates,

    Now I'm trying to install Windows 7 on a pure UEFI laptop with "Windows 7 Image Updater - SkyLake\KabyLake\CoffeLake\Ryzen Threadripper" by Atak_Snajpera which already uses Integrates installer from Windows 10. I can get to NVME SSD partitioning part and copying files, but after the first restart i get the top red bar due to GOP video and lack of VGA.

    I know i have to disable VGA drivers and insert vendor drivers, i have tried various commands, bat files, etc but i'm failing, surely doing somethin wrong, please please please HELP me cause i'm goint nuts :(((

    so to make things easier, i have a USB stick with Bob.Ombs.Modified.Win10PEx64.v4.8 for a live PE medium.

    I have another USB stick with en_windows_7_ultimate_with_sp1_x64_dvd_u_677332, modified with
    Windows 7 Image Updater - SkyLake\KabyLake\CoffeLake\Ryzen Threadripper by Atak_Snajpera with integrated installer from Windows 10 (among updates, various needed drivers etc).

    I boot Win10PE and i have:

    RAMDisk (B: ) (from WinPE)
    Local Disk (C: ) - Windows partition from NVME ssd made with 7 installer up to the point of first restart, after copying files. (so no more acpi error with win10 installer)
    Windows7x64 (D: ) - from USB stick, the one with winx64 updated with image updater by Atak_Snajpera
    UEFI_NTFS (E: ) - another small 494KB partition from the USB stick, i think Rufus makes it? as D: is of ntfs format, probably due to big install.wim? anyway
    and
    Boot (X: ) (from WinPE as well, i guess)

    So next, what do i do?

    What commands do i execute and where, to either:

    a) disable vga on the already (half installed) windows 7 on C: (if possible) and also integrate intel graphics additionally, or

    b) disable vga on the USB stick with 7 installer, D: , integrate intel graphics and start installer from scratch, again.

    Please help me, cause i fell like the ultimate noob atm :(
     
  16. CiprianPtr

    CiprianPtr MDL Novice

    Feb 29, 2020
    3
    1
    0
    Another update,

    Unfortunately nothing seemed to work after more than 2 days of various tries, fixes etc, probably due to that ACPI DSDT table as daniel_k was suggesting :(

    Managed to put the right commands on cmd on a bootable Win10PE to disable vga, after rebuilding the iso with Image updater as well as slipstreaming UHD 630 graphics (by canonkong from win-raid forums, also had other 2 variants) and geforce 1660ti, but still no good.

    Had another try yesterday starting from a clean iso, working with Flashboot Pro to integrate the preloader only (for UEFI GOP to/from VGA), then working with Gigabyte's Windows USB Installation Tool to integrate more USB/AHCI/nvme/kb's whatever (though maybe it might add something I might skip), then working with NTLite to integrate GTX 1660ti drivers as well as canonkong's UHD 630 drivers, plus Fernando's (from win-raid) Latest "pure" Intel Chipset Device *.INF files for all Intel systems from 6-Series up, plus canonkong's ACPITME / EHCI(AMT) Drivers & Fake Drivers for SMBus Controller, SPI Controller, Intel Serial IO GPIO Host Controller :) then finally working with Windows_7_Image_Updater for final goodies of various other drivers and Windows' 10's updated installer.. which went alright with no errors on all software, but to no avail, as, just the same, setup launches, I'm able to partition, copy files etc, reboot, preloader kicks in after first restart in 1024x768 as it should but i get to the acpi bsod :( it's killing me inside spending so much time to build these isos, time and time again :( And today I had to give back the laptop to the guy who owns it, without completing my challenge unfortunately :(

    I didn't have the time to lunch a Windows 8.1 installer as daniel_k suggested to see if it works, at the end of the day the feeling is that if only i would find some right acpi inf files for this specific laptop to skip this bsod I would be in desktop mode already.

    At the end of the day, since I'm posting in author's topic with other problems for which I apologize, just want to say as well that the program works as expected and does what it advertises, which by the way is quite a brilliant ideea imo. Just a shame my problems are further down the road. Worth a try, I guess.

    Thanks all peope who gave me advice and help in private messages and posts, here and in other forums as well, thought sharing it here might maybe help others in the future. Good luck, and thanks again.
     
  17. Wolfman_Jack

    Wolfman_Jack MDL Novice

    Nov 12, 2017
    2
    0
    0
    #19 Wolfman_Jack, Mar 8, 2020
    Last edited: Mar 8, 2020
    I was interested in doing this a few years ago, I came across a GitHub project called VgaShim, written for a Mac laptop. Just posting in case some were unaware.
     
  18. shhnedo

    shhnedo MDL Expert

    Mar 20, 2011
    1,676
    2,225
    60
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...