Skip to content

Commit e9bf8da

Browse files
Merge pull request #2349 from jasonrandrews/review2
Initial version of Windows on Arm VM Learning Path
2 parents 239e504 + ca316c3 commit e9bf8da

File tree

7 files changed

+785
-0
lines changed

7 files changed

+785
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
title: Windows on Arm virtual machine creation using Arm Linux, QEMU, and KVM
3+
4+
draft: true
5+
cascade:
6+
draft: true
7+
8+
minutes_to_complete: 90
9+
10+
who_is_this_for: This is for developers and system administrators who want to automate Windows on Arm virtual machine (VM) creation on Arm Linux systems using QEMU and KVM.
11+
12+
learning_objectives:
13+
- Understand the process of creating Windows on Arm virtual machine using Bash scripts.
14+
- Run scripts for VM creation and management.
15+
- Troubleshoot common VM setup and runtime issues.
16+
- Use Windows on Arm virtual machines for software development and testing.
17+
18+
prerequisites:
19+
- An Arm Linux system with KVM support and a minimum of 8GB RAM and 50GB free disk space.
20+
21+
author: Jason Andrews
22+
23+
### Tags
24+
skilllevels: Introductory
25+
subjects: Migration to Arm
26+
armips:
27+
- Neoverse
28+
- Cortex-A
29+
operatingsystems:
30+
- Linux
31+
- Windows
32+
tools_software_languages:
33+
- QEMU
34+
- KVM
35+
- Bash
36+
- RDP
37+
38+
further_reading:
39+
- resource:
40+
title: Linaro Wiki - Windows on Arm
41+
link: https://wiki.linaro.org/LEG/Engineering/Kernel/WindowsOnArm
42+
type: documentation
43+
- resource:
44+
title: Botspot Virtual Machine (BVM) Project
45+
link: https://github.com/Botspot/bvm
46+
type: website
47+
48+
### FIXED, DO NOT MODIFY
49+
# ================================================================================
50+
weight: 1 # _index.md always has weight of 1 to order correctly
51+
layout: "learningpathall" # All files under learning paths have this same wrapper
52+
learning_path_main_page: "yes" # This should be surfaced when looking for related content. Only set for _index.md of learning path content.
53+
---
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
# ================================================================================
3+
# FIXED, DO NOT MODIFY THIS FILE
4+
# ================================================================================
5+
weight: 21 # Set to always be larger than the content in this path to be at the end of the navigation.
6+
title: "Next Steps" # Always the same, html page title.
7+
layout: "learningpathall" # All files under learning paths have this same wrapper for Hugo processing.
8+
---
600 KB
Loading
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
title: System requirements
3+
weight: 2
4+
5+
### FIXED, DO NOT MODIFY
6+
layout: learningpathall
7+
---
8+
9+
If you are building and testing Windows on Arm software you have a variety of options to run Windows on Arm. You can use local laptops, cloud virtual machines, and CI/CD platforms like GitHub Actions for development tasks.
10+
11+
You can also use a local Arm Linux server to create virtual machines for Windows on Arm software development tasks. This Learning Path explains how to install and use Windows on Arm virtual machines on an Arm Linux system. Two scripts are provided to create and run Windows on Arm virtual machines to make the process easy.
12+
13+
Before creating a Windows on Arm virtual machine, ensure your Arm Linux system meets the hardware and software requirements. This section covers everything you need to prepare to create a Windows on Arm virtual machine using QEMU and KVM.
14+
15+
## Hardware requirements
16+
17+
You need an Arm Linux system with enough performance, memory, and storage to run a Windows on Arm virtual machine.
18+
19+
The provided scripts have been tested on a [Thelio Astra](https://system76.com/desktops/thelio-astra-a1.1-n1/configure?srsltid=AfmBOoplXbwXifyxppxFe_oyahYMJHUT0bp2BnIBSH5ADjqgZxB7wW75) running Ubuntu 24.04.
20+
21+
Thelio Astra is an Arm-based desktop computer designed by System76 for autonomous vehicle development and other general-purpose Arm software development. It uses the Ampere Altra processor, which is based on the Arm Neoverse N1 CPU, and ships with the Ubuntu operating system.
22+
23+
Other Arm Linux systems and other Linux distributions are possible, but have not been tested. General hardware requirements are listed below.
24+
25+
The minimum hardware requirements for the Arm Linux system are:
26+
27+
- 8 cores with hardware virtualization support
28+
- 8 GB RAM
29+
- 50 GB free disk space
30+
31+
The scripts automatically allocate resources as listed below, but the details can be customized for your system.
32+
33+
- CPU: half of available cores (minimum 4 cores)
34+
- Memory: half of available RAM (minimum 4 GB)
35+
- Disk: 40 GB VM disk
36+
37+
## KVM support
38+
39+
Kernel-based Virtual Machine (KVM) support is required for hardware-accelerated virtualization and good VM performance.
40+
41+
KVM is a virtualization infrastructure built into the Linux kernel that allows you to run virtual machines with near-native performance. It leverages Arm's hardware virtualization extensions to provide efficient CPU virtualization, while QEMU handles device emulation and management. Without KVM, virtual machines run much slower using software emulation.
42+
43+
Verify your system supports KVM by running:
44+
45+
```console
46+
sudo apt install cpu-checker -y
47+
sudo kvm-ok
48+
```
49+
50+
If KVM is available, you will see the messages:
51+
52+
```output
53+
INFO: /dev/kvm exists
54+
KVM acceleration can be used
55+
```
56+
57+
This confirms that:
58+
- Your CPU supports hardware virtualization
59+
- The KVM kernel module is loaded
60+
- The `/dev/kvm` device exists
61+
62+
## Required software
63+
64+
The scripts require several software packages.
65+
66+
Install the packages using the Linux package manager.
67+
68+
```console
69+
sudo apt update
70+
sudo apt install qemu-system-arm qemu-utils genisoimage wget curl jq uuid-runtime -y
71+
```
72+
73+
If needed, the [Remmina](https://remmina.org/) remote desktop (RDP) client is automatically installed by the run script so you don't need to install it now, but you can install it using the command below.
74+
75+
```console
76+
sudo apt install remmina remmina-plugin-rdp -y
77+
```
78+
79+
Proceed to the next section to learn about the scripts.
80+
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
---
2+
title: Understanding the virtual machine scripts
3+
4+
weight: 3
5+
6+
layout: "learningpathall"
7+
---
8+
9+
A GitHub project provides two Bash scripts. Understanding their architecture and design will help you use them effectively and enable you to customize the options for your specific needs.
10+
11+
Start by cloning the project repository from GitHub to your Arm Linux system.
12+
13+
```bash
14+
git clone https://github.com/jasonrandrews/win11arm.git
15+
cd win11arm
16+
```
17+
18+
The remainder of this section explains the structure of the scripts, and the next section provides details to run the scripts to create a Windows virtual machine.
19+
20+
## Project overview
21+
22+
The project includes two Bash scripts.
23+
24+
- VM create script: `create-win11-vm.sh` handles all VM creation tasks
25+
- VM run script: `run-win11-vm.sh` manages VM execution and connectivity
26+
27+
All configuration is available using command-line options.
28+
29+
The VM create script also allows you to perform the entire VM creation with a single command or run each individual step to learn and monitor the process.
30+
31+
This modular approach allows you to understand each component while maintaining the simplicity of automated execution.
32+
33+
## Virtual machine creation
34+
35+
The creation script, `create-win11-vm.sh` is responsible for building a complete Windows 11 on Arm VM from scratch. It handles everything from directory setup to Windows installation, with each step clearly defined and independently executable.
36+
37+
The script handles resource detection and allocation, provides unattended Windows installation, and has a flexible command line to change default values.
38+
39+
Virtual machine creation includes the following steps:
40+
41+
- Download the Windows 11 for Arm ISO from Microsoft
42+
- Configure VirtIO drivers for optimal performance
43+
- Set up automated installation with custom credentials
44+
- Create optimized disk images
45+
46+
### Virtual machine creation details
47+
48+
The `create-win11-vm.sh` script implements a four-step process that builds a Windows VM incrementally:
49+
50+
### Step 1: Create VM directory
51+
52+
Step 1 initializes the VM directory structure and configuration. It creates the VM directory, copies initial configuration files, and sets up the basic environment. As a result, the VM directory, configuration files, and connection profiles are created.
53+
54+
### Step 2: Download Windows
55+
56+
Step 2 downloads the Windows 11 ISO and VirtIO drivers. It downloads the Windows 11 Arm ISO from Microsoft, fetches VirtIO drivers, and prepares unattended installation files. The files created during this step include `installer.iso`, `virtio-win.iso`, and the unattended installation directory. This step takes some time as the Windows ISO download is large, but if you already have the file the script will save time and not repeat the download.
57+
58+
### Step 3: Prepare VM disk image
59+
60+
Step 3 creates the VM disk image and finalizes the installation setup. It builds the unattended installation ISO, creates the main VM disk image, and configures all installation media. The files created during this step include `disk.qcow2` and `unattended.iso`.
61+
62+
{{% notice Note %}}
63+
The product key used in the scripts is a generic key provided by Microsoft, which allows installation. This key is for testing purposes only and does not activate Windows. If you plan to continue using Windows beyond installation, you should replace it with a genuine product key.
64+
{{% /notice %}}
65+
66+
### Step 4: First Windows boot
67+
68+
Step 4 executes the Windows installation. It boots the VM with installation media, runs the automated Windows setup, and completes the initial configuration. The result is a fully installed and configured Windows on Arm VM.
69+
70+
Each step builds on the previous one, and you can run them individually for debugging or customization purposes.
71+
72+
## Virtual machine execution
73+
74+
The `run-win11-vm.sh` script runs virtual machines by managing their execution and connectivity.
75+
76+
The script begins by checking if the VM is already active by validating QEMU processes and PID files. If the VM is running, it skips to establishing an RDP connection; otherwise, it proceeds to start the VM.
77+
78+
Next, the script launches the VM in headless mode, optimized for RDP access, by configuring QEMU with a headless display, setting up port forwarding, and starting the VM as a background daemon process.
79+
80+
Once the VM is running, the script waits for the RDP service to become available, configures the Remmina client, and establishes a desktop connection.
81+
82+
This process ensures seamless access to the VM with proper display scaling and input handling.
83+
84+
## Automatic resource detection and allocation
85+
86+
The scripts try to manage resources based on your system.
87+
88+
For CPU allocation, `/proc/cpuinfo` is used to determine the total number of CPU cores and use half of the available cores for the VM. A minimum of 2 cores for creation and 4 cores for runtime are required.
89+
90+
For memory allocation, `/proc/meminfo` is used to determine total system RAM and allocate half of the available memory for the VM. A minimum of 2GB is required and memory usage is based on system capacity, with an option to override using a command line parameter.
91+
92+
For storage, the default VM disk size is 40GB in QCOW2 format. The available disk space is validated before creation.
93+
94+
All settings are customizable using command line arguments.
95+
96+
## Script Integration and Workflow
97+
98+
The create and run scripts share the same configuration files. Separating creation from execution enables you to create a VM once and then use the run script repeatedly.
99+
100+
The next section explains how to create and run a Windows on Arm virtual machine.

0 commit comments

Comments
 (0)