[java][debian][armv6][jre1.6][jdk 7] [jdk 8] - Android Software/Hacking General [Developers Only]

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.

Related

Android SDK 1.5 trouble in Linux

I am a new to using Linux, I just downloaded the SDK 1.5 and I am having some trouble getting the tools to work properly. For example. If I try to open the emulator it will just sit there and do nothing. I cannot get adb to work either. I set it up / the instructions. Any ideas on what I am missing? Thanks
easiest way to fix the adb problem is to move your adb command that is included in the SDK into your /usr/bin or /bin directory. if you have a problem with either of those then type cd ~/<sdk>/tools followed by ./adb the "./" tells the phone to run the command in the current directory, otherwise you could just type the directory to adb to run it i.e. ~/SDK/tools/adb that's all you need. as far as the emulator i have no idea because i have never gotten it up and running properly
How do I add the ADB command to usr/bin?
You can do as followed:
- Run the Terminal
- cd to your sdk/tools directory
- Run these command:
Code:
#./adb kill-server
#./adb devices
If you see your HTC has been remounted, it's done!
sudo mv ~/sdk/tools/adb /usr/bin/adb
tubaking182 said:
sudo mv ~/sdk/tools/adb /usr/bin/adb
Click to expand...
Click to collapse
Got it thanks for your help! I still can't get the emulator to work. Oh well Thanks again
What version of Linux? Are you using 64 Bit? What is the result of typing
Code:
java -version
You created the AVD, right?
What do you get when you type:
Code:
android list avd
stovenator said:
What version of Linux? Are you using 64 Bit? What is the result of typing
Code:
java -version
Ubuntu version 9.04 & 64 Bit
java version "1.6.0_13"
Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
Java HotSpot(TM) Client VM (build 11.3-b02, mixed mode, sharing)
You created the AVD, right?
What do you get when you type:
Code:
android list avd
Click to expand...
Click to collapse
bash: android: command not found
They made a change in 1.5 SDK that you must specifiy the virtual device you want the emulator to run. if you just double click on "emulator", it will print the error to console and exit.
So first cd to the tools directory of the sdk and type android[return]
you will be given the commands that android (the program) will accept. you can also do this for emulator.
Great!! Everything is working well now. Thanks for everyones help!!
How Do I get fastboot working in Ubuntu?
jordanjf86 said:
How Do I get fastboot working in Ubuntu?
Click to expand...
Click to collapse
http://andblogs.net/fastboot/
fastboot is included in the 1.5 sdk, once you get adb working it should start working as well.
billc.cn said:
fastboot is included in the 1.5 sdk, once you get adb working it should start working as well.
Click to expand...
Click to collapse
Actually it doesn't seem to be in the Linux 1.5 SDK; I had to build it. It's in the Windows SDK, though. Kinda weird.
Android SDK 1.5 emulator trouble in windows
hi i m new to xda and to android i m not tech savy
i install sdk 1.5 i try ddms it works good what when i try to lanch emulator nothing happnes and i try by going in command promt im getting this error can any one help me out in this
C:\Documents and Settings\jass>emulator
emulator: ERROR: You did not provide the name of an Android Virtual Device
with the '-avd <name>' option. Read -help-avd for more information.
If you *really* want to *NOT* run an AVD, consider using '-data <file>'
to specify a data partition image file (I hope you know what you're doing).
karan09 said:
hi i m new to xda and to android i m not tech savy
i install sdk 1.5 i try ddms it works good what when i try to lanch emulator nothing happnes and i try by going in command promt im getting this error can any one help me out in this
C:\Documents and Settings\jass>emulator
emulator: ERROR: You did not provide the name of an Android Virtual Device
with the '-avd <name>' option. Read -help-avd for more information.
If you *really* want to *NOT* run an AVD, consider using '-data <file>'
to specify a data partition image file (I hope you know what you're doing).
Click to expand...
Click to collapse
First, this is the wrong thread for such a question. This thread is about SDK issues in Linux, and you're asking about using debugging tools in Windows.
Second, if you say yourself that you are "not tech savvy", then I'm not quite sure why you are wanting to play with the SDK tools. I don't mean this in a derogatory way; I'm just not sure what it is that you're trying to accomplish.
That said, Android dev docs can be found here, and information specifically about the emulator is here.
- Chris

help porting a linux program to the android

hi all
i have created a custom rom for myself because i want to add a linux program: scanmem
i have copied the file in system/xbin
using this guide http://lukasz.szmit.eu/2009/12/making-your-own-rooted-android-rom.html on step6 for su command
the problem is that doesn't work ...
when i open a terminal in my desire and type :
su
scanmem
i receve this message:
scanmem: 1: syntax error: "(" unexpected
any help, suggestion ? scanmem is compiled for i386 32bit
kiokoman said:
any help, suggestion ? scanmem is compiled for i386 32bit
Click to expand...
Click to collapse
There's your problem.
Code:
[email protected]:/tmp$ file busybox
busybox: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.14, stripped
[email protected]:/tmp$
If you don't have the source, time and a cross-compiler, you have a problem It's also Little Endian from memory.
This is the busybox binary I tested in case you want to strip it down: http://benno.id.au/blog/2007/11/14/android-busybox
i found a lot of information with google
http://www.kbrandt.com/2009/06/how-to-cross-compile-the-bash-shell-for-android-15.html
i have the source maybe i can compile for arm
kiokoman said:
i found a lot of information with google
http://www.kbrandt.com/2009/06/how-to-cross-compile-the-bash-shell-for-android-15.html
i have the source maybe i can compile for arm
Click to expand...
Click to collapse
Precisely. You should also check the dependencies (if any) and make sure you cross-compile those too.
jayshah said:
Precisely. You should also check the dependencies (if any) and make sure you cross-compile those too.
Click to expand...
Click to collapse
oh my god
depends on libc6 and readline6, i have to cross-compile half gnu/linux
out of my hand
Shame :/
Why did you need it anyway? Perhaps there is another way for what you want to achieve.
jayshah said:
Shame :/
Why did you need it anyway? Perhaps there is another way for what you want to achieve.
Click to expand...
Click to collapse
i think it was an easy program to port and with a frontend for android I would have used it as the first cheats system like cheat engine for pc
I made this. I compile scanmem fo my android phone (p500) from sourses.
He even gets up and running, but not quite.
Opt for a process (pid command)
It finds regions of memory. But during the search, crashes ". bus Error"
Maybe it's because of the specificity of an android, or due to the fact that I had to change all calls to readline lib, because otherwise the project will not compile.
I will continue to watch and understand ...
Done. Scanmem works fine on my phone.

[R&D] Writing custom Gear 2 roms, starting with the source.

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.

[GUIDE] [BIN] Compile busybox on Linux

About Busybox: busybox.net/about.html
More on Busybox: busybox.net
This is just for anyone who wants to try, and especially those without access to a PC.
:
: --------------- BUILD STEPS --------------
:
Things we'll need besides your phone:
- "Android Terminal Emulator" app
- "Complete Linux Installer" app , I also recommend trying "linux deploy" for more advanced usage
- internet/wifi
- latest "busybox" source
1) We need to get Ubuntu or Debian booted for a sufficient build environment (kali linux works well too). I've used them all on Android but I like the better stocked terminal in the Ubuntu images. I used the app "Complete Linux Installer" which is free and works beautifully, very simple and easy. In the app you want to follow the short instructions to download an Ubuntu image, rename it to ubuntu.img, and place it in a folder named ubuntu in /sdcard. Then hit menu in the app and click the terminal screen icon that says "Launch". An Ubuntu terminal will now open in Android Terminal Emulator. Super quick and easy.
2) Let's download some crucial build environment tools.
Code:
apt-get install -y gcc build-essential libncurses5-dev libpam0g-dev libsepol1-dev libselinux1-dev
--EDIT-(30AUG2014)--
For Selinux compatibility and loginutils, we need to also download a few extra packages. Already included in the code above.
3) Now the cool thing about this chroot Ubuntu environment is that we still have access to the sdcard to transfer files between Android environment and the chroot jail. Extract your downloaded busybox source to your Ubuntu home with something like:
Code:
cd
tar -xf /sdcard/Download/busybox*bz2
cd busybox*
4) Now we can build busybox statically. The first thing we do is generate a Makefile by running "make" with a "defconfig" (default configuration file) Usually you will run "./configure" with other programs, but busybox compiles more like a kernel, so it uses a config which has a huge checklist of options.
(After successfully compiling busybox, we can go back and customize the .config; this entails that for each "CONFIG ..." line we see, we can uncomment it and mark it "y" or "n" to configure some option... This can be more easily done from a terminal busybox menu interface with "make menuconfig". You just need to crank font down to 7 or use telnet/ssh)
Skip "make defconfig" if you use a customized ".config" file such as one I've attached.
Code:
make defconfig
If all goes well, we now have a Makefile and are ready to compile:
Code:
make clean && make LDFLAGS=-static
Let "make" crank out the binary for a couple minutes. The extra variable we set after make is to compile statically. When compiling is complete we'll have a few different busybox binaries at the root of the source directory. We use the one named "busybox" since we're not debugging.
5) Now let's copy it to /system/usr/bin to install for test usage.
Code:
cp ./busybox /android/data/media/0
(Open a new terminal tab to get into Android Environment)
mount -o remount,rw /system
mkdir -p /system/usr/bin
cp -f /sdcard/busybox /system/usr/bin
chmod 0555 /system/usr/bin/busybox
/system/usr/bin/busybox --install -s /system/usr/bin
mount -o remount,ro /system
PATH+=:/system/usr/bin
.. and done. Run some scripts and enjoy your static busybox!
:
: Extra steps for SELinux-enabled busybox
:
Here are the extra steps you need to take to compile busybox with SELinux features. Sorry it took so long to get this added to this first post.
First we need to download the source for libselinux and libsepol and compile it. (This is for use with the standard glibc toolchain.)
Code:
cd
apt-get source libselinux libsepol
cd libselinux*
make
cd
cd libsepol*
make
Now that we have those libraries compiled, we can proceed to the busybox compilation.
Code:
cd
cd busybox*
make clean && make LDFLAGS='-static -L ../libselinux*/src -L ../libsepol*/src' CFLAGS='-Os -I ../libselinux*/include -I ../libsepol*/include'
That's pretty much it. It initially seems more complicated than it actually is, but all we're really doing is including the libraries for libselinux and libsepol into the busybox compilation.
edit:
**Commands to run if you have compile errors:
Code:
apt-get build-dep busybox
apt-get install -y build-essential
apt-get -f update
dpkg --configure -a
:
: --------------- DOWNLOADS --------------
:
***** Attached are flash installers for busybox (v1.23.1 stable, non-SELinux, 374 applets included!, ~1.1MB size) or busybox (v1.23.1 stable, SELinux, 386 applets included!, ~1.6MB size) *****
Since it's up-to-date it has some nice extras most people haven't seen like a "-I" option for xargs! Yes, that is correct, busybox xargs has its testicles back.
Code:
e.g.
$ echo Hello | xargs -I{} echo {} world!
> Hello world!
: ---------- UPDATES ----------
-------------------EDIT-2-(30AUG2014)----------------------
Got a Selinux-enabled busybox attached now. This means Selinux flags are integrated into applets like ls, id, ps, etc, and there are now 12 extra Selinux applets to give a total of 386 applets, ~1.6MB in size. The previous one is more portable, but this one can completely replace toolbox and gives you Selinux control for Android 4.4+. Plus it's pure maxed-out awesomeness.
***I've also attached the .config files for each busybox I've compiled, so anybody can remake them (from their phone!) as I've posted. You just need to download and extract the .config file to the root of your busybox source directory and type "make".***
-------------------EDIT-3----------------------
YashdSaraf has made some very useful flash zips to install either the non-selinux- or selinux-enabled busybox 1.23.1 via recovery. Installation replaces the stock busybox in /system/xbin. I've attached the zips he made to the end of this OP.
(**Note: Thought I'd mention that there will be a handful of applets that don't work in "Android" environment such as su(don't worry this isn't linked with the installer) Part of this is because of the way Android's default file structure is an amputated modified version of linux. With almost all of them, slight modifications to environment and file structure can be made to get them to work. This is just normal behaviour of busybox in android. The su and init applets shouldn't be used in Android though. I keep them compiled into the binary anyway for completeness of the build and because they work and are needed for a root.gz initrd or some chroot environments. It also doesn't hurt keeping them compiled in. You just have to remember not to link them when installing busybox.
-------------------EDIT-4-(06SEPT2014)----------------------
:
: How to compile against(using) uclibc for a smaller binary!!
:
Download the attached arm-linux-uclibcgnueabi toolchain package that I pre-compiled. Extract to /data/media:
Code:
cd /data/media
zip='/sdcard/Download/2014-09-06__arm-buildroot-linux-uclibcgnueabi.tar.lz.zip'
unzip -op "$zip" | lzip -d | tar -xf -
Then let's open up the "Complete Linux Installer" or "Linux Deploy" terminal.
To use the toolchain with a busybox build, we just need to specify the parameter CROSS_COMPILE which is a prefix to the compiler tools. So if you extracted the toolchain to /data/media, you will use:
Code:
make clean && make LDFLAGS=-static CROSS_COMPILE=/android/data/media/arm-buildroot-linux-uclibcgnueabi/bin/arm-buildroot-linux-uclibcgnueabi-
When you're done you should have a busybox binary with 374 functions with size around 1.1MB. That's a 20% decrease in size from using the standard glibc toolchain!
**IMPORTANT Notes
- The toolchain can't be used with lollipop since it's not compiled with -fPIC. I'll fix this later. Busybox is fine since it's static, it's just the toolchain I uploaded.
- Selinux-enabled busybox .config errors out when building using the uclibc toolchain; I think this is a lack of support issue. In the "Complete Linux Installer" app you'll need to add the mount "/data/media" in options. This gives you access to it as "/android/data/media", very very useful for extra space needs.
Difference between SELinux and non-SELinux busybox
The SELinux (NSA security enhanced Linux) binary comes with the following extra utilities: chcon, getenforce, getsebool, load_policy, matchpathcon, restorecon, runcon, selinuxenabled, setenforce, setfiles, setsebool, and sestatus. There are also some selinux flags enabled for applets such as "ps" and "ls", e.g. "ps -Z" and "ls -Z" to show the context for processes or files. If you are using Android 4.3 or newer, then you probably want to use the SELinux-enabled busybox since Android 4.3 is when SELinux was introduced to Android. Using the SELinux busybox on older version of Android without SELinux file structure should probably work besides the SELinux applets, but I haven't tested this. The non-SELinux binary can be used on any version of Android. When it comes down to it, the system actually uses "/system/bin/toolbox" SELinux applets for SELinux operations, so unless you specifically want to use busybox's SELinux tools for personal use, the safest option is to go with the non-SELinux busybox. I use Android 4.3.1 and 5.x, so I use busybox's better featured SELinux tools.
Latest updates see post 2
Busybox 1.23.1 (2015-02-06) below
Busybox compilation on Linux
reserved
Great Info here!
But I would be interested to know how well this method works on Samsung Stock devices running AOS 4.2 and above? Any experience?
Awesome info, this thread came up #1 while googling busybox 1.23
I made a flashable zip of the attached binary in the op to clean the old one(if any) and install the new busybox in xbin, just in case if anyone needs it. :good:
Is it work on xperia sp on 4.3 fw yes ?
YashdSaraf said:
Awesome info, this thread came up #1 while googling busybox 1.23
I made a flashable zip of the attached binary in the op to clean the old one(if any) and install the new busybox in xbin, just in case if anyone needs it. :good:
Click to expand...
Click to collapse
Thanx,worx fine with Carbon 4.4.4 on my LG.
GREETZ FROM TEAM-OPTIMA!!!
E:V:A said:
Great Info here!
But I would be interested to know how well this method works on Samsung Stock devices running AOS 4.2 and above? Any experience?
Click to expand...
Click to collapse
Thanks man. I've been compiling tons of stuff with Debian and Ubuntu chroot no problem on top of 4.3.1 Vanir and also 4.4.4 Carbon, both are my daily drivers. "Complete Linux Installer" is pretty fast compared to some other chroot apps like GNUroot (no offense to GNUroot, it works but is way too slow). It runs real-time compared to non-chroot. When compared to my dual-core 2007 Pentium M laptop, it's about 2-3 times as slow which isn't too bad for compiling something like mksh or even busybox which takes up to 5 mins I'd say.
In terms of binary size, compiling natively is better than cross-compiling it seems. I used gcc with no size optimizations here, so 1.37MB is pretty nice compared to some others around 2MB with full configs. With this method and klcc (gcc wrapper) I got mksh compiled to 192KB. I'm currently trying to build a uclibc toolchain on my laptop that will give me a mksh binary under 300KB..
YashdSaraf said:
Awesome info, this thread came up #1 while googling busybox 1.23
I made a flashable zip of the attached binary in the op to clean the old one(if any) and install the new busybox in xbin, just in case if anyone needs it. :good:
Click to expand...
Click to collapse
Cool thanks man! That is really useful, glad to hear from CALIBAN that it works. Could I add this to the OP with credit to you?
Hamidreza2010 said:
Is it work on xperia sp on 4.3 fw yes ?
Click to expand...
Click to collapse
Yes, xperia sp uses armv7 so you should be good to go.
7175 said:
Cool thanks man! That is really useful, glad to hear from CALIBAN that it works. Could I add this to the OP with credit to you?
Click to expand...
Click to collapse
Sure bro go ahead
Edit: Went ahead and made one for selinux enabled busybox :silly: , you can add this one in the op too.
Hey guys I was able to get an entire uClibc toolchain built the other day (using buildroot). I tested it and it makes some nice small binaries with about 20%+ smaller size than the standard glibc. Man that took hours to compile but was well worth it. It really put the stability of Android OS to the test as well. Kitkat absolutely couldn't finish compiling with multiple oom's and oops's, but Vanir 4.3.1 stuck it out real nice. Once I had the huge amount of required buildroot packages downloaded, I was able to compile in TWRP as well with good stability. (I have the "Complete Linux Installer" startup chroot script aliased in my mkshrc so I can pull up an ubuntu terminal without starting the app. )
So I got 3 new attachments to OP:
- arm-linux-uclibc toolchain for anyone who wants to compile stuff with it (host=arm AND target=arm)
- busybox (374 fcns, non-selinux) 1116KB
- lzip binary (in case you need it to unzip the toolchain, which is highly compressed from 64MB to 14MB with lzip's lzma)
**As I mentioned in the updated OP, I wasn't able to get selinux-enabled busybox compiled with uclibc. This may be something unsupported, or there may be a patch fix. I'll check it out. I'll try with musl libc and musl-gcc as well.
I have another approach, I try aboriginal cross compiler toolchain in archLinux it produced small binary, but I can't compile busybox for android. For Linux it work. Maybe need bionic lib?
ndrancs said:
I have another approach, I try aboriginal cross compiler toolchain in archLinux it produced small binary, but I can't compile busybox for android. For Linux it work. Maybe need bionic lib?
Click to expand...
Click to collapse
Sounds interesting. I honestly haven't given this a try yet, but I'm very interested in taking a look at it. At this point I'm pretty much addicted to making the smallest binaries I can and testing out different toolchains. I'll give it a good search on duckduckgo, and if you have any insightful links that would be great.
Edit: Alright cool I found the source for Aboriginal Linux at landley.net/aboriginal and am building on Android now. I'm also trying this on my x86_64 laptop so that I can compare the differences like I have with glibc, uclibc, musl, klibc binary builds in a native environment and a cross-compile environment.
I see from my laptop's build that a busybox was generated, but it was dynamic and has a libc.so.6 dependency. @ndrancs : this might be what you were talking about. Did you try compiling static? Also see if "make allnoconfig && make clean && make LDFLAGS=-static" works for compiling busybox with Aboriginal Linux.
7175 said:
Edit: Alright cool I found the source for Aboriginal Linux at landley.net/aboriginal and am building on Android now. I'm also trying this on my x86_64 laptop so that I can compare the differences like I have with glibc, uclibc, musl, klibc binary builds in a native environment and a cross-compile environment.
I see from my laptop's build that a busybox was generated, but it was dynamic and has a libc.so.6 dependency. @ndrancs : this might be what you were talking about. Did you try compiling static? Also see if "make allnoconfig && make clean && make LDFLAGS=-static" works for compiling busybox with Aboriginal Linux.
Click to expand...
Click to collapse
I preferred to use uclibc I think it easy to setup and produced small binary.. Aboriginal cross-compiler use uclibc as default. Btw I don't use cmd : LDFLAGS=-static instead I set it in .config.. Maybe I try this later..
ndrancs said:
I preferred to use uclibc mk it easy to setup and produced small binary.. Aboriginal cross-compiler use uclibc as default. Btw I don't use cmd : LDFLAGS=-static instead I set it in .config.. Maybe I try this later..
Click to expand...
Click to collapse
Ok yeah I like how aboriginal set up with uclibc, and it has scripts for each build stage, so you can stop at the toolchain. I'll be interested to see their future releases with the musl libc as well.
Also for anyone interested, I figured out how to run dynamic binaries in android:
- make the directories "/lib" and "/lib/arm-linux-gnueabihf"
Code:
mkdir -p /lib/arm-linux-gnueabihf
- copy the linker "ld-linux-armhf.so.3" to "/lib"
- find a specific binary's dependencies: e.g. for dynamic mksh do:
Code:
strings mksh | grep \\.so
- copy the listed libs to "/lib/arm-linux-gnueabihf": e.g. for mksh that would be libc.so.6. The libs/linker you copy over will come from the mounted ubuntu/debian/... image you have mounted like with "Complete Linux Installer".
- adjust your LD_LIBRARY_PATH:
Code:
LD_LIBRARY_PATH=/lib:/lib/arm-linux-gnueabihf:$LD_LIBRARY_PATH
Any plan to update the busybox to current version. Thanks.
@7175 can you update flashable zip to 1.23.0 stable ?
@ndrancs @exodius48 : Thanks for notifying me guys, I needed to get around to updating to 1.23.0 stable. I updated the original post with no-edify installers for busybox 1.23.0 stable. There's a non-SELinux uclibc compiled version and a full 386-applet SELinux glibc compiled version. They're included in this post too for ease.
7175 said:
@ndrancs @exodius48 : Thanks for notifying me guys, I needed to get around to updating to 1.23.0 stable. I updated the original post with no-edify installers for busybox 1.23.0 stable. There's a non-SELinux uclibc compiled version and a full 386-applet SELinux glibc compiled version. They're included in this post too for ease.
Click to expand...
Click to collapse
Great..been waiting for this release.. :good:
Btw, can i use busybox_full_selinux.zip on android 4.2.2 MIUI rom?
exodius48 said:
Great..been waiting for this release.. :good:
Btw, can i use busybox_full_selinux.zip on android 4.2.2 MIUI rom?
Click to expand...
Click to collapse
Yeah that should work just fine. I'm pretty sure any SELinux tools or applet flags should work since 4.2 introduced SELinux to its filesystem. Let me know if there are any issues.
7175 said:
Yeah that should work just fine. I'm pretty sure any SELinux tools or applet flags should work since 4.2 introduced SELinux to its filesystem. Let me know if there are any issues.
Click to expand...
Click to collapse
Great release..busybox_full_selinux.zip working fine so far on MIUI rom V5 android 4.2.2. :victory:
7175 said:
@ndrancs @exodius48 : Thanks for notifying me guys, I needed to get around to updating to 1.23.0 stable. I updated the original post with no-edify installers for busybox 1.23.0 stable. There's a non-SELinux uclibc compiled version and a full 386-applet SELinux glibc compiled version. They're included in this post too for ease.
Click to expand...
Click to collapse
Hey @7175
Great guide. I am able to compile just fine on my device using your guide. However, is there any way to compile the selinux applets support using a Linux PC (or NDK)? I am not able to find a selinux supported toolchain. May be you can help.

Is there an assembler and linker included in Android?

From an ADB shell, I tried running:
Code:
as helloworld.s -o helloworld.o
but it seems that the GNU assembler is not included in Android.
I also tried it from a root shell on the device.
I was just wondering if anyone knows whether there is an assembler and linker included on Android? If not, is it possible to install one?
Thanks.
Wondering why Android OS should have included GNU assembler ( GAS ) ?
BTW: GNU assembler for ARM exists
In order to compile your assembly program, you will need the Android NDK, the Native Development Kit, which contains a set of compilers and build tools for the ARM platform. You can get download it directly from the official site, or install it through Android Studio.
But please note that this is for Windows, Mac or Linux instead of Android OS.
James_Watson said:
In order to compile your assembly program, you will need the Android NDK, the Native Development Kit, which contains a set of compilers and build tools for the ARM platform. You can get download it directly from the official site, or install it through Android Studio.
But please note that this is for Windows, Mac or Linux instead of Android OS.
Click to expand...
Click to collapse
I was hoping to find one that will run on Android itself.
OK so as far as I can tell, there is no assembler or linker included on Android, since apps are created from x86_64 machines and then installed on the device. So I went with installing binutils via Termux.
- Installed f-droid
- Installed Termux via f-droid (The version in the play store has an out of date sources.list and the app hasn't been updated since September. Evidently the Termux dev group is releasing via f-droid now, not via the Play store.)
- From Termux, ran the following:
$ pkg update
$ pkg install binutils
This allowed me to use the GNU assmbler (as) and linker (ld).
Just leaving this note here in case anyone else wants to do the same thing and finds this thread.

Categories

Resources