Static compilation of Web Server appweb (with matrixssl support) for arm9-+ Linux

Source: Internet
Author: User
Tags builtin
Among the many web servers, there are many lightweight Web servers, such as BOA, thttp, and Lighttpd, however, for Embedded Web servers with high security and convenience for later web development and development, the Web servers mentioned above are too thin. the company requires that embedded products (such as routers) be managed and developed on the web with certain security performance. compared with several lightweight, embedded web servers. the final recommendations were made by Michael o'brien's two Web servers: GoAhead (http://webserver.goahead.com/webserver/webserver.htm) and appweb (http://www.appwebserver.org/downloads/appWeb/download.php ).



The former is part of goahead's embedded management framework product. This software package is mainly used to solve future embedded system development problems. This web server is very small, the size of the compiled Windows CE version is less than 60 kb, and its output is usually oriented to some small screen devices. GPL & Commercial license. It claims to be the leader of embedded web server in the future.


The latter is the first product of mbedthis company created by Michael o'brien, GPL & Commercial License. mob described it as mini-Apache. in the process of use, we can also feel this: Through appweb. the conf configuration file supports dynamic loading of modules. the above two Web servers are the first choice for most routers and other devices. The following describes the main features of these two Web servers:


Appweb features (too lazy to translate ):


Appweb is a standards-based embedded HTTP server that has a wealth of features including:

1, standards compliant HTTP/1.1 web server core

2, embeddable in applications and devices (supports xip)

3, dynamically loadable modules

4. Embedded Server Pages (ESP) for dynamic content (in fact, it is used to support ASP modules like goahead)

5. session State Data Management

6. server-side embedded Javascript

7. Secure Socket Layer (SSL): (OpenSSL and matrixssl)

8, in-process CGI as well as traditional CGI

9. romable web pages and configuration files

10, digest authentication ********

11. HTTP client program and Library

12, extensive logging

13. Fastest performance in its class

14. modular source code and documentation provided

15. APACHE-style configuration, logging, and single-and multi-threaded apps.


Because the company's products should consider security issues, we must point out the SSL 3.0 implementation of matrixssl. matrixssl is an SSL designed for embedded products, which is much smaller than OpenSSL. GPL & Commercial License occupies about 50 k ram.


In terms of performance, a 68040 processor of 24mh Z can respond 20 times/second, and a 266mhz Pentium processor can respond 50 times/second. It has the following features:

1. Support for ASP

2. Supports embedded Javascript

3. Standard CGI execution

4. Memory CGI processing gofroms

5. Extended APIs

6. Fast response. More than 50 requests can be processed per second.

7. fully compatible with the standard

8. If SSL is not included, only 60 kb of memory is required. If SSL is included, KB of memory is required.

9. The web page may exist in the ROM or file system.

10. Supports multiple operating systems, including ECOs, Linux, lynxos, QNX, VxWorks, WinCE, and PSOs.



Goahead requires you to specify goahead on the homepage when using it. I think this is not very good, so I mainly transplanted appweb. it may be that Chinese people use it less and only see one post. for more information, there are still many problems and SSL is not supported. later, I read the English document, read the relevant questions on the appweb forum, and finally solved a lot of questions. I successfully transplanted them to at91rm9200dk + linux. in order to avoid detours, the original is a rare one. Today, it is suspended. I think it should be more detailed.


Note: The environment is cent OS 4.4 {kernel version: 2.6.9-42.el, GCC version: 3.4.6 (Red Hat 3.4.6-3 )}

Crosstool: Arm-softfloat-Linux-GNU-GCC gcc-3.4.1-glibc-2.3.3


1, download the appweb source code: http://www.appwebserver.org/software/appweb-src-2.4.0-0.tar.gz


2. Unzip the package:

# Tar-xvzf appwe-src-2.4.0-0.tar.gz-C/usr/local/src


3. Modify the environment variable:


Modify ccar LD ranlib strip as a cross-compiling environment tool;

Modify cc_for_build to pc gcc:


Write the shell script export. Sh as follows:


#! /Bin/bash


Exportcc = "/opt/crosstool/gcc-3.4.1-glibc-2.3.3/ARM-softfloat-Linux-GNU/bin/ARM-softfloat-Linux-GNU-GCC"

Exportar = "/opt/crosstool/gcc-3.4.1-glibc-2.3.3/ARM-softfloat-Linux-GNU/bin/ARM-softfloat-Linux-GNU-AR"

Exportlds = "/opt/crosstool/gcc-3.4.1-glibc-2.3.3/ARM-softfloat-Linux-GNU/bin/ARM-softfloat-Linux-GNU-LD"

Exportranlib = "/opt/crosstool/gcc-3.4.1-glibc-2.3.3/ARM-softfloat-Linux-GNU/bin/ARM-softfloat-Linux-GNU-ranlib"

Exportstrip = "/opt/crosstool/gcc-3.4.1-glibc-2.3.3/ARM-softfloat-Linux-GNU/bin/ARM-softfloat-Linux-GNU-strip"

Exportcc_for_build = "GCC"

Echo "@ done! "


# Source export. Sh or. Export. Sh run the shell script and make it take effect.



4, download matrixssl source code: http://www.matrixssl.org/download.html


5. decompress the package to/usr/local:

# Tar-xvzf matrixssl-1-8-3-open.tar.gz-C/usr/local


6, go to/usr/local/src/matrixssl-1-8-3-open/src to modify makefile:


Modify CC, strip, AR, and ranlib as our cross compiler, for example:

Cc =/opt/crosstool/gcc-3.4.1-glibc-2.3.3/ARM-softfloat-Linux-GNU/bin/ARM-softfloat-Linux-GNU-gcc



7. Make

The dynamic link library libmatrixssl. So and static Link Library libmatrixsslstatic. A will be generated in the current directory.




8. Perform./configure on appweb:

# Cd/usr/local/src/appweb-src-2.4.0


#. /Configure -- Host = arm-atmel-linux -- Build = i686-pc-linux -- Port = 80 -- type = release -- disable-log -- disable-multi-thread -- disable-shared -- disable-Samples -- disable-shared-libc -- enable-static -- disable-test -- disable-access-log -- enable-ejs -- disable-modules -- With-CGI = builtin
-- With-copy = builtin -- With-auth = builtin -- With-ESP = builtin -- With-upload = builtin -- without-C-API -- without-php5 -- With-SSL = builtin -- -matrixssl = builtin -- With-matrixssl-Dir =/usr/local/matrixssl/src -- With-matrixssl-libpath =/usr/local/matrixssl/src -- With-matrixssl-iflags = "-I
/Usr/local/matrixssl/src "-- with-matrixssl-libs = libmatrixsslstatic



You can use. /configure -- help to view related instructions. -With-matrixssl-libs: This option tells the linker which matrixssl lib library is linked when an appweb executable file is generated. if you want to dynamically compile, choose libmatrixssl. so, in this case, we should specify withmatrixssllibs = libmatrixssl; if you want to statically compile, we should choose libmatrixsslstatic. A static library file. in this case, specify

-- With-matrixssl-libs = libmatrixsslstatic.




9 make


In this process, the three function undefined errors in src/OS/Linux. C under the matrixssl source code will appear. In this case, we will comment out the relevant sections and then OK.


Line 123: pthread_mutexattr_init ()

Line 125 pthread_mutexattr_settype ();

Line 135 pthread_mutexattr_destroy ()


After successful make, the appweb and appweb. conf files will be generated under the appweb directory. In addition, there are some keys required for matrixssl operation.


Mkdir/usr/local/nfs:

These files are: appweb (BIN), appweb. conf (configuration file), mime. types, directory web (DocumentRoot), server. Key. Pem, server. CRT, server. Key



10 enable the NFS service:


Modify the/etc/exports file as follows:

/Usr/local/nfs * (RW, sync, root_squash)


# Service protmap start


# Service NFS start


# Showmount-a view the shared and accessed Directories


Mount NFS on the Development Board (ensure that the developed IP address and host address are in the same network segment ):


# Mkdir/tmp/nfs


# Mount-t nfs hostip:/usr/local/nfs



11. Run appweb and enable Web Services


./Appweb-F appweb. conf


If an error occurs, modify the appweb. conf configuration file according to the error message.



Access the Web service provided by appweb on the PC, and enter the IP address and port number of the target board in Firefox.
Http: // 10.78.28.218: 80/
Https: // 10.78.28.218: 4443/


If the access fails, modify the appweb. conf configuration file.


PS:

The appweb and goahead chief architect, the founder of mbedthis, later pointed out the three functions that I commented out at the appweb Forum:

If you build matrixssl with multithreading, then you need to build appweb with multithreading. I wocould not recommend just commenting out those pthread lines.


Regarding linking statically, you are right to use a static version of the matrix SSL library.


Michael




Therefore, we only need to choose -- with -- multi-thread When configuring appweb to solve the problem of undefined three functions.

Later, Michael added:

Those APIs are part of pthreads the Linux multithreaded library. They are not part of appweb.

Http://bbs.chinaunix.net/thread-2082286-1-1.html

Related Article

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.