HTTP Server for uCLinux

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.

Router Web Configuration
Network Configuration Page rendered by a Web Server

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:


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

Share this:

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK 5 ITX Rockchip RK3588 mini-ITX motherboard
Subscribe
Notify of
guest
The comment form collects your name, email and content to allow us keep track of the comments placed on the website. Please read and accept our website Terms and Privacy Policy to post a comment.
0 Comments
oldest
newest
Boardcon Rockchip RK3588S SBC with 8K, WiFI 6, 4G LTE, NVME SSD, HDMI 2.1...