[XPERIA X8 General] krzysiek_grucha:
First of all please notice, that this is

not

my own development project, it is just a port of the guide for HTC G1 from http://pdaclub.pl/forum/htc-dream/%28how-to%29-instalacja-debiana-%28na-g1%29/ for Xperia X8.

Please be aware, that this solution has been only tested with one Xperia X8 device running Floyo 0.30 (thanks to Racht for this great ROM :D !). I cannot guarantee that it will work on every other custom ROM as well as on the stock Xperia X8 ROM's.

Please also notice, that instructions in this tutorial in some cases can brick Your phone. I'm not responsible for any damage to the software or hardware caused by this tutorial. You can follow the instructions from this guide but

only

at Your own responsibility!

Please also notice, that I'm not an Android Developer. I'm just a user with some knowledge about Unix, so don't blame me if this tutorial won't work for You. You can post Your problems and we'll try to solve it together.

OK, I think that's all for the intro :) .

TABLE OF CONTENTS:

1) The purpose of this guide

2) Requirements

3) Things to prepare

4) Installation

5) Some known bugs

6) Some little tips

1) The purpose of this guide.

This guide reffers to the newbie users who want to run Debian Linux on their Xperia X8. Step by step I'll try to explain how to run Debian simultaneously (at the same time) with Android. To gain that we'll use a program/command chroot (http://en.wikipedia.org/wiki/Chroot) which will allow us to Run Debian in Android as something similiar to "virtual machine" on PC.

You may ask why to run Debian on Android device ?

There are several answers to that question:

a. For testing...

b. ...developing applications in for e.g. C/C++ for ARM platform and try to run them on Android OS.

c. Installing Linux applications (like web servers, WiFi cracking software) and test what is working and what isn't.

d. For fun :)

For those who are asking what Debian actually is - please refer to the page http://en.wikipedia.org/wiki/Debian.

2) Requirements.

Before continuing check if You and Your device meet the following requirements:

a. ROOTED Xperia X8 device (I recomend to have Floyo 0.30 by Racht ROM installed, because it was tested on this ROM. I don't know if it'll work on different ROM's.)

b. At least 800MB space free on Your SD Card

c. Access to PC computer

d. Basic knowledge about Windows command line and Linux shell

e. About 1 hour of free time to set up everything

3) Things to prepare.

a. Download one of the following packages:

or

These are the packages containing Debian drives image as well as all other files needed to install Debian on Android. The only difference is that the first one is 750MB and the second is 1,5GB. The second one is for bigger SD Cards, you'll get more free space in Your "virtual machine" after running it.

b. ADB Shell (can be found in Android SDK in folder platform-tools\ - http://developer.android.com/sdk/index.html)

c. SSHDroid from Market (only if You're planning to connect to Your Debian via SSH)

d. PuTTY for Windows (only if You're planning to connect to Your Debian via SSH - http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html)

e. ConnectBot or Terminal Emulator from Market (it's a good terminal application)

The bold items are necessary.

4) Installation.

PERFORM A FULL SYSTEM BACKUP USING XRECOVERY BEFORE PROCEEDING ANY FURTHER !

Now the best part :D !

There are several ways to install Debian:

1) Some are using Terminal Emulator application (preinstalled in Floyo 0.30)

2) Others are connecting with phone via SSH

3) But some are using adb shell command from Android SDK and that's the way we'll do this, because I know there are some differences between using adb shell and other ways. I tested it with adb and it is working so I think it is the right choice.

First, unpack the *.rar file of Your choice (debian750.rar or debian1.5.rar) to Your hard disk on a PC.

Replace file bootdeb which can be found in Debian folder after unpacking the archive with the one from bootdeb.zip file attached to this post. You need to do this, because the bootdeb file which is in the archive won't let You boot Debian correctly. It'll only cause Xperia X8 to restart after few seconds since execution. The file in bootdeb.zip has been corrected by me and it allows to boot Debian without any (known :) ) bugs.

Copy the Debian folder from the archive

directly

to the SD Card (also known as a root directory of Your SD Card). You should have the following directory tree on Your SD Card visible in Xperia X8:

Enable USB Debugging in Xperia X8. To do this go to Settings->Applications->For programmers and check USB Debigging.

Connect Your phone via USB and don't mount the SD Card (just like You want to charge the phone via USB).

On Your PC click Start->Run, type cmd and cd to the directory where You installed Android SDK, then cd to platform-tools and execute command adb shell. After execution You should see a # symbol in the command line window like on a below screenshot:

Now execute the following commands in ADB ahell on PC:

And You shoul get something like this:

And it's done :D ! Debian Linux has been installed.

Type in ADB Shell command

As many times (I guess 3) until command line window disappears. Disconnect Your phone from PC and unplug the USB cable.

Now let's try to run Debian - on Xperia X8 run ConnectBot or Terminal Emulator and type:

Remember to allow the terminal application to run as a superuser.

After a while You should see a screen similar to the below screen shot:

I removed the lines (blured section) which You won't see after first boot. I have them, because I installed Apache Web Server and it is starting at the logon :) .

As You can see we are logged into Debian Linux :D!

Now, execute the following command:

It's necessary only after first logon. It'll let You to set up root password (only for Debian, not for Android) and do some more stuff (actually I didn't even check what this script is doing :D - forgive me).

And it's done... Now You are on Your own with Debian installed :D ! Go, play around, because it is a fully functional operating system for Your demand :) .

What about the performance ?

My Debian is still working since one day in the background (minimize the Terminal Emulator window after logging in) and I haven't suffer any problems with the low performance yet. I even set up an icewm window manager and VNC Server to be able to log in to my machine via VNC client and see the desktop and it isn't too laggy :) . But that's only a stupid future. The most power we get because of the access to Linux Shell (the command line which let us to use Linux applications on our Xperia X8).

4) Some known bugs.

For Your own safety read this short section.

1) Better don't try to unmount the SD Card from Xperia X8 (for e.g. when mounting the phone to the PC) when Debian is running. I didn't try this yet, but the bootdeb script is creating something called loop device in the Android system which should be properly unmounted. If this device will wanish due to some user activity the phone may not boot correctly any more.

2) When You finish playing with Debian

always

use the exit command to safely unmount the loop filesystem. After exit Your phone needs to be rebooted, better don't try to override this setting.

3) If somehow You will loose connection with Debian in Terminal Emulator You always can run:

And log in again. You'll just receive several errors on the boot screen, because the script will try to mount already mounted file system.

5) Some little tips.

1) After first logon execute the following commands:

And in the opened text editor add these lines (do not overwrite the file contents):

After this execute the command:

It will update Your applications repository available for Debian.

2) Running Apache Web Server:

Execute command:

To install Apache Web Server. When the installer asks You if You want to proceed with the installation type Y.

After installation run command:

And then You can try to connect to Your phone on port 80 using HTTP browser and see if there's a message It works! :D.

3) Uploading files to Your Debian "virtual machine":

Install SSHDroid from Android Market.

Download program WinSCP and connect to Your device on port 22 using root as a user name and admin as a password.

After connection open location /data/local/mnt and You'll see Your Debian file system.

I think that's all for now.

I hope this guide will help "newbie" users to run Debian on their phones.

If You have any more questions or problems please let me know.

Regards,

Chris.