CWMP Open Source Code research 7--CWMP Transplant

Source: Internet
Author: User

Original works, reproduced please indicate the source, strictly prohibited illegal reprint. If there are errors, please leave a message!

Email:[email protected]

Disclaimer: This series involves the open source program code learning and research, strictly prohibited for commercial purposes. If you have any questions, please feel free to contact me. (Penguin number: 408797506)

File package download path for this article: http://download.csdn.net/detail/eryunyong/9735149

I. Environment
1.gnu/linux Centos6.5 operating system
2.GCC
two. Installation of dependent packages
1. expat-2.1.0
1) Download installation package expat-2.1.0.tar.gz, path http://www.libexpat.org/
2) Extract
  TAR-XVF expat-2.1.0.tar.gz
3) Enter directory
  CD expat-2.1.0;mkdir tmp
4) Configure the installation path to TMP
  ./configure -- prefix= $PWD/tmp (if the local Linux system requires only./configure)
5) Install
  Make;make install
6) Copy the corresponding files in the TMP directory to the desired location ( skip )

2. openssl-1.0.2 (skip temporarily)
Because Curl's installation package relies on OpenSSL and the HTTPS security of SSL certificates in CWMP, install the OpenSSL
1) before installing the installation package openssl-1.0.2.tar.gz, the path HTTP/ distfiles.macports.org/openssl/
2) Unzip
  TAR-XVF openssl-1.0.2.tar.gz
3) Enter directory
  CD Openssl-1.0.2;mkdir tmp;mkdir TMP/OPENSSL
4) Configuring the installation path and configuration file path
 ./config gkfx--prefix= $PWD/tmp-- openssldir= $PWD/tmp/openssl (if local Linux system, only./config shared)
5) Installation
  Make;make install
6) Copy the corresponding file in the TMP directory to the desired location ( skip )

3.curl-7.21.4
1) Download the installation package curl-7.21.4.tar.gz, path: Http://pkgs.fedoraproject.org/repo/pkgs/curl /
2) Unzip
  TAR-XVF curl-7.21.4.tar.gz
3) Enter directory
  CD curl-7.21.4;mkdir tmp
4) Configure the installation path and SSL options ( SSL support is placed in a later Advanced section specifically)
 ./configure--without-ssl --prefix= $PWD/tmp
5) Installation
  Make;make Install
6) Copy the corresponding file in the TMP directory to the desired location ( skip )
Here, cwmp The core-dependent installation package is complete.


three. Install cwmp
because CWMP core is not open source, there is a compiled installer under X86 Centos6.5 platform. If there is a different environment for readers to need this program, you can leave a message. The
copies the compiled executable file cwmp to the computer or to the device's feasibility path.

four. LIBCWMP Library installation
Here is the storage and operation of data, we know that OpenWrt introduced the UCI, is a set of configuration parameter management system. So first of all we need to understand the basic operation and knowledge of UCI, this is not introduced here, in addition to the embedded SQLite can also be used to manage data.
1. UCI installation
  in order to facilitate the subsequent development, here is the migration of the previous product developed in the Luci, the main change is in the/usr/config/below a dynamic storage parameters, and in/etc/ The configuration under the config/directory is the default parameter configuration. That is, when the UCI program obtains a configuration parameter information, it first loads the configuration from the/usr/config/directory and returns if read. If it is not read, then load the configuration from the/etc/config/directory.
1) Download installation package uci-0.4.0.tar.gz, path http://distfiles.macports.org/openssl/
2) Extract
  TAR-XVF uci-0.4.0.tar.gz
3) Enter directory
  CD uci-0.4.0;mkdir tmp
4) Compile
   make
5) Install (skip)
   *.h *.so Copy generated To the desired location
note: You can also manually modify the makefile install rules under the source directory and make install.
2) libcwmp install
   provide source code, you can freely develop. Put the compiled so into the/usr/lib directory. (need source can message email address)

Five. Download the installation package

Download path: http://download.csdn.net/detail/eryunyong/9735149

Based on the above, I put the dependencies of the dependent packages (dynamic library and header files) and the configuration of the test data into a package file, and wrote the corresponding script file. The following is a description of the use, available for reference.
Instructions for using the script:
If you're like me, you've installed the Centos6.5 system under the X86 platform, you only need to unzip the installation package and execute the make command to complete the CWMP core installation and the files required by all dependent package programs.
How the environment is different, such as the use of Ubuntu or Fedora system, directly execute my Centos6.5 environment compiled program will encounter many errors, some shared library error, some software version inconsistency (such as glibc), etc. (refer to the sixth section).
Therefore, in addition to CWMP core no source code, all other programs are recommended to recompile, and the resulting program or dependent files (dynamic libraries and header files) into your environment.

Download the installation package and see the following directory after unpacking:

The above dependency package used by Cwmp_dep_packet.

The ETC and USR directories hold data.

Lib and include store the header files and dynamic libraries (which do not require a static library) that are compiled by the above dependency packages. (now understand why the last step of relying on package installation is "Skip over", just copy all installed programs here and do make to automate the CWMP deployment )

The bin is an executable program that is used.

The configuration data used by the script install_dep.sh installation. (can be operated separately)

Script install_dep.sh.sh The dependent files that are used to install. (can be operated separately)

The/lib/link.sh script is a soft connection to create a dynamic library so file used in the Lib directory. (can be operated separately)

The makefile is mostly done with the actions of the above three scripts.

Six. Testing

Before testing, you must first configure the parameters and the environment.

The file location corresponding to the ACS URL and the CPE address is modified according to your environment.

Execute command:

-f/etc/config/cwmp_global.conf

Log is output to the/tmp/log/cwmp1.log file by default and can be viewed using the command tail-f/tmp/log/cwmp1.log. If you need to modify the log storage path, you can modify the path in the configuration/etc/config/log1.conf file.

Note: The/tmp/log directory will be created after the first installation, and the/tmp/log directory must be created manually each time it starts because the content in the TMP directory is restarted.

Seven. Cross-platform or operating system issues

Instead of recompiling a dependent package and program for reference, the following is an error that was encountered in porting the Ubuntu12.04 operating system's dependencies directly to the Centos6.5 migration process:

Question one:

Cwmp:error while loading shared libraries:librtmp.so.0:cannot open Shared object file:no such file or directory
Reason:
[[email protected] X86 transplant]# grep "rtmp". -R
Binary file./lib/libcurl.so.4.2.0 matches
Workaround:
1) Recompile Libcurl Remove the RTMP protocol support, (2) or install the RTMP library on the CentOS system, while installing the RTMP protocol requires support from OpenSSL and zlib libraries.
Reference: http://blog.csdn.net/u014037733/article/details/22978887
Here in the first way, recompile libcurl, remove librtmp support. Option--without-librtmp
That is, use the command when configuring Libcurl:./configure--without-ssl--prefix= $PWD/tmp--without-librtmp
Finally copy the made file to the desired location.

Question two:
[Email protected] X86 Transplant]# Easycwmp-f/etc/config/cwmp_global.conf
EASYCWMP:/lib/libc.so.6:version ' glibc_2.15 ' not found (required by EASYCWMP)
EASYCWMP:/lib/libldap_r-2.4.so.2:no version information available (required by/usr/lib/libcurl.so.4)
EASYCWMP:/lib/libc.so.6:version ' glibc_2.15 ' not found (required by/usr/lib/libcurl.so.4)
Cause: The glibc version is too low to upgrade. Reference: http://blog.csdn.net/hnhuangyiyang/article/details/50392997

Seven. Porting to platforms such as Arm,mips
Because the majority of readers are not able to practice (without the Development Board), the porting of the X86 platform is more detailed. Refer to the above steps, it should be easy to transplant success, as for other platforms of the transplant, in the future according to the reader's message to consider whether to write a cross-platform porting.
To cross-compile, provide a cross-compilation toolchain, and I'll send you the compiled CWMP core program.

CWMP Open Source Code research 7--CWMP Transplant

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.