Here is a link to a HOWTO (not the one I used but looks better):
http://forum.xda-developers.com/showthread.php?t=823370
Now, I am using a rooted CYANOGEN ROM on my phone (basically not all that much different than the stock 2.1-update1 but rooted) but it should work on any rooted Android phone as long as your kernel has ext2 built in or has a module (it's built in on mine) and you have access to the mount and chroot commands.
You also want to set a few variables so I'll post my startup script that you run from the "adb shell" prompt. My ubuntu disk image is called /sdcard/ubuntu/ubuntu.img and I create a mount point directory /data/local/ubuntu. Here's the script that will give you a root shell in the new environment:
I created a /data/bin directory and created the script /data/bin/ubuntu:
- Code: Select all
export kit=/sdcard/ubuntu
if [ ! -d /data/local/ubuntu ]
then
mkdir /data/local/ubuntu
fi
export mnt=/data/local/ubuntu
export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH
export USER=root
export TERM=linux
export HOME=/root
mount -t ext2 -o loop,noatime $kit/ubuntu.img $mnt
mount -t devpts devpts $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys
sysctl -w net.ipv4.ip_forward=1
chroot $mnt /bin/bash
#After exit command is executed clear it all up
echo " "
echo "Shutting down Ubuntu"
umount $mnt/dev/pts
umount $mnt/proc
umount $mnt/sys
umount $mnt
After running that script you should get a root prompt and be chrooted to the Ubuntu install. You will probably want to set the root password (passwd root) and then you can start up sshd (/etc/init.d/ssh start) or vncserver (vncserver start). Don't forget to set your vncpassword with "vncpasswd". From there you can connect to localhost 5901 (or 5902, or whatever depending on what vncserver starts up on :1 = 5901, :2 = 5902, etc) from your android vnc client app or ssh to localhost from connectbot.
Personally, rather than trying to remote control the Ubuntu installation from the little screen and keyboard on your phone you can connect to it over the wireless connection with vncviewer or ssh client from your Linux (or Windows) PC. Or you can use the adb command to forward ports to your PC over the USB debug connection. Here is an example of forwarding 22 to your localhost:2222 on your local PC with adb server running:
- Code: Select all
#!/bin/bash
./adb forward tcp:2222 tcp:22
ssh root@localhost -p 2222
(run in your adb tools directory) Have fun!


