1. Prepare the environment
cd ~/openwrt/bin/ar71xx tar -xjvf OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.6-linaro_uClibc-0.9.33.2.tar.bz2 #Decompression toolkit cd OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.6-linaro_uClibc-0.9.33.2/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2
2. Coding
Since C is cross-platform, the hello world encoding is consistent on any platform.
#include <stdio.h> int main(int argc,char **argv) { printf("hello world\n"); return 0; }
3. Compile
openwrt provides a special gcc tool, the command is no different.
./bin/mips-openwrt-linux-uclibc-gcc -o hello hello.c
The generated hello world is based on MIPS architecture. There are so many brands of routers. It seems that if you want to develop a product, you have to compile them one by one.
4. Upload to the router
It is recommended to use the winSCP tool and select the scp protocol to transmit. Note that sftp cannot be selected because the router does not have a built-in sftp-server service.
5. Operation
Bingo .....