Pages

Monday, February 28, 2011

Ubuntu and Debian on HTC Incredible

I have recently, successfully installed bot Ubuntu and Debian on my HTC/Droid Incredible. The speed is good, (for a phone) and all in all it works great, however it took the use of multiple guides to get this to work. As far as I know this guide is HTC incredible specific, however i imagine it would not be difficult to implement on many different devices. So now for what you are all waiting for THE GUIDE:

1. Find a Computer running Ubuntu
2. open Terminal
3. copy and paste the following text into terminal


sudo -s
apt-get install debootstrap
dd if=/dev/zero of=debian.img seek=838860800 bs=1 count=1
mke2fs -F debian.img
mkdir debian
mount -o loop debian.img debian/
debootstrap --verbose --arch armel --foreign lenny debian http://ftp.us.debian.org/debian
umount debian/
rm -r debian/
4. Open up a text editor and name it "bootdebian.sh" (without the quotes)
5. now copy and paste the following text into your new file

if [[ $EUID -ne 0 ]]
then
echo "Becoming ROOT!"
su -c bootdebian
exit 1
fi

echo "Mounting system as R/W"
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system

echo "Setting some stuff up.."
export bin=/system/bin
export img=/mnt/sdcard/debian.img
export mnt=/data/local/debian
export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
if [ ! -d $mnt ]
then
mkdir $mnt
fi

echo "Mounting the Linux Image"
mknod /dev/block/loop5 b 7 0 #may already exist
losetup /dev/block/loop5 $img
mount -t ext2 -o noatime,nodiratime /dev/block/loop5 $mnt
mount -t devpts devpts $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys

echo "Setting Up Networking"
sysctl -w net.ipv4.ip_forward=1
echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
echo "nameserver 8.8.4.4" >> $mnt/etc/resolv.conf
echo "127.0.0.1 localhost" > $mnt/etc/hosts

echo "Mounting sdcard and emmc in /mnt"
if [ ! -d $mnt/mnt/emmc ]
then
mkdir $mnt/mnt/emmc
fi
busybox mount --bind /mnt/emmc/ $mnt/mnt/emmc
if [ ! -d $mnt/mnt/sdcard ]
then
mkdir $mnt/mnt/sdcard
fi
busybox mount --bind /mnt/sdcard/ $mnt/mnt/sdcard

echo "Entering CHROOT "
echo " "
chroot $mnt /bin/bash

echo " "
echo "Shutting down CHROOT"
umount $mnt/mnt/emmc
umount $mnt/mnt/sdcard
sysctl -w net.ipv4.ip_forward=0
umount $mnt/dev/pts
umount $mnt/proc
umount $mnt/sys
umount $mnt
losetup -d /dev/block/loop5
mount -o remount,ro -t yaffs2 /dev/block/mtdblock3 /system
6. now save and close that file
7. copy bootdebian.sh and debian.img (created in step 3) to the root of your sdcard
8. Now we are switching to the phone side of this process. You are gonna need some sort of terminal app, i use terminal emulator (this could also be done from adb shell)
9. input the following text into your terminal LINE BY LINE do not copy and paste their is not guarantee of copy and paste working here, so just dont even bother (make sure to do a nandroid backup before doing this step)
su
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
cat /sdcard/bootdebian.sh > /system/xbin/bootdebian.sh
rm /sdcard/bootdebian.sh
chmod 777 /system/xbin/bootdebian.sh
bootdebian.sh
/debootstrap/debootstrap --second-stage
echo 'deb http://ftp.us.debian.org/debian lenny main' >/etc/apt/sources.list
apt-get autoclean
apt-get update
exit
10. Now debian is installed! whenever you want to start it again, just type "bootdebian.sh" (without the quotes).
11. Now for the hard part.......getting the GUI. start debian
12. do this part on the phone terminal not adb shell. type in the following text line by line, (this part will take a while)
apt-get update
apt-get install tighvncserver
apt-get install lxde
export USER=root
vncserver –geometry 1024x800
 
 
13. After typing the last command you will be asked for a password (make it at least 8 characters). If you wanted to you could now use a vnc viewer ON YOUR PHONE to view the GUI. However you will have to type the last 2 lines of the above command everytime you want to start the GUI.
14. To make it permanent using your phone terminal or adb input the following text
cat > /root/.vnc/xstartup
#!/bin/sh
xrdb $HOME/.Xresources
xsetroot -solid grey
icewm &
lxsession
 
15. Press “CTRL+D” twice after the last line of the command
 
16. now input this next set of text
 
cat > front
export USER=root
cd /
rm -r -f tmp
mkdir tmp
cd /
vncserver -geometry 1024×800
 
17. Press “CTRL+D” twice after the last line of the command
 
18. Now enter the following text
 
cat front /root/.bashrc > temp
cp temp /root/.bashrc
 
19. DONE!!!. Now all you have to do is type "bootdebian.sh" (without the quotes) and it will start debian as well as the
gui automatically, so you could now go into Android vnc (the vnc viewer I use) or whatever viewer you choose to use and enter into the Gui.
 
I am not responsible for anything that may happen to your device during, before, or as a result of this process. If you have any questions what so ever, post a comment and i will answer
to the best of my ability. I will probably post the ubuntu tutorial, some time next week. THANK YOU!
 
Sources: http://www.addictivetips.com/mobile/how-to-install-ubuntu-linux-on-your-nook-color/  ;  http://lanrat.com/android/debian
 

No comments:

Post a Comment