raspiduino / waq

Run Windows 10 for ARM64 on QEMU
MIT License
77 stars 8 forks source link

Windows 10 ARM iso hung at the boot screen #2

Closed nguyenthienminh closed 2 years ago

nguyenthienminh commented 2 years ago

Yeah, the installer got hung at the boot logo for a long time. I left it for hours and still nothing. Any ideas? image

raspiduino commented 2 years ago

Hello and welcome to the repo!

Thank you!

nguyenthienminh commented 2 years ago

Update: I happened to use the newer version of 10 ARM (version 2004 and later) which doesn't work. I had to use version 1909 to make it work, but it still BSODs when booting the installer with a ACPI_BIOS_ERROR blue screen: 2022-01-05 14 00 28 I looked in the BIOS and the RAM amount reported is 0MB: 2022-01-05 14 00 46 Also, more info:

raspiduino commented 2 years ago

Well, I also tried that firmware (some years ago) but if you feel is just old for now, you can get the new prebuilt UEFI firmware online. You can get one from here. Remember to choose AARCH64 version for QEMU.

Also, there is a bug in qemu virt machine (this have been fixed in 5.x). You said you use the QEMU from 2018, so it's equal to version 3.x. In that case, virt-2.12 seems to work for Windows ARM. If it still results in error, try disabling highmem and enable EL2 by using -machine virt-2.12,highmem=off,virtualization=on and see if it works. (I wonder why you choose this QEMU version)

I have read somewhere (didn't remember to save the link, sorry) that Windows 20H1 arm64 and later doesn't work on QEMU without KVM (virtualization, not emulation). So if you want some recent Windows arm64 on QEMU, you should use KVM (you can try on some hardware like RPi and other SBCs)

Also, you should change the display from VGA to ramfb, as VGA is usually for x86 emulation. -device VGA to -device ramfb.

Again, try this:

qemu-system-aarch64.exe ^
-M virt-2.12,highmem=off,virtualization=on^
-cpu cortex-a57 ^
-smp 3 ^
-m 3072M ^
-pflash QEMU_EFI.img ^
-pflash QEMU_VARS.img ^
-device ramfb^
-device nec-usb-xhci ^
-device usb-kbd ^
-device usb-mouse ^
-device usb-storage,drive=install ^
-drive if=none,id=install,format=raw,media=cdrom,file=.\WindowsARM.iso ^
-device usb-storage,drive=drivers ^
-drive if=none,id=drivers,readonly=on,file=.\drivers.vhdx ^
-device virtio-blk,drive=system ^
-drive if=none,id=system,format=raw,file=.\system.vhdx

Try this and see if it works! Thank you for taking a look at this repo and feel free to ask about this.

Edit: If you find it too hard for installing using the installer, you can also create a VHD, mount it on Windows, then use dism to apply the wim image to it (extracted from the iso) and then put efi files on it, and it works normally just like using the installer.

nguyenthienminh commented 2 years ago

The BIOS file kind of got really corrupted and such caused this error when executed the cmdline: image If I use the old BIOS, the cmdline will (once executed) got this error: image And yes, if the video card's emulation files are not found, then the machine won't start again: image But interestingly, the serial display actually works and showed the bios. But then when I chose to boot from DVD, it'll display a prompt to press a key to boot into DVD, then it'll stop at a blinking cursor. So I changed the display type too back to VGA, and this time, it boots fine. Weird.

raspiduino commented 2 years ago

No it is not corrupted, it just not fit the QEMU's flash. The QEMU's flash is 64MB in size and you should have the firmware also in 64 MB.

From this, on Linux you can use dd if=/dev/zero bs=1M count=64 of=QEMU_EFI.img and then dd if=QEMU_EFI.fd bs=1M of=flash0.img conv=notrunc.

On Windows you can use fsutil file createnew QEMU_EFI.img 67108864 to create a 64MB file and then use some hex editor you can copy the content of QEMU_EFI.fd to the beginning of the new file. QEMU will happily accept it.

EDIT: Windows does require a graphic display so even it output to serial, it can't show you the installer through that. EDIT #2: QEMU can work without vgabios-ramfb.bin but it requires driver inside the UEFI firmware, so i guess the old firmware doesn't support ramfb.

nguyenthienminh commented 2 years ago

Oh well, it still works, so yeah. It's currently at the installer, which is going to take not a long time (maybe). I sped it up using GVM (KVM for Windows) too, so yeah, it's going to be a little bit faster.

raspiduino commented 2 years ago

Oh man, which platform are you running on? Is your host platform x86 or ARM?

If you are using an x86(_64) machine, you cannot use KVM for running an ARM64 VM! KVM requires the guest to use the same instruction set as the host processor.

nguyenthienminh commented 2 years ago

Woopsie. Let me uninstall GVM.

raspiduino commented 2 years ago

Excuse me, can you provide the link to GVM? I have googled it but couldn't find any information. Thanks!

nguyenthienminh commented 2 years ago

Here's the link: http://github.com/google/Android-emulator-hypervisor-driver-for-amd-processors

raspiduino commented 2 years ago

Thanks! Is your VM ok now?

nguyenthienminh commented 2 years ago

Well, it booted the installer successfully, but it didn't detect the hard drive at all. Even after loading the driver, it still only appear a tiny 60MB volume on the "Choose a partition to install Windows" screen.

raspiduino commented 2 years ago

The line -drive if=none,id=system,format=raw,file=.\system.vhdx Try changing it to format=vhdx and see if something better

nguyenthienminh commented 2 years ago

That fixed it. Thanks! Now just to see how much time it's going to install... (already 10 mins so far)

raspiduino commented 2 years ago

Good to see it works! If you have any other questions, feel free to put a comment here. Thanks!

nguyenthienminh commented 2 years ago

Oh. So now it's really stuck at the "Installing updates" screen for 30 mins already: image

nguyenthienminh commented 2 years ago

Oh nevermind, it's unhung anyways

raspiduino commented 2 years ago

You should be patient. Emulation is always slower than you expected.

If you want to know is things in process (eg if is hang or not), you can press Shift+F10 to open cmd and then open task manager from it.

nguyenthienminh commented 2 years ago

Yeah, I opened the taskmgr like that, and.... the CPU got capped at 100%, that's why it's so slow

nguyenthienminh commented 2 years ago

oh, and it refused to boot from the hard drive. It only wants to boot from the DVD.

raspiduino commented 2 years ago

Ok you should remove the cd from qemu. Or you can go to firmware setting and choose to boot from hard drive

nguyenthienminh commented 2 years ago

Yep, I go into the firmware settings, chose the hard drive and it refused to boot. Just exited out to the BIOS screen. When I removed the DVD, it wants to network boot.

raspiduino commented 2 years ago

Is the installer show some errors or it just ask you to reboot?

nguyenthienminh commented 2 years ago

Oh nevermind, by a little probing found out the device name. The BIOS menu is just so messy...

raspiduino commented 2 years ago

Try all of the options and you will find the one correct :)

nguyenthienminh commented 2 years ago

I saved the statistics into a .txt file, once the install's done i'm going to upload the statistics up here

nguyenthienminh commented 2 years ago

Can I let my computer sleep when the VMs doing this? I have to go to another place so yeah. image

raspiduino commented 2 years ago

You have to keep your computer on, of course. Or you can pause the VM and when you come back you can unpause it.

nguyenthienminh commented 2 years ago

oh, I already let it slept for... a while, and it kind of pauses the vm, but starting it up'll basically unpause it.

nguyenthienminh commented 2 years ago

Huh, now it got stuck on the "Just a moment..." screen for a whole 2 hours (not included the time I let the computer hibernate and I let the VM pause, which is roughly 14 hours). Sometimes the VGA output got black, but moving the cursor kind of un-blacks it. image

raspiduino commented 2 years ago

Well, black is normal, it just show black when you leave it for a long time, it will turn off the screen.

Keep the installer for some more time, and if the loop is endless, I will show you the way to bypass OOBE. (Sometimes QEMU is just to slow)

nguyenthienminh commented 2 years ago

Yeah, it's 2 hours. I know how to skip OOBE mind you, so should I reboot the VM?

raspiduino commented 2 years ago

If you reboot the VM, it will show the error "please start the installation process again" or it will result in the endless loop again

nguyenthienminh commented 2 years ago

I knew that, I'm skipped OOBE using the registry. Now Windows (really) didn't like that and started Automatic Repair, but I can easily skip that.

raspiduino commented 2 years ago

After get to the desktop, if you find the VM to slowly, you can try some optimize script on github for Windows ARM. Just search on google :)

nguyenthienminh commented 2 years ago

Automatic Repair just crashed the entire VM. Now it's time to disable WinRE.

nguyenthienminh commented 2 years ago

Well, after all that (I even skipped the OOBE), it still got stuck at the "Just a moment..." screen.

nguyenthienminh commented 2 years ago

oh. now it's this. image

raspiduino commented 2 years ago

Change -device virtio-blk,drive=system to -device usb-storage,drive=system

nguyenthienminh commented 2 years ago

That certainly fixed the problem. However, I had to change the boot order. I also tweaked the res a little bit from 800x600 to 1024x768 in the BIOS so it looked more great in there.

nguyenthienminh commented 2 years ago

And Windows kept booting and hanging at the spinning animation

raspiduino commented 2 years ago

Spinning? The boot screen with Windows logo?

nguyenthienminh commented 2 years ago

Yeah. It is hanging there really, but the spinner is still spinning. It's already half an hour.

raspiduino commented 2 years ago

Have you boot to the desktop yet? (Since you skipped OOBE?

nguyenthienminh commented 2 years ago

Nope, I had to do a full reinstall (using dism and bcdboot), because the normal way got stuck at the "Just a moment..." waiting screen.

nguyenthienminh commented 2 years ago

Oh anyways, now it finally booted. QEMU is just so slow...

raspiduino commented 2 years ago

Be patient! :)

nguyenthienminh commented 2 years ago

It's so slow!!!!!!!!!! (I reached the desktop but Explorer hasn't even loaded finished)

raspiduino commented 2 years ago

Buy an ARM-based SBC and run KVM on it (I currently do that) and it is much better

nguyenthienminh commented 2 years ago

Explorer is literally crashing constantly because of the high CPU load.