1.平台
MT7628

2.交叉编译器及版本信息
mipsel-linux + buildroot-gcc463_32bits.tar.bz2

3.创建工作目录
lancer@ubuntu:~$ mkdir -p tr069/usr

lancer@ubuntu:~/tr069/usr$ pwd
/home/lancer/tr069/usr

4.移植json-c -----------------------------------------------------------------------------------------------
root@ubuntu:/home/lancer/tr069# git clone git://github.com/json-c/json-c.git
cd json-c

Generate configuration files:
# sh autogen.sh

Configure:
# ./configure --prefix=/home/lancer/tr069/usr --host=mipsel-linux

# make
# make install
# ln -sf /home/lancer/tr069/usr/include/json-c /usr/include/json

5.移植libubox ----------------------------------------------------------------------------------------------
root@ubuntu:/home/lancer/tr069# git clone git://nbd.name/luci2/libubox.git
cd libubox

Configure:
vim CMakeLists.txt #在前边添加如下配置,注意是最前边
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_C_COMPILER "mipsel-linux-gcc")
SET(CMAKE_CXX_COMPILER "mipsel-linux-g++")
INCLUDE_DIRECTORIES("/home/lancer/tr069/usr/include/")
INCLUDE_DIRECTORIES("/home/lancer/tr069/usr/include/json-c")
LINK_DIRECTORIES("/home/lancer/tr069/usr/lib")

(cmake如何清除编译缓存,root@ubuntu:/home/lancer/tr069/libubox# rm CMakeCache.txt)
root@ubuntu:/home/lancer/tr069/libubox# cmake CMakeLists.txt -DBUILD_LUA=OFF -DCMAKE_INSTALL_PREFIX=/home/lancer/tr069/usr
-- The C compiler identification is GNU
-- Check for working C compiler: /opt/buildroot-gcc463/usr/bin/mipsel-linux-cc
-- Check for working C compiler: /opt/buildroot-gcc463/usr/bin/mipsel-linux-cc -- works #说明添加OK

Build:
root@ubuntu:/home/lancer/tr069/libubox# make
Scanning dependencies of target ubox
[ 3%] Building C object CMakeFiles/ubox.dir/avl.c.o
[ 6%] Building C object CMakeFiles/ubox.dir/avl-cmp.c.o
[ 9%] Building C object CMakeFiles/ubox.dir/blob.c.o
[ 12%] Building C object CMakeFiles/ubox.dir/blobmsg.c.o
[ 16%] Building C object CMakeFiles/ubox.dir/uloop.c.o
[ 19%] Building C object CMakeFiles/ubox.dir/usock.c.o
[ 22%] Building C object CMakeFiles/ubox.dir/ustream.c.o
[ 25%] Building C object CMakeFiles/ubox.dir/ustream-fd.c.o
[ 29%] Building C object CMakeFiles/ubox.dir/vlist.c.o
[ 32%] Building C object CMakeFiles/ubox.dir/utils.c.o
[ 35%] Building C object CMakeFiles/ubox.dir/safe_list.c.o
[ 38%] Building C object CMakeFiles/ubox.dir/runqueue.c.o
[ 41%] Building C object CMakeFiles/ubox.dir/md5.c.o
[ 45%] Building C object CMakeFiles/ubox.dir/ulog.c.o
Linking C shared library libubox.so
[ 45%] Built target ubox
Scanning dependencies of target blobmsg_json
[ 48%] Building C object CMakeFiles/blobmsg_json.dir/blobmsg_json.c.o
In file included from /home/lancer/tr069/libubox/blobmsg_json.c:17:0:
/home/lancer/tr069/libubox/blobmsg_json.h:22:24: fatal error: json/json.h: No such file or directory
compilation terminated.
make[2]: *** [CMakeFiles/blobmsg_json.dir/blobmsg_json.c.o] Error 1
make[1]: *** [CMakeFiles/blobmsg_json.dir/all] Error 2
make: *** [all] Error 2
解决方案:
我们前边已经包含了头文件路径,"/home/lancer/tr069/usr/include/json-c",把所有"json/json.h",改为"json.h"再重新编译
/home/lancer/tr069/libubox/blobmsg_json.c: In function '__blobmsg_add_json':
/home/lancer/tr069/libubox/blobmsg_json.c:78:2: error: implicit declaration of function 'is_error' [-Werror=implicit-function-declaration]
cc1: all warnings being treated as errors
make[2]: *** [CMakeFiles/blobmsg_json.dir/blobmsg_json.c.o] Error 1
make[1]: *** [CMakeFiles/blobmsg_json.dir/all] Error 2
make: *** [all] Error 2
解决方案:
vim blobmsg_json.c +78添加头文件
#include "bits.h"重新编译OK

Install:
sudo make install
sudo ln -sf /usr/local/lib/libubox.so /usr/lib/libubox.so
sudo mkdir -p /usr/share/libubox
sudo ln -sf /usr/local/share/libubox/jshn.sh /usr/share/libubox/jshn.sh

6.移植uci--------------------------------------------------------------------------------------------------
Get the sources:
lancer@ubuntu:~/tr069$ git clone git://nbd.name/uci.git
cd uci

Configure:
vim CMakeLists.txt #在前边添加如下配置,注意是最前边
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_C_COMPILER "mipsel-linux-gcc")
SET(CMAKE_CXX_COMPILER "mipsel-linux-g++")
INCLUDE_DIRECTORIES("/home/lancer/tr069/usr/include/")
LINK_DIRECTORIES("/home/lancer/tr069/usr/lib")
root@ubuntu:/home/lancer/tr069/uci# cmake CMakeLists.txt -DBUILD_LUA=OFF -DCMAKE_INSTALL_PREFIX=/home/lancer/tr069/usr2

Build:
make

Install:
class="western"
sudo make install
sudo ln -sf /usr/local/bin/uci /sbin/uci
sudo ln -sf /usr/local/lib/libuci.so /usr/lib/libuci.so

7.移植ubus-------------------------------------------------------------------------------------------------
Get the sources:
root@ubuntu:/home/lancer/tr069# git clone git://nbd.name/luci2/ubus.git
cd ubus

Configure:
vim CMakeLists.txt #在前边添加如下配置,注意是最前边
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_C_COMPILER "mipsel-linux-gcc")
SET(CMAKE_CXX_COMPILER "mipsel-linux-g++")
INCLUDE_DIRECTORIES("/home/lancer/tr069/usr/include/")
INCLUDE_DIRECTORIES("/home/lancer/tr069/usr/include/json-c")
LINK_DIRECTORIES("/home/lancer/tr069/usr/lib")
root@ubuntu:/home/lancer/tr069/ubus# cmake CMakeLists.txt -DBUILD_LUA=OFF -DCMAKE_INSTALL_PREFIX=/home/lancer/tr069/usr

Build:
make

Install:
sudo make install
sudo ln -sf /usr/local/sbin/ubusd /usr/sbin/ubusd
sudo ln -sf /usr/local/lib/libubus.so /usr/lib/libubus.so

8.移植microxml---------------------------------------------------------------------------------------------
Get the sources:
root@ubuntu:/home/lancer/tr069# git clone https://github.com/pivasoftware/microxml.git
cd microxml

Generate configuration files:
root@ubuntu:/home/lancer/tr069/microxml# autoconf -i

Configure:
root@ubuntu:/home/lancer/tr069/microxml# ./configure --prefix=/home/lancer/tr069/usr --host=mipsel-linux --enable-threads --enable-shared --enable-static

Build:
make

Install:
sudo make install
sudo ln -sf /usr/lib/libmicroxml.so.1.0 /lib/libmicroxml.so
sudo ln -sf /usr/lib/libmicroxml.so.1.0 /lib/libmicroxml.so.1

9.移植curl
下载:https://curl.haxx.se/download.html :curl-7.53.1.tar.gz
cd curl-7.53.1

Configure:
root@ubuntu:/home/lancer/tr069/curl-7.53.1# ./configure --prefix=/home/lancer/tr069/usr --host=mipsel-linux

Build:
make

Install:
sudo make install

10.移植easycwmp-----------------------------------------------------------------------------------------------
官网下载:http://www.easycwmp.org/download.html : 我选择easycwmp-1.5.2.tar.gz
cd easycwmp-1.5.2

Generate configuration files:
root@ubuntu:/home/lancer/tr069/easycwmp-1.5.2# autoreconf -i

Configure:
./configure --prefix=/home/lancer/tr069/usr --host=mipsel-linux --enable-debug --enable-devel --enable-acs=multi --enable-jsonc=1 --x-includes=/home/lancer/tr069/usr/include/ --x-libraries=-L/home/lancer/tr069/usr/lib
......
checking for LIBCURL... no
configure: error: Package requirements (libcurl) were not met:

Package libcurl was not found in the pkg-config search path.
Perhaps you should add the directory containing `libcurl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libcurl' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables LIBCURL_CFLAGS
and LIBCURL_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
解决方案:
root@ubuntu:/home/lancer/tr069/easycwmp-1.5.2# PKG_CONFIG_PATH=/home/lancer/tr069/usr//lib/pkgconfig:$PKG_CONFIG_PATH
root@ubuntu:/home/lancer/tr069/easycwmp-1.5.2# export PKG_CONFIG_PATH
root@ubuntu:/home/lancer/tr069/easycwmp-1.5.2# echo $PKG_CONFIG_PATH
/home/lancer/tr069/usr//lib/pkgconfig:
root@ubuntu:/home/lancer/tr069/easycwmp-1.5.2# ./configure --prefix=/home/lancer/tr069/usr --host=mipsel-linux --enable-debug --enable-devel --enable-acs=multi --enable-jsonc=1
OK
或者vim /opt/buildroot-gcc463/usr/bin/pkg-config修改
#!/bin/sh
#PKG_CONFIG_LIBDIR=${PKG_CONFIG_LIBDIR:-/opt/buildroot-gcc463/usr/mipsel-buildroot-linux-uclibc/sysroot/usr/lib/pkgconfig:/opt/buildroot-gcc463/usr/mipsel-buildroot-linux-uclibc/sysroot/usr/share/pkgconfig} PKG_CONFIG_SYSROOT_DIR=${PKG_CONFIG_SYSROOT_DIR:-/opt/buildroot-gcc463/usr/mipsel-buildroot-linux-uclibc/sysroot} $(dirname $0)/pkgconf $@
PKG_CONFIG_LIBDIR=${PKG_CONFIG_LIBDIR:-/home/lancer/tr069/usr/lib/pkgconfig:/home/lancer/tr069/usr/share/pkgconfig} PKG_CONFIG_SYSROOT_DIR=${PKG_CONFIG_SYSROOT_DIR:-} $(dirname $0)/pkgconf $@
为PKG_CONFIG_LIBDIR=${PKG_CONFIG_LIBDIR:-/home/lancer/tr069/usr/lib/pkgconfig:/home/lancer/tr069/usr/share/pkgconfig} PKG_CONFIG_SYSROOT_DIR=${PKG_CONFIG_SYSROOT_DIR:-/opt/buildroot-gcc463/usr/mipsel-buildroot-linux-uclibc/sysroot} $(dirname $0)/pkgconf $@
当然第二种更好,不然编译还会有如下问题。

Build:
make
root@ubuntu:/home/lancer/tr069/easycwmp-1.5.2# make
Making all in bin
make[1]: Entering directory `/home/lancer/tr069/easycwmp-1.5.2/bin'
mipsel-linux-gcc -DPACKAGE_NAME=\"easycwmpd\" -DPACKAGE_TARNAME=\"easycwmpd\" -DPACKAGE_VERSION=\"1.5.2\" -DPACKAGE_STRING=\"easycwmpd\ 1.5.2\" -DPACKAGE_BUGREPORT=\"mohamed.kallel@pivasoftware.com\" -DPACKAGE_URL=\"\" -DPACKAGE=\"easycwmpd\" -DVERSION=\"1.5.2\" -DPACKAGE=\"easycwmpd\" -DVERSION=\"1.5.2\" -DJSONC=1 -DDEBUG=1 -DDEVEL=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -I. -I/opt/buildroot-gcc463/usr/mipsel-buildroot-linux-uclibc/sysroot/home/lancer/tr069/usr/include -D_THREAD_SAFE -D_REENTRANT -I/opt/buildroot-gcc463/usr/mipsel-buildroot-linux-uclibc/sysroot/home/lancer/tr069/usr/include -g -O2 -MT ../src/easycwmpd-backup.o -MD -MP -MF ../src/.deps/easycwmpd-backup.Tpo -c -o ../src/easycwmpd-backup.o `test -f '../src/backup.c' || echo './'`../src/backup.c
In file included from ../src/backup.c:13:0:
../src/backup.h:15:22: fatal error: microxml.h: No such file or directory
compilation terminated.
make[1]: *** [../src/easycwmpd-backup.o] Error 1
make[1]: Leaving directory `/home/lancer/tr069/easycwmp-1.5.2/bin'
make: *** [all-recursive] Error 1
看前边。

自此,tr069相关库及程序都已交叉编译完毕。

tr069开源协议EasyCwmp移植的更多相关文章

  1. tr069开源代码——cwmp移植

    原创作品,转载请注明出处,严禁非法转载.如有错误,请留言! email:40879506@qq.com 声明:本系列涉及的开源程序代码学习和研究,严禁用于商业目的. 如有任何问题,欢迎和我交流.(企鹅 ...

  2. 聊聊 Apache 开源协议

    摘要 用一句话概括 Apache License 就是,你可以用这代码,但是如果开源你必须保留我写的声明:你可以改我的代码,但是如果开源你必须写清楚你改了哪些:你可以加新的协议要求,但不能与我所 公布 ...

  3. 五种开源协议(GPL,LGPL,BSD,MIT,Apache)

    什么是许可协议? 什么是许可,当你为你的产品签发许可,你是在出让自己的权利,不过,你仍然拥有版权和专利(如果申请了的话),许可的目的是,向使用你产品的人提供 一定的权限. 不管产品是免费向公众分发,还 ...

  4. [转]五种开源协议的比较(BSD,Apache,GPL,LGPL,MIT)

    当Adobe.Microsoft.Sun等一系列巨头开始表现出对"开源"的青睐时,"开源"的时代即将到来!现今存在的开源协议很多,而经过Open Source ...

  5. 四大开源协议比较:BSD、Apache、GPL、LGPL (转)

    转自:http://www.lupaworld.com/portal.php?mod=view&aid=205552&page=all 本文参考文献:http://www.fsf.or ...

  6. 五种开源协议的比较(BSD,Apache,GPL,LGPL,MIT)

    当Adobe.Microsoft.Sun等一系列巨头开始表现出对”开源”的青睐时,”开源”的时代即将到来!现今存在的开源协议很多,而经过Open Source Initiative组织通过批准的开源协 ...

  7. 五种开源协议的比较(BSD_Apache_GPL_LGPL_MIT)

    现今存在的开源协议很多,而经过Open Source Initiative组织通过批准的开源协议目前有58种(http://www.opensource.org/licenses/alphabetic ...

  8. 四大开源协议:BSD、Apache、GPL、LGPL

    参考文献:http://www.fsf.org/licensing/licenses/ 现今存在的开源协议很多,而经过Open Source Initiative组织通过批准的开源协议目前有58种.我 ...

  9. 五种开源协议的比较(BSD,Apache,GPL,LGPL,MIT)(整理)

    BSD开源协议(original  BSD license.FreeBSD  license.Original  BSD license) BSD开源协议是一个给于使用者很大自由的协议.基本上使用者可 ...

随机推荐

  1. Python 正则表达式(字符)详解

    Python正则表达式 - 简介 ​    其实正则表达式这种技术,源于一个很简单的问题:  如何通过变成使得计算机具有在文本中检索某种模式的能力? ​     而正则表达式为通过编程实现高级的文本模 ...

  2. Ichars制作数据统计图

    数据统计图基本上每个网站的后台都要做,不仅要做还要的非常详细才行,这样才能全面的具体的了解网站数据.之前用的jfreechart没有iChartjs用着方便,也没有iChartjs的效果炫,所以果断弃 ...

  3. Prince2是怎么考试的?想了解P2

    自己在项目管理培训的行业已经有了5年的时间,经历了很多的学员和企业,和他们交流的问题,话题也很多. 在前几年,对于项目经理来讲关注的很多是单项目管理的工具技术模板,谈论最多的是,进度延期,成本超支,范 ...

  4. Bzoj超级经验大放送题集(好评如潮哦~~~)

    其实这些是因为没有数据才形成的...唯一可惜的是这些都是需要300软妹币才能打开的萌萌哒权限题*^_^* 好啦,吾来教你如何快速AC么么哒 pascal: 1 begin end. //Pascal ...

  5. js中call、apply、bind那些事

    前言 回想起之前的一些面试,几乎每次都会问到一个js中关于call.apply.bind的问题,比如- 怎么利用call.apply来求一个数组中最大或者最小值 如何利用call.apply来做继承 ...

  6. 计算机程序的思维逻辑 (74) - 并发容器 - ConcurrentHashMap

    本节介绍一个常用的并发容器 - ConcurrentHashMap,它是HashMap的并发版本,与HashMap相比,它有如下特点: 并发安全 直接支持一些原子复合操作 支持高并发.读操作完全并行. ...

  7. JSON的服务器开发之路

    JSON的服务器开发之路 不知道需要哪儿些包... /dcywpt/WebRoot/WEB-INF/lib/commons-collections-3.2.jar /dcywpt/WebRoot/WE ...

  8. 转载 感受K2.Net 2003工作流解决方案

    接触SourceCode公司的工作流产品K2.NET 2003有一段时间了,想把一些心得分享出来,和各位共同探讨一下,抛砖引玉,希望能对相关人士以启发. K2.Net 2003是基于微软.Net Fr ...

  9. windows phone 8.1开发SQlite数据库引用安装

    原文出自:http://www.bcmeng.com/windows-phone-sqlite/ windows phone 8.1开发SQlite数据库引用安装 第一步: 安装SQlite forw ...

  10. [python爬虫]爬取学校教务处成绩

    学校教务处网站 登陆窗口 表单数据 观察登陆窗口和提交的表单数据可知只要将账号.密码.验证码正确赋值提交即可模拟登陆. 账号和密码都有,问题的关键就在验证码上. 右键验证码图片审查观察源码如下图: 刚 ...