Howto create a Debian chroot on an Android phone
Howto create a Debian chroot on an Android phone (HTC Desire and Motorola Milestone)
This page will grow once I have everything running, but this is a starting point:http://www.android-hilfe.de/anleitungen-fuer-motorola-milestone/26870-ho…
- [HTC Desire, unbranded, European version]: Flashed (pre-rooted and with busybox included) firmware from http://android.modaco.com/content/htc-desire-desire-modaco-com/315108/04…, taking file 2.09.405.8-update-bravo-stock-rooted-busybox-withradio-signed.zip
- On a Debian squeeze (amd64, but with i386 it will be similar) box:
- sudo apt-get install debchroot qemu-user
- Download qemu-arm-static from http://packages.ubuntu.com/lucid/qemu-arm-static (and its dependency) to get the build-arm-chroot script
- dd if=/dev/zero of=debian.img bs=1024 count=1950000
- sudo mkfs.ext2 -F debian.img
- sudo tune2fs -c0 debian.img
- mkdir debian
- sudo mount -o loop debian.img debian/
- sudo build-arm-chroot –verbose –arch=armel –foreign squeeze debian http://ftp.de.debian.org/debian
- sudo mkdir debian/sdcard
- sudo mount -t proc none debian/proc/
- sudo mount -t sysfs sysfs debian/sys/
- sudo mount -t devpts devpts debian/dev/pts
- sudo chroot debian/ /bin/bash
- export HOME=/root
- export USER=root
- export LC_ALL=C
- echo ‘deb http://ftp.de.debian.org/debian squeeze main contrib non-free’ > /etc/apt/sources.list
- aptitude update
- aptitude install –without-recommends lxde tightvncserver xfonts-base
- [optional, this is my personal package selection]: aptitude install psmisc nmap aircrack-ng ruby1.8 rubygems driftnet wireshark tshark subversion openssh-client openssh-server git
- aptitude clean
- echo localhost > /etc/hostname
- echo ’nameserver 4.2.2.2’ > /etc/resolv.conf
- to create VNC server startup files (setting connect password, I
used password ‘debian’):
[for HTC Desire]: vncserver -geometry 800x480
[for Motorola Milestone]: vncserver -geometry 854x480 - sed -i ’s/\/etc\/X11\/Xsession/lxsession/’ /root/.vnc/xstartup
- echo > /usr/sbin/lxde <<EOF
#!bin/sh
export USER=root
vncserver -geometry 800x480
EOF - chmod +x /usr/sbin/lxde
- echo > /usr/sbin/klxde <<EOF
#!/bin/sh
killall Xtightvnc && killall lxsession
EOF - chmod +x /usr/sbin/klxde
- killall /usr/bin/qemu-arm-static
- exit
- sudo umount debian/proc
- sudo umount debian/dev/pts
- sudo umount debian/sys
- sudo umount debian/
- Copy this debian.img file to the SD card under a newly created folder “debian”.
- Copy the startdeb and stopdeb scripts to the same “debian” folder.
- Deactivate the hard disk mode so that the SD card is again available to Android running on the phone.
- On the mobile phone (e.g. via a “local” shell with ConnectBot or
with “adb shell” from the connected Debian box):
- mkdir data/local/debian
- mkdir data/local/debian/mnt
- sh /sdcard/debian/startdeb
- lxde
- Use any local VNC client to connect to localhost, port 5091 using the password set previously
- klxde
- sh /sdcard/debian/stopdeb