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
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

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

or here

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

(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 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 script


# 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 lenny main

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

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

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


Shane Par-Due said...

Is it possible to dualboot the stock android image and Debian? That would be ideal in my book.

Anonymous said...

Looks good! Can you access devices like bluetooth keyboard while in Debian? How about USB? Can you access the filesystem from Debian so that you could, for instance, write a program in Debian and run it under Android?

javacom said...

If you want to write a C / C++ program on Android, use the Android NDK compiler.

The debian compiled program can only run under debian system

kousal said...

sadly, is not work!!!