Embed Notice
HTML Code
Corresponding Notice
- Embed this notice@PurpCat >how do you run Linux binaries
Easy, just enable the terminal emulator in settings, or install one from f-droid and evecute;
cd path/to/binary.elf && ./binary.elf
If a binary is programmed to not use any libc functions and only use Linux SYSCALLs (i.e. a trivial assembly program) and isn't dynamically linked to anything, then such will run on any system that uses Linux as its kernel.
That is quite niche and is rarely done, but it has been done in the past for a laugh like a prime number that can also be interpreted as i396 machine code that does DeCSS and allows you to pipe a DVD through it and play that DVD.
One example I found of such assembly programs is;
section .data
Buffer: db 'Hello World!',0xA ;db returns memory address of data. 0xA is a newline
BufferSize: equ $-Buffer
section .text
global _start
_start:
mov edi, 1 ;file descriptor = stdout
mov rsi, Buffer ;move address of Buffer into rdi
mov rdx, BufferSize ;move size of buffer into rsi
mov eax, 1 ;sys_write
syscall ;do sys_write
exit: mov eax, 60 ;sys_exit
xor edi, edi ;return 0
syscall ;do sys_exit
With compilation instructions;
nasm -f elf64 hello-world.asm
ld -m elf_x86_64 -o hello-world hello-world.o (GNU ld preferred of course)
Although Android tries to force you towards using its Java libraries, it does allow writing only minimal Java for a GUI and then writing in C or C++, which are compiled against native libraries.
Android does include a libc, but it kind of sucks and you're better off figuring how to get glibc installed and using that.