编译时要配置内核,make menuconfig
配置Build the OpenWrt SDK ,前提条件是openwrt编译成功
1.在编译好的文件中会有/bin/ramips/OpenWrt-SDK-ramips-for-linux-x86_64-gcc-4.6-linaro_uClibc-0.9.33.2.tar.bz2文件
2.然后解压这个文件
tar xvf OpenWrt-SDK-ramips-for-linux-x86_64-gcc-4.6-linaro_uClibc-0.9.33.2.tar.bz2
进入这个sdk,会看见一个package,在下新建mkdir -p helloworld/src 两个目录
在目录src下新建helloworld.c
然后在此目录下创建Makefile( 注意Makefile的语法要用tab )
然后返回上层目录,即helloworld目录,在此目录下创建一个Makefile
这里的Makefile文件要注意tab(如果是复制过去的话)
然后回到OpenWrt-SDK-ramips-for-linux-x86_64-gcc-4.6-linaro_uClibc-0.9.33.2目录执行make
编译过程会在build_dir目录下完成
make[1] world
make[2] package/compile
make[3] -C package/helloworld compile
make[2] package/index
说明编译成功
编译好的文件放置在 bin/[yourtarget]/package目录下
配置Build the OpenWrt SDK ,前提条件是openwrt编译成功
1.在编译好的文件中会有/bin/ramips/OpenWrt-SDK-ramips-for-linux-x86_64-gcc-4.6-linaro_uClibc-0.9.33.2.tar.bz2文件
2.然后解压这个文件
tar xvf OpenWrt-SDK-ramips-for-linux-x86_64-gcc-4.6-linaro_uClibc-0.9.33.2.tar.bz2
进入这个sdk,会看见一个package,在下新建mkdir -p helloworld/src 两个目录
在目录src下新建helloworld.c
然后在此目录下创建Makefile( 注意Makefile的语法要用tab )
然后返回上层目录,即helloworld目录,在此目录下创建一个Makefile
这里的Makefile文件要注意tab(如果是复制过去的话)
然后回到OpenWrt-SDK-ramips-for-linux-x86_64-gcc-4.6-linaro_uClibc-0.9.33.2目录执行make
编译过程会在build_dir目录下完成
make[1] world
make[2] package/compile
make[3] -C package/helloworld compile
make[2] package/index
说明编译成功
编译好的文件放置在 bin/[yourtarget]/package目录下