[ARM] Compilers on ARM Linux - Android Software/Hacking General [Developers Only]

(Forgive shortage of my English)
Hi, I'm a student interested in ARM Architecture and Linux.
Studying ARM Linux, unable of compiling on ARM was too inconvenience (Compilers from apt-get in Ubuntu is available, but it seems it's hard to support newer version. Latest GCC on apt-get is 4.4.3, GNU Make is 3.81)
There may be some way to compile Unix based softwares, Linux Kernel, etc.
Android has strange structure to use external binaries. So I used Ubuntu with chroot. And succeed to compile, this is which i done. (FTP-Korea, running with Pantech VegaRacer)
ftp://210.183.62.238:3721
gcc-4.7.2.zip contains GCC binaries, lib, etc which also able to use in Android.
mpc, mpfr and gmp are necessary libs to compile GCC. I used latest version.
make-3.82.tar is GNU Make which is needed when compiling UNIX softwares.
Files which end with _ARM are binaries or libs compiled on ARM device(my one was SGS3 LTE(E210L, c1lgt))
Now I'm compiling Linaro toolchain, and I need many helps.

Mu ple bang ji we one hwe
Thanks

Related

[Q] Compile bash for droid?

I dont know if this is the proper place for this thread...and I know there is a bash compiled already floating around (which I have) but for the purposes of learning Im trying to create a custom ROM from scratch, building busybox,bash,froyo, etc..
I am trying to comile bash 4.1 from the source code, compiling process is pretty straightforward but im having trouble making it cross compile for ARM
Here is what spits out after I enter "file bash" after compiling.
ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, for GNU/Linux 2.6.15, not stripped
The part I'm missing is how to make it into the proper format which is:
ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.14, stripped
Any suggestions?
also is there a way to make it the default shell upon booting?
There's some toolchain tips here. Don't know if there any use to you.
http://android-tricks.blogspot.com/2009/02/hello-world-c-program-on-using-android.html
Pointed me in the right direction thanks .
heres the the code
I added the path of my arm-2010q1/bin to my .bashrc
then:
Code:
CC=arm-none-linux-gnueabi-gcc ./configure --prefix=/opt/arm_bash/ -host=arm-linux --enable-static-link --without-bash-malloc
conigured what I needed to and it cross compiled successfully after make.
drew408 said:
also is there a way to make it the default shell upon booting?
Click to expand...
Click to collapse
http://forum.xda-developers.com/showthread.php?t=727566

How to install 'gcc' and 'make' so I can compile bash, uname, and *****X?

How do I install gcc and make so i can make all ; make install any package I want? What about ldconfig and dynamic linking tools? At the very least bash should compile since it's basically just character strings and such, no specific libs required.
I believe most people would cross-compile the desired apps on a Linux box.

[Q] Cross compiling C software for my android

Hi,
I've download the Android source with "repo", and it includes cross compiler toolchains for various architectures.
I want to build a package (for now, mtd-utils) for my android phone (a htc hero), but I'm having limited success understanding how to get this working. I was thinking there was something I could do, like change my $PATH and set up some other environment variables, that would use the tools from the toolchain instead of the system default ones, so that the binaries would be built for the phone instead of for my computer. But it certainly doesn't seem to be that easy...
I've reverted to attempting a "Hello world" program, but when I try to compile even that using the included toolchain tools, I run into trouble:
Code:
$ $HOME/src/mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-gcc -static -o hello hello.c
hello.c:1:19: error: stdio.h: No such file or directory
hello.c: In function 'main':
hello.c:5: warning: incompatible implicit declaration of built-in function 'printf'
so I tried a couple of other variants:
Code:
$ $HOME/src/mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-gcc -static -I $HOME/src/mydroid/bionic/libc/include -o hello hello.c
$ $HOME/src/mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-gcc -static -I $HOME/src/mydroid/ndk/build/platforms/android-8/arch-x86/usr/include/ -o hello hello.c
but they both give (different) errors about what other include files are missing when referenced from somewhere.
Is there some "easy" way to android-ify a source tree, so that I can build sources using the cross compiler toolchains? Or should I fetch a different cross compiler toolchain to use, like benno did in his document from 2007? He uses a codesourcery toolchain and builds with that instead (as referenced in other articles here on the subject).
Would much appreciate any shared tips or experiences on how to accomplish this.
The tool chain is fine the problem is non of the include/lib are set up correctly to find the needed version of the includes. Remember the default includes under linux depend on glibc and android only supplies bionic.
Have a look here for more info on setting up bionic:
http://android-dls.com/wiki/index.php?title=Compiling_for_Android
Though if you get the full source for glibc (or precompiled arm binaries) you could compile a dependant program staticly (I think that's what busybox does)
Building for older versions of Android
I was actually able to compile a program manually today, specifically one of the programs in the mtd-utils package. After lots of jumping back and forth, I have found out that the 64 bit version of Ubuntu is what I needed, and also sun-java-1.6, contrary to almost all information I found out there. Then I was able to build AOSP, and then I was able to get "agcc" working, the wrapper that sets environment variables automatically as needed.
So I compiled the app, but it didn't work on my Android. Trying to run it in an adb shell gave approximately this error (from memory):
/bin/sh: ./program: No such file or directory
though the program was there. I didn't use strace, but concluded that this is because of a missing shared library. I have a very recent version of AOSP, while the phone is running Android 2.0 or something like that, so that's a plausable reason why this is happening.
I tried to rebuild the program using "agcc -static ...", but that doesn't work because I don't have the static version of libc after building AOSP, so it just dies with a linker error complaining that it can't find -lc.
So now I need to figure out how to build for old Android version using my checked out version of AOSP, or I need to figure out how to check out an old version of AOSP using repo.
Any tips would be much appreciated.

[Q] Compiling kernel for Desire HD on ARM system (not cross compiled)

Hello. I am trying to compile and boot a Cyanogenmod-7 kernel for the HTC Desire HD. My first attempt was from a Debian chroot running on the phone. I managed to compile the kernel, but was unable to boot it. For testing, I unpacked boot.img, and repacked it with the original files and kernel, and was able to boot that... this confirmed the problem was the kernel, and nothing else. I believe I tried the Kali- and Cyanogenmod-msm7x30 sources.
Realizing that compiling on the phone was impractical, I decided to buy a Trim Slice embedded system (an A9 cpu, 1gb memory, 500gb storage). I also realize that Android kernels are cross compiled, but I preferred native architecture because there are some advantages (regression tests). This Trim Slice runs Ubuntu Natty, with GCC Linaro 4.5.2.
I can not cross compile from my workstation because it is OpenBSD, and does not do such things.
Now, more carefully, I downloaded the Cyangenmod 7 kernel sources, with the same git pull version as the shipped kernel. /proc/config.gz and cyanogen_msm7230_defconfig are identical. I made no changes to the config. I used 'make CROSS_COMPILE='. I compiled mkbootimg natively, and did flash_image on the phone, rebooted, and same thing... the HTC screen for infinity.
So then I built GNU Patch-2.7 statically linked (it's a balance between a complex program and a simple program), and copied it to the phone, and './patch --version' works fine. So my compiler is fine... it is compiling for the correct platform.
What could be going wrong with my kernels? Is my GCC version to blame?.. /proc/version says the phone's kernel was built with gcc-4.4.3.
Is there a boot loader that can turn my phone's usb port into a serial port/console so I can see what is going on?

[Q] Running Ubuntu for Arm, how to cross compile command line programs for Android?

Using Linuxdeploy I installed ubuntu (for arm with hardware floats) on my tablet.
It runs beautifully, and I can install packages with apt-get, or (and I just did it to upgrade bison) compile from source using gcc 4.6 and all the other tools.
BUT, nothing I compile from within linux will run outside of the linux jail. I can copy the files out, but they won't run even if the permissions are set to execute.
"gcc -abi=armeabi" doesn't make any difference.
I guess I can install the same tools that people use to compile for android on x86 machines, but it seems like overkill and maybe breaks the advantage of being able to use standard linux build tools. Is there a different set of libraries to link to? A different linker? Different linker settings? Different gcc options?
Josh

Categories

Resources