Daniel Eran Dilger
A number of people are working to crack open the iPhone in order to use it on alternative mobile networks or to install or modify software. What they are finding is more interesting to me because it reveals hints as to what latent features of the iPhone remain to be unlocked in software. Here’s a look at what’s been discovered about the core OS inside the iPhone, starting at the kernel.
La arquitectura del OSX del iPhone: el kernel Mach y la RAM – planetamac
Traducción: Oscar Reixa
[Leopard, Vista and the iPhone OS X Architecture]
[iPhone OS X Architecture: Disk, Shell, and Password Security]
[iPhone OS X Architecture: the BSD Unix Userland]
[iPhone OS X Architecture: Cocoa Frameworks and Mobile Mac Apps]
The iPhone Kernel.
Yes it’s Mach. Remember how many so-called experts insisted that Apple was stuck with Mach, but would move to the Linux kernel in a heartbeat if only it could, and perhaps as soon as Mach maven Avie Tevanian left Apple?
I countered the initial rumors that Apple would move to the Linux kernel last year, and repeated the same thing before WWDC 07, when the meme evolved into an imminent migration to Sun’s Solaris kernel.
There’s nothing wrong with Mach. In reality, it fits Apple’s needs quite well. If Apple were desperate to jump to some other OS architecture, the iPhone would certainly be the place to ditch its existing kernel and run with something else, just as Microsoft created a new kernel for Windows CE rather than using the NT kernel from its Windows NT/2000/XP/Vista desktop products.
[More Predictions for WWDC 2007: Solaris, Google, Surround: Mac OS X with the Solaris Kernel]
[The Microkernel Myth: What is Mach?]
[The Linux Kernel Myth: Much ado about Mach]
[OS X vs. WinCE: How iPhone Differs from Windows Mobile]
The iPhone’s Mach kernel uses the same I/O Kit architecture as Mac OS X, allowing Apple to reuse a lot of the mature code that is already proven to work on the Mac. The I/O Kit in Mach uses kexts or kernel extensions to add low level hardware support.
Because they plug into the kernel, it is critical that they are as solid and mature as possible. When software crashes outside of the kernel, it can usually be restarted. When something crashes within the kernel, it results in a kernel panic and the system becomes unusable and has to be rebooted. That’s bad.
Apple recommends against adding kernel extensions to Mac OS X unless there is no other way to accomplish the task at hand. That’s why people complain when they find third party software installing kexts without good reason; it frequently results in stability problems.
Apple has followed its own advice by using only two sets of kexts in the iPhone. The first sets up USB input, specifically for a user human interface device, and more specifically the multitouch screen:
The second pair of extensions relate to VPN or Virtual Private Networks. These extensions tie into the network stack to provide a way to securely tunnel encrypted traffic over a public network like the Internet.
Comparing the iPhone Kernel to the Mac’s.
The iPhone’s kernel and kexts are not identical to the Mac. For example, desktop Macs have kexts for the iSight camera, audio and video hardware, power and thermal management, and serial interfaces. The iPhone has no kext equivalents for any of these, despite having the hardware. The iPhone’s PPP.kext is also missing.
It appears that support for all of the hardware in the iPhone is built into the iPhone’s kernel, rather than being implemented as a kext. On the Mac, different models have different hardware, so a modular set of plugin is required. There is currently no variety in the hardware in shipping iPhones.
Having the I/O Kit architecture in place on the iPhone demonstrates Apple plans to expand hardware support in the future, and won’t have to resort to bolting on support for an extension mechanism after the fact. Because Mach and I/O Kit were built from the start to accommodate a wide range of hardware, the iPhone was able to inherit this functionality and use it as is without returning to the drawing board to build a “mobile OS kernel.”
Among the things accounted for in Mach is sophisticated power management, which intelligently powers up planes of devices as the system goes into standby or to sleep. That helps explain why the first generation of the iPhone has remarkable battery life, commonly twice that of comparable smartphones.
System RAM and Flash RAM.
Another significant difference between the iPhone and other smartphones relates to system RAM and Flash RAM storage. The pundits haven’t said anything about this, because it is embarrassing to other manufacturers, and it is apparently politically incorrect to point out that the iPhone blazes a new trail in technology.