[Wine] Re: Is it possible to port (part of) WINE to iOS?

SpawnHappyJake wineforum-user at winehq.org
Sat Jun 4 01:05:37 CDT 2011


The reason why I've been gone from the forums for the last few days is because I've been researching this.
There are ways of getting apps into iOS other than the app store. And I'm not necessarily referring to jailbreaking, though that is one method. Please note that jailbreaking is no longer illegal.
You might have memories of Pre-iPod Touch iPods showing up as a storage disk that could be mounted, viewed in the file browser, and you could copy files on and off and thus use it as an external hard drive. iPhones, iPod Touches, and I'm assuming iPads, do not do "show" themselves as hard drives, are not recognized as such by the kernel (heart of the operating system), and thus cannot be mounted or even formatted. I found out about some geniuses that figured out how to mount an iPhone or iPod Touch or iPad as a hard drive in Linux. For some more details on why this is a big deal and what's going on with this mounting business, I wrote this: http://pastebin.com/L806qmYZ.
Anyways, it was quite the trick to mount an iOS device. I thought, "Maybe people could just mount their iOS device in Linux, and copy over a WINE app into the applications folder. I think I'll post that as something that might work. Wait - I'd have to admit that I haven't tried it. That wouldn't sound good. I better try first." So I did. It doesn't let you copy apps off or put a file or a folder where it shows your apps being. Oddly, it only showed apps that I put on, and not the apps that came with the iPhone. I wonder if this is different with a jailbroken iPhone, and if you could just copy a WINE app over like that. I also wonder if you would see more files and folders. Prehaps a non-jailbroken iPhone is not mounted at its root directory. If you could, I think you have to put an SHA1 hash of the app in a plist file somewhere for it to allow you to run the app.
Next thought, "Hmm. Can they get a WINE app through Cydia? What exactly is jailbreaking? Will that let it in somehow?" Wikipedia says that jailbreaking is simply removing all the restrictions from an iPhone.
You open source people are going to love this: the jailbroken iPhone crowd has set up repositories and APT stuff for installing apps onto iPhones. So I would think that you wouldn't even need to go through Cydia to get a WINE app onto a jailbroken iPhone. Just make an APT repository for the WINE app, and they do the equivalent of adding your PPA, and they tell it to install! Furthermore, Cydia says the packages actually follow Debian format: http://cydia.saurik.com/faq/repositories.html
Then my third main thought occurred to me, "These apps in the AppStore don't just appear there. Someone has to make them. That implies the makers of the apps tested them as they were making them. That implies that they got their app onto their iPhone for testing without the AppStore. Surely Apple provides a way of doing this without jailbreaking." They do.
The way it works is that all apps ran by a non-jailbroken iPhone have to have a signature on them. Unless an app has a trusted signature, the iPhone won't run it. So before you can even test an app you are working on, you are supposed to request a signature from Apple, approved by Apple, and that new signature you obtain is in the "trusted signatures list". You can sign apps with that signature. Then you have to set your iPhone to "Use for Development": http://developer.apple.com/library/ios/#documentation/Xcode/Conceptual/iphone_development/128-Managing_Devices_and_Digital_Identities/devices_and_identities.html#//apple_ref/doc/uid/TP40007959-CH4-SW2 .
Then you set up this special "Portal" through which you can put your signature onto the iPhone, which has been set to "Use for Development", allowing the iPhone to run any apps signed by your signature. Then you can work on an app, sign it, and move it to your iPhone for testing, through the Portal.
Or instead of getting a signature issued by Apple, you can create your own signature, called self-signing. You can mark a jailbroken-iPhone (though I haven't seen it explicitly stated that you can't do this self-signing workaround on a non-jailbroken iPhone) to "Use for Development", and load the self-signed signature to the iPhone through the "Portal", and you can sign the app you made with that signature, put the app onto the iPhone with through the "Portal", and it will run on the iPhone because the signature is in it's "trusted" list. See here: http://www.alexwhittemore.com/?p=398
Now what about developing an iOS app in Linux? There's some people working on making that a possibility, the iphone-dev project: http://code.google.com/p/iphone-dev/
To tie this back to Android, a jailbroken iPhone can be dual booted with Android.

There is another issue to overcome, that is indeed possible to overcome. The assemblby instuction set of the iOS device processor. Processors are arrangements of electrical components arrangened in such a way that they process and give outputs for certain commands. Different processors are designed to process different commands. The set of commands a given processor can process is its assembly instruction set. The main one right now is the x86 instruction set. If you wrote a program in terms of x86 instructions, it would only work on processors designed for that instruction set. If you wrote a program in a set of terms not related to a processor, but were instead terms created to be easier to think in, called a programming language, and then had a translator (compiler) for each instruction set that could convert that programming language's terms into assembly instructions for a given processor's instruction set, you could translate (compile) your program to work on whatever processor you want to. Except that most programs don't run directly on the processor; instead they run on the kernel which runs on the processor and passes code to the processor. So programs are actually compiled taking into consideration both kernel and processor instruction set. The kernel is effectively the processor as far as an average program is concerned, to my understanding.
How is this a problem? WINE is a kernel that runs already compiled programs. That means WINE is running programs already in terms of a processor's instruction set - the x86 instruction set. These instuctions get executed by being passed to the processor. The iOS device processor uses an ARM instruction set rather than an x86 instruction set. How can WINE pass x86 instructions on to a processor that only does ARM instructions, and have the instructions executed? It can't. They have to be converted in live time from x86 to ARM to run on the ARM processor, the A4.
The thing that translates the instructions is called a processor emulator. You create a program that can process x86 instructions, probably with a programming language. If you used a programming language, you compile this program for an ARM processor, taking into consideration the iOS kernel that it will directly be running on. You run the WINE kernel on top of this virtual processor.
Darwine is a project that put WINE on a processor emulator, so we know that it is possible. See here: http://en.wikipedia.org/wiki/Darwine. How did I know Darwine had an emulator? What else but a James McKenzie post, of course!







More information about the wine-users mailing list