Showing posts with label Debian. Show all posts
Showing posts with label Debian. Show all posts

Sunday, December 5, 2010

How to install debian on Samsung Galaxy Tab

Assume you have rooted the Samsung Galaxy Tab and want to install debian

The instruction of setting up debian in G1 is in saurik's site here http://www.saurik.com/id/10
But some of the information are outdated, as the rooting is very simple now and the busybox comes with one click z4root

z4root is here http://www.multiupload.com/EPKDWWLWD9

I like this method as the Debian system is installed in a standalone img file which can be copied to other Android phones.

(1) Download the Debain G1 image here
http://rapidshare.com/files/161776007/debian-armel-750.img.bz2

or here
http://www.multiupload.com/VUKS8LQ7EP

There is a ubuntu.img out there and is 2G in size (but trust me, running a graphical desktop via vnc is overkilling on mobile device). If you want shell access only, this debian.img is better.

(2) copy it to sdcard.
adb push debian-armel-750.img.bz2 /sdcard/

(3) su shell access to Tab

adb shell
su


(4) unzip the file in Tab. The image after unzip is 750M in size, so make sure you have enough space in sdcard.

cd /sdcard
busybox bunzip2 debian-armel-750.img.bz2
mv debian-armel-750.img debian.img


(5) setup mount and chroot

create and run this script in

cd /data/local
busybox vi startdeb.sh



startdeb.sh Select all
export kit=/sdcard
export mnt=/data/local/mnt
export TERM=linux
export HOME=/root
export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH

busybox clear

busybox mkdir -p $mnt

busybox mount -o loop,noatime $kit/debian.img $mnt

busybox mount -t devpts devpts $mnt/dev/pts
busybox mount -t proc proc $mnt/proc
busybox mount -t sysfs sysfs $mnt/sys

busybox mkdir -p $mnt/mnt
busybox mkdir -p $mnt/mnt/sdcard $mnt/mnt/system
busybox mkdir -p $mnt/mnt/data $mnt/mnt/dev

busybox mount -o bind /sdcard $mnt/mnt/sdcard
busybox mount -o bind /system $mnt/mnt/system
busybox mount -o bind /data $mnt/mnt/data
busybox mount -o bind /dev $mnt/mnt/dev
busybox mount -t tmpfs tmpfs $mnt/tmp -o noatime,mode=1777

busybox chroot $mnt /bin/bash

#After exit command is executed clear it all up
echo " "

echo "Shutting down Debian........"

umount $mnt/dev/pts
umount $mnt/proc
umount $mnt/sys
umount $mnt/mnt/sdcard
umount $mnt/mnt/system
umount $mnt/mnt/data
umount $mnt/mnt/dev
umount $mnt/tmp
umount $mnt



run the startdeb.sh script

sh startdeb.sh



# now Tab should be in Debian System

(6) do some fixing and change root password and install OpenSSH and start it

rm -f /etc/mtab
ln -s /proc/mounts /etc/mtab
passwd root
apt-get update
apt-get install debian-keyring debian-archive-keyring
apt-get update
apt-get upgrade
apt-get install openssh-server openssh-client
/etc/init.d/ssh start


(7) If the default package source does not work, you can change this file /etc/apt/sources.list to

deb http://ftp.us.debian.org/debian lenny main


(8) Then you can ssh to your Tab by using ssh root@xxx.xxx.xxx.xxx after enable wifi in Tab, where xxx.xxx.xxx.xxx is the IP address of Tab.

(9) If you want to change the DNS server say to Google Public DNS

echo "nameserver 8.8.8.8" > /etc/resolv.conf
echo "nameserver 8.8.4.4" >> /etc/resolv.conf






Sunday, November 1, 2009

[How-to] install Debian and openssh server in T-Mobile G1

Assume you have installed CynogenMod and get busybox in it, you can install Debian system in G1 or other Android phone that has been rooted and have busybox in that custom ROM.

The instruction of setting up debian in G1 is in saurik's site here http://www.saurik.com/id/10
But some of the information are outdated, as the rooting is very simple now and the busybox comes with all custom cooked ROMs.

I like this method as the Debian system is installed in a standalone img file which can be copied to other Android phones.

(1) Download the Debain G1 image here
http://modmygphone.com/files/debian-G1.zip

or
http://rapidshare.com/files/161776007/debian-armel-750.img.bz2

unzip bz2 file with
bunzip2 debian-armel-750.img.bz2

(2) unzip it and copy the img file to sdcard. The image is 750M in size, so make sure you have enough space in sdcard.
adb push debian-armel-750.img /sdcard/kit/

(3) su shell access into G1

adb shell
su


(4) setup mount and chroot

export kit=/sdcard/kit
export mnt=/data/local/mnt
export TERM=linux
export HOME=/root
export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH

busybox clear

busybox mkdir -p $mnt

busybox mount -o loop,noatime $kit/debian-armel-750.img $mnt

busybox mount -t devpts devpts $mnt/dev/pts
busybox mount -t proc proc $mnt/proc
busybox mount -t sysfs sysfs $mnt/sys

busybox mkdir -p $mnt/mnt
busybox mkdir -p $mnt/mnt/sdcard $mnt/mnt/system
busybox mkdir -p $mnt/mnt/data $mnt/mnt/dev

busybox mount --bind /sdcard $mnt/mnt/sdcard
busybox mount --bind /system $mnt/mnt/system
busybox mount --bind /data $mnt/mnt/data
busybox mount --bind /dev $mnt/mnt/dev
busybox mount -t tmpfs tmpfs $mnt/tmp -o noatime,mode=1777


busybox chroot $mnt /bin/bash
# now G1 should be in Debian System

rm -f /etc/mtab
ln -s /proc/mounts /etc/mtab


(5) change root password and install OpenSSH and start it

passwd root

apt-get install debian-keyring debian-archive-keyring
apt-get update
apt-get upgrade
apt-get install openssh-server openssh-client
/etc/init.d/ssh start


(6) If the default package source does not work, you can change this file /etc/apt/sources.list to

deb http://ftp.us.debian.org/debian lenny main


(7) if you want to install gcc compiler

apt-get install build-essential


(8) exit the debian system
exit

(9) Before you proceed to copy the Debian system to the /system/sd, please consider to check the partition size of /system/sd first. If you want to manually increase the ext2 partition size, please follow this guide below. Please backup before re-partition as the process will wipe your sdcard data.

http://forum.xda-developers.com/showthread.php?t=534714

This how you can backup the /system/sd and sdcard

adb pull /system/sd/app app
adb pull /system/sd/app-private app-private
adb pull /system/sd/dalvik-cache dalvik-cache
adb pull /sdcard sdcard


and this is how you restore data after repartition the sdcard (remember this is when the phone is booted up and not in recovery mode

adb push app /system/sd/app
adb push app-private /system/sd/app-private
adb push dalvik-cache /system/sd/dalvik-cache
adb push sdcard /sdcard



(10) Reboot G1
reboot

(11) Copy the Debian system to /system/sd if you use CynogenMod ROM and have ext2 partition in the sdcard

cd /data/local/mnt
tar cf - . | (cd /system/sd/; tar xvf -)



(12) create the mount script as /system/sd/userinit.sh

export mnt=/system/sd

export TERM=linux
export HOME=/root

busybox mount -t devpts devpts $mnt/dev/pts
busybox mount -t proc proc $mnt/proc
busybox mount -t sysfs sysfs $mnt/sys

busybox mount --bind /sdcard $mnt/mnt/sdcard
busybox mount --bind /system $mnt/mnt/system
busybox mount --bind /data $mnt/mnt/data
busybox mount --bind /dev $mnt/mnt/dev


append this script if you want to start ssh server automatically
busybox chroot /system/sd /etc/init.d/ssh start

(12) Reboot G1
reboot


(13) Then you can ssh to your G1 by using ssh root@xxx.xxx.xxx.xxx after enable wifi in G1, where xxx.xxx.xxx.xxx is the IP address of G1.


This is how you chroot manually when you use adb shell access
chroot /system/sd /bin/bash