27 December 2020

Intel x86_64 Windows (not Arm Windows) successfully runs on Apple Silicon M1 MacBook Air - how to

Some articles started to report about Arm Windows running on Apple Silicon Mac, but Arm Windows is not major in industry yet.

I thought a different story.

The macOS itself provides Virtualization Framework to execute Linux virtual machine guest OS easily on macOS, and it is the same on Apple Silicon
Therefore Apple Silicon Mac can execute Arm Linux guest OS.
Linux OS provides QEMU virtualization that can use both KVM (hardware-based kernel virtualization) and software-based CPU emulation.
It means Intel Linux can execute Intel Linux and Arm Linux guest, and Arm Linux can execute Arm/Intel guest.
QEMU is flexible enough to execute Windows guest, so Arm Linux will be able to execute Intel Windows guest.

Following is how to execute Intel x86 Windows on Apple Silicon M1 Mac.

  1. Download a pre-build Arm Ubuntu image and virtualization app for Apple Silicon Mac.
    One of the examples is @mibosshard work at https://twitter.com/mibosshard/status/1331558536728506368
    It is a package of Arm Ubuntu Linux and SimpleVM tool.
    Download it, and extract.
  2. I was not able to customize/build the code of SimpleVM, and found other virtualization app vftool at https://github.com/evansm7/vftool
    Download the source code.
  3. Pre-build Ubuntu does not have enough disk space, so I changed the vftool code as that CD drive will be assumed to disk drive (replace readOnly:true to false), and build.
    Open the vftool project with Xcode, locate readOnly and replace "true" with "false", and do build.
  4. Xcode places the built app at a temporary path. So, I find it by [Show in Finder].
  5. Open macOS terminal and create an empty HDD image by command:
    % cd <<to where Ubuntu_SimpleVM was extracted>>
    % dd if=/dev/zero of=ext4fs-data03.img bs=20g count=0 seek=6

  6. Execute the guest OS by:
    % /Users/xxx/Library/Developer/Xcode/xxx/Products/Debug/vftool -k vmlinuz -i initrd -a "console=hvc0 root=dev/vda" -d image  -m 9000 -c ext4fs-data03.img -net -p 8
  7. Open another terminal and connect to the guest by:
    % screen /dev/ttys001
  8. Ubuntu Linux boot messages and Login prompt will be appeared.
    The root password is described in README.txt of Ubutu_SimpleVM.
    Login as root.
  9. Initialize the filesystem (we will store Windows image at /Data) and mount it by:
    # ls -l /dev/vd*
    # mkfs.ext4 /dev/vdb
    # mkdir /Data
    # mount /dev/sdb /Data
  10. Install QEMU by:
    # apt-get install qemu binfmt-support qemu-user-static docker.io
  11. Install qemu x86_64 from https://github.com/dbhi/qus and https://hub.docker.com/r/aptman/qus/ by:
    # docker run --rm --privileged aptman/qus -s -- -p x86_64
  12. Download a pre-build Intel Windows 10 image from https://app.vagrantup.com/peru/boxes/windows-10-enterprise-x64-eval by (will download 7.5GB, and the password is described at the site):
    # cd /Data
    # wget https://app.vagrantup.com/peru/boxes/windows-10-enterprise-x64-eval/versions/20201203.01/providers/libvirt.box
  13. Extract disk image by (results 15GB):
    # mv libvirt.box w10-box.tar.gz
    # tar xzvf w10-box.tar.gz box.img
    # mv box.img w10-box.img
  14. Before start the guest, check the Ubuntu IP address of emp0s1 interface (will be used for vnc connection) by:
    # ip a
  15. Then, start the Intel Windows by:
    # qemu-system-x86_64 w10-box.img -m size=6000 -vnc :0,password  -monitor stdio -usb -device usb-tablet -accel tcg,thread=multi  -cpu qemu64 -smp 8,maxcpus=8,sockets=2
  16. A prompt (qemu) will be appeared, then set your favorite password for vnc by:
    (qemu) change vnc password
  17. Return to macOS Finder and [Go] => [Connect to Server...], and specify following as Server Address and enter your password:
    vnc://192.168.64.xxx
  18. Finally, QEMU window will be appeared to display the progress of the Intel Windows boot.
    It takes about 30 minutes for the first time and consumes 100% of 8 cores even on Apple M1, because this is software emulation.

This is just an experimental work as beginning.
I will post the performance comparison later.
If you have interest, leave your comment or say Like at my twitter post.

[2021-01-17] UTM app is easy way to execute Arm and Intel guest operating system, so I wrote a post about it.

26 November 2020

Making Intel code on Apple Silicon Mac is "cc -arch x86_64", and open shell as Intel is "arch -arch x86_64"

The first thing we will do with new computer is execute hello world program.
This is how on Apple Silicon Mac:

% mkdir tmp
% cd tmp
   [Open TextEdit and enter following code]
#include <stdio.h>
int main () {
    printf ( "hello world.\n");
}
   [Then, [Fromat] => [Plain Text], and [File] => [Save as...] ~/tmp/a.c]
% cc a.c

   [xcode tools will be installed on demand]
% ls -l

% ./a.out

The app generated is Apple Silicon app, and you can check by:

% file a.out

You can also build a Intel app as following:

% mv a.out a_arm64.out
% cc -arch x86_64 a.c
% mv a.out a_x86.out
% ./a_x86.out

   [Rosetta 2 will installed on demand]
% file a_x86.out

In addition, this is how to make Universal app:

% lipo -create -output a.out a_x86.out a_arm64.out
% ./a.out

macOS will execute Intel only app by using Rosetta 2.
With Universal app, macOS will select Arm binary by default.
If you want to change the default, you can execute the shell program as Intel by:

% arch -arch x86_64 zsh
   [can be confirmed with one of following]
% uname -m
% echo %CPUTYPE
% machine

Otherwise, change to Arm from Intel environment:

% arch -arch arm64e zsh
   [can be confirmed with one of following]
% uname -m
% echo %CPUTYPE
% machine

[Japanese version of this post]

23 February 2020

Comparing coming Windows 10 2004 Fluent Design icons with current Metro icons

As announced at Microsoft Design blog (subtitled: Introducing the new Windows 10 icons in Fluent Design 2020-02-21), icon designs on Windows 10 will be refreshed as Fluent Design system on coming Windows 10 Version 2004 (20H1).
I made a figure to compare the icons side by side.
 I don't know some of the icons in Fluent  figure.
If you know what is the missing or find my mistake, please let me know.

[Japanese version of this post]

22 August 2017

Google public releases Android 8.0 Oreo name, and silent releases Android Oreo beta firmwares for Nexus/Pixel

https://www.android.com/eclipse/
Google announced eclipse event site, and released the name of Android 8.0 Oreo with short animation (https://www.youtube.com/watch?v=twZggnNbFqo).
It is not bad, but I continue to find additional.

We can receive Beta Firmware of Android 8.0 Oreo for Nexus 5X/6P/Player, Pixel and Pixel C/XL.
From Android Developer site at
https://developer.android.com/index.html

points to Android O Developer preview at
https://developer.android.com/about/versions/o/index.html
and then we can access to Beta Firmware from
https://developer.android.com/about/versions/o/download.html

Enjoy Oreo!

[Japanese version of this post]

02 May 2013

OldExpose on Mountain Lion 10.8 within standard features

OldExpose on Mountain Lion 10.8
Uncheck [Group win...]
Mission Control on Mountain Lion 10.8/Lion 10.7
Exposé on Snow Leopard 10.6
[from my past post]

Exposé on Tiger 10.4/Leopard 10.6 (OldExpose)
I found OldExpose solution (original Exposé mode) for Mac OS X Mountain Lion 10.8 at last.
If you know Tiger 10.4 or Leopard 10.5 Exposé, you might love it, and hate it on OS X newer than 10.5.

The first screen shot is OldExplse on Mountain Lion.
To enable OldExpose, open [System Preferences], select [Mission Control], and Uncheck [Group windows by application].

Comparing Exposés from Tiger 10.4/Leopard 10.5 to Lion 10.7/Lion 10.8, original Exposé (so called OldExpose) has been the best Exposé ever.
Disabling [Group windows by application] simulates OldExpose very well.
I let you easily select the target window from many windows opens, by preserving the original window places and sizes compared to others.
[Japanese version of this post]

12 November 2012

iPad mini price formula, I fuond; $40 x screen size, and for Retina $50 x screen size

from article by AppBank
I found simple iPad series price calculation formula that I had never seen in internet.
That covers iPod touch as somebody said as "iPad mini is large iPod touch."
  • non Retina iPad's price is $40 multiplied by display size in inch.
    For Retina model, $50 multiplied by display size.
  • Above is for 16GB model. For 32GB and 64GB, each time when doubling the memory, plus $100.
  • With Cellular, plus $130
That's all.
Let me verify it using table.

iPod touch 5geniPad miniiPad 2iPad 4gen
display size47.99.79.7

16GBmultiplied by $40
329399
Retina; multiplied by $50199 (not available)

499
with Cellular; plus $130
459529629

32GB; plus $100multiplied by $40
429

Retina; multiplied by $50299

599
with Cellular; plus $130
559
729

64GB; plus $200multiplied by $40
529

Retina; multiplied by $50399

699
with Cellular; plus $130
659
829
In this table, I wrote real price.
But gaps between calculation are smaller than 4%.
Now let me simulate several predicts for iPad mini.
  • If iPad mini had 7 inchi display similar to other tables, the price was $40*7=$280. I think it is not competitive nor innovative.
  • If iPad mini was with 8GB, the price was $329-$100=$229. I could be $199, same as Nexus 7 at that time, but they lowered soon.
  • If iPad mini with Retina display wil be released, the price will be $50*7.9=$395~$399. At the time it will be released, iPad 2 in that price will be retired, and iPad mini should be major member in iPad series.
How do you think this?
I'm looking forward to half and/or one year later.
[Japanese version of this post]