OpenWrt交叉编译helloworld

OpenWrt交叉编译helloworld

解压OpenWrt-SDK

tar -xvf OpenWrt-SDK-15.05-ramips-mt7620_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64.tar.bz2
下载链接

添加环境变量

找到交叉编译工具,一般在staging_dir/ARCH/bin/下:

/home/netsurfed/openwrt/OpenWrt-SDK-15.05-ramips-mt7620_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin

添加PATH变量

export PATH=$PATH:/home/netsurfed/openwrt/OpenWrt-SDK-15.05-ramips-mt7620_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin

添加STAGING_DIR变量

export STAGING_DIR=$STAGING_DIR:/home/netsurfed/openwrt/OpenWrt-SDK-15.05-ramips-mt7620_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin

编译

mipsel-openwrt-linux-gcc -o helloworld helloworld.c

参考

参考链接

你可能感兴趣的:(openwrt)