ZF2 Linux Howto - ZenFone 2 General

I've had a bunch of requests on how to run Linux on our ZF2, so this is a quick(ish) howto using some awesome tools out there.
Requirements:
1. Root ( this is necessary for creating a chroot )
2. Busybox ( from the Play Store ) for Linux Deploy and pretty much all root-related software
3. Linux Deploy ( from the Play Store ) for installing Linux
Optional:
1. XServer-XSDL ( from the Play Store ) for X
2. MicroSD card for linux
3. SD Card Partitioning software ( I use Aparted from the Play Store )
Process:
1. Root your phone. Plenty of howto's out there
2. Install Busybox
3. Install Linux Deploy
4. ( OPTIONAL ) Install XServer-XSDL
5. ( OPTIONAL ) If you want pulse audio support, you will need to add a /tmp folder to /data/data/x.org.server/files/img/
6. ( OPTIONAL ) Install Aparted
7. ( OPTIONAL ) repartition your microSD card with partition 1 as exFAT & the 2nd partition as ext4 ( for linux )
7b. Write down the location of your ext4 partition. Most of the time it will probably be /dev/bloc/mmcblk1p2 ( means memory card 1 partition 2 )
8. Start up Linux Deploy
8a. click on Properties ( looks like a download icon on the bottom right )
8b. Under Deploy: Select your Distribution.
8c. Under Deploy: Select your Distribution suite. ( right now there is no hw video acceleration and Mesa's new implementation fails with llvm errors; so if you want software supported glx, then choose an older distro )
8d. Under Deploy: Select i386 or i686 ( do NOT select any of the ARM processors )
8e. ( OPTIONAL ) Under Deploy: change Installation type to Partition if you want to use a real partition off your microSD card.
8f. ( OPTIONAL ) Under Deploy: change Installation path to your real partition, ie /dev/block/mmcblk1p2
8g. ( OPTIONAL ) Under Deploy: Change File system to the filesystem we partitioned the card as, ie ext4
8h. Under Startup: ONLY have SSH checked
8i. ( OPTIONAL ) Under Startup: Check Custom Mounts to mount other filesystems, like the internal SD card, the microSD card exFAT partition or even the /tmp folder for XServer-XSDL for pulse audio
8j. ( OPTIONAL ) Under Startup: Click Mount points to add mount points, here's a quick list:
/storage/emulated/0
/storage/MicroSD
/data/data/x.org.server/files/img/tmp
These 3 mounts would appear as: /mnt/0, /mnt/MicroSD and /mnt/tmp in your chroot linux
9. Install Linux ( it will take around 30 minutes or so )
10. After installation finishes, click Start and Linux Deploy will start up your ssh service.
11. Connect to your phone via ssh with default login/password: android/changeme
12. I HIGHLY recommend changing your password.
13. ( OPTIONAL ) start up XServer-XSDL on your phone
14. ( OPTIONAL ) export DISPLAY=:0 to send all X commands to XServer-XSDL
15. ( OPTIONAL ) Pulse Audio: use your local package manager ( apt-get, rpm, pacman, emerge, etc... ) to install pulseaudio & pulse-alsa packages. This should set the default asound.conf to use pulse audio.
15a. ( OPTIONAL ) edit /etc/pulse/default.pa and add this line at the end:
load-module module-pipe-sink rate=44100 format=s16le channels=2 file=/mnt/tmp/audio-out
15b. ( OPTIONAL) edit /etc/pulse/default.pa and comment out the lines containing module-console-kit, ie:
# .ifexists module-console-kit.so
# load-module module-console-kit
# .endif
15c. ( OPTIONAL ) to start pulse audio before your application: $pulseaudio --start -D
16. Run your Linux executable(s)
Directions on recompiling LLVM, Gold & Mesa for Intel SSE4.1 assisted 3d: http://forum.xda-developers.com/showpost.php?p=62024812&postcount=12
Arch Linux walkthrough: http://forum.xda-developers.com/zenfone2/general/zf2-linux-howto-t3158034/page4#post62916375
Enjoy linux running alongside your phone.
Edit: Compiled libandroid-shmem.so for 64-bit Arch.

Thank you for the in-depth tutorial. How well does this run? In the past I have tried (ARM based devices) and it runs like trash when trying to start applications. Does it run smooth on here?

Christopher876 said:
Thank you for the in-depth tutorial. How well does this run? In the past I have tried (ARM based devices) and it runs like trash when trying to start applications. Does it run smooth on here?
Click to expand...
Click to collapse
It's pretty much native linux, so comparable to whatever's out there. As far as X goes, it's pretty smooth with XServer-XSDL. <-- hands down, the best Android X Server out there.
...and you can further increase the speed of X apps by getting libandroid-shmem.so ; it opens a shared memory location with XServer-XSDL. ( Under the description of XServer-XSDL is a link to download it ) This ONLY works for 32 bit distros at the moment.
ie, $LD_PRELOAD=/lib/libandroid-shmem.so mplayer my_movie & would play the movie with shared memory access.
Actually, I use this setup to start up Qemu-KVM to virtualize windows.
You will have issues with OpenGL, though, because right now I haven't figured out how to access the video card hardware properly. Older Distros, before Mesa moved to llvm, will still allow you to do software rendering & I was able to get around 40-50 fps w/ the test software.

Added to index; thanks for the tutorial!

Good job

I keep getting a message that says couldn't find these debs: 0. And I also get the linux.img already but, its suppose to be a 30 minute install
Sent from My ZE550ML

troy5890 said:
I keep getting a message that says couldn't find these debs: 0. And I also get the linux.img already but, its suppose to be a 30 minute install
Sent from My ZE550ML
Click to expand...
Click to collapse
I would first check your internet & if it still doesn't go, try a different distro.
Depending on which Distro you want to install, I'd recommend going to Google to see how to mount your img and create the chroot from scratch.

So, every OS in VM (Linux, Windows) suffers from lack of full-featured GPU drivers. In other words, every OS in VM on ZF2 stuck with software rendering.
While it can be OK for some office or other non-graphics intensive apps, you can forget about idea to run the games
If i guess right, this situation won't change, because no-one will able to write GPU driver.

sorg said:
So, every OS in VM (Linux, Windows) suffers from lack of full-featured GPU drivers. In other words, every OS in VM on ZF2 stuck with software rendering.
While it can be OK for some office or other non-graphics intensive apps, you can forget about idea to run the games
If i guess right, this situation won't change, because no-one will able to write GPU driver.
Click to expand...
Click to collapse
The problem isn't the GPU driver, though.
This is using the Android kernel. Which means we do have some sort of hardware acceleration on Linux...
Just not full hardware acceleration. I heard it had to do with something in the way this deploys or something like that. Idk~

AkiroX said:
The problem isn't the GPU driver, though.
This is using the Android kernel. Which means we do have some sort of hardware acceleration on Linux...
Just not full hardware acceleration. I heard it had to do with something in the way this deploys or something like that. Idk~
Click to expand...
Click to collapse
For simplicity, i've called 3D accelerated (DirectX, OpenGL) driver as GPU driver.
Of course, there is basic video driver, but that's not enough to play the games.
May be it's possible to use somehow part of android binaries, like OpenGL driver, and then create some other OpenGL driver on top of it (Android API is well documented), to make it compatible with normal Linux. Some kind of wrapper.
At least in theory. This should require a lot of knowledge.

About the "couldn't find these debs: 0", I think it's due to an invalid combination of settings. For instance I get it when selecting GNOME on Ubuntu Precise, but it installs just fine when using Lucid.
That said I can't get GNOME to work with any distro I've tried. Just crashes when starting gnome-session. Guess it needs graphics acceleration?
Also, I don't think busybox is strictly required. At least I've previously managed to install Debian with LXDE without installing busybox.

Update: LLVM & GLES
In order to get GLES( 1 & 2 ) working, you will need to recompile LLVM, Gold & Mesa.
Explanation of the issue:
Without hardware accelerated video drivers, modern linux distros fall back to the software renderer. The current Mesa software renderer tries to make use of all possible intrinsic instructions ( SSE, SSE2, SSE3, SSE4, etc.. ) at link time (LTO). Here's the rub: LLVM doesn't recognize our cpu, so it returns generic x86_64; which doesn't support.. you guessed it, SSE4.1; even though cpuinfo will show that we have SSE4.1 support.
Here's the process:
I. Prepare binutils following this guide: http://llvm.org/docs/GoldPlugin.html
1. download binutils: git clone --depth 1 git://sourceware.org/git/binutils-gdb.git binutils
2. create a separate build directory since you're only going to use the binutils source files. I called mine: mybuild
3. from your build directory: $ ../binutils/configure --enable-gold --enable-plugins --disable-werror
4. from your build directory: $ make all-gold
II. Prepare & Build LLVM following this guide: http://www.linuxfromscratch.org/blfs/view/svn/general/llvm.html
1. Download LLVM 3.6.2: http://llvm.org/releases/3.6.2/llvm-3.6.2.src.tar.xz
2. Download Clang: http://llvm.org/releases/3.6.2/cfe-3.6.2.src.tar.xz
3. Download Compiler RT: http://llvm.org/releases/3.6.2/compiler-rt-3.6.2.src.tar.xz
4. extract LLVM: $ tar xvf llvm-3.6.2.src.tar.xz
5. extract Clang inside the llvm directory -> tools directory: tar xvf cfe-3.6.2.tar.xz
6. rename the directory: $ mv cfe-3.6.2 clang
7. extract Compiler-RT inside the llvm directory -> projects directory: tar xvf compiler-rt-3.6.2.tar.xz
8. rename the directory: $ mv compiler-rt-3.6.2 compiler-rt
III. Modify lib/LTO/LTOCodeGenerator.cpp
1. do a quick search for "yonah", it should appear in bool LTOCodeGenerator::determineTarget
2. After the Darwin check, add the following line: Mcpu = "silvermont";
3. ( Explanation ) Even though our processor is a Moorefield ( Medfield ) processor, it falls under the Silvermont sub-family. Basically, we're telling LTO ( Link Time Optimization ) that it doesn't matter what we're detected as, we're a Silvermont processor.
IV. Modify lib/Support/Host.cpp for Intel processors
1. ( explanation ) if you do a $ cat /proc/cpuinfo you'll see that our family is 6 and our model is 90. So we need to add that to the Atom Silvermont section of StringRef sys::getHostCPUName. Cpuid, though, also detects our model as model 10, so we need to comment out that model under family 6.
2. comment out the case statement under family 6 w/ model 10: // case 10: // Pentium III Xeon processor, model 0Ah ( here we add 2 slashes in front of case 10 )
3. Add 90 and 10 to the Silvermont section of family 6 ( "slm" is shorthand for silvermont ):
// Atom Silvermont codes from the Intel software optimization guide.
case 55:
case 74:
case 77:
case 90:
case 10:
return "slm";
4. To make sure we make LLVM aware of what processor we are, comment out all of the "default: return x86_64..." 's with:
default: return "slm";
// default: return (Em64T) ? "x86-64" : "i686";
5. Comment out "generic" and return "slm" again:
default:
return "slm";
// return "generic";
V. Prepare the LLVM configuration in the llvm directory
1. $ sed -e "s:/docs/llvm:/share/doc/llvm-3.6.2:" -i Makefile.config.in
2. $ sh configure --with-binutils-include=[full downloaded binutils path]/include --prefix=/usr --enable-shared
3. make -j2
4. Go have dinner, watch a movie, drink some coffee; it's going to take a LONG time
5. DO NOT INSTALL IT YET
VI. Prepare Mesa
1. Download Mesa 10.6.2 from mesa: ftp://ftp.freedesktop.org/pub/mesa/10.6.2/mesa-10.6.2.tar.xz
2. extract mesa $ tar xvf mesa-10.6.2.tar.xz
3. inside the mesa directory: $ sh configure --host=x86_64-pc-linux --prefix=/usr CFLAGS=-march=silvermont --enable-gles1 --enable-gles2 --enable-nine --enable-opencl --with-llvm-prefix=[full path to downloaded LLM]/llvm-3.6.2.src/Release+Asserts
4. $make -j2
VII. Install LLVM & Mesa
1. from the llvm directory: $ sudo make install
2. from the mesa directory: $ sudo make install
If everything works, you can download the mesa demo's package from your favorite package manager and be able to run es2gears_x11 w/ XServer-XSDL ( from the App Store ).
On average, I get just shy of 60 fps this way.
You should be able to download virtualgl & turbovnc to get quite a performance boost. VirtualGL uses a fake X environment to render the 3D and passes that on to the 2D X environment. TurboVNC is built on top of VirtualGL, so it's a vncserver that supports pretty snappy gles on and off the phone. I was able to hit around 112 fps w/ es2gears_x11 in a TurboVNC environment. YMMV
At the moment, there is still no GLX support and I'm looking into it, but having our quad core processor w/ SSE4.1 helps w/ the software rendering a LOT.

Does that mean GPU acceleration is close to work or we need GLX (OpenGL for X) ?
The fps you got are in which game/application?
Is TurboVNC faster than VirtualGL?

aziz07 said:
Does that mean GPU acceleration is close to work or we need GLX (OpenGL for X) ?
The fps you got are in which game/application?
Is TurboVNC faster than VirtualGL?
Click to expand...
Click to collapse
Before we can get GPU acceleration, I wanted to make sure LLVM responded w/ the correct cpu since a LOT of software now uses it.
fps was from es2gears_x11, the mesa gles2 demo program.
Connecting to TurboVNC using bVNC ( from the app store ) allowed es2gears_x11 to run around 112 fps
Connecting to TurboVNC from my laptop using Windows TurboVNC viewer allowed es2gears_x11 to run around 68 fps
Using VirtualGL running es2gears_x11 to XServer-XSDL was just shy of 60 fps ( ~58 fps or so ), so either I'm not running it correctly, but XServer-XSDL is limited
The benefit of using XServer-XSDL, though, is that it has built-in pulseaudio support; right now, I'm not setting something right in my /etc/pulse/default.pa configuration file to stream audio to Simple Player ( android app store ).
Edit:
Here's a video of TurboVNC running the lxde windows manager, es2gears_x11, Windows 8 under qemu-kvm and the ePSXe Playstation 1 emulator inside Windows 8.

Hows your ram usage in Android with all those running ??

aziz07 said:
Hows your ram usage in Android with all those running ??
Click to expand...
Click to collapse
Pretty much normal. I think I dip down around 900 megs free or so. ( because I allot 1 gig to Windows 8 )

Amazing accomplishments ycavan, but I'm wondering, can I compile on my desktop machine (Arch Linux x86_64), move the folders to the chrooted installation in my ZenFone, and make install then and there? Am I missing something here? I dabbled with clang, but mostly small stuff (and using Qt in the middle, so I wasn't really doing a whole lotta makefiles or stuff like that ). Also, is there any improvement for this in Mesa 10.6.3?
Thanks!
edit: on my Arch installation I'm getting the warning "configure: WARNING: unrecognized options: --enable-gold" and it can't do the make all-gold. Am I missing something?

pijiman said:
Amazing accomplishments ycavan, but I'm wondering, can I compile on my desktop machine (Arch Linux x86_64), move the folders to the chrooted installation in my ZenFone, and make install then and there? Am I missing something here? I dabbled with clang, but mostly small stuff (and using Qt in the middle, so I wasn't really doing a whole lotta makefiles or stuff like that ). Also, is there any improvement for this in Mesa 10.6.3?
Thanks!
edit: on my Arch installation I'm getting the warning "configure: WARNING: unrecognized options: --enable-gold" and it can't do the make all-gold. Am I missing something?
Click to expand...
Click to collapse
I'm not sure about compiling on your desktop machine, but I doubt it'd be too much of a problem.
re: the --enable-gold warning, did you follow the linked howto? it almost sounds like you didn't grab the correct binutils ( or running configure for some other program )

I'd like to think so. I created a directory, did the clone of binutils into that directory. CDd there, created another directory called "mybuild" (so I could follow the steps perfectly), etc. I'll try again in a little bit and post some pictures with the warning, should they arise again. Thanks!
EDIT: created "mybuild" INSIDE binutils, instead of BESIDES binutls. making it right now. I'd like to, eventually, post a video guide of this build process, with your permission and due credits.

I think that's a wonderful idea!
Sent from my ASUS_Z00AD using XDA Free mobile app

Related

Ubuntu Setup Notes for Dev (kitchen) work - UPDATED 2/26

Update 2010-02-26 Added examples for linking either dynamically or statically (see page 2)
I decided to try and set up a kitchen using the closest thing to a native kernel dev environment that I could set up.
At this point I have:
- cross-compiled the HTC Desire (kernel) sources using the Android 1.6 NDK
- figured out the repo/git stuff to pull the Android sources corresponding to a given Android release point
- cross-compiled the entire Cupcake release to an ARM target using the NDK tools
- built a dynamically linked "hello, world" executable using the NDK arm-eabi-* tools and verified it works on the phone.
Yah, I know - not much yet, but it's a start for a newb.
I have some notes documenting the Ubuntu setup process in case anyone wants it - but it is full of links (URLs), so I can't post anything with links as a new user.
If a mod can "verify" my account, I'll post it up. I promise, I'll be good.
bftb0
OK, I guess I need to make a couple of posts before I can embed links.
I'll post it without the URL protocol prefix (it's gonna look fugly), and then come back and edit it once the restriction is removed. I hope someone finds it useful.
Android kernel dev is not officially supported on Windows; closest match to Google Dev environment seems to be -> Ubuntu 8.04 LTS + JDK 5 (32 bit, not x64).
I realize that this is nothing close to the "kitchens" that the WinMo folks have been using, but figured that (as a newb) I would just end up confusing myself trying to figure out which of those tools could be useful for Android, in addition to needing the native binary cross-compilation tools anyway.
(Note: I briefly tried to set this up in a Ubuntu VMware Player VM, but ran into limitations of available Ubuntu 8.04 LTS player machine file size limits (as well as problems hosting a VM bigger than about 10 Gb on a USB drive - insufficient space on my primary drive)
If anyone wants to follow in my footsteps, here is a thumbnail sketch of useful links. I'll admit, this is not for the faint of heart - you need Linux/Unix skills to work through the kinks.
1) (ubuntu.com/getubuntu/downloadmirrors#mirrors) Ubuntu Download Mirrors list - Find a server near you
2) Download ubuntu-8.04.4-alternate-i386.iso and burn it to 700 Mb CD-R
3) Install Ubuntu 8.04 LTS Desktop Version (gulp!)
4) Use the Ubuntu graphical package manager (System -> Administration -> Synaptic Package Manager) and install the packages (git, flex, bison, etc) mentioned in the "Ubuntu Linux (32-bit x86)" section in this (source.android.com/download)Android Source setup page
5) Note that JDK6 does not work correctly; rather than going to Sun/Oracle for JDK5, install the sun-java5-{bin,jdk,jre,doc,demo} packages (1.5.0-22-0ubuntu) using the Ubuntu package installer mentioned above. Note if you install the docs package, you will also need to go to Sun/Oracle and get jdk-1_5_0-doc.zip towards the end of the package install, and drop it into /tmp for the package manager to finish.
6) Go to the (developer.android.com/sdk/index.html) Android SDK Download page and get android-sdk_r04-linux_86.tgz
7) Unpack ( gunzip -c and...tgz | tar xf - ) to desired location, add tools dir to PATH
Optional Steps (For Java App Devs)
o-8) (eclipse.org/downloads/ Eclipse IDE Download page - chose 'Eclipse Classic 3.5.1 (162 MB)' for Linux, 32 bit (eclipse-SDK-3.5.1-linux-gtk.tar.gz)
o-9) Install by unpacking ( gunzip -c ecli....tar.gz | tar xf - ) to desired location, add eclipse folder to PATH
o-10) Run eclipse, and follow the (developer.android.com/sdk/eclipse-adt.html) Installing and Updating ADT instructions for adding Android functionality to Eclipse 3.5 (Galileo)
o-11) From within Eclipse, launch Window -> Android SDK and AVD Manager, and install all available & compatible Android SDK Tools (all versions). (You might need to use http instead of https... YMMV) Note that this is the same functionality as simply running the command "android" from the command prompt if the Android SDK (steps 6,7) tools directory is in your PATH
12) Familiarize yourself with the command line tool "adb" tool in the SDK; in particular, since Ubuntu needs root privs to access the USB hardware, the best way to start the adb server on your PC is to
Code:
$ sudo /bin/bash
- set up root's environment so the SDK "tools" directory is in root's PATH
- plug your phone into the USB cable
- On the Eris, set the options:
Settings -> Applications -> Development -> USB Debugging (on)
Settings -> Applications -> Development -> Stay awake (on)
Code:
# adb devices
This last command only lists the available USB-connected (real) devices and any emulators you have running, but as a side effect it starts up the adb server on the Ubuntu machine running as root. Thereafter, you can use adb (or ddms) as an unprivileged user.
13) Have a peek at the SDK "ddms" monitor. A variety of things can be done from here, the least of which is screen shots (Select device, then Device-> Screen capture)... and some more twisty things too.
14) Download the (developer.android.com/sdk/ndk/1.6_r1/index.html) Android 1.6 NDK r1 (Native Development Kit) - android-ndk-1.6_r1-linux-x86.zip, and unzip into your desired location. Add the ARM cross-compiler tools to your path (see example below).
15) At this point you might be using something like this to set up your path wherever you please (.profile or elsewhere, according to how you want to manage your environment)
Code:
_INSLOC='/opt/android/'
_JAVAPATH='/usr/lib/jvm/java-1.5.0-sun/bin'
_BASEPATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
_ANDTOOLS="${_INSLOC}"'/android-sdk-linux_86/tools'
_ECLPSPATH="${_INSLOC}"'/eclipse-3.5.1'
_ARMXCOMPILE="${_INSLOC}"'/android-ndk-1.5_r1/build/prebuilt/linux-x86/arm-eabi-4.2.1/bin'
PATH="${_JAVAPATH}"':'"${_BASEPATH}"':'"${_ANDTOOLS}"':'"${_ECLPSPATH}"':'"${_ARMXCOMPILE}"
export PATH
16) Download the (member.america.htc.com/download/RomCode/Source_and_Binaries/desirec-be918f7b.tgz) HTC Desire Kernel Source Code and unpack to a location of your choice.
17) Test your enviroment by building the HTC Kernel code:
$ cd v2_6_27/kernel_msm7k; make
I can't remember if I needed to stuff anything into the environment here (e.g. 'CC' definitions, etc.) - but I know that I didn't need to modify any Makefiles. I think the make system will find all the "arm-eabi-*" executables if they are in your path. You will know soon enough.
18) Try to compile a "Hello, world!" program for the phone. Before you get too far along in this (e.g. "where is crt0.o?"), (honeypod.blogspot.com/2007/12/dynamically-linked-hello-world-for.html) read this blog post - steps 3 and 4 only.
You might find a Makefile similar to this useful:
Code:
AR = arm-eabi-ar
AS = arm-eabi-as
CC = arm-eabi-gcc
CXX = arm-eabi-c++
LD = arm-eabi-ld
NDK_KIT = /opt/android/android-ndk-1.5_r1
PLATF_KIT = build/platforms/android-1.5
ARM_INC = $(NDK_KIT)/$(PLATF_KIT)/arch-arm/usr/include
ARM_LIB = $(NDK_KIT)/$(PLATF_KIT)/arch-arm/usr/lib
PLATF_INC = $(NDK_KIT)/$(PLATF_KIT)/common/include
OBJS = hello.o start.o
EXES = hello
hello: hello.o start.o
$(LD) \
--entry=_start \
--dynamic-linker /system/bin/linker -nostdlib \
-rpath /system/lib -rpath $(ARM_LIB) \
-L $(ARM_LIB) -lc -o hello hello.o start.o
hello.o: hello.c
$(CC) -I $(ARM_INC) -I $(PLATF_INC) -c hello.c
start.o: start.c
$(CC) -I $(ARM_INC) -I $(PLATF_INC) -c start.c
clean:
rm -f $(OBJS) $(EXES)
and then
Code:
$ make hello 2>&1 | tee make_hello-log.txt
if all goes well, push to the phone
Code:
$ adb push hello /sqlite_stmt_journals/hello
and then use a shell on the phone to watch the lights gerblinken:
Code:
PC-path$ adb shell
$ cd /sqlite_stmt_journals
$ ./hello
Hello, world!
$ exit
PC-path$
19) Now, download the Android stock kernel sources:
- Make sure you have "git" and "repo" installed; see the (source.android.com/download) Android "Get source" page, starting from "Installing Repo".
- Make a clean directory to initialize "repo" in, and download the code:
Code:
$ mkdir ~/mydroid
$ cd ~/mydroid
$ repo init -u git://android.git.kernel.org/platform/manifest.git -b cupcake
$ repo sync
The sync step above will download the entire source tree corresponding to the Cupcake release (90 minutes on my link).
20) Build the sources
Code:
$ cd ~/mydroid
$ make 2>&1 | tee make_Android-log.txt
On my old PC, this step took about two hours.
Well, that's a little start; everything that comes after this is heavy lifting, I suppose.
bftb0
Thank you for that.
I forgot to add a disk space usage report to this; here it is:
O/S ( /, /boot, /var, /tmp) ~ 4 Gb **
Android SDK, all versions: 1.3 Gb
Android "Cupcake" full sources + full build: 5.5 Gb (2.5 Gb sources, 3.0 Gb build tree)
Android NDK ~0.05 Gb
Eclipse 3.5.1: 0.21 Gb
HTC Desire Kernel Sources + build ~ 0.77 Gb
All up, thats about 12 Gb minimum needed for a full environment. Obviously, you would want some headroom above that.
Note that if you only want to build native binaries, and not the full Android source tree (or develop Java applications), this could be done handily in a virtual machine which is less than 10 Gb in size - for Windows users, there are VMware "Player" versions of Ubuntu 8.0.4 available for that. That eliminates the need for a separate machine, or a dual-boot PC - and the worries of messing up trying to create a dual-boot machine.
All that is really needed for that is the Desktop OS and the NDK. Adding a single version of the SDK so you have 'adb' and 'ddms' available to you would be helpful, but not absolutely necessary if you are using a Windows host machine with those tools already present.
bftb0
** beware that Ubuntu uses a lot of space on /var if you put it in a separate partition - 600+ Mb in my configuration.
bftb0 said:
I forgot to add a disk space usage report to this; here it is:
O/S ( /, /boot, /var, /tmp) ~ 4 Gb **
Android SDK, all versions: 1.3 Gb
Android "Cupcake" full sources + full build: 5.5 Gb (2.5 Gb sources, 3.0 Gb build tree)
Android NDK ~0.05 Gb
Eclipse 3.5.1: 0.21 Gb
HTC Desire Kernel Sources + build ~ 0.77 Gb
All up, thats about 12 Gb minimum needed for a full environment. Obviously, you would want some headroom above that.
Note that if you only want to build native binaries, and not the full Android source tree (or develop Java applications), this could be done handily in a virtual machine which is less than 10 Gb in size - for Windows users, there are VMware "Player" versions of Ubuntu 8.0.4 available for that. That eliminates the need for a separate machine, or a dual-boot PC - and the worries of messing up trying to create a dual-boot machine.
All that is really needed for that is the Desktop OS and the NDK. Adding a single version of the SDK so you have 'adb' and 'ddms' available to you would be helpful, but not absolutely necessary if you are using a Windows host machine with those tools already present.
bftb0
** beware that Ubuntu uses a lot of space on /var if you put it in a separate partition - 600+ Mb in my configuration.
Click to expand...
Click to collapse
great very descriptive thread
Hey bftb0
thanks for posting this guide. I am trying to just play around with someone of the exploit binaries on my eris (from the tattoo/hero rooting threads) , so these guidelines are coming in handy. However for some reason whenever I try and do anything over adb i get this error:
Code:
error: insufficient permissions for device
I cant use adb shell at all, even trying to push to the sdcard gives permissions denied. In the adb devices output the phone is coming up as "?????? no permissions", Did I miss a step ?
My setup so far: Ubuntu 9.10 i386,
Hey bftb0
thanks for posting this guide. I am trying to just play around with someone of the exploit binaries on my eris (from the tattoo/hero rooting threads) , so these guidelines are coming in handy. However for some reason whenever I try and do anything over adb i get this error:
Code:
error: insufficient permissions for device
I cant use adb shell at all, even trying to push to the sdcard gives permissions denied. In the adb devices output the phone is coming up as "?????? no permissions", Did I miss a step ?
My setup so far: Ubuntu 9.10 i386, android-sdk_r04-linux_86, droid eris with most recent OTA
someguy, you have to go to developer.android.com/guide/developing/device.html and install the linux driver (as root) and restart your system.
@someguy
Type "adb kill-server" followed by "sudo adb". You need to run adb as root in unix for it to work.
zifnab06, that was it, I must have not run the first command as root which caused the server to be run without su.
What exactly does this do?
bigcj55 said:
What exactly does this do?
Click to expand...
Click to collapse
Because of the lineage between Linux and Android, the primary platform for compilation of the kernel and other ARM instruction-set binaries ("native" code) has been on Linux. It appears (at the moment...reading between the lines) that Google engineers are using Ubuntu 8.04 LTS as their choice of Linux platform for maintaining Android kernel & utilities code... so, in principle, it is the "best supported" platform for doing "native" development work, if for no other reason than it's what Google has been using. (Not because it is somehow a "better" O/S, but rather because you are likely to run into fewer quirks, and have more resources on the internet who might have experienced the same difficulties that you run into.)
For instance, the folks that have been building kernel exploit programs have been using the Google "NDK". They are not writing/compiling those in Java - they are writing or compiling programs written in "C", and compiling them into native (ARM) object code.
I provided notes from my own installation for anyone considering "dipping their toe" into building Android kernels or native binaries using Linux as a host O/S - most forum readers are not going to be interested in doing that.
Note that Google now releases an NDK for Windows, Linux, and Mac OS/X. The strange thing about doing development on Windows using Cygwin is that if you have sufficient skills to do so - and are capable of resolving problems that inevitably crop up - then you probably already have sufficient skills to be using Unix/Linux in the first place. Sort of depends on your past experience, though. I'd be willing to bet that Devs with a history of doing WinMo development probably would prefer to climb the Android development learning curve by trying their hand with the Windows/Cygwin NDK because of their familiarity with other Windows-based development tools (IDEs, hex editors, assemblers, GUI generators, etc).
That reminds me though - I need to update this thread with something else.
Cheers
bftb0
Static OR Dynamic Linking of Native Binaries
I was a little unsatisfied with the "hack" used in the above examples to circumvent the need to launch programs without linking to C runtime initialization using that strange code shown above, i.e.
Code:
start() { exit( main() ); }
Moreover, for purposes of debugging applications running on the phone (using "gdbserver"), it simply seems easier to link statically - it allows you to step into the syscall library routines and actually see the assembler implementations wrapped around "STI" interrupts.
So, I spent some time experimenting, and came up with a Makefile that allows me to easily toggle between building an ARM executable linked statically or dynamically. Moreover, it lets "argc" and "argv" work they way they are supposed to, and also allows main() to do a return().
Here's an example Makefile, for a program "hello.c". Make sure you read the notes which follow it.
Code:
#
# FIX THESE (to match your installation)
# Top of the Android Source/build tree (retrieved w/ repo)
ANDSRCROOT := /home/user/android/repo-root
# link dynamically against the libraries shipped on the phone!
# e.g.: $cd /opt/android/Eris_libs/ruu1_16_605_1 ; adb pull /system/lib/
PHONELIBS := /opt/android/Eris_libs/ruu1_16_605_1/lib
# Choose one or the other; static is easiest for debugging use
LINKMODE := dynamic
#LINKMODE := static
# tools
CROSS_COMPILE := arm-eabi-
CC := $(CROSS_COMPILE)gcc
LD := $(CROSS_COMPILE)ld
AR := $(CROSS_COMPILE)ar
CXX := $(CROSS_COMPILE)c++
OBJDUMP := $(CROSS_COMPILE)objdump
RANLIB := $(CROSS_COMPILE)ranlib
READELF := $(CROSS_COMPILE)readelf
# Note STATLIBROOT is relative to the Android Source root (ANDSRCROOT)
STATLIBROOT := out/target/product/generic/obj/STATIC_LIBRARIES
INCLUDE := -I $(ANDSRCROOT)/bionic/libc/include \
-I $(ANDSRCROOT)/bionic/libc/arch-arm/include \
-I $(ANDSRCROOT)/bionic/libc/kernel/common \
-I $(ANDSRCROOT)/bionic/libc/kernel/arch-arm
ifeq ($(LINKMODE),dynamic)
LIBDIRS := -L $(PHONELIBS)
else
LIBDIRS := -L $(ANDSRCROOT)/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/lib/gcc/arm-eabi/4.2.1 \
-L $(ANDSRCROOT)/$(STATLIBROOT)/libc_intermediates \
-L $(ANDSRCROOT)/$(STATLIBROOT)/libc_common_intermediates
endif
ifeq ($(LINKMODE),dynamic)
CRTBEG := $(ANDSRCROOT)/out/target/product/generic/obj/lib/crtbegin_dynamic.o
LDFLAGS := -rpath /system/lib -rpath-link /system/lib --dynamic-linker /system/bin/linker
EXTLIBS := -lc -ldl
else
CRTBEG := $(ANDSRCROOT)/out/target/product/generic/obj/lib/crtbegin_static.o
LDFLAGS := -static
EXTLIBS := -lc -lgcc -lc_common
endif
CRTEND := $(ANDSRCROOT)/out/target/product/generic/obj/lib/crtend_android.o
CFLAGS := -g -Wall
%.o: %.c
$(CC) -c $(INCLUDE) \
$(CFLAGS) $< -o [email protected]
%.s: %.c
$(CC) -S -c $(INCLUDE) \
$(CFLAGS) $< -o [email protected]
all: hello
hello: hello.o
$(LD) $(LDFLAGS) \
-o [email protected] --entry=_start -nostdlib \
$(CRTBEG) \
$^ \
$(CRTEND) \
$(LIBDIRS) $(EXTLIBS)
This makefile has certain assumptions built into it:
(1) Static Linkage
If you are going to link statically, you will need to have already built the entire Android source tree - the Android NDK does not provide any static libraries (In the OP I provided instructions on how to do this download and build the Android "Cupcake" release.)
(2) Dynamic Linking
If you want to compile code which is "as close to the phone as possible" then there is really only one way to do that: compile against the headers that HTC used, and perform linking against the dynamic libraries that you literally pull off the phone ("adb pull /system/lib").
There's only one problem with this strategy: HTC did not release their copy of the bionic (or other library) source code, so you are forced to punt... the second-best choice is to use headers from the Android (Cupcake) source tree. So... you will notice that for both the dynamic-link or static-link cases in the above makefile, the $(INCLUDE) paths used during compilation come from the Android source tree.
bftb0
PS I guess there is a mechanism to configure the top-level "make" of the Android source tree for not only a target type (defaults to "arm"), but also a "machine" dependency. I didn't research that, as I have only built user-space code. I'm doubt there should be any differences at the syscall interface API - excepting perhaps things like ptrace() which have a machine dependency (register structures, etc).
bftb0 said:
Because of the lineage between Linux and Android, the primary platform for compilation of the kernel and other ARM instruction-set binaries ("native" code) has been on Linux. It appears (at the moment...reading between the lines) that Google engineers are using Ubuntu 8.04 LTS as their choice of Linux platform for maintaining Android kernel & utilities code... so, in principle, it is the "best supported" platform for doing "native" development work, if for no other reason than it's what Google has been using. (Not because it is somehow a "better" O/S, but rather because you are likely to run into fewer quirks, and have more resources on the internet who might have experienced the same difficulties that you run into.)
For instance, the folks that have been building kernel exploit programs have been using the Google "NDK". They are not writing/compiling those in Java - they are writing or compiling programs written in "C", and compiling them into native (ARM) object code.
I provided notes from my own installation for anyone considering "dipping their toe" into building Android kernels or native binaries using Linux as a host O/S - most forum readers are not going to be interested in doing that.
Note that Google now releases an NDK for Windows, Linux, and Mac OS/X. The strange thing about doing development on Windows using Cygwin is that if you have sufficient skills to do so - and are capable of resolving problems that inevitably crop up - then you probably already have sufficient skills to be using Unix/Linux in the first place. Sort of depends on your past experience, though. I'd be willing to bet that Devs with a history of doing WinMo development probably would prefer to climb the Android development learning curve by trying their hand with the Windows/Cygwin NDK because of their familiarity with other Windows-based development tools (IDEs, hex editors, assemblers, GUI generators, etc).
That reminds me though - I need to update this thread with something else.
Cheers
bftb0
Click to expand...
Click to collapse
Wow, i was a little off in this case. I was under the assumption y'all were somehow going to compile ubuntu to run on the eris. :O

[Tools] Android SDK API 9 / Ubuntu 8.04 -> 10.04

The newest Android SDK API (v9 - Android 2.3) for linux seems to require glibc 2.11. I didn't know that, and blithely installed it last night from within eclipse - on my Ubuntu 8.04 LTS VM - and then found out that the emulator would no longer work correctly because of the glibc requirement.
So, I took the plunge and decided to do an online upgrade of Ubuntu 8.04 -> 10.04. Sort of wanted to see what Ubuntu 10 looked like anyway. Normally I am not a big fan of major upgrades (as opposed to clean installs), but it succeeded well enough. Here's some notes from that process.
I'm using VirtualBox (3.6.12) with a Win7 x64 (i5-750, has VT) host, and the Ubuntu VM is an x32 guest.
- First, I cloned off the VirtualBox disk for the Ubuntu machine:
Code:
VboxManage clonehd Ubuntu-8.04-LTS.vdi Ubuntu-10.04.vdi --format VDI
that way, if disaster struck, I would still have the old VM available - my .VDI is about 32 GB. (I think that you can not simply copy a .VDI because the "VboxManager clonehd" modifies a "UID" VM disk identifier label when you clone, and if you don't do this, it will cause problems with VirtualBox, possibly even screw up the other (saved) VM Hard Drive file)
- Second, you go in to Virtualbox's media manager (File -> Virtual Media Manager), and let VirtualBox know that the .VDI you just created on the command line is available as a VM Hard Drive. Next, click on the "New" (VM) wizard, and create a new VM - the only thing you need to get right in this step is that rather than create a new VM hard drive, you just pick the newly-created .VDI to be your hard drive.
Don't start the VM yet.
- Third, make very careful notes about the existing settings for the current Ubuntu VM, and then select the new (Ubuntu 10.04) VM, and update all the settings ("Settings" icon) to match - after all, when you are initially booting it, it will still be 8.04, and will expect to see the exact hardware that it previously saw. You can probably get away with a few things changing (e.g. main memory size), but to avoid hassles, I was very careful - even copying the same MAC address (Network -> Adapter 1 -> Advanced) to the new machine definition. (OT, I don't know why VB doesn't just have a "clone the whole damn machine menu item, but that's a rant for another day). After you are sure everything matches, fire up the new VM - it will be running an exact copy of the old (8.04) VM.
- 4th: After logging in, System -> Administration -> Update Manager. The update spent about 45 minutes downloading files (3.6 Mbits/sec, about 1.1 GB total), and then the update processes took another 45 minutes or so. You don't need to hover over it all the time, but you might want to check on it every once in a while - in my case it stopped once to let me know it was obsoleting some packages as part of the upgrade.
- 5th: When it reboots, the old VirtualBox extensions are still present in the VM, but they do not work since they no longer match the new kernel - so the video will be in "minimal mode". Also, if you had a "vbox" mount in your /etc/fstab, it will not mount - if the system asks you about it during boot, just hit the "S" key for "Skip". You just need to live with this for 10 or 20 minutes while you do the next step - don't worry about fooling with it, as both the video and shared folders will come right back once you get the guest extensions reinstalled. Also, you might find it is impossible for the VM Manager to "mount" the VirtualBox Extensions .iso as a CD-ROM device, so, you do the following:
a) Copy the VBoxGuestAdditions.iso file (30+Mb) from the C:\Program Files\Oracle\VirtualBox folder to someplace where you can get it to the VM. The shared folders will also not be working yet, so you could put it on a browsable network server or a thumb drive; I used the latter, and then did a USB pass-through to the guest VM (VirtualBox VM "Devices -> USB Devices" menu)
b) Do a loopback mount, e.g.
Code:
$ sudo /bin/bash
# mkdir /mnt/VBox
# losetup /dev/loop0 /home/user/foo/VBoxGuestAdditions.iso
# mount -t iso9660 -o ro /dev/loop0 /mnt/VBox
You might need to
Code:
$ sudo apt-get install dkms
as the VirtualBox installer needs the dkms package to install - I did.
Then
Code:
# cd /mnt/VBox
# sh VBoxLinuxAdditions-x86.run (or the AMD equivalent if you have AMD uP)
# cd /
# umount /mnt/VBox
# losetup -d /dev/loop0
# rmdir /mnt/VBox
At this point you should reboot the VM. If everything went OK, the VirtualBox guest additions will be active, and you will have decent video and the shared folders will be available. I had a minor problem where I could write to the (host) shared folders no problem, but all files were then owned by root, and that made Firefox unhappy when DL'ing directly to the shared folders. So, I unmounted it (as root), , added uid=,gid= options to my /etc/fstab entry which corresponded to the regular user login (1000/1000), and then remounted it (as root).
/etc/fstab entry:
Code:
VM_ubuntu /home/user/VM_shared vboxsf rw,uid=1000,gid=1000 0 0
("VM_ubuntu" is the "Folder Name" I shared the host folder with in the VirtualBox Host app window)
Sixth, the last thing is Java - I had used either "apt" or the Synaptic Package manager to add JSE 5 to Ubuntu 8.04, and that was invalidated and uninstalled during the upgrade, so I needed to to go and manually get a JDK directly from Sun/Oracle. It's a bit difficult to find, as JSE 6 is now the shipping release. 1 year ago, the Android SDK did not work correctly with JSE 6 (frankly, I don't know if it is an eclipse issue or the Android SDK), which necessitated installing JSE 5. That may have changed (I got lazy and didn't research it - just installed JSE 5) but if it hasn't, here's the "older versions" download page at Oracle:
http://www.oracle.com/technetwork/java/javase/downloads/previous-jsp-138793.html
You might need to fix up PATH, or CLASSPATH environment variables from your prior settings if you install the JSE to a new location.
Success! The Emulator works again!
Finally, if you read this far, here is the good news: I don't know why, but the Ubuntu 10.04 desktop seems WAY SNAPPIER than the old (Hardy Heron) 8.04 default desktop. This seems very hard to believe, as I am using exactly the same VM host and guest extensions, but it makes 8.04 look very sluggish by comparison. Seems hard to believe that a new X11 server. or libraries, or even a new kernel would do that - maybe the old (gnome-based?) window manager was a POS? Dunno - but I think you will like Ubuntu 10.04
cheers,
bftb0
Another very nice post....
Conap said:
Another very nice post....
Click to expand...
Click to collapse
I really wish I could understand 98% of what bftbo posts.

[APP] php 5.4.2 + lighttpd 1.4.29 in FCGI mode, crosscompiled for ARM

Update 7 May 2012: New version released, containing PHP 5.4.2 with curl / openssl modules built in (still for armv5). Besides the version number, installation steps remain the same.
Introduction
The web page of the project, containing more information, licenses, configuration fils, list of modules for php and lighttpd, etc is here:
http://hex.ro/wp/blog/php-and-lighttpd-for-android/
It also contains and example, how to install SMF forum onto the phone
Download
This comes with NO WARRANTY. Use it at your own risk!
php-5.4.2_lighttpd_1.4.29_armv5.tar.gz
php-5.3.8_lighttpd_1.4.29_armv5.tar.gz
Installing
After you copy the archive above into the root of your SD Card, installation is easy:
Code:
cd /
tar xf /sdcard/php-5.3.8_lighttpd_1.4.29_armv5.tar.gz
reload-fcgi.sh
reload-lighttpd.sh
Make sure you are on the root file system (/) before executing tar command.
Also, mandatory: rooted phone + busybox + /system partition mounted read only.
Below information is older - which was before the bundle was ready
Coming soon:
(excerpt from phpinfo() now running on my phone)
PHP:
System Linux localhost 2.6.32.9-perf #1 PREEMPT Fri Jul 8 13:45:08 2011 armv7l
Build Date Aug 30 2011 22:07:32
...
PHP Version 5.3.8
...
Server API CGI/FastCGI
Virtual Directory Support disabled
Configuration File (php.ini) Path /system/etc/php
Loaded Configuration File /system/etc/php/php.ini
...
_SERVER["_"] /system/bin/php
_SERVER["FCGI_ROLE"] RESPONDER
_SERVER["SERVER_SOFTWARE"] lighttpd/1.4.29
_SERVER["SERVER_NAME"] 192.168.1.3
_SERVER["GATEWAY_INTERFACE"] CGI/1.1
I have managed to compile lighttp 1.4.29 with fcgi support as well as php 5.3.8 (both latest version).
All graphics libraries are in as well as SQLite.
I will still have to play with OpenSSL to get it running. Maybe MySQL in the future
It will take a while to set everything up (a web page for source code, wiki on how to install), but we're close to have a fuller Linux experience on Android powered phones.
This would be amazing, I've been hoping for something like this.
wow, I'm really looking forward this
It's cool to have this functionality, cuz sharing files via BT is a pain the ass
I'm waiting too. And wish you luck. Thanks for the efforts.
Thank you for the kind words
Yes, everything works now, and I've tried out a PHP gallery as well as PHP file editor (so you can edit .php files within Opera connected to local host).
It works. Unfortunately, on my Arc, it takes about 3 seconds to generate a thumbnail of a camera image. Now I understand why the whole thing with Media Server indexing files first time after reboot, when phone is slow and etc .. and why the need that apps have to notify Media Server to index additional files when apps create them. So by the time user gets to open the gallery, their thumbnails are already there (it masks the delay).
I want to try out more scripts and then create an installer for the whole thing. If members here report it works, then I will upload it to the market.
I think I will try a bunch of forum engines.
How many additional modules will there be? ImageMagik is really useful… or at least GD
EDIT: ohh, didn't see OP says all graphic libraries included (^_^; )
viulian said:
Thank you for the kind words
Click to expand...
Click to collapse
We should thank you for your efforts. And we are.
viulian said:
I want to try out more scripts and then create an installer for the whole thing. If members here report it works, then I will upload it to the market.
Click to expand...
Click to collapse
You can count on me. I'm not a full time PHP developer, but I wrote few little "systems" in "my way" so it should test non-standard approach at least. but I believe you've already tested basic PHP behaviour
By the way - you mentioned something about mysql... I would personally prefer PostgreSQL, but I do not know anything about a way it's written so theoretically it can be harder to move to arm platform. Postgres is more flexible in many ways, and sometimes (I've heard) a way faster because of simplicity of mysql.
But if anything will be problematic with sql, I can always fall back to sqlite
Update:
libcurl won't be bundled (PHP will be compiled without --with-curl argument).
It seems that libcurl has a dependency on libc - and it tries to load libc.so causing php executable to crash.
Output from strace:
Code:
open("/system/lib/libc.so", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=273912, ...}) = 0
close(3) = 0
--- {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0xfde0004} (Segmentation fault) ---
+++ killed by SIGSEGV +++
Segmentation fault
that's really sad. cURL is sooo cool. (´Д`)
but so far you always found a way to make things work and I hope the same will apply to this as well.
If you have an idea that would work, then will this released later? or you let us play with the cURL-less boundle?
I won't mind lacking of cURL. We have wget onboard for simple downloads. For more sophisticated actions android isn't the best platform
Here's the info.php generated using lighttpd / php statically built for Android:
info.php.zip
I've been on a trip with limited access to internet, and so far I managed to find a fix for lighttpd which, when statically built, would not load the modules in the correct order. It was a mess to use I've documented it here: http://redmine.lighttpd.net/issues/2343
ImageMagick is not ported yet (just standard gd as you will see). I'm tempted to port ImageMagick also, since it seems that batch operations are faster with it than with the built in gd (and on my Arc, generating the thumbnail of a camera taken photo takes about 3 seconds, which is slow).
So far I've tested fotogallery and monoedit (to edit php files on the phone using any browser) and they work fine.
Please expect updates soon.
I've just managed to cross-compile ImageMagick for Android, and it takes mogrify about 4.2 seconds (on my Arc) to create a 120x90 px thumbnail for a 1.8Mb photo from the camera.
Code:
[[email protected]]/sdcard/DCIM/100ANDRO# time mogrify -path thumbs -thumbnail 120x90 DSC_0172.jpg
real 0m4.176s
user 0m3.950s
sys 0m0.130s
Also, each executable has about 5.3Mb when statically linked (convert, mogrify, etc...) which makes the ImageMagick bundle to around 57Mb in total (which is huge).
Thus, no ImageMagick for now waiting for better hardware.
When will you release any alpha to allow us killing it?
I'm working on a web page on my blog where I'll present everything - and will post an update here. If not later tonight, then tomorrow I'll release it.
For now it is compiled for armv5 CPUs (meaning it will work on many phones, even older and slower ones). I've tested it on a Sony X10 Mini (MSM7227, 600Mhz, ArmV5) and Sony Arc (MSM8255, 1Ghz, ArmV7) and works a treat!
Also installed SMF (Simple Machines Forum with sqlite) and it works.
Great . I'll try it as soon as you publish it
krzych said:
Great . I'll try it as soon as you publish it
Click to expand...
Click to collapse
Please check first post and let me know! I've just released it.
i think max request size is too small
it will make 413 error when try to attach file
default value is 2Gb but i think viulian set too small value (even i can't attache 250kb jpg )
if someone want to increase it
add this lines on your lighttpd.conf
server.max-request-size=10240
server.network-backend=”writev”
server.upload-dirs=( “/sddata/www/tmp” )
size=kb
dirs=must same as upload_tmp_dir on your php.ini
there are my config files
Thank you for the updates
Both php and lighttpd come with the default values - I did not change anything ... (in an attept to offer as much as possible the Linux experience with them, when you have to reconfigure things).
The only change I did was to set the temp folder for php to /data/local/tmp (although your suggestion to use the /sdcard might work out better in case of a lot of uploads since the /data space is limited compared to /sdcard).
i also think sdcard is better but /sdcard can't save permission and ownner
it's big secure hole
i think sd-ext is best
i compile the execwrap
using by gcc for android (you can download from here (you can extract from main files from https://market.android.com/details?id=com.n0n3m4.gcc4droid&feature=more_from_developer)
you can find documents about execwrap from lighty's site

[SCRIPTSET v2.6][02/28/2012] Build native GNU/Linux applications: the easy way

New: SANE (USB Scanner backend and drivers) - OTG equipped device needed to work for this - YES, Scanner Access Now possible and Easy with your phone
This can (in combination with tesseract-ocr) be very useful to recognize text from scanned images.
For pictures see also http://forum.xda-developers.com/showpost.php?p=23046120&postcount=187
Update 01/30/2012: Now with a small android app (ScriptStarter) to start services and other shell scripts easily from the GUI. See bottom of the post.
WHAT'S POSSIBLE WITH THIS SCRIPT:
With this bash script your are able to build relatively easy from source a lot of native software (over 90 at the moment) from the GNU/Linux community for your Android phone and you will have
the good experience with free software.
All these tools and programs are not "apps for the GUI" for Android but native running command line tools "under the surface" of your Android GUI like the kernel and other services.
Don't ask me if it makes any sense to install program xy (like MySQL) on a phone. This is your decision. It's possible, so try it and see what you can do with it.
Note: I tested most of the compiled software on a Samsung Galaxy S2 (my phone). I cannot test it on a variety of phones because I have no mobile phone shop...
Currently buildable with this scripts (abstract, see the full list in package_selection.conf):
PHP 5.3.10 (with almost all extensions and XCache)
MySQL 5.5.19 (if you want a full database server on your phone...)
lighttpd 1.4.30
OpenSSH 5.9p1
OpenSSL 1.0.0f
Samba 3.6.3
cURL 7.23.1
bash 4.2
BusyBox 1.19.3
ImageMagick 6.7.4-10
OpenVPN 2.2.2
Python 2.7.2
Node.js 0.6.7
git 1.7.9
Wget 1.13.4
Rsync 3.0.9
TCPDUMP 4.2.0
Midnight Commander 4.8.1
Pure-FTPd 1.0.35
screen 4.0.3
iptables 1.4.10 (without bionic bug "getnetbyaddr()" and with iptables-save/restore!)
BIND 9.8.1-P1
Lua 5.2.0
Ruby 1.9.3-p0
usbutils 004
MTDUtils latest git
GCC 4.6.2 (c, c++)
GNU Coreutils 8.14, Binutils 2.22, Findutils 4.4.2, Inetutils 1.8
QEMU 0.15.1
SANE 1.0.22
tesseract-ocr 3.01
...
a lot of libraries, development tools and other useful programs
...
FEATURES:
automatic download and untar the cross-compilers (if not already done) for cross compiling
automatic download and untar the source packages (if not already done), that you have selected
solve dependences and reserves additional needed packages
apply patches to the sources if necessary
build them, "install" them in a folder for later "ready to transfer" to your phone and stripes the binaries and libraries to reduce the filesize if selected
autogenerate a tar file and adb push the file to device if selected
allows you to use well-known software like PHP, MySQL, OpenSSL, OpenSSH, OpenVPN, bash and lighttpd on your phone (see the full list in file package_selection.conf, see attachement)
scripting and development on your phone
no limits with BusyBox (without want to be derogative, BusyBox is a wonderful tool), full featured tools like Coreutils, Binutils etc.
build scripts are expandable with other or newer packages you eventual want to have
QUESTIONS AND ANSWERS:
Q: Do I need native GNU/Linux programs and what is that?
A: If you do not know what native Linux applications are, then stop here - you don't need them.
Q: What can I do with these tools?
A: Many things. As a developer you can use the libraries to include them in Android GUI apps, as user you can start for example a webserver on your phone and write some HTML or PHP pages
just for fun or replace BusyBox with full featured tools (or only some commands).
Some tools are also very useful to find network errors, check the network traffic and many more.
Q: What do I need?
A: A Linux installation (VM or real), some Linux knowledge and a little bit time to read all instructions carefully. A rooted Android device with enouth free memory (ext2/3/4 formatted)
See README for details.
Q: Costs?
A: Nothing. The scripts are Open Source (GPL v3), the packages are GPL licensed or under a similar license. The cross-compilers are Open Source or free to use for non-profit purposes.
But I would be pleased if I get a donation and/or a press on the "Thanks button", if the scripts are useful for you. It was a long and hard work...
Note: The attachement scriptset-x.yy.zip is double packed (inside .bz2), because I want preserve the right settings of the scripts.
STEPS:
Selected the desired packages in the config file
Adjust the compiler settings for your phone
Run the build script to download and compile the software
Copy the generated TAR files to your phone or let "adb" this do for you and unpack them in the prepared sysroot folder
For more information please read the instructions in "README"
Please let me also know if you have any problems or if you have questions or further suggestions.
Thanks go to the Open Source community and a lot of people/webpages with hints about cross-compiling software.
Thanks
smitna
CHANGELOG:
01/14/2012 First public release v0.9
01/14/2012 Update: Removed unneeded big patch for ncurses
01/15/2012 Release of v1.0
Update: Fixed build of gcc. Note: the header files are not copied automatically with the script.
If you want to compile on your phone, set TAR_HEADERS=1 in configuraton.conf
Typos: some translations corrected in build.sh
01/16/2012 Release of v1.1
Update: Removed building of fsck from util-linux-ng, it's in e2fsprogs
Update: ISC Cron / vixie cron: set correct paths in pathnames.h before compiling
Enhancement: More detailed explanation of device specific compiler settings with list of possible values
Update: Removed dependence e2fsprogs libs from e2fsprogs
01/17/2012 Release of v1.2
Update: Build of zip, zipcloak, zipnote, zipsplit, unzip, unzipsfx and funzip now possible without errors
01/17/2012 Release of v1.3
Update: Added Node.js
Typos: some translations and language errors corrected in build.sh and README (sorry, I'm not a native English speaker...)
01/18/2012 Release of v1.4
Fixed TMP_PATH in PHP extension XCache (mmap.c) to prevent startup warning
Fixed BusyBox problems with static build against glibc ("__getpagesize" segfault with ping, traceroute and other networking parts)
and added some BusyBox patches.
BusyBox is now dynamic linked, so don't replace the system BusyBox with this build, because of missing mount/paths to libraries at phone startup
01/20/2012 Release of v1.5
Update: Cleanup in scripts and separation of configuration and code. Now it's only necessary to edit configuration.conf and package_selection.conf
Update: Added gzip
Update: Added experimental adb push to device if the device is connected and permissions are ok
Update: Check for installed programs. Script now exists on check failure to minimize errors while compiling.
01/21/2012 Release of v1.6
Bugfix: MySQL build could fail if gen_lex_hash could not generate the file sql/lex_hash.h in pass 2
Update: adb push should now work, check for connected device (and possible multiple devices) and check for right permissions to use the device
Enhancement: Even more explanation of device specific compiler flags and some hints to find the right settings.
01/21/2012 Release of v1.7
Enhancement: To eliminate sure a failing MySQL build, with every new run the source folder will be removed before completely
Enhancement: file version is now strictly checked (the host version must be the same as the cross version)
Some minor changes and filechecks (e.g. autoconf)
01/23/2012 Release of v1.8
Bugfix: Python has SQLite dependencies and SQLite must be ready before Python configure/make
Bugfix: In certain circumstances the optimizer settings get lost
Bugfix: Removed --enable-multibyte from bash, no chance to use it with NDK
01/24/2012 Release of v1.9
Update: Added ngIRCd (Please read the comment for this server, because of running as root)
Update: Sorted the links and package names in the config a little bit...
01/26/2012 Release of v2.0
Bugfix: OpenSSH wants to touch /var/empty while compiling, should be fixed --with-privsep-path now set (thanks to member dateno1 for his reports of such warnings/errors)
Bugfix: Removed a wrong CFLAG -I path from NDK config (only useful for me, really useless for others...)
Enhancement: Example for a user db for Pure-FTPd virtual user database in README (please use virtual users, it's the best and easiest solution)
Update: OpenSSH build need ssh-keygen for the generation of the default keys, added this info to README and the package selection
Bugfix: Not really a bugfix, but some installers don't set the right permissions of libraries in the sysroot folder, so set them global in the final task
Bugfix: Removed --with-lastlog=$TARGET_SYSROOT/var/log/lastlog from OpenSSH and added --with-lastlog=no, I don't know why this is not working and throws a warning, but we can live without it...
Enhancement: Added option to choose the sysroot variant from the CodeSourcery libs: v5TE (default), v4T (old), thumb2 (v7, fastest if supported by the phone)
Enhancement: Added option to tar the headers for development on the device with CodeSourcery (hint: always set rpath in LDFLAGS to make use of the CodeSourcery libs)
01/26/2012 Release of v2.1
Update: Added getcap/setcap and libraries from wishlist, needs libtoolize. Note: This is in a testing stage, kernel and filesystem support needed!
01/30/2012 Added a ScriptStarter app
09/02/2012 Release of v2.2
Update: Local compilation of static "tic" from ncurses for buildhost, if ncurses installation is missing
Enhancement: "downloading only" mode without compiling the packages (and force download)
Enhancement: some parameters for starting the script with additional functions (show with ./build.sh help)
Enhancement: more logging and outputs
Enhancement: language specs, all outputs can be changed to other languages in build.sh
Update: Added dosfstools
Update: Added Ruby
Update: Added example configs and starter scripts for Samba and OpenSSH
Update: Use of http-URLs if possible and update of some broken external links since last release
Bugfix: util-linux-ng needs gettext, added dependence
Bugfix: Added parameter to Samba to solve user/group settings and socket_wrapper support to set path vars at runtime
Update: Changed PHP version to 5.3.10, Samba to 3.6.3 and git to 1.7.9
02/11/2012 internal Release v2.3
Bugfix: openVPN patch for /dev/tun and links to ip/netstat/ifconfig/route, see hints for symlinks
02/16/2012 internal Release v2.4
02/25/2012 Release of v2.5
Update: Added LAME
Update: Added experimental CUPS
Update: Changed PNG version to 1.5.9
Update: Added Net-SNMP
Update: Added Netpbm
Update: Added PNG 1.2.47 for Netpbm and phpSANE
Update: Added LibTIFF
Update: Added SANE (USB Scanner backend and drivers) - OTG equipped device needed to work for this - YES, Scanner Access Now possible and Easy with your phone
Update: Split patches for bash (4.1 and 4.2) for better and easier (automatic) inclusion of original patches
02/28/2012 Release of v2.6
Update: Added Cuneiform OCR
Update: Added tesseract-ocr (see hints for more details howto use it)
ScriptStarter
02/03/2012 Added a small ScriptStarter for the GUI. With this app, written with JQuery, PhoneGap and Java (wrapper to execute the shell scripts) it's possible to start for example the lighttpd web server, Pure-FTPd or MySQL from within the Android GUI without a terminal and read the output. If a script needs root access, there is a checkbox to allow this. For this to work, copy the script sush in the script folder. All scripts ending with .sh can be started (please choose after the first start your script folder on the device to add the scripts to the selection, normally your [SYSROOT]/sbin folder).
Three buttons (start, stop and status) are predefined for start-stop-status scripts, there is also a parameter input field for more start values.
Free GPL v3 source code also included (Eclipse project). Please don't expect too much eye-candy. The GUI could be much better, but my CSS skills are very limited...
I added a few example scripts in the zip file, for example a battery stats reader. Before starting these scripts, have a look in the source code to be sure that they are compatible with your device.
Update 0.97 02/03/2012: Now the stderr is also printed in the output window
Update 0.99 02/10/2012: Replaced scrolling api with a much better solution (jScrollPane) for the output window. Not the real Android scroll feeling, but it's usable.
Thanks! I would hit the Thanks button, but I am on my mobile atm.
Sent from MIUI powered phone
Someone tried it? Problems?
Please, I need your feedback...
Sounds interesting, I'll try once I get back home and share feedback here
now i try to all packages for test
i will test on cortex a8 (motolora xt720)
TARGET_MARCH="armv7-a" (not work on armv7 )
TARGET_MTUNE="cortex-a8"
TARGET_MFPU="neon"
TARGET_MFLOAT="softfp"
it make dynamic binarys but i don't want dymanic type (because it difficult to divide one thing and maybe not work on android's libs)
how can i make static type?
ps : oh...it has so many comile error (even can't read or count all)
dateno1 said:
i will test on cortex a8 (motolora xt720)
TARGET_MARCH="armv7-a" (not work on armv7 )
TARGET_MTUNE="cortex-a8"
TARGET_MFPU="neon"
TARGET_MFLOAT="softfp"
it make dynamic binarys but i don't want dymanic type (because it difficult to divide one thing and maybe not work on android's libs)
Click to expand...
Click to collapse
I hope I understand your question. Why not dynamic?
Yes, you have to set the parameters for your mobile phone. For TARGET_MARCH try "armv7", for TARGET_MFLOAT "softfp" and for TARGET_MFPU "vfp" but check this last setting carefully for this phone.
It's very hard to build a full static binary (and sometimes nearly impossible) and it's also hard to build against bionic (with NDK). I had no good experience with it . A lot of compiler runs wasn't sucessful. Edit: I also had for example massive problems with openssl. I couldn't find a way to build it with NDK or static and then build other programs like cURL with openssl support.
Static binaries are also too big and not necessary. For this we have a sysroot environment to be independent from bionic and without the restrictions. The compiled libs and binaries are linked to the CodeSourcery glibc and have set the custom "rpath" for the dynamic loader. That's no problem I think.
that's simple
if someone want to make some binary for all version of android (even same cpu) it will not work well (defend on basic lib(ex : libc) is ok but complex things will not work)
i know make static type binary is very difficult but it valable
dateno1 said:
that's simple
if someone want to make some binary for all version of android (even same cpu) it will not work well (defend on basic lib(ex : libc) is ok but complex things will not work)
i know make static type binary is very difficult but it valable
Click to expand...
Click to collapse
You are right, if you want to build a "portable" binary, you have to set very safe settings, like TARGET_MARCH="armv5", the full list is in the "README". But it's not my main target to offer a solution that is easy portable to other phones, instead you can build the software with optimizations for your phone to "get the best" for it
smitna said:
You are right, if you want to build a "portable" binary, you have to set very safe settings, like TARGET_MARCH="armv5", the full list is in the "README". But it's not my main target to offer a solution that is easy portable to other phones, instead you can build the software with optimizations for your phone to "get the best" for it
Click to expand...
Click to collapse
just i want to add some more function on the phone
thanks for patch files
I want to try this, to install some apps(most interested fro mc), but I don' t wanna change my sd card.
Can I use phone' s /data partition as mysysroot directory? I have 1.5GB space available on data partition, it is 2GB all.
And If yes, I must create the dir: /data/mysyroot? And where to create this dir on pc? On root directory of my linux system?
dancer_69 said:
I want to try this, to install some apps(most interested fro mc), but I don' t wanna change my sd card.
Can I use phone' s /data partition as mysysroot directory? I have 1.5GB space available on data partition, it is 2GB all.
And If yes, I must create the dir: /data/mysyroot? And where to create this dir on pc? On root directory of my linux system?
Click to expand...
Click to collapse
You can use the /data partition. Just create a new folder, for example /data/sysroot. On your PC you have to create the same temporary with full user rights. This is not your working dir for building. Create a new dir in /home/user and unpack the files there. In settings insert the /data/sysroot as TARGET_SYSROOT and change the other settings for your phone and choose mc=yes. Then start the ./build.sh
Thanks for your quick answer.
Just to make clear because my english understanding is not in a high level
I must create the /data/sysroot dir under "/"(root directory) on linux pc with superuser rights?
dancer_69 said:
Thanks for your quick answer.
Just to make clear because my english understanding is not in a high level
I must create the /data/sysroot dir under "/"(root directory) on linux pc with superuser rights?
Click to expand...
Click to collapse
Yes, that is right. But this is the only step you need to do as root or better with root rights. After this work as usual as user.
oh it can't make mysql
package selection : mysql only
target directory (prefix) : /sddata/mysql (on sdext on my system)
armv7-a
cortex-a8
neon
softfp
then run ./build.sh 2> error.txt
it is my error messages
http://pastebin.com/g7Yi4bGz
sorry you can see this link only today (my mistake)
this setting can make some binary and lib run on my phone but fail to make gcc or mysql (when i try gcc it just fail to making gcc only (other things were made) )
dateno1 said:
package selection : mysql only
target directory (prefix) : /sddata/mysql (on sdext on my system)
armv7-a
cortex-a8
neon
softfp
then run ./build.sh 2> error.txt
it is my error messages
http://pastebin.com/g7Yi4bGz
sorry you can see this link only today (my mistake)
this setting can make some binary and lib run on my phone but fail to make gcc or mysql (when i try gcc it just fail to making gcc only (other things were made) )
Click to expand...
Click to collapse
Please notice first, that you should not run this script as root!!
Then there is something wrong with the build of the first needed packages:
ZLIB=yes
OPENSSL=yes
CURL=yes
GETTEXT=yes
LIBXML2=yes
READLINE=yes
NCURSES=yes
- The script cannot find the readline sources. Do you have a subfolder readline-6.2 in folder sources in your builddir? Same for the other source folders. The script first downloads the packages to folder packages, extract the tars in folder sources, repeated for all selections.
(look at line 67 in your log: ./build.sh: 1402: cd: Python-2.7.2: No such file or directory)
- You have no "xz", install it first and make sure, that the other necessary packages are installed. MySQL and gcc are "two pass" compilations and this builds generating temporary binaries, runable on your linux pc. So you need all for a successful compilation of such binaries like gcc, make, python etc. on your linux machine. If you are using Ubuntu, then install the "meta-package" build-essential, look in the README.
Do you have the other unpacking tools like gunzip etc. Please install also "bison"
You should do following steps:
1. First select only the necessary packages (see above), all others to no.
2. If zlib, python, readline an the others are cross-compiled (without errors) and the libraries are in ./sysroot/lib, then deselect them (=no) and select mysql=yes and start a second run with ./build.sh
smitna said:
Please notice first, that you should not run this script as root!!
Then there is something wrong with the build of the first needed packages:
ZLIB=yes
OPENSSL=yes
CURL=yes
GETTEXT=yes
LIBXML2=yes
READLINE=yes
NCURSES=yes
- The script cannot find the readline sources. Do you have a subfolder readline-6.2 in folder sources in your builddir? Same for the other source folders. The script first downloads the packages to folder packages, extract the tars in folder sources, repeated for all selections.
(look at line 67 in your log: ./build.sh: 1402: cd: Python-2.7.2: No such file or directory)
- You have no "xz", install it first and make sure, that the other necessary packages are installed. MySQL and gcc are "two pass" compilations and this builds generating temporary binaries, runable on your linux pc. So you need all for a successful compilation of such binaries like gcc, make, python etc. on your linux machine. If you are using Ubuntu, then install the "meta-package" build-essential, look in the README.
Do you have the other unpacking tools like gunzip etc. Please install also "bison"
You should do following steps:
1. First select only the necessary packages (see above), all others to no.
2. If zlib, python, readline an the others are cross-compiled (without errors) and the libraries are in ./sysroot/lib, then deselect them (=no) and select mysql=yes and start a second run with ./build.sh
Click to expand...
Click to collapse
i'm not edit necessary part
ZLIB=yes
OPENSSL=yes
CURL=yes
GETTEXT=yes
LIBXML2=yes
READLINE=yes
NCURSES=yes
i just edit mysql=no => mysql=yes
ok try to install packages and run as not root
dateno1 said:
i'm not edit necessary part
ZLIB=yes
OPENSSL=yes
CURL=yes
GETTEXT=yes
LIBXML2=yes
READLINE=yes
NCURSES=yes
i just edit mysql=no => mysql=yes
ok try to install packages and run as not root
Click to expand...
Click to collapse
Good luck!
If you can wait a little bit:
In a short time I release a new version with better error and program checks and some small bug fixes. With this version it's not longer necessary to edit the build.sh, it's now all in only two separated configuration files (configuration and package selection).
hmm...fail to compile mysql again
with this error
note: the mangling of 'va_list' has changed in GCC 4.4
full error log on http://pastebin.com/jd1Pw9Xw
dateno1 said:
with this error
note: the mangling of 'va_list' has changed in GCC 4.4
full error log on http://pastebin.com/jd1Pw9Xw
Click to expand...
Click to collapse
Hello dateno1,
first: you have *NOT* changed to a user account as promised
The va_list is only a note, not an error, no problem (but ask the MySQL devs why they haven't adapted the code to gcc 4.6.1).
Your Python cross binaries and libraries are not ok (from you broken first build?). Please start from a "fresh state" (delete the folder sources/Python-2.7.2 and sysroot) or start from a total clean state.
Please use the latest 1.5 version of the script because of the xargs warnings at the end
Delete the complete sysroot folder, there are some folders not in place (data and docs). There is a script remove_all_files.sh
Start this script in your buildroot with ./remove_all_files.sh to remove all files and symlinks in subfolder sysroot.
Edit: delete the sysroot folder complete, there are some other missing folders from your first build!
Start again with ./build.sh and activated packages (the "ALWAYS NEEDED" one and MySQL)
smitna said:
Hello dateno1,
first: you have *NOT* changed to a user account as promised
The va_list is only a note, not an error, no problem (but ask the MySQL devs why they haven't adapted the code to gcc 4.6.1).
Your Python cross binaries and libraries are not ok (from you broken first build?). Please start from a "fresh state" (delete the folder sources/Python-2.7.2 and sysroot) or start from a total clean state.
Please use the latest 1.5 version of the script because of the xargs warnings at the end
Delete the complete sysroot folder, there are some folders not in place (data and docs). There is a script remove_all_files.sh
Start this script in your buildroot with ./remove_all_files.sh to remove all files and symlinks in subfolder sysroot.
Edit: delete the sysroot folder complete, there are some other missing folders from your first build!
Start again with ./build.sh and activated packages (the "ALWAYS NEEDED" one and MySQL)
Click to expand...
Click to collapse
make new account (compile.compile) and use su -c "./build.sh" compile
i think it work (compiled file's owner is changed to compile.compile)
now i delete almost files and folders (exclude android-ndk, readline-6.2, toolchains) and retrying...oh failed (attach new log (full) )
'를 위해 할 일이 없습니다' mean 'no job for~'
'오류' mean 'error'

[Guide] Ubuntu 12.04 desktop on N7 2013 with LinuxOnAndroid

Hello,
I'm gonna describe here a method that can bypass the "loop device not found" bug with Android 4.3 and LinuxOnAndroid (also called Complete Linux Installer).
With that method, you will be able to run Ubuntu 12.04. It will not harm your device, since it's only an application and a "mount loop".
This is not from me, I found some loose informations on LoA's forum and just tried it out. Then I wrote this guide when I finally got it working. Credits are at the end of the post.
Informations :
- Any Kernel should work (I use ElementalX 1.4)
- Any ROM should work (I use ParanoidAndroid 3.99)
- Any 4.3 device should work (this has been seen working on Nexus 4 and Nexus 7 flo).
- This trick should work for any GNU/Linux armel distribution, but you'll have to change some things, like "startlxde" command and others. I can't help you for that.​
What do I need ?
- Root access(SuperSu is recommended)
- BusyBox
- a root file explorer (ES File Explorer is recommended)
- Android 4.3 or CustomROM based on 4.3
- A computer running GNU/Linux (Ubuntu is recommended, but this should work with any debian-based distro. LiveUSB should work)
- Internet access (Around 450Mb download is needed, so 3G or 4G is not recommended)
- ... some free time.​
What should I do ?
Step 1 : Install apk on your device
Download and install those 3 applications :
- Complete Linux Installer
- Terminal Emulator
- Android-VNC-viewer​
Step 2 : Prepare the .img ubuntu disk on your computer
- Start Ubuntu on your computer.
- Download the LinuxOnAndroid "ubuntu.img" from Sourceforge (you'll need the 'small' version : 396Mo)
- Create a new folder (anywhere you want, ext4 partition is recommended, so /home/user is good) and call it "loa" (for LinuxOnAndroid)
Code:
[I]Example : [/I]
mkdir /home/yourname/loa
- Extract the ubuntu1204-v4-small.zip in that folder
- Open a terminal and navigate to the directory where the ubuntu.img was extracted :
Code:
cd /home/yourname/loa
- Enter the following commands :
Code:
#Create the needed directories
mkdir ubuntunew ubuntuold
#Create a new empty .img
dd if=/dev/zero of=ubuntunew.img bs=1M count=0 seek=4096
#Format your new .img into ext4 (original is ext2 and bugs with Android 4.3)
mkfs.ext4 -F ubuntunew.img
#Mount the .img into the directories
sudo mount -o loop ubuntu.img ubuntuold
sudo mount -o loop ubuntunew.img ubuntunew
#Copy the content of downloaded ext2.img into created ext4.img (may process during some time)
sudo cp -r ubuntuold/* ubuntunew
#Unmount mounted .img
sudo umount ubuntuold
sudo umount ubuntunew
Step 3 : prepare your device for the new ubuntunew.img
- Copy the ubuntunew.img (4Go) from your computer to your device
- Place the ubuntunew.img in SDCARD/ubuntu/ubuntunew.img (you'll need to create the directory)​
Step 4 : prepare Complete-Linux-Installer for the new ubuntunew.img
- Open "ES File explorer", turn on the "root explorer" option
- Navigate to /data/data/com.zpwebsites.linuxonandroid/files
- Edit bootscript.sh with a text editor :
1) In "Set up loop device and mount image" :
The line :
$bbox mount -t ext2 /dev/block/loop255 $mnt
becomes
$bbox mount -t ext4 /dev/block/loop255 $mnt
2) In "Mount all required partitions" :
add the line :
$bbox mount -o bind /sys/fs/selinux $mnt/selinux
3) In "Unmount all user defined mounts if any" :
add the line :
$bbox umount $mnt/selinux
- Save changes in bootscript.sh​
Step 5 : Use Complete-Linux-Installer to boot ubuntunew.img
- Open "Complete-Linux-Installer
- Go to "Launch" > "Settings" > "Add"
Name : Droidbuntu
Image : /storage/emulated/0/ubuntu/ubuntunew.img
- Choose "Droidbuntu" from the list and "Start Linux"
- Proceed with the installation (terminal starts and ask you a few things) :
Code:
Example values I used on my N7 flo :
- resolution : 1920x1200 (I disabled navbar and statusbar, if you did not, you'll have to try acceptable values)
- run vnc : [B]yes[/B] (important! it will allow you to start the GUI)
- run ssh : no
- password : whatever you want
- You should now be in linux shell (you can tell by the [email protected]:/# in the terminal emulator)
- Enter the command :
Code:
#It will allow you to start the GUI by adding startlxde to the xstartup script
echo startlxde | tee /home/ubuntu/.vnc/xstartup
- Leave the terminal alone (don't close it) and open "androidVNC"
Values to use :
Code:
Nickname : Droidbuntu
Password : ubuntu
Adress : localhost
Port : 5900
Username : root
24-bit color (4 bpp)
Check the local mouse checkbox
- Clic on "Connect"​
You are now in Ubuntu 12.04 LXDE. :highfive:
You may want to change "entrymode" in settings, and use "Touchpad", it's better in my opinion.​
What's next ?
To start Ubuntu later, just open Complete-Linux-Installer and click "Start linux", then once you're in [email protected], open VNC and "connect". Yes, it's that simple.
The command lines need to be entered in terminal emulator, not in lxterm nor any terminal in Ubuntu.​
Credits :
LinuxOnAndroid Team
Canonical and partners
Following LinuxOnAndroid forum users : clb, Isei, RobbH
NOTE : My english surely isn't perfect. If I made any errors, or if you don't understand a step, please tell me.
I can upload an ext4 ubuntu.img (described in step 2), but only if it really is necessary. The image is 4.0 Gigabyte and it will take me a long time to upload this... (My upload internet speed is 40Ko/s so it will take 30 hours to upload, and I'll be glad not to^^)
Awesome guide thank you.
Sent from my HTC Desire HD
Could some one post the image prefered-large one because i do not have ubuntu and it seems complicated for a 'noob like me
bogii4 said:
Could some one post the image prefered-large one because i do not have ubuntu and it seems complicated for a 'noob like me
Click to expand...
Click to collapse
This will not work "as it" with the large image, because you are adding the command startlxde to Ubuntu, which will start LXDE, not Unity.
Do not forget that small image uses LXDE, when large image uses Unity. I don't know which command you should use to start Unity in the xstartup script for VNC.
But, if you want some programs that are inclueded in large-image, you can always use "apt-get install nameofthepackageyouwant" in the terminal-emulator while using Ubuntu. This command will download and install the program. But if you want Unity, I can't help you, maybe some else know...
And, by the way. You don't have Ubuntu on your PC but you want to use it on Android ? That's odd^^
can you verify this works on Flo? it's not clear that you have this on your Nexus
reading the working devices list on linuxonandroid.org, it says "It does not work when going to the mount step since there is a bug in 4.3. It should run perfectly after that is fixed."
have a link or two where someone has successfully installed this on their Nexus 7 (Flo)? or do you have screenshots of it on yours?
Midnight_Rider said:
can you verify this works on Flo? it's not clear that you have this on your Nexus
reading the working devices list on linuxonandroid.org, it says "It does not work when going to the mount step since there is a bug in 4.3. It should run perfectly after that is fixed."
have a link or two where someone has successfully installed this on their Nexus 7 (Flo)? or do you have screenshots of it on yours?
Click to expand...
Click to collapse
It works on flo, I posted here in "Neuxs 7 (2013) > Nexus 7 (2013) General" and the title of this thread is "on N7 2013".
I also explained in the introduction that this is a way to bypass the bug with 'mount loop'.
I also said in the "informations" box that it works with 'flo'
I also gave the credits to users from LinuxOnAndroid forum, who made this possible. There you'll find some testimony of people who were able to run it. You can also check RobbH's post on LinuxOnAndroid thread, here, on XDA.
Sorry, but I think that it's pretty clear haha
Sent from my Nexus 7 using xda app-developers app
sure, ok, seems odd though that you edited your OP after you tell me the info i was looking for was already in the OP
whatever, thanks anyway
Midnight_Rider said:
sure, ok, seems odd though that you edited your OP after you tell me the info i was looking for was already in the OP
whatever, thanks anyway
Click to expand...
Click to collapse
I added this to OP :
Code:
Example :
mkdir /home/yourname/loa
I'm trying to help you and others here, I'm not here to be insulted and called a liar. Thank you.
anyway (workaround) we can boot the 'large image as in Unity the full desktop experience? or do we have to wait for an actual fix ?
Just thought I would pop in and say hi.
Thanks to @Vaykadji and everyone else in LoA land that helped get everything running on 4.3 we are finally sorting the bugs.
A beta version of the app featuring the edits needed in the boot script has been pushed to our beta test group and new ext4 images are being cooked as we speak.
Should not be much longer now and LinuxonAndroid will fully support 4.3
bogii4 said:
anyway (workaround) we can boot the 'large image as in Unity the full desktop experience? or do we have to wait for an actual fix ?
Click to expand...
Click to collapse
as I said : the part in the guide where you add "startlxde" to the xstartup script is only for LXDE (so: small image of Ubuntu only). But if you find the same command for Unity, you will maybe be able to boot with Unity.
Note: Unity and LXDE are both "desktop environment", but different ones. Google it if you don't understand, I can't explain this with my poor English :/
I used this method,but in ubuntu 12.04,it's only X cursor and gray desktop.
in ubuntu 13.04,solved this problem. so we best use ubuntu 13.04.
now I have a problem:in ubuntu,I installed openjdk and run java application .if java application not close and run background.then I press power button to close screen,battery drain very quickly.I saw "android os " always awake.one hour maybe drain 5% battery.
if close the java application battery drain normal.and "android os " no longe awake.
this problem only found in nexus 7 (flo), I have run java application in other android device(like nexus 7 2012,htc evo 4g lte,htc incredible) all of them didn't appear this problem.
some people can test this problem?
and how can I resolved it?
sdwshlsdx said:
I used this method,but in ubuntu 12.04,it's only X cursor and gray desktop.
in ubuntu 13.04,solved this problem. so we best use ubuntu 13.04.
now I have a problem:in ubuntu,I installed openjdk and run java application .if java application not close and run background.then I press power button to close screen,battery drain very quickly.I saw "android os " always awake.one hour maybe drain 5% battery.
if close the java application battery drain normal.and "android os " no longe awake.
this problem only found in nexus 7 (flo), I have run java application in other android device(like nexus 7 2012,htc evo 4g lte,htc incredible) all of them didn't appear this problem.
some people can test this problem?
and how can I resolved it?
Click to expand...
Click to collapse
The X cursor and gray desktop appears when you don't add "startlxde" to you xstartup script. I'll try with 13.04 if I have the time, I couldn't tell right know.
Works well on Ubuntu 13.04 small image (but in 13.04, you don't have to do the "echo startlxde | tee /blablabla" command)
a little off topic but.. i was able to boot Windows XP using Bosch it took 10-15mins to fully boot but it is not usable i expected more mouse seems smooth but clicking - the start menu, open something takes forever :/ worth it?
Vaykadji said:
I added this to OP :
Code:
Example :
mkdir /home/yourname/loa
I'm trying to help you and others here, I'm not here to be insulted and called a liar. Thank you.
Click to expand...
Click to collapse
you're right, did not mean to insinuate anything or insult you, that was not my intent. please accept my apologies
Thank you ! We're good.
Now, since this guide will soon no longer be usefull (with LoA being updated), I'm willing to do some researchs on how to improve Linux ARM experience. Because I noticed that they were plenty of cool things that were not ported (or not officially though).
Some repo's are broken for example. Official repo's (I was planning to install LightSpark, a flash-player fork, but no can do). Maybe this will be more usefull for LinuxOnAndroid user's.
And Touch should be released soon for Nexus products (not including flo, but hopefully it'll come quick).
So, with this, it's not touch screen?
Sent from my Nexus 7 using Tapatalk 4

Categories

Resources