Skip to main content

I followed the tutorial onFollowing this page and installed the ARM cross compiler toolchain on Ubuntu andtutorial I have compiled a simple Hello World program.

Code:

#include "stdio.h"
 
int main(void) {
  printf("Hello world !\n");
  return 0;
}

The command used to compile this program:
Hello World! ARM binary from C source using arm-linux-gnueabi-gcc -static -o hello hello.c

I. I want to run hellothis program on my unrooted Android phone but I can't figure out an easy way to do it.

What I've tried:

  1. Copying hello to /sdcard and trying to run it from there. This doesn't work because the internal storage is mounted with the noexec flag.

  2. Copying hello to /data/local/ using cp hello /data/local/ or cat hello > /data/local/hello as explained here. This also doesn't work and I get a "permission denied" error.

  3. Installing a terminal emulator program such as Termux and using the Termux app to copy hello from /sdcard/hello to /data/data/com.termux/files/home, running chmod +x hello and then running ./hello from the Termux home directory within the Termux app. This works but is not a feasible solution.

Is there a better/easier way to run native ELF executables on an unrooted Android phone directly through ADB and doesn't involve installing any apps?

I followed the tutorial on this page and installed the ARM cross compiler toolchain on Ubuntu and compiled a simple Hello World program.

Code:

#include "stdio.h"
 
int main(void) {
  printf("Hello world !\n");
  return 0;
}

The command used to compile this program:
arm-linux-gnueabi-gcc -static -o hello hello.c

I want to run hello on my unrooted Android phone but I can't figure out an easy way to do it.

What I've tried:

  1. Copying hello to /sdcard and trying to run it from there. This doesn't work because the internal storage is mounted with the noexec flag

  2. Copying hello to /data/local/ using cp hello /data/local/ or cat hello > /data/local/hello as explained here. This also doesn't work and I get a "permission denied" error.

  3. Installing a terminal emulator program such as Termux and using the Termux app to copy hello from /sdcard/hello to /data/data/com.termux/files/home, running chmod +x hello and then running hello from the Termux home directory within the Termux app. This works but is not a feasible solution.

Is there a better/easier way to run native ELF executables on an unrooted Android phone directly through ADB and doesn't involve installing any apps?

Following this tutorial I have compiled a Hello World! ARM binary from C source using gcc. I want to run this program on my unrooted Android phone but I can't figure out an easy way to do it.

What I've tried:

  1. Copying hello to /sdcard and trying to run it from there. This doesn't work because the internal storage is mounted with the noexec flag.

  2. Copying hello to /data/local/ using cp hello /data/local/ or cat hello > /data/local/hello as explained here. This also doesn't work and I get a "permission denied" error.

  3. Installing a terminal emulator program such as Termux and using the Termux app to copy hello from /sdcard/hello to /data/data/com.termux/files/home, running chmod +x hello and then running ./hello from the Termux home directory within the Termux app. This works but is not a feasible solution.

Is there a better/easier way to run native ELF executables on an unrooted Android phone directly through ADB and doesn't involve installing any apps?

Post Closed as "Duplicate" by CommunityBot
Source Link
Vinayak
  • 235
  • 5
  • 15

How can run native executables compiled for ARM on unrooted Android devices?

I followed the tutorial on this page and installed the ARM cross compiler toolchain on Ubuntu and compiled a simple Hello World program.

Code:

#include "stdio.h"
 
int main(void) {
  printf("Hello world !\n");
  return 0;
}

The command used to compile this program:
arm-linux-gnueabi-gcc -static -o hello hello.c

I want to run hello on my unrooted Android phone but I can't figure out an easy way to do it.

What I've tried:

  1. Copying hello to /sdcard and trying to run it from there. This doesn't work because the internal storage is mounted with the noexec flag

  2. Copying hello to /data/local/ using cp hello /data/local/ or cat hello > /data/local/hello as explained here. This also doesn't work and I get a "permission denied" error.

  3. Installing a terminal emulator program such as Termux and using the Termux app to copy hello from /sdcard/hello to /data/data/com.termux/files/home, running chmod +x hello and then running hello from the Termux home directory within the Termux app. This works but is not a feasible solution.

Is there a better/easier way to run native ELF executables on an unrooted Android phone directly through ADB and doesn't involve installing any apps?