Port BOA to Android platform

Source: Internet
Author: User

1. Download The borserver at http://www.boa.org/and use 0.94.13.pdf.

2. decompress it to external/BOA under the root directory of the android source code

3. Create the Android. mk file in the BOA folder. The details are as follows:

Ifeq ($ (target_arch), arm) local_path: = $ (call my-DIR) include $ (clear_vars) local_prelink_module: = falselocal_src_files: = src/lex. YY. c \ src/y. tab. c \ // tab interval, grasp src/alias. c \ src/boa. c \ src/buffer. c \ src/CGI. c \ src/cgi_header.c \ src/config. c \ src/escape. c \ src/get. c \ src/hash. c \ src/IP. c \ src/log. c \ src/mmap_cache.c \ src/pipe. c \ src/queue. c \ src/read. c \ src/request. c \ src/response. c \ src/select. c \ src/signals. c \ src/util. c \ src/sublog. c \ src/timestamp. libraries: = \ libcutilslocal_c_includes + = $ (local_path)/src local_module: = libmyinclude $ (build_shared_library) // generate libmy Library include $ (clear_vars) local_src_files: = src/lex. YY. c \ src/y. tab. c \ // tab interval, grasp src/alias. c \ src/boa. c \ src/buffer. c \ src/CGI. c \ src/cgi_header.c \ src/config. c \ src/escape. c \ src/get. c \ src/hash. c \ src/IP. c \ src/log. c \ src/mmap_cache.c \ src/pipe. c \ src/queue. c \ src/read. c \ src/request. c \ src/response. c \ src/select. c \ src/signals. c \ src/util. c \ src/sublog. c \ src/timestamp. clocal_cflags: =-g-O2-pipe-wall-I. local_shared_libraries: = \ libcutils libmylocal_c_includes + = $ (local_path)/src local_module: = boainclude $ (build_executable) endif

4. Modify Boa Source Code

(1) Modify src/compat. h

# Define timezone_offset (FOO) Foo #-> tm_gmtoff

Modify

# Define timezone_offset (FOO)-> tm_gmtoff

(2) Modify src/log. c

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 ");

}*/

(3) Modify src/boa. c

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

(4) Modify src/boa. c

If (setuid (0 )! =-1 ){

Die ("icky Linux kernel bug !");

}

Is

# If 0

If (setuid (0 )! =-1 ){

Die ("icky Linux kernel bug !");

}

# Endif

V. Compilation

Return to the root directory of the android source code, execute. Build/envsetup. Sh, and then execute Mmm external/BOA to compile the boa source code.

6. Configure boa. conf

1) Modify group nogroup to group 0 and Change User nobody to user 0.

2) Change errorlog/var/log/BOA/error_log to # errorlog/var/BOA/log/error_log

3) Modify accesslog/var/log/BOA/access_log to # accesslog/var/BOA/log/access_log

4) Modify # servername www.your.org. Here to servername www.your.org. Here

5) Change DocumentRoot/var/WWW to DocumentRoot/etc/BOA/www.

6) Modify mimetypes/etc/mime. types to mimetypes/etc/BOA/mime. types.

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

ScriptAlias/cgi-bin/etc/BOA/www/cgi-bin/

 

7. Because the etc directory in the Development Board is located in out/target/product/rk29sdk/system/etc under the android source code, create the following directory under this directory:

/Etc/BOA/

/Etc/BOA/log

/Etc/BOA/WWW

/Etc/BOA/www/cgi-bin/

(1) Copy boa. conf to the/etc/BOA directory.

(2) Copy mime. types to the/etc/BOA directory. Mime. types can be obtained from the/etc directory of your machine.

(3) copy the static html page to the/etc/BOA/WWW directory.

8. Execute./mkimage to generate system. IMG and burn it to the board.

9. Test

(1) Start the WiFi hotspot of the target board.

(2) connect the computer to the WiFi hotspot on the target board.

(3) execute ADB shell to enter the command interface, execute BOA, and start the boa server of the target board.

(4) enter the IP address of the WiFi hotspot in the browser (you can run the busybox ifconfig command on the command interface to view the IP address). If the IP address is normal, you will see the HTML page you just entered.

 

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.