[APP] mksh (ksh successor) shell for Android - Android Apps and Games

I cross-compiled mksh R39c for Android if anyone is interested : http://www.plusquenet.net/android/mksh-R39c-armel-optimized.tar.bz2
Just as an indication, filesize is now 222kb (way less than any Bash will be).
To compile it yourself you just need to launch the build with :
(if you got Voodoo lagfix cross compiler (recommanded)) CC="/path/to/lagfix/stages_builder/buildroot-2010.08/output/staging/usr/bin/arm-linux-cc" CFLAGS="-Os -static" ./Build.sh
(if you got codesourcery cross compiler) CC="/path-to-codesourcery-toolchain/bin/arm-none-linux-gnueabi-gcc" CFLAGS="-Os -static" ./Build.sh

Someone does care... Me!
I assume mksh is backwards compatible with running any ksh scripts? IBM has a shell curses library that works just like the C library, but can be used in shell scripts. Written in pure ksh. I want to use it...

mksh is part of AOSP, you basically “only” have to write TARGET_SHELL:=mksh into your board configuration and you get mksh as /system/bin/sh ☺
Otherwise, compilation is straight-forward, and it runs fine, dynamically linked against Bionic (no need for strange other libcs or fancy stuff).

dwallersv said:
Someone does care... Me!
I assume mksh is backwards compatible with running any ksh scripts? IBM has a shell curses library that works just like the C library, but can be used in shell scripts. Written in pure ksh. I want to use it...
Click to expand...
Click to collapse
If you still need the info, mirabilos made the curses lib working with few patches.

dwallersv said:
I assume mksh is backwards compatible with running any ksh scripts?
Click to expand...
Click to collapse
Somewhat. There are different ksh’en out there, you know… ☺
dwallersv said:
IBM has a shell curses library that works just like the C library, but can be used in shell scripts. Written in pure ksh. I want to use it...
Click to expand...
Click to collapse
I’ve attached the patches against what I could find: http://www.ibm.com/developerworks/aix/library/au-shellcurses/ had no ready-made downloads, but pointed to http://www.mtxia.com/css/Downloads/Scripts/Korn/Functions/ which led to spotting http://www.mtxia.com/js/Downloads/Scripts/Korn/Functions/visualSelect/index.shtml which includes the shell curses functions.
Tab expansion is pretty broken on BSD with xterm and GNU screen, but the same seems to work better on ssh’ing out to Linux, I wonder why, since all software involved is the same… except tput though. But it works like that and is usable. With post-R40 mksh, you can get about with even less hacks (more similarity to AT&T ksh).
Have fun!

Related

C Code in G1? JF? Anyone?

I'm just wondering is anyone trying this yet? i mean is it even possible?
Just a thought for you big shot android devs out there JF, Haykuro, LucidREM
Google "android jni"
Well, a quick trip around google would have helped you.
Android is using java, and currently it's not possible to use anything else.
But anyway, would you rather compile all of your code for multiple architectures? J makes things easier here...
You can write cli-apps in C though... i heard something about that there was plans to make other languages available in android, but i wouldn't hold my breath
Also, why is this related to JF/Haykuro/LucidREM?
I think you can do this with JNI: http://en.wikipedia.org/wiki/Java_Native_Interface
Using an ARM native compiler (such as the ones at CodeSourcery, http://www.codesourcery.com/sgpp/lite/arm/portal/[email protected]=lite) you can compile your apps and run them fine on the G1
Code:
$ arm-none-linux-gnueabi-gcc -static foo.c -o foo
$ adb push foo /data/foo # we are pushing to /data as it is +rwx (read, write, execute) for a standard user.
$ adb shell /data/foo
a=1
b=2
foo=a+b
foo=3
^^^
OH I love when I stumble across a post like this and have something new to play with.
The problem is due to the different location of the linker and mainly the different libc you have to statically link everything.
I have been having a hell of a time getting DPKG to build statically.
I picked up a copy of the newly released book, Unlocking Android, at Barnes and Noble yesterday. There is a whole chapter devoted to writing native apps using C (and ARM assembler) with the CodeSourcery tools linked above. The author walks through the steps you need to do to dynamically link the libraries so you don't end up with enormous statically linked executables. Well worth the price.
It is surprising what you can do with C on the phone, its actually not too difficult. The method outlined below doesn't use the non native toolchains and if you use the sourcery toolchain (as mentioned above) you will end up with bigger binaries as you need to link in a standard glibc and not androids bionic libc. This may or may not be important for your project.
The other advantage of the steps below is that you will build and link against any library that is available to the android platform
The easiest way that I've found to start when porting or writing new applications is this method.
1) Check out the current git android source.
2) Build the entire tree, "make" in the top level directory.
3) Create a new directory in mydroid/external/packagename/
4) Copy one of the simple android Android.mk (Make) files from a "like" target.
(If doing a library, choose a library, if coding an executable , choose that).
5) source the mydroid/build/envsetup.sh in the users bashrc
6) cd to your directory, then instead of the usual "make" do an mm.
This should create a binary, which you can adb push to the phone and run at the console.
You can do all the usual things if linked properly, like write the framebuffer using sdl, play sounds, create network connections.
Just remember that you dont have a standard libc (glibc) to play around with you have "bionic". If you are missing your favourite glibc function , it is probably intention and not abug. You'll either need to port it or make do with the functions provided by bionic.
These instructions are for a "pure" C program. you can mix the java like dex calling by 'shelling' out to the C application when you need performance, however premature optimization is the root of all evil, you'll be surprised what performance you can pull from davlik (And I expect the VM guys to improve this even further).
I know that is a lot to digest. Will do the best I can to answer your questions. I'm by no means an expert in the area, but have learned a bit about C on android.
Well I don't know much about all this but what i know is that e.g.
ScummVM IS written in C++ , and so is g-arcade.
His FAQ says:
"How did you do this? Is it Java?
No. ScummVM is a C++ program. For this port, I turned it into a really big JNI library so Android still thinks it's running a Java program, but almost all of it is implemented in C++."
(http://sites.google.com/site/scummvmandroid/faq#TOC-How-did-you-do-this-Is-it-Java-)
So if some1 wanna port MAME, feel free to xD

[ROM] NAVDROID ION work-in-progress

I am going to be making a ION based build for lightweight speedy access of the phone. i don't know how to do crap at the moment, but i learn quick and i love stimulants LOL.
PLANNING ROADMAP
LEARN ECLIPSE AND JAVA
MODIFY ION AND REMOVE RINGTONES AND ADD MY OWN BUILD NAME
INTEGRATE SWAPPER
DO NOT CATER TO THE APPS2SD CROWD
INTEGRATE OVERCLOCK WIDGET
UPLOAD FIRST RELEASE
???
PROFIT
if any helpful developers want to lend a helpful hand. i am running windows xp in a virtualbox and have my development environment there. the final goal of this release is to have the smallest footprint possible and the most stable environment to make calls, send and receive txts, get email and use msn, but above all, PLAY MUSIC UNINTERRUPTED. i know i could achieve this with a simple stock firmware, but i see this as the anti modified firmware. everyone focuses on bleeding edge OMG HERO OMG NEW FEATURES NO ONE WILL USE. i call, i use my data plan, and i listen to my 2gigs of OGG files.
thank you
- NAVDROID
Read Java Head First
I would suggest running a Linux distro to do your editing in...sign in windows thats about it. Cygwin is not worth the trouble IMO
wat? there is an issue with my fedora wanting to run....
http://bayimg.com/AaBEFaaCF
if i could fix this issue then hellz yea i could try to do this native on my fedora, but alas it dosent wanna work.
Looks like you have an issue with you Java VM. You need to be using Sun's Java
Try this..these are about a year old so slight changes might need to be made to JRE and JDK
1. Remove all installed packages related to java:
Code:
$ sudo apt-get remove eclipse sun-java6-*
2. Download self extracting versions of JRE and JDK for Linux (jdk-6u4-linux-i586.bin and jre-6u3-linux-i586.bin). I will assume that you downloaded them in your Desktop for the rest of the instructions (~/Desktop).
3. Create the /usr/lib/jvm directory and extract the JRE and JDK binaries there:
Code:
$ sudo mkdir /usr/lib/jvm
$ cd !$
$ sudo sh ~/Desktop/jre-6u3-linux-i586.bin
$ sudo sh ~/Desktop/jdk-6u4-linux-i586.bin
4. Install java plugin for Firefox:
Code:
$ sudo ln -s /usr/lib/jvm/jre1.6.0_03/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/firefox/plugins/libjavaplugin_oji.so
5. Update alternatives for JDK (I don't really know why we must do this, any comments to clarify this will be appreciated):
Code:
$ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.6.0_04/bin/java" 1
6. Set /usr/lib/jvm/jdk1.6.0_04 as your first java option:
Code:
$ sudo vim /etc/jvm
The file must have in the first line /usr/lib/jvm/jdk1.6.0_04 to set that directory as your first JVM search option:
Code:
# This file defines the default system JVM search order. Each
# JVM should list their JAVA_HOME compatible directory in this file.
# The default system JVM is the first one available from top to
# bottom.
/usr/lib/jvm/java-6-sun
/usr/lib/jvm/java-gcj
/usr/lib/jvm/ia32-java-1.5.0-sun
/usr/lib/jvm/java-1.5.0-sun
/usr
6. Verify your JRE plugin installation for Firefox by visiting http://www.java.com/en/download/installed.jsp and click on "VERIFY INSTALLATION" button.
7. Verify your JDK installation by typing the following in the console:
Code:
$ java -version
java version "1.6.0_04"
Java(TM) SE Runtime Environment (build 1.6.0_04-b12)
Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode, sharing)
And that's it! You're now able to run Easyeclipse.
Happy hacking!
java version "1.6.0_13"
Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
Java HotSpot(TM) Server VM (build 11.3-b02, mixed mode)
if this dont work, then i slit wrists and just continue using windows xp virtual machine
Woo hoo double post, I'm in the car with my dad, so excuse any android mispellings. Umm, I plan on starting with the obvious HELLO WORLD stuff, but if anyone wants to give me a quick and dirty introduction to simple update.zip editing, post it plox.
Anyone else think it's strange and a little funny that the OP makes an official ROM thread for a rom he plans to make and first on his list of things to do is learn Java?
navdroid said:
I am going to be making a ION based build for lightweight speedy access of the phone. i don't know how to do crap at the moment, but i learn quick and i love stimulants LOL.
PLANNING ROADMAP
LEARN ECLIPSE AND JAVA
MODIFY ION AND REMOVE RINGTONES AND ADD MY OWN BUILD NAME
INTEGRATE SWAPPER
DO NOT CATER TO THE APPS2SD CROWD
INTEGRATE OVERCLOCK WIDGET
UPLOAD FIRST RELEASE
???
PROFIT
if any helpful developers want to lend a helpful hand. i am running windows xp in a virtualbox and have my development environment there. the final goal of this release is to have the smallest footprint possible and the most stable environment to make calls, send and receive txts, get email and use msn, but above all, PLAY MUSIC UNINTERRUPTED. i know i could achieve this with a simple stock firmware, but i see this as the anti modified firmware. everyone focuses on bleeding edge OMG HERO OMG NEW FEATURES NO ONE WILL USE. i call, i use my data plan, and i listen to my 2gigs of OGG files.
thank you
- NAVDROID
Click to expand...
Click to collapse
Please don't keep the swapper bull**** in your roadmap. Apps2SD > Swapper for performance until they fix some of the durability issues surrounding mSDHC.
Just a suggestion.
Pinesal said:
Anyone else think it's strange and a little funny that the OP makes an official ROM thread for a rom he plans to make and first on his list of things to do is learn Java?
Click to expand...
Click to collapse
Yeah I LOL'd.
My plans to become an astronaut:
1. Learn physics.
2. ....
3..........
4. WIN.
I know it's where we all started at some point in life on SOMEthing, but it is funny for someone to call it out.
****, I'm a C# guy by trade, so for me those were the first two steps also. Learn a bit about Eclipse and refresh on Java (since that was my foundation going into C#).
No it is ****ing foolish of myself to go into this head first, but seriously how hard could it be to learn the basics of this. Unless another developer wants to take my ideas and apply them.
I have an ion r1 rom that's sort of slimmed down to things I use; I removed amazon mp3 store, email app (not gmail), talk, voice search, and voice dialing. Removed all ringtones, notifications, and alarms and replaced them with one of each taken from the htc build, removed apps2sd (seriously, who needs it when you have 89mb free at /data), pushed the overclock widget (odexed and slimmed apk), terminal, removed all locales but english, and most of the htc apks and framework libraries that haykuro had tossed in there.
You'll notice one thing when you do it, though, removing a lot of things from /system will be pretty useless because you don't even have access to it by default anyway, so making space by removing apks or media will really yield nothing. Now, if we had an spl that partitioned the nand to give system only about 64 mb (my system.img is 62 mb), and the rest to /data, you'd be looking at having about ~100 mb free from a clean install. Who really has more than 30 mb worth of apks? (and actually uses them all, calm down, apk pack rats). You'd also wouldn't have to worry about a2sd biggest flaw; no hot-swapping.
navdroid said:
No it is ****ing foolish of myself to go into this head first, but seriously how hard could it be to learn the basics of this. Unless another developer wants to take my ideas and apply them.
Click to expand...
Click to collapse
how hard is it to learn basics?...you'll see..
Hey jubeh, that modding you did is exactly what I'm going to do.
im sorry navdroid i no this isnt relevant but how is the gtx280 running on fedora lol just curious
Good luck. I'd ask you to cater to the "apps2sd crowd", but seeing as this is a rom that's supposed to be minimalistic, that would be somewhat contradictory.
Do you plan to remove the camera?
navdroid said:
Hey jubeh, that modding you did is exactly what I'm going to do.
Click to expand...
Click to collapse
sorry about posting and then seeming to disapear. the rom I made was already installed in my phone, then i deleted the update and i have the backup as a nandroid backup. I won't share that because it's got personal information. I'll try to re-make the rom and then megaupload it or rs it, or whichever one i can do quick, painless, and free. I'll need a day (not that i need all day to work on it, but I have a life too).
navdroid said:
INTEGRATE SWAPPER
DO NOT CATER TO THE APPS2SD CROWD
Click to expand...
Click to collapse
Thanks, but I'd rather stick to actual builds that allow me to use my phone to its fullest potential.
i like using a phone where i can pull the sd card out at any time without it breaking and requiring a reboot, plus i dont need 500 mb worth of fart apps (85% of market apps suck)
The issue isn't that you have a lot to learn before doing it...the issue is that really the changes that you're making can be done in about 10 minutes..it doesn't really need a new rom name for that. We're getting so many 'flavors' out there of everything that it's getting hard to keep up with it all.
* LEARN ECLIPSE AND JAVA
Click to expand...
Click to collapse
Not necessary for almost all ROM 'development'
* MODIFY ION AND REMOVE RINGTONES AND ADD MY OWN BUILD NAME
Click to expand...
Click to collapse
adb remount
adb shell rm -rf /system/media/audio/ringtones/*
* INTEGRATE SWAPPER
Click to expand...
Click to collapse
Didn't you say you wanted performance?
* DO NOT CATER TO THE APPS2SD CROWD
Click to expand...
Click to collapse
Didn't you say you wanted performance?
* INTEGRATE OVERCLOCK WIDGET
Click to expand...
Click to collapse
echo 528000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo 528000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
* UPLOAD FIRST RELEASE
Click to expand...
Click to collapse
That's really on a roadmap?
* PROFIT
Click to expand...
Click to collapse
Good luck with that
That being said - I'm not bashing the idea of contribution to the platform, it's just that in all honesty you aren't doing anything that's justifiable of calling it a new ROM...it's not. The things that Cyanogen/JF/Haykuro have done and the path that JAC is headed towards is more in line with what are considered truly real ROMs -- *shrug* maybe i'm just grumpy this morning.

Compile and execute programs on Android 2.2

Hello friends,
I am in need of an installation of gcc such that I can execute the gcc command in the terminal emulator.
My aim is to be successful in writing and compiling programs on my Android (LG Optimus One P500) during travelling and other wasted time.
Thanks.
Probably not exactly what you want but here's the closest I've got for you, http://code.google.com/p/android-scripting/
I'm looking at the same thing on my debian machine and from what i gather the android sdk devel tools along with nvidia's tegra addon give you an arm cross compiler and the include files and kernel headers you'd need.
d0ugie said:
Probably not exactly what you want but here's the closest I've got for you, LINK
Click to expand...
Click to collapse
Thanks for the link. I am trying them out tonight.
gitorious.org/android-toolchain > Someone please try this out and tell me if it works (I will try it out by myself this weekend anyway... So if you have time )
touchqode - mobile code editor and SL4A
I'm not sure if I can post links, but you can search the Internet and/or market to find it. I've played with it for a minute, but plan to use it along with SL4A since they both support Javascript. I don't think Sl4A supports PHP at the moment, but I'm pretty sure it'll be added at some point. I hope this helps.
Topcheese said:
I'm not sure if I can post links, but you can search the Internet and/or market to find it. I've played with it for a minute, but plan to use it along with SL4A since they both support Javascript. I don't think Sl4A supports PHP at the moment, but I'm pretty sure it'll be added at some point. I hope this helps.
Click to expand...
Click to collapse
I am quite satisfied with the range of languages I have. Python + Lua + Perl
My goal was to make g++ and gcc run on Android, but I think I am done for now. Next would be making Debian work for my LG

BotBrew Vim Installation

Hello folks,
So i discovered the wonders of the amazing application "BotBrew", which is basically BusyBox but supercharged to bring a pretty full featured GNU UNIX terminal session to any arm device.
That being said I managed to successfully install Vim on my device without a problem. Its seriously amazing! running vim on my androids terminal!! No emulation! No mounted Linux, nothing but running the real vim on from my android's linux kernel. Phenomenal.
But im curious, i know that has all the same support as vim on linux, including syntax highlighting, etc. But i cant seem to get the syntax highlighting to work. It may be just because my terminal has its colors set to white on black, and maybe its overriding the colors of the syntax highlighting, or maybe I may have just not enabled it or something?
Is there a key combination to enable syntax highlighting in vim? As well as auto-completion?
I know in linux this happens automatically when you save the file with ":w" to whatever file extension it will start the syntax highlighting for that programming language.
So any thoughts on this guys? Maybe a terminal that has basic colors without color schemes? Or a keyboard shortcut that may enable autocompletion and syntax highlighting?
Thanks for your time guys. And i highly recommend getting BotBrew if you have experience on a Linux/UNIX terminal. get vim installed and check out the unreal list of amazing applications you can install and get your new terminal package manager "opkg".
Really you wont regret it.
Oh and help them out and add your device to the supported devices list if it works.
Take care everyone.
Ill take a screenshot in a bit too
Sent from my SPH-D600 using xda premium

[DEV][LIBRARY][2015-06-12] RootFW4 - An Android Root Shell Framework

RootFW4 - An Android Root Shell Framework
RootFW is a tool that helps Android Applications act as root. The only way for an application to perform tasks as root, is by executing shell commands as Android has no native way of doing this. However, due to different types of shell support on different devices/ROM's (Shell type, busybox/toolbox versions etc.), this is not an easy task. RootFW comes with a lot of pre-built methods to handle the most common tasks. Each method tries to support as many different environments as possible by implementing different approaches for each environment. This makes the work of app developers a lot easier.
RootFW is the largest of it's kind. It does not only provide a feature of connecting to a root shell and executing a few shell commands. It also provides a very large range of additional features and extra shell tools that are all build to make RootFW the most cross-device compatible library for Android, and very fast and easy to use in your app.
Besides the ability to connect and communicate with a shell, it provides tools for working with files, properties (Both registered and prop files), file systems, binaries, busybox, memory (RAM, SWAP, ZRAM etc), processes and so on.
Links
Source
Usage and Overview
Full Documentation
Reserved...
Thanks @dk_zero-cool. This looks interesting. I'm currently using Chainfire's SU library. I'll give it a try !
Edit: Just out of curiosity, Why LGPL ?
ukanth said:
Edit: Just out of curiosity, Why LGPL ?
Click to expand...
Click to collapse
GPL has got to much limitation on how and where. I use GPL most of the times, but for something like this, I think LGPL fits much better.

Categories

Resources