Ubus移植到openwrt
2015-08-13 08:43
513 查看
ubus移植到openwrt
环境为Ubuntu12.04,交叉编译工具为mipsel-openwrt-linux-gcc
首先参考杰哥的链接:
openwrt ubus 移植到ARM上 http://blog.csdn.net/h893529689/article/details/46873451 openwrt libubox 移植到ARM上 http://blog.csdn.net/h893529689/article/details/46861201
弄清楚依赖关系
要编译ubus,需要libubox,libubox又需要json-c。
源码为libubox-2014-08-04-dffbc09baf71b294185a36048166d00066d433b5.tar.gz,这个库依赖json-c 库,所以要先移植json-c库(json-c-0.11.tar.gz)。
json-c移植
具体步骤如下:
1. 解压源码
2. 编辑config.h.in 文件,一定要去掉下面两行内容,红色字体为要删除的
/*Define to rpl_malloc if the replacement function should be used. */
#undefmalloc
/*Define to rpl_realloc if the replacement function should be used. */
#undefrealloc
3. ./configure --host=mipsel-openwrt-linux --prefix=/home/yang/lib_mips/json-c
4. make
5 . make install
执行以上几个步骤,即可生成头文件和库文件到/home/yang/lib_mips/json-c中
libubox的移植
由于libubox没有configure之类的,需要用cmake生成Makefile,cmake如果没有,请自行安装。
具体的步骤如下:
1. 解压libubox源码
2. 修改CMakeList.txt文件,在文件最开始处加上如下几句(不要怀疑,就是最开始处):
红色字体为要添加的
#告知当前使用的是交叉编译方式,必须配置
SET(CMAKE_SYSTEM_NAMELinux)
#指定C交叉编译器,必须配置
#或交叉编译器使用绝对地址
SET(CMAKE_C_COMPILER"mipsel-openwrt-linux-gcc")
#指定C++交叉编译器
SET(CMAKE_CXX_COMPILER"mipsel-openwrt-linux-g++")
include_directories("/home/yang/lib_mips/json-c/include/json-c")
include_directories("/home/yang/lib_mips/json-c/include")
link_directories("/home/yang/lib_mips/json-c/lib")
3. cmake
4. make
5.修改文件cmake_install.cmake,
红色的要修改的
# Set the installprefix
IF(NOT DEFINEDCMAKE_INSTALL_PREFIX)
SET(CMAKE_INSTALL_PREFIX"/home/yang/lib_mips/libubox")
6. make install
执行以上几个步骤,即可生成头文件和库文件到/home/yang/lib_mips/libubox中
好,开始编译ubus
源码为ubus-2014-09-17-4c4f35cf2230d70b9ddd87638ca911e8a563f2f3.tar.gz,具体的步骤如下:
1.解压源码
2.修改CMakeList.txt,
首先,在开头加上如下几句,可以看到它依赖libubox。
红色的为要添加的
#告知当前使用的是交叉编译方式,必须配置
SET(CMAKE_SYSTEM_NAMELinux)
#指定C交叉编译器,必须配置
#或交叉编译器使用绝对地址
SET(CMAKE_C_COMPILER"mipsel-openwrt-linux-gcc")
#指定C++交叉编译器
SET(CMAKE_CXX_COMPILER"mipsel-openwrt-linux-g++")
INCLUDE_DIRECTORIES(/home/yang/lib_mips/json-c/include/json-c)
INCLUDE_DIRECTORIES(/home/yang/lib_mips/json-c/include)
LINK_DIRECTORIES(/home/yang/lib_mips/json-c/lib)
INCLUDE_DIRECTORIES(/home/yang/lib_mips/libubox/include/libubox)
INCLUDE_DIRECTORIES(/home/yang/lib_mips/libubox/include)
LINK_DIRECTORIES(/home/yang/lib_mips/libubox/lib)
LINK_DIRECTORIES(/home/yang/lib_mips/uiot_libs)
然后,修改以下几行其中的内容
红色的为要修改的
#find_library(jsonNAMES json-c json)
ADD_EXECUTABLE(clicli.c)
SET_TARGET_PROPERTIES(cliPROPERTIES OUTPUT_NAME ubus)
TARGET_LINK_LIBRARIES(cliubus ubox blobmsg_json json-c)
3.cmake .
4.make
5.在源码根目录即可生成库和可执行文件
ubusd 为ubus服务
ubus 为ubus客户端
6. 修改文件cmake_install.cmake
红色的要修改的
# Set the installprefix
IF(NOT DEFINEDCMAKE_INSTALL_PREFIX)
SET(CMAKE_INSTALL_PREFIX"/home/yang/lib_mips/libubus")
ENDIF(NOT DEFINEDCMAKE_INSTALL_PREFIX)
6. 修改lua目录下的cmake_install.cmake
将其中的/usr/local/lib 全部替换成/home/yang/lib_mips/libubus
7. make install
执行以上几个步骤,即可生成头文件和库文件到/home/yang/lib_mips/libubus中
完成!
环境为Ubuntu12.04,交叉编译工具为mipsel-openwrt-linux-gcc
首先参考杰哥的链接:
openwrt ubus 移植到ARM上 http://blog.csdn.net/h893529689/article/details/46873451 openwrt libubox 移植到ARM上 http://blog.csdn.net/h893529689/article/details/46861201
弄清楚依赖关系
要编译ubus,需要libubox,libubox又需要json-c。
源码为libubox-2014-08-04-dffbc09baf71b294185a36048166d00066d433b5.tar.gz,这个库依赖json-c 库,所以要先移植json-c库(json-c-0.11.tar.gz)。
json-c移植
具体步骤如下:
1. 解压源码
2. 编辑config.h.in 文件,一定要去掉下面两行内容,红色字体为要删除的
/*Define to rpl_malloc if the replacement function should be used. */
#undefmalloc
/*Define to rpl_realloc if the replacement function should be used. */
#undefrealloc
3. ./configure --host=mipsel-openwrt-linux --prefix=/home/yang/lib_mips/json-c
4. make
5 . make install
执行以上几个步骤,即可生成头文件和库文件到/home/yang/lib_mips/json-c中
libubox的移植
由于libubox没有configure之类的,需要用cmake生成Makefile,cmake如果没有,请自行安装。
具体的步骤如下:
1. 解压libubox源码
2. 修改CMakeList.txt文件,在文件最开始处加上如下几句(不要怀疑,就是最开始处):
红色字体为要添加的
#告知当前使用的是交叉编译方式,必须配置
SET(CMAKE_SYSTEM_NAMELinux)
#指定C交叉编译器,必须配置
#或交叉编译器使用绝对地址
SET(CMAKE_C_COMPILER"mipsel-openwrt-linux-gcc")
#指定C++交叉编译器
SET(CMAKE_CXX_COMPILER"mipsel-openwrt-linux-g++")
include_directories("/home/yang/lib_mips/json-c/include/json-c")
include_directories("/home/yang/lib_mips/json-c/include")
link_directories("/home/yang/lib_mips/json-c/lib")
3. cmake
4. make
5.修改文件cmake_install.cmake,
红色的要修改的
# Set the installprefix
IF(NOT DEFINEDCMAKE_INSTALL_PREFIX)
SET(CMAKE_INSTALL_PREFIX"/home/yang/lib_mips/libubox")
6. make install
执行以上几个步骤,即可生成头文件和库文件到/home/yang/lib_mips/libubox中
好,开始编译ubus
源码为ubus-2014-09-17-4c4f35cf2230d70b9ddd87638ca911e8a563f2f3.tar.gz,具体的步骤如下:
1.解压源码
2.修改CMakeList.txt,
首先,在开头加上如下几句,可以看到它依赖libubox。
红色的为要添加的
#告知当前使用的是交叉编译方式,必须配置
SET(CMAKE_SYSTEM_NAMELinux)
#指定C交叉编译器,必须配置
#或交叉编译器使用绝对地址
SET(CMAKE_C_COMPILER"mipsel-openwrt-linux-gcc")
#指定C++交叉编译器
SET(CMAKE_CXX_COMPILER"mipsel-openwrt-linux-g++")
INCLUDE_DIRECTORIES(/home/yang/lib_mips/json-c/include/json-c)
INCLUDE_DIRECTORIES(/home/yang/lib_mips/json-c/include)
LINK_DIRECTORIES(/home/yang/lib_mips/json-c/lib)
INCLUDE_DIRECTORIES(/home/yang/lib_mips/libubox/include/libubox)
INCLUDE_DIRECTORIES(/home/yang/lib_mips/libubox/include)
LINK_DIRECTORIES(/home/yang/lib_mips/libubox/lib)
LINK_DIRECTORIES(/home/yang/lib_mips/uiot_libs)
然后,修改以下几行其中的内容
红色的为要修改的
#find_library(jsonNAMES json-c json)
ADD_EXECUTABLE(clicli.c)
SET_TARGET_PROPERTIES(cliPROPERTIES OUTPUT_NAME ubus)
TARGET_LINK_LIBRARIES(cliubus ubox blobmsg_json json-c)
3.cmake .
4.make
5.在源码根目录即可生成库和可执行文件
ubusd 为ubus服务
ubus 为ubus客户端
6. 修改文件cmake_install.cmake
红色的要修改的
# Set the installprefix
IF(NOT DEFINEDCMAKE_INSTALL_PREFIX)
SET(CMAKE_INSTALL_PREFIX"/home/yang/lib_mips/libubus")
ENDIF(NOT DEFINEDCMAKE_INSTALL_PREFIX)
6. 修改lua目录下的cmake_install.cmake
将其中的/usr/local/lib 全部替换成/home/yang/lib_mips/libubus
7. make install
执行以上几个步骤,即可生成头文件和库文件到/home/yang/lib_mips/libubus中
完成!
相关文章推荐
- 把jQuery的each(callback)方法移植到c#中
- IIS 服务器的备份和移植技巧
- 解析libcurl在android下的移植、编译与测试
- Objective-c代码如何移植为Swift代码 Objective-c代码转移到Swift过程介绍
- ok6410开发板移植DirectFB手记
- J2ME游戏移植到Android平台的方法
- J2me游戏如何快速移植到Android(1)
- J2me游戏如何快速移植到Android (2)
- android与j2me移植之clipRect
- 移植linux-2.6.30.4到S3C2440
- 触摸屏驱动移植(mini2440,linux-2.6.32.7)
- boa服务器移植
- C++ 64位的平台兼容性
- 向Tiny210移植Debian Linux
- U-Boot-2009-03移植笔记(移植准备)
- U-Boot-2009-03移植笔记(点亮第一展灯)
- Android NDK r8b 和 FFmpeg 0.11.2 移植
- 移植Linux到SAMSUNG S3C2410开发板
- 看rom助手如何教你脱离伸手党,做出自己的rom
- U-Boot移植全程指导