Windows on ARM devices

From postmarketOS Wiki

(Not to be confused with Windows Mobile devices)

Windows on ARM (Often abbreviated WoA) are a line of devices that were shipped with Windows as the operating system. Sometimes those devices are referred to as "Windows on Snapdragon" (WoS) as the majority is based on Qualcomm chipsets.

This page provides a general overview and common information for those devices in postmarketOS.

Installation

Installation on USB

  1. Disable EFI secure boot.
  2. Follow Pmbootstrap page, do a SD card installation to USB.

Installation on internal storage

Icon WARNING: If you have a Windows recovery partition it is recommended to make a backup of it. Some vendors don't provide a recovery image. There is only one way to return to Windows on these devices: using dism utility with install.wim from recovery partition, so consider making a backup of this file.

Once you have a pmOS installation booted from USB:

Devices with UFS or NVME

  1. Install pmbootstrap (apk add pmbootstrap).
  2. Perform pmbootstrap install --disk /dev/sdX.
Icon WARNING: X here represents a letter of block device, e.g. /dev/sda. Make sure to select correct, because selecting wrong one can lead to bricking your device. You can find the correct one with lsblk command. It should be the biggest one, usually the first.

Devices with EMMC

Compared to UFS devices where the OS has a dedicated LUN, or NVME devices, where the bootloader is stored on a separate chip, EMMC devices share bootloader setup similar to phones, where a set of partitions is dedicated for the UEFI and other things critical to boot.

Icon WARNING: Altering contents or removing ANY partition apart from the EFI ESP, "Windows" ("C:") or "Windows recovery" may result in an unrecoverable brick!

One of the possible ways to install pmOS on such device would be to boot into pmOS usb install and overwrite "Windows" partition with root image, generated with pmbootstrap install --split, and overwrite the efi esp with the boot image.

Devices

Device Codename Chipset CPU GPU Memory Storage Display Supported in pmOS
Acer Aspire 1 acer-aspire1 Qualcomm Snapdragon 7c 2x Kryo 468 Gold + 6x Kryo 468 Silver Adreno 618 4 GB 64 GB 1920x1080 IPS Yes
Huawei MateBook E 2019 huawei-planck Qualcomm Snapdragon 850 (SDM850) 4 × Qualcomm Kryo 3xx Gold, 4 × Qualcomm Kryo 3xx Silver Adreno 630 8GB 256GB/512GB 2160x1440 Yes
Lenovo Flex 5G lenovo-flex-5ga Qualcomm Snapdragon 8cx 4x Kryo 495 Gold 2.84 GHz & 4x Kryo 495 Silver 1.8 GHz Adreno 680 8 GB 256/512 GB 1920x1080 IPS Yes
Lenovo ThinkPad X13s lenovo-21bx Qualcomm Snapdragon 8cx Gen 3 (SC8280XP) 4x 3.0GHz (Cortex-X1), 4x 2.4GHz (Cortex-A78) Adreno 690 8GB, 16GB, 32GB 256GB, 512GB, 1TB 1920x1200 IPS Yes
Lenovo Yoga 5G lenovo-81xe Qualcomm Snapdragon 8cx 4x Kryo 495 Gold 2.84 GHz & 4x Kryo 495 Silver 1.8 GHz Adreno 680 8 GB 256/512 GB 1920x1080 IPS Yes
Lenovo Yoga 5G lenovo-82ak Qualcomm Snapdragon 8cx 4x Kryo 495 Gold 2.84 GHz & 4x Kryo 495 Silver 1.8 GHz Adreno 680 8 GB 256/512 GB 1920x1080 IPS Yes
Lenovo Yoga 5G lenovo-yoga-5g Qualcomm Snapdragon 8cx 4x Kryo 495 Gold 2.84 GHz & 4x Kryo 495 Silver 1.8 GHz Adreno 680 8 GB 256/512 GB 1920x1080 IPS Yes
Lenovo Yoga C630 lenovo-yoga-c630 Qualcomm Snapdragon 850 (SDM850) Octa-core (4x 2.9 GHz Kryo 385 Gold & 4x 1.7 GHz Kryo 385 Silver) Adreno 630 8GB 128GB 1920x1080 IPS Touch + Stylus Yes
Microsoft Windows Devkit 2023 volterra Qualcomm Snapdragon 8cx Gen 3 (SC8280XP) 4x 3.0GHz (Cortex-X1), 4x 2.4GHz (Cortex-A78) Adreno 690 32GB LPDDR4x 512GB M.2 2230 NVME SSD Main: mDP (HBR2), Secondary and Tertiary: 2xUSB-C (HBR3) No
Samsung Galaxy Book S samsung-w767 Qualcomm Snapdragon 8cx 4x Kryo 495 Gold 2.84 GHz & 4x Kryo 495 Silver 1.8 GHz Adreno 680 8 GB 256 GB 1920x1080 IPS Yes

Common issues and quirks

  • It's generally unfeasible to use original vendor ACPI code shipped with the existing Qualcomm devices to boot Linux since significant part of the hardware information is baked into the windows drivers code, instead of the ACPI. Thus, the usual way of using Linux on these devices assumes booting with the Device Tree made for the device.

Virtualization support

Due to a quirk[1] in firmware on Windows-on-Snapdragon devices it's impossible to use virtualization by default as the system boots in EL1. Windows uses special "Secure launch" mechanism to elevate to EL2 as part of the bootloader flow and gain virtualization support for hyper-v.

slbounce is an alternative "Secure launch" implementation that can allow one to boot Linux (or other OS) in EL2 and unlock virtualization. Unfortunately linux can't yet use all of the device features when running EL2 so, for example, things that rely on remoteprocs will not work.

Prerequisites

  • Make sure Windows reports virtualization as enabled;
  • Get tcblaunch.exe from the windows install on your device. You can find it in C:\Windows\system32\tcblaunch.exe;
  • Be able to boot into EFI Shell.

Setup

Clone and build slbounce.

$ git clone --recursive https://github.com/TravMurav/slbounce.git
$ git checkout switch-if-overlay
$ cd slbounce
$ make -j$(nproc)
$ make -j$(nproc) dtbs

Copy out/*.efi and your tcblaunch.exe to the root of your ESP (or a usb stick). Make sure tcblaunch.exe is in the root of the same disk as slbounce.efi and sltest.efi.

Check that your device is supported by slbounce: Reboot into EFI Shell and run sltest.efi:

fs0:\> sltest.efi tcblaunch.exe

Your device should show a green line on the top of the screen. Reboot it by holding the power button.

Generate a special EL2 dtb by applying overlays from slbounce to your device's dtb:

$ cd slbounce
# fdtoverlay -i /boot/sc7180-acer-aspire1.dtb -o /boot/sc7180-acer-aspire1-el2.dtb out/dtbo/sc7180-symbols.dtbo out/dtbo/sc7180-el2.dtbo

(Note that the order of overlays is meaningful)

Add a new boot option by copying existing one and changing the name and devicetree file and install slbounce to systemd-boot driver dir:

$ sudo cat /boot/loader/entries/pmos_el2.conf
title	   postmarketOS (EL2)
sort-key   yyy-postmarketOS-el2
linux	   linux.efi
initrd	   initramfs
options    efi=novamap,noruntime deferred_probe_timeout=30 console=tty0
devicetree sc7180-acer-aspire1-el2.dtb

$ sudo cat /boot/loader/loader.conf
default  pmos.conf
timeout  1

$ sudo cp out/slbounce.efi /boot/EFI/systemd/drivers/slbounceaa64.efi

Now you should see two boot options on each boot, where EL2 boot option would allow you to use virtualization (however some other features of the device may be broken).

See also

  • Non-distro-specific IRC room for Linux on ARM laptops: #aarch64-laptops on OFTC. Public archive.

References

  1. Secure-Launch and vendor lock-in overview: https://github.com/TravMurav/Qcom-Secure-Launch/