I'm trying to cross compile a 'hello world' program for an RK3128 SoC that I believe is running linux. The program should power the device off by running the poweroff -f
command.
I have confirmed that the poweroff -f
command when run from a bash script will turn off the device. Now I would like to do this in a C program.
#include <stdlib.h>
int main()
{
system("poweroff -f");
return 0;
}
I compiled this program for my AMD machine and it worked however, when I changed the compiler settings to target the RK3128 ARM-based SoC, this program did not work.
I used the command below to cross compile my poweroff script for the RK3128:
arm-linux-gnueabihf-gcc --sysroot=[path to dumped filesystem from RK3128] -isysroot / main.c -o program -mfloat-abi=hard -mfpu=neon-vfpv4 -fPIC -march=armv7-a -v
What settings and or compiler can I use to do this successfully?
NOTE: The RK3128 is located on a mini console featured in a modding article. I do not have terminal access or serial access so my only means of debugging is seeing the screen power off.
If needed here's the output of readelf -A game
where game is a functioning program stored on the RK3128
readelf -A game
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "Cortex-A7"
Tag_CPU_arch: v7
Tag_CPU_arch_profile: Application
Tag_ARM_ISA_use: Yes
Tag_THUMB_ISA_use: Thumb-2
Tag_FP_arch: VFPv4
Tag_ABI_PCS_wchar_t: 4
Tag_ABI_FP_rounding: Needed
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align_needed: 8-byte
Tag_ABI_align_preserved: 8-byte, except leaf SP
Tag_ABI_enum_size: int
Tag_ABI_VFP_args: VFP registers
Tag_CPU_unaligned_access: v6
Tag_MPextension_use: Allowed
Tag_DIV_use: Allowed in v7-A with integer division extension
Tag_Virtualization_use: TrustZone and Virtualization Extensions