Installing custom web server content
How can I control the default web server content installed in PetaLinux?
Problem Description
By default, system images built with PetaLinux SDK include a web application demo built using the uWeb (MicroWeb) framework from WorkWare Systems.
For those who prefer to create their own Embedded Web interfaces, PetaLinux also includes the BusyBox httpd server. This KnowledgeBase article describes how to configure the BusyBox webserver and create/install your own custom web content into a PetaLinux system image.
Resolution
1. First, de-select the uWeb demo from the PetaLinux menuconfig:
$ petalinux-config-apps
"PetaLinux Configuration" ---> "PetaLogix Demo Applications --->" "[ ] uWeb ---> "
Once uWeb is removed, the BusyBox httpd will be the default web server.
2. Next, create a new application to hold the web content:
$ petalinux-new-app web-app
You may use any name you like, 'web-app' is used in this example, and the new application template will be in $PETALINUX/software/user-apps/web-app
3. Create a directory inside this application directory, called httpd, which will hold the static HTML and file contents for the web server:
$ mkdir $PETALINUX/software/user-apps/web-app/httpd
4. Create the desired HTML and directory heirarchy inside this httpd subdirectory.
5. Edit the web-app/Makefile to copy this httpd content directory into the root filesystem template, by modifying the default application Makefile's romfs: target as follows:
romfs: all [tab] rsync -a --delete httpd/ $(ROMFSDIR)/home/httpd/
Note the '[tab]' should be replaced by an actual tab character, to follow Makefile syntax rules.
6. If you also need to build and install any custom CGI web applications, you will need to modify the default Makefile accordingly. Note that these CGI applications will normally be installed into the /home/httpd subdirectory, rather than /bin.
7. Rebuild the PetaLinux system image, and boot. Now if you point a web browser at the MicroBlaze's IP address you should see your new custom web content.


