Giter VIP home page Giter VIP logo

Comments (59)

jeditobe avatar jeditobe commented on August 30, 2024 50

Hello from ReactOS team!

We are looking for ways of using BTRFS as main FS in ReactOS. At the moment we already use WinBTRFS driver 1.0. We want to make possible booting of ReactOS from BTRFS partition.

from btrfs.

maharmstone avatar maharmstone commented on August 30, 2024 49

I've got it working on Windows 7 now as well. I'll submit the patches once I've cleaned them up.

win7-btrfs

from btrfs.

maharmstone avatar maharmstone commented on August 30, 2024 23

If anybody's interested, I've got this working with Vista now as well. I'll be submitting some patches to Freeloader shortly.

It's my understanding that Vista and Windows 7 aren't all that dissimilar internally, so hopefully getting this working with modern versions of Windows isn't that far away...

vista

from btrfs.

maharmstone avatar maharmstone commented on August 30, 2024 23

If anybody's interested: https://github.com/maharmstone/quibble

from btrfs.

maharmstone avatar maharmstone commented on August 30, 2024 19

An update: I got fed up of trying to hack freeldr into shape, so I've been working on a new EFI bootloader, which I'll be releasing once it's done. Here's it running Windows 8 off a Btrfs partition:

win8

from btrfs.

maharmstone avatar maharmstone commented on August 30, 2024 18

I've created a ReactOS pull request, which fixes the bug. Here's a binary with the fix applied: freeldr.zip.

With the modified version of freeldr and the latest btrfs patches, booting Windows Server 2003 from btrfs now seems to be stable.

from btrfs.

archeYR avatar archeYR commented on August 30, 2024 17

I'm happy to tell you that I successfully managed to boot Windows using FreeLoader (ReactOS boot loader) and the WinBtrfs' ReactOS port.
Windows_Btrfs

The video: https://youtu.be/zZ5JOwVbyWE

It's on drive D: due to drive lettering issues of some sort (happens on Windows 2003 only). Also, a random crash might occur ocassionaly while using the system (not sure wether it is FreeLDR or Btrfs driver fault).

from btrfs.

HBelusca avatar HBelusca commented on August 30, 2024 16

New update (29 July 2018): https://reactos.org/blogs/gsoc-2018-booting-btrfs-works

from btrfs.

maharmstone avatar maharmstone commented on August 30, 2024 12

Awesome! Thank you for sharing this.

from btrfs.

HBelusca avatar HBelusca commented on August 30, 2024 11

Here is the final GSoC blog update from our GSoC student (with a demo video linked): https://reactos.org/blogs/gsoc-2018-final-report
The demo build also includes the two PRs #102 and #103.

from btrfs.

ZhuMa12345678 avatar ZhuMa12345678 commented on August 30, 2024 8

In fact, Microsoft introduced 32-bit UEFI boot support as early as the beta version of Windows Vista. Of course, versions earlier than Windows 8 still require CSM support by default when UEFI boot.
The first Windows system build to support UEFI-IA32 boot was 6.0.5219, but this feature was removed by Microsoft after building 6.0.5477.
image
Until the 32-bit UEFI boot appeared again at build 6.1.7850 and has been retained to this day, the build is also the first Windows system to support exFAT boot.
image

from btrfs.

HBelusca avatar HBelusca commented on August 30, 2024 4

Latest update (14 July 2018): we have a VBR to boot directly into a btrfs volume, that is able to load our freeldr.sys : https://reactos.org/blogs/gsoc-2018-boot-sector-finished
The next step is to implement small btrfs filesystem read-only support in freeldr for it to be able to load arbitrary files from arbitrary directories. Currently work-in-progress.

from btrfs.

maharmstone avatar maharmstone commented on August 30, 2024 3

Thanks for the link, looks like it might be useful. There's symbols available for bootmgfw.efi, which say that there's functions called NtfsMount etc. It might be possible to hook the FS functions or somesuch, I don't know. As I said, it's a long-term aim, and I'm going to look at it properly once the driver itself is feature-complete.

from btrfs.

maharmstone avatar maharmstone commented on August 30, 2024 3

Thanks for letting me know, that sounds interesting. I'm intrigued to see how you get on!

from btrfs.

maharmstone avatar maharmstone commented on August 30, 2024 3

@ale5000-git - 32 so far - I'm hoping 64-bit support will be a relatively trivial addition...

@HBelusca - yes, I know: it's a mess and I'm not touching it. It looks very much like it comes from the run-it-through-IDA-Pro-and-clean-it-up school of reverse engineering. It copies, or appears to aim to copy, all of Microsoft's bad design decisions: the bootmgr/winload split, the inclusion of an XML parser, the inclusion of a FAT driver despite this being guaranteed by the UEFI specs...

from btrfs.

HBelusca avatar HBelusca commented on August 30, 2024 2

An update: I got fed up of trying to hack freeldr into shape, so I've been working on a new EFI bootloader, which I'll be releasing once it's done. Here's it running Windows 8 off a Btrfs partition:

Great, because there is one waiting for it to happen as well: https://git.reactos.org/?p=reactos.git;a=tree;f=boot/environ/app;h=504c60baef7c77f09ec9ae42f710da3496f95020;hb=HEAD xD

from btrfs.

maharmstone avatar maharmstone commented on August 30, 2024 2

@ale5000-git - I think that just means that Microsoft haven't written a 32-bit UEFI bootloader for Windows 7. As far as the kernel is concerned, Windows 8 doesn't require CSM, everything before it does.

from btrfs.

archeYR avatar archeYR commented on August 30, 2024 1

I was wondering if the "Have disk" button on the installer would let you load the driver - though it'd still break when it came to the first reboot.

Yeah, and I don't think this option would work for FS drivers in setup.

I'm surprised it works at all on Windows 2003, actually - I thought the minimum supported version was Windows 7. I don't know if that's behind your crashes.

I'm using a ReactOS version, which has lowered requirements to (at least) Windows 2003. Although ReactOS still really targets Windows 2003, and doesn't expose any NT 6+ functionality AFAIK. The driver itself works fine in ReactOS as well.

from btrfs.

maharmstone avatar maharmstone commented on August 30, 2024 1

I've spent some time looking into this, and I'm now fairly sure it's a bug in Freeloader...

When CmpInitializeSystemHive finishes, only the first sector is marked as dirty, rather than all the cells for which the bootloader has removed the volatile data. This means it ends up discarding dirty registry without it having been flushed, and later on HvpGetCellMapped ends up reading unsanitized data from the disk, and crashing when it tries to read an invalid pointer.

from btrfs.

binarymaster avatar binarymaster commented on August 30, 2024 1

It looks very much like it comes from the run-it-through-IDA-Pro-and-clean-it-up school of reverse engineering.

Blame @ionescu007 😅

32 so far - I'm hoping 64-bit support will be a relatively trivial addition...

Would be interesting to see it for Windows 10 ARM64 as well.

from btrfs.

ale5000-git avatar ale5000-git commented on August 30, 2024 1

@maharmstone: You can't trust the specs, the first PCs are EFI, not UEFI and may not comply completely with the current specs.

I suggest to NOT expect anything being guaranteed.

from btrfs.

maharmstone avatar maharmstone commented on August 30, 2024

It's a long-term aim. To get the whole thing on Btrfs, I'd have to do a new version of bootmgfw.efi, and I'm not even sure if you can do this without it being signed by Microsoft. Another possibility might be having a tiny NTFS partition with just a few files, and everything else on Btrfs.

from btrfs.

Rast1234 avatar Rast1234 commented on August 30, 2024

Thank you for clarifying.
AFAIK EFI has the concept of filesystem drivers (as separate .efi binaries loaded from another bootloader or EFI shell), and rEFInd already has btrfs driver, so maybe bootmgrfw can be patched to read btrfs if something loads the driver. Everything with disabled SecureBoot, of course.

Your idea of having tiny NTFS partition is interesting, but i am not sure how to achieve this. Symlinking everything from NTFS partition to btrfs one? I already did that trick with two NTFS drives and moved /ProgramData, /Program Files and some non-critical /Windows subfolders from SSD to HDD and it worked. Can you tell at what moment of booting windows loads filesystem drivers? Surely it loads some other drivers before, so i doubt if symlinking whole /Windows will work.

Anyway, i'll try to dissect and symlink as much folders as i can this weekend..

from btrfs.

maharmstone avatar maharmstone commented on August 30, 2024

To be honest, for all I know booting via rEFInd might be all that's required. If you load an EFI filesystem driver before the Windows bootloader, will Windows use it or ignore it? It's something I'll have to research.

Presumably the boot process goes something like this:

  • UEFI runs bootmgr.efi
  • bootmgr.efi uses functions in bootmgfw.efi to load ntoskrnl.exe
  • bootmgfw.efi then gets used to load system.reg, which amongst other things lists the services needed to boot
  • Either bootmgr.efi or ntoskrnl.exe then walks the tree looking for services where the start type is 0 ("Boot"), and loads the images into memory
  • Windows then replaces bootmgfw.efi's NTFS commands with the proper ones contained in ntfs.sys, which it has just loaded
  • We then proceed with the normal boot

from btrfs.

mirh avatar mirh commented on August 30, 2024

Everything with disabled SecureBoot, of course.

It's not like there isn't the handy Linux Foundation PreLoader that can sign whatever you want.

I mean, you could even modify re-sign bootmgfw after you have modified it (but is it even legal?).

To be honest, for all I know booting via rEFInd might be all that's required. If you load an EFI filesystem driver before the Windows bootloader, will Windows use it or ignore it? It's something I'll have to research.

I think it depends more on whether windows bootloader is more like GRUB (which loads its own set of drivers) or more like systemd-boot (which handle everything as simply as possible).
Given its functioning and how it can load winload.exe which is the system ntfs partition, I'd go with the former.

So either somebody manages to adds into it btrfs efi driver, or I guess the tiny ntfs partition idea is better.

from btrfs.

ariscop avatar ariscop commented on August 30, 2024

it'd be better to focus on making dism work, currently dies at a call to SetFileSize

from btrfs.

jeditobe avatar jeditobe commented on August 30, 2024

https://jira.reactos.org/browse/CORE-13769

from btrfs.

ale5000-git avatar ale5000-git commented on August 30, 2024

This discussion was mainly about UEFI boot, but has anyone tried to boot Windows 7 in legacy mode (not UEFI) from a btrfs partition?

from btrfs.

hellozyemlya avatar hellozyemlya commented on August 30, 2024

Any updates on this?

from btrfs.

maharmstone avatar maharmstone commented on August 30, 2024

from btrfs.

archeYR avatar archeYR commented on August 30, 2024

Awesome! Did you install it directly to Btrfs, or copy an installation from
NTFS?

I have installed Windows 2003 on FAT32 volume, then the WinBtrfs driver from ReactOS and finally moved the Windows installation to the Btrfs volume (which already had FreeLoader installed). Installing directly onto Btrfs might not be easy because Windows 1st stage installer doesn't support it.

from btrfs.

maharmstone avatar maharmstone commented on August 30, 2024

I was wondering if the "Have disk" button on the installer would let you load the driver - though it'd still break when it came to the first reboot.

I'm surprised it works at all on Windows 2003, actually - I thought the minimum supported version was Windows 7. I don't know if that's behind your crashes.

from btrfs.

ale5000-git avatar ale5000-git commented on August 30, 2024

Quote:

I've spent some time looking into this, and I'm now fairly sure it's a bug in Freeloader...

When CmpInitializeSystemHive finishes, only the first sector is marked as dirty, rather than all the cells for which the bootloader has removed the volatile data. This means it ends up discarding dirty registry without it having been flushed, and later on HvpGetCellMapped ends up reading unsanitized data from the disk, and crashing when it tries to read an invalid pointer.

@SergeGautherie
@Extravert-ir
It looks like a serious problem.

from btrfs.

archeYR avatar archeYR commented on August 30, 2024

Very nice! It truly is great to see FreeLDR being capable of booting Vista+... And Vista being booted from Btrfs as well. By the way, if you're not aware already, ReactOS also has an (incomplete) UEFI bootloader, it might be interesting when it comes to UEFI booting Windows from Btrfs.

from btrfs.

MegaZeroX10 avatar MegaZeroX10 commented on August 30, 2024

If anybody's interested, I've got this working with Vista now as well. I'll be submitting some patches to Freeloader shortly.

It's my understanding that Vista and Windows 7 aren't all that dissimilar internally, so hopefully getting this working with modern versions of Windows isn't that far away...

vista

Is that a 32-bit or 64-bit version of Windows Vista?

from btrfs.

maharmstone avatar maharmstone commented on August 30, 2024

from btrfs.

MegaZeroX10 avatar MegaZeroX10 commented on August 30, 2024

That would explain why I couldn't boot into it. I was trying to boot a 64-bit version of Vista (which Freeldr doesn't support yet). By the way, can you please provide a compiled driver that works in that architecture of Vista? I got one to compile but it wouldn't load (it gave me a 31 error code).

from btrfs.

MegaZeroX10 avatar MegaZeroX10 commented on August 30, 2024

I was able to get Windows Vista x86 to load a driver compiled from the latest source. When I try to boot it via Freeldr off of a BTRFS drive, it gives me a STOP code of 0x000000A5. I am running Windows Vista x86 via a VirtualBox VM.

EDIT: Here's some debug output that I got by using Windbg to show what was being outputted via Vista's debug mode:

windbg output of ACPI crash - Vista via Freeldr on BTRFS drive.txt

from btrfs.

MegaZeroX10 avatar MegaZeroX10 commented on August 30, 2024

Is that with no changes to the registry? If so, I wonder why booting Windows Vista via Freeldr and BTRFS doesn't work on VMWare/VirtualBox but works on QEMU.

from btrfs.

maharmstone avatar maharmstone commented on August 30, 2024

I had to change the start type of tcpip, as you mentioned in the other thread - that's another issue I need to look into.

from btrfs.

MegaZeroX10 avatar MegaZeroX10 commented on August 30, 2024

Now I am getting a different crash when I try running Windows Vista via FreeLDR + BTRFS via WMWare Workstation Player 15 with only the start type of TCPIP changed. I am attaching the debug log to see if it can help in fixing the crash.

btrfs-vista-bsod.txt

from btrfs.

MegaZeroX10 avatar MegaZeroX10 commented on August 30, 2024

I have another crash after compiling it via ROSBE instead of Visual Studio 2019. The debug log is attached.

btrfs-vista-bsod-2.txt

from btrfs.

MegaZeroX10 avatar MegaZeroX10 commented on August 30, 2024

I managed to get it to work somewhat by using Fastcopy to preserve the ACLs of the files and directories when copying from a VHD that has a working copy of Vista on a NTFS FS to a VHD that has a BTRFS FS with the Freeldr files and bootsector applied. When I try to boot from the BTRFS VHD, it gets stuck on a blue background (meaning it can't load explorer.exe) until I change the group entry of BTRFS's key in the registry to include Boot and change the start dword from 1 to 0. Then it loads the taskbar and two Notepad windows with a desktop file showing its contents in both of them.

from btrfs.

MegaZeroX10 avatar MegaZeroX10 commented on August 30, 2024

@maharmstone How did you copy the files from the Vista image to the BTRFS image that has freeldr.sys and freeldr.ini on it?

from btrfs.

Skorpion96 avatar Skorpion96 commented on August 30, 2024

Can anyone do a tutorial to do it?

from btrfs.

MegaZeroX10 avatar MegaZeroX10 commented on August 30, 2024

I agree with the wanting of a tutorial on how to get Windows 2003 and Vista (and 7 when the patches are ready to apply) to boot when on a BTRFS drive.

from btrfs.

ale5000-git avatar ale5000-git commented on August 30, 2024

@maharmstone: Good work :)

Does it works on both 32 and 64-bit or only 32-bit?

from btrfs.

ale5000-git avatar ale5000-git commented on August 30, 2024

Also all of this need to be tested, before or later, on macOS (since it can install Windows), and very weird things can be expected from macOS firmware.

from btrfs.

MegaZeroX10 avatar MegaZeroX10 commented on August 30, 2024

@maharmstone Would the EFI bootloader allow the booting of earlier Windows versions that are on a BTRFS partition?

from btrfs.

mirh avatar mirh commented on August 30, 2024

You can't trust the specs, the first PCs are EFI, not UEFI and may not comply completely with the current specs.

To be fair, FAT32 is there supported from the get go.
On the other hand bugs happen. And I guess it has all its sense for microsoft not to trust firmware.

from btrfs.

thejsa avatar thejsa commented on August 30, 2024

@maharmstone Would the EFI bootloader allow the booting of earlier Windows versions that are on a BTRFS partition?

I expect older versions of Windows (pre-Vista) would require a CSM to function

from btrfs.

mirh avatar mirh commented on August 30, 2024

Actually, everything up to Windows 7 requires CSM (well, at least without hacks)
Contrarily to what most people think the compatibility support module doesn't automatically exclude UEFI.

A nice feature I'd like to see is instead, a bios bootloader that didn't require external disks to boot from GPT (but I digress) EDIT: cool

from btrfs.

thejsa avatar thejsa commented on August 30, 2024

Actually, everything up to Windows 7 requires CSM (well, at least without hacks)
Contrarily to what most people think the compatibility support module doesn't automatically exclude UEFI.

A nice feature I'd like to see is instead, is a bios bootloader that didn't require external disks to boot from GPT (but I digress)

Ah, I wasn't aware of that - thanks for some fascinating reads, too :)

from btrfs.

ale5000-git avatar ale5000-git commented on August 30, 2024

@mirh: If I'm not wrong 32-bit Windows 7 support only legacy mode but 64-bit Windows 7 support both legacy/UEFI mode.

from btrfs.

ElpizoZ avatar ElpizoZ commented on August 30, 2024

Booting via FreeLDR is easier in my opinion. All a user needs to do is get it it installed on a BTRFS partition somehow and then copy over the Windows installation.

from btrfs.

mimi89999 avatar mimi89999 commented on August 30, 2024

Did anybody try to create a Btrfs partition from GNU/Linux, wimapply the image from the install disc, install the bootloader and try to boot that?

Also, I think that Quibble is very nice, but computers with full and correct UEFI support appeared only several years ago and there are still many BIOS only machines with good specs running Windows 10. It would also be very nice to use Btrfs on the system partition on those machines.

from btrfs.

mirh avatar mirh commented on August 30, 2024

As you know, there is a completely different bootloader for BIOS systems
maharmstone/quibble#17
reactos/reactos#1905

from btrfs.

yegender124001 avatar yegender124001 commented on August 30, 2024

Hey, I want to boot windows from Btrfs subvolumes. I am tring to boot from quibble efi. But got error EFI_NOT_FOUND. I tried every config which I can think about:
`[FREELOADER]
TimeOut=10

[Operating Systems]
Windows_7="Windows 7"
Windows_8="Windows 8.1"
Windows_10="Windows 10"
Windows_11="Windows 11"
Windows_7_PATH="Windows 7"
Windows_8_PATH="Windows 8.1"
Windows_10_PATH="Windows 10"
Windows_11_PATH="Windows 11"
Windows_7_PATH2="Windows 7"
Windows_8_PATH2="Windows 8.1"
Windows_10_PATH2="Windows 10"
Windows_11_PATH2="Windows 11"

[Windows_7]
SystemPath=btrfs(756dadf8-2d04-4f43-bbc3-eb38a2fffb13)\Windows
Options=/SUBVOL=win7

[Windows_8]
SystemPath=btrfs(756dadf8-2d04-4f43-bbc3-eb38a2fffb13)\Windows
Options=/SUBVOL=win8

[Windows_10]
SystemPath=btrfs(756dadf8-2d04-4f43-bbc3-eb38a2fffb13)\Windows
Options=/SUBVOL=win10

[Windows_11]
SystemPath=btrfs(756dadf8-2d04-4f43-bbc3-eb38a2fffb13)\Windows
Options=/SUBVOL=win11

[Windows_7_PATH]
SystemPath=btrfs(756dadf8-2d04-4f43-bbc3-eb38a2fffb13)\win7\Windows
Options=/SUBVOL=win7

[Windows_8_PATH]
SystemPath=btrfs(756dadf8-2d04-4f43-bbc3-eb38a2fffb13)\win8\Windows
Options=/SUBVOL=win8

[Windows_10_PATH]
SystemPath=btrfs(756dadf8-2d04-4f43-bbc3-eb38a2fffb13)\win10\Windows
Options=/SUBVOL=win10

[Windows_11_PATH]
SystemPath=btrfs(756dadf8-2d04-4f43-bbc3-eb38a2fffb13)\win11\Windows
Options=/SUBVOL=win11

[Windows_7_PATH2]
SystemPath=btrfs(756dadf8-2d04-4f43-bbc3-eb38a2fffb13)\win7\Windows

[Windows_8_PATH2]
SystemPath=btrfs(756dadf8-2d04-4f43-bbc3-eb38a2fffb13)\win8\Windows

[Windows_10_PATH2]
SystemPath=btrfs(756dadf8-2d04-4f43-bbc3-eb38a2fffb13)\win10\Windows

[Windows_11_PATH2]
SystemPath=btrfs(756dadf8-2d04-4f43-bbc3-eb38a2fffb13)\win11\Windows`

Please tell me How I can approach booting from btrfs subvolume.

from btrfs.

maharmstone avatar maharmstone commented on August 30, 2024

Closing old issues

from btrfs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.