Playing with the G1

Disclaimer

Ok, you know the drill : all those tips, tricks and hacks can and will eventually blow up your phone, so don't do it at home.

Anyways.

I finally got my hands on a real device, for a change ! Looks a lot like the emulator, except that you can put it in your pocket for real. I am lucky enough to have a phone with a low enough RC number, so the root trick described here works. Apparently, it's becoming more and more difficult to find a “root-friendly” phone, so you might as well get a Dev Phone 1 from Google (I wish I had, anyways).

Console

Adb is a pretty neat program. You can use it to access the phone or the emulator in the same way. So getting a shell on the G1 is as easy as plugging the USB cable in the phone and typing :

adb shell

Of course, you'll only get a uid of 2000 and not many permissions. The cool thing with the root bug is that it allows you to launch telnetd as root. Once this is done, just type :

adb forward tcp:4444 tcp:23
telnet localhost 4444

And voila, a root shell !

Transfer

Transfering stuff is done with adb push or pull. There is a catch though : adb push as the same low permissions as adb shell, and most transfer attempts will end up with “permission denied”.

The only partition that has write permission is /sdcard. Of course, /sdcard is mounted noexec. To transfer stuff, you can either log in as root and change the permissions on the partitions, or remount them. Or you can send things to /sdcard, and then log in as root and move them around. Except that mv will fail because it can't do a cross device link. cp is nowhere to be found. What's left ?

dd if=/sdcard/hello of=/data/hello

Update Seems like you can write to /data/local, which is mounted with exec permission.

lsmod

The phone kernel seems to have been compiled with module support turned on.

Discussion

Rich, 2009/01/22 11:04
Hey, just found your wiki! This is the best Android analysis I've seen so far. I'm particularly interested in the LKM stuff you've done, and that kernel modules can be inserted on the G1. I have an RC30 G1 and I'm interested in finding a route to root without reflashing using an all-root LKM. Running ismod doesn't require su, but I'm assuming modutils won't allow any new LKMs without it, but I haven't tested this yet. Any thoughts? email me!
fred, 2009/01/26 07:56
I'm cheating in the sense that I have an easy to root G1 (small RC < 30). If I understand you well, you'd like to get root without reflashing by "just" inserting an LKM ? I've lent my phone for a few days, but as soon as I get it back, I'll experiment a bit. I'll let you know ...
rich, 2009/01/26 20:28
Thanks for replying! Anytime you feel like chatting about this just let me know.
Enter your comment (wiki syntax is allowed):
DCKDO
 
wiki/g1.txt · Last modified: 2009/01/12 09:57 by fred
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki