终于编译完成了OpenWrt,并且成功交叉编译了Helloworld,并在Easy-Link的板子上运行。
#编译OpenWrt SDK#
编译OpenWrt的过程,可参考OpenWrt的编译。编译配置我勾选了Advanced configuration option、Build the OpenWrt SDK和Build the OpenWrt based Toolchain。
编译完成之后,交叉编译工具链在类似staging_dir/toolchain-architecture_gcc-compilerver_uClibc-libcver/bin/目录。
#配置环境变量#
主要配置以下环境变量:
1 | |
#交叉编译Helloopenwrt#
helloopenwrt.c的源码如下:
1 | |
然后进行交叉编译:
1 | |
然后将生成的hellowopenwrt.o文件用scp上传到Easy-Link上,并用ssh登录到Easy-Link上,并运行,便可以看到终端输出:
1 | |