maharmstone / quibble
- воскресенье, 16 февраля 2020 г. в 00:21:41
C
Quibble - the custom Windows bootloader
Quibble is the custom Windows bootloader - an open-source reimplementation of the files bootmgfw.efi and winload.efi, able to boot every version of Windows from XP to Windows 10 1909. Unlike the official bootloader, it is extensible, allowing you to boot from other filesystems than just NTFS.
This is only a proof of concept at this stage - don't use this for anything serious.
Screenshot of Windows 10 1909 running on Btrfs:
I'm doing this for kicks and giggles, but if you want to donate it'd be appreciated:
This has been tested with Qemu using the OVMF firmware, with Seabios included as a Compatibility Support Module (CSM). It may work on other VMs or hardware, it may not. You will need the CSM version of OVMF, which isn't the usual one bundled with Qemu. Precompiled version are available: x86 and amd64.
Set up your VM, and install Windows on an NTFS volume.
Install WinBtrfs - you will need version 1.6 at least.
On modern versions of Windows, turn off Fast Startup in the Control Panel.
Shutdown your VM, and copy its hard disk to a Btrfs partition.
On Windows 8, you will need to use icacls to give C:\Users[USERNAME]\AppData\LocalLow a mandatory integrity level of "Low", otherwise it will crash on login.
On some versions of Windows 10 (1607 to 1803?), you will need to give the pseudo-group "ALL APPLICATION PACKAGES" access to C:\Windows\Fonts, or you'll have the amusing sight of Windows not being able to display any text.
Extract the Quibble package into your EFI System Partition. It's supposed to work in a subdirectory, but if you have trouble you might need to put it in the root.
Adjust the file freeldr.ini, if necessary - the default is for it to boot from the first partition
of the first disk. You can also change the SystemPath to e.g. SystemPath=btrfs(1e10b60a-8e9d-466b-a33a-21760829cf3a)\Windows,
referring to the partition by UUID rather than number.
Add quibble.efi to your list of UEFI boot options, and hope that it works...
With the Btrfs driver, this should work on XP, Vista, Windows 7, Windows 8, Windows 8.1, and Windows 10 versions 1507 to 1909. XP and Vista work only in 32-bit mode for the time being. Earlier versions ought to work, as the boot structures were backwards-compatible at that point, but the Btrfs driver won't work.
The included Btrfs driver, and maybe also the FAT driver that's part of the UEFI specifications. Windows XP, Vista, and 7 will work fine from a FAT volume, though why you'd want to do that is anyone's guess.
Drop your EFI driver in the drivers folder, and it'll load it on startup.
Install a cross-compiler version of GCC - either i686-w64-mingw32-gcc or x86_64-w64-mingw32-gcc - and gnu-efi.
I know. This is at least partly due to the NTFS permissions not being transferred. You can use Win+R to open the Run menu.
Again, permissions. Let Windows fix it and it won't happen again.
Mark the files C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\desktop.ini and C:\Users[USERNAME]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\desktop.ini.
This means that the Registry is unclean, which we can't currently recover from. If you attach C:\Windows\System32\config\SYSTEM to another machine via Regedit temporarily, it'll fix it. Make sure you shut Windows down properly to avoid having to do this.
Yes - add /SUBVOL=xxx to your Options in freeldr.ini. You can find the number to use on the Properties page of your subvolume. Bear in mind that unlike Linux this is in hexadecimal.
This is released under the LGPL. The Mersenne Twister code is by Mutsuo Saito and Makoto Matsumoto - see the header of tinymt32.c.