procount / pinn

An enhanced Operating System installer for the Raspberry Pi
1.11k stars 123 forks source link

Windows 10 on ARM unable to boot in PINN #481

Open MysticWhiteDragon opened 3 years ago

MysticWhiteDragon commented 3 years ago

I tried to make a multiboot image on an SSD using (Raspberry Pi OS, Konstakang Android, and Windows 10 on ARM). I have successfully managed to boot Raspberry Pi OS and android without any issues. However, I can only get into the UEFI Boot Partition for Windows.

procount commented 3 years ago

Microsoft haven't supported Windows IoT for years.

MysticWhiteDragon commented 3 years ago

I'm not referring to Windows IOT, but Windows on ARM. https://www.worproject.ml/

procount commented 3 years ago

Has someone produced a noobs/PINN image for this installation then?

procount commented 3 years ago

A quick read of that site suggests WoR requires GPT, but PINN only supports MBR (not GPT), so it would not be able to manage the installation. You might manage to fork-and-spoon it in manually with some sort of hybrid GPT/MBR partition format, but I've no idea how you would do that.

Itai-Nelken commented 3 years ago

WoR won't work with multiboot (mbr or gpt) because it uses a uefi or something. I'm not sure how to explain why it doesn't work (I'm no Windows expert, I prefer Linux), but I can say 100% that it doesn't work.

Itai-Nelken commented 3 years ago

A quick read of that site suggests WoR requires GPT, but PINN only supports MBR (not GPT),

actually it does support MBR, and its recommended not to use GPT with it because its unstable.

MysticWhiteDragon commented 3 years ago

Has someone produced a noobs/PINN image for this installation then?

Not that I'm aware of. I used one of the OS images and just modified the second drive to be NTFS instead of ext4. It managed to successfully copy both the root and system partitions to the drive and boot into the EFI.

I was planning on putting this on an m.2 SATA drive inside of an enclosure for a portable system that I'm making. I might look at trying out MBR on WoR. And I'll also look to see if there is a way to do a GPT/MBR hybrid using gParted or something similar.

procount commented 3 years ago

I hope you appreciate that just copying the partitions will not work. You have moved the partitions from their default location on the drive (typically /dev/mmcblk0p1 and /dev/mmcblk0p2, or /dev/sda1 & /dev/sda2 if on USB) to another partition. PINN knows where to find the first boot partition (or UEFI), but that partition needs to be able to find the root partition (or however WoR is partitioned - I have no idea). On Linux you typically have to fix up cmdline.txt and /etc/fstab to tell it where the new locations of its partitions are. This is the purpose of the partition_setup.sh script file for each OS. Android is a lot more complex. Most 64-bit OSes seem to require UBoot , so that the subsequent boot loaders can be more standardised, but UBoot only works on the first partition, so I have to strip it out. WoR - I have no idea, especially as it requires UEFI. @Itai-Nelken suggests it is not possible. If it is possible, it will need more than just copying the partitions across, I'm afraid. He also suggest MBR is supported, so stick with that if you can.

lurch commented 3 years ago

In summary: if you want to use "Windows 10 on ARM" with PINN, you'll have to ask the "Windows 10 on ARM" developers to specifically add support for PINN to their OS :wink: (and with no disrespect to PINN, I suspect they have "more important" features to work on than supporting installation with PINN?)

mop999x commented 3 years ago

i wonder if its possible to make a partition on win 10 and change the boot order from UEFI and install maybe a iso/img backup of pinn and other OS on that partition if possible it could kinda have dule boot at least that's what i was thinking about since i tried to make a dule boot tablet with win10/linux os's for RPI4 and started hitting limitations. Also based on the chat i had on with one of the people mods or devs not sure who developed WOR they did mention UEFI and potential instability

lurch commented 3 years ago

install maybe a iso/img backup of pinn and other OS on that partition if possible

Not gonna work, easier (and cheaper in the long-run) to just use separate SD cards.

it could kinda have dule boot at least that's what i was thinking about

For anyone else who thinks "this should be easy", I suggest reading https://github.com/raspberrypi/noobs/wiki/Standalone-partitioning-explained and https://github.com/raspberrypi/noobs/wiki/NOOBS-partitioning-explained which should help you understand @procount 's comment.

Since SD cards (that a Raspberry Pi boots from) have so much less capacity than Hard Disk drives (that PCs boot from), "dual booting" is much less common on a Raspberry Pi than it is on a PC. Combined with the fact that it's much easier to swap SD cards than it is to swap HD drives! :laughing: So developers of Raspberry Pi OSes tend to assume that they're the only OS installed onto a card, and support for NOOBS or PINN seems to be somewhat of a rarity. Whereas on a normal PC "dual boot" support in an OS is much more common.

MysticWhiteDragon commented 3 years ago

I was able to make an entry for PINN to boot the UEFI partition. I can't get it to boot the Windows partition from the PINN installation drive. But if I put use another USB drive, the UEFI partition will boot and detect the UEFI partition on the second USB drive and boot into WIndows fine. I would like for it to read the partition from the PINN drive, but I guess at least it does work this way. I have an entry in PINN and m able to boot.

I'll make an entry on github for my method sometime soon.

lurch commented 3 years ago

I've never even looked at Windows on ARM (and have no plans for doing so), but just replying to:

Do I need to change partition.json to indicate it's a raw img?

Yes, you can specify a 'raw' partition type in partitions.json (which I believe is what e.g. RiscOS does, but note that this is just a raw partition, whereas an .img file is typically a raw disk image, so you'll need to extract the partitions from the disk-image out into separate partition-images, if you want to write them with PINN. It's been a long time since I looked at all this stuff, but IIRC kpartx was useful for doing this kind of thing?

lurch commented 3 years ago

I had to google what ESP was and I found https://en.wikipedia.org/wiki/EFI_system_partition Remember that PINN doesn't support GPT, so the bit that'll be relevant for you is "its ID in the master boot record (MBR) partition-table scheme is 0xEF". I've got no idea what the "ESP flag" you mention is, but if it's this partition-ID, then note that this is set in the MBR (e.g. by parted) rather than in the partition-data itself. And before you ask, no I don't know how you'd do that in PINN, that'll be a question for @procount :wink:

procount commented 3 years ago

I think there is a partition_type entry you can add to partitions.json. see my wiki.

procount commented 3 years ago

They were original NOOBS options. I think the partition number was for WindowsIoT, and the offset was either for the same, or most likely RiscOS. Partitions 3&4 are already outside the extended partition, but locating one at the end of the disk would require some thought (to check there are no implications)

It could be that I forgot to add that option. Thanks for pointing it out. EDIT: Fixed now.

MysticWhiteDragon commented 3 years ago

Using a second USB drive, I was able to boot Windows 10 on ARM. My setup is linked here. Just copy the Windows10 folder to the os folder of PINN and copy the WIndows 10 on ARM "boot" partition to the partition that the script created on the PINN drive.

procount commented 3 years ago

It sounds like it is more of a firmware boot feature rather than PINN. I think I have some researching to do......

lurch commented 3 years ago

i didnt realize parted could be used non-interactively until recently. ill learn how to do it in partition_setup.sh if it cant be done via PINN easily.

I'm not quite following what you're trying to do, but note that (despite the name) partition_setup.sh is intended for modifying the files on the filesystems for the respective OS, to tell the OS where its boot and root partitions are. It's not really intended for creating or modifying the raw partitions themselves.

lurch commented 3 years ago

I know very little about EFI, but I think in a typical setup there'd only be a single ESP; and given that the main usage of EFI is with GPT-partitioned disks (which don't have extended / logical partitions), it wouldn't surprise me if the EFI System Partition on an MBR-partitioned disk "works best" when it's one of the 4 primary partitions. (and I guess it's also probably a rarity to not have the ESP as the first partition of the disk? :wink: ) @procount Didn't Windows IOT have something to force one of it's partitions to be a primary partition, or am I misremembering and/or getting it confused with something else?

leave free space in the extended partition

Could you use a ProjectSpace for that?

procount commented 3 years ago

Ae3NerdGod:- make one that sets the partition outside of the extended partition, and/or an option to put it at the end of the drive?

You can already assign 2 out of 3 of the primary partitions (2,3, or 4) (PINN will move the extended partition accordingly between 2 and 4, I believe). But to create it at the end of the drive would need an additional option.

Ae3NerdGod:- ( only one device that pinn works on officially supports gpt)

You mean the Pi4?

Lurch:- Didn't Windows IOT have something to force one of it's partitions to be a primary partition, or am I misremembering and/or getting it confused with something else?

Yes, Windows IoT required partitions 2 and 3, I believe.

Ae3NerdGod:- pinn works around this by moving everything in the SETTINGS partition into ram and replacing it afterwards i believe, and doing most things from a ramdisk

Not quite. When PINN does an initial format, it removes every partition (extended, logical and primary) except partition 1. Depending on its size, this partition is then either resized to a minimal size, OR everything on it is copied to ramdisk and it is recreated from scratch before copying everything back. So this is not related to the settings partition, nor modifying the extended partition.

Ae3NerdGod:- maybe it'd be easier to make another recovery.cmdline option like it currently has one for reserving empty space in the RECOVERY partition but instead reserve unpartitioned space in the extended partition? maybe installreserve=(+)XXX

Possible. Is this in addition to the empty space/partition requested to be outside the extended partition space?

Ae3NerdGod:- the version of parted included seems to be missing the esp flag. any chance it could be updated?

Doubtful, as I think it will break a lot of PINN's functionality. Later versions of parted miss out some other crucial features, AFAIK.

procount commented 3 years ago

It is Windows IoT that REQUIRES it, but it informs PINN to do it via partitions.json.

Adding a ProjectSpace is not sufficient to reserve space in the extended partition? I guess this is a location issue and need to be empoty-space? So that's the only thing you need at the moment?

lurch commented 3 years ago

Yeah IIRC some of the later versions of parted remove various partition-resizing functions (although as mentioned before, it's a long time since I've looked at all of this!)

rusagent commented 3 years ago

yes, although I found a workaround for now, its not very clean and involves making a partition just to delete it, unmounting everything and deleting, then remounting. Using partition setup.sh

Could you write out detailed how you did that please? I really would like to have win10 alongside of all the other unix systems on my ssd^^

Niehztog commented 4 months ago

As with the new Raspberry Pi 5 and its NVMe capabilities, having a multi boot setup including windows will become a priority for quite some people, I'd like to point out that "Windows 10/11 on ARM" definetely works fine with a MBR partition scheme (the UEFI partition needs to have the "active" flag though). As stated in earlier comments there have been attempts to add Windows on ARM to PINN, for example here: https://github.com/Marcinoo97/pinn-uefi I havn't tried it yet, but I would appreciate if someone with more dedication and knowledge than me would provide step by step instructions on how to set it up.