阿里iotkit-embedded移植到openwrt

1,说明

iotkit-embedded本身支持ubuntu,所以移植到openwrt也就是把工具链改成openwrt的交叉编译工具链。

2,获取源码

a,通过【git clone  https://github.com/aliyun/iotkit-embedded.git】命令下载 iotkit-embedded源码。
下载已修改好的iotkit-embeddded代码,可以跳以下几步,或者依照以下步骤适配自己喜欢的平台。

3,创建配置文件

touch src/configs/config.mips-openwrt.mtk7688 (旧版本)
touch src/board/config.mips-openwrt.mtk7688  (iotx-2.2.1 +)
并添加如下内容
 
 
 CONFIG_ENV_CFLAGS += -Wall 
 
 OVERRIDE_CC = mipsel-openwrt-linux-gcc 
 OVERRIDE_AR = mipsel-openwrt-linux-ar (注意,不要使用mipsel-openwrt-linux-gcc-ar,否则会出现“sorry - this program has been built without plugin support”错误)
 
CONFIG_src/platform = 
CONFIG_sample = 
CONFIG_src/sdk-tests =

4, 创建hal层文件

 cp src/ref-impl/hal/os/unbutn src/ref-impl/hal/os/mips_openwrt 

注意文件夹名与3中配置文件名中间段相同
根据硬件平台修改mips_openwrt文件夹内的代码,若是linux刚不需要修改,这里不修改。

5,添加环境变量

把你的openwrt交叉工具链目录添加到环境变量

6,编译

a,  选择配置文件 make reconfig

$ make reconfig 
SELECT A CONFIGURATION: 
1) config.mips.mtk7600 
2) config.ubuntu.x86 
3) config.mdm9206.sim7000c 
4) config.win7.mingw32 
#? 1
b, 执行  make all  进行编译

7,生成动态库方法

a, 修改src/ref-impl/hal/iot.mk,顶部增加LIBSO_TARGET := libiot_hal.so
修改src/ref-impl/tls/iot.mk,顶部增加LIBSO_TARGET := libiot_tls.so
b, 修src/board/config.mips_openwrt.mtk7688
增加CONFIG_LIB_EXPORT := dynamic
PS: 先设置工具链环境变量,再make reconfig后,直接执行make all
若执行make后再执行make all,不会生成libiot_sdk.so
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值