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.
woo, I found this gem on a search and ended up at talk.maemo.org in the n900 section.
oracle released an armv6/armv7 headless 1.6 jre binary set! way back in april, but I hadn't seen it until today.
works in debian squeeze on my armv6 (msm7627) optimus v... it runs, but I haven't put it through its paces yet for any real testing.
I thought someone might enjoy this since for a long time it was really hard to find a jre for arm debian except for icedtea, which isn't as compatible with some things as the oracle release hopefully is.
here is the post including a download link for the jre.
another post by the same user points to an arm-friendly java7 download as well.
thank you Fabry.
official Oracle java jdk now released for ARM Linux!
download page
editbsolete.
since the sun java6 jdk is available for download to arm devices through debian apt-get, but it has a set of binaries which won't work on the armv6, someone enterprising might be able to patch the jre binaries into the jdk for a usable armv6 jdk.
/end edit
edit:
to use the 1.6 jre...
download it from Oracle
copy it to /opt in your armel debian install (or chroot)
untar it there
Code:
cd /opt
tar -xzvf ejre-1_6_0_25-fcs-b06-linux-arm-vfp-eabi-headless-14_apr_2011.tar.gz
ln -s /opt/java/ejre1.6.0_25/bin/java /usr/bin/java
thank you Dak.
after that, you should be able to use java at the command line.
further down in the first linked thread are instructions for linking the jre to fennec, probably adaptable to iceweasel.
edit:
newer JDK!
JDK 8 (with JavaFX) for ARM Early Access
for armv6 hard float applications. Installation instructions for the Raspberry Pi are linked from that page. You have to accept a license agreement.
I know this was quite a long time ago, but you state that sun-java6-jdk is in debian repositories for arm, but I am not finding it.
Is there a download link for sun-java6-jdk on arm?
Hope you see this.
Take care man. And thanks for the great info!
DiehlC said:
I know this was quite a long time ago, but you state that sun-java6-jdk is in debian repositories for arm, but I am not finding it.
Is there a download link for sun-java6-jdk on arm?
Hope you see this.
Take care man. And thanks for the great info!
Click to expand...
Click to collapse
It showed up back then when google searching for the package, but apt-get won't bring it in because of the jre dependency it can't fulfill.
they must've realized and removed it.
It may be possible to get the x86 .deb and repack it with the jre binaries or something... I actually had it installed on some chroot on my android phone to try building the android emulator on-device (which eventually worked, but the dang thing wouldn't boot in qemu.)
I'll dig around and see if I've still got it, but no guarantees.
bigsupersquid said:
It showed up back then when google searching for the package, but apt-get won't bring it in because of the jre dependency it can't fulfill.
they must've realized and removed it.
It may be possible to get the x86 .deb and repack it with the jre binaries or something... I actually had it installed on some chroot on my android phone to try building the android emulator on-device (which eventually worked, but the dang thing wouldn't boot in qemu.)
I'll dig around and see if I've still got it, but no guarantees.
Click to expand...
Click to collapse
I reolize this topic is a bit older but thought it would be worth letting you all know that installing orical's Java is way easier on Android running Linux. I've been at it awile and have a script set up to fully install the soft float version of JDK 7 and am working on a downloader script (it is actually a tall order reliably downloading the source from orical reliably) to incorperate in when debugged. Eventually I'll be testing/writing one for hard float versions too but for now you all can find what has been tested as working with "Debian Kit" from here https://github.com/S0AndS0/Debian-Kit-Mods check the readme for how to modify for your preferred version of Java and enjoy
Update 02272014- the java downloading script I mentioned earlier is now ready for testing; you may use it to download jre or jdk either hard float or soft float (4 options) and the installer script has been updated for soft float jdk version 7u51. I'll be working on making the download script call up the installer scripts today too
Update 03032014- try the "ARM_Linux_Mods" script in the above github; it will step you through the download and installation of Java JDK soft or hard float.
bigsupersquid said:
woo, I found this gem on a search and ended up at talk.maemo.org in the n900 section.
oracle released an armv6/armv7 headless 1.6 jre binary set! way back in april, but I hadn't seen it until today.
works in debian squeeze on my armv6 (msm7627) optimus v... it runs, but I haven't put it through its paces yet for any real testing.
I thought someone might enjoy this since for a long time it was really hard to find a jre for arm debian except for icedtea, which isn't as compatible with some things as the oracle release hopefully is.
here is the post including a download link for the jre.
another post by the same user points to an arm-friendly java7 download as well.
thank you Fabry.
official Oracle java jdk now released for ARM Linux!
download page
editbsolete.
since the sun java6 jdk is available for download to arm devices through debian apt-get, but it has a set of binaries which won't work on the armv6, someone enterprising might be able to patch the jre binaries into the jdk for a usable armv6 jdk.
/end edit
edit:
to use the 1.6 jre...
download it from Oracle
copy it to /opt in your armel debian install (or chroot)
untar it there
Code:
cd /opt
tar -xzvf ejre-1_6_0_25-fcs-b06-linux-arm-vfp-eabi-headless-14_apr_2011.tar.gz
ln -s /opt/java/ejre1.6.0_25/bin/java /usr/bin/java
thank you Dak.
after that, you should be able to use java at the command line.
further down in the first linked thread are instructions for linking the jre to fennec, probably adaptable to iceweasel.
edit:
newer JDK!
JDK 8 (with JavaFX) for ARM Early Access
for armv6 hard float applications. Installation instructions for the Raspberry Pi are linked from that page. You have to accept a license agreement.
Click to expand...
Click to collapse
I'm working on AOSP. I copied all extracted tar file to somewhere inside system folder. When I type
Code:
java -version
It says:
Code:
/system/bin/sh: java: No such file or directory
But it exist!
In other side, I typed
Code:
ln -s /system/ejre1.6.0_25/bin/java /usr/bin/java
and it said:
Code:
4 /system/linux_arm_sflt/jre/bin/java 4 /system/bin/java
What should I do now?
UPDATE:
When I run java directly Or symbolink), it says:
Code:
/system/bin/sh: java: can't execute: Permission denied
And when I run it with busybox, it says:
Code:
java: applet not found
UPDATE:
Even when I root my device, I get above errors.
dr_jacky_2005 said:
thank you Dak.
after that, you should be able to use java at the command line.
further down in the first linked thread are instructions for linking the jre to fennec, probably adaptable to iceweasel.
edit:
newer JDK!
JDK 8 (with JavaFX) for ARM Early Access
for armv6 hard float applications. Installation instructions for the Raspberry Pi are linked from that page. You have to accept a license agreement.
I'm working on AOSP. I copied all extracted tar file to somewhere inside system folder. When I type
It says:
But it exist!
In other side, I typed
and it said:
What should I do now?
UPDATE:
When I run java directly Or symbolink), it says:
And when I run it with busybox, it says:
UPDATE:
Even when I root my device, I get above errors.
Click to expand...
Click to collapse
you have to run Java in a Linux chroot.
Android shell can't handle it (system/bin/sh is definitely Android path)
bigsupersquid said:
you have to run Java in a Linux chroot.
Android shell can't handle it (system/bin/sh is definitely Android path)
Click to expand...
Click to collapse
What do you mean by run it in a Linux chroot?
If you means run it after type SU command, I did.
I root my device, then I can use su command in shell.
But if you means something else, please explain more in detail.
Thanks.
dr_jacky_2005 said:
What do you mean by run it in a Linux chroot?
If you means run it after type SU command, I did.
I root my device, then I can use su command in shell.
But if you means something else, please explain more in detail.
Thanks.
Click to expand...
Click to collapse
here's an example of how to use a chroot for Nexus 10
you can also look up lil debi, linuxonandroid, and variations of "chroot (debian, Ubuntu) on Android" with Google, for more information.
bigsupersquid said:
here's an example of how to use a chroot for Nexus 10
you can also look up lil debi, linuxonandroid, and variations of "chroot (debian, Ubuntu) on Android" with Google, for more information.
Click to expand...
Click to collapse
All of these installed a virtual Linux that can access with VNC!
But I want to put java binary and its libraries in my Android source, and compile it; then run my jar file with for wxampel installed terminal amulator.apk, or from PC (adb shell command).
Is that possible?
dr_jacky_2005 said:
All of these installed a virtual Linux that can access with VNC!
But I want to put java binary and its libraries in my Android source, and compile it; then run my jar file with for wxampel installed terminal amulator.apk, or from PC (adb shell command).
Is that possible?
Click to expand...
Click to collapse
probably not. the Java binary relies on Linux libraries, like libc instead of bionic. not seen anything about running Java under Android except for their dalvik java.
bigsupersquid said:
probably not. the Java binary relies on Linux libraries, like libc instead of bionic. not seen anything about running Java under Android except for their dalvik java.
Click to expand...
Click to collapse
Do you mean if I install a buildroot on my device, or pure linux from first (there is no android on my device anymore), then I can use JRE for armv7 and run a jar with GUI?
dr_jacky_2005 said:
Do you mean if I install a buildroot on my device, or pure linux from first (there is no android on my device anymore), then I can use JRE for armv7 and run a jar with GUI?
Click to expand...
Click to collapse
I've not had tons of luck getting Linux to run natively on devices, but if you can do it, yes that should work.
i like enlightenment as gui (e17) for debian on mobile device, if you're going that way.
As the most of you probably know the Gear 2's sources are released by Samsung over here: http://opensource.samsung.com/reception/receptionSub.do?method=sub&sub=F&searchValue=r381
Are there amongst you who already started the development of custom software for this device or who have experience with Tizen's source code?
What I want to know right now:
How do I compile these sources?
Found information:
I found this guide (https://source.tizen.org/documentat...ctions/creating-tizen-images-scratch-one-page) which describes how to compile Tizen from scratch.
[UPDATE: 21/6/14] So we figured out you need a 32 bit Ubuntu install to be able to compile these files.
How can I push the compiled code to the Gear 2?
Found information:
Probably the tools provided with the Tizen SDK have the ability to create a rom package which we can deploy (Am I right here?) to the Smartwatch with Odin (http://forum.xda-developers.com/gal...08-2013-odin-3-09-odin-1-85-versions-t2189539). For the people unfamiliar with flashing watches (like me), here is how you set the watch in download mode: https://www.youtube.com/watch?v=EXT7kr3j2Ac.
Where do I have to start modding these sources to eventually be able to create an open platform for the Gear 2?
All help is appreciated!
Thanks
We probably have to see if we can even flash anything without modifications
CovXX said:
We probably have to see if we can even flash anything without modifications
Click to expand...
Click to collapse
This weekend I'm going to experiment with the source to see if I can compile it. I'll keep ya updated on the progress!
Corstian said:
This weekend I'm going to experiment with the source to see if I can compile it. I'll keep ya updated on the progress!
Click to expand...
Click to collapse
have you made any progress ??? even at emulated level ????
gav-collins1983 said:
have you made any progress ??? even at emulated level ????
Click to expand...
Click to collapse
I was stuck on compiling the source. My Ubuntu installation gives errors which say that it can't execute binary files. Also, on my primary PC I don't have enough free space on my hard disk to install Ubuntu. So after a while other stuff came through and I stopped trying around.
Whatsoever, I still have Gear 2 which is useless to me and you just motivated me to continue the journey
Btw, all help is appreciated
Corstian said:
I was stuck on compiling the source. My Ubuntu installation gives errors which say that it can't execute binary files. Also, on my primary PC I don't have enough free space on my hard disk to install Ubuntu. So after a while other stuff came through and I stopped trying around.
Whatsoever, I still have Gear 2 which is useless to me and you just motivated me to continue the journey
Btw, all help is appreciated
Click to expand...
Click to collapse
I have linux kali set up. On a vm on one of my machines. But I've only just started to learn linux. And my god there is a lot to learn. Once I get my wireless adaptor running in kali. Which I've had a little trouble with. And not a lot of time . I can maybe help. Even if it means installing Ubuntu onto another of my laptops . I just feel a little useless not knowing all the jargon for Linux as yet. Cmd is complicated even with Google help. I have a windows 7 a windows 8 and an Xp machine if it helps
gav83collins said:
I have linux kali set up. On a vm on one of my machines. But I've only just started to learn linux. And my god there is a lot to learn. Once I get my wireless adaptor running in kali. Which I've had a little trouble with. And not a lot of time . I can maybe help. Even if it means installing Ubuntu onto another of my laptops . I just feel a little useless not knowing all the jargon for Linux as yet. Cmd is complicated even with Google help. I have a windows 7 a windows 8 and an Xp machine if it helps
Click to expand...
Click to collapse
Practically the only thing you have to know is how the commands within the terminal works. Also, I can recommend you to already start downloading the source from the Samsung Opensource site (Search for SM-R380) as the download is very slow (1.3 Gb at 40 Kb/s). With the source, a guide is provided which exactly tells you how to compile it. Read this guide very carefully when trying to set up your environment!
Furtheron, once we're able to compile it all we can try to modify the source. I really don't know your coding skills but please notice this isn't a project to learn how to code. But for now, lets try to compile it all.
I'm out camping in the sticks at the moment. But once um home il look into it
ok dude im home, and im downloading, the sm-r380 --- sm r381 source code, i have the standalone sbd, but im gonna need the sdk too i imagine, so il grab that too, now to wait
edit.....
oh i see windows 8 isnt supported, this is my main machine, my win 7, is my wired media centre into my tv/av reciever......
gonna try running in compatibility for win 7 on my win 8 machine, fingers crossed, if not, il create a second linux vm, next to kali, ubuntu of course
gav83collins said:
ok dude im home, and im downloading, the sm-r380 --- sm r381 source code, i have the standalone sbd, but im gonna need the sdk too i imagine, so il grab that too, now to wait
edit.....
oh i see windows 8 isnt supported, this is my main machine, my win 7, is my wired media centre into my tv/av reciever......
gonna try running in compatibility for win 7 on my win 8 machine, fingers crossed, if not, il create a second linux vm, next to kali, ubuntu of course
Click to expand...
Click to collapse
I'd STRONGLY recommend you to run Ubuntu (12.04) for your build environment to prevent unnecessary hassle.
I'm downloading and installing an Ubuntu 12.04 AMD64 build. I guess, and hope, that the errors I got during my first time trying were because I used a x86 build of Ubuntu.
Corstian said:
I'd STRONGLY recommend you to run Ubuntu (12.04) for your build environment to prevent unnecessary hassle.
I'm downloading and installing an Ubuntu 12.04 AMD64 build. I guess, and hope, that the errors I got during my first time trying were because I used a x86 build of Ubuntu.
Click to expand...
Click to collapse
, ive had no errors installing the sdk i just toubleshooted compatibility first, and updating the repos, was pretty straight forward, i too am on an amd 64 bit windows,,,,,,,
what issues have you had, did you try the windows sdk b4 u installed linux
im still waiting on my source to download, after 6 hours waiting we had a power shortage here in western australia, typically my luck, ive restarted
gav83collins said:
, ive had no errors installing the sdk i just toubleshooted compatibility first, and updating the repos, was pretty straight forward, i too am on an amd 64 bit windows,,,,,,,
what issues have you had, did you try the windows sdk b4 u installed linux
im still waiting on my source to download, after 6 hours waiting we had a power shortage here in western australia, typically my luck, ive restarted
Click to expand...
Click to collapse
The problem isn't in installing the Tizen SDK. The problem is in compiling the Tizen source code and the dependencies needed to do this. I have attached the contents of the "HOW_TO_BUILD" file so you can see the steps needed to compile the Tizen source you are currently trying to download.
HOW_TO_BUILD
System requirement (Strongly recommended)
* OS: Ubuntu 12.04 or newer
Installing Development Tools in Ubuntu
* Open the source list by using text editor.
$ sudo vi /etc/apt/sources.list
* Add Tizen tools repository to the source list.
deb http://download.tizen.org/tools/latest-release/Ubuntu_12.04 /
* Resynchronize the package index files from the sources specified in the source list by executing the following command:
$ sudo apt-get update
* Install a development tool by executing the following command:
$ sudo apt-get install gbs
Build root strap setup
* Download build rootstrap and unpack into home directory
$ sudo tar xfz {build rootstrap name} --same-owner
* Change root to the build rootstrap
$ sudo chroot standard-armv7l
* Change account to abuild
$ su abuild
Building a package
* Source packages are in the /home/abuild/rpmbuild/SRPMS
* Build a package with rpmbuild
$ cd /home/abuild/rpmbuild/SRPMS
$ rpmbuild --rebuild {src.rpm name}
* You can find binary rpms in /home/abuild/rpmbuild/RPMS
Install a package
* rpm -ivh {src.rpm name}
* if {src.rpm name} is already installed : rpm -ivh --force {src.rpm name}
Corstian said:
The problem isn't in installing the Tizen SDK. The problem is in compiling the Tizen source code and the dependencies needed to do this. I have attached the "HOW_TO_BUILD" file so you can see the steps needed to compile the Tizen source you are currently trying to download.
HOW_TO_BUILD
System requirement (Strongly recommended)
* OS: Ubuntu 12.04 or newer
Installing Development Tools in Ubuntu
* Open the source list by using text editor.
$ sudo vi /etc/apt/sources.list
* Add Tizen tools repository to the source list.
deb http://download.tizen.org/tools/latest-release/Ubuntu_12.04 /
* Resynchronize the package index files from the sources specified in the source list by executing the following command:
$ sudo apt-get update
* Install a development tool by executing the following command:
$ sudo apt-get install gbs
Build root strap setup
* Download build rootstrap and unpack into home directory
$ sudo tar xfz {build rootstrap name} --same-owner
* Change root to the build rootstrap
$ sudo chroot standard-armv7l
* Change account to abuild
$ su abuild
Building a package
* Source packages are in the /home/abuild/rpmbuild/SRPMS
* Build a package with rpmbuild
$ cd /home/abuild/rpmbuild/SRPMS
$ rpmbuild --rebuild {src.rpm name}
* You can find binary rpms in /home/abuild/rpmbuild/RPMS
Install a package
* rpm -ivh {src.rpm name}
* if {src.rpm name} is already installed : rpm -ivh --force {src.rpm name}
Click to expand...
Click to collapse
thanks, but thats ubuntu, unless absolutley neccessary, i want to use windows 8, i dont think my machine will handle ubuntu with my linux kali on a vm, and all my cloud, n media editing software aswell, il just configure the enviroment variables to make it work..........hows your compiling going
gav83collins said:
thanks, but thats ubuntu, unless absolutley neccessary, i want to use windows 8, i dont think my machine will handle ubuntu with my linux kali on a vm, and all my cloud, n media editing software aswell, il just configure the enviroment variables to make it work..........hows your compiling going
Click to expand...
Click to collapse
Well crap! So I've installed Ubuntu 12.04 AMD64 as VM (Which runs pretty amazing btw) and I still have the same errors. Le me trying to dig deeper into the operating system to find the problem of this all. (I'm also not really into UNIX OS's) Turns out I / we all need a 32 bit operating system to be able to use the binary files.
Running the file xargs command on the xargs file gave this result:
Code:
xargs: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.25, stripped
Whatsoever, I gotta start downloading a 32 bit Ubuntu 12.04 iso.
Corstian said:
Well crap! So I've installed Ubuntu 12.04 AMD64 as VM (Which runs pretty amazing btw) and I still have the same errors. Le me trying to dig deeper into the operating system to find the problem of this all. (I'm also not really into UNIX OS's) Turns out I / we all need a 32 bit operating system to be able to use the binary files.
Running the file xargs command on the xargs file gave this result:
Code:
xargs: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.25, stripped
Whatsoever, I gotta start downloading a 32 bit Ubuntu 12.04 iso.
Click to expand...
Click to collapse
again thats ubuntu, with windows 64 win 8, you can runx86 0n 64 bit, dynamically, and also sys compat to any previous version, if you get errors, change the correct enviroment variable path
you do your way, il try mine, between us, we should get somewhere
i gotta be honest reading up on this app making, standalone, or otherwise, is blowing my mind, im not the brightest spark
gav83collins said:
again thats ubuntu, with windows 64 win 8, you can runx86 0n 64 bit, dynamically, and also sys compat to any previous version, if you get errors, change the correct enviroment variable path
you do your way, il try mine, between us, we should get somewhere
i gotta be honest reading up on this app making, standalone, or otherwise, is blowing my mind, im not the brightest spark
Click to expand...
Click to collapse
So I tried multiple editions of Ubuntu and still no luck in compiling the source. How's it going on Windows?
Corstian said:
So I tried multiple editions of Ubuntu and still no luck in compiling the source. How's it going on Windows?
Click to expand...
Click to collapse
My source download keeps failing. Can you mirror it to a fat er site
Like Google drive . Your own and share the folder to me. Australian Internet is ****. I'm currently dev testing the gear 2 Cam app on the s3 s5 and s5 over multiple android versions and builds 4.1.2, 4.2.2, 4.3, 4.4.x - aosp, Aokp, miui, cyanogen. Slim. Pa etc
When running the command "su abuild", I got the error message "bash: /bin/su: cannot execute binary file".
I use a vm of ubuntu 12.04 64bit.