Computers, Gaming, & Technology Here you can talk about anything with circuit boards, or dilithium crystals, or flux capacitors. Show off your technology, computing, and gaming knowledge.

Running Ubuntu on Android

Thread Tools
 
Old 02-10-2011, 07:55 AM
  #1  
DTN
Moderator
Thread Starter
 
DTN's Avatar
 
Join Date: Feb 2009
Location: Leesville, Louisiana
Posts: 11,731
Received 5 Likes on 5 Posts
Vehicle: 2001 Hyundai Tiburon
Default Running Ubuntu on Android

I was going to make this into a blog post, but it wil require updates and the blog system blanks out posts after a few updates.





I. How android works



So lets start by looking at how android works.



1. boot sector

When you turn the phone on, you see the AT&T or whatever logo. This is the boot sector. It is setting up the phone to perform the next action

2. boot loader

The boot loader is responsible for many things.
  • Recovery mode - this allows for reflashing and updating of software under normal conditions
  • Download mode - this is a failsafe method of updating and flashing software
  • Boot linux/Android -this is the normal mode of operations
3. Linux layer

The Linux layer provides the framework for Android to operate... Disk access, memory management, permissions management, device interfaces, process management...... My own phone runs Linux kernel version 2.6.32.9 currently. The Linux layer is extremely scaled back from what I'm used to. The main difference is the lack of tools and home folder. Many of the files you'd expect to see on Linux are missing such as /etc/profile, passwd, group, and several others.



The reason for the lack of many Linux tools/structures, is Android does not use many of the Linux tools or the Linux permissions model. The Android os talks to the Linux layer and assigns permissions to applications rather then users. Each application runs as it's own username and it's permissions are assigned by the developer and authorized by the user upon installation on the phone. So basically, instead of the standard login/execute with user permissions model, the application is assigned permissions by the user and the user is assigned to the application.



4. The Android layer

Android uese the "Dalvik Virtual Machine". The DalvikVM is much like the JavaVM. The DalvikVM allows each application to run in it's own Virtual Machine. By running in a VM, each application can be started and shut down nearly immediately by saving the state of the memory and reloading it on demand. Each DalvikVM application runs similarly to a standard computer on a network and communicates with the main system and other applications in a limited way. This allows each application to run in a "Sandbox".



II. What is required to run Ubuntu



Ubuntu Linux requires

1. Linux layer -present

2. Memory space - present

3. X interface reader - handled by Android VNC application

4. A new root folder -needed

5. An Arm Ubuntu Filesystem -needed

6. X interface - needed





Currently, I'm working on creating a 4gigabyte armv7l compatable image of Ubuntu in a virtual machine on my Desktop computer (which also runs Ubuntu). I'm running into difficulties with the keyboard. The Keyboard keys ASDF translate to ABCD inside the virtual machine.





Continued later....













Old 02-10-2011, 12:18 PM
  #2  
Administrator
 
187sks's Avatar
 
Join Date: Mar 2006
Location: Lacey, WA
Posts: 12,515
Likes: 0
Received 2 Likes on 2 Posts
Vehicle: Two Accents, Mini, Miata, Van, Outback, and a ZX-6
Default

Interesting project.
Old 02-13-2011, 12:07 AM
  #3  
DTN
Moderator
Thread Starter
 
DTN's Avatar
 
Join Date: Feb 2009
Location: Leesville, Louisiana
Posts: 11,731
Received 5 Likes on 5 Posts
Vehicle: 2001 Hyundai Tiburon
Default

Well, I was able to get it working tonight.... I'm running Lubuntu. At first I was a bit dismayed that I could not get full-blown Ubuntu running because of a package called Mono which Microsoft cleverly placed into the Linux upstream... Oh well. Lubuntu works and it's designed to be lightweight so my Android's processor does not get overtaxed.



The key to the keyboard issue is that Canonical makes rootstock. They set their default keyboard setups to PC105. Here in the USA, we use PC104. So... The completed image creation goes like this..



Code:
sudo rootstock --dist lucid --seed lxde,tightvncserver,openoffice.org,gimp,ssh -fqdn localhost --login ubuntu --password ubuntu --imagesize 3800M --notarball --fullname "Ubuntu for Android" --kbmodel pc104  --locale en_US.UTF-8 --serial ttyS0  --doswap --swapsize 256M
Let me break this down a bit...



sudo rootstock

rootstock creates a ARM image file in a QEMU virtual environment. It then takes that image and turns it into a usable virtual hard disk when complete (if the --notarball is specified)



--dist Lucid

This specifies the distribution time period to use.. like Windows XP, Vista, and 7... Lucid Lynx, 10.04LTS is a LongTermSupport distribution of Ubuntu. It will have less features but be more stable



--seed lxde,tightvncserver,openoffice.org,gimp,ssh

This specifies the packages we want to spawn into the distribution



-fqdn localhost

we will call our new ubuntu "localhost"



--login ubuntu --password ubuntu

very high security login and password



--imagesize 3800M

The size of the image cannot exceed 3999M when placed on any VFAT drive. FAT32 filesystem is used on Android's SDCard



--fullname "Ubuntu for Android"

This is the name of the person who logs into the Ubuntu desktop. It's used for auto-fill purposes sometimes.



--kbmodel pc104

kbdmodel specifies the type of keyboard to use. pc104 in USA, pc105 in europe.



--locale en_US.UTF-8

local refers to a filel on the hard disk which contains locality information like currency, time formats, and date formats.



--serial ttyS0

Serial allows a port in and out of the machine. If, perchance I find a serial port on my android, it would be nice to use it to communicate with the device.



--doswap --swapsize 256M

doswap creates a swapfile. swapsize specifies what the size will be. Linux SWAP filesystems are used to store data temporarily... outputs and inputs, they also provide a place on the filesystem to place devices like serial ports and sound devices.



So... Now, I'm troubleshooting miscellanious problems to bring Lubuntu up to specs. Currently I cannot spawn a terminal inside the X interface, nor can I bring up certain applications which require the terminal. The terminal simply brings up a black screen. The terminal is very important for technical operations in Linux. I must have my terminal.
Old 02-13-2011, 10:52 AM
  #4  
Administrator
 
187sks's Avatar
 
Join Date: Mar 2006
Location: Lacey, WA
Posts: 12,515
Likes: 0
Received 2 Likes on 2 Posts
Vehicle: Two Accents, Mini, Miata, Van, Outback, and a ZX-6
Default

Awesome. Yeah, without the terminal you're sort of crippled in Linux.
Old 02-13-2011, 12:41 PM
  #5  
Super Moderator
 
WytchDctr's Avatar
 
Join Date: Dec 2001
Location: Houston, Texas
Posts: 1,792
Likes: 0
Received 0 Likes on 0 Posts
Vehicle: 14 EGT 2.0
Default

Interesting, because I really dont like android.. lol
Old 02-13-2011, 02:00 PM
  #6  
DTN
Moderator
Thread Starter
 
DTN's Avatar
 
Join Date: Feb 2009
Location: Leesville, Louisiana
Posts: 11,731
Received 5 Likes on 5 Posts
Vehicle: 2001 Hyundai Tiburon
Default

The idea is to have Ubuntu running side-by-side on Android. Using my Android's resources to tgeir fullest potential.... All the power of a desktop in my pocket and still be able to take phone calls.
Old 02-14-2011, 04:50 PM
  #7  
DTN
Moderator
Thread Starter
 
DTN's Avatar
 
Join Date: Feb 2009
Location: Leesville, Louisiana
Posts: 11,731
Received 5 Likes on 5 Posts
Vehicle: 2001 Hyundai Tiburon
Default

I've created a google code repository here: https://code.google.com/p/andbuntu/



It's not much yet, but this will mount an EXT4 loop filesystem (ubuntu.img file) as an EXT4. This has never been done before on android. EXT4 is used from Ubuntu 9.04 on. I believe it was made default in 9.10. This project makes it possible to run 2009+ versions of Ubuntu on Android 2.2 Operating system.



Here is the script which does the meat of the work. https://code.google.com/p/andbuntu/s...se/trunk/uboot
Old 02-16-2011, 01:53 PM
  #8  
DTN
Moderator
Thread Starter
 
DTN's Avatar
 
Join Date: Feb 2009
Location: Leesville, Louisiana
Posts: 11,731
Received 5 Likes on 5 Posts
Vehicle: 2001 Hyundai Tiburon
Default

I have terminal up and running inside X. Somehow during the creation process the /dev/ptmx device was destroyed and replaced with a file called /dev/ptmx. Just a simple, blank file.



to get terminal running, the commands were simple

Code:
rm /dev/ptmx

mknod --mode 666 /dev/ptmx c 5 2


Now I'm focusing on the memory issues. Android reports about 17 megs of memory available. However, I believe I can get it running by utilizing the linux swap inside the virtual filesystem.




All times are GMT -6. The time now is 12:37 PM.