Guide [Linux][Android]Android on Linux for complete Android dummies - General Questions and Answers

As a new Android user, it take me hours, if not days, to understand some very basic Android concepts. So here we are:
Welcome to the Android on GNU/Linux for complete Android dummies
Introduction
The first concept to understand is that Android, even if it is based on a Linux kernel, is not GNU/Linux, it is Android. That imply some huge differences, the first ones being the file hierarchy and what you can do or not do with that file hierarchy. :cyclops: :crying: :cyclops:
To illustrate that difference, on GNU/Linux, you can copy, move, modify or delete any file, the only condition for that is to have the corresponding access rights. As root, you can do whatever you want on the whole file hierarchy.. On Android, you cannot do that, because the device comes with built-in protections that can save your device if you make a wrong manipulation, but get in your way when you want to make a backup or restore it..
To make things worst on GNU/Linux, even if Android is reasonably well supported, the actual Android support of your installation will depend on your distribution, your WM/Desktop and what software is actually installed.
My distribution is Gentoo, my desktop FVWM-Crystal. That imply I will use generic solutions that should work in any combination of distribution/desktop. The way to install the software will differ, the main difference being that Gentoo use 'emerge' to install the software, when Debian use 'apt' and the rpm based distributions use 'rpm' (or Yast in Suse, etc.).
Note: The command that must be issued as root will be prefixed by '$ ', the command that must be issued as your normal user will be prefixed with '# '.
Android
The most important thing to understand is:
To make a full backup of an Android device, it must be rooted or have a Recovery mode with backup
That imply you must first unlock your phone and install a Recovery.
To make a full backup of an Android device, it must be rooted or have a Recovery mode with backup
That imply you must first unlock your phone and install a Recovery.
To make a full backup of an Android device, it must be rooted or have a Recovery mode with backup
That imply you must first unlock your phone and install a Recovery.
To make a full backup of an Android device, it must be rooted or have a Recovery mode with backup
That imply you must first unlock your phone and install a Recovery.
To make a full backup of an Android device, it must be rooted or have a Recovery mode with backup
That imply you must first unlock your phone and install a Recovery.
To be able to root your device, you must have a Recovery, which imply the device must be first unlocked.
As long your device is not unlocked and don't have a Recovery, what you will be able to backup is device dependent. It can vary from nothing to not much.
When you understand that, you can begun to work in an efficient manner.
MTP
Most recent Android devices use MTP to communicate via the USB bus. MTP mean Media Transport Protocol. What a given device will provide via MTP is device dependent. It will also vary if it is locked or not, and if it is rooted or not.
Android on GNU/Linux
It is 3 ways to communicate via MTP. The first one is using mtpfs, the second one via rsync, the third one via adb.
mtpfs
We will not use plain mtpfs, because it give unreliable results. Instead, it is several other tools that have a much better MTP support, and we will use them.
On Gentoo, it is a global USE flag 'mtp' that will enable MTP support in all programs that have optional MTP support. It is a good thing to add it in /etc/portage/make.conf and update your system as usual before continuing.
Also, for mtpfs to work, as with other pluggable devices, we need to be into the plugdev group:
To check it:
Code:
# groups
wheel audio cdrom video games usb users portage android vboxusers roccat plugdev dom
If you are not into the plugdev group:
Code:
$ gpasswd -a YOUR_USER plugdev
You can now logout and login.
KDE
kio-mtp is a slave for KDE's KIO framework. After installing it, your MTP devices appear e.g. in Dolphin. You may have to logout and login.
Gnome
I don't use Gnome at all (no systemd, *kit, udisks and the like here, which imply a Gnome free system ). See XFCE as Gnome use gvfs, it should work with Nautilus too.
XFCE
PcManFM support MTP via gvfs. If it doesn't work, check your distribution documentation. On Gentoo, to have mtp as global USE flag will add MTP support in gvfs. Alternatively, you can add it for gnome-base/gvfs in /etc/portage/package.use. This should work for Thunar too.
On Debian, it is a package called gvfs-mtp.
gMTP
gMTP is a simple MTP client for Solaris and Linux based on GTK+.
After its installation, launch it, click on connect. A few seconds later, you will get the file hierarchy of your device. You can start to manipulate the files. It support features like Album, Artwork and play lists. The actual support of a given feature can depend on your device and on the libmtp version.
Media players
Many media players have built-in or optional MTP support. Those players include Amarok, Audacious, Rhythmbox and others. MTP support on these players can vary, as example with Audacious it depend on plain mtpfs and is completely buggy at that time of writing (April 2014). On the other hand, if you use another MTP file system implementation like gphotofs, simple-mtpfs or go-mtpfs, you can use any GNU/Linux software with your MTP devices.
gphotofs
gphotofs is a FUSE file system for interfacing with digital cameras using gphoto2. Most modern mobile phones are cameras at the same time, and gphotofs can be a good alternative to simple-mtpfs or go-mtpfs. gphotofs is used among other by professional cameras and is therefore very well tested and reliable.
You can also install software like gtkam, and your MTP device will appear automatically into them. That can be very useful if you take a lot of pictures with your phone.
After installation, to mount the device:
Code:
# mkdir ~/AndroidDevice
# gphotofs ~/AndroidDevice -o allow_other
To unmount the device:
Code:
# fusermount -u ~/AndroidDevice
I really prefer to manually mount the device. When done, you can use any file manager to browse its files, and any graphic or media software as well. Please be aware that, due to limitation with the MTP protocol (it can only deal with complete files), it is better to copy your files locally and to work on these copies.
simple-mtpfs
It work the same than gphotofs.
After installation, to mount the device:
Code:
# mkdir ~/AndroidDevice
# simple-mtpfs ~/AndroidDevice
To unmount the device:
Code:
# fusermount -u ~/AndroidDevice
go-mtpfs
Another MTP FUSE implementation.
On Gentoo, we need to unmask 2 packages in /etc/portage/package.keywords:
Code:
dev-libs/go-fuse **
sys-fs/go-mtpfs **
That will install these 2 packages directly from their source code repositories:
Code:
$ emerge --ask go-mtpfs
As usual, to mount the device:
Code:
# mkdir ~/AndroidDevice
# go-mtpfs ~/AndroidDevice &
To unmount the device:
Code:
# fusermount -u ~/AndroidDevice
rsync
rsync is a software mainly used to make professional backups and restores, or to synchronize websites. The main advantage of rsync is that it is possible with it to automatize the process of backup and restoration.
To use it, you need to install rsync.
Code:
$ emerge --ask rsync
In /etc/rsyncd.conf:
Code:
# /etc/rsyncd.conf
# Minimal configuration file for rsync daemon
# See rsync(1) and rsyncd.conf(5) man pages for help
# This line is required by the /etc/init.d/rsyncd script
pid file = /var/run/rsyncd.pid
use chroot = yes
read only = yes
# Simple example for enabling your own local rsync server
#[gentoo-portage]
# path = /usr/portage
# comment = Gentoo Portage tree
# exclude = /distfiles /packages
[backup]
path = /home/dom/rsync
list = yes
comment = personnal backup
hosts allow = 192.168.178.*
The exact content of that file may be dependent on your distribution. You also have to adapt the variables 'path' and 'host allow' to your actual configuration. rsync will not use the USB but your WAN network (typically the wi-fi). In that example, the backup will be find in /home/dom/rsync and all the devices on your local home network will be allowed to access it via rsync. For testing purpose, you can comment the hosts allow line, this will allow any host.
When done:
Code:
$ /etc/init.d/sshd start
We also need to install rsync backup for Android by Michal Kowalczuk in the phone.
TODO: continue the rsync setup to the end and put some examples.
adb.
ADB mean mean Android Debug Bridge, and it is a part of the Android Software Development Kit (SDK). We will need it anyway to flash the Android devices.
To install it on Gentoo:
Code:
$ emerge --ask android-sdk-update-manager
This will install just an infrastructure. To actually install, manage and update the Android SDK, just run:
Code:
$ android
.
As emerge modify the PATH environmental variable, that for the Android SDK to work well, the best thing to do at that point is to reboot your computer. It doesn't append often on GNU/Linux, but that time it is best to do so.
On other distribution, if it doesn't provide a package to install it, you have to download the SDK from Get the Android SDK. It is several threads on the forum that deal with that:
[GUIDE/Linux] Install Android SDK the "Linux way"
[APP] Linux-on-Android project (Complete Linux Installer) (more for developers this one)
Now, we are ready to play with our phone.:good:
Operations on files
To be able to play with the files in your phone, you don't need to install all the above packages. The one that is really needed is adb. After that, all depend of what you want to do and what kind of integration you want into your GNU/Linux system.
Anyway, it is cool to be able to play with the phone with any file manager. This is why I would recommend to also install one of gphotofs, simple-mtpfs or go-mtpfs. If you also have a MTP camera, go for gphotofs, you will need it anyway. From my short experience, simple console based solution like gphotofs are more reliable than GUI solution (with the notable exception of gMTP and gphoto2 GUI like gtkam), and after mounting they allow the use of any file manager, player, etc.
Where we are now, what files you will be able to see and to operate on will depend on your device. We are not even unlocked.
If you still not believe me, read that: Solution Available for 4.x Devices: This solution will not back up and restore contact, SMS or calendar information
With my HTC One, I can copy the content of the whole sdcard. Most interesting are the Download, Movies, Music and DCIM folders.
It is just to plug the phone on the USB, mount it as explained above, and use any file manager to copy the files. We can also copy new files into the phone.
This must be enough to get you started. From here, you may want to continue with something like [Tutorial] Root, Unlock, Recovery and flashing a Custom ROM . Choose the one that correspond to your device.
If you want to start developing for Android, you may be interested by [GUIDE][WIN/LINUX] A COMPLETE ANDROID DEVELOPMENT GUIDE FOR NEWBIES-SArnab©®.

Related

Installable Linux Image for HTC Herald / T-Mobile Wing (UPDATED: Android Install)

I've developed a kernel and base linux system suitable for installation on the HTC Herald / T-Mobile Wing series of phones. This image is for installation of a root filesystem directly to an SD storage card (no need for a root FS image). Several things don't work so far -- this is early development. But it's enough to play with. My hope is that we can use development on this as a jumping point for getting Google Android to run on the wing.
UPDATE (2/10/09):
I've added a Resources section to collect the useful information and links that have been posted here and in the other thread. I've also updated the known issues section for Android to reflect what I've discovered so far.
UPDATE (2/9/09):
I've got an updated kernel config and images for starting Android now! Android will now pull up the boot animation and begin startup. It still does not complete startup, but at least we know we've got the right stuff in the kernel now!
I've added instructions at the bottom for installing these and using them with an already set up linux system (per the first set of instructions).
UPDATE (2/7/09):
Here's some extra files you can grab if you're interested in development: (The patches don't apply cleanly yet against the linwizard kernel)
Kernel .config file I've used (against the linwizard 2.6.25 kernel): http://dl.getdropbox.com/u/198699/linux_wing/wing_config
Android diffs (between SDK android kernel and kernel.org 2.6.27 kernel): http://dl.getdropbox.com/u/198699/linux_wing/android-2.6.27.patch
Contents
Part 1: Linux Base System Installation Instructions
Part 2: Android Installation Instructions
Resources
Part 1: Linux Base System Installation Instructions:
The below instructions assume you have access to Linux and can read/write to your SD storage card.
To start out with, here's what you'll need:
Haret + default.txt + kernel (.zip, 1.4mb)
Root filesystem contents (.tar.gz, 13.1mb)
1. Repartition your SD card.
For this, you'll need to use something like Partition Magic or some other suitable partitioner (in Linux, you can use gparted to resize your Windows partition.) I recommend the following layout:
Partition 1: Primary, FAT16 or FAT32 containing your original Windows files (any size of your choosing)
Partition 2: Primary, Linux Swap, 128mb
Partition 3: Primary, EXT3, >=64mb​My linux partition is 650mb with a 1.2gb Windows partition and 128mb swap -- adjust to preference.​2. Format the swap and linux partitions.
In linux, run the following: (I assume your SD card is /dev/sdb -- adjust if different)
Code:
# sudo mkswap /dev/sdb2
# sudo mkfs.ext3 /dev/sdb3
I'm assuming the layout in step 1 as well.​
3. Mount the new Linux partition.
Run the following:
Code:
# sudo mount /dev/sdb3 /mnt
4. Copy the base linux system into the new Linux partition.
Save the root filesystem .tar.gz file from above to somewhere (I'll assume $HOME). Then run:
Code:
# cd /mnt
# sudo tar -xzvf $HOME/rootfs.tar.gz
# cd ..
5. Unmount the linux partition.
Run the following command:
Code:
# sudo umount /mnt
6. Mount the windows partition and copy the Haret executable + kernel.
I'll again assume you saved the "haret+kernel.zip" file to $HOME. Run the following:
Code:
# sudo mount /dev/sdb1 /mnt
# cd /mnt
# mkdir linux
# cd linux
# sudo unzip $HOME/haret+kernel.zip
# cd /
# sudo umount /mnt
At this stage, your Linux base system and kernel should be installed. All that's left is to remove your SD card and re-insert it into your phone, start up HaRET and enjoy.
7. Log in
Once you're booted into Linux, you can log in with:
Username: root
Password: wing​
Plug in a USB cord to log in on your laptop. If your laptop runs linux, you'll need to make sure that the usb0 network interface has the right address:
Code:
# sudo ifconfig usb0 10.100.0.2 up
The phone's address will be 10.100.0.1. You should be able to SSH or telnet in to the phone and mess around. Run "startx" to bring up X and such.
What's Working
Minimal X server capable of landscape and portrait video modes (KDrive, using the framebuffer (omapfb))
Touch screen support + calibration software (TSC2046 driver + tslib)
Console keyboard (some characters are difficult / impossible to type due to the limited key layout and driver)
USB gadget support for connecting with my laptop (I can SSH / telnet into the phone, or ssh/telnet from the phone into my laptop)
Full access to the SD card (even the Windows FAT side -- mmci-omap driver)
Known Issues
Bluetooth -- haven't been able to get a working driver, or anything to even recognize that it exists
WLAN -- same as bluetooth
GPRS / Phone -- same. There appears to be a GSM device, but I haven't been able to do anything with it.
Most of the extra buttons don't fire any events
LEDs for the most part don't work
Battery and power stats aren't available, as well as power management
No control of the backlight or display power
Sound not functional -- don't have any drivers / software compiled for sound, so I don't know if this would work or not
No real time clock (RTC) functionality
Part 2: Android Installation Instructions:
For these instructions, the recommended procedure is to copy the files you'll need to the Windows side of your SD card and install using the Linux boot system. Make sure you follow the instructions for getting a Linxu base system installed first before following this.
First off, grab the following files (Required)
Android patched kernel for the wing (same as the below kernel, but with android patches): http://dl.getdropbox.com/u/198699/android/zImage2
Android root filesystem, compiled for the wing: http://dl.getdropbox.com/u/198699/android/root.tar.gz
Android /system partition, compiled for the wing: http://dl.getdropbox.com/u/198699/android/system.tar.gz
Script for starting Android: http://dl.getdropbox.com/u/198699/android/start_android
You can also grab the kernel config file if you're interested in building the kernel (I'll have the android patch set available soon) (Optional):
Kernel .config file for the modified kernel: http://dl.getdropbox.com/u/198699/android/kernel_config
1. Copy all files to your wing
From Windows Mobile, download the 4 required files above and place them on your storage card:
root.tar.gz -- Place in /Storage Card/
system.tar.gz -- Place in /Storage Card/
zImage2 -- Place in /Storage Card/linux (overwrite the file that's already there, or re-name the original first)
start_android -- Place in /Storage Card/
2. Install Android
Run HaRET.exe to start Linux. It should boot the new kernel (you most likely won't notice a difference). Once in Linux, run the following commands (you can do it directly with the wing keyboard, or you may elect to use SSH (see instructions above) -- SSH is easer in my opinion):
Code:
# cd ../..
# mkdir android
# cd android
# tar -xzf ../mnt/windows/root.tar.gz
# tar -xzf ../mnt/windows/system.tar.gz
# cp ../mnt/windows/start_android ../bin
# chmod 775 ../bin/start_android
If using the Wing's keyboard, you'll need to use the following key mapping:
'/' --> 'Tab'
'-' --> 'Alt + x'
'_' --> 'Alt + c' (I think -- it's Alt + one of the letter keys)
Numbers -> 'Alt + <top row>'
3. Start Android
At this point, android is now installed and ready to run. Simply execute the following command to start Android:
Code:
# start_android
After a few seconds, you should see the Android startup animation appear.​Known Issues
The omapfb driver currently in use does not support page flipping, preventing the Android GUI from being displayed
Resources
WMStorage -- turn your wing into a USB SD card reader (Kudos to Kuff!): http://forum.xda-developers.com/showpost.php?p=3263023&postcount=5
Wing Service Manual (kudos to drmidnight!): http://forum.xda-developers.com/showpost.php?p=3291171&postcount=132
Google Andriod for Herald and Tmobile Wing -- the thread that started it all: http://forum.xda-developers.com/showthread.php?t=398830
Enjoy
If this is based on the linwizard kernel, have you seen the Android kernel that the linwizard crew ported over to the Wizard? It's incomplete, but it might be a good starting point for a an Android Port. When I have time tomorrow, I might try installing this.
Hmm, I actually haven't tried that. My image is based on the Polaris development tree, using htcwizard_defconfig. I added some extra drivers, like the touchscreen and SD drivers from there.
Looks like their download of the android kernel is down, unfortunately.
Hey guy, I can and will help you!
A winrar is you!
I don't know how to work with GSM module, but sound drivers should compile OK
Can't find your SD-card in the partitioning program?
As mostly your sd-card is not seen as a "drive" in Windows and in Linux, you can use the "WM5Storage"-tool to do so.
The .cab is attached. Just install it on you device, reboot and start the program without the device being attached to you computer.
Uncheck "Read-Only" and "Removable Class" en tap "Active".
Now you can connect your device (with the sd-card in it) and go on partitioning.
Hi Guys!
I'm surprised. This is the first image and way thats works on my german herald.
My linux experience is very limited. But i want help to let run Android on herald.
What are the next steps?
Morning, I will try to set up android filesystem.
Thank's a lot,
expone
Glad to hear it works for you!
I've managed to get an earlier version of Android to at least begin to start (I get the red-eye moving back and forth), but nothing happens after that.
My guess is that the video is working based on the ability to get the red-eye, but that either some other driver isn't working, or there's not enough free memory.
The image I used was a modified linwizard kernel (not the one I have here), plus a root filesystem that contained Android as an ext2 fs. I never tried with a swap partition enabled.
If we can get our hands on a copy of the android root filesystem in a form that we can mount with this image, perhaps there's a chance of running it. I saw a link somewhere about someone getting this method to work on a different phone (they copied an android root filesystem image to SD card and mounted it from linux, then started android). I'll have to dig around a bit to find it again. Expone, good luck!
Another thing is that we need lots of drivers. If we can get our hands on a spec sheet of the herald listing all the chipsets used, that might give us what we need to start getting this to work. More than likely we'll need to port (or even write) some drivers from different platforms though, as none of the drivers I compiled into this kernel seem to work for things like bluetooth and wifi. Those are probably secondary to getting android to run though -- more for getting it useful.
Just my thoughts.
darkstar62 said:
Glad to hear it works for you!
I've managed to get an earlier version of Android to at least begin to start (I get the red-eye moving back and forth), but nothing happens after that.
My guess is that the video is working based on the ability to get the red-eye, but that either some other driver isn't working, or there's not enough free memory.
The image I used was a modified linwizard kernel (not the one I have here), plus a root filesystem that contained Android as an ext2 fs. I never tried with a swap partition enabled.
If we can get our hands on a copy of the android root filesystem in a form that we can mount with this image, perhaps there's a chance of running it. I saw a link somewhere about someone getting this method to work on a different phone (they copied an android root filesystem image to SD card and mounted it from linux, then started android). I'll have to dig around a bit to find it again. Expone, good luck!
Another thing is that we need lots of drivers. If we can get our hands on a spec sheet of the herald listing all the chipsets used, that might give us what we need to start getting this to work. More than likely we'll need to port (or even write) some drivers from different platforms though, as none of the drivers I compiled into this kernel seem to work for things like bluetooth and wifi. Those are probably secondary to getting android to run though -- more for getting it useful.
Just my thoughts.
Click to expand...
Click to collapse
I saw someone with an Elfin who had a similar issue but it turns out that it just took 20 minutes for android to boot.
The full source code of Android is available online.
You're right about the drivers, though. We'll probably have to write some of our own.
Can you provide your android images?
One Idea:
Is it possible to merge this two file systems of android and this Linux File system? We get the working driver from this system and get software of android system.
What problems might occur?
@darkstar62:
Can you get me some tips where I can find the image?
You can find the android source code here:
http://source.android.com/
If you have a cross-compiling toolchain, you can build it up. As far as binary images go, I don't have one yet for the wing that works -- I'll be working over the next few days or so to get one compiled for the arch and installed.
I found instructions here for getting an earlier version of Android to run off SD card:
http://wiki.kldp.org/wiki.php/AndroidPortingOnRealTarget
All the porting sites I've found talk about pulling the Android /system and /data partitions from the emulator. I don't think that's necessary though (especially with the Android source code out now). Browsing around, I think I may need a different toolchain compiler -- not sure mine supports EABI (see here: http://elinux.org/Android_on_OMAP#Compiler)
Hopefully tonight or tomorrow I'll be able to get my toolchain working and build a kernel. I'm going to attempt to compile Android's kernel source with their patches using bits and pieces from my kernel configuration (the one for the kernel in the howto). With any luck all will be well. Then the real fun in building Android begins.
Also, to whet your appetite, someone managed to get Android running on a phone not too dissimilar from the wing -- OMAP730 processor @ 200mHz, 64mb of RAM, SD card:
http://ohawatch.blogspot.com/2008/02/android-running-on-omap-730-200mhz.html
Also, TI showed android on our processor, the OMAP850 200mHz CPU:
http://forum.xda-developers.com/showthread.php?t=400905
So with a bit of luck I think we'll have a rather nice Android platform on our phones.
I was together with a colleague ever compiled a kernel. We had the ARM GNU / Linux compiler used.
Myself, I need more time to get more information about this topic.
Where will we discuss in the future? In this topic or in the other?
I would say, since this thread is really meant for using an installable Linux image that we keep Android-related discussion on the other thread (since that's what its topic is).
On the other hand, having all the images in one place at the front of this forum with installation instructions makes it very accessible. Perhaps we should rename this thread to something like:
"HOWTO: Multi-Boot Linux, Android and WM6 on T-Mobile Wing / HTC Herald (in work)"
I hate to turn this thread into a spin-off from the other one though...
Anyone have any thoughts?
darkstar62 said:
I would say, since this thread is really meant for using an installable Linux image that we keep Android-related discussion on the other thread (since that's what its topic is).
On the other hand, having all the images in one place at the front of this forum with installation instructions makes it very accessible. Perhaps we should rename this thread to something like:
"HOWTO: Multi-Boot Linux, Android and WM6 on T-Mobile Wing / HTC Herald (in work)"
I hate to turn this thread into a spin-off from the other one though...
Anyone have any thoughts?
Click to expand...
Click to collapse
I believe this a real good since i have little to no time to work on it.
All because of school. UGH!
I'm just glad I inspired you guys in making this happen.
So I will indeed keep the other thread open cause i would have time working on porting android to the wing in a month.
@darkstar62:
Is it possible that you provide me your kernel sources and make-project-file?
So I could even work...
The sources I've been working from come from the linwizard project:
http://linwizard.sourceforge.net
I used a git clone from their instructions using the polaris branch. It's a 2.6.25 kernel (the latest Android is based on 2.6.27...) so we'll have to either port the Android patches from 27 to 25 or port all the linwizard drivers to the android 27 kernel.
I'll post the .config file I'm using when I get home (it's on my desktop there).
A cursory look seems to indicate that it'll be easier to port the android patches to the linwizard kernel, since there's a lot less code involed (and most of the patches apply cleanly against it -- some conflicts need to be resolved though).
I got the patches by git cloning the android source code and diffing their kernel source against the kernel.org kernel of the same version. I'll post that diff when I get home too.
I've got an Android filesystem image compiled for the phone, and it seems to work (I can run the binaries from it using our working kernel -- just can't boot without the patches). So, assuming we get a working kernel, running Android should be a slam-dunk.
More to follow. If things start getting more involved, I'll probably start a sourceforge project for all this so we have some place to put all this information.
As promised, here's the .config and android patches:
Config: (rename to .config): http://dl.getdropbox.com/u/198699/linux_wing/wing_config
Android patches (against kernel.org 2.6.27): http://dl.getdropbox.com/u/198699/linux_wing/android-2.6.27.patch
I've updated the top post as well. The patches don't cleanly apply against the 2.6.25 kernel yet. Hopefully I'll be able to get that working soon.
Good luck.
Unfortunately, I don't have time, nor the crazy Linux experience to be of any help...
But I am way excited and can't wait to see what you can pull off...
Another step in the right direction -- The modified Android kernel boots, and Android will now try and start.
For some reason or another it won't complete starting -- I'm going to install some debugging tools later to try and figure out what else we need (if we're missing something). I've also noticed that Android isn't taking advantage of the swap space we have, so there may be an Android mod needed to allow that -- not sure how much it will help at this point though.
I've updated the top post with instructions on how to install the new kernel and android images to play with on your phone.
Enjoy!
I have a rooted G1. I didnt see a swap partition when I run the mount command. Let me know if you need anythhing else. I'll do my best to help out.
Yeah, not surprised. The G1 has a lot more memory than the Wing (128mb vs. 64mb if I'm not mistaken) so I doubt there'd be a need for one.
My hope was that if memory was tight for running on Android, adding a swap partition would give it some more breathing room. I guess Android wasn't designed that way though.

[Tutorial] How to build a perfect ROM [Updated 02/12/11]

This is to educate all the wannabe Devs', How to build a perfect ROM.
There will be tutorials from all over. Respective credits will be added.
Everyone's Invited
Know the Basics
Without knowing what you are getting yourself into will only make things worse even before you start off. To build a good Rom is different and to atleast build a fully functional Rom is different. So make sure you are fully aware of the technical fundamentals of building a Rom to enough extent so that you are able to fix the bugs and know what and where can things go wrong and how to solve them.
Performance, Memory, Stability and Battery
These are the four defining points which decide the pros and cons of the Rom that you develop. The Rom should be Fast, Have enough storage and program memory, should be stable and have a good battery backup. Trying to get a good balance of all these is very important. So make sure you keep all these things in mind while developing your Rom.
Be Patient and Polite
Building a good/perfect or bug free Rom wont come immediately. It’ll take many releases, experiments, testing and knowledge till you reach a nearly perfect Rom. So be patient as it sometimes takes weeks or sometimes months. Dealing with the public is not an easy job. You’ll find all sort of people of various characters. The can be nice as well as rude, but do remember that their critics are the only way you can improve. All they want from you is a good Rom, just keep this in mind and ignore the negatives.
Make it User Friendly
There are many ways in which you can make your Rom user friendly. Integrating useful apps. Prepping Eye candy themes, Important shortcuts etc.
Stay Motivated
This is the only driving force behind every Rom developer to continue doing their work with ease and success. Stay motivated and alert so that you can deliver the best with every release. Its hard sometimes but its it important.
Give Time to your Work
Most of the developers are either students or work some where and building Roms is some what like a hobby for us. Its correct that we are not supposed to spend all the time on building Roms but if we want to have a good working Rom we should manage considerable amount of time for few alternate days to work on this project.
Make it Different
You Rom characteristics should be some what different from what is already been provided by other developers. If its nothing different and Catchy then it’ll be hard to get users trying your Rom consistently. I still remember the days when i used to try alot of different Roms but still couldn’t find one that was nearly perfecting my needs. I tried alot of Roms that time.
Join Hands with another Developer
This is what i like the most. Join hands and team up with other developers and thus improve the efficiency and effectiveness of your Rom. The mind of two can bring together wonders. You can even team up with Developers of other devices and build a Rom for device that you personally do not own but you you widen your work area.
Don’t be ignorant
Make sure you are attentive and up to date with all what is discussed about your Rom, all bugs, all tests, reports, etc. so that you do not miss out on any bug possibly to be fixed for next release. If you ignore or avoid fixing the important bugs, the users will think that you are not really capable of solving them or not really interested in this Rom.
Get Testers
Testers are users who like to test the Rom and report you the bugs before you go public with the release. They are very helpful if you like to avoid the criticism after the release of the Rom as before itself you’ll be able to get rid of maximum number of Bugs and issues present in the Rom. That is where testers come in handy. Jus give a notice and many would love to try and test your Beta releases.
Keep Detailed Changelogs
Changelogs keep track of your developments over the time. They come in handy when ever you need to check for prolonged bugs. For example you may not notice it but if someone reports that he has been having an issue since your 3rd Rom release, then you can check out what all changes you made on that release and cross check whether one of those changes cause that bug.
Be Active on the Rom Page
This is the most important part of being interactive with the users cause there is alot that they want to be done in your Rom. Talk to them, answer their questions and discuss the pros and cons of the Roms with them. You can learn alot from them. Being active to the discussion will make them feel that you are eager to further develop and make this Rom improve further.
Add only Useful apps and Regularly Update them
Make sure the application you add to your Rom are useful by the people. Adding two Music Players in the Rom is not a good choice. Choose one that is best and use that only. But make sure you add one possibly best Application for all needs of the users. Keep track of all the applications that you have included in your Rom and make sure the latest versions are included. It keep the user feel updated with your Rom. Many times there are applications which are important to add but have some bug. Later these bugs are fixed in their next releases, so even you should add those updated fixed Applications. Use only Genuine Licenses and No Warez Applications. Warez is like a virus to the development of your Rom. Copyright issues and illegal use of cracked applications make pose a ban on you Roms by the Blogs and threads where you list them. Either you use development licenses to use the in your Roms or use an equally good free Application.
Good looking User Interface and Graphics
This is the major aspect that defines your Rom and makes it distinct from others. Work on that graphics that can be changed in your Rom, try different themes and skin enhancements in different aspects of os like dialer, lockscreen, fonts etc.
Keep Polls and ask Questions
Polls and asking questions from users is a very important way by which you can interact with users and get their feedback. Polls can be asking them about their preferences. Which applications they like or dislike, asking frequents questions on that changes you will be making in the Rom cause at the end of the day it is them who will be using them.
Learn from Competition
I don’t call the fellow developers a competition and usually many share their work and are supportive like i am to each other’s work. But you can learn from what is included in their Rom and if its catchy and important then you can add it to your Rom aswel. There might be many new and useful applications and features that other developers might be using and you are not even aware of that. It can be very helpful in evolving your Rom completely.
Listen and Learn from Users
Listening what a user has to say about their experiences on using your Rom is very important. They might have something very important to share from their experiences which you can incorporate in your Rom. It really helps in fixing bugs and improving your Rom further.
In the end you are the Decision Maker
Its you who has to take the decisions in the end. There will be many people wanting you to do this or that and add this or remove that but in the end you have to keep an unbiased judgment on all the requests, ideas and suggestions and bring forward the changes that you feel the masses are going to appreciate. And for that you will need to take care of all the above mentioned points in mind.
Give Credits
Not to forget that 70%-80% of your work is inspired from that of other developers. And it wonk charge you anything to be humbly give credit or some appreciation to the help you have got from other developers in terms of guides, tips, tricks, applications, UI Enhancements, etc. It just shows your character as a person as well.
[What is it?]
What are Stock Roms and Custom Roms?
What is a Rom?
ROM – Read Only Memory is that memory which stores the system files of your Device. Those files which make up the basic Operating System, be is Windows Mobile Phone OS, Android, Symbian, Windows OS, etc. Every electronic device has a Read only Memory which stores the basic programming of the functions that the Electronic equipment is to perform. ROM in terms of our Android Devices the basic set of programming applications and files of functions which your device performs Out of the Box. Without a Rom no electronic device exists.
What are Stock ROMs?
Those ROMs which come pre installed are called Stock ROMs. Stock ROMs are the ones that come Box packed with your Device preinstalled. These are official Software that are provided by the Manufacturer or the OEM.
Is it possible to Edit/Customize/Alter Stock ROMs?
Yes it is. For a lot of Operating Systems be it Windows Mobile Phone OS, Android, Symbian, etc, it is possible to Customize these stock ROMs and install them to our devices.
What are Custom ROMs?
They are Custom ROMs are based on Stock ROMs but customized by the user in terms of additions in applications, improvements, removal of unnecessary application, etc. A customized ROM may be an minor improvement to Stock Rom or can even be a complete makeover of Stock Rom even changing the drivers of the Rom with that of other compatible devices providing better performance.
Why do we need Custom Rom?
Customization is making things personal. That is one main reason why we customize a Stock Rom. A stock Rom no matter what will have a lot of unnecessary applications, files, images, settings that are pre set by the Manufactures but are not at all important to us and uses a lot of space for no reason. No matter what there has to be one or the other Bug in a Stock Rom. To get rid of these issues we customize a stock ROM by either adding useful applications, settings, removed crap, fixing bugs and on getting a Top Notch easy to use and completely customized Device.
What about the warranty?
This is decision that you need to make personally. Yes, Custom ROMs will take away your precious warranty. But that to only if your device stops working while you are using Custom Rom on your device and you have to take it to the company. If you want you can revert back to Stock ROMs and then take your device to the Service Center and they won’t even know about it. But you need to consider reverting back to Original Stock Rom.
su
Also referred to as substitute user - a command for changing the account in the current terminal (usually black screen with blinking cursor). Default account is root account. So if you insert into terminal 'su' and hit enter, you will become root user.
root
Root alias superuser or poweruser is special user account for system administration. Similar to windows having its administrator account, unix-like systems have a root account. With this, you can do anything and if you run a command to delete the whole system, unix will just do it! No asking, no confirming. So, watch your steps!
rooting
Rooting is just enabling power of root for applications and other purposes.
Superuser app
After rooting is done, you will see a new app called superuser in app drawer. This app can delegate applications to use su (root) feature. When an app asks this from first use, a popup window will appear asking if the application should be allowed to use root permission.
sh, bash
is a command-line interpreter or shell that provides a traditional user interface for the Unix operating system and for Unix-like systems. So simply, it is some interface, which can execute command(s), which you have entered. Many shells exist, but in scope of android you can (as far as I know) use only sh (standard - Bourne-shell) or bash (compiled in BusyBox or separately on XDA). Both are basically same, but bash has much more features and it is more comfortable.
user/root shell
How do I know if I'm root or normal user? It's simple. Root's shell is ended with # (usually it's shell looks like "bash-3.2# _") and user's ends with $ (usually bash-3.2$ _). In terminal emulator you also can have only [path]($|#) (for root for example "/etc # _")
BusyBox
also called "The Swiss Army Knife of Embedded Linux" is a tool which brings into Android basic tools known from unix system, but is much more smaller than standard tools is. But this "packing" has limited functions in comparison to standard tools in unix-system (missing special modes of tool, color output and so on). Many application use this. For example busybox grep (filtering of text) is needed for application called Market enabler.
BusyBox commands
list of commands is really wide, so it's not possible explain all, so I pickup only top few. (hint: if you want what some command do, just search on google for "man <command_name>" for example man mv or enter command here
cd - change directory - same like in windows. You can switch directory. example: cd /sdcard
ls - list of files in actual directory (have few switches like for example: ls -l /sdcard/*.png (detailed listing)
cat - print file into standard output (like more in windows) Example: cat /sdcard/data.txt
vi - editing of file. But on limited phone keyboard (no keyboard) it is little harder Read more about vi
cp - copy of one or more file. Example: cp /sdcard/bike.jpg /sdcard/media/bike-wallpaper.jpg
mv - moving/rename files, Example: mv /sdcard/bike.jpg /sdcard/media/renamed-moved-bike.jpg
rm - delete file (rm -R for recursive, or for delete whole folder), Example: rm -R /sdcard/wallpaper-bad/*
find - search for files, Example find / -name "best-chopper-ever.avi"
mkdir - make directory - creates directory, Example: mkdir mynewdir
chmod - changes access of files
less - similar like cat, but you can scroll in it and it doesn't produce any output. Example: less /sdcard/funnytext.txt
For BusyBox's tool help, just enter BusyBox <command_name> -h.
ADB (shell)
ADB - Android Debug Bridge is a versatile tool that lets you manage the state of an emulator instance or Android-powered device. It is a client-server program that includes three components:
* A client, which runs on your development machine. You can invoke a client from a shell by issuing an adb command. Other Android tools such as the ADT plugin and DDMS also create adb clients.
* A server, which runs as a background process on your development machine. The server manages communication between the client and the adb daemon running on an emulator or device.
* A daemon, which runs as a background process on each emulator or device instance.
Generally, it can be compared with standard cmd prompt in windows (you can write commands which will be executed locally, for example in Terminal Emulator) or it can be just like SSH in unix-like system (you connect to terminal through adb client (in Android SDK) and commands will be run remotely.
Android SDK
Android software development kit is a complex set of tools for developing apps on Android. It includes a fully usable emulator of Android OS on your PC, where you can do everything. You can install/delete apps, browse web page in embedded web browser, play games or make your own application in Eclipse (widely used IDE for development). Of course, with emulator you can use also GPS or camera.
Android SDK tools
* Fully emulated Android device
* Android Development Tools Plugin (Eclipse IDE)
* Android Virtual Devices (AVDs)
* Hierarchy Viewer
* layoutopt
* Draw 9-patch
* Dalvik Debug Monitor Service (ddms)
* Android Debug Bridge (adb)
* Android Asset Packaging Tool (aapt)
* Android Interface Description Language (aidl)
* sqlite3
* Traceview
* mksdcard
* dx
* UI/Application Exerciser Monkey
* monkeyrunner
* Android
* zipalign
Tools for work with Android adb shell
You have two ways to connect into ADB service - locally and remotely.
Locally - for local access you will need some application which can connect to local adb shell.
Terminal Emulator (free) - probably most commonly used app from market, which works and looks like standard unix shell.
ConnectBot (free) - same as Terminal Emulator, but it can be also used for connecting via SSH or telnet
Remotely- For remote connection you need phone configuration adjustment:
Home desktop -> [menu button] -> Settings -> Applications -> Development -> USB debugging [ON].
Also you need connect your phone via USB (or finds on market some widget/app, witch enable using ADB also via wi-fi)
adb tool from Android SDK
After downloading Android SDK, extract the archive anywhere (in example I extracted it in c:/AndroidSDK). Then follow instructions on developer.android.com for installation of SDK Platform-tools (contains adb). After installation click on start menu and in Run... (in Windows7 in search bar) enter 'cmd' and press Ok or [enter]. Then write in cmd line:
Quote:
cd c:\AndroidSDK\android-sdk-windows\tools [enter]
now you can enter following command to connect to phone's adb shell if you don't have more connected device (virtual or real-one)
Quote:
adb shell
If you have more then one, you need explicitly say which one should be used for connection. So list connected devices with
Quote:
adb devices
which shows you serial number of connected devices. Than use
Quote:
adb -s <serial-number> shell
3. Custom recovery
* What is custom recovery
* Tools which custom recovery provide - NAND backup/restore, formatting of SDcard, partitioning (ext1,ext2, ext3), wiping, flashing of Custom ROM, ...
* Is it safe to install? - potential problems, backup/restore of original recovery
* How this whole thing works - installation description (not how-to install, just explanation of what is done during installation)
What is custom recovery
Recovery is an image (binary data) stored in internal memory. This image contains something like a "program" or "tool", which can boot-up independently from the Android system. This tool is part of phone system, and in PC terminology recovery can by compared to BIOS with some added features. This recovery state can be reached on all phones, but if you don't have a custom recovery, it will do a so-called HW reset and automatically restart itself into standard boot mode.
Tools which custom recovery provides
* USB-MS Toggle :mounts sdcard as mass storage
It just mounts your phone as USB-mass storage (USB disk) so you can access it through your PC
* Backup/Restore:
Absolutely GREAT feature. With NAND you can copy an image of your actual system (phone's memory). It means that you can backup the whole system with all configuration, customization, wallpapers, system's tweaks... just everything. This image will be written to your SD card which you are then free to copy around and back up on your computer
* Flash Zip From Sdcard
This tool is designed for installation of custom ROMs or tweaks. If you are instructed to install via custom recovery, then you should use this menu. Never unzip the file because it contains meta-information about itself with some validate-checks so if you edit it, or unpack and pack back, it won't work. And remember to place the file in the root (main folder) of your sdcard.
* Wipe Menu:
Wipe data/factory reset: wipes data & cache
- wipes user data (contacts, apps, configuration, ...) and cache (caches of applications)
Wipe cache
- wipes cache only
Wipe Dalvik cache : Wipes Dalvik cache in all possible locations if moved by apps2sd
- wipes Dalvik cache
Wipe SD:ext : Wipes Apps2sd ext partition
- if you used Partition SDcard option, you can wipe it here
Wipe Battery Stats (remember to fully charge your phone before doing this)
- If you think, that your battery life is too short, you can try delete battery stats. Than let phone fully charge. (more)
Wipe rotate settings
- wipe sensor settings (acceleration, ...)
Wipe .android secure : Wipes froyo native .android_secure on sdcard
- wipe information about moved apps
* Partition Sdcard:
Partition SD: Partitions sdcard for apps2sd (this formats card so all data will be lost)
- will create ext2 partition (you will be asked for size of ext2 and cache)
Repair Sd:ext
SD:ext2 to ext3 : converts apps2sd ext2 partition to ext3 (requires kernel support for ext3)
SD:ext3 to ext4 : same as above but ext3 to ext4 (requires kernel support for ext4)
ext2 - file system for the Linux kernel (no journal, fast but not recovery of I/O error)
ext3 - file system for the Linux kernel (journal, slower than ext2 because of journal, but provides recovery on I/O error)
ext4 - file system for the Linux kernel (journal, enhanced version of ext3)
* Mounts:
Gui automatically mounts folders
png-optimized -
png files takes less memory, are loads faster
JIT -
just-in-time compilation also known as dynamic translation, is a method to improve the runtime performance of computer programs, but it takes some time to convert into it on start.
HW:acceleration -
using of HW acceleration for rendering GUI. Increases battery consumption.
VM.Heap Size -
maximum memory an application can consume
stagefright -
In Android 2.2 new media framework that supports local file playback and HTTP progressive streaming
:: How To's ::
Samsung Galaxy 3 (I5801/I5800) Flashing Guide
Before these steps make sure you have latest version of kies installed, it helps in keeping latest drivers installed.
Files required for Flashing can be downloaded here.
1) Start Odin (if using windows 7 or vista right click Odin and use run as administrator)2) Check "One Package" checkbox3) Check “Reboot” checkbox4) Check protect ops checkbox (Don’t check this if you are flashing I5801 with I5800 firmware for the first time.)5) Check reset time checkbox, keep the default value as it is i.e. 300 don’t select any other options.6) Hit reset files button once.7) Click ops button and select OPS file for I5800*8) Click one package and select the firmware you want to flash. The file must a .tar file.9) You can take a backup of your data/apps. For that you can use Titanium Backup. For backing up contacts and SMS.A) go to contacts press menu/left most button select import/export option, then export the contacts to sdcard.B) For sms use the app called SMS backup.10) Now remove your sdcard and sim card from phone and do a factory reset/ Hard Reset also clear cache then restart and put it in downloading mode by pressing vol- + home + power button together.11) Now connect your phone to pc.12) Odin will show yellow color and com port no. in the first box on top in Odin.13) Click Start and watch the progress bar and timer, wait until PASS message appear on Message box.14) Disconnect the phone from PC when Odin displays disconnect serial port & wait until rebooting phone.
Let the phone boot it takes some time 5-10 mins for first boot so don’t panic.
After reboot do factory reset or Hard Reset also clear cache again then restart phone and put sim and sdcard back in.
Sorry cant post images right now in office, will attach images as soon as i get home.
Please let me know if i have missed anything or if anything needs correction.
ATENTION I5801 USERS:to keep the i5801 bootscreen you should remove boot.bin and sbl.bin from the .tar file before flashing.
Deodex
Advantages or disadvantages
- Odexed ROMs are slightly faster, deodexed ROMs are slightly slower
+ You can make custom themes for your ROM
+ Performance los is negligible.
Requirements:
Download XUltimate
Busybox installed
Root
1. Connect phone to computer
2. Start xUltimate, we will now get the required files from our phone to deodex and zipalign it which we will describe in the 3rd step.
3. On the main menu of xUltimate, choose option 5 (Pull and deodex all). Everything will be done for you here. Don't worry. You will see all your finished files in the folders 'done_app' and 'done_frame' which are located in the installation directory of xUltimate.
4. move folders 'done_app' and 'done_frame' folders to your sdcard, you can find these folders in the directory of xUltimate as described in the previous step.
5. Make sure the sdcard is not mounted to pc anymore
6. Open Windows Command Prompt and type the following commands.
adb shell
su
stop
mount -o remount,rw /dev/block/stl12 /system
rm /system/app/*.odex
rm /system/framework/*.odex
busybox cp /sdcard/done_app/* /system/app/
busybox cp /sdcard/done_frame/* /system/framework/
chmod 644 /system/app/*
chmod 644 /system/framework/*
mount -o remount,ro /dev/block/stl12 /system
sync
reboot recovery
7. Now data and cache reset in the recovery menu...
8. reboot
If one of the commands, for example 'cp' is not found, try putting busybox in front of the command:
eg: busybox cp /sdcard/done_frame/* /system/framework/
SRY, but please not again a tutorial. We already have two. I accept your work, but please don't make an another thread for something, that we already have.
lol, again?
Pauri said:
SRY, but please not again a tutorial. We already have two. I accept your work, but please don't make an another thread for something, that we already have.
Click to expand...
Click to collapse
Dude! This is different from others.
Just wait and see!
OK, I will see^^
@sekhargreen Very nice
kyrillos13 said:
@sekhargreen Very nice
Click to expand...
Click to collapse
hi
+1 here
lets appreciate his hard work look at the amount of info he has give and the time it would have taken to give the same if u are a rom developer this might not be a great thing as u already learn t all this the hard way
but looking at it from the eyes of noobs(or when u were a noob rom developer) who has many questions before they start cooking a rom i would say this is a good place to start as it has many of the answers
i would also say if this goes well this would not just be another tute but one with enough info for the noob rom devloper to start as he would have all his questions answers by reading this one
good job done pls keep up the good work
Note : this has been added to the roll up thread
Gonna throw myself out there and say I kinda fall under this category. I still have a lot to learn so thank you for this. It will most likely improve me.
The Dark Lestat said:
Gonna throw myself out there and say I kinda fall under this category. I still have a lot to learn so thank you for this. It will most likely improve me.
Click to expand...
Click to collapse
Hi Lestat,
Please contribute to this thread, if you have time.
It will help all the Devs in XDA forum.
Thanks dude for wonderful tutorial. It will be really helpful.
InDroid 4.0 (Build 6)
helpful to all..
Tutorials updated
Tutorials updated. Please First page.
can you add this to pocketdroid i think its very useful tutorial..
pflorin said:
can you add this to pocketdroid i think its very useful tutorial..
Click to expand...
Click to collapse
Sure, added. Just check it out!
Very good now i can see that it's different. Thank you for the wonderful tutorial.
Sent from my GT-I5800 using XDA App
Pauri said:
Very good now i can see that it's different. Thank you for the wonderful tutorial.
Sent from my GT-I5800 using XDA App
Click to expand...
Click to collapse
Thanks for you appreciation. Encouragement from people like you will boost my energy!!
Hello...firstly like to thank you for these tutorials...they are a gr8 help for everyone...
i would like to request you that if u can cover some kernel basics also then it would be great...

[GUIDE] Ubuntu in a chroot on the Galaxy S4 - now with Native Booting!

Notice (4/16/14): I'm no longer here. I've said "goodbye" to AT&T and their locked bootloader schemes. I'm voting with my wallet - I've sold my I337 and switched to T-Mobile. My apologies to the community, but you're now on your own here.
Intro/About/Requirements:
This thread started as a guide for people who wanted to run Ubuntu in a chroot, and then connecting to it locally with a VNC client. This method has been used countless times on other devices, with many thanks to @zacthespack and his his group, LinuxonAndroid. Unfortunately, this method did not work out-of-the-box on my device, so I tweaked things to work with the Galaxy S4 and posted them here in this thread.
However, the most people immediately noticed that with this method the performance is not great, and some applications can't work in a headless environment. With a comment made by zackthespack, I began researching what it would take to get Ubuntu to write directly to the device's framebuffer. After a few months, I not only managed to accomplish this, but also developed a way to get the Galaxy S4 to boot directly into Ubuntu. As far as I have seen, both of these are a "first" for this handset.
All of these methods require root. The VNC Chroot does not require a custom kernel, but the other methods require a custom-built kernel. For the I337 (AT&T) handset, this can pose a problem if you have bootloaders that are MF3+. If you're using MDB/MDL bootloaders still, you shouldn't have a problem with this and you can Loki the custom kernel without issue.
Depending on your ROM and/or Kernel, you may also need a new version of BusyBox installed, even for the VNC method. You'll find a few apps on the Play Store that can do this for you. Beware that some of them are not easily reversible (such as TinyBox), so if you're stuck on MF3 with no way to create/restore a nandroid/system backup, you should be careful.
Click to expand...
Click to collapse
Disclaimers:
Following this guide and/or flashing anything I've provided to your device is your own responsibility. If something breaks, you break your device, or something explodes, I can't be held liable (I'll help correct any situations you may put yourself in, however). I claim no rights to any proprietary software or intellectual property included in this post or the packages contained herein. By using any of this software, you agree to whatever licenses/agreements that the creators may have included with their software. If you use any of this stuff in your own project, please provide credit where credit is due. For example, if you take my u.sh script and adapt it to some new device (i.e. Galaxy S 5), please at least mention where it came from.
Click to expand...
Click to collapse
VNC Chroot Method (original):
This method is loosely based on this thread for the Galaxy S3 and the ubuntu.sh script there. It didn't work for the S4, but I've made several tweaks to it, simplifying it a ton, and otherwise getting it to work perfectly on my S4. I've tried this using my AT&T Galaxy S4 (SGH-I337) on both the MDL build and the MF3 build - both seem to work great.
Instructions:
Download the Ubuntu 13.04 Small v1 image here.
Create a folder on your sdcard labeled "ubuntu" by whatever means you want to.
Extract the ubuntu.img from your downloaded zip into this folder.
Download my version of the ubuntu.sh and place it on the root of your sdcard.
Open the script in a text editor and read through it. Never run a script like this on your android without first knowing what it does - especially when the author is telling you that you need root. If you're happy with it, proceed.
Install an terminal emulator of your choice. I personally used this one, and technically an adb shell will work too (but you'll be tethered to your PC...).
Install a VNC Client of your choice. I personally used this one, but there might be better/faster ones out there.
Open the terminal emulator, and execute the following commands:
Code:
su
sh /sdcard/ubuntu.sh
If you see a bunch of errors and get dumped back at the "[email protected]:/ # " prompt, then something went wrong. Report your errors in this thread. Remember, this requires root (and the "su" command to get there, of course).
You'll be prompted for some setup parameters, which you can save at the end for later. Just answer each question and press Enter after each:
You'll need to provide a new password for the "ubuntu" user. A simple passwords like "ubuntu" works, unless you want some security.
Start VNC server? (y/n) - always choose "y". We need this to interact with the device.
SSH server? Optional. If you use it, you should enable it.
Screen size: Enter whatever you want. I personally used 960x540 (one quarter of the S4's screen size) so that I could actually interact with things using the touch screen.
Save settings as defaults? - You might not want to do this until you have a screen size that works best for you.
Once you see the prompt, "[email protected]:~# " - you're in! You now have Ubuntu running in a chroot. As the on-screen instructions suggest, type "exit" at this prompt to end the chroot and Ubuntu. It is recommended to do this when you are done so that the ubuntu.sh script can clean up after itself (unmounting things, etc.).
Leave your terminal emulator app running! Use your Home button to return home and leave it running.
Open you VNC client and connect with the following settings:
Nickname: (whatever you want)
Password: ubuntu
Address: localhost
Port: 5900 (default)
Username: (leave blank)
Color Format: 24-bit color (you can use lower if you want better performance)
Connect. For the VNC app I used, I had to zoom in to make the screen fit correctly (use pinch-to-zoom, and then use the "+" button on-screen). Also, you can play around with the Input Mode some if you wish.
Enjoy Ubuntu!
As you can see, it's not terribly complicated to get this up and running. Once you have set it up the first time, it's a lot smoother from then on out. The script is designed to allow you to use the external SDCard if you wish. Just use place the ubuntu.img in an "ubuntu" folder on your external SDCard, drop the ubuntu.sh on the root of the external SDCard, and use "sh /mnt/extSdCard/ubuntu.sh" instead (don't forget "su"!).
Click to expand...
Click to collapse
Freedreno Chroot Method (NEW):
This long-winded tutorial will explain how you can setup Xubuntu-desktop in a chroot. Before attempting any of this, you should read through all the steps and be sure you're comfortable performing the steps needed.
This requires roughly 2GB free space on your /data partition - the actual finished install is about 1.4GB, but it will require some extra space while it installs Freedreno and other components. HINT: Keep in mind that your /data partition is shared with your internal sdcard (your internal sdcard gets whatever space is leftover at the end of the /data partition), so you can get an idea how much free space you have by looking at how much space your internal sdcard has available.
Instructions:
Step 0 (option A) - Build Custom Kernel
You will need to install a custom kernel that has specific options enabled in the configuration, along with a few patched files in the source code. This list of changes is based on a delta from the stock I337 MF3 kernel, available at http://opensource.samsung.com/. You should be able to apply these changes to "any" kernel that you can build from source, so this documentation may apply to devices other than the I337.
Kernel Mods:
Required config changes:
Code:
CONFIG_DEVTMPFS=y
# CONFIG_DEVTMPFS_MOUNT is not set
CONFIG_DRM=y
CONFIG_MSM_KGSL_DRM=y
# CONFIG_KGSL_PER_PROCESS_PAGE_TABLE is not set
# CONFIG_MSM_KGSL_PAGE_TABLE_COUNT is not set
CONFIG_FB_MODE_HELPERS=y
CONFIG_FB_MSM_TRIPLE_BUFFER=y
CONFIG_FB_MSM_DEFAULT_DEPTH_BGRA8888=y
# CONFIG_FB_MSM_DEFAULT_DEPTH_RGBA8888 is not set
Fix for Wi-Fi problems when using MF3 kernel on UCUAMDL bootloaders (i.e. "unadulterated" or "neutered"):
Code:
CONFIG_PROC_AVC=y
Required Patches to kernel source code:
https://github.com/freedreno/kernel-msm/commit/4c0281745f8c85707be88acebb557aca0b8f1dba
https://github.com/freedreno/kernel-msm/commit/228f65d48d4855d903e3b4642179dfa14eedd040
https://github.com/freedreno/kernel-msm/commit/54b510b2e6bccf08fdf3a8ad00a62b27c2f8c1e6
Additional changes required for sudo to work (added 10-25-13 in v4):
Code:
# Samsung Rooting Restriction Feature
#
# CONFIG_SEC_RESTRICT_ROOTING is not set
# CONFIG_SEC_RESTRICT_SETUID is not set
# CONFIG_SEC_RESTRICT_FORK is not set
# CONFIG_SEC_RESTRICT_ROOTING_LOG is not set
Additional changes to the initramfs required for sudo to work (added 10-25-13 in v4):
Edit fstab.qcom, remove the nosuid, part of the line that references userdata.
Step 0 (option B) - Download Custom Kernel Instead
Don't want to compile your own kernel from source? If you have the I337, you can use mine! As mentioned above, this kernel is based on the original MF3 source from Samsung, with the modifications listed above. If you are stuck with MF3+ bootloaders on your I337, you will not be able to install this kernel directly (at the time of this writing). MDB/MDL bootloaders are fine, but you will need to flash loki-doki afterwards (this kernel is not pre-lokified!). This kernel might work with other similar variants (such as the M919), but I haven't tested this on anything except my own I337 daily-driver. YMMV. If you run into issues, you might need to wipe cache/dalvik. This will likely only work with TouchWiz-based ROMs (I have not tried it with AOSP). Here's some downloads for you:
mf3-freedreno-android-boot-v4.zip - CWM/TWRP flashable zip.
- Boots to android, allows Ubuntu with Freedreno to work in a chroot.
- Compiled with the original (slightly modified) MF3 initramfs and "mf3-freedreno-minimum-zImage-v4" (below).
- Includes minimal configuration changes described above, plus the WiFi fix part.
mf3-freedreno-minimum-zImage-v4 - Just the MF3 kernel itself with minimal changes to get the chroot to work.
mf3-freedreno-minimum-config-v4 - Yeah, that's right. I'm providing the .config files I used for all of this.
Step 0.5 - Install the Kernel
Before you can start up the chroot properly, you'll need to have the custom kernel installed. You don't want the "ubuntu-boot" version right now, because you don't have an Ubuntu install to boot to. If you're using my pre-built kernel, first flash mf3-freedreno-android-boot-v4.zip and then flash loki-doki.zip.
Step 1 - Companion Files
Download this file: mf3-freedreno-companions-v4.zip - Non-flashable zip. This includes the script files, which you should promptly read through both u.sh and launch.sh. It is always good practice to read through any script file you get from the internet, making sure it's doing what you would expect it to. Also check out CREDITS.txt, which includes information about the included upstart-dummy.tar.gz and start-stop-daemon files.
Extract the companion files .zip and place its contents on the root of your internal sdcard (/sdcard/). Don't extract the contents of upstart-dummy.tar.gz. This is your $src directory. You can change this if you wish (see script for details).
Step 2 - Install/Configure Ubuntu
Install an terminal emulator of your choice. I personally used this one, and technically an adb shell will work too (but you'll be tethered to your PC...). At the console/shell, type the following two commands:
Code:
su
sh /sdcard/u.sh bash
The script will download Ubuntu Core and install Freedreno, upstart-dummy, and lubuntu-desktop. Total download size will be around 425MB. Total install time will vary, but count on it taking at least 45 minutes to install and configure everything. At the very end, you'll be prompted to enter a password for the new user "ubuntu".
Step 2.5 - Exit ubuntu
When you see the message "Type 'exit' (without quotes) to leave ubuntu," the install is complete. You'll notice that your prompt changed to "[email protected]". This is the easiest way to confirm that you're actually inside the ubuntu chroot. Type exit and hit Enter to get back to android.
Step 3 - Fire it up!
From now on, you can start Ubuntu using u.sh in any of these three ways:
sh /sdcard/u.sh - This will make initial prep, STOP android (black screen), launch the chroot, install/configure if needed, and will execute "service lightdm start". This will give you the greeter and you can login as "ubuntu". If the lightdm service stops for whatever reason (see info about the home button below), the script will continue by exiting the chroot and rebooting your device.
[*]sh /sdcard/u.sh bash - Same as above, except that it will not stop android, not startx (will give bash shell instead), and will not reboot your phone when you exit the shell.
[*]sh /sdcard/u.sh destroy - This will do exactly as it sounds - destroy your ubuntu installation. This will unmount your /sdcard from ubuntu (if still mounted somehow) and then recursively delete your ubuntu installation. If you change the source or destination directories in the main script, you should be careful deleting things.
NOTE: Remember to ALWAYS run any these from a root shell, whether via terminal emulator, via adb shell, or using SManager (or similar).
Step 4 - Note the Home Button and Touchpad
Take note that any time you have X running via lightdm, the hardware Home button will kill the X server. This is intentional, and will exit the chroot and reboot your phone. You'll also notice that currently, the touchscreen acts like a giant touchpad (like on a laptop). Use two fingers to right-click or scroll. Direct touchscreen input is not available at this time due to a segmentation fault that evdev causes when used on this device in a chroot.
Step 5 - (optional) Make Changes and Do it All Over Again
Customize the crap out of it! Edit my u.sh, launch.sh or xorg.conf and have fun. If you find great improvements, please post them in this thread! In future revisions, I might include them. Things should be well documented within the scripts. You might even change the bit at the end of launch.sh that starts "service lightdm start&" instead of "startx" - this would give you the greeter and let you login as the user "ubuntu" if you want. Also note that those three files are the only ones that must remain in your $src directory if you wish to continue to run this as a chroot. By the way, booting directly to Ubuntu after it is installed does not require any of the companion files anymore.
Click to expand...
Click to collapse
Native Boot Method (NEW):
This part of the tutorial is for those who wish to take things a step further and boot your device directly into Xubuntu-desktop. This will require that you setup the Freedreno chroot properly, and then you'll be installing a new boot.img. While this doesn't replace your /system partition, you won't be able to boot directly into Android while you have this boot.img installed.
Instructions:
Step 1 - Install Ubuntu
Basically, you need to perform all the steps for the Freedreno Chroot method, and get that up and running first. All you're doing here is swapping out your kernel.
Step 2 (option A) - Build Custom Kernel
You'll need all of the kernel customizations included in the freedreno chroot method, plus these listed below:
NOTE: You will need some proprietary blobs, which can be found on your device in the /etc/firmware directory.
Config changes to enable booting directly into Ubuntu (beyond replacing the initramfs...):
Code:
CONFIG_EXTRA_FIRMWARE_="audience-es325-fw.bin a300_pm4.fw a300_pfp.fw vidc_1080p.fw"
CONFIG_CMDLINE="console=tty0 fbcon=vc:0-3"
# CONFIG_CMDLINE_FROM_BOOTLOADER is not set
CONFIG_CMDLINE_EXTEND=y
# CONFIG_CMDLINE_FORCE is not set
Optional config changes to enable the framebuffer console when booting directly into Ubuntu - useful for debugging.
Code:
CONFIG_VT_CONSOLE=y
CONFIG_VT_CONSOLE_SLEEP=y
CONFIG_VT_HW_CONSOLE_BINDING=y
CONFIG_DEVPTS_MULTIPLE_INSTANCES=y
CONFIG_FRAMEBUFFER_CONSOLE=m
CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
# CONFIG_FONTS is not set
NOTE: You will need to grab some .ko files that are created, which must be loaded in the following order:
Code:
insmod /ko/font.ko
insmod /ko/softcursor.ko
insmod /ko/bitblit.ko
insmod /ko/fbcon.ko
I recommend that you include these four lines into the init script that is included in the ubuntu ramdisk. These can go pretty much anywhere after the ". /scripts/functions" part, but before it calls out to run-init. Also, don't forget to drop those .ko files into a new /ko directory in the initramfs. If you want to load these with modprobe, I'll leave that up to you (good luck).
Replace the entire ramdisk/initramfs:
At this time, I'm not going to provide instructions on how to do this. You'll need this mako boot.img straight from Ubuntu, repacked with the zImage created here. For what it's worth, the re-pack tool I'm using includes --cmdline 'androidboot.hardware=qcom user_debug=31 zcache', but I'm not sure if that's needed (especially considering our kernel seems to use qcache?). Anyways, good luck.
Step 2 (option B) - Download Custom Kernel Instead
Again, if you don't want to compile your own kernel from source, you can download mine and use it. The same warnings and restrictions apply as they do in Step 0 (option B) of the Freedreno Chroot method. And here's your downloads:
mf3-freedreno-ubuntu-boot-v4.zip - CWM/TWRP flashable zip.
- Boots to Ubuntu directly, but only if your Ubuntu install is located at /data/ubuntu (Default).
- Compiled with the original MF3 initramfs and "mf3-freedreno-everything-zImage-v4" (below).
- Includes all configuration changes described above.
mf3-freedreno-everything-zImage-v4 - Just the MF3 kernel itself with all changes for both chroot and direct booting to Ubuntu.
mf3-freedreno-everything-config-v4 - Yet again, I'm providing my complete .config file for this.
Step 3 - Install the Kernel
Here's the easy part. Flash your completed boot.img, flash loki-doki, and reboot. If you're using my pre-built kernel, first flash mf3-freedreno-ubuntu-boot-v4.zip and then flash loki-doki.zip.
Click to expand...
Click to collapse
Flashable Zip Method (NEWEST):
It's finally finished: a flashable .zip that you can use to dump a pre-built rootfs onto your data partition. This will still require that you flash one of the two custom kernels (whether for chroot or native booting), but it will allow you to skip the whole build/install process.
ubuntu-install-v4.zip - CWM/TWRP flashable .zip. Requires approx 2GB free space on your data partition during install, and the final install size is approximately 1.3GB (may want more free space to add your own programs/etc.). Output folder is /data/ubuntu. This can be changed in u.sh, but heed the warnings within!
Instructions:
Instructions for Chroot-style Ubuntu:
Download the "companions" .zip and extract its contents to the root of /sdcard.
Download the "ubuntu-install" .zip to your internal or external SDCard.
Download the "mf3-freedreno-android-boot" .zip to your internal or external SDCard.
Make a nandroid backup of your phone, and store it on an external SDCard or your computer. Always a good idea to have this.
Install the "ubuntu-install" and "mf3-freedreno-android-boot" .zip files, followed by loki-doki.zip if you need that for your device (e.g. I337).
Restart and resume with Step3 of the Freedreno Chroot Method.
Instructions for Native Boot Ubuntu:
Download the "ubuntu-install" .zip to your internal or external SDCard.
Download the "mf3-freedreno-ubuntu-boot" .zip to your internal or external SDCard.
Install the "ubuntu-install" and "mf3-freedreno-ubuntu-boot" .zip files, followed by loki-doki.zip if you need that for your device (e.g. I337).
Restart and let it start into Ubuntu!
NOTE: The username is "ubuntu" and the password is also "ubuntu" - it is highly recommended that you change this ASAP.
Click to expand...
Click to collapse
Known Issues/Bugs:
Below is the list of known issues that I can think of, from the top of my head. This will probably be updated later as everyone points stuff out. Some issues only apply to some of the methods, so the applicable methods are listed in parenthesis after each.
Sound has not been tested (freedreno/native)
3D graphics or OpenGL support has not been tested (all)
Some applications don't work in a headless environment (vnc)
Some applications don't like to run as root, such as chromium (freedreno) lightdm is working in companions-v3, so no need to login as root anymore
Onboard is not working (freedreno/native) fixed in companions-v3
sudo does not work (all) fixed in kernel-v4 for freedreno/native, but problem remains for (vnc) if you are not using a custom kernel
A few kernel Oops's (native)
Shutdown menu doesn't always work (freedreno/native) fixed partly in companions-v4 - proper locale settings seem to allow the shutdown menu to work once you are logged in
Performance issues due to VNC connection (vnc)
No 3G/WiFi/network connection that I'm aware of... (native)
No control over 3G/WiFi/network/bluetooth yet (all)
Xorg's normal touchscreen driver evdev causes segmentation faults (freedreno/native)
Working on a possibly trying to get fbdev to work natively without Freedreno for simplicity (freedreno/native)
Anything you'd normally expect from a phone does not exist (freedreno/native)
Screen rotation (with or without accelerometer) doesn't work yet (freedreno/native)
HDMI/MHL output remains untested at this time. I got it to briefly work once, but I need to revisit this. (freedreno/native)
Many more to come, I'm sure...
Click to expand...
Click to collapse
To-Do:
Add mirrors to the download links.
Add a CWM/TWRP-flashable .zip that just dumps a clean Ubuntu install onto your data partition. This should be easy enough. completed!
Fix some of the bugs above.
Simplify the launch.sh and xorg.conf files. The u.sh script seems pretty solid.
Develop a method that works with only fbdev. This method might eliminate the possibility of 3D acceleration, but should enable screen rotation and other nifty things.
Possibly look into getting kexec (or similar) to work on the Galaxy S4 to offer a dual-boot option. Low priority at the moment, because flashing a kernel back and forth is pretty easy stuff.
Get Ubuntu Touch to work. This would eliminate a lot of bugs. I mostly need to just buckle-down and build CM10.1 from source, and then slowly visit each step of the Ubuntu Touch boot process.... Ugh.
Rebuild Freedreno to try to get Mesa/Gallium3D working properly. I'm probably going to need a lot of help from Rob Clark on this one!
More to come...
Click to expand...
Click to collapse
Revision History:
[11-13] mf3-freedreno-companions-v2.zip - Updated launch.sh: added some error checking and fixed the Freedreno build process.
[11-15] mf3-freedreno-companions-v3.zip - Updated launch.sh to include onboard and English language. Removed florence and xvkbd. Removed .keyb script. Added sudo. Simplified upstart-dummy, and included new upstart-dummy.tar.gz. Prepped for new flashable .zip method.
[11-26] mf3-freedreno-companions-v4.zip - Updated launch.sh: included fix for onboard so that it should work anytime lightdm is launched, added some bits for sudo to work, and home button now kills lightdm (not just the Xsession); Updated u.sh: Added check for root, added notes about sudo and nosuid.
[11-26] mf3-freedreno-android-boot-v4.zip & mf3-freedreno-ubuntu-boot-v4.zip - Finally fixed sudo! See kernel mods sections for details.
[11-26] ubuntu-install-v4.zip - rebuilt with new companions.
Click to expand...
Click to collapse
Aou said:
Check out this app: SManager (Script Manager). It makes running the ubuntu.sh or u.sh a whole lot easier, plus you can send it into the background (vnc method only). Just remember to jump back into SManager later, use the Menu Key and open the console to be able to kill the ubuntu.sh. You can also add "bash" as an additional argument (freedreno method only). This seems to be an effective replacement for the Terminal Emulator. Don't forget to choose the "su" option to run either script as root.
Click to expand...
Click to collapse
I have literally spent hundreds of hours working on this project, and many more hours documenting it thoroughly - just so that I could share it with all of you. If you found this guide, custom kernel or scripts to be beneficial, please hit the THANKS button on this post.
This mostly works, but I think I may have made an error. I see it starting the sshd, but not VNC server. I can call vncserver, but when launching the vnc client app I just get stuck at "Establishing Handshake" until it times out. This differs from when I don't call vncserver, where I get immediately connection refused.
I'm going to redownload the image and start from scratch, but the image isn't very friendly when I'm trying to figure out how to rerun the initial configuration script...
On my S4 running OTA-MF3 with root, this didn't work for me until i used Busybox Installer from the market. Tried internal and external without it, neither worked. Only thing that looked like an error after that was
Code:
chown: cannot access '/external-sd/': no such file or directory
but this only showed the first time I ran it. Opened VNC connection just fine from my computer to the phone, and though there was slight graphics glitching (orange and red boxes on desktop) it worked just fine and they didn't interfere. Thanks for this!
Tsaukpaetra said:
This mostly works, but I think I may have made an error. I see it starting the sshd, but not VNC server. I can call vncserver, but when launching the vnc client app I just get stuck at "Establishing Handshake" until it times out. This differs from when I don't call vncserver, where I get immediately connection refused.
I'm going to redownload the image and start from scratch, but the image isn't very friendly when I'm trying to figure out how to rerun the initial configuration script...
Click to expand...
Click to collapse
It's not, I agree. I found that the easiest way to clear the configuration and start anew is to do the following from the "[email protected]" prompt (that is, within ubuntu):
Code:
rm /root/DONOTDELETE.txt
rm /root/cfg/linux.config
DeadlySin9 said:
On my S4 running OTA-MF3 with root, this didn't work for me until i used Busybox Installer from the market. Tried internal and external without it, neither worked. Only thing that looked like an error after that was
Code:
chown: cannot access '/external-sd/': no such file or directory
but this only showed the first time I ran it. Opened VNC connection just fine from my computer to the phone, and though there was slight graphics glitching (orange and red boxes on desktop) it worked just fine and they didn't interfere. Thanks for this!
Click to expand...
Click to collapse
Interesting. I looked through the image's init.sh, and found something that's relatively new (wasn't in beta):
Code:
# Fix for sdcard read/write permissions by Barry flanagan
chown ubuntu /external-sd/
As far as I can tell, that message is harmless. It's only included in the initial configuration, as it's in the section:
Code:
if [ ! -f /root/DONOTDELETE.txt ]
As for the need to download/install the BusyBox installer, that's not surprising at all. I've had so much trouble BusyBox ever since I switched to MF3. I might include this as an extra step in the OP - thank you.
You kidding right...does this really work? To cool, thanks Aou. Great work.
TheAxman said:
You kidding right...does this really work? To cool, thanks Aou. Great work.
Click to expand...
Click to collapse
Yessir, it does indeed work! The S4 handles it very nicely with the extra RAM & CPU it has to spare, so the only limiting factor is VNC. If someone could devise a way to get Ubuntu to draw directly on the screen from within that Chroot, that would be perfect. I don't think it's really possible by design, but this might be the closest we get to running native linux on the I337 until we see some unlocked bootloaders.
Thanks
Aou said:
Yessir, it does indeed work! The S4 handles it very nicely with the extra RAM & CPU it has to spare, so the only limiting factor is VNC. If someone could devise a way to get Ubuntu to draw directly on the screen from within that Chroot, that would be perfect. I don't think it's really possible by design, but this might be the closest we get to running native linux on the I337 until we see some unlocked bootloaders.
Thanks
Click to expand...
Click to collapse
In fact I am currently working on getting xorg to write to androids frame buffer which will mean no more vnc
Sent from my Nexus 4 using xda premium
zacthespack said:
In fact I am currently working on getting xorg to write to androids frame buffer which will mean no more vnc
Sent from my Nexus 4 using xda premium
Click to expand...
Click to collapse
You, sir, are the man. thank you so much for working on this! I threw $10 at you to help fund the skittles/cheetos/carrots/beer/pizza/whatever it takes to help you along.
Added a couple things to the OP. Looks like pure-stock roms will indeed need BusyBox installed, by some means or another. Also, found SManager, which makes executing the ubuntu.sh script much, much easier.
The second script that allows me to launch ubuntu, but the first that allows me to get a real X server on my vnc. Thank you so much !
PS: Why am I unable to install wine ?
"Package wine is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source"
This is working pretty good, slow though, do I have it setup right, or did I miss something?
TheAxman said:
This is working pretty good, slow though, do I have it setup right, or did I miss something?
Click to expand...
Click to collapse
I have found it to run a bit slow, and with regular crashing of GUI programs too. Is it just slow or unusable? You can always try closing other apps besides terminal and VNC, or try to VNC from a computer even.
tboss1995 said:
The second script that allows me to launch ubuntu, but the first that allows me to get a real X server on my vnc. Thank you so much !
PS: Why am I unable to install wine ?
"Package wine is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source"
Click to expand...
Click to collapse
Looks like you're not the only one. Check out this thread on the LinuxOnAndroid site:
http://forum.linuxonandroid.org/index.php?topic=268.0
TheAxman said:
This is working pretty good, slow though, do I have it setup right, or did I miss something?
Click to expand...
Click to collapse
DeadlySin9 said:
I have found it to run a bit slow, and with regular crashing of GUI programs too. Is it just slow or unusable? You can always try closing other apps besides terminal and VNC, or try to VNC from a computer even.
Click to expand...
Click to collapse
Most of the slowness comes from interacting with it via VNC, it would seem. Hard to compare to anything else, considering VNC is all we've got at the moment. I wonder if @zacthespack can shed some light on this. As he mentioned before, he's working on getting it to draw directly to the Android screen. I'm certainly not going to ask for any status updates, but I'm wondering if he can confirm that we'd see a speed increase without VNC...
EDIT: Also, as I use it more, I am noticing the app crashes too (such as Chromium). Could just be something in the 13.04 image, but also could be because we're running this all on ARM architecture.
Aou said:
Looks like you're not the only one. Check out this thread on the LinuxOnAndroid site:
http://forum.linuxonandroid.org/index.php?topic=268.0
Most of the slowness comes from interacting with it via VNC, it would seem. Hard to compare to anything else, considering VNC is all we've got at the moment. I wonder if @zacthespack can shed some light on this. As he mentioned before, he's working on getting it to draw directly to the Android screen. I'm certainly not going to ask for any status updates, but I'm wondering if he can confirm that we'd see a speed increase without VNC...
Click to expand...
Click to collapse
RE installing WINE, sure you can install the ARM verson but Wine is not a emulator (infact WINE stands for Wine Is Not a Emulator) so you can only run ARM compiled windows software.
Yest there is a good speed increase, as with VNC xorg writes to the vnc server and passes it to the vnc client to then render on the screen.
With the new method xorg just writes to Androids frame buffer, no inbetween man.
And it can get even faster once we have graphics accelerations although not all chip sets will get that.
zacthespack said:
RE installing WINE, sure you can install the ARM verson but Wine is not a emulator (infact WINE stands for Wine Is Not a Emulator) so you can only run ARM compiled windows software.
Click to expand...
Click to collapse
Good point, forgot about that. It's really just a big package of Windows dependencies, responding to API calls, etc. The software that Wine runs is still sending stuff to/from the processor directly, therefore it would have to be compiled for ARM.
I wonder what Windows8 programs are available that are compiled for ARM (because of the Microsoft Surface and all...).
Aou said:
Good point, forgot about that. It's really just a big package of Windows dependencies, responding to API calls, etc. The software that Wine runs is still sending stuff to/from the processor directly, therefore it would have to be compiled for ARM.
I wonder what Windows8 programs are available that are compiled for ARM (because of the Microsoft Surface and all...).
Click to expand...
Click to collapse
There's plenty or ARM software within the built in app store, but I'm not sure where they install to or how one would go about extracting them. I have it on desktop and it shows what processors it runs on. Can't wait for the straight to screen function though
Also, I'm going to see if a different image is more stable. Chromium was the most obvious crashing for me and others generally crashed.
DeadlySin9 said:
There's plenty or ARM software within the built in app store, but I'm not sure where they install to or how one would go about extracting them. I have it on desktop and it shows what processors it runs on. Can't wait for the straight to screen function though
Also, I'm going to see if a different image is more stable. Chromium was the most obvious crashing for me and others generally crashed.
Click to expand...
Click to collapse
I noticed that with 12.04, it doesn't seem to connect to Xorg or something, because when you use VNC, it only shows a grey screen with a cross cursor. Same for both "Lite" and "Full" packages. Haven't tried older (10.x) packages of Ubuntu.
The other Linux images should work just fine. Optionally, you can edit the ubuntu.sh script to be more appropriate, but it should theoretically work the same (unless the init.sh is located elsewhere inside the image...).
I tried the Ubuntu 10 image and the Debian image but ubuntu didn't run vnc (vncserver not found or something) and debian kept saying I didn't have permissions.
It appears chromium is incredibly unstable on this image, so I've uninstalled it.
I'm currently working on trying to get Minecraft to work, but ever since 1.6.2 and this new launcher, it's incredibly difficult to modify the client files and such. Something is going wrong with liblwjgl.so. I can get the launcher to work correctly, but when it goes to load the game, it can't find liblwjgl.so and says that it might be because of 32bit vs ARM. I did get lwjgl installed correctly, and pulled the ARM version of the .so and stuck it in [what I believe was] the right .jar file, but it still has the error.
I'll keep you all posted. If I can get this to work, and if zacthespack can get xorg to draw on the android screen, ... :good:
EDIT:
Found out that every time the launcher runs minecraft, it downloads several libraries and other crap to run the game, to keep itself current and to support multiple versions, yada, yada. Unfortunately, this means that it downloads https://s3.amazonaws.com/Minecraft..../2.9.0/lwjgl-platform-2.9.0-natives-linux.jar every time you click Play, and overwrites any custom one you might have (i.e. one with ARM libraries inside). I tried revoking write access to the file, but then the launcher aborts the launch because it can't overwrite the file.
Any suggestions?
EDIT #2:
Well, the easy solution was to modify the file, run the launcher, disconnect mobile data temporarily, and then launch the game ("couldn't connect to server .... have local copy of file .... assuming it's good...."). No more errors about that stupid library file. However, the game immediately crashes now with an error report. Investigating this now. PROGRESS!
Problem
I'm aware I may need to modify the script in order to accommodate my setup, but I figured I'd post here first before changing anything in case someone else had a similar problem and came up with the solution.
I followed all the instructions, except I want to boot from an external USB stick (mounted using StickMount).
I reviewed the script, dropped it on the root of the USB stick, and copied the unzipped image to a folder named ubuntu.
Here is the output when I run the script:
Making mount points and mounting to them...
mount: mounting /dev/loop20 on /data/local/ubmnt failed: Operation not supported
mount: mounting devpts on /data/local/ubmnt/dev/pts failed: No such file or directory
mount: mounting proc on /data/local/ubmnt/proc failed: No such file or directory
mount: mounting sysfs on /data/local/ubmnt/sys failed: No such file or directory
Connecting to /sdcard...
mount: mounting /sdcard on /data/local/ubmnt/sdcard failed: No such file or directory
Putting in some settings...
net.ipv4.ip_forward = 1
/sdcard/usbStorage/sda1/ubuntu.sh[19]: can't create /data/local/ubmnt/etc/resolv.conf: No such file or directory
/sdcard/usbStorage/sda1/ubuntu.sh[20]: can't create /data/local/ubmnt/etc/resolv.conf: No such file or directory
/sdcard/usbStorage/sda1/ubuntu.sh[21]: can't create /data/local/ubmnt/etc/hosts: No such file or directory
ubuntu is configured with SSH and VNC servers that can be accessed from the IP:
(You will see an error about wlan0 if your WiFi is disabled. Safe to ignore.)
----------------- OKAY, starting Ubuntu! -----------------
chroot: can't execute '/root/init.sh': No such file or directory
----------------- Ubuntu has exited! -----------------
Cleaning up - unmounting everything and removing what we made...
umount: can't forcibly umount /data/local/ubmnt/dev/pts: No such file or directory
umount: can't forcibly umount /data/local/ubmnt/sys: No such file or directory
umount: can't forcibly umount /data/local/ubmnt/proc: No such file or directory
umount: can't forcibly umount /data/local/ubmnt/sdcard: No such file or directory
umount: can't forcibly umount /data/local/ubmnt: Invalid argument
Welcome back to your android.
Click to expand...
Click to collapse
I am running as root, BusyBox free has been installed. My terminal app has been granted root privileges. The path to the USB stick is sdcard/usbStorage/sda1.
Any help/guidance would be greatly appreciated! :fingers-crossed:

[How To][Linux] Optware + ssh + samba + transmission + flexget

Yep, you read that correctly. I have optware, ssh, samba, transmission, and flexget working on my Minix X5 Mini. This should work for any rooted device which has an adb connection enabled. This will work on the original ROM. In fact, I use the stock ROM. For those not using a Minix device this should work on any ARM device. Sorry but all the binaries are built on ARM.
JUST AS EVERY OTHER DEVELOPER: I AM NOT RESPONSIBLE IF YOU BRICK YOUR DEVICE! MAKE A BACKUP!
Requirements:
Linux box with adb (don't ask me about windows, I don't support bad habits)
clockworkmod (for a backup)
root
internet connection
Process:
Make a backup of your ROM!
Download files (gitHub)
You have two options here:
Download the zip via https://github.com/erichlf/AndroidSeedBox/archive/master.zip and unzip it.
Clone the repo using git via 'git clone [email protected]:erichlf/AndroidSeedBox.git'
Make script executable
chmod +x optware-etc.sh
Obtain adb connection to device (covered in another thread)
Gain root access on local machine (adb seemed to require this for things to work)
sudo su
Run script and follow directions
./optware-etc.sh
Use SManager to run /opt/home/root/sysinit at every restart.
Notes:
The script can be modified to change the various programs that I install. You could exchange transmission for deluge for example.
Transmission can be accessed from the minix through localhost:9091 or from some other machine using your ip-address and the port 9091. If that doesn't work you should edit the config file located at /opt/home/root/.config/transmission-daemon/settings.json
username: root
password: you provided this in the install script
Without SManager nothing will start automatically. However, if you have a ROM which has init.d support you can move the scripts in /opt/etc/init.d to /etc/init.d I would suggest maybe linking the two instead of just moving the scripts or possibly adding a script to /etc/init.d which runs the items in /opt/etc/init.d The reason is because when installing things using ipkg the startup scripts will be placed in /opt/etc/init.d and not /etc/init.d However, it is extremely important that optware is started, and this is partly what sysinit accomplishes.
To list available packages
ipkg list
To install a new package use the command
ipkg install <new package>
To remove a package use the command
ipkg remove <package to remove>
cron is weird and I couldn't get it to work like it should, but I got it to work
While on the Android device (ssh or terminal emulator)
Create a .crond file in the home directory of your device (/opt/home/root/) with some schedule in it. Remember to leave a blank line at the end of the file.
Tell cron about the .crond file
crontab -u root /opt/home/root/.crond
Make sure cron sees the cron file
crontab -l
If you want to edit your cronfile use a text editor and edit the file directly and then tell cron about the file again.
Many things are installed in what seem like strange places, so use
which <binary you are looking for>
Feel free to help develop the code. I think what would be best is an update.zip or a CWM flashable zip. Right now I don't know how to do this, but once I get more time I will look into it. So, any help on this front is welcomed.
Enjoy!
I really wish you would have kept the repo up. It seems kind of pointless to go through all that trouble just to delete the repo and leave people wondering what you did.
I have been busy and didn't update this particular post, since there had been no activity on it.
git clone [email protected]:erichlf/androidseedbox.git
https://bitbucket.org/erichlf/androidseedbox/get/master.zip
Sorry, I didn't need to be rude. I was just excited to find this and then sad when it was gone. Thanks for pointing me in the right direction!

[GUIDE/DEV] Microsoft Android "Emulator"

I can't find much of any information on hacking the microsoft android emulator. Ideally, I'd like to get it working with superuser, exposed, etc, so it can be a fully functional way to see how android itself and apps work in different environments, all from my desktop. Also, I can just play around with stuff that I wouldn't touch on my tablet for fear of bricking it. I like playing with things.
Disclaimer: I'm not interested in maintaining anything, but as mentioned above, I can't find any information. Therefore, I'm simply posting what information I have here, in the hopes it will interest someone else enough to take a harder look at it. My original post was over here, but I've expanded beyond simply adding supersu to the image.
Things I can't do:
- Install superuser
- Install Xposed
- Install Google Play for anything more recent than KitKat
- Install recovery scripts
Things I can do:
- Run commands as root.
- Install Google Play Services on KitKat
- Change the screen resolution
- Change the amount of internal disk space
- Change the amount of memory and cpu cores available.
- Install busybox
- Flash simple scripts that don't require recent versions of cwm/twrp/other modern recovery.
----------------------------------------
Background information: The Microsoft Android "Emulator" is actually a HyperV virtual machine. When you install it, it enables the HyperV virtualization service in windows*. The effect of this is that instead of running android by emulating an arm processor, it runs android natively, with far better performance, by using Microsoft's hypervisor that's built into windows (win8+). You can work with it with Visual Studio and with Android Studio, but I don't use either much, so I can't help you with that. You can download it from Visual Studio if you want to (VS 2015 is free), or you can download a standalone version. I don't know if there's a difference between the two.
* I'm not sure if it installs the HyperV GUI as well, as I already use HyperV for other things and had it already installed. If you need to do so, you can install the GUI by going to add-remove windows features in the control panel ('appwiz.cpl' from the control panel).
----------------------------------------
Modifying the properties of the emulated system.
Configuration file location: After you create a device, the .cfg file for it will be located in %localappdata%\Microsoft\VisualStudioEmulator\Android\Containers\Local\Devices
To change the resolution: So far, I haven't identified any supported resolutions other than those listed in the device profiles list. So far, supported resolutions that I've used successfully are 480x800, 720x1080. You can edit the .cfg file for the specific device that you want to change the resolution of, and change the `device.screen.resolution=` line to any supported (see previous) resolution.
To change the size of the internal storage, follow the instructions here. You'll need an ubuntu cd; minimal install cd is fine if you have slow internet/computer or low ram.
To change the amount of ram or processors allocated to the virtual machine: Open Hyper-V manager, right-click the appropriate VM and click settings.
- Change the ram allocation by clicking Memory in the list at left. I do not know what happens if you try using Dynamic Memory; if it works, it should be more memory-efficient, but I left that alone. Now update the `device.vm.ram.size=` line in the .cfg file.
- Change the cpu allocation by clicking the Processor field. Please note that if you have hyper-threading, you should only use half your logical processors as cpus; the hyperthreaded 'cores' won't work as well (according to information online; you can check number of logical processors in windows task manager's performance tab). Now update the 'device.vm.cpu.count=' line in the .cfg file
----------------------------------------
Info on "recovery" and "flashing" - Installing google play
So far, I have only managed to get Google Play Services working on KitKat. I can't get it to work on Lollipop or Marshmallow (and haven't tried earlier versions at all); the virtual machine does *not* have a recovery or fastboot because of the way it works, and I haven't figured out any way of installing such. Instead, there's a simple shell file called install_zip.sh. It does not work with modern flashable zips that require TWRP/CWM; it only works with the old style zip designed for a specific architecture. As such, opengapps flashable zips will not work.
To install Google Play Services on KitKat (4.4.4)
1. Inside the emulator, open the browser and go to http://www.teamandroid.com/gapps/ and download the file linked under Gapps CyanogenMod 11.
2. Open the window the the android VM from the Hyper-V Manager to get console access. If you have ADB installed locally, you can use that in the future, but getting the VM's shared IP requires terminal access anyways (run `ip addr` as root inside the emulator to get the list of IPs).
3. Run `adb shell` to get access to the root shell (yes, it's that easy).
4. Run `install_zip.sh /sdcard/Downloads/gapps-kk-20140105-signed.zip` (or whatever the name/path for the downloaded gapps file is).
5. It should complete successfully. Now type exit to exit the adb shell, and close the hyper-v console window (the android emulator will continue running).
6. Click the 'X' at the top right of the Emulator to shut down/close the VM
7. Start the emulator back up. You should now have access to Google Play Services.
----------------------------------------
Busybox
The emulator does not come with a preinstalled copy of busybox. It does come with the android toolbox, but this has only a very minimal amount of commands in it. The instructions below are for installing stericson's busybox.
1. Get a copy of stericson's busybox from somewhere--your personal device, etc, it doesn't matter. The easiest way is to either install it on a real android device and grab it with airdroid (or other), or to use a play store scanner to get it. The file name will probably be something like stericson.busybox.apk.
2. Rename it to .zip so you can access the contents.
3. Extract the busybox-x86.png file from the 'assets' folder inside the zip, and rename it to `busybox`.
4. In the Android Emulator, click the >> button for tools, and click the sdcard header. Choose a folder (a new one on your dekstop will do) and tell it to pull the contents of the sdcard to the folder.
5. Move the busybox file into the Download folder that you just pulled from the sdcard. If you created a folder for this, you can delete it now.
6. Back in the android emulator, push the folder structure back into the sdcard; this will move the busybox onto the emulator.
7. Open the HyperV console for the emulator or open a terminal app in the android emulator (installing it is up to you)
8. Run `adb shell` to get a root prompt.
9. Run `mount -o rw,remount /system` to remount the system partition as writable
10. Run `cp /sdcard/Download/busybox /system/xbin` to copy the busybox binary over
11. Run `chmod 777 /system/xbin/busybox` to make the busybox binary executable.
12. Run `busybox --install /system/xbin` to copy the busybox binary for all the included applets. I think the -s paramter will symlink the applets to the main binary instead, but I'm not sure.
13. Type exit in the adb shell.
14. You can now run busybox commands in the terminal, and use apps that require busybox to be installed.
Now that you have busybox installed, you can use unzip, etc.
----------------------------------------
Hacking the OS itself.
The android emulator uses a VHD file for the disks. I've mounted the vhd file inside an ubuntu server to play with, and discovered several things about the way it works. The first partition is the boot partition, it contains 3 files:
- kernel - the android/linux kernel
- ramdisk - the ramdisk for the root filesystem. gzipped cpio archive.
- cmdline - the kernel parameters(? not sure what to call this)
I've tried modifying the ramdisk to add the init files for the superuser, but this doesn't seem to work properly; when I boot up the vhd file, I can open the console with hyper-v manager (the android emulator machines show up there automatically), and when it gets to the ramdisk, it says so--then the caps/num/scroll lights start flashing and it hangs. I haven't gotten any further than that at this time.

Categories

Resources