[Android Software/Hacking General [Developers Only]] osm0sis:
Set Up A Build Environment On Android

Stumbled upon this yesterday and decided I'd give it a shot on my Nexus 7 '13 to see if I could use some of this horsepower to do some native compiles:

http://kevinboone.net/kbox2.html

[MENTION=4608636]bsmitty83[/MENTION] [MENTION=3685904]ak[/MENTION] [MENTION=4443334]Grarak[/MENTION] [MENTION=2838735]aosp[/MENTION] [MENTION=4179234]trevd[/MENTION]

Here's as far as I got last night and my notes to go with it:

http://kevinboone.net/kbox2_downloads.html

(install bc, dropbear, coreutils, ftp, gawk, gcc 4.7, gcc 4.8, kbox-login, make, nano, Perl, rsync, strace, utelnetd & zsh packages; add kbox script to /system/xbin with the kbox shell command to easily enter the shell from the command line)

http://kevinboone.net/kbox2_diary.html

(copy newer libchfakeroot.so to kbox's /lib; copy newer dropbear to kbox's /bin)

(In kbox's /bin: symlink /bin/awk to /bin/gawk; copy /bin/gcc to /bin/ar and edit the command inside to also be ar since busybox's is feature-poor)

http://danilogiulianelli.blogspot.ca/2012/12/how-to-cross-compile-libiconv-for.html

(copy include/iconv.h and libcharset/include/libcharset.h to /usr/include)

http://gpp256.sytes.net:18080/wiki/?Android/libintl

(same edits as iconv to gettext-tools/gnulib-lib/localcharset.c; copy gettext-runtime/intl/libintl.h to /usr/include)

https://github.com/android/platform_external_openssl

(copy include/openssl/ to /usr/include)

This ends up giving you a decent build environment for compiling simple Linux utility binaries natively on Android. Still lots of compatibility to be worked out in anything more complex, however. The last 3 things were dependencies I was trying to handle to build the git package from source (got way too difficult so I had to stop for fear of aneurysm..), but a lot of utilities use those headers so it will probably be good to have them. ;)

I compiled Android versions of my updated mkbootimg+unpackbootimg so far: https://github.com/osm0sis/mkbootimg :cool:

If anyone has any ideas how to get this build environment completely equipped, let me know. :cowboy:

This is also of some interest though I wasn't able to get Terminal IDE's git port working correctly in kbox, (but kbox provides a better Linux-like build environment):

http://federico-lox.github.io/development/android-and-git-a-version-controlled-love-story.html

Edit: [MENTION=4608636]bsmitty83[/MENTION] Grabbed working git binaries from ZShaolin (mentioned in that article), and put them in kbox's /bin/ - along with the ssh-git script they also mention. Then the git-core templates from Terminal IDE go in /share/. git config works on the ZShaolin binary so set up username / email and template dir.

Ex:

git config --global init.templatedir /share/git-core/templates/
git config --global user.name osm0sis
git config --global user.email osm0sis@fakeemail.com

you might also want:

git config --global core.editor nano
git config --global push.default simple

The only thing you can't set in that is the custom SSH command to go with the SSH generated from the instructions in the article, so edit /etc/profile adding the following somewhere:

# GIT SSH Setup
export GIT_SSH='/bin/ssh-git'

Then you have a working git, the only catch is the Android ones don't have working https support, hence all the SSH shenanigans. So to clone a github repo you have to own it and add your public SSH key. Then the command is, eg.:

git clone git@github.com:osm0sis/mkbootimg

Edit 2: I've uploaded a .tgz of the required git files if anyone wants - to save you from having to manually do that part of the above. From the kbox shell prompt unpack it in the / root with "tar xzvf" then all you'll need to do is generate your own SSH key in ~/.ssh/ :good:

Edit 3: ncurses here; http://credentiality2.blogspot.ca/2010/08/compile-ncurses-for-android.html - curses.h, ncurses_dll.h, unctrl.h to kbox's /usr/include/

Edit 4: Good news, KBox 3 is now out and has its own git builds available with it, so all of this is obsolete and a lot easier now! :)

[ Attachment removed since KBox3 has git included ]