Windows XP on Android


Windows XP on Samsung Galaxy S2 - bootingRecently I have been playing around to get Windows XP to run on my Android ARM phone. After a decent amount of research and work done (found out later that most of it was unnecessary) I managed to get proof of concept Windows XP to boot with usable resolution, network, and no sound ;) Like my colleague said: Just because I can ;)

Photos for the curious

Windows XP on Android - boot logo

Windows XP on Android - boot logo

Windows XP on Android - minesweeper

Windows XP on Android - minesweeper

Windows XP on Android - web browser

Windows XP on Android - web browser

The host (Samsung Galaxy S2, a tablet, etc)

First of all you need to face the obvious – your device is ARM-based, and Windows XP runs on x86 architecture. So what you need is an x86 emulator, and it means that it will not be that fast. QEMU is a popular and efficient choice nowadays when you need different architectures for your guest systems. Years ago I used it to run a proof of concept PPC Mac OS X on an Intel box, it was terribly slow on an Athlon 900 but it worked.

Fortunately on my Android I had already prepared a playground for myself to run various things – see my post about Gentoo on Android (it is not a must, but the article assumes you do have Gentoo – otherwise you are on your own to get qemu for your device). Aside from allowing you to run a ssh server, cron and maybe a web server – Gentoo provides you the power to compile a lot of software natively (build=host=target) to ARM as your CHOST in /etc/make.conf states.

To save your time I will tell you ahead, that none of currently available (in portage) versions of qemu worked for this setup. I did not take precise notes, but it is ok to assume that versions 0.11.1* will cause your Windows XP to bluescreen and reboot before the boot logo appears and will drop you to “last good configuration” boot menu. The 1.0* will just say “Aborted” on the command line. Version 0.9 and before should theoretically work (these have a different approach to TCG/TCI), but require either working gcc-3 to build or heavy patching for gcc-4.

I have tried both approaches. The gcc-3 (for qemu-0.9) does not support armv7a. Cross building for amrv6j with gcc-4 was a horror and it failed anyway, triggering even unmasking newer binutils as the linker had emulation mode / ABI issues. Trust me, this is not a good way to go. To build with gcc-4 – there are no high quality qemu patches (tried many various combinations) to successfully build specifically on an ARM host for x86 target. These just failed, and actually even if it built successfully I would not trust the emulation to work reliably anyway.

So the quick answer is: go with qemu-0.15.1. It is not included in the portage tree (not even as masked), but you can add it to your local overlay using qemu-0.11.1-r1.ebuild as a base ebuild (the -r1 includes a security patch). You will need to disable the code handling –disable-kqemu configure option, get the usual files directory and digest the ebuild. Here is mine qemu-0.15.1.ebuild file.

Edit your /etc/make.conf to include:

QEMU_SOFTMMU_TARGETS="arm i386"
QEMU_USER_TARGETS="arm i386"

I put the ARM target just for any future use. Then issue:

# emerge -va qemu

And have it compiled and ready for use. But wait, there’s more.

To access your Windows XP you will need a VNC client. This simplifies the overall GUI situation greatly. Get androidVNC from the market and set Input Method to Touchpad, as it seems to work reasonably well (scrolls the display following the cursor, single tap – single click, double tap – right click, slow double tap – double click). You might also want to get Hackers Keyboard to be able to type in a more comfortable way if you don’t have it yet. In androidVNC – tap and hold, and then tap the small keypad icon on the bottom to get to the keyboard.

And last but not least – have at minimum 2GB free storage on your device for disk image file.

The guest

Now when your Android is ready you should set-up the system image (actually a disk image is enough). I used qemu-0.11.1 on my main workstation. This version exposes a different network card to the guest than qemu-0.15 by default, but we will handle that later on, when running it on the destination device (model=ne2k_pci).

Create an x86 machine, with 128 (works) or 256 (better) MB of memory and a 2G (at least) disk image. Get a GUI (qemulator?) or in short:

# dd if=/dev/zero of=./qemu-winxp2g.bin bs=1M count=2048
# qemu -M pc -m 256 -net nic,vlan=0 -net user,vlan=0,hostname=emu \
  -hda ./qemu-winxp2g.bin -cdrom ./windows-xp-install.iso \
  -boot d -usbdevice tablet -localtime

Now do the usual installation (skip time zone auto adjustment for daylight saving) and remember to install all the updates. Additional things you might want to change then:

  • set-up a classic start menu to easily fit it on screen (or leave the fancy one for easy tapping)
  • disable grouping on the task bar (well, maybe this one is just my personal)
  • disable system restore
  • disable automatic updates (with all the consequences…)
  • tweak screen resolution to 800×480 (for Galaxy S2 at least) – there are many ways to do that, including using emulated vmware vga driver (man qemu) or using Powerstrip – however I did not do this, as I can live with scrolling up and down, and some settings windows just fit

When done, shut down your Windows XP properly and transfer the disk image to the phone location of your choice, say:

# adb shell mkdir /mnt/sdcard/external_sd/VM
# adb push ./qemu-winxp2g.bin /mnt/sdcard/external_sd/VM/

And yes, your SD card will get traffic like a real hard disk with all the swapping included, so bear it in mind if one day it dies unexpectedly.

Running

Get a root shell on the phone. In the Gentoo chroot in this example you might just ssh to your phone – and issue:

# qemu -M pc -m 256 -net nic,vlan=0,model=ne2k_pci \
  -net user,vlan=0,hostname=emu -vnc 127.0.0.1:2 -localtime \
  -hda /android/mnt/sdcard/external_sd/VM/qemu-winxp2g.bin \
  -boot c -usbdevice tablet

Then run androidVNC and connect to 127.0.0.1:5902. You might get disconnected while the system changes resolutions during the boot process. Just reconnect.

After ~10 minutes your Windows XP on Android should be booted and ready for use.

Miscellaneous

To simplify the process with excellent apps Tasker and System Settings plugin create a new task WinXP with the following:

- Tasker / Tasks / New Task / “WinXP”:

- add: Secure Settings / Configuration – Edit / Run Command with (or equivalent):

/data/gentoo/do-cmd qemu -M pc -m 256 -net nic,vlan=0,model=ne2k_pci \
  -net user,vlan=0,hostname=emu -vnc 127.0.0.1:2 -localtime \
  -hda /android/mnt/sdcard/external_sd/VM/qemu-winxp2g.bin \
  -boot c -usbdevice tablet

- add: Load App / androidVNC

Save, and then add a Tasker Task widget to the home screen, select this task and an icon, and you’re done.

And that’s about it. I did not configure sound, since my Gentoo has some issues with the phone’s alsa device – sound is pretty much stuck and heard just after a volume change – probably device access is conflicting with Android’s processes (well, fuser says nothing), so I left it as is for now. I hope you have a dual-core device to handle qemu load. I haven’t tried with qemu -smp 2, but YMMV.

One more photo if you have reached that far ;)

Windows XP on Android - web browser

Windows XP on Android - web browser

Have fun!

About these ads

12 Responses to “Windows XP on Android”


  1. 1 sush 30.07.2012 at 20:09

    hello !
    i want to run windows xp in android tab. it has all the requirements but i dont know how to do it.
    i have problems understanding your post about windows xp in android.
    i wnt to do it using vnc server in my android and i have the windows xp .img file too.
    so please tell me the proper guide and i dont know about gentoo and all so help me please!
    either reply me with the proper method to run xp in android or email me the same sushobhit333@yahoo.com
    (i will be highly obliged to you)

    • 2 Apatsch 30.07.2012 at 23:04

      Hi!

      The article describes a bit geeky way I have done it, but as I see there are plenty of ways to do it with this kind of emulation. You might want to do a search or two on XDA-Developers forums, I think there’s a guide with using a special app for that. Don’t forget to check Google Play too.

      Regards,
      Marcin

      • 3 sush 31.07.2012 at 23:09

        thanks Marcin, i have already searched a lot on xda and other top forums of the world but no result for exactly what i require. i appreciate that you are trying to help but i have tried bochs, qemu, dosbox etc in my android tab but either it crashes or super slow so nothing is working in aproper way.
        .
        .
        i think xp can be made to run in vnc server using img of xp as you did . the only thing i require is a android terminal emulator .sh script (the latest back track 5 is running in my android the similar way ie using .sh and android vnc)
        i thing similar work can be done with xp also.
        .

        please-please-please help me with this matter.

      • 4 Apatsch 03.08.2012 at 01:51

        If it is super slow, then it …works. In short – you cannot expect much performance because of architecture difference.

        Your device is most probably equipped with an ARM processor, and Windows things run on x86 architecture. Both of these are quite different and have their own advantages and disadvantages. Therefore it is technically impossible to run x86 software natively, so the qemu/bochs in this case is emulating an x86 system in software. This is very different from virtualization (which makes use of native execution), since it requires interpreting binary bytecode by software, and this basically means that it requires a lot of processing power. Bottom line is that it is more of an academic experiment and proof of concept, than a real-world application for production use.

        If you really need a mobile Windows environment, just get a netbook :)

        Regards,
        Marcin

  2. 5 sush 03.08.2012 at 19:14

    thank you very much.

  3. 6 Ravi 18.02.2013 at 14:58

    Performance?

    • 7 Apatsch 18.02.2013 at 16:51

      Quite poor, as I explain in the other comments. Just a proof of concept. But if you need an XP handy in an emergency, and there’s nothing else available…

  4. 8 Sabith pkcmnr 26.05.2013 at 13:16

    hai, iam sabith pkc,
    i need a help.When i opening bochs on my tablet pc it shows not reponding too!

    can you help me plz

    it will be a good thing for me

    please sent help into the Email below:

    sabithpkcmnr@gmail.com

  5. 9 zaid 08.08.2013 at 12:02

    Please tell me can i do it on my micromax funbook p300

  6. 10 navid 21.09.2013 at 18:42

    what a long process,anyone cannot easily understand the steps of doing whatever you mentiond above,why won’t you give explanation about the steps in easy manner mentioning them one after another.thank you.

  7. 11 Srecko 17.11.2013 at 00:03

    Please,make video… Or write step by step in an easy way… I do not understand this… I’m sorry if I wrote bad…

  8. 12 ag 18.04.2014 at 09:22

    wow:)


What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




Enter your email address to follow this blog and receive notifications of new posts by email.

Join 47 other followers

Marcin Gałkowski

Seasoned admin, Linux hacker, Android fan, Gentoo enthusiast. Doing digital audio on Linux when time permits. At work: IT Team Lead (+labs, +datacenters...)

Latest Tweets

BTC tip jar:

1HprotPu2zi8v8hFZBqVfcTYL7ZYVYBruo

Follow

Get every new post delivered to your Inbox.

Join 47 other followers

%d bloggers like this: