0

Can anyone tell me how to transplant linux shell command (such as : ls ,cat and tar) from linux to android. what i think is to do as follow:

1、download the sourcecode

2、execute the command :./configure ( with some params ) CC=arm-linux-android(use cross-compile)

3、./build or make it

4、then ,we can copy the object files and executables to the android

is it right way to do it? thanks in advance !

wangxigui
  • 35
  • 5
  • 1
    Have you ever tried connecting to your Android device with "adb shell"? You'll see that your mentioned shell commands are probably already there. Android's kernel is Linux. – tiguchi Aug 17 '13 at 13:09
  • thanks for your advice ! I know what your mean .but not all the shell command can run on the android , just some pre-built command can run on it – wangxigui Aug 17 '13 at 13:21
  • I see... considering that I guess your described approach is correct. You'll need the source code and compile it for the target processor architecture (be careful there are also non-ARM Android devices). I'm curious, what exactly are you going to do? – tiguchi Aug 17 '13 at 13:36
  • Have you ever used 'busybox' on android ? you can run most of linux shell command on android with it . I am very intereted in how does it work . – wangxigui Aug 17 '13 at 14:00
  • I didn't know about that yet but it looks like busybox emulates a shell environment and its commands and typical tools. The project page of busybox says that you can extend it with more commands ("modules") during compile time. It's probably not possible to do that afterwards. So I guess you could set up busybox with all features you need and compile it for Android. The other approach would be compiling individual utility programs for Android, copy them to your device and use shell or bash to execute them. – tiguchi Aug 17 '13 at 14:21

2 Answers2

0

First of all you need to root your android to extend its limits. Then get busybox to get all possible commands and you can get compilers for c in play store...

Ankit Pise
  • 1,243
  • 11
  • 30
0

Essentially those steps would work... you would just have to figure out the right configure commands. Getting the ndk, checking out AOSP, even checking out CM would probably get you the cross-compilers you would need. AOSP and CM would probably be overkill but they include what you would get with the ndk. If you are only planning on porting utilities the ndk might be all you need though.

Hope that helps.

dudebrobro
  • 1,287
  • 10
  • 17