[G1 Android Development] kronarq:
Debian on Haykuro ADP 1.5

I have seen people running into issues getting Debian running on cupcake builds so I decided to post a guide on how I did it. It's important to note that I got this information from http://www.saurik.com/id/10 and http://android-dls.com/wiki/index.php?title=Haykuro_Apps_to_SD. I have simply made some changes for it to applicable to the current setup and to use the native ext2 partition instead of mounting an image like people have been doing with Debian. I would also like to say thanks to everyone in the community for their continued hard work putting out this builds etc.

1.) Get Haykuro ADP 1.5 Apps2SD up and running.

A. Check if your phone is recognised.

adb devices

B. Mount the phone into ADB.

adb remount

C. Bring up the shell.

adb shell

D. Check if /system/sd is visible.

df

E. Skip this step if you already have your apps on SD.

cp -a /data/app /system/sd

F. Skip this step if you already have your app-private on SD.

cp -a /data/app-private /system/sd

G. Remove the current apps folder on device.

rm -r /data/app

H. Remove the current app-private folder on device.

rm -r /data/app-private

I. Link the app folder on sd to the one on device.

ln -s /system/sd/app /data/app

J. Link the app-private folder on sd to the one on device.

ln -s /system/sd/app-private /data/app-private

K. Finally Reboot.

reboot

*You should now have a fully functioning apps2sd build running. We are now going to start getting the files for Debian.

2.) We need to get debbootstrap on the system you are working from. Hopefully you are running a debian based distribution.

apt-get install debootstrap

3.) Next we need to create a folder to mount the ext2 partition of the card to. This is fine being on for instance your desktop.

mkdir sd

4.) Plug in your phone and make sure you choose the mount option.

5.) If your system auto-mounts the drive you will need to unmount it as it is probably mounted with noexec. (This is where mine was mounted for example.)

umount /media/disk1

6.) Now lets mount the ext2 partition on your sdcard. (Note your drive and partition may differ from mine.)

mount /dev/sdb2 sd

7.) At this point I created a folder as I didnt want debian cluttering my partition but this is up to you.

cd sd

mkdir debian

8.) Next lets actually get some files on there.

debootstrap --verbose --arch armel --foreign lenny debian http://ftp.de.debian.org/debian

9.) Now we can unmount the partition.

umount debian

10.) For the next steps we need to get into adb shell again. (See above for getting into shell.)

11.) Now we need to set a couple variables. (Note the mnt variable is set to where you placed your debian files Haykuro Apps2SD mounts the ext2 partition at /system/sd from there we have my debian folder I created.)

export mnt=/system/sd/debian

export PATH=/usr/bin:/usr/sbin:/bin:$PATH

export TERM=linux

export HOME=/root

12.) Now we just have to have debbootstrap extract and configure everything. (This is gonna take 10-15 minutes.)

chroot $mnt /debootstrap/debootstrap --second-stage

13.) From here we have a couple fixes to make.

A.) We need to fix the sources.list for apt.

echo 'deb http://ftp.de.debian.org/debian lenny main' >$mnt/etc/apt/sources.list

B.) We need to fix the resolv.conf

echo 'nameserver 4.2.2.2' >$mnt/etc/resolv.conf

14.) Now we are ready to go into Debian.

chroot $mnt /bin/bash

15.) Let's tidy up mtab.

rm -f /etc/mtab

ln -s /proc/mounts /etc/mtab

15.) And get everything mounted.

mount -t devpts devpts /dev/pts

mount -t proc proc /proc

mount -t sysfs sysfs /sys

16.) Don't forget to set a password for root.

passwd root

You know have a fully functioning Debian in a chrooted environment on a cupcake build. Now you can install OpenSSH or whatever else from here using apt-get. I haven't covered unionfs or various scrip

When you restart your phone will need to resetup some items. You can create a shell script with the commands listed below.

-------------------------------------------------------------------------------------------

export mnt=/system/sd/debian

export PATH=/usr/bin:/usr/sbin:/bin:$PATH

export TERM=linux

export HOME=/root

mount -t devpts devpts $mnt/dev/pts

mount -t proc proc $mnt/proc

mount -t sysfs sysfs $mnt/sys

chroot $mnt /bin/bash

-------------------------------------------------------------------------------------------

Here is the script for those that would prefer to download it.

Debian Boot Script