Author Topic: iX for iPhone 2G  (Read 2792 times)

Offline bishop

  • Member
  • Posts: 11
  • Karma: +0/-0
    • View Profile
iX for iPhone 2G
« on: October 17, 2010, 10:12:24 PM »
I know a few people out there are having trouble getting their iPhone 2G's to run the latest iX. Here is what i did to make it work.
BTW im using Ubuntu 10.10 64bit but these instructions should work on any Linux distro regardless of cpu type

First, install Bootlace: http://www.idroidproject.org/wiki/Bootlace
Then, install OpeniBoot: http://www.idroidproject.org/wiki/Installing_OpeniBoot
  I used the 0.1.2 build

Next, grab these files:
http://idroid.nickpack.com/iX/iX-UbuntuDevImageV0.01.rar
http://debianiphone.googlecode.com/files/zImage.gz

So, extract the rar and follow the directions in the READMEFIRST to install it. However, when you get to the part about mounting initrd.img and copying over the firmware, we are gonna do something different.

First off, i used bootlace to extract the firmware. then i used scp to copy it to my computer and then i put it in lib/firmware (inside initrd.img). Remember we need sd8686_helper.bin, sd8686.bin, zephyr_main.bin and zephyr_aspeed.bin.

next we need to edit the startup script, init, to reflect the different firmware files we are using.
open up init in your favorite editor as root (e.g.: sudo nano init) and look for the following lines:

Code: [Select]
# Load the helper
echo 1 > /sys/class/firmware/iphone-multitouch/loading
/bin/cat /lib/firmware/zephyr2.bin > /sys/class/firmware/iphone-multitouch/data
echo 0 > /sys/class/firmware/iphone-multitouch/loading

We need to change zephyr2.bin to zephyr_aspeed.bin.
But what about zephyr_main.bin? Good catch, you actually have to load both so we are going to need to duplicate the same loading sequence and tell it to wait for the first one to finish before moving on to the second. Oh, and you need to load zephyr_aspeed.bin first, not sure why. Thus:

Code: [Select]
# Load the helper
echo 1 > /sys/class/firmware/iphone-multitouch/loading
/bin/cat /lib/firmware/zephyr_aspeed.bin > /sys/class/firmware/iphone-multitouch/data
echo 0 > /sys/class/firmware/iphone-multitouch/loading

while [ ! -e /sys/class/firmware/iphone-multitouch/loading ]
do
    /bin/sleep 1
done

echo 1 > /sys/class/firmware/iphone-multitouch/loading
/bin/cat /lib/firmware/zephyr_main.bin > /sys/class/firmware/iphone-multitouch/data
echo 0 > /sys/class/firmware/iphone-multitouch/loading

Bam! Save that sucker!
Unmount the image and re-gzip it
We also need to rename it to android.img.gz  because that is what OpeniBoot is looking for.
go ahead and scp android.img.gz and zImage to the iphone at /var/idroid
then scp ix.img to the phone at /var  (yeah, i know it takes like 25 minutes)

Now you just need to use the quickboot feature of bootlace (or just reboot your phone) and choose android.
Things to remember:
  • This isnt anything close to a final product, its just really cool
  • Every time you are booting with a "fresh" ix.img, the screen will go black for a long period of time while the window manager starts for the first time
  • Every time you hard-reset you will have to recopy android.img.gz zImage and ix.img again (they get corrupty)
  • Every time you do a "correct" shutdown/reboot from debian, you need to boot into iOS before you can go back to debian. debian doesnt do a clean dismount so iOS has to run a file system check and fix any errors. one solution might be to have debian check the filesystem itself every boot.
  • You can make your scp transfers a little quicker by using scp like this: scp -c blowfish-cbc -C <file1> <file2> <file3> root@<ipaddress>:/var/idroid
  • If your an overly compulsive control freak like I am (or just want a challenge) try installing Debian the hard (fun) way: http://dev.idroidproject.org/documents/5

Offline Lopi

  • Moderator
  • Member
  • *****
  • Posts: 64
  • Karma: +2/-0
    • View Profile
Re: iX for iPhone 2G
« Reply #1 on: October 21, 2010, 12:29:39 AM »
Great write up. I know I have done this for a few people on irc, but never put together the steps to make it happen. Although, you are using a fairly old kernel compiled by ikex. I'll add this to iX's documentation. I do have a few questions for you though.

1) Is the touch screen calibrated properly?

2) Would you like to help develop a 2G version of iX?

Offline bishop

  • Member
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: iX for iPhone 2G
« Reply #2 on: October 21, 2010, 08:58:18 AM »
Yeah, I ended up using that old one because i was having trouble getting the ones from the MoJo releases to play nice. I am not positive that it was the kernel though, only that i had the most repeatable results with ikex's.

The touch screen calibration seems to be about 1/3cm down and right of center (in landscape) of my fingertip. Where is the calibration data stored? I would like to fiddle around with it; I also had an idea for "context-aware calibration adjustment" that i want to play with.

I would love to help develop a 2G version of iX, I also have an IPT1G to experiment with.

Offline bcooperizcool

  • Member
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: iX for iPhone 2G
« Reply #3 on: October 21, 2010, 09:10:41 PM »
Bit of a problem...  I followed the instructions, and typed the code the first time, then copies it the second, but I still am having the same problem of "kernel panic: not syncing, attempted to kill init!"  or somthing like that.  I am using the zImage, wifi and multitouch files from the bootlace extraction, and I still get that. :(

Any ideas?

Thanks!

Offline bishop

  • Member
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: iX for iPhone 2G
« Reply #4 on: October 21, 2010, 11:43:44 PM »
just to be clear, you are using the kernel i linked to right?

otherwise, there are two more scripts in the root of android.img.gz  i believe they are named "halfboot" and "linux.rc" . i havent actually figured out under what conditions these two get executed, but all three scripts are practically identical. if all else fails, try copying init on top of these two.

Offline bcooperizcool

  • Member
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: iX for iPhone 2G
« Reply #5 on: October 22, 2010, 01:01:03 AM »
Yup. What do you mean copy init ontop of?  like replace the scripts with?
Thanks for your help!  This is the first hint of iX with working touchscreen! :D

Offline Lopi

  • Moderator
  • Member
  • *****
  • Posts: 64
  • Karma: +2/-0
    • View Profile
Re: iX for iPhone 2G
« Reply #6 on: October 22, 2010, 06:25:57 PM »
Yeah, I ended up using that old one because i was having trouble getting the ones from the MoJo releases to play nice. I am not positive that it was the kernel though, only that i had the most repeatable results with ikex's.

The touch screen calibration seems to be about 1/3cm down and right of center (in landscape) of my fingertip. Where is the calibration data stored? I would like to fiddle around with it; I also had an idea for "context-aware calibration adjustment" that i want to play with.

I would love to help develop a 2G version of iX, I also have an IPT1G to experiment with.

Well, we finished sorting through the kernel issues yesterday. We finally have our first iX kernel (big thanks to alogeno, ricky26, idroid dev team, and anyone else that helped) which contains a usb ethernet gadget. No more hard reset if wifi drops. Anyway, we can compile a new kernel for 2G and IPT1G as well.

Regarding the touch screen calibration, it takes times to calibrate properly. Here's some information that may help you:

Display rotation
Rotating the display for tablet mode can be done with xrandr. Commands of interest are
xrandr -o left
xrandr -o right
xrandr -o normal
xrandr -o inverted

Touchscreen input rotation
Rotating the touchscreen input can be done with xinput. Commands of interest are
xinput list
xinput set-prop "devicename" "Evdev Axis Inversion" 0, 0
xinput set-prop "devicename" "Evdev Axis Inversion" 0, 1
xinput set-prop "devicename" "Evdev Axis Inversion" 1, 0
xinput set-prop "devicename" "Evdev Axes Swap" 0
xinput set-prop "devicename" "Evdev Axes Swap" 1
and, of course, as you'll learn from the output of the program I'll tell you about next,
xinput set-prop "devicename" "Evdev Axis Calibration" minX maxX minY maxY

Touchscreen input calibration
Calibrating the touchscreen can be done with the excellent program xinput_calibrator. xinput_calibrator will output a usable xinput command and a chunk of xorg.conf config, so you can make your change temporary or permanent as you see fit. If you rotate the screen you will need to recalibrate with your x and y values reversed. At times if your calibration is way off, you may need to calibrate several times, starting from the previous calibration each time, as otherwise the calibrator can't find the edges of the screen.

As far as developing goes, please get on irc so I can speak with you on a regular basis.