Skip to content

Instantly share code, notes, and snippets.

@nokute78
Last active June 23, 2021 08:57
Show Gist options
  • Save nokute78/845baec44c6789b94d7de3de7b8d6aef to your computer and use it in GitHub Desktop.
Save nokute78/845baec44c6789b94d7de3de7b8d6aef to your computer and use it in GitHub Desktop.
Testing QEMU (user mode emulation)

on ARM OS

$gcc --static helloworld.c -o helloworld

on Ubuntu 20.04 Host

sudo apt install g++-arm-linux-gnueabihf
sudo apt-get install qemu-system-arm
arm-linux-gnueabihf-gcc  -Wall --static helloworld.c

on x86_64 host(I tested on CentOS7)

$ uname -a
Linux localhost.localdomain 3.10.0-514.6.1.el7.x86_64 #1 SMP Wed Jan 18 13:06:36 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
$ file helloworld
helloworld: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.26, BuildID[sha1]=2e78e055e9bf3ca6de6a9b1ccab30de37c4adef2, not stripped
$ qemu-arm helloworld
helloworld
/* $ gcc --static helloworld.c */
#include <stdio.h>
int main(void){
printf("helloworld\n");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment