My name is Sven Andersson and I
work as a consultant in embedded
system design, implemented in ASIC
and FPGA.
In my spare time I write this blog
and I hope it will inspire others to
learn more about this fantastic field.
I live in Stockholm Sweden and have
my own company
Contact
You are welcome to contact me
and ask questions or make comments
about my blog.
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.
Create a new application
We will create a dummy application to hold the web content. We call it TourSkating, you will soon see why.
Once we have created the new application, the next step is to compile and build it. The required steps are shown below.
2. Select your new application to be included in the build process. The application is not enabled by default. Launch the rootfs configuration menu:
->petalinux-config -c rootfs
3. We will include the TourSkating app and exclude the uWeb app.
4. We need to include the built-in web server (httpd). It can be found in base->busybox->busybox-httpd
5. Exit and save the configuration.
Build a new PetaLinux kernel
6. Execute the command:
->petalinux-build
Create the index.html file
The web page will display two pictures.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Tour skating in Sweden and around the world</title> </head> <body> <h3> The ice is like a mirror</h3> <img src="MirrorLike.png"> <br><br> <h3> On the ice</h3> <img src="TourStart.png"> <br><br> <a href="http://www.wildskating.com">For more information see my blog</a> <br> </body> </html>
Boot PetaLinux
Follow the instructions in part 28 to boot PetaLinux.
Copying files to the PetaLinux installation
We will use the cURLcommand to transfer the files from our host to the guest. cURLis 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. Here are the command to transfer the three files used to display our web page.
Enter the web address: 192.168.33.3/index.html in your web browser.
Include the files in the build process
We add the web page files to the httpd directory in the TourSkating apps directory.
We then modify the makefile to include the web page files during the build. Here is the modified makefile:
ifndef PETALINUX $(error "Error: PETALINUX environment variable not set. Change to the root of your PetaLinux install, and source the settings.sh file") endif
include apps.common.mk
APP = TourSkating
# Add any other object files to this list below APP_OBJS = TourSkating.o
rankeney December 11, 2015 09:16 PM PST The busybox-httpd startup script is wrong. Have a look in your Petalinux build directory - there are 3 identical copies of it. Change DAEMON to /sbin/httpd (remove the /usr part) and change HTTPROOT="/home/httpd" and it will start automatically.
Carlos Moraes January 4, 2015 07:12 PM PST Hi Max,
I had the same problem. I created another project and appeared to me the directory and now the httpd works fine.
Regards!!
Max December 12, 2014 03:45 PM PST I tried it under petalinux 2014.2. But there is no httpd folder at /home. In my petalatinux project folder in apps/TourSkating is also no httpd folder. i added the folder manually and changed the makefile as described but the build process failed.
at startup the busybox httpd server is not running, i have to run the command "httpd" first then i can run the manually loaded html file. something is very wrong with my petalinux project, do you have any idea? thank you