Installing custom web server content
By default, system images built with PetaLinux SDK include a web application demo built using the uWeb (MicroWeb) framework from WorkWare Systems.
If we prefer to create our own Embedded Web interfaces, PetaLinux also includes the BusyBox httpd server. This tutorial describes how to configure the BusyBox web server and create/install our own custom web content into a PetaLinux system image. Read more here.
Create a new application
We will create a new dummy application to hold the web content. We call it TourSkating, you soon will see why.
Adding HTML files
We create a directory called httpd in the TourSkating application directory and add all files that make up the web page (index.html and two jpg files).
The index.html file
The web page will show two pictures.
Changing the makefile
We edit the application makefile to copy the httpd content directory into the root file system by changing the romfs target as follows:
De-selecting the uWeb application
Next step is to de-select the uWeb application and select our TourSkating application.
And select our new application.
Rebuild the PetaLinux system image
Boot the PetaLinux system image
We boot our system using the QEMU emulator.
We look in the httpd directory and find our html files.
We find the IP address.
Now we can open a web browser on our host and access the web server. This is what we see.
Modifying our web page.
We just realized that we would like to add one more picture on our web page. Here is a description on how to do that.
Transfer the picture
We will use the cURL command to transfer the picture from our host to our guest.
cURL is a command line tool for doing all sorts of interesting and essential URL manipulations and data transfers. The original goal of the program was to transfer files programmatically via protocols such as http, ftp, gopher, sftp, ftps, scp, tftp, and many others, via a command line interface. The main benefit of using the command line interface is that you can use the program in your Windows batch file or Linux shell scripts to automate many URL related processes.
The file will be transfered to the directory /var/ftp.
We copy it to the /home/httpd/image directory.
We can now use the VI editor to include the image in the index.html file.
When we are finished the web page will look like this:
Top Previous Next