You may need a web server on your no-MMU embedded system in order to allow remote configuration or possibly provide external access to some files.
Usually, you’ll need a lightweight webserver (e.g. not Apache) with the required features and in case of no-mmu system, source that can accommodates uClinux limitations such as no fork support. You’ll also take into account the programming language or the server: e.g. C/C++. Java, Ruby, Perl… If your system does not support Java or Perl for example, that may not be the best solution to add one of those only for the web server and it also depends on the resources (Flash/RAM) available.
There are plenty of C/C++ lightweight http servers such as thttpd or lighttpd, however those are using fork in their code.
One open source http server that is lightweight and uses vfork (instead of fork) is mathopd.
At the time of writing, the latest version is mathopd 1.5p6.
mathopd supports the following:
- HTTP/1.1 including persistent connections, partial responses and pipelining.
- CGI/1.1
To cross-compile it (e.g. using arm-elf-gcc for Sigma Designs EM862X), go to mathopd-1.5p6/src and edit the Makefile as follows:
BIN = mathopd
CC = arm-elf-gcc
CFLAGS = -O -Wall
CPPFLAGS =
LDFLAGS = -Wl,-elf2flt
LIBS = -lcrypt
PREFIX = /usr/local
SBINDIR = $(PREFIX)/sbin
and run make. That’s it !
In your target you’ll need to create /etc/mathopd.conf to configure mathopd. It you want to have you web files in www, it could look like:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
User nobody Control { Types { text/html { .htm } text/html { .html } text/plain { .txt } image/gif { .gif } image/png { .png } image/jpeg { .jpg } text/css { .css } application/octet-stream { * } } IndexNames { index.htm } } Server { Virtual { AnyHost Control { Alias / Location /www } } } |
Finally copy mathopd to your path, copy your web pages, pictures and cgi in www and run it in your target board as follows:
mathopd -f /etc/mathopd.cfg
To try it, simply access your board though your browser as follows:
http://board_ip
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress