Embedded Linux Web Programming

Source: Internet
Author: User

I haven't written an article for a long time. I 've been busy recently, and I 've got my papers and internships ...... A bunch of things, nonsense, go straight to the topic

 

Today, let's talk about one thing we have recently done. Setting up a Web server in Freescale imx27 is actually a simple B/S architecture.

 

First of all, since it is a web server, there must be a server. On an Embedded Board, it is impossible to rack a server as large as Apache, even if it is inside, the performance of the entire board can be imagined ......

 

1. What kind of server should we choose first? Some good people have already provided us with a lot of embedded servers. We just need to configure the environment. There are BOA, httpd, yhttpd, easyhtpd, Lighttpd, etc. Which one to choose? According to your hobbies ......

Here I chose thttpd. You can download one from the Internet. How can I find it? Baidu ...... Google ......

I downloaded thttpd-2.25b.tar.gz

2) decompress tar xzvf thttpd-2.25b.tar.gz

3) CD thttpd-2.23b

4) Modify CC in makefile and select your cross compiler.

Cc =/opt/Freescale/usr/local/gcc-4.1.1-glibc-2.4-nptl-sf-1/arm-926ejs-linux/bin/arm-926ejs-linux-gcc

./Configure-host = Ann-Linux
$ VI makefile
Ldflags =-static // specify as static Compilation

Of course, you can also avoid static compilation, which will make thttpd very large. After removing it, use the arm-Linux-readelf-D thttpd command to read what kind of package is missing from this package, but what does it add ......

5) Now you can compile the code.

Simple make with arm-926ejs-linux-strip thttpd remove debugging information ......

 

6) modify the thttpd. conf configuration file. The specific configuration method is as follows:

# This secti
On overrides defaults
# Declare the directory of the CGI program as the root directory path
Dir =/opt/dvsdk/dm365/Web
# Chroot
# Chroot is blocked to run the dynamically compiled CGI
User = root # default = nobody
Logfile =/var/log/thttpd. Log
Pidfile =/var/run/thttpd. PID
# This section _ documents _ defaults in effect
Port = 81
# The port parameter is used to change the port number (if other Web servers are running, different ports are required)
# Nosymlink # default =! Chroot
# Symlinks
# Novhost
Cgipat =/cgi-bin /*
# Nothrottles

 

2. The second part is to configure the CGI Environment. Of course, it is very simple. You just need to modify the thttpd. conf file. See the above. The above has already been configured for you ......

 

This development environment has been basically configured. Now, let's summarize the mistakes I 've made in this process. Some mistakes have plagued me for a long time ......

Recall this process ......

1) After compiling the CGI file, you must use chmod A + x XXX. CGI grants it the permission to execute, otherwise it is garbled, or jumps out of a download page. This error takes at least two hours, and it is depressing.

2) The second one is that compiling cgi files requires a cross-compiling environment, but I don't know how to make a short circuit in my mind. I have made such a low-level error, and at least I have to say a little more ......

3) how to print HTML files? There are various problems ......

4) garbled problem, Linux support UTF-8 and PC above the general use of gd2312 format, leading to this problem, can be converted ......

5) there is a standard for the selection of get and post methods ......

6) Of course, the program is wrong.

7) You must learn to use shell scripts when using them. Otherwise, you must enter the same steps repeatedly during testing to delay the time ......

8) Of course, writing makefile files is also very important. Different directories and files are called each other. How can we write makefile files to get them out of the binary files we need? You also need to learn ......

 

 

In a word, there are all simple things to be done. This is a very low eye ......

Of course, in the process of debugging, when encountering errors, you should be good at analysis. Sometimes you don't know what's going on, your mind keeps calling, turning your head around, leading to a waste of time.

 

After hard work, we finally got everything done on Thursday. The other is the beautification of the interface. Some common applications of JavaScript, HTML, and Linux have become and the entire framework has come out, everything becomes so easy ......

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.