[General Topics] S0AndS0:
1:5 Other methods of running Linux alongside Android

Contents

​

_______SPLIT FOR POSTINGS______

1:5 Other methods of running Linux alongside Android​

These sections that follow ( 1:5:* ) will detail the other methods the author has installed Linux Environment.

Note: at this point I've only one device that is capable of developing a guide to install and integrate cloud services; if you wish to see that change you may make additions on the publicly editable version of this document, or, research it on your own time, or, make a donation to the author; my time can be purchased ;), or, wait for me to document it in my own time.

1:5:1 Using Limbo PC Emulator (QEMU)​

Note: I did not originally include this method as it is a slower way to run linux on android. Its good but emulation always comes at a cost. There are many devices on the market now that will support this app smoothly but like I've said you'll still see a cost.

Note: run-on list of “Cost”

Slow: The nature of emulation causes this. To understand the details of this one will have to delve into some of the details of how machines talk to one another and within themselves, machine language(s), and, the details of what a processor actually does.

I’ll try to sum it up though; a processor type (CPU - ARM/Pentium/AMD and even GPU - Nvidia, iSBX 275, S3 89C911) has a specific structure in how the components and pathways are laid out. This causes each manufacturer to have their own way of sending electrons across the internal structure that makes up the processor, this is usually kept private or proprietary (Xbox, Playstation, Nintendo are good examples of this) to the manufacture, which is the machine language that I was talking about. Compatibility with the other components that the processor connects to is usually achieved by standardization of “shape” meaning the little wires that come off of CPU chip itself and connect to the rest of the circuit board, and the internal firmware of the CPU chip.

To make a processor process a “native” task one must be speaking its language or a language that it understands (many come with what’s called ‘channels’ that handle; Flash, Java, or other human readable programming language) and tell it where to get information and how to handle it and where to send it and what to do next and have all that on the “native” hardware. To make a processor process a “alien” task one must have a way of translating all the processor’s calls for data and handling of data to a completely different set of physical pathways and methods of handling data; this would be like if you and I were placed in completely different parts of the same city and were given the exact same set of instructions (north 5 kilometers, east 12 meters, south east 1 kilometers) and be expected to arrive at the same location; just doesn’t compute, you would end up in a location relative to your start point just as I would but the relative distance wouldn’t change between us. And more than likely one of us would run into an obstacle not far from the start and where we programs and not humans the one of us to hit an obstacle would, like a lemming, just keep failing until killed off.

An emulator bridges the language and hardware divide (visual here: like an octopus wriggling through a small hole when viewed through x ray photography) by wrapping up the data being handled in such a way that another processor doesn’t try to natively run the data being wrapped up (visual here: like the internal organs, of the before mentioned imaginary octopus, not rupturing through the skin and spilling out into the water that it’s entire body is encapsulated in) and then giving the data within a way to communicate with other data that has been wrapped up.

It's not an exact description of emulation but an analogy and how I think about it.

Electron Expensive: The very act of emulation causes the processor that is running the emulation to pull double duty. For every task that has to be carried out by the emulated machine. a task must first be started on the host machine, then the emulated task is started, then the emulated task makes a call for more data or tries to write data, that emulated task ‘call for more’ is sent back to the host machine, the host machine then must make the required translations to compute the request, after computing the request the task is performed, if the task being performed makes ‘calls for more’ then those are then handled just like the parent task (making more calls and translations back and forth) and so on. When done coded properly; emulators can emulate a processor very near the host’s megahertz level and the emulated tasks show very little lag from all this back and forth that the data must first go through, however, due to the closed source nature of hardware and internal firmware, making a well coded emulator is very difficult and usually involves trial and error combined with a little reverse engineering. In most cases when running an emulator, you’ll want a host machine capable of much greater megahertz range than the machine you are trying to emulate (it’s why next gen console emulation is so difficult for most home PC’s) to allow for the back and forth that happens with emulation. This back and forth that the data goes through is what will cost you in battery life because data is transmitted with electricity and there is a finite amount that your battery will store and output.

Hair Puller: As wonderful as it can be to run emulators; eventually things just go wrong and debugging how to work around it can be an exercise in futility.

Note: run-on list of “Benefits”

Extended Compatibility: Being able to run non-native machine code and system tasks gives an enormous amount of flexibility to the host machine. With QEMU you can even emulate the old floppy disk drives on Android and I doubt most households have a fiscal one of those anymore.

Development Options: Emulating hardware allows for development to take place on a set of hardware that doesn’t need to be physically owned thus reducing the cost of development to time, education, and workforce.

Hardware Virtualization:Because the operating system is running on virtualized hardware you are more free to convert the image file that the OS is saved to and run on multiple devices or computers with very little work once you’ve got an installed OS image. I’ve even seen work done to sync system files between clones so that one can login to each clone and after a few minutes have the exact same programs to access and run between devices.

Games:Yep you can play games with this, like mine sweeper and other low memory intensive games, but further development and a faster device will alow for many more titles to be added to the list of “working and fun” that I’ll be compiling here.

1:5:1:1 Apps & Files to download for QEMU​

Limbo from the Google Marketplace

https://play.google.com/store/apps/details?id=com.max2idea.android.limbo.main

Limbo in my opinion is of the one of the best apps out there for novice on up to master rooted phone users. In short its like a "game console" emulator for your pc only with a big twist the "game console" Limbo emulates is actually normal PC processors like a pentium 3 and it runs on android so you can play pc hardware dependent content such as windows if you've got the specs on the go.

Pick A Linux Distribution

The links provided are here for convenience and should be considered untested unless accompanied by a statement that it has worked on android. I will try to test as many as possible and document the; pros and cons; methods of installation if they varied from the main QEMU install guide provided in this main guide.

DSL (Damn Small Linux)

http://www.damnsmalllinux.org/download.html

Worked for me on my Epic 4Gs

Ubuntu (12.04)

http://www.ubuntu.com/download

Kali (like backtrack)

http://www.kali.org/downloads/

There is a live boot ISO for PC, a ARM variant that’s being tested by others, and a network install that I’ve found. For this method (QEMU) I would suggest the PC version; I’ll be testing the network install in the future so I can attempt a “Debian Kit” port for the ARM native version of their distribution.

Backtrack

http://www.backtrack-linux.org/downloads/

Android-x86

http://code.google.com/p/android-x86/downloads/detail?name=android-x86-2.2-generic.iso&can=2&q=

Just ran across this one. It’s android for PC processors instead of the ARM processor. But QEMU is a PC emulator, so if we want a slow Android OS running on top of the normal one for that could be possible. Don’t know yet if it will work but it’s worth a shot as this would allow developers to mobily develop for this variant of Android and normal root users the chance to make drastic changes to the emulated Android environment without too much fear of fouling up their main Android environment.

1:5:1:2 QEMU Linux Install Guide​

1:5:1:2-1 Method one: Install to virtual hard drive with QEMU

1. Download Limbo from the market place

2. Download a Linux distro to start with or try an ISO that you already have if you're feeling adventurous

3. Open Limbo

4. Tap on ‘Load VM’ and choose ‘New’

5. Name your new Virtual Machine and tap ‘Create’

6. Scroll down to ‘RAM Memory (MB)’ tap ‘64’ and choose 512

7. Scroll down to ‘CDROM (*.iso)’ and tap ‘None’

8. Tap ‘Open’ in the new pop up and using the folder navigation window that pops up; navigate the the ISO file that is on your device (usually in your downloads folder) and tap it

9. Back in the main Limbo app screen scroll down to ‘Hard Disk A(*.img/*.qcow2)’ and tap ‘None’ and tap new

10. In the new pop up (Image Name) title your hard disk somthing that will tell you that it’s an emulated hard drive of that distribution, such as ‘DSLhdEmu’ and set a size that you’re willing to sacrifice to running Linux and tap ‘Create’

11. Scroll down to ‘Boot from Device’ tap ‘Default’ and in the pop up choose ‘CD Rom’

12. Scroll down to ‘Network Configuration’ and tap ‘None’ and choose ‘User’

13. Scroll down to ‘VGA Configuration’ tap std and choose ‘vmware’

14. Scroll up, all the way up, on the Limbo main screen and choose start. If everything goes well you’ll be presented with a linux live boot environment that you can then use to install onto the virtual hard drive that you made. Once you install you can remove the ISO from the parameters in Limb and change the boot order to the virtual hard drive.

1:5:1:2-2 Method two: use a computer to make a virtual install

and then converting it to a qcow2 file and install linux to it before moving it over to the device to run it. This is a bit round about but it's my method when I can't run the install but can run the OS due to emulation not being perfect and my device not being powerful enough.

1. Download and install ‘VertualBox’ to your PC from:

https://www.virtualbox.org/wiki/Downloads

Note: You’ll want to choose the one that is for your PC’s hardware and operating system

2. Open ‘Oracle VM VirtualBox Manager’ and click ‘New’

3. Click ‘Next’ and title it something you’ll remember is for this purpose, such as ‘DSLforQEMU’

4. Mouse over to ‘Operating System’ and click on ‘Microsoft Windows’ choose ‘Linux’ in the drop down

5. Mouse over to ‘Version’ and click on ‘Ubuntu’ choose ‘Other Linux’ in the drop down

6. Mouse over to the ‘Next’ button and click it

7. Mouse over to the box with ‘256’ click it and input 512; mouse over to next and click it (unless you’re computer has less than 2 gigs of RAM)

8. Click the ‘Next’ button again because we’re creating a new ‘Start-up Disk’

9. Mouse over to the ‘VHD (Virtual Hard Disk)’ and click the little circle next to it to select that option and mouse over to the ‘Next’ button and click it

10. Click the ‘Next’ button again unless you really want a ‘Fixed size’ image taking up a bunch of space or if you’ve had issues with ‘Dynamically allocated’ option not converting to qcow2 format properly.

11. This next page titled ‘Virtual disk file location and size’ you’ll want to set up yourself based on how much space your hard drive has and how much space your Android device has. I shrank mine down to 3 gigs though and left everything else alone.

12. Mouse over to the ‘Next’ button and click it then ensure everything looks ok and click the ‘Create’ button too. If there is a second window behind that go ahead and click the ‘Next’ and ‘Create’ buttons too to set up the virtual machine

13. Mouse over to the new virtual machine that you’ve created and ‘right click’ it and select settings or select the new virtual machine and select the ‘Settings’ button which should be between the ‘New’ and ‘Start’ buttons

14. In the new ‘Settings’ window, you’ll find oodles of things to tweak and feel free at a latter time, for now mouse over to the ‘Storage’ and click it

15. In the storage settings mouse over to the ‘Storage Tree’ part of the window and look for a disk icon that says ‘Empty’ and select it (this is the virtual machine's CD drive)

14. With the virtual CD drive selected mouse over to the ‘Attributes’ part of the window and select the checkbox to enable ‘Live CD/DVD’, mouse over to the disk icon just to the right and a little above the checkbox and click it to set up where the ISO is for installing Linux, select ‘Choose a virtual CD/DVD file...’

15. Use the new window titled ‘Choose a virtual CD/DVD file’ to navigate and select the ISO file that you wish to use to install Linux to the virtual hard drive image that was created in step 11

16. Mouse over to the ‘Open’ button and click it then click the ‘Ok’ button in the ‘Settings’ window that was behind it.

17. Back in the main window for VirtualBox titled ‘Oracle VM VirtualBox Manager’ ensure that the virtual machine that we’ve been making is still selected and then mouse over to the ‘Start’ button and click it.

18. Interrupt the boot with one of the function buttons on your keyboard when the new window pops up and starts to paint in what will look like a computer starting up in a window (usually ‘F2’ or ‘F10’ or ‘F12’)

19. In the interrupted boot menu within the “VM” window choose the option that corresponds with the CD drive to make the virtual machine boot from CD this time around only

20. Let the live boot process process for a bit and eventually you should be presented with a window that looks like a linux desktop is inside of it

21. Follow the instructions for installing your specific distribution to a hard drive and when that guide states to install to a hard drive just remember to be selecting the virtual hard drive that was created in step 11

22. After installation to the virtual hard drive has finished test that it installed correctly by shutting down the virtual machine and getting back into the settings described in step 15 and “eject or remove or unmount” the linux ISO file from the virtual CD drive

23. Start the virtual machine again and check that it boots correctly from the virtual hard drive image. If it does shut it down again properly. If it doesn’t try again or try a different distribution.

24. Open the ‘Settings’ window again and select ‘Storage’ again, this time though under the ‘Storage Tree’ part of the window select the virtual hard drive image (its the *.vdi file that was created in step 11) and mouse over to the disks icon to in the ‘Attributes’ part of the window to the far right of where it says ‘Hard Disk’ and select ‘Choose a virtual hard disk file...’ and make a note of the full folder path to the *.vdi file; somewhere like in a notepad or scrap of paper or memorize it.

25. Open a terminal window on your PC and convert the *.vdi file to a *.qcow2 file with the following command structure

Example : Syntax

# qemu-img convert -O qcow2 *.vdi *.qcow2

Example : useable

# cd /home/dev/dumps

# qemu-img convert -O qcow2 DSLforQEMU.vdi DSLforQEMU.qcow2

26. Let the converter convert and come back to it after a few minutes

27. Once the converter has converted it’s time to transfer the qcow2 file to your Android device, use a cable or a SD card adapter to get it over to the folder that Limbo saves virtual hard drive

28. Start up Limbo and create a new machine much like the steps in method one but you’ll not need to select a ISO file, instead select the virtual hard drive image as the hard drive to boot from and set the other setting the same as method one and start the virtual machine to test it on your Android device.