BOA embedded porting

Source: Internet
Author: User

The following describes how to port A Boa Server.

Environment

HOST: ubuntu8.10
Cross tool chain: gcc-3.4.5-glibc-2.3.6
Objective: To develop the S3C2410 Development Board

A complete document is prepared based on some documents on the Internet.

1. Download Boa Source Code

: Http://www.boa.org/

Latest release: 0.94.13

Download boa-0.94.13.tar.gz

Unzip: # tar xzf boa-0.94.13.tar.gz

2. tools required for installation: Bison, flex

Sudo apt-Get install bison flex

Otherwise, the following error occurs:

Make: YACC: Command not found
Make: *** error 127

Make: Lex: Command not found
Make: *** [Lex. yy. C] Error 127

3. Modify the file

(1) Modify src/compat. h

Find

# Define timezone_offset (FOO) Foo #-> tm_gmtoff

Modify

# Define timezone_offset (FOO)-> tm_gmtoff

Otherwise, an error occurs:

Util. C: 100: 1: Error: pasting "T" and "->" does not give a valid preprocessing token make: *** [util. O] Error 1

(2) Modify src/log. c

Comment out

If (dup2 (error_log, stderr_fileno) =-1 ){
Die ("unable to dup2 the error log ");
}

Is:

/* If (dup2 (error_log, stderr_fileno) =-1 ){
Die ("unable to dup2 the error log ");
}*/

Otherwise, an error occurs:

Log. C: 73 unable to dup2 the Error Log: Bad file descriptor

(3) Modify src/boa. c

Comment out the following two sentences:

If (passwdbuf = NULL ){
Die ("getpwuid ");
}
If (initgroups (passwdbuf-> pw_name, passwdbuf-> pw_gid) =-1 ){
Die ("initgroups ");
}

Is

# If 0
If (passwdbuf = NULL ){
Die ("getpwuid ");
}
If (initgroups (passwdbuf-> pw_name, passwdbuf-> pw_gid) =-1 ){
Die ("initgroups ");
}
# Endif

Otherwise, the following error occurs: boa. C: 211-getpwuid: no such file or directory.

Comment out the following statement:

If (setuid (0 )! =-1 ){
Die ("icky Linux kernel bug !");
}

Is

# If 0
If (setuid (0 )! =-1 ){
Die ("icky Linux kernel bug !");
}

# Endif

Otherwise, a problem occurs: boa. C: 228-Icky Linux kernel bug! : No such file or directory

4. Generate the MAKEFILE file

Run:

# Cd BOA-0.94.13/src
#./Configure

5. Modify makefile

CD SRC
Vim makefile

Modify cc = GCC to CC = arm-softfloat-Linux-GNU-gcc

Modify CPP = gcc-e to CC = arm-softfloat-Linux-GNU-gcc-e

6. Compile

Make
Ls-l Boa
-Rwxr-XR-x 1 David 189223 Boa

Then we reduced BOA for the generated binary file.

Arm-softfloat-Linux-GNU-strip Boa
Ls-l Boa
-Rwxr-XR-x 1 David 61052 Boa

We can find that there is a large gap between BOA and BOA, which saves us a lot of space.

7. BOA Configuration

This step is also done on the Computer Host.

An example boa. conf already exists in the BOA-0.94.13 directory and can be modified based on it. As follows:

# Vi boa. conf

(1) group Modification

Modify group nogroup

Group 0

(2) User Modification

Modify user nobody

User 0

(3) Modify ScriptAlias

Modify ScriptAlias/cgi-bin // usr/lib/cgi-bin/

ScriptAlias/cgi-bin // www/cgi-bin/

(5) doucmentroot Modification

Modify doucmentroot/var/WWW

Is doucmentroot/WWW

(6) servername settings

Modify # servername www.your.org. Here

Servername www.your.org. Here

Otherwise, the error "gethostbyname: no such file or directory" appears"

(7) accesslog Modification

Modify accesslog/var/log/BOA/access_log

Is # accesslog/var/log/BOA/access_log

Otherwise, the error message "unable to dup2 the Error Log: Bad file descriptor" appears"

(8) The following configurations are related to the configurations of BOA. conf, which are created in the arm root file system.

Perform the following steps on the Development Board:

Create the/etc/BOA directory and copy boa and BOA. conf to this directory.

Mkdir/etc/Boa

Create the main directory of the HTML document/WWW

Mkdir/WWW

Create a CGI script/www/cgi-bin

Mkdir/www/cgi-bin

Perform the following steps in Ubuntu:

Copy boa. conf to/etc/BOA in the root file system of the Development Board.

# Cp boa. CONF/source/rootfs/etc/Boa

Copy BOA to/etc/BOA in the root file system of the Development Board.

# Cp src/BOA/source/rootfs/etc/Boa

Copy/etc/mime. types in Ubuntu to/etc in the root file system of the Development Board.

# Cp/etc/mime. types/source/rootfs/etc

Copy your homepage index.html to the WWW directory

9. Test

Open a browser and enter the IP address of the Development Board.

OK

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.