The iPhone Porting Guide

Sunday, May 16, 2010

Something helpful for those who are interested (but don't know where to start) in the "porting openiboot to other devices" task under "Jobs for Reverse Engineers".....

Base addresses, GPIO ports, i2c slave addresses, interrupt numbers, clock gates, etc. will all be available from ioreg -l on your jailbroken device. Check your ioreg -l output with the ioreg -l / device tree outputs of already ported platforms to see quickly which drivers are likely to be compatible with merely some constants changed, and which will need to be rewritten.

If you have an iPhone uart cable, you can port the uart driver early… it’s very simple. This will save you a lot of pain debugging.

Step 1. Figure out how to reboot the device. This is usually done by writing a value into a WDT register, but could be verified by reversing cmd_reboot in iBoot.

Step 2. Change the “Constants” in includes/hardware/s5l8900.h to reflect the basic memory layout of your hardware if necessary. Most likely this does not need to be changed provided the MIU was properly configured before openiboot is called.

Step 3. Make sure PeripheralPort in includes/hardware/s5l8900.h is set to the right place. You can find out by reversing iBoot and finding where it sets the peripheral port remap register early on.

Step 4. Figure out where the MIU configuration register is and which MIU setting to use to make sure SDRAM is mapped to 0×0. This can also be most likely found in iBoot. The MIU is one of the devices labeled /arm-io/clkrstgen in the iPhone’s device tree. Change the instructions at the beginning of entry.S, miu_setup, and clock_set_bottom_bits_38100000 with this new information. You may attempt to make the assumption that the MIU is still at the same place and/or has the same register offsets/values.

Step 5. Put a reboot early on in entry.S and progressively move it back, troubleshooting as you go, until you reach C code (OpenIBootStart). This is the first major landmark.

Step 6. Port over clock.c, power.c, timer.c, interrupt.c and the interrupt handling code in entry.S. Most likely you just need to change the base addresses in their respective includes/hardware/*.h. Use the event.c code (which is platform independent) to try to schedule a reboot 10 seconds after you launch openiboot. (make sure you comment out everything you haven’t ported and add a while(1); at the end of your code). If this works, the timer, clock and interrupts all work. These are very important basic services for the other drivers. Use a combination of the reboot code you worked out in step 1 and while(1)s to troubleshoot, they will be your only form of feedback for now.

Step 7. Port over usb.c. Again, you can probably just change the base address of the USB code and it will work. Once that is done, you can re-enable all the command line parsing code. If the openiboot command line code works, then you have a basic bring-up!

Step 8. Port over the GPIO driver. You can test its workings by checking the button states. You need this for a whole bunch of devices.

Step 9. Port over the i2c driver. Test with the accelerometer. This is needed for the PMU and LCD among other things.

Step 10. Port over the pmu driver. This is a good application of the i2c driver, and you need it to control the backlight.

Step 11. Port over the SPI driver. Most notably, this is used for the LCD driver and probably NOR on new ports. No easy way to test this in isolation so you’ll want to do it concurrently with step 13.

Step 13. Port over the NOR driver. It might “just work” when the SPI driver does.

Step 14. Port over the LCD driver. This is probably one of the trickier parts. I had to check the actual iBoot disassembly for my ports here. However, it only took an hour or so to get working.

Step 15. Port over the DMA controller. There probably won’t be any changes, but who knows.

Step 16. Port the rest. There aren’t any surprise dependencies. sdio → wan, radio → uart and that’s about it.

Android running on iPhone!

Saturday, May 15, 2010

I've been working on this quietly in the background. Sorry about the initial video quality, but YouTube promises that the quality will get better as the video gets processed more. The back part of the version I uploaded to Vimeo was cut off.



I think that says it all, really. Donations via paypal to planetbeing at gmail.com. If you'd like to help, come join #iphonelinux on irc.osx86.hu.

Thanks to CPICH for reversing support, harmn1, posixninja, jean, marcan and saurik for patches, and last but not least, TheSeven for his work on the FTL.

Pre-built images and sources at http://graphite.sandslott.org:4080/pub/idroid/idroid-release-0.1a.tar.bz. Read the README. For generic openiboot instructions, there's plenty now that you can search for.

It should be pretty simple to port forward to the iPhone 3G. The 3GS will take more work. Hopefully with all this groundwork laid out, we can make Android a real alternative or supplement for iPhone users. Maybe we can finally get Flash. ;)

EDIT: Apparently on some iPhones, the installation of openiboot appears to be failing (THIS MEANS IT WON'T BOOT UP AGAIN). This is being investigated (I can't reproduce it on my own phone), but meanwhile you can just do a "tethered boot". In openiboot console, don't install but do !zImage, kernel, !android.img.gz, ramdisk, boot "console=tty root=/dev/ram0 init=/init rw" (after installing the other images to the second partition). If your phone won't boot up again, a DFU restore will get it back to normal. Take a deep breath. Calm down. There's nothing to worry about. :) We'll get this sorted out by tomorrow.

EDIT2: Fixed! It was previously only working on phones that used PwnageTool due to some assumption I made. Thanks geohot! Redownload the archive or just openiboot.img3

Google prepares for eBook sales, increase competition with Apple


google-ebook1

According to The Wall Street Journal Google is planning on introducing their very own eBook store as early as this next month, and gearing up once again to go head-to-head with Apple. This news comes just after Apple announced that in just 28 days, iPad users have downloaded over 1.5 million eBooks via iBooks.
“Google says its new service–called Google Editions–will allow users to buy digital copies of books they discover through its book search service. It will also allow book retailers to sell Google Editions on their own sites, taking the bulk of the revenue. Google has yet to release details about pricing and which publishers are expected to participate.”
Unlike on devices such as the iPhone, iPad and Kindle, Google’s approach will be to allow users access to the digital books from a complete range of websites and over various devices.
Would any of our readers prefer Google’s eBooks over Apple’s iBooks? Sound off in the comments below!

A New iPhone A to-do list

Friday, May 14, 2010

I'm gratified at a lot of the developers that want to help! This is the only way this project can stay alive. That being said, let's start to get a little organized. Here's a to-do list:

http://theiphonewiki.com/wiki/index.php?title=IPhoneLinux_To-Do

I'm proposing that unless someone wants to step in to host and administer an iPhone Linux website/wiki/forums, we use the iPhone Wiki to exchange information since it's there already. That said, Be Bold and work on whatever you like! If you have patches to openiboot, send them using git. If you have patches for the kernel or Android stuff, just contact me with it (IRC preferred, e-mail is okay) and I'll see about how we can publish them.

I'll personally be focusing on the first gen iPod touch and 3G port since I think I have a comparative advantage in that area.

Free Google Maps Navigation App Coming to iPhone

Google working on bringing free nav app to other platforms than Android

Smartphones are highly converged devices that offer users the ability to surf the web, talk, text, and take pictures. One of the more popular uses for smartphones today is as GPS navigation devices. Most platforms have GPS applications that require the user to purchase the app or pay a monthly fee.

Google unveiled a free GPS navigation platform for its Android devices in October of 2009 that provided free GPS navigation services in America. The platform recently landed in Europe for free as well. Along with the move into Europe, Google has announced that it intends to extend its free Google Maps Navigation service to other platforms.

Those other platforms include the iPhone. Getting its free GPS navigation platform onto the iPhone would be huge for users. TomTom, Navigon, and other providers on the iPhone right now charge $60 or more for GPS applications and some like AT&T charge a monthly fee for GPS navigation.

The launch of Google Maps Navigation in Europe is a big deal; Europe was left out of the launch last year. UK users can get Google Maps Navigation on their Android device as a free update to Google Maps.

“Google Maps pre-caches the entire route,” said Mobile Maps product manager, Steve Lee. “It needs a data connection when you ask for navigation. But while driving to your destination, if you intermittently lose the connection, it will still carry on. As long as you stay on the route.”

The free GPS service will undoubtedly hurt paid offerings from companies like Garmin and TomTom in the UK. Google simply says that other providers had become stale and its offering will force them to innovate in the GPS market.

The port to the iPhone 3G

Thursday, May 13, 2010

The port to the iPhone 3G is coming along. This is a picture of an iPhone 3G booting into a BusyBox / Buildroot shell. As you can see, wireless networking is working great. We can also talk to the baseband over the debugging channel. This might be enough to get calling, etc., working but we may need to figure out the SPI transport.

I'd still like to get the WM8991 codec working for it in openiboot (shouldn't be much trouble since there's a datasheet), just so we can iron out any quirks before testing it inside the kernel. We also need a new multi-touch driver (they've upgraded from Zephyr to Zephyr2). After that, we'll have a working port of Android.

Also, for existing developers and testers, I've implemented the Android wi-fi driver extensions so WLAN should be working better now. I know people had problems associating with WPA protected networks, etc. See if this update helps!

How to install any paid or free game or app directly from your iPhone 3G!

Hi, all Apple iPhone 3G fans.
Finally I have finished my First Unofficial Apple iPhone 3G manual.
Today I start official sales of this unique manual on my website. Let me explain why this manual is so amazing.
This manual is so-called „step-by-step” instructions created for all amateur, newbie and professional iPhone users,  so this is a detailed instructions with pictures and educational videos on 25 sheets.
It means that every iPhone 3G without any basic PC or Mac knowing can easily free his iPhone from Apple, download and install any FREE or PAID app or game from App Store database completely for FREE. You won’t need PC or Mac computer, you won’t need iTunes software. All you need is your iPhone and Internet access. That’s it.
This method is truly unique you won’t find a manual in the Internet explaining this method, I guarantee.
How to install any paid or free game or app directly from your iPhone 3G!
I will explain two methods on how to install any game or app into your iPhone: official and unofficial.
- official method - using App Store database. you can download and install any Free game or app from App Store;
- unofficial method, this method will allow anyone to download and install any PAID game and app directly from your iPhone 3G, without connecting to PC or Mac computer. This method is truly unique, you won’t find anything similar in the Internet.
I ask a small money compensation for this unique manual - $9,00
I have dedicated almost two weeks to create this manual, it took some time to record educational videos and create very detailed instructions, as I said this is really „step-by-step” instructions.  All you need is to download this manual, open it, and then follow all operations step by step, this method works with all iPhone 3G, 100% guarantee.

Android repos are up

Wednesday, May 12, 2010

We've gotten a tremendous response -- far more than I've actually anticipated before the release. I would like to thank the community for their interest. The amount of support and enthusiasm that was displayed was truly humbling to someone used to cynicism about this project.

The thing I'm most excited about is the fact there are now many developers working on several different things... a pretty big change from when I was hacking on the source tree virtually alone. There are developers actively working on the first generation iPod port, the iPhone 3G port, and a second-generation iPod touch port and things are moving much more quickly than I've anticipated. With so many helping hands, I'm sure that we can get these ports to production quality.

To coordinate our efforts, I've setup a series of git repositories on GitHub. You can clone the Android tree using Google's repo tool thus:

repo init -u git://github.com/planetbeing/platform_manifest.git -b android-sdk-1.6_r2-iphone


This command populates the majority of the tree from the main Android kernel.org repositories, with any changed project from my tree.

git://github.com/planetbeing/kernel_common.git branch android-2.6.32-iphone is our kernel tree. It is included in the main repo checkout as well.

git://github.com/planetbeing/iphonelinux.git as always is our openiboot/bootloader tree. New hardware support will be trialled there and then ported into the Linux kernel.

A fellow with the nickname of "konaya" on IRC has volunteered to administer a website for us at http://www.idroidproject.org. We can use the wiki to document iPhone Linux/iDroid and the forums to provide help to newcomers. We also have a developer mailing list (please ask in IRC if you wish to get added to that).

Ellen makes spoof iPhone commercial. Apple doesn’t think it’s funny


Ellen iPhone Ad

Comedian Ellen DeGeneres played a spoof iPhone ad during her Monday talk show. In it, she is glorifying the iPhone, yet having difficulties with texting.

Apple didn’t see the humor in her commercial and complained that she implied that the iPhone is difficult to use. Ellen responded during her Tuesday show by apologizing and explaining that the iPhone is in fact not hard to use, it’s the only phone she can text on, and that she loves her iPhone, iPad, iPod, and even iHop!

Watch the ad and her apology below and let us know what you think. Is Apple being a little too sensitive?
UPDATE: Ellen’s official YouTube video says “no longer available” (all her YouTube videos now say that(?!)) so we’ve switched to whatever non iPhone-friendly version they use on the official website. Sorry!

New iPhone 3G Multi-touch

Tuesday, May 11, 2010

I finished writing a driver for the Zephyr2 on the iPhone. It's the same multi-touch solution that Apple has used starting from the first generation iPod touch and up to and including the iPad.

Now, of course this shouldn't be construed as a promise to support the iPad eventually, but this multi-touch driver is definitely a concrete milestone that is important for pretty much all of Apple's mobile Internet devices.

More immediately, this is pretty much the sole remaining blocking issue on the first-gen iPod touch and one of the two major issues on the iPhone 3G. The other issue on the iPhone 3G is baseband SPI. I'm wondering if we can get away with just using the debug uart to make calls (if we don't care about having a fast 3G data connection yet).



Also, I'd like some opinions from this blog's readers: More frequent updates? Or just document the major advances?