Skip to content

Instantly share code, notes, and snippets.

@darkn3rd
Forked from niw/README.en.md
Created May 10, 2024 05:50
Show Gist options
  • Save darkn3rd/c3a7c19a04c2dbec02284ee1d2ed0be3 to your computer and use it in GitHub Desktop.
Save darkn3rd/c3a7c19a04c2dbec02284ee1d2ed0be3 to your computer and use it in GitHub Desktop.

Revisions

  1. @niw niw revised this gist Oct 2, 2021. 2 changed files with 20 additions and 24 deletions.
    22 changes: 10 additions & 12 deletions README.en.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    Here is easy steps to try Windows 10 on ARM or Ubuntu for ARM64
    on your Apple Silicon Mac. Enjoy!

    > NOTE: that this is current, 8/19/2021 state.
    > NOTE: that this is current, 10/1/2021 state.
    ## Running Windows 10 on ARM

    @@ -25,16 +25,14 @@ on your Apple Silicon Mac. Enjoy!
    brew install ninja pkgconfig glib pixman
    ```
    3. Clone QEMU source code with Hypervisor.framework patches
    that @[_AlexGraf](https://twitter.com/_AlexGraf) made.
    3. Clone the latest QEMU source code
    The latest `master` at 10/1/2021 has Apple Silicon support.
    ```
    git clone --depth 1 --branch implement_apple_silicon_support https://github.com/niw/qemu
    git clone --depth 1 https://git.qemu.org/git/qemu.git
    ```
    See <https://patchwork.kernel.org/project/qemu-devel/list/?series=485309&archive=both>
    for details about the patch.
    4. Build QEMU.
    In `qemu` directory, run following commands.
    @@ -97,9 +95,9 @@ on your Apple Silicon Mac. Enjoy!
    ```
    qemu-system-aarch64 \
    -monitor stdio \
    -M virt,highmem=off \
    -M virt,highmem=off,virtualization=on \
    -accel hvf \
    -cpu cortex-a72 \
    -cpu host \
    -smp 4 \
    -m 4096 \
    -drive file=pflash0.img,format=raw,if=pflash,readonly=on \
    @@ -217,7 +215,7 @@ $ .build/release/holepunch --show-progress /path/to/Windows10.raw
    Follow the same steps for Windows 10 to prepare QEMU,
    then download Ubuntu Server for ARM64 and install it.
    1. Follow previous steps from 1. to 7. to prepare QEMU.
    1. Follow previous steps from 1. to 6. to prepare QEMU.
    2. Create an empty disk image.
    @@ -234,9 +232,9 @@ then download Ubuntu Server for ARM64 and install it.
    ```
    qemu-system-aarch64 \
    -monitor stdio \
    -M virt,highmem=off \
    -M virt,highmem=off,virtualization=on \
    -accel hvf \
    -cpu cortex-a72 \
    -cpu host \
    -smp 4 \
    -m 4096 \
    -drive file=pflash0.img,format=raw,if=pflash,readonly=on \
    22 changes: 10 additions & 12 deletions README.ja.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@

    ARM 版 Windows 10 や Ubuntu を Apple Silicon な Mac で動かす簡単な方法です。

    > メモ: 2021年8月19日現時点での方法で、今後まだ改善されていくと思います。
    > メモ: 2021年10月1日現時点での方法で、今後まだ改善されていくと思います。
    ## ARM 版 Windows 10 を動かす

    @@ -23,16 +23,14 @@ ARM 版 Windows 10 や Ubuntu を Apple Silicon な Mac で動かす簡単な方
    brew install ninja pkgconfig glib pixman
    ```
    3. @[_AlexGraf](https://twitter.com/_AlexGraf)氏がつくった Hypervisor.framework
    のパッチをあててある QEMU のソースを取得
    3. 最新の QEMU のソースを取得
    2021年10月1日現時点での最新の `master` は Apple Silicon の対応がなされています。
    ```
    git clone --depth 1 --branch implement_apple_silicon_support https://github.com/niw/qemu
    git clone --depth 1 https://git.qemu.org/git/qemu.git
    ```
    パッチは <https://patchwork.kernel.org/project/qemu-devel/list/?series=485309&archive=both>
    を参照のこと。
    4. QEMU をビルドする
    `qemu` ディレクトリで以下を実行。
    @@ -94,9 +92,9 @@ ARM 版 Windows 10 や Ubuntu を Apple Silicon な Mac で動かす簡単な方
    ```
    qemu-system-aarch64 \
    -monitor stdio \
    -M virt,highmem=off \
    -M virt,highmem=off,virtualization=on \
    -accel hvf \
    -cpu cortex-a72 \
    -cpu host \
    -smp 4 \
    -m 4096 \
    -drive file=pflash0.img,format=raw,if=pflash,readonly=on \
    @@ -212,7 +210,7 @@ $ .build/release/holepunch --show-progress /path/to/Windows10.raw
    ARM 版 Windows 10 を動かす手順に従って QEMU を準備して、Ubuntu Server for ARM64
    をダウンロードしてインストールします。
    1. 上記の手順 1 から 7 までに従って QEMU を準備する。
    1. 上記の手順 1. から 6. までに従って QEMU を準備する。
    2. 空のディスクイメージを作成する。
    @@ -229,9 +227,9 @@ ARM 版 Windows 10 を動かす手順に従って QEMU を準備して、Ubuntu
    ```
    qemu-system-aarch64 \
    -monitor stdio \
    -M virt,highmem=off \
    -M virt,highmem=off,virtualization=on \
    -accel hvf \
    -cpu cortex-a72 \
    -cpu host \
    -smp 4 \
    -m 4096 \
    -drive file=pflash0.img,format=raw,if=pflash,readonly=on \
  2. @niw niw revised this gist Aug 23, 2021. 2 changed files with 21 additions and 3 deletions.
    11 changes: 10 additions & 1 deletion README.en.md
    Original file line number Diff line number Diff line change
    @@ -35,7 +35,9 @@ on your Apple Silicon Mac. Enjoy!
    See <https://patchwork.kernel.org/project/qemu-devel/list/?series=485309&archive=both>
    for details about the patch.
    4. Build QEMU
    4. Build QEMU.
    In `qemu` directory, run following commands.
    ```
    mkdir build
    @@ -44,6 +46,8 @@ on your Apple Silicon Mac. Enjoy!
    make -j
    ```
    It creates `qemu-img`, `qemu-system-aarch64` etc, which we use later.
    5. Download pre-build EDK II OVMF EFI image for QEMU.
    This EFI image is built from `stable202011` tag with additional resolutions
    @@ -56,6 +60,8 @@ on your Apple Silicon Mac. Enjoy!
    6. Prepare pflash for non-volatile variable store, such as screen resolution.
    Create a working directory and run following command.
    ```
    tar xzvf QEMU_EFI-*.tar.gz
    dd if=/dev/zero of=pflash0.img bs=1m count=64
    @@ -64,6 +70,7 @@ on your Apple Silicon Mac. Enjoy!
    dd if=QEMU_VARS.fd of=pflash1.img conv=notrunc
    ```
    - Please use each path to where you download it.
    - This step is optional, you can use `-bios QEMU_EFI.fd`
    instead of `-drive ...if=pflash` lines in the next step,
    but in that case, any changes in EFI will not be persistent.
    @@ -83,6 +90,8 @@ on your Apple Silicon Mac. Enjoy!
    qemu-img convert -p -O raw Windows10_InsiderPreview_Client_ARM64_en-us_21354.VHDX Windows10.raw
    ```
    - Please use each path to where you download it.
    9. Run Windows 10
    ```
    13 changes: 11 additions & 2 deletions README.ja.md
    Original file line number Diff line number Diff line change
    @@ -35,14 +35,18 @@ ARM 版 Windows 10 や Ubuntu を Apple Silicon な Mac で動かす簡単な方
    4. QEMU をビルドする
    `qemu` ディレクトリで以下を実行。
    ```
    mkdir build
    cd build
    ../configure --target-list=aarch64-softmmu --enable-cocoa
    make -j
    ```
    5. QEMU 用の EDK II OVMF EFI イメージをダウンロードする。
    `qemu-img`, `qemu-system-aarch64` などが作成されますので、これらを使用します。
    5. QEMU 用の EDK II OVMF EFI イメージをダウンロードする
    このイメージは `stable202011` タグに、`QemuRamfb.c` に追加の解像度を足したものです。
    @@ -52,6 +56,8 @@ ARM 版 Windows 10 や Ubuntu を Apple Silicon な Mac で動かす簡単な方
    6. pflash イメージを作って、画面サイズなどを設定する不揮発なストレージを準備する
    作業用のディレクトを作成して、以下を実行。
    ```
    tar xzvf QEMU_EFI-*.tar.gz
    dd if=/dev/zero of=pflash0.img bs=1m count=64
    @@ -60,6 +66,7 @@ ARM 版 Windows 10 や Ubuntu を Apple Silicon な Mac で動かす簡単な方
    dd if=QEMU_VARS.fd of=pflash1.img conv=notrunc
    ```
    - 各パスはダウンロードした場所などに適宜修正してください。
    - このステップは省略可能。その場合は次のステップで `-drive ...,if=pflash,...`
    のかわりに `-bios QEMU_EFI.fd` を指定すること。
    ただし、EFI での変更が保存されなくなります。
    @@ -80,6 +87,8 @@ ARM 版 Windows 10 や Ubuntu を Apple Silicon な Mac で動かす簡単な方
    qemu-img convert -p -O raw Windows10_InsiderPreview_Client_ARM64_en-us_21354.VHDX Windows10.raw
    ```
    - 各パスはダウンロードした場所などに適宜修正してください。
    9. Windows 10 を起動する
    ```
    @@ -244,7 +253,7 @@ ARM 版 Windows 10 を動かす手順に従って QEMU を準備して、Ubuntu
    上記の手順に従って Ubuntu Server for ARM64 を動かします。
    1. EDK II のソースコードを取ってくる
    1. EDK II のソースコードを取ってくる
    ```
    git clone --depth 1 --branch edk2-stable202011 https://github.com/tianocore/edk2.git
  3. @niw niw revised this gist Aug 23, 2021. 2 changed files with 26 additions and 33 deletions.
    30 changes: 13 additions & 17 deletions README.en.md
    Original file line number Diff line number Diff line change
    @@ -56,19 +56,15 @@ on your Apple Silicon Mac. Enjoy!
    6. Prepare pflash for non-volatile variable store, such as screen resolution.
    In the directory where you downloaded `QEMU_EFI-....tar.gz`,
    run following commands.
    ```
    cd ~/Downloads
    tar xzvf QEMU_EFI-*.tar.gz
    dd if=/dev/zero of=pflash0.img bs=1m count=64
    dd if=/dev/zero of=pflash1.img bs=1m count=64
    dd if=QEMU_EFI.fd of=pflash0.img conv=notrunc
    dd if=QEMU_VARS.fd of=pflash1.img conv=notrunc
    ```
    - This step is optional, you can use `-bios ~/Downloads/QEMU_EFI.fd`
    - This step is optional, you can use `-bios QEMU_EFI.fd`
    instead of `-drive ...if=pflash` lines in the next step,
    but in that case, any changes in EFI will not be persistent.
    @@ -84,29 +80,29 @@ on your Apple Silicon Mac. Enjoy!
    See "Compact raw disk image" section below for the details.
    ```
    qemu-img convert -p -O raw ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_21354.VHDX ~/Downloads/Windows10.raw
    qemu-img convert -p -O raw Windows10_InsiderPreview_Client_ARM64_en-us_21354.VHDX Windows10.raw
    ```
    9. Run Windows 10
    ```
    ./qemu-system-aarch64 \
    qemu-system-aarch64 \
    -monitor stdio \
    -M virt,highmem=off \
    -accel hvf \
    -cpu cortex-a72 \
    -smp 4 \
    -m 4096 \
    -drive file=~/Downloads/pflash0.img,format=raw,if=pflash,readonly=on \
    -drive file=~/Downloads/pflash1.img,format=raw,if=pflash \
    -drive file=pflash0.img,format=raw,if=pflash,readonly=on \
    -drive file=pflash1.img,format=raw,if=pflash \
    -device ramfb \
    -device qemu-xhci \
    -device usb-kbd \
    -device usb-tablet \
    -device intel-hda \
    -device hda-duplex \
    -nic user,model=virtio \
    -drive file=~/Downloads/Windows10.raw,format=raw,if=none,id=boot \
    -drive file=Windows10.raw,format=raw,if=none,id=boot \
    -device nvme,drive=boot,serial=boot
    ```
    @@ -137,7 +133,7 @@ you need to install a device driver.
    Add next options to `qemu-system-aarch64`.
    ```
    -drive file=~/Downloads/virtio-win-0.1.190.iso,media=cdrom,if=none,id=drivers \
    -drive file=virtio-win-0.1.190.iso,media=cdrom,if=none,id=drivers \
    -device usb-storage,drive=drivers
    ```
    @@ -217,7 +213,7 @@ then download Ubuntu Server for ARM64 and install it.
    2. Create an empty disk image.
    ```
    ./qemu-img create -f raw ~/Downloads/ubuntu.raw 40G
    qemu-img create -f raw ubuntu.raw 40G
    ```
    3. Download Ubuntu Server for ARM64
    @@ -227,24 +223,24 @@ then download Ubuntu Server for ARM64 and install it.
    4. Install Ubuntu Server for ARM
    ```
    ./qemu-system-aarch64 \
    qemu-system-aarch64 \
    -monitor stdio \
    -M virt,highmem=off \
    -accel hvf \
    -cpu cortex-a72 \
    -smp 4 \
    -m 4096 \
    -drive file=~/Downloads/pflash0.img,format=raw,if=pflash,readonly=on \
    -drive file=~/Downloads/pflash1.img,format=raw,if=pflash \
    -drive file=pflash0.img,format=raw,if=pflash,readonly=on \
    -drive file=pflash1.img,format=raw,if=pflash \
    -device virtio-gpu-pci \
    -display default,show-cursor=on \
    -device qemu-xhci \
    -device usb-kbd \
    -device usb-tablet \
    -device intel-hda \
    -device hda-duplex \
    -drive file=~/Downloads/ubuntu.raw,format=raw,if=virtio,cache=writethrough \
    -cdrom ~/Downloads/ubuntu-20.04.1-live-server-arm64.iso
    -drive file=ubuntu.raw,format=raw,if=virtio,cache=writethrough \
    -cdrom ubuntu-20.04.1-live-server-arm64.iso
    ```
    - Follow instruction to install Ubuntu Server. Once it’s installed, `-cdrom`
    29 changes: 13 additions & 16 deletions README.ja.md
    Original file line number Diff line number Diff line change
    @@ -52,10 +52,7 @@ ARM 版 Windows 10 や Ubuntu を Apple Silicon な Mac で動かす簡単な方
    6. pflash イメージを作って、画面サイズなどを設定する不揮発なストレージを準備する
    `QEMU_EFI-....tar.gz` をダウンロードしたディレクトリで以下を実行。
    ```
    cd ~/Downloads
    tar xzvf QEMU_EFI-*.tar.gz
    dd if=/dev/zero of=pflash0.img bs=1m count=64
    dd if=/dev/zero of=pflash1.img bs=1m count=64
    @@ -64,7 +61,7 @@ ARM 版 Windows 10 や Ubuntu を Apple Silicon な Mac で動かす簡単な方
    ```
    - このステップは省略可能。その場合は次のステップで `-drive ...,if=pflash,...`
    のかわりに `-bios ~/Downloads/QEMU_EFI.fd` を指定すること。
    のかわりに `-bios QEMU_EFI.fd` を指定すること。
    ただし、EFI での変更が保存されなくなります。
    7. Windows 10 on ARM Insider Preview をダウンロードする
    @@ -80,29 +77,29 @@ ARM 版 Windows 10 や Ubuntu を Apple Silicon な Mac で動かす簡単な方
    詳しくは以下の「raw フォーマットのディスクイメージを縮小する」を参照のこと。
    ```
    qemu-img convert -p -O raw ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_21354.VHDX ~/Downloads/Windows10.raw
    qemu-img convert -p -O raw Windows10_InsiderPreview_Client_ARM64_en-us_21354.VHDX Windows10.raw
    ```
    9. Windows 10 を起動する
    ```
    ./qemu-system-aarch64 \
    qemu-system-aarch64 \
    -monitor stdio \
    -M virt,highmem=off \
    -accel hvf \
    -cpu cortex-a72 \
    -smp 4 \
    -m 4096 \
    -drive file=~/Downloads/pflash0.img,format=raw,if=pflash,readonly=on \
    -drive file=~/Downloads/pflash1.img,format=raw,if=pflash \
    -drive file=pflash0.img,format=raw,if=pflash,readonly=on \
    -drive file=pflash1.img,format=raw,if=pflash \
    -device ramfb \
    -device qemu-xhci \
    -device usb-kbd \
    -device usb-tablet \
    -device intel-hda \
    -device hda-duplex \
    -nic user,model=virtio \
    -drive file=~/Downloads/Windows10.raw,format=raw,if=none,id=boot \
    -drive file=Windows10.raw,format=raw,if=none,id=boot \
    -device nvme,drive=boot,serial=boot
    ```
    @@ -133,7 +130,7 @@ VirtIO NIC は標準では有効にならないので、デバイスドライバ
    `qemu-system-aarch64` のオプションに以下を追加する。
    ```
    -drive file=~/Downloads/virtio-win-0.1.190.iso,media=cdrom,if=none,id=drivers \
    -drive file=virtio-win-0.1.190.iso,media=cdrom,if=none,id=drivers \
    -device usb-storage,drive=drivers
    ```
    @@ -211,7 +208,7 @@ ARM 版 Windows 10 を動かす手順に従って QEMU を準備して、Ubuntu
    2. 空のディスクイメージを作成する。
    ```
    ./qemu-img create -f raw ~/Downloads/ubuntu.raw 40G
    qemu-img create -f raw ubuntu.raw 40G
    ```
    3. Ubuntu Server for ARM64 をダウンロードする。
    @@ -221,24 +218,24 @@ ARM 版 Windows 10 を動かす手順に従って QEMU を準備して、Ubuntu
    4. Ubuntu Server for ARM をインストールする。
    ```
    ./qemu-system-aarch64 \
    qemu-system-aarch64 \
    -monitor stdio \
    -M virt,highmem=off \
    -accel hvf \
    -cpu cortex-a72 \
    -smp 4 \
    -m 4096 \
    -drive file=~/Downloads/pflash0.img,format=raw,if=pflash,readonly=on \
    -drive file=~/Downloads/pflash1.img,format=raw,if=pflash \
    -drive file=pflash0.img,format=raw,if=pflash,readonly=on \
    -drive file=pflash1.img,format=raw,if=pflash \
    -device virtio-gpu-pci \
    -display default,show-cursor=on \
    -device qemu-xhci \
    -device usb-kbd \
    -device usb-tablet \
    -device intel-hda \
    -device hda-duplex \
    -drive file=~/Downloads/ubuntu.raw,format=raw,if=virtio,cache=writethrough \
    -cdrom ~/Downloads/ubuntu-20.04.1-live-server-arm64.iso
    -drive file=ubuntu.raw,format=raw,if=virtio,cache=writethrough \
    -cdrom ubuntu-20.04.1-live-server-arm64.iso
    ```
    - 指示に従ってインストールしたあとは `-cdrom` は不要です。
  4. @niw niw revised this gist Aug 20, 2021. 2 changed files with 0 additions and 4 deletions.
    2 changes: 0 additions & 2 deletions README.en.md
    Original file line number Diff line number Diff line change
    @@ -207,8 +207,6 @@ $ swift build -c release
    $ .build/release/holepunch --show-progress /path/to/Windows10.raw
    ```
    Note, if you didn't install Xcode, install it from App Store.
    ## Running Ubuntu Server for ARM64
    Follow the same steps for Windows 10 to prepare QEMU,
    2 changes: 0 additions & 2 deletions README.ja.md
    Original file line number Diff line number Diff line change
    @@ -201,8 +201,6 @@ $ swift build -c release
    $ .build/release/holepunch --show-progress /path/to/Windows10.raw
    ```
    もし、Xcode がインストールされていない場合、Xcode が必要になります。
    ## Ubuntu Server for ARM64 を動かす
    ARM 版 Windows 10 を動かす手順に従って QEMU を準備して、Ubuntu Server for ARM64
  5. @niw niw revised this gist Aug 20, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.en.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    Here is easy steps to try Windows 10 on ARM or Ubuntu for ARM64
    on your Apple Silicon Mac. Enjoy!

    > NOTE: that this is current, 6/6/2021 state.
    > NOTE: that this is current, 8/19/2021 state.
    ## Running Windows 10 on ARM

  6. @niw niw revised this gist Aug 20, 2021. 2 changed files with 179 additions and 111 deletions.
    157 changes: 97 additions & 60 deletions README.en.md
    Original file line number Diff line number Diff line change
    @@ -1,45 +1,41 @@
    # How to run Windows 10 on ARM or Ubuntu for ARM64 in QEMU on Apple Silicon Mac

    Here is easy steps to try Windows 10 on ARM or Ubuntu for ARM64 on your Apple Silicon Mac.
    Enjoy!
    Here is easy steps to try Windows 10 on ARM or Ubuntu for ARM64
    on your Apple Silicon Mac. Enjoy!

    > NOTE: that this is current, 6/6/2021 state.
    ## Running Windows 10 on ARM

    1. Install Xcode from App Store or install Command Line Tools on your Mac running on Apple Silicon.
    1. Install Xcode from App Store or install Command Line Tools on your Mac
    running on Apple Silicon.

    ```
    xcode-select --install
    ```
    2. Install ARM64 Homebrew and QEMU dependencies.
    **If you already installed x86_64 Homebrew in `/usr/local`, please uninstall it.**
    **It's not possible to build QEMU with x86_64 Homebrew**
    https://brew.sh/
    **If you already installed x86_64 Homebrew in `/usr/local`,**
    **please uninstall it.**
    **It’s not possible to build QEMU with x86_64 Homebrew**
    ```
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    brew install ninja pkgconfig glib pixman
    ```
    3. Clone QEMU source code.
    3. Clone QEMU source code with Hypervisor.framework patches
    that @[_AlexGraf](https://twitter.com/_AlexGraf) made.
    ```
    git clone https://git.qemu.org/git/qemu.git
    git clone --depth 1 --branch implement_apple_silicon_support https://github.com/niw/qemu
    ```
    4. Create a local branch then apply Hypervisor.framework patches that @[_AlexGraf](https://twitter.com/_AlexGraf) made.
    ```
    cd qemu
    git checkout 3c93dfa -b wip/hvf
    curl 'https://patchwork.kernel.org/series/485309/mbox/'|git am --3way
    ```
    See <https://patchwork.kernel.org/project/qemu-devel/list/?series=485309&archive=both>
    for details about the patch.
    5. Build QEMU
    4. Build QEMU
    ```
    mkdir build
    @@ -48,17 +44,20 @@ Enjoy!
    make -j
    ```
    6. Download pre-build EDK II OVMF EFI image for QEMU.
    5. Download pre-build EDK II OVMF EFI image for QEMU.
    This EFI image is built from `stable202011` tag with additional resolutions in `QemuRamfb.c`.
    This EFI image is built from `stable202011` tag with additional resolutions
    in `QemuRamfb.c`.
    https://gist.github.com/niw/4f1f9bb572f40d406866f23b3127919b/raw/f546faea68f4149c06cca88fa67ace07a3758268/QEMU_EFI-cb438b9-edk2-stable202011-with-extra-resolutions.tar.gz
    To build it from the source code for adding more resolutions, see the following section.
    To build it from the source code for adding more resolutions,
    see the following section.
    7. Prepare pflash for non-volatile variable store, such as screen resolution.
    6. Prepare pflash for non-volatile variable store, such as screen resolution.
    In the directory where you downloaded `QEMU_EFI-....tar.gz`, run following commands.
    In the directory where you downloaded `QEMU_EFI-....tar.gz`,
    run following commands.
    ```
    cd ~/Downloads
    @@ -69,22 +68,26 @@ Enjoy!
    dd if=QEMU_VARS.fd of=pflash1.img conv=notrunc
    ```
    - This step is optional, you can use `-bios ~/Downloads/QEMU_EFI.fd` instead of `-drive ...if=pflash` lines in the next step,
    - This step is optional, you can use `-bios ~/Downloads/QEMU_EFI.fd`
    instead of `-drive ...if=pflash` lines in the next step,
    but in that case, any changes in EFI will not be persistent.
    8. Download Windows 10 on ARM Insider Preview
    7. Download Windows 10 on ARM Insider Preview
    https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewARM64
    9. Convert VHDX downloaded Windows image to qcow2 format
    8. Convert VHDX downloaded Windows image to raw format
    It seems that VHDX often gets broken while it is being used, so probably it is better to convert it to qcow2 format before using it.
    It seems that VHDX often gets broken while it is being used,
    so probably it is better to convert it to raw format before using it.
    Using raw format makes the disk image file a sparse file on APFS disk.
    See "Compact raw disk image" section below for the details.
    ```
    qemu-img convert -p -O qcow2 ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_21354.VHDX ~/Downloads/Windows10.qcow2
    qemu-img convert -p -O raw ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_21354.VHDX ~/Downloads/Windows10.raw
    ```
    10. Run Windows 10
    9. Run Windows 10
    ```
    ./qemu-system-aarch64 \
    @@ -103,20 +106,27 @@ Enjoy!
    -device intel-hda \
    -device hda-duplex \
    -nic user,model=virtio \
    -drive file=~/Downloads/Windows10.qcow2,format=qcow2,if=none,id=boot,cache=writethrough \
    -drive file=~/Downloads/Windows10.raw,format=raw,if=none,id=boot \
    -device nvme,drive=boot,serial=boot
    ```
    - Please modify each path to the image depends on your environment.
    - Hit `ESC` while you see TianoCore, then `Device Manager`, `OVMF Platform Configuration`, `Change Preferred Resolution for Next Boot` to change screen resolution.
    - To add more resolutions, follow "Build EDK II OVMF EFI image from the source code" below and modify `OvmfPkg/QemuRamfbDxe/QemuRamfb.c` then build new `QEMU_EFI.fd`.
    - Use `-device usb-tablet` instead of `-device usb-mouse` allows transparently moving mouse cursor.
    - Hit `ESC` while you see TianoCore, then `Device Manager`,
    `OVMF Platform Configuration`, `Change Preferred Resolution for Next Boot`
    to change screen resolution.
    - To add more resolutions, follow "Build EDK II OVMF EFI image from
    the source code" below and modify `OvmfPkg/QemuRamfbDxe/QemuRamfb.c`
    then build new `QEMU_EFI.fd`.
    - Use `-device usb-tablet` instead of `-device usb-mouse` allows
    transparently moving mouse cursor.
    - `-device intel-hda -device hda-duplex` to enable audio.
    - `-nic user,model=virtio` is the network interface. To enable it, see the following section.
    - `-nic user,model=virtio` is the network interface.
    To enable it, see the following section.
    ## Enable the internet
    VirtIO NIC is not enabled by default. To make it works, you need to install a device driver.
    VirtIO NIC is not enabled by default. To make it works,
    you need to install a device driver.
    1. Download VirtIO device drivers ISO from [Fedora Project](https://docs.fedoraproject.org/en-US/quick-docs/creating-windows-virtual-machines-using-virtio-drivers/index.html#virtio-win-direct-downloads).
    @@ -135,7 +145,8 @@ VirtIO NIC is not enabled by default. To make it works, you need to install a de
    3. Disable device driver signature enforcement
    Boot Windows, then right click Windows Start button, then select Command Prompt (Admin).
    Boot Windows, then right click Windows Start button,
    then select Command Prompt (Admin).
    Use bcdedit to enable test-signed device drivers.
    @@ -149,47 +160,66 @@ VirtIO NIC is not enabled by default. To make it works, you need to install a de
    4. Install driver
    Once Windows booted again, then right click Windows Start button, then select Device Manager.
    Once Windows booted again, then right click Windows Start button,
    then select Device Manager.
    In Device Manager, select View menu then Devices by Connection.
    Navigate in the device tree, select `ACPU ARM64-based PC`, `Microsoft ACPI-Compliant System`, `PCI Express Root Complex`, then you will see one `Unknown device` there.
    (There are many `Unknown device` in tree but the one under `PCI Express Root Complex` is the VirtIO NIC.)
    Navigate in the device tree, select `ACPU ARM64-based PC`,
    `Microsoft ACPI-Compliant System`, `PCI Express Root Complex`,
    then you will see one `Unknown device` there.
    (There are many `Unknown device` in tree but the one under
    `PCI Express Root Complex` is the VirtIO NIC.)
    Right click `Unknown device` then select Update Drivers, then Browse my computer for drivers, then select `D:\NetKVM\w10\ARM64`.
    Right click `Unknown device` then select Update Drivers,
    then Browse my computer for drivers, then select `D:\NetKVM\w10\ARM64`.
    Click Next to install `Red Hat VertIO Ethernet Adapter`.
    ## Compact disk image
    ## Compact raw disk image
    The disk image, `Windows10.qcow2`, can be getting bigger as using Windows, especially after Windows Update, even if you delete files.
    If you use `ls` or similar tool, you will notice that `Windows10.raw` is using
    large like 64GB disk space, however, it is not actually using that space.
    If the disk image is too big, you may want to compact it to release free space.
    By using Finder, you will see in info panel of that file, that shows the actual
    disk usage is much lower than that, like 10GB. Or, you can see actual size on
    disk by using the following command.
    1. Use Defragment and Optimize Drives coming with Windows 10 and optimize `C:` drive.
    ```
    $ du -h Windows10.raw
    10G Windows10.raw
    ```
    2. Download [SDelete](https://docs.microsoft.com/en-us/sysinternals/downloads/sdelete). Run `SDelete64a -z C:` by using Administrator Command Prompt to zero-fill free space.
    This may take a while. While running this command, the disk image can be bigger, so be sure Mac have enough free space.
    This is because APFS is using a sparse file format automatically and doesn’t
    actually allocate the space until it is used.
    However, even though, the actual size on disk can be getting bigger as using
    Windows, especially after Windows Update, even if you delete files.
    3. Shutdown Windows, then run next command on Mac. This may take a while.
    Since this command creates compacted disk image, so be sure Mac has enough free space.
    If the disk image is too big, you may want to compact it to release free space
    by using Defragment and Optimize Drives coming with Windows 10 and optimize `C:`
    drive, then use my [HolePunch](https://github.com/niw/HolePunch) tool
    to reduce the actual disk usage.
    ```
    qemu-img convert -O qcow2 ~/Downloads/Windows10.qcow2 ~/Downloads/Windows10_compacted.qcow2
    ```
    ```
    $ git clone https://github.com/niw/HolePunch.git
    $ ce HolePunch
    $ swift build -c release
    $ .build/release/holepunch --show-progress /path/to/Windows10.raw
    ```
    4. Replace `Windows10.qcow2` by compacted `Windows10_compacted.qcow2`.
    Note, if you didn't install Xcode, install it from App Store.
    ## Running Ubuntu Server for ARM64
    Follow the same steps for Windows 10 to prepare QEMU, then download Ubuntu Server for ARM64 and install it.
    Follow the same steps for Windows 10 to prepare QEMU,
    then download Ubuntu Server for ARM64 and install it.
    1. Follow previous steps from 1. to 7. to prepare QEMU.
    2. Create an empty disk image.
    ```
    ./qemu-img create -f qcow2 ~/Downloads/ubuntu.qcow2 40G
    ./qemu-img create -f raw ~/Downloads/ubuntu.raw 40G
    ```
    3. Download Ubuntu Server for ARM64
    @@ -215,11 +245,12 @@ Follow the same steps for Windows 10 to prepare QEMU, then download Ubuntu Serve
    -device usb-tablet \
    -device intel-hda \
    -device hda-duplex \
    -drive file=~/Downloads/ubuntu.qcow2,if=virtio,cache=writethrough \
    -drive file=~/Downloads/ubuntu.raw,format=raw,if=virtio,cache=writethrough \
    -cdrom ~/Downloads/ubuntu-20.04.1-live-server-arm64.iso
    ```
    - Follow instruction to install Ubuntu Server. Once it's installed, `-cdrom` argument is not needed.
    - Follow instruction to install Ubuntu Server. Once it’s installed, `-cdrom`
    argument is not needed.
    ## Build EDK II OVMF EFI image from the source code
    @@ -233,8 +264,11 @@ Follow the previous instructions to run Ubuntu Server for ARM64.
    git submodule update --init --recursive
    ```
    You may want to disable xHCI due to current Hypervisor.framework patch limitation.
    Comment out `MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf` in `/ArmVirtPkg/ArmVirtQemu.dsc` and `/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc`. Probably this is no longer needed.
    You may want to disable xHCI due to current Hypervisor.framework
    patch limitation.
    Comment out `MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf` in
    `/ArmVirtPkg/ArmVirtQemu.dsc` and `/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc`.
    Probably this is no longer needed.
    2. Build it.
    @@ -245,10 +279,13 @@ Follow the previous instructions to run Ubuntu Server for ARM64.
    build -a AARCH64 -t GCC5 -p ArmVirtPkg/ArmVirtQemu.dsc
    ```
    Then, you will get `QEMU_EFI.fd` and `QEMU_VARS.fd` in `Build/ArmVirtQemu-AARCH64/DEBUG_GCC5/FV`.
    Then, you will get `QEMU_EFI.fd` and `QEMU_VARS.fd` in
    `Build/ArmVirtQemu-AARCH64/DEBUG_GCC5/FV`.
    - The easiest way to take these files to the host macOS, run Remote Login on macOS then `scp` these to `10.0.2.2`.
    - To build these on x86_64 environment, use following toolchain to cross compile.
    - The easiest way to take these files to the host macOS,
    run Remote Login on macOS then `scp` these to `10.0.2.2`.
    - To build these on x86_64 environment, use following toolchain
    to cross compile.
    ```
    sudo apt install gcc-aarch64-linux-gnu
    133 changes: 82 additions & 51 deletions README.ja.md
    Original file line number Diff line number Diff line change
    @@ -2,42 +2,38 @@

    ARM 版 Windows 10 や Ubuntu を Apple Silicon な Mac で動かす簡単な方法です。

    > メモ: 2021年6月6日現時点での方法で、今後まだ改善されていくと思います。
    > メモ: 2021年8月19日現時点での方法で、今後まだ改善されていくと思います。
    ## ARM 版 Windows 10 を動かす

    1. Xcode を App Store で、あるいは Command Line Tools を Apple Silicon な Mac にインストール
    1. Xcode を App Store で、あるいは Command Line Tools を Apple Silicon な Mac
    にインストール

    ```
    xcode-select --install
    ```
    2. ARM64 対応の Homebrew で QEMU の依存ライブラリをインストール
    **すでに x86_64 の Homebrew が `/usr/local` にインストールされている場合は削除するなどしてください。**
    **すでに x86_64 の Homebrew が `/usr/local` にインストールされている場合は**
    **削除するなどしてください。**
    **x86_64 の Homebrew では QEMU がビルドできません**
    https://brew.sh/
    ```
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    brew install ninja pkgconfig glib pixman
    ```
    3. QEMU のソースコードをとってくる
    3. @[_AlexGraf](https://twitter.com/_AlexGraf)氏がつくった Hypervisor.framework
    のパッチをあててある QEMU のソースを取得
    ```
    git clone https://git.qemu.org/git/qemu.git
    git clone --depth 1 --branch implement_apple_silicon_support https://github.com/niw/qemu
    ```
    4. ローカルブランチを作って、@[_AlexGraf](https://twitter.com/_AlexGraf)氏がつくった Hypervisor.framework のパッチをあてる。
    ```
    cd qemu
    git checkout 3c93dfa -b wip/hvf
    curl 'https://patchwork.kernel.org/series/485309/mbox/'|git am --3way
    ```
    パッチは <https://patchwork.kernel.org/project/qemu-devel/list/?series=485309&archive=both>
    を参照のこと。
    5. QEMU をビルドする
    4. QEMU をビルドする
    ```
    mkdir build
    @@ -46,15 +42,15 @@ ARM 版 Windows 10 や Ubuntu を Apple Silicon な Mac で動かす簡単な方
    make -j
    ```
    6. QEMU 用の EDK II OVMF EFI イメージをダウンロードする。
    5. QEMU 用の EDK II OVMF EFI イメージをダウンロードする。
    このイメージは `stable202011` タグに、`QemuRamfb.c` に追加の解像度を足したものです。
    https://gist.github.com/niw/4f1f9bb572f40d406866f23b3127919b/raw/f546faea68f4149c06cca88fa67ace07a3758268/QEMU_EFI-cb438b9-edk2-stable202011-with-extra-resolutions.tar.gz
    さらに解像度を追加するなど、ソースコードからビルドする場合は以下を参照のこと。
    7. pflash イメージを作って、画面サイズなどを設定する不揮発なストレージを準備する
    6. pflash イメージを作って、画面サイズなどを設定する不揮発なストレージを準備する
    `QEMU_EFI-....tar.gz` をダウンロードしたディレクトリで以下を実行。
    @@ -67,21 +63,27 @@ ARM 版 Windows 10 や Ubuntu を Apple Silicon な Mac で動かす簡単な方
    dd if=QEMU_VARS.fd of=pflash1.img conv=notrunc
    ```
    - このステップは省略可能。その場合は次のステップで `-drive ...,if=pflash,...` のかわりに `-bios ~/Downloads/QEMU_EFI.fd` を指定すること。ただし、EFI での変更が保存されなくなります。
    - このステップは省略可能。その場合は次のステップで `-drive ...,if=pflash,...`
    のかわりに `-bios ~/Downloads/QEMU_EFI.fd` を指定すること。
    ただし、EFI での変更が保存されなくなります。
    8. Windows 10 on ARM Insider Preview をダウンロードする
    7. Windows 10 on ARM Insider Preview をダウンロードする
    https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewARM64
    9. VHDX から qcow2 に変換する
    8. VHDX から raw に変換する
    VHDX のままだとかなりの頻度でイメージが壊れる印象があるので qcow2 に変換しておく。
    VHDX フォーマットのままだとかなりの頻度でイメージが壊れる印象があるので raw フォーマットに
    変換しておく。
    raw フォーマットを使うことで APFS ではスパースファイルとして扱うことができるので、
    実際に使用するまで実際のファイルサイズを抑えることができる。
    詳しくは以下の「raw フォーマットのディスクイメージを縮小する」を参照のこと。
    ```
    qemu-img convert -p -O qcow2 ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_21354.VHDX ~/Downloads/Windows10.qcow2
    qemu-img convert -p -O raw ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_21354.VHDX ~/Downloads/Windows10.raw
    ```
    10. Windows 10 を起動する
    9. Windows 10 を起動する
    ```
    ./qemu-system-aarch64 \
    @@ -100,22 +102,29 @@ ARM 版 Windows 10 や Ubuntu を Apple Silicon な Mac で動かす簡単な方
    -device intel-hda \
    -device hda-duplex \
    -nic user,model=virtio \
    -drive file=~/Downloads/Windows10.qcow2,format=qcow2,if=none,id=boot,cache=writethrough \
    -drive file=~/Downloads/Windows10.raw,format=raw,if=none,id=boot \
    -device nvme,drive=boot,serial=boot
    ```
    - イメージへのパスなどは適宜修正してください。
    - TianoCore のロゴが出ている時に `ESC` を押して、`Device Manager`、`OVMF Platform Configuration`、`Change Preferred Resolution for Next Boot` と進めて解像度を変更できます。
    - 解像度を追加するには、下記の「EDK II の OVMF EFI イメージをビルドする」に従って `OvmfPkg/QemuRamfbDxe/QemuRamfb.c` を変更し、新しい `QEMU_EFI.fd` を作ってください。
    - `-device usb-mouse` より `-device usb-tablet` を使うことでマウスカーソルがロックされなくなり使いやすくなります。
    - TianoCore のロゴが出ている時に `ESC` を押して、`Device Manager`、
    `OVMF Platform Configuration`、`Change Preferred Resolution for Next Boot`
    と進めて解像度を変更できます。
    - 解像度を追加するには、下記の「EDK II の OVMF EFI イメージをビルドする」に従って
    `OvmfPkg/QemuRamfbDxe/QemuRamfb.c` を変更し、新しい `QEMU_EFI.fd`
    を作ってください。
    - `-device usb-mouse` より `-device usb-tablet` を使うことでマウスカーソルがロック
    されなくなり使いやすくなります。
    - `-device intel-hda -device hda-duplex` でオーディオが使えるようになります。
    - `-nic user,model=virtio` がネットワークインターフェイスです。有効にするには以下を参照してください。
    - `-nic user,model=virtio` がネットワークインターフェイスです。有効にするには
    以下を参照してください。
    ## インターネットに接続する
    VirtIO NIC は標準では有効にならないので、デバイスドライバを入れる必要がある。
    1. VirtIO デバイスドライバの ISO を [Fedora Project](https://docs.fedoraproject.org/en-US/quick-docs/creating-windows-virtual-machines-using-virtio-drivers/index.html#virtio-win-direct-downloads) からダウンロード。
    1. VirtIO デバイスドライバの ISO を [Fedora Project](https://docs.fedoraproject.org/en-US/quick-docs/creating-windows-virtual-machines-using-virtio-drivers/index.html#virtio-win-direct-downloads)
    からダウンロード。
    https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-0.1.190-1/virtio-win-0.1.190.iso
    @@ -132,7 +141,8 @@ VirtIO NIC は標準では有効にならないので、デバイスドライバ
    3. デバイスドライバの署名検証を無効にする
    Windows を起動して Windows スタートボタン を右クリック、Command Prompt (Admin) を選択。
    Windows を起動して Windows スタートボタン を右クリック、Command Prompt (Admin)
    を選択。
    bcdedit を使ってテスト署名されたデバイスドライバを有効にする。
    @@ -150,43 +160,60 @@ VirtIO NIC は標準では有効にならないので、デバイスドライバ
    Device Manager のウィンドウで、View メニューの Devices by Connection を選択。
    デバイスのツリーから、`ACPU ARM64-based PC`、`Microsoft ACPI-Compliant System`、`PCI Express Root Complex` と選択してその中にある `Unknown device` を探す。
    (`Unknown device` はデバイスのツリーに沢山あるけれど、`PCI Express Root Complex`の下にあるのが、VirtIO NIC。)
    デバイスのツリーから、`ACPU ARM64-based PC`、`Microsoft ACPI-Compliant System`
    `PCI Express Root Complex` と選択してその中にある `Unknown device` を探す。
    (`Unknown device` はデバイスのツリーに沢山あるけれど、`PCI Express Root Complex`
    の下にあるのが、VirtIO NIC。)
    該当の `Unknown device` を右クリックして、Update Drivers を選択、Browse my computer for drivers を選んで、`D:\NetKVM\w10\ARM64` を指定。
    該当の `Unknown device` を右クリックして、Update Drivers を選択、
    Browse my computer for drivers を選んで、`D:\NetKVM\w10\ARM64` を指定。
    Next をクリックして `Red Hat VertIO Ethernet Adapter` をインストール。
    ## ディスクイメージをを縮小する
    ## raw フォーマットのディスクイメージを縮小する
    ディスクイメージである `Windows10.qcow2` ファイルは Windows Update などをすると容量まで大きくなる可能性があり、たとえファイルを削除してもディスクイメージのサイズは減りません。
    `ls` や似たようなツールを使うと、`Windows10.raw` ファイルが実際より多くの、
    例えば64GBのディスクを使っているように表示されることがあります。
    しかし、実際には利用している容量しか使っていません。
    そのため、ディスクサイズが大きくなりすぎた場合などは使用していない領域を開放する必要があります。
    Finder を使うことで、ファイルの情報を見ると実際のディスクの使用量を表示できます。
    もしくは、以下のコマンドでも同じことができます。
    1. Windows 10に付属の Defragment and Optimize Drives で、`C:` ドライブを Optimize する。
    ```
    $ du -h Windows10.raw
    10G Windows10.raw
    ```
    2. [SDelete](https://docs.microsoft.com/en-us/sysinternals/downloads/sdelete) をダウンロードする。`SDelete64a -z C:` を Administrator Command Prompt で実行し、使用していない領域をゼロで埋める。
    このコマンドの実行はしばらくかかります。この時、ディスクイメージがとても大きくなるので Mac の空き容量に注意。
    これは APFS がスパースファイルを自動で使うためで、実際にファイルの領域が使われるまでディスクの
    領域を割り当てないからです。
    しかしながら、ファイルは Windows Update などをすると容量まで大きくなる可能性があり、
    たとえファイルを削除してもディスクイメージのサイズは減らないことがあります。
    3. Windows を終了して、以下のコマンドを Mac で実行する。
    このコマンドの実行はしばらくかかります。また縮小したディスクイメージは別に作られるので Mac の空き容量に注意。
    そのため、ディスクサイズが大きくなりすぎた場合などは Windows 10 に付属の
    Defragment and Optimize Drives で、`C:` ドライブを Optimize して使用していない領域を
    開放したあと、以下の拙作の[HolePunch](https://github.com/niw/HolePunch)ツールを使って
    `Windows10.raw` を縮小してください。
    ```
    qemu-img convert -O qcow2 ~/Downloads/Windows10.qcow2 ~/Downloads/Windows10_compacted.qcow2
    ```
    ```
    $ git clone https://github.com/niw/HolePunch.git
    $ ce HolePunch
    $ swift build -c release
    $ .build/release/holepunch --show-progress /path/to/Windows10.raw
    ```
    4. `Windows10.qcow2` を縮小した `Windows10_compacted.qcow2` で置き換え
    もし、Xcode がインストールされていない場合、Xcode が必要になります
    ## Ubuntu Server for ARM64 を動かす
    ARM 版 Windows 10 を動かす手順に従って QEMU を準備して、Ubuntu Server for ARM64 をダウンロードしてインストールします。
    ARM 版 Windows 10 を動かす手順に従って QEMU を準備して、Ubuntu Server for ARM64
    をダウンロードしてインストールします。
    1. 上記の手順 1 から 7 までに従って QEMU を準備する。
    2. 空のディスクイメージを作成する。
    ```
    ./qemu-img create -f qcow2 ~/Downloads/ubuntu.qcow2 40G
    ./qemu-img create -f raw ~/Downloads/ubuntu.raw 40G
    ```
    3. Ubuntu Server for ARM64 をダウンロードする。
    @@ -212,7 +239,7 @@ ARM 版 Windows 10 を動かす手順に従って QEMU を準備して、Ubuntu
    -device usb-tablet \
    -device intel-hda \
    -device hda-duplex \
    -drive file=~/Downloads/ubuntu.qcow2,if=virtio,cache=writethrough \
    -drive file=~/Downloads/ubuntu.raw,format=raw,if=virtio,cache=writethrough \
    -cdrom ~/Downloads/ubuntu-20.04.1-live-server-arm64.iso
    ```
    @@ -230,7 +257,9 @@ ARM 版 Windows 10 を動かす手順に従って QEMU を準備して、Ubuntu
    git submodule update --init --recursive
    ```
    Hypervisor.framework パッチの制限で xHCI を無効にする必要があれば `/ArmVirtPkg/ArmVirtQemu.dsc` と `/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc` にある `MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf` の行をコメントアウト。たぶん現状は問題ない。
    Hypervisor.framework パッチの制限で xHCI を無効にする必要があれば `/ArmVirtPkg/ArmVirtQemu.dsc` と `/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc` にある
    `MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf` の行をコメントアウト。
    たぶん現状は問題ない。
    2. ビルドする
    @@ -241,9 +270,11 @@ ARM 版 Windows 10 を動かす手順に従って QEMU を準備して、Ubuntu
    build -a AARCH64 -t GCC5 -p ArmVirtPkg/ArmVirtQemu.dsc
    ```
    `Build/ArmVirtQemu-AARCH64/DEBUG_GCC5/FV` に `QEMU_EFI.fd` と `QEMU_VARS.fd` ができるはず。
    `Build/ArmVirtQemu-AARCH64/DEBUG_GCC5/FV` に `QEMU_EFI.fd` と `QEMU_VARS.fd`
    ができるはず。
    - これらのファイルを簡単に macOS ホストに取り出すには macOS でリモートアクセスを有効にして `scp` で `10.0.2.2` にコピー。
    - これらのファイルを簡単に macOS ホストに取り出すには macOS でリモートアクセスを
    有効にして `scp` で `10.0.2.2` にコピー。
    - x86_64 の環境でビルドする場合は以下のツールチェーンでクロスコンパイル。
    ```
  7. @niw niw revised this gist Jul 1, 2021. 1 changed file with 1 addition and 3 deletions.
    4 changes: 1 addition & 3 deletions README.en.md
    Original file line number Diff line number Diff line change
    @@ -116,9 +116,7 @@ Enjoy!
    ## Enable the internet
    VirtIO NIC is not enabled by default. To make it works, you need to
    device driver.
    VirtIO NIC is not enabled by default. To make it works, you need to install a device driver.
    1. Download VirtIO device drivers ISO from [Fedora Project](https://docs.fedoraproject.org/en-US/quick-docs/creating-windows-virtual-machines-using-virtio-drivers/index.html#virtio-win-direct-downloads).
  8. @niw niw revised this gist Jun 6, 2021. 2 changed files with 6 additions and 18 deletions.
    12 changes: 3 additions & 9 deletions README.en.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    Here is easy steps to try Windows 10 on ARM or Ubuntu for ARM64 on your Apple Silicon Mac.
    Enjoy!

    > NOTE: that this is current, 5/23/2021 state. I think it will be improved in upcoming a few months.
    > NOTE: that this is current, 6/6/2021 state.
    ## Running Windows 10 on ARM

    @@ -35,16 +35,10 @@ Enjoy!
    ```
    cd qemu
    git checkout 3bbaed2cd0 -b wip/hvf
    git checkout 3c93dfa -b wip/hvf
    curl 'https://patchwork.kernel.org/series/485309/mbox/'|git am --3way
    ```
    Current `3bbaed2cd0`, on macOS 11.3 with Xcode 12.5 and later, due to C++20 `version` header file conflicts with `VERSION` file, QEMU build fails. Therefore, you also need apply next patch.
    ```
    curl 'https://patchwork.kernel.org/series/474841/mbox/'|git am --3way
    ```
    5. Build QEMU
    ```
    @@ -87,7 +81,7 @@ Enjoy!
    It seems that VHDX often gets broken while it is being used, so probably it is better to convert it to qcow2 format before using it.
    ```
    qemu-img convert -p -O qcow2 ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_21286.VHDX ~/Downloads/Windows10.qcow2
    qemu-img convert -p -O qcow2 ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_21354.VHDX ~/Downloads/Windows10.qcow2
    ```
    10. Run Windows 10
    12 changes: 3 additions & 9 deletions README.ja.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@

    ARM 版 Windows 10 や Ubuntu を Apple Silicon な Mac で動かす簡単な方法です。

    > メモ: 2021年5月23日現時点での方法で、今後まだ改善されていくと思います。
    > メモ: 2021年6月6日現時点での方法で、今後まだ改善されていくと思います。
    ## ARM 版 Windows 10 を動かす

    @@ -33,16 +33,10 @@ ARM 版 Windows 10 や Ubuntu を Apple Silicon な Mac で動かす簡単な方
    ```
    cd qemu
    git checkout 3bbaed2cd0 -b wip/hvf
    git checkout 3c93dfa -b wip/hvf
    curl 'https://patchwork.kernel.org/series/485309/mbox/'|git am --3way
    ```
    なお、macOS 11.3, Xcode 12.5 以降では C++20 の `version` ヘッダーが、`VERSION`ファイルと混同されてビルドできないので、現状 `3bbaed2cd0` では以下のパッチも必要。
    ```
    curl 'https://patchwork.kernel.org/series/474841/mbox/'|git am --3way
    ```
    5. QEMU をビルドする
    ```
    @@ -84,7 +78,7 @@ ARM 版 Windows 10 や Ubuntu を Apple Silicon な Mac で動かす簡単な方
    VHDX のままだとかなりの頻度でイメージが壊れる印象があるので qcow2 に変換しておく。
    ```
    qemu-img convert -p -O qcow2 ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_21286.VHDX ~/Downloads/Windows10.qcow2
    qemu-img convert -p -O qcow2 ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_21354.VHDX ~/Downloads/Windows10.qcow2
    ```
    10. Windows 10 を起動する
  9. @niw niw renamed this gist May 23, 2021. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  10. @niw niw revised this gist May 23, 2021. 2 changed files with 2 additions and 2 deletions.
    2 changes: 1 addition & 1 deletion README.ja.md
    Original file line number Diff line number Diff line change
    @@ -37,7 +37,7 @@ ARM 版 Windows 10 や Ubuntu を Apple Silicon な Mac で動かす簡単な方
    curl 'https://patchwork.kernel.org/series/485309/mbox/'|git am --3way
    ```
    なお、macOS 11.3.1, Xcode 12.5 では C++20 の `version` ヘッダーが、`VERSION`ファイルと混同されてビルドできないので、現状(`3bbaed2cd0`)では以下のパッチも必要。
    なお、macOS 11.3, Xcode 12.5 以降では C++20 の `version` ヘッダーが、`VERSION`ファイルと混同されてビルドできないので、現状 `3bbaed2cd0` では以下のパッチも必要。
    ```
    curl 'https://patchwork.kernel.org/series/474841/mbox/'|git am --3way
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -39,7 +39,7 @@ Enjoy!
    curl 'https://patchwork.kernel.org/series/485309/mbox/'|git am --3way
    ```
    Current `3bbaed2cd0`, on macOS 11.3.1 with Xcode 12.5, due to C++20 `version` header file conflicts with `VERSION` file, QEMU build fails. Therefore, you also need apply next patch.
    Current `3bbaed2cd0`, on macOS 11.3 with Xcode 12.5 and later, due to C++20 `version` header file conflicts with `VERSION` file, QEMU build fails. Therefore, you also need apply next patch.
    ```
    curl 'https://patchwork.kernel.org/series/474841/mbox/'|git am --3way
  11. @niw niw revised this gist May 23, 2021. 2 changed files with 19 additions and 7 deletions.
    14 changes: 10 additions & 4 deletions README.ja.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@

    ARM 版 Windows 10 や Ubuntu を Apple Silicon な Mac で動かす簡単な方法です。

    > メモ: 2021年2月8日現時点での方法で、今後まだ改善されていくと思います。
    > メモ: 2021年5月23日現時点での方法で、今後まだ改善されていくと思います。
    ## ARM 版 Windows 10 を動かす

    @@ -29,12 +29,18 @@ ARM 版 Windows 10 や Ubuntu を Apple Silicon な Mac で動かす簡単な方
    git clone https://git.qemu.org/git/qemu.git
    ```
    4. ローカルブランチを作って、@[_AlexGraf](https://twitter.com/_AlexGraf)氏がつくった Hypervisor.framework のパッチをあてる
    4. ローカルブランチを作って、@[_AlexGraf](https://twitter.com/_AlexGraf)氏がつくった Hypervisor.framework のパッチをあてる
    ```
    cd qemu
    git checkout d0dddab40e -b wip/hvf
    curl 'https://patchwork.kernel.org/series/418581/mbox/'|git am --3way
    git checkout 3bbaed2cd0 -b wip/hvf
    curl 'https://patchwork.kernel.org/series/485309/mbox/'|git am --3way
    ```
    なお、macOS 11.3.1, Xcode 12.5 では C++20 の `version` ヘッダーが、`VERSION`ファイルと混同されてビルドできないので、現状(`3bbaed2cd0`)では以下のパッチも必要。
    ```
    curl 'https://patchwork.kernel.org/series/474841/mbox/'|git am --3way
    ```
    5. QEMU をビルドする
    12 changes: 9 additions & 3 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    Here is easy steps to try Windows 10 on ARM or Ubuntu for ARM64 on your Apple Silicon Mac.
    Enjoy!

    > NOTE: that this is current, 2/8/2021 state. I think it will be improved in upcoming a few months.
    > NOTE: that this is current, 5/23/2021 state. I think it will be improved in upcoming a few months.
    ## Running Windows 10 on ARM

    @@ -35,8 +35,14 @@ Enjoy!
    ```
    cd qemu
    git checkout d0dddab40e -b wip/hvf
    curl 'https://patchwork.kernel.org/series/418581/mbox/'|git am --3way
    git checkout 3bbaed2cd0 -b wip/hvf
    curl 'https://patchwork.kernel.org/series/485309/mbox/'|git am --3way
    ```
    Current `3bbaed2cd0`, on macOS 11.3.1 with Xcode 12.5, due to C++20 `version` header file conflicts with `VERSION` file, QEMU build fails. Therefore, you also need apply next patch.
    ```
    curl 'https://patchwork.kernel.org/series/474841/mbox/'|git am --3way
    ```
    5. Build QEMU
  12. @niw niw revised this gist Mar 22, 2021. 2 changed files with 44 additions and 4 deletions.
    24 changes: 22 additions & 2 deletions README.ja.md
    Original file line number Diff line number Diff line change
    @@ -78,7 +78,7 @@ ARM 版 Windows 10 や Ubuntu を Apple Silicon な Mac で動かす簡単な方
    VHDX のままだとかなりの頻度でイメージが壊れる印象があるので qcow2 に変換しておく。
    ```
    qemu-img convert -p -O qcow2 ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_21286.VHDX ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_21286.qcow2
    qemu-img convert -p -O qcow2 ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_21286.VHDX ~/Downloads/Windows10.qcow2
    ```
    10. Windows 10 を起動する
    @@ -100,7 +100,7 @@ ARM 版 Windows 10 や Ubuntu を Apple Silicon な Mac で動かす簡単な方
    -device intel-hda \
    -device hda-duplex \
    -nic user,model=virtio \
    -drive file=~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_21286.qcow2,format=qcow2,if=none,id=boot,cache=writethrough \
    -drive file=~/Downloads/Windows10.qcow2,format=qcow2,if=none,id=boot,cache=writethrough \
    -device nvme,drive=boot,serial=boot
    ```
    @@ -157,6 +157,26 @@ VirtIO NIC は標準では有効にならないので、デバイスドライバ
    Next をクリックして `Red Hat VertIO Ethernet Adapter` をインストール。
    ## ディスクイメージをを縮小する
    ディスクイメージである `Windows10.qcow2` ファイルは Windows Update などをすると容量まで大きくなる可能性があり、たとえファイルを削除してもディスクイメージのサイズは減りません。
    そのため、ディスクサイズが大きくなりすぎた場合などは使用していない領域を開放する必要があります。
    1. Windows 10に付属の Defragment and Optimize Drives で、`C:` ドライブを Optimize する。
    2. [SDelete](https://docs.microsoft.com/en-us/sysinternals/downloads/sdelete) をダウンロードする。`SDelete64a -z C:` を Administrator Command Prompt で実行し、使用していない領域をゼロで埋める。
    このコマンドの実行はしばらくかかります。この時、ディスクイメージがとても大きくなるので Mac の空き容量に注意。
    3. Windows を終了して、以下のコマンドを Mac で実行する。
    このコマンドの実行はしばらくかかります。また縮小したディスクイメージは別に作られるので Mac の空き容量に注意。
    ```
    qemu-img convert -O qcow2 ~/Downloads/Windows10.qcow2 ~/Downloads/Windows10_compacted.qcow2
    ```
    4. `Windows10.qcow2` を縮小した `Windows10_compacted.qcow2` で置き換え。
    ## Ubuntu Server for ARM64 を動かす
    ARM 版 Windows 10 を動かす手順に従って QEMU を準備して、Ubuntu Server for ARM64 をダウンロードしてインストールします。
    24 changes: 22 additions & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -81,7 +81,7 @@ Enjoy!
    It seems that VHDX often gets broken while it is being used, so probably it is better to convert it to qcow2 format before using it.
    ```
    qemu-img convert -p -O qcow2 ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_21286.VHDX ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_21286.qcow2
    qemu-img convert -p -O qcow2 ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_21286.VHDX ~/Downloads/Windows10.qcow2
    ```
    10. Run Windows 10
    @@ -103,7 +103,7 @@ Enjoy!
    -device intel-hda \
    -device hda-duplex \
    -nic user,model=virtio \
    -drive file=~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_21286.qcow2,format=qcow2,if=none,id=boot,cache=writethrough \
    -drive file=~/Downloads/Windows10.qcow2,format=qcow2,if=none,id=boot,cache=writethrough \
    -device nvme,drive=boot,serial=boot
    ```
    @@ -162,6 +162,26 @@ device driver.
    Click Next to install `Red Hat VertIO Ethernet Adapter`.
    ## Compact disk image
    The disk image, `Windows10.qcow2`, can be getting bigger as using Windows, especially after Windows Update, even if you delete files.
    If the disk image is too big, you may want to compact it to release free space.
    1. Use Defragment and Optimize Drives coming with Windows 10 and optimize `C:` drive.
    2. Download [SDelete](https://docs.microsoft.com/en-us/sysinternals/downloads/sdelete). Run `SDelete64a -z C:` by using Administrator Command Prompt to zero-fill free space.
    This may take a while. While running this command, the disk image can be bigger, so be sure Mac have enough free space.
    3. Shutdown Windows, then run next command on Mac. This may take a while.
    Since this command creates compacted disk image, so be sure Mac has enough free space.
    ```
    qemu-img convert -O qcow2 ~/Downloads/Windows10.qcow2 ~/Downloads/Windows10_compacted.qcow2
    ```
    4. Replace `Windows10.qcow2` by compacted `Windows10_compacted.qcow2`.
    ## Running Ubuntu Server for ARM64
    Follow the same steps for Windows 10 to prepare QEMU, then download Ubuntu Server for ARM64 and install it.
  13. @niw niw revised this gist Mar 21, 2021. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -102,6 +102,7 @@ Enjoy!
    -device usb-tablet \
    -device intel-hda \
    -device hda-duplex \
    -nic user,model=virtio \
    -drive file=~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_21286.qcow2,format=qcow2,if=none,id=boot,cache=writethrough \
    -device nvme,drive=boot,serial=boot
    ```
  14. @niw niw revised this gist Mar 8, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -228,7 +228,7 @@ Follow the previous instructions to run Ubuntu Server for ARM64.
    Then, you will get `QEMU_EFI.fd` and `QEMU_VARS.fd` in `Build/ArmVirtQemu-AARCH64/DEBUG_GCC5/FV`.
    - The easiest way to take these files to the host macOS, run Remove Login on macOS then `scp` these to `10.0.2.2`.
    - The easiest way to take these files to the host macOS, run Remote Login on macOS then `scp` these to `10.0.2.2`.
    - To build these on x86_64 environment, use following toolchain to cross compile.
    ```
  15. @niw niw revised this gist Feb 9, 2021. 2 changed files with 20 additions and 16 deletions.
    18 changes: 10 additions & 8 deletions README.ja.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@

    ARM 版 Windows 10 や Ubuntu を Apple Silicon な Mac で動かす簡単な方法です。

    > メモ: 2020年12月19日現時点での方法で、今後おおきく改善されていくと思います(だといいな。)
    > メモ: 2021年2月8日現時点での方法で、今後まだ改善されていくと思います。
    ## ARM 版 Windows 10 を動かす

    @@ -11,12 +11,16 @@ ARM 版 Windows 10 や Ubuntu を Apple Silicon な Mac で動かす簡単な方
    ```
    xcode-select --install
    ```
    2. MacPorts で QEMU の依存ライブラリをインストール
    2. ARM64 対応の Homebrew で QEMU の依存ライブラリをインストール
    https://www.macports.org/install.php
    **すでに x86_64 の Homebrew が `/usr/local` にインストールされている場合は削除するなどしてください。**
    **x86_64 の Homebrew では QEMU がビルドできません**
    https://brew.sh/
    ```
    sudo port install ninja pkgconfig glib2 libpixman
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    brew install ninja pkgconfig glib pixman
    ```
    3. QEMU のソースコードをとってくる
    @@ -29,14 +33,12 @@ ARM 版 Windows 10 や Ubuntu を Apple Silicon な Mac で動かす簡単な方
    ```
    cd qemu
    git checkout master -b wip/hvf
    curl 'https://patchwork.kernel.org/series/400619/mbox/'|git am --3way
    git checkout d0dddab40e -b wip/hvf
    curl 'https://patchwork.kernel.org/series/418581/mbox/'|git am --3way
    ```
    5. QEMU をビルドする
    必ず `PATH` や `PKG_CONFIG_PATH` を書き換えるなどして、Homebrew などの **x86_64 のツールがインストールされていないか、有効になっていないことを確認してください**。
    ```
    mkdir build
    cd build
    18 changes: 10 additions & 8 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    Here is easy steps to try Windows 10 on ARM or Ubuntu for ARM64 on your Apple Silicon Mac.
    Enjoy!

    > NOTE: that this is current, 12/19/2020 state. It will be improved a lot in upcoming a few months... (I hope.)
    > NOTE: that this is current, 2/8/2021 state. I think it will be improved in upcoming a few months.
    ## Running Windows 10 on ARM

    @@ -13,12 +13,16 @@ Enjoy!
    xcode-select --install
    ```
    2. Install MacPorts and QEMU dependencies.
    2. Install ARM64 Homebrew and QEMU dependencies.
    https://www.macports.org/install.php
    **If you already installed x86_64 Homebrew in `/usr/local`, please uninstall it.**
    **It's not possible to build QEMU with x86_64 Homebrew**
    https://brew.sh/
    ```
    sudo port install ninja pkgconfig glib2 libpixman
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    brew install ninja pkgconfig glib pixman
    ```
    3. Clone QEMU source code.
    @@ -31,14 +35,12 @@ Enjoy!
    ```
    cd qemu
    git checkout master -b wip/hvf
    curl 'https://patchwork.kernel.org/series/400619/mbox/'|git am --3way
    git checkout d0dddab40e -b wip/hvf
    curl 'https://patchwork.kernel.org/series/418581/mbox/'|git am --3way
    ```
    5. Build QEMU
    Before building, **please ensure there are no x86_64 tools enabled**, such the one installed by Homebrew, by rewriting `PATH` or `PKG_CONFIG_PATH`.
    ```
    mkdir build
    cd build
  16. @niw niw revised this gist Jan 17, 2021. 2 changed files with 4 additions and 4 deletions.
    4 changes: 2 additions & 2 deletions README.ja.md
    Original file line number Diff line number Diff line change
    @@ -76,7 +76,7 @@ ARM 版 Windows 10 や Ubuntu を Apple Silicon な Mac で動かす簡単な方
    VHDX のままだとかなりの頻度でイメージが壊れる印象があるので qcow2 に変換しておく。
    ```
    qemu-img convert -p -O qcow2 ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_21286.VHDX ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_20231.qcow2
    qemu-img convert -p -O qcow2 ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_21286.VHDX ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_21286.qcow2
    ```
    10. Windows 10 を起動する
    @@ -98,7 +98,7 @@ ARM 版 Windows 10 や Ubuntu を Apple Silicon な Mac で動かす簡単な方
    -device intel-hda \
    -device hda-duplex \
    -nic user,model=virtio \
    -drive file=~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_20231.qcow2,format=qcow2,if=none,id=boot,cache=writethrough \
    -drive file=~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_21286.qcow2,format=qcow2,if=none,id=boot,cache=writethrough \
    -device nvme,drive=boot,serial=boot
    ```
    4 changes: 2 additions & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -79,7 +79,7 @@ Enjoy!
    It seems that VHDX often gets broken while it is being used, so probably it is better to convert it to qcow2 format before using it.
    ```
    qemu-img convert -p -O qcow2 ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_21286.VHDX ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_20231.qcow2
    qemu-img convert -p -O qcow2 ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_21286.VHDX ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_21286.qcow2
    ```
    10. Run Windows 10
    @@ -100,7 +100,7 @@ Enjoy!
    -device usb-tablet \
    -device intel-hda \
    -device hda-duplex \
    -drive file=~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_20231.qcow2,format=qcow2,if=none,id=boot,cache=writethrough \
    -drive file=~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_21286.qcow2,format=qcow2,if=none,id=boot,cache=writethrough \
    -device nvme,drive=boot,serial=boot
    ```
  17. @niw niw revised this gist Jan 17, 2021. 2 changed files with 2 additions and 2 deletions.
    2 changes: 1 addition & 1 deletion README.ja.md
    Original file line number Diff line number Diff line change
    @@ -76,7 +76,7 @@ ARM 版 Windows 10 や Ubuntu を Apple Silicon な Mac で動かす簡単な方
    VHDX のままだとかなりの頻度でイメージが壊れる印象があるので qcow2 に変換しておく。
    ```
    qemu-img convert -p -O qcow2 ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_20231.VHDX ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_20231.qcow2
    qemu-img convert -p -O qcow2 ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_21286.VHDX ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_20231.qcow2
    ```
    10. Windows 10 を起動する
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -79,7 +79,7 @@ Enjoy!
    It seems that VHDX often gets broken while it is being used, so probably it is better to convert it to qcow2 format before using it.
    ```
    qemu-img convert -p -O qcow2 ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_20231.VHDX ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_20231.qcow2
    qemu-img convert -p -O qcow2 ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_21286.VHDX ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_20231.qcow2
    ```
    10. Run Windows 10
  18. @niw niw revised this gist Dec 28, 2020. 2 changed files with 2 additions and 2 deletions.
    2 changes: 1 addition & 1 deletion README.ja.md
    Original file line number Diff line number Diff line change
    @@ -30,7 +30,7 @@ ARM 版 Windows 10 や Ubuntu を Apple Silicon な Mac で動かす簡単な方
    ```
    cd qemu
    git checkout master -b wip/hvf
    curl 'https://patchwork.kernel.org/series/400619/mbox/'|git am
    curl 'https://patchwork.kernel.org/series/400619/mbox/'|git am --3way
    ```
    5. QEMU をビルドする
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -32,7 +32,7 @@ Enjoy!
    ```
    cd qemu
    git checkout master -b wip/hvf
    curl 'https://patchwork.kernel.org/series/400619/mbox/'|git am
    curl 'https://patchwork.kernel.org/series/400619/mbox/'|git am --3way
    ```
    5. Build QEMU
  19. @niw niw revised this gist Dec 20, 2020. 2 changed files with 10 additions and 4 deletions.
    7 changes: 5 additions & 2 deletions README.ja.md
    Original file line number Diff line number Diff line change
    @@ -46,9 +46,11 @@ ARM 版 Windows 10 や Ubuntu を Apple Silicon な Mac で動かす簡単な方
    6. QEMU 用の EDK II OVMF EFI イメージをダウンロードする。
    https://gist.github.com/niw/4f1f9bb572f40d406866f23b3127919b/raw/f4dab9b407a2ea94ceceb7905eb918e1317bc251/QEMU_EFI-a096471-edk2-stable202011.tar.gz
    このイメージは `stable202011` タグに、`QemuRamfb.c` に追加の解像度を足したものです。
    ソースコードからビルドする場合は以下を参照のこと。
    https://gist.github.com/niw/4f1f9bb572f40d406866f23b3127919b/raw/f546faea68f4149c06cca88fa67ace07a3758268/QEMU_EFI-cb438b9-edk2-stable202011-with-extra-resolutions.tar.gz
    さらに解像度を追加するなど、ソースコードからビルドする場合は以下を参照のこと。
    7. pflash イメージを作って、画面サイズなどを設定する不揮発なストレージを準備する
    @@ -102,6 +104,7 @@ ARM 版 Windows 10 や Ubuntu を Apple Silicon な Mac で動かす簡単な方
    - イメージへのパスなどは適宜修正してください。
    - TianoCore のロゴが出ている時に `ESC` を押して、`Device Manager`、`OVMF Platform Configuration`、`Change Preferred Resolution for Next Boot` と進めて解像度を変更できます。
    - 解像度を追加するには、下記の「EDK II の OVMF EFI イメージをビルドする」に従って `OvmfPkg/QemuRamfbDxe/QemuRamfb.c` を変更し、新しい `QEMU_EFI.fd` を作ってください。
    - `-device usb-mouse` より `-device usb-tablet` を使うことでマウスカーソルがロックされなくなり使いやすくなります。
    - `-device intel-hda -device hda-duplex` でオーディオが使えるようになります。
    - `-nic user,model=virtio` がネットワークインターフェイスです。有効にするには以下を参照してください。
    7 changes: 5 additions & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -48,9 +48,11 @@ Enjoy!
    6. Download pre-build EDK II OVMF EFI image for QEMU.
    https://gist.github.com/niw/4f1f9bb572f40d406866f23b3127919b/raw/f4dab9b407a2ea94ceceb7905eb918e1317bc251/QEMU_EFI-a096471-edk2-stable202011.tar.gz
    This EFI image is built from `stable202011` tag with additional resolutions in `QemuRamfb.c`.
    To build it from the source code, see the following section.
    https://gist.github.com/niw/4f1f9bb572f40d406866f23b3127919b/raw/f546faea68f4149c06cca88fa67ace07a3758268/QEMU_EFI-cb438b9-edk2-stable202011-with-extra-resolutions.tar.gz
    To build it from the source code for adding more resolutions, see the following section.
    7. Prepare pflash for non-volatile variable store, such as screen resolution.
    @@ -104,6 +106,7 @@ Enjoy!
    - Please modify each path to the image depends on your environment.
    - Hit `ESC` while you see TianoCore, then `Device Manager`, `OVMF Platform Configuration`, `Change Preferred Resolution for Next Boot` to change screen resolution.
    - To add more resolutions, follow "Build EDK II OVMF EFI image from the source code" below and modify `OvmfPkg/QemuRamfbDxe/QemuRamfb.c` then build new `QEMU_EFI.fd`.
    - Use `-device usb-tablet` instead of `-device usb-mouse` allows transparently moving mouse cursor.
    - `-device intel-hda -device hda-duplex` to enable audio.
    - `-nic user,model=virtio` is the network interface. To enable it, see the following section.
  20. @niw niw revised this gist Dec 20, 2020. 2 changed files with 2 additions and 2 deletions.
    2 changes: 1 addition & 1 deletion README.ja.md
    Original file line number Diff line number Diff line change
    @@ -188,7 +188,7 @@ ARM 版 Windows 10 を動かす手順に従って QEMU を準備して、Ubuntu
    -device intel-hda \
    -device hda-duplex \
    -drive file=~/Downloads/ubuntu.qcow2,if=virtio,cache=writethrough \
    -cdrom ~/Downloads/ubuntu-20.04.1-live-server-arm64.iso \
    -cdrom ~/Downloads/ubuntu-20.04.1-live-server-arm64.iso
    ```
    - 指示に従ってインストールしたあとは `-cdrom` は不要です。
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -192,7 +192,7 @@ Follow the same steps for Windows 10 to prepare QEMU, then download Ubuntu Serve
    -device intel-hda \
    -device hda-duplex \
    -drive file=~/Downloads/ubuntu.qcow2,if=virtio,cache=writethrough \
    -cdrom ~/Downloads/ubuntu-20.04.1-live-server-arm64.iso \
    -cdrom ~/Downloads/ubuntu-20.04.1-live-server-arm64.iso
    ```
    - Follow instruction to install Ubuntu Server. Once it's installed, `-cdrom` argument is not needed.
  21. @niw niw revised this gist Dec 20, 2020. 2 changed files with 2 additions and 2 deletions.
    2 changes: 1 addition & 1 deletion README.ja.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # ARM 版 Windows 10 や Ubuntu for ARM64 を Apple Silicon な Mac で動かす

    ARM 版 Windows 10 を Apple Silicon な Mac で動かす簡単な方法です。
    ARM 版 Windows 10 や Ubuntu を Apple Silicon な Mac で動かす簡単な方法です。

    > メモ: 2020年12月19日現時点での方法で、今後おおきく改善されていくと思います(だといいな。)
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # How to run Windows 10 on ARM or Ubuntu for ARM64 in QEMU on Apple Silicon Mac

    Here is easy steps to try Windows 10 on ARM on your Apple Silicon Mac.
    Here is easy steps to try Windows 10 on ARM or Ubuntu for ARM64 on your Apple Silicon Mac.
    Enjoy!

    > NOTE: that this is current, 12/19/2020 state. It will be improved a lot in upcoming a few months... (I hope.)
  22. @niw niw revised this gist Dec 20, 2020. No changes.
  23. @niw niw revised this gist Dec 20, 2020. 2 changed files with 142 additions and 46 deletions.
    94 changes: 71 additions & 23 deletions README.ja.md
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,10 @@
    # ARM 版 Windows 10 を Hypervisor.framework のパッチをあてた QEMU を使って Apple Silicon な Mac で動かす
    # ARM 版 Windows 10 や Ubuntu for ARM64 を Apple Silicon な Mac で動かす

    ARM 版 Windows 10 を Apple Silicon な Mac で動かす簡単な方法です。

    > メモ: 2020年12月12日現時点での方法で、今後おおきく改善されていくと思います(だといいな。)
    > メモ: 2020年12月19日現時点での方法で、今後おおきく改善されていくと思います(だといいな。)
    ## 手順
    ## ARM 版 Windows 10 を動かす

    1. Xcode を App Store で、あるいは Command Line Tools を Apple Silicon な Mac にインストール

    @@ -44,25 +44,13 @@ ARM 版 Windows 10 を Apple Silicon な Mac で動かす簡単な方法です
    make -j
    ```
    6. Windows 10 on ARM Insider Preview をダウンロードする
    https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewARM64
    7. VHDX から qcow2 に変換する
    VHDX のままだとかなりの頻度でイメージが壊れる印象があるので qcow2 に変換しておく。
    ```
    qemu-img convert -p -O qcow2 ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_20231.VHDX ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_20231.qcow2
    ```
    8. QEMU 用の EDK II OVMF EFI イメージをダウンロードする。
    6. QEMU 用の EDK II OVMF EFI イメージをダウンロードする。
    https://gist.github.com/niw/4f1f9bb572f40d406866f23b3127919b/raw/f4dab9b407a2ea94ceceb7905eb918e1317bc251/QEMU_EFI-a096471-edk2-stable202011.tar.gz
    ソースコードからビルドする場合は以下を参照のこと。
    9. pflash イメージを作って、画面サイズなどを設定する不揮発なストレージを準備する
    7. pflash イメージを作って、画面サイズなどを設定する不揮発なストレージを準備する
    `QEMU_EFI-....tar.gz` をダウンロードしたディレクトリで以下を実行。
    @@ -77,6 +65,18 @@ ARM 版 Windows 10 を Apple Silicon な Mac で動かす簡単な方法です
    - このステップは省略可能。その場合は次のステップで `-drive ...,if=pflash,...` のかわりに `-bios ~/Downloads/QEMU_EFI.fd` を指定すること。ただし、EFI での変更が保存されなくなります。
    8. Windows 10 on ARM Insider Preview をダウンロードする
    https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewARM64
    9. VHDX から qcow2 に変換する
    VHDX のままだとかなりの頻度でイメージが壊れる印象があるので qcow2 に変換しておく。
    ```
    qemu-img convert -p -O qcow2 ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_20231.VHDX ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_20231.qcow2
    ```
    10. Windows 10 を起動する
    ```
    @@ -152,16 +152,56 @@ VirtIO NIC は標準では有効にならないので、デバイスドライバ
    Next をクリックして `Red Hat VertIO Ethernet Adapter` をインストール。
    ## Ubuntu Server for ARM64 を動かす
    ARM 版 Windows 10 を動かす手順に従って QEMU を準備して、Ubuntu Server for ARM64 をダウンロードしてインストールします。
    1. 上記の手順 1 から 7 までに従って QEMU を準備する。
    2. 空のディスクイメージを作成する。
    ```
    ./qemu-img create -f qcow2 ~/Downloads/ubuntu.qcow2 40G
    ```
    3. Ubuntu Server for ARM64 をダウンロードする。
    https://ubuntu.com/download/server/arm
    4. Ubuntu Server for ARM をインストールする。
    ```
    ./qemu-system-aarch64 \
    -monitor stdio \
    -M virt,highmem=off \
    -accel hvf \
    -cpu cortex-a72 \
    -smp 4 \
    -m 4096 \
    -drive file=~/Downloads/pflash0.img,format=raw,if=pflash,readonly=on \
    -drive file=~/Downloads/pflash1.img,format=raw,if=pflash \
    -device virtio-gpu-pci \
    -display default,show-cursor=on \
    -device qemu-xhci \
    -device usb-kbd \
    -device usb-tablet \
    -device intel-hda \
    -device hda-duplex \
    -drive file=~/Downloads/ubuntu.qcow2,if=virtio,cache=writethrough \
    -cdrom ~/Downloads/ubuntu-20.04.1-live-server-arm64.iso \
    ```
    - 指示に従ってインストールしたあとは `-cdrom` は不要です。
    ## EDK II の OVMF EFI イメージをビルドする
    OVMF EFI イメージをソースコードから作る場合、とりあえず簡単にビルドするには、まず VMWare Fusion とか、VirtualBox とかを Intel Mac (そう、Intel Mac が必要)にインストールして、Ubuntu などの Linux が必要になります
    上記の手順に従って Ubuntu Server for ARM64 を動かします
    1. EDK II のソースコードを取ってくる。
    ```
    git clone https://github.com/tianocore/edk2.git
    git clone --depth 1 --branch edk2-stable202011 https://github.com/tianocore/edk2.git
    cd edk2
    git checkout edk2-stable202011 # stable ってタグされてるやつがいい
    git submodule update --init --recursive
    ```
    @@ -170,10 +210,18 @@ OVMF EFI イメージをソースコードから作る場合、とりあえず
    2. ビルドする
    ```
    sudo apt install iasl python3 python3-distutils uuid-dev gcc-aarch64-linux-gnu
    sudo apt install iasl python3 python3-distutils uuid-dev make g++
    source edksetup.sh
    make -C BaseTools
    env GCC5_AARCH64_PREFIX=aarch64-linux-gnu- build -a AARCH64 -t GCC5 -p ArmVirtPkg/ArmVirtQemu.dsc
    build -a AARCH64 -t GCC5 -p ArmVirtPkg/ArmVirtQemu.dsc
    ```
    `Build/ArmVirtQemu-AARCH64/DEBUG_GCC5/FV` に `QEMU_EFI.fd` とかができるはず。
    `Build/ArmVirtQemu-AARCH64/DEBUG_GCC5/FV` に `QEMU_EFI.fd` と `QEMU_VARS.fd` ができるはず。
    - これらのファイルを簡単に macOS ホストに取り出すには macOS でリモートアクセスを有効にして `scp` で `10.0.2.2` にコピー。
    - x86_64 の環境でビルドする場合は以下のツールチェーンでクロスコンパイル。
    ```
    sudo apt install gcc-aarch64-linux-gnu
    env GCC5_AARCH64_PREFIX=aarch64-linux-gnu- build -a AARCH64 -t GCC5 -p ArmVirtPkg/ArmVirtQemu.dsc
    ```
    94 changes: 71 additions & 23 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,11 @@
    # How to run Windows 10 on ARM in QEMU with Hypervisor.framework patches on Apple Silicon Mac
    # How to run Windows 10 on ARM or Ubuntu for ARM64 in QEMU on Apple Silicon Mac

    Here is easy steps to try Windows 10 on ARM on your Apple Silicon Mac.
    Enjoy!

    > NOTE: that this is current, 12/12/2020 state. It will be improved a lot in upcoming a few months... (I hope.)
    > NOTE: that this is current, 12/19/2020 state. It will be improved a lot in upcoming a few months... (I hope.)
    ## Steps
    ## Running Windows 10 on ARM

    1. Install Xcode from App Store or install Command Line Tools on your Mac running on Apple Silicon.

    @@ -46,25 +46,13 @@ Enjoy!
    make -j
    ```
    6. Download Windows 10 on ARM Insider Preview
    https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewARM64
    7. Convert VHDX downloaded Windows image to qcow2 format
    It seems that VHDX often gets broken while it is being used, so probably it is better to convert it to qcow2 format before using it.
    ```
    qemu-img convert -p -O qcow2 ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_20231.VHDX ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_20231.qcow2
    ```
    8. Download pre-build EDK II OVMF EFI image for QEMU.
    6. Download pre-build EDK II OVMF EFI image for QEMU.
    https://gist.github.com/niw/4f1f9bb572f40d406866f23b3127919b/raw/f4dab9b407a2ea94ceceb7905eb918e1317bc251/QEMU_EFI-a096471-edk2-stable202011.tar.gz
    To build it from the source code, see the following section.
    9. Prepare pflash for non-volatile variable store, such as screen resolution.
    7. Prepare pflash for non-volatile variable store, such as screen resolution.
    In the directory where you downloaded `QEMU_EFI-....tar.gz`, run following commands.
    @@ -80,6 +68,18 @@ Enjoy!
    - This step is optional, you can use `-bios ~/Downloads/QEMU_EFI.fd` instead of `-drive ...if=pflash` lines in the next step,
    but in that case, any changes in EFI will not be persistent.
    8. Download Windows 10 on ARM Insider Preview
    https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewARM64
    9. Convert VHDX downloaded Windows image to qcow2 format
    It seems that VHDX often gets broken while it is being used, so probably it is better to convert it to qcow2 format before using it.
    ```
    qemu-img convert -p -O qcow2 ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_20231.VHDX ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_20231.qcow2
    ```
    10. Run Windows 10
    ```
    @@ -156,16 +156,56 @@ device driver.
    Click Next to install `Red Hat VertIO Ethernet Adapter`.
    ## Running Ubuntu Server for ARM64
    Follow the same steps for Windows 10 to prepare QEMU, then download Ubuntu Server for ARM64 and install it.
    1. Follow previous steps from 1. to 7. to prepare QEMU.
    2. Create an empty disk image.
    ```
    ./qemu-img create -f qcow2 ~/Downloads/ubuntu.qcow2 40G
    ```
    3. Download Ubuntu Server for ARM64
    https://ubuntu.com/download/server/arm
    4. Install Ubuntu Server for ARM
    ```
    ./qemu-system-aarch64 \
    -monitor stdio \
    -M virt,highmem=off \
    -accel hvf \
    -cpu cortex-a72 \
    -smp 4 \
    -m 4096 \
    -drive file=~/Downloads/pflash0.img,format=raw,if=pflash,readonly=on \
    -drive file=~/Downloads/pflash1.img,format=raw,if=pflash \
    -device virtio-gpu-pci \
    -display default,show-cursor=on \
    -device qemu-xhci \
    -device usb-kbd \
    -device usb-tablet \
    -device intel-hda \
    -device hda-duplex \
    -drive file=~/Downloads/ubuntu.qcow2,if=virtio,cache=writethrough \
    -cdrom ~/Downloads/ubuntu-20.04.1-live-server-arm64.iso \
    ```
    - Follow instruction to install Ubuntu Server. Once it's installed, `-cdrom` argument is not needed.
    ## Build EDK II OVMF EFI image from the source code
    To build this from the source code, you may need to setup Linux environment. Install VMWare Fusion or VirtualBox on your Intel Mac (Yes, Intel Mac.) and install Ubuntu.
    Follow the previous instructions to run Ubuntu Server for ARM64.
    1. Checkout EDK II source code.
    ```
    git clone https://github.com/tianocore/edk2.git
    git clone --depth 1 --branch edk2-stable202011 https://github.com/tianocore/edk2.git
    cd edk2
    git checkout edk2-stable202011 # or any stable tagged commit
    git submodule update --init --recursive
    ```
    @@ -175,10 +215,18 @@ To build this from the source code, you may need to setup Linux environment. Ins
    2. Build it.
    ```
    sudo apt install iasl python3 python3-distutils uuid-dev gcc-aarch64-linux-gnu
    sudo apt install iasl python3 python3-distutils uuid-dev make g++
    source edksetup.sh
    make -C BaseTools
    env GCC5_AARCH64_PREFIX=aarch64-linux-gnu- build -a AARCH64 -t GCC5 -p ArmVirtPkg/ArmVirtQemu.dsc
    build -a AARCH64 -t GCC5 -p ArmVirtPkg/ArmVirtQemu.dsc
    ```
    Then, you will get `QEMU_EFI.fd` in `Build/ArmVirtQemu-AARCH64/DEBUG_GCC5/FV`.
    Then, you will get `QEMU_EFI.fd` and `QEMU_VARS.fd` in `Build/ArmVirtQemu-AARCH64/DEBUG_GCC5/FV`.
    - The easiest way to take these files to the host macOS, run Remove Login on macOS then `scp` these to `10.0.2.2`.
    - To build these on x86_64 environment, use following toolchain to cross compile.
    ```
    sudo apt install gcc-aarch64-linux-gnu
    env GCC5_AARCH64_PREFIX=aarch64-linux-gnu- build -a AARCH64 -t GCC5 -p ArmVirtPkg/ArmVirtQemu.dsc
    ```
  24. @niw niw revised this gist Dec 19, 2020. 2 changed files with 2 additions and 2 deletions.
    2 changes: 1 addition & 1 deletion README.ja.md
    Original file line number Diff line number Diff line change
    @@ -170,7 +170,7 @@ OVMF EFI イメージをソースコードから作る場合、とりあえず
    2. ビルドする
    ```
    apt install iasl python3 python3-distutils uuid-dev gcc-aarch64-linux-gnu
    sudo apt install iasl python3 python3-distutils uuid-dev gcc-aarch64-linux-gnu
    source edksetup.sh
    make -C BaseTools
    env GCC5_AARCH64_PREFIX=aarch64-linux-gnu- build -a AARCH64 -t GCC5 -p ArmVirtPkg/ArmVirtQemu.dsc
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -175,7 +175,7 @@ To build this from the source code, you may need to setup Linux environment. Ins
    2. Build it.
    ```
    apt install iasl python3 python3-distutils uuid-dev gcc-aarch64-linux-gnu
    sudo apt install iasl python3 python3-distutils uuid-dev gcc-aarch64-linux-gnu
    source edksetup.sh
    make -C BaseTools
    env GCC5_AARCH64_PREFIX=aarch64-linux-gnu- build -a AARCH64 -t GCC5 -p ArmVirtPkg/ArmVirtQemu.dsc
  25. @niw niw revised this gist Dec 19, 2020. 2 changed files with 5 additions and 3 deletions.
    2 changes: 1 addition & 1 deletion README.ja.md
    Original file line number Diff line number Diff line change
    @@ -170,7 +170,7 @@ OVMF EFI イメージをソースコードから作る場合、とりあえず
    2. ビルドする
    ```
    apt install install iasl python3 python3-distutils uuid-dev gcc-aarch64-linux-gnu
    apt install iasl python3 python3-distutils uuid-dev gcc-aarch64-linux-gnu
    source edksetup.sh
    make -C BaseTools
    env GCC5_AARCH64_PREFIX=aarch64-linux-gnu- build -a AARCH64 -t GCC5 -p ArmVirtPkg/ArmVirtQemu.dsc
    6 changes: 4 additions & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -110,7 +110,9 @@ Enjoy!
    ## Enable the internet
    VirtIO NIC is not enabled by default. To make it works, you need to install device driver.
    VirtIO NIC is not enabled by default. To make it works, you need to
    device driver.
    1. Download VirtIO device drivers ISO from [Fedora Project](https://docs.fedoraproject.org/en-US/quick-docs/creating-windows-virtual-machines-using-virtio-drivers/index.html#virtio-win-direct-downloads).
    @@ -173,7 +175,7 @@ To build this from the source code, you may need to setup Linux environment. Ins
    2. Build it.
    ```
    apt install install iasl python3 python3-distutils uuid-dev gcc-aarch64-linux-gnu
    apt install iasl python3 python3-distutils uuid-dev gcc-aarch64-linux-gnu
    source edksetup.sh
    make -C BaseTools
    env GCC5_AARCH64_PREFIX=aarch64-linux-gnu- build -a AARCH64 -t GCC5 -p ArmVirtPkg/ArmVirtQemu.dsc
  26. @niw niw revised this gist Dec 12, 2020. 2 changed files with 6 additions and 6 deletions.
    6 changes: 3 additions & 3 deletions README.ja.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@

    ARM 版 Windows 10 を Apple Silicon な Mac で動かす簡単な方法です。

    > メモ: 2020年12月5日現時点での方法で、今後おおきく改善されていくと思います(だといいな。)
    > メモ: 2020年12月12日現時点での方法で、今後おおきく改善されていくと思います(だといいな。)
    ## 手順

    @@ -29,8 +29,8 @@ ARM 版 Windows 10 を Apple Silicon な Mac で動かす簡単な方法です
    ```
    cd qemu
    git checkout v5.2.0 -b wip/hvf
    curl https://patchwork.kernel.org/series/395899/mbox/|git am
    git checkout master -b wip/hvf
    curl 'https://patchwork.kernel.org/series/400619/mbox/'|git am
    ```
    5. QEMU をビルドする
    6 changes: 3 additions & 3 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    Here is easy steps to try Windows 10 on ARM on your Apple Silicon Mac.
    Enjoy!

    > NOTE: that this is current, 12/5/2020 state. It will be improved a lot in upcoming a few months... (I hope.)
    > NOTE: that this is current, 12/12/2020 state. It will be improved a lot in upcoming a few months... (I hope.)
    ## Steps

    @@ -31,8 +31,8 @@ Enjoy!
    ```
    cd qemu
    git checkout v5.2.0 -b wip/hvf
    curl https://patchwork.kernel.org/series/395899/mbox/|git am
    git checkout master -b wip/hvf
    curl 'https://patchwork.kernel.org/series/400619/mbox/'|git am
    ```
    5. Build QEMU
  27. @niw niw revised this gist Dec 8, 2020. 2 changed files with 8 additions and 14 deletions.
    11 changes: 4 additions & 7 deletions README.ja.md
    Original file line number Diff line number Diff line change
    @@ -16,11 +16,9 @@ ARM 版 Windows 10 を Apple Silicon な Mac で動かす簡単な方法です
    https://www.macports.org/install.php
    ```
    sudo port install ninja pkgconfig texinfo libtool glib2 libpixman
    sudo port install ninja pkgconfig glib2 libpixman
    ```
    sudo とか使いたくない場合は、`/opt/local` を `$USER:staff` で作って、MacPorts をソースコードからインストールすれば可能です。
    3. QEMU のソースコードをとってくる
    ```
    @@ -31,22 +29,21 @@ ARM 版 Windows 10 を Apple Silicon な Mac で動かす簡単な方法です
    ```
    cd qemu
    git checkout d73c46e -b wip/hvf # これは現時点での `origin/master` のコミット。
    git checkout v5.2.0 -b wip/hvf
    curl https://patchwork.kernel.org/series/395899/mbox/|git am
    ```
    5. QEMU をビルドする
    必ず `PATH` や `PKG_CONFIG_PATH` を書き換えるなどして、Homebrew などの **x86_64 のツールがインストールされていないか、有効になっていないことを確認してください**。
    ```
    mkdir build
    cd build
    ../configure --target-list=aarch64-softmmu --enable-cocoa
    make -j
    ```
    - x86_64 な Homebrew などを使っている場合は問題がおこるので、`PATH` などを書き換えるなどして無効にしておくこと。
    - Intel な Mac と比べて、めっちゃ速い。
    6. Windows 10 on ARM Insider Preview をダウンロードする
    https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewARM64
    11 changes: 4 additions & 7 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -18,11 +18,9 @@ Enjoy!
    https://www.macports.org/install.php
    ```
    sudo port install ninja pkgconfig texinfo libtool glib2 libpixman
    sudo port install ninja pkgconfig glib2 libpixman
    ```
    Don’t want to use sudo with MacPorts? Create `/opt/local` as `$USER:staff` and install MacPorts from the source code.
    3. Clone QEMU source code.
    ```
    @@ -33,22 +31,21 @@ Enjoy!
    ```
    cd qemu
    git checkout d73c46e -b wip/hvf # This is current `origin/master` when this document is written.
    git checkout v5.2.0 -b wip/hvf
    curl https://patchwork.kernel.org/series/395899/mbox/|git am
    ```
    5. Build QEMU
    Before building, **please ensure there are no x86_64 tools enabled**, such the one installed by Homebrew, by rewriting `PATH` or `PKG_CONFIG_PATH`.
    ```
    mkdir build
    cd build
    ../configure --target-list=aarch64-softmmu --enable-cocoa
    make -j
    ```
    - Please disable any x86_64 tools such as the one installed by Homebrew, please rewrite `PATH` etc to disable them.
    - This is surprisingly fast on Apple Silicon Mac, compare to Intel Mac...
    6. Download Windows 10 on ARM Insider Preview
    https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewARM64
  28. @niw niw revised this gist Dec 6, 2020. 2 changed files with 2 additions and 2 deletions.
    2 changes: 1 addition & 1 deletion README.ja.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@

    ARM 版 Windows 10 を Apple Silicon な Mac で動かす簡単な方法です。

    > メモ: 2020年12月2日現時点での方法で、今後おおきく改善されていくと思います(だといいな。)
    > メモ: 2020年12月5日現時点での方法で、今後おおきく改善されていくと思います(だといいな。)
    ## 手順

    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    Here is easy steps to try Windows 10 on ARM on your Apple Silicon Mac.
    Enjoy!

    > NOTE: that this is current, 12/2/2020 state. It will be improved a lot in upcoming a few months... (I hope.)
    > NOTE: that this is current, 12/5/2020 state. It will be improved a lot in upcoming a few months... (I hope.)
    ## Steps

  29. @niw niw revised this gist Dec 6, 2020. 2 changed files with 32 additions and 14 deletions.
    23 changes: 16 additions & 7 deletions README.ja.md
    Original file line number Diff line number Diff line change
    @@ -51,17 +51,26 @@ ARM 版 Windows 10 を Apple Silicon な Mac で動かす簡単な方法です
    https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewARM64
    7. QEMU 用の EDK II OVMF EFI イメージをダウンロードする。
    7. VHDX から qcow2 に変換する
    VHDX のままだとかなりの頻度でイメージが壊れる印象があるので qcow2 に変換しておく。
    ```
    qemu-img convert -p -O qcow2 ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_20231.VHDX ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_20231.qcow2
    ```
    8. QEMU 用の EDK II OVMF EFI イメージをダウンロードする。
    https://gist.github.com/niw/4f1f9bb572f40d406866f23b3127919b/raw/f4dab9b407a2ea94ceceb7905eb918e1317bc251/QEMU_EFI-a096471-edk2-stable202011.tar.gz
    ソースコードからビルドする場合は以下を参照のこと。
    8. pflash イメージを作って、画面サイズなどを設定する不揮発なストレージを準備する
    9. pflash イメージを作って、画面サイズなどを設定する不揮発なストレージを準備する
    `QEMU_EFI-....tar.gz` をダウンロードしたディレクトリで、例えば `~/Downloads` などで、以下を実行
    `QEMU_EFI-....tar.gz` をダウンロードしたディレクトリで以下を実行
    ```
    cd ~/Downloads
    tar xzvf QEMU_EFI-*.tar.gz
    dd if=/dev/zero of=pflash0.img bs=1m count=64
    dd if=/dev/zero of=pflash1.img bs=1m count=64
    @@ -71,7 +80,7 @@ ARM 版 Windows 10 を Apple Silicon な Mac で動かす簡単な方法です
    - このステップは省略可能。その場合は次のステップで `-drive ...,if=pflash,...` のかわりに `-bios ~/Downloads/QEMU_EFI.fd` を指定すること。ただし、EFI での変更が保存されなくなります。
    9. Windows 10 を起動する
    10. Windows 10 を起動する
    ```
    ./qemu-system-aarch64 \
    @@ -90,7 +99,7 @@ ARM 版 Windows 10 を Apple Silicon な Mac で動かす簡単な方法です
    -device intel-hda \
    -device hda-duplex \
    -nic user,model=virtio \
    -drive file=~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_20231.VHDX,if=none,id=boot,cache=writethrough \
    -drive file=~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_20231.qcow2,format=qcow2,if=none,id=boot,cache=writethrough \
    -device nvme,drive=boot,serial=boot
    ```
    @@ -123,10 +132,10 @@ VirtIO NIC は標準では有効にならないので、デバイスドライバ
    Windows を起動して Windows スタートボタン を右クリック、Command Prompt (Admin) を選択。
    BCDEdit を使ってテスト署名されたデバイスドライバを有効にする。
    bcdedit を使ってテスト署名されたデバイスドライバを有効にする。
    ```
    Bcdedit.exe -set TESTSIGNING ON
    bcdedit.exe -set TESTSIGNING ON
    ```
    このあと Windows を再起動すること。
    23 changes: 16 additions & 7 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -53,17 +53,26 @@ Enjoy!
    https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewARM64
    7. Download prebild EDK II OVMF EFI image for QEMU.
    7. Convert VHDX downloaded Windows image to qcow2 format
    It seems that VHDX often gets broken while it is being used, so probably it is better to convert it to qcow2 format before using it.
    ```
    qemu-img convert -p -O qcow2 ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_20231.VHDX ~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_20231.qcow2
    ```
    8. Download pre-build EDK II OVMF EFI image for QEMU.
    https://gist.github.com/niw/4f1f9bb572f40d406866f23b3127919b/raw/f4dab9b407a2ea94ceceb7905eb918e1317bc251/QEMU_EFI-a096471-edk2-stable202011.tar.gz
    To build it from the source code, see the following section.
    8. Prepare pflash for non-volatile variable store, such as screen resolution.
    9. Prepare pflash for non-volatile variable store, such as screen resolution.
    In the directory where you downloaded `QEMU_EFI-....tar.gz`, for example, `~/Downloads`,
    In the directory where you downloaded `QEMU_EFI-....tar.gz`, run following commands.
    ```
    cd ~/Downloads
    tar xzvf QEMU_EFI-*.tar.gz
    dd if=/dev/zero of=pflash0.img bs=1m count=64
    dd if=/dev/zero of=pflash1.img bs=1m count=64
    @@ -74,7 +83,7 @@ Enjoy!
    - This step is optional, you can use `-bios ~/Downloads/QEMU_EFI.fd` instead of `-drive ...if=pflash` lines in the next step,
    but in that case, any changes in EFI will not be persistent.
    9. Run Windows 10
    10. Run Windows 10
    ```
    ./qemu-system-aarch64 \
    @@ -92,7 +101,7 @@ Enjoy!
    -device usb-tablet \
    -device intel-hda \
    -device hda-duplex \
    -drive file=~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_20231.VHDX,if=none,id=boot,cache=writethrough \
    -drive file=~/Downloads/Windows10_InsiderPreview_Client_ARM64_en-us_20231.qcow2,format=qcow2,if=none,id=boot,cache=writethrough \
    -device nvme,drive=boot,serial=boot
    ```
    @@ -125,10 +134,10 @@ VirtIO NIC is not enabled by default. To make it works, you need to install devi
    Boot Windows, then right click Windows Start button, then select Command Prompt (Admin).
    Use BCDEdit to enable test-signed device drivers.
    Use bcdedit to enable test-signed device drivers.
    ```
    Bcdedit.exe -set TESTSIGNING ON
    bcdedit.exe -set TESTSIGNING ON
    ```
    Then reboot Windows.
  30. @niw niw revised this gist Dec 5, 2020. 2 changed files with 2 additions and 2 deletions.
    2 changes: 1 addition & 1 deletion README.ja.md
    Original file line number Diff line number Diff line change
    @@ -32,7 +32,7 @@ ARM 版 Windows 10 を Apple Silicon な Mac で動かす簡単な方法です
    ```
    cd qemu
    git checkout d73c46e -b wip/hvf # これは現時点での `origin/master` のコミット。
    curl https://patchwork.kernel.org/series/394901/mbox/|git am
    curl https://patchwork.kernel.org/series/395899/mbox/|git am
    ```
    5. QEMU をビルドする
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -34,7 +34,7 @@ Enjoy!
    ```
    cd qemu
    git checkout d73c46e -b wip/hvf # This is current `origin/master` when this document is written.
    curl https://patchwork.kernel.org/series/394901/mbox/|git am
    curl https://patchwork.kernel.org/series/395899/mbox/|git am
    ```
    5. Build QEMU