Linux on the iPhone!

Posted on the January 28th, 2012 under Gadged by

I’m pleased to announce that the Linux 2.6 kernel has been ported to Apple’s iPhone platform, with support for the first and second generation iPhones as well as the first generation iPod touch. This is a rough first draft of the port, and many drivers are still missing, but it’s enough that a real alternative operating system is running on the iPhone.

<br>

What we have:

- Framebuffer driver
- Serial driver
- Serial over USB driver
- Interrupts, MMU, clock, etc.

What we have in openiboot (but hasn’t been ported yet):

- Read-only support for the NAND

What we don’t have (yet!):

- Write support for the NAND
- Wireless networking
- Touchscreen
- Sound
- Accelerometer
- Baseband support

The current userland we’re using, in the interest of expedience, is a Busybox installation created with buildroot, but glibc works fine as well, and we’re going to build a more permanent userland solution.

A demonstration video can be seen here: http://www.vimeo.com/2373142

Instructions here: http://www.iphone-dev.org/planetbeing/LINUX-README.txt

Download here: http://91.186.26.18/iphone/files/iphonelinux-demo.tar.gz (look for mirrors in the comments)

EDIT: The instructions are missing the step that you have to select openiboot console from the menu before performing the “sudo ./oibc” step. Just be aware you have to do that if it seems like you’re not getting a response from the oibc client.

Project lead: planetbeing

Contributors: CPICH, cmw, poorlad, ius, saurik

If you’re experienced with hacking/porting Linux and especially if you’re experienced with porting Android, I’d definitely like to hear from you. Come chill in the #iphonelinux channel on irc.osx86.hu. Thanks. icon smile Linux on the iPhone!

EDIT: I was asked a couple times by people who wanted to donate (financially) to the project. I made a post discussing this possibility, if you are interested.

 Linux on the iPhone!

 Linux on the iPhone!

 Linux on the iPhone!

iPod + iPhone + Web Mashup

Posted on the January 28th, 2012 under Gadged by

It’s what the mobile music experience could be

This project started as I explored ways to view lyrics while listening to my music library on the iPod Touch. Ideas kept coming and I added some concepts (and code) from iMovieMash.com plus great content from the multitude of public video, music and search APIs.

The result was iMusicMash.com, an iPhone and Android G1 social web application that takes your music experience to a whole new level of enjoyment and discovery. You can start with the friends’ playlists we already have or load your own iTunes music library. The interface is familiar as it mimics the iPhone’s iPod. For each artist, we bring photos from Yahoo Boss Image Search, concert dates from Eventful, and live Twitter discussions. Then, for each song, we bring great YouTube videos, lyrics from LyricWiki, similar songs from Last.fm, and friends’ songs for the same artist.

I recently added lyrics search and artist/title search.

iMusicMash was a winner in the Yahoo Developer Mashup contest at the recent Mashup Camp in Mt. View, California.

Poorlad’s menu implemented; Porting issues resolved

Posted on the January 28th, 2012 under Gadged by

Yesterday night, I merged in a branch I was working on for poorlad’s menu. A version of that beautiful menu is now in Git. His menu included a version string at the bottom. We didn’t have any way to keep track of versions and builds before, so this was actually a good idea that I had to implement. Because I didn’t want to implement support for non-fixed width fonts, or add another space-consuming font, I just used the console font I was already using for that part. I also had to brighten the gradient on the bottom of the screen, since it was basically invisible due to gamma issues otherwise.

The border between the gradient and the “black” is clearly visible on my device. This is probably because of a gamma issue. When poorlad comes back, we can ask him to calibrate it more.

Otherwise, it looks pretty good! In order to make this possible, I added in stb_images.c, a great tiny little image library that can read PNG, JPEGs and even PSD files and does zlib decompression as an added bonus. This will be a great help if we decide to change things or need to add more stuff that consumes a lot of space. I also added in a basic function to perform alpha blending (albeit comparatively slowly).

Sadly, while I was busy making these changes, ius from IRC actually begun to implement poorlad’s menu without me knowing about it, so we ened up duplicating each other’s efforts. He was able to compile in zlib and libpng, but the cost was to inflate the final binary to 347 KB. Whereas taking out the old menu images, and adding small, compressed PNGs and the stb_images library instead actually made openiboot smaller than it was before! His decision to preblend the images, rather than attempt alpha blending on the device, was probably more optimal from a performance perspective.

Steven Troughton-Smith told me on Twitter that he has actually implemented his own boot menu as well. I’m not sure if he used the new PNG code or not, but the new code makes it pretty easy for a competent programmer to add in whatever menu they would like. I’d tell everyone to skin away, but we should keep as few wild branches of this project as possible, since everyone randomly installing openiboot just for kicks (especially a modified version) and then coming to us (read: me, ultimately) for support is something we don’t have the resources to handle at this moment.

On the porting side, the issues with installation, optimizing NOR access on iPhone 3G, NAND access on a few devices all seem to have been fixed, so we can basically scratch the first two items off of the list I put up in the last post. I’m pleasantly surprised at how relatively easy it was.

Anyway, now for the kernel. Well, if I don’t get distracted by writing to NAND.

 Poorlads menu implemented; Porting issues resolved

 Poorlads menu implemented; Porting issues resolved

 Poorlads menu implemented; Porting issues resolved

Porting to iPhone 3G and iPod touch

Posted on the January 28th, 2012 under Gadged by

Hey guys,

The lack of updates for the past few days is because many of you decided to visit us in IRC, thus enabling work to be done on porting openiboot to the iPod touch and the iPhone 3G (in particular because I don’t have an iPod touch at the moment).

I’m pleased to report that everything now seems to be working on the iPhone 2G and the iPhone 3G (albeit NOR read/write on the iPhone 3G is unoptimized and is unacceptably slow). There is apparently an outstanding issue with the NAND ECC on some (?) iPod touchs, and also some people can’t seem to actually install openiboot to NOR on both iPhone 2G and iPod touch. Unfortunately, the problem is that these things happen on devices that I don’t have physical access to, and IRC is often a frustrating medium for communicating with testers. I’m confident these issues will be resolved soon, though.

So, current simultaneous projects:

1. Resolve openiboot porting issues
2. Implement poorlad’s boot menu
3. Work on write support for FTL

After at least one of those things are done, we’ll be working on the Linux kernel.

 Porting to iPhone 3G and iPod touch

 Porting to iPhone 3G and iPod touch

 Porting to iPhone 3G and iPod touch

NAND filesystem now readable!

Posted on the January 27th, 2012 under Gadged by

Amazingly enough, the FTL_Read stuff from last night was pretty much correct! After that, it was relatively trivial to port over the HFS+ code I’ve already written (which was in pure C… finally that [fail] design decision has been vindicated =P).

As you can see in the screenshot below, with the latest Git revision, you can browse the filesystem from openiboot!

FS+works NAND filesystem now readable!
Next on the list is to port openiboot over to the iPod touch and iPhone 3G. It’s probably just a matter of putting in different numbers for the GPIO ports, but we’ll see.

After that, I will implement poorlad’s bootmenu (which everyone seems to like).

After that, well… We have pretty much all the devices now, so we’ll start looking at the Linux kernel. If you’re a Linux kernel guy who would be willing to help (preferrably you have experience porting Linux to new ARM platforms), please leave a comment here. I can do most of the muscle work, but it’d be nice if someone can show me how to set up the source tree properly for the new port.

 NAND filesystem now readable!

 NAND filesystem now readable!

 NAND filesystem now readable!

FTL

Posted on the January 27th, 2012 under Gadged by

I don’t know how I was talked into reversing a FTL, but we’re actually on our way. I’ve managed to enlist the aid of CPICH (who has been helping with the lower layers as well, he’s our human HexRays) and just recently, pumpkin, who you will know from the Dev Team. pumpkin will be the heavy support that’s necessary to take down _FTLRestore, which is the most complex function I’ve seen in 1.1.4 iBoot (and I’ve pretty much have seen all of it). pumpkin is very good, so this task should be now be cut down to “fairly difficult” from “completely impossible”.

The strategy so far has been me methodically hacking through the functions in the order that they are called, completely decompiling them, understanding them, and assimilating them into openiboot. Toward this end, I’ve been working on FTL_Open, which is a fairly large (but as it turns out, boring) function, but has been useful in enlightening us on several of the large data structures FTL uses.

Meanwhile, CPICH works on functions ahead of me, so that when I reach them, a lot of the thorny underbrush has been cleared out and my job becomes much easier and faster. Toward this end, he has been working on FTL_Read, which uses the data structures that the now-completed FTL_Open should populate.

_FTLRestore is sort of a “bonus”, since it’s not normally called if the iPhone was shut down normally and everything is cleaned up. However, since recovering faulty data structures require all redundancies to be exploited, reversing this would let us gain a lot of insight into how the FTL works. It’s also, naturally, an enormously complex function, and hence I wisely delegated it to pumpkin. =P (We will probably end up working on it together)

The one thing that troubled me was that the code we were reversing is for 1.1.4 whereas we primarily need it to work on 2.0. However, due to the fact that I had it better mapped out than the 2.0 iBoot, and the fact that the equivalent 2.0 code was much more complex (lots of function pointers flying around, and a weird switch idiom I haven’t quite figured out yet), We decided to stick to the 1.1.4 iBoot.

After completing FTL_Open, I had a bit of a panic when I discovered it did not work at all on my 2.1 phone, and I could not find any obvious bugs with it. This might’ve meant that all our work on 1.1.4′s FTL was for naught. Forgoing sleep, I tore through the 2.1 iBoot, locating the analogues to my already reversed 1.1.4 functions (I had given up trying to trace through the function pointers the first time around), and called them directly with my special version of iBoot (patched so that one of the commands was able to call arbitrary iBoot functions with arbitrary arguments). I managed to find a couple of bugs with my VFL code, and after having fixed them, FTL_Open appears to have worked. I think. It just finds and reads several data structures from NAND. It remains to be seen if I’m even reading the right thing.

Now for some sleep.

 FTL

 FTL

 FTL

API, Blotcode and Dandelion for commercial projects

Posted on the January 27th, 2012 under Gadged by

 API, Blotcode and Dandelion for commercial projects

 API, Blotcode and Dandelion for commercial projects

Both Blotcode and Dandelion are available for licensing. License gives a right to generate own codes within independent code range.

Another alternative is to use our API. Usage of API is free for non-commercial applications. 2D Sense API is available on request.

Use this address: sergey[AT]dsense.com

2D Sense reads Scanbuy’s EzCodes

Posted on the January 27th, 2012 under Gadged by

 2D Sense reads Scanbuys EzCodes

Do you know that 2D Sense can read and process Scanbuy’s EZCodes (or former Visual codes)? Find examples here http://www.scanlife.com/examples.html and scan them!

As you know, CTIA The International Association for the Wireless Telecommunications Industry has reached the conclusion that US carriers will support the proprietary EZ Code and open Datamatrix Code symbologies with indirect access…. Ability to handle both Datamatrix and EZCodes makes 2D Sense very unique application on a market.

Port of 2D Sense on BlackBerry is near to end and is planned for Xmass 2008.

Stay tuned!

QuickGold for iPhone – Jailbroken iPhone app recommendation

Posted on the January 26th, 2012 under Gadged by

3600 QuickGold for iPhone   Jailbroken iPhone app recommendationThis one’s not one of mine, but an app made by Zachary "zataang" Taanges really hit the spot. Using the Dock 3.0 source code as a reference, Zach created a beautiful text-based app launcher called QuickGold that runs right on top of SpringBoard.

It’s available now in Cydia (hosted by Shaun "Ste" Erickson).

This thing is great, just hit the Home button while already at the home screen and start typing what you want, then tap the result that matches. So fast (even faster than Dock)!

Read the rest of this post

What can code injection do on an iPhone?

Posted on the January 26th, 2012 under Gadged by

3569 What can code injection do on an iPhone?Pretty much anything.


Read the rest of this post