Free Software for Embedded Systems
Mail: [email protected] Web: http://stephane.lavirotte.com/
University of Nice - Sophia Antipolis
We must start with something…
Introduction
9 Linux for embedded systems
– Is used more and more – In use in many devices
Mobile Phones
PDA (Personal Digital Equipment)
Network Equipments
…
Have a look to:
– http://www.linuxfordevices.com/c/a/Linux-For-Devices-Articles/The-Linux-Devices-Showcase/
– Used in limited resources systems
uClinux, uClibc, dietlib, …
9 Easy to include free software inside that products
– sqlite, samba, thttpd, …
Linux for Embedded Systems
Development Phases
9 Configuration
– First, choose which features to include in the system
Kernel configuration
Choose the tools and applications to include
9 Build
– Need to recompile the entire system for the target:
Kernel
Libraries
Applications
9 Deployment
– Installation of files in a filesystem
– Transfer on the target and start the new system
System Components
9 Component
– Boot Loader – Kernel
– Kernel Modules – File Systems
– Libraries
– Applications
Boot Loader
Kernel
File System Kernel Modules
Libraries
Applications
About Free Software
9 Linux is and Open Source Free Software
9 Free Software provides 4 freedom to the user:
– The freedom to use the program as it sees fit
– The freedom to study how the program works and adapt it to its own needs (Get the source code is a precondition).
– The freedom to redistribute copies to help others
– The freedom to improve the program, and distribute the
improvements to the public so that the community can benefit from advanced (Get the source code is a precondition).
9 See
– http://www.gnu.org/philosophy/
The GNU General Public License (GPL)
9 Copyleft licenses rely on copyright law to require that any modified version remains free software.
– For more details
Copyleft: http://www.gnu.org/copyleft/copyleft.html
9 The GNU GPL requires that modifications and derivative works are also under GPL:
– Applies only to software distributed
– Any program using GPL code (statically or dynamically linked) is regarded as an extension of this code and therefore under the GPL
– For more details
FAQ GPL: http://www.gnu.org/licenses/gpl-faq.html
A collection of Software Tools
Free Applications and
Embedded Systems
glibc
9 C Library made by GNU project
– http://www.gnu.org/software/libc/
– LGPL License
9 Designed for
– Performances
– Respect standards – Portability
9 Necessary for all GNU/Linux systems 9 But too big for embedded systems
– About 1,5 - 2MB are necessary
Sur IPaQ: 1,2MB pour la libc et 500KB pour la libm
Sur i386: 1,3MB pour la libc et 150KB pour la libm
uClibc
9 C Library made by CodePoet Consulting
– http://www.uclibc.org/
– LGPL License
– Now supported by MontaVista, TimeSys, Wind River
9 Designed
– For small and tiny embedded systems – With a maximum of functionalities
9 Provides most needs
– Debian Woody completely ported using uClibc
9 Small: about 4 times smaller than glibc arm
– glibc: 1700 KB (libc: 1.2 MB, libm: 500 KB)
– uClibc:. 400 KB (libuClibc: 300 KB, libm: 55KB)
Comparison
9 glibc (GNU C Library)
– Done for its performance and the respect of standards – The best for workstation machines and servers
9 uClibc
– Highly compatible
– Made for embedded systems with a small storage capacity and memory
9 The others: diet libc, newlib, klibc
– Most suitable for all small systems, or initramfs and init ramdisk
THE Toolbox
A Toolbox for the Target
BusyBox
9 http://www.busybox.net/
9 BusyBox
– Consolidates most Unix utilities into a single executable – A web server if also included !
– Small size
Statically compiled with uClibC: less the 500KB
Statically compiled with glibc: less than 1MB
9 An excellent choice for:
– Initramfs or initrd with complexes scripts
– Embedded systems with small and medium-sized storage
9 Easy to configure the wanted functionalities
BusyBox Commands
addgroup, adduser, adjtimex, ar, arping, ash, awk, basename, bunzip2, bzcat, cal, cat, chgrp, chmod, chown, chroot, chvt, clear, cmp, cp, cpio, crond, crontab, cut, date, dc, dd, deallocvt, delgroup, deluser, devfsd, df, dirname, dmesg, dos2unix, dpkg, dpkgdeb, du, dumpkmap, dumpleases, echo, egrep, env, expr, false, fbset, fdflush, fdformat, fdisk, fgrep, find, fold, free, freeramdisk, fsck.minix, ftpget, ftpput, getopt, getty, grep, gunzip, gzip, halt, hdparm, head, hexdump, hostid, hostname, httpd, hush, hwclock, id, ifconfig, ifdown, ifup, inetd, init, insmod, install, ip, ipaddr, ipcalc, iplink, iproute, iptunnel, kill, killall, klogd, lash, last, length, linuxrc, ln, loadfont, loadkmap, logger, login, logname, logread, losetup, ls, lsmod, makedevs, md5sum, mesg, mkdir, mkfifo, mkfs.minix, mknod, mkswap, mktemp, modprobe, more, mount, msh, mt, mv, nameif, nc, netstat, nslookup, od, openvt, passwd, patch, pidof, ping, ping6,
pipe_progress, pivot_root, poweroff, printf, ps, pwd, rdate, readlink, realpath, reboot, renice, reset, rm, rmdir, rmmod, route, rpm, rpm2cpio, runparts, rx, sed, seq, setkeycodes, sha1sum, sleep, sort,
startstopdaemon, strings, stty, su, sulogin, swapoff, swapon, sync, sysctl, yslogd, tail, tar, tee, telnet, telnetd, test, tftp, time, top, touch, tr,
traceroute, true, tty, udhcpc, udhcpd, umount, uname, uncompress,
uniq, unix2dos, unzip, uptime, usleep, uudecode, uuencode, vconfig, vi, vlock, watch, watchdog, wc, wget, which, who, whoami, xargs, yes, zcat
Configuring BusyBox
9 Get the latest stable version
– http://busybox.net/
9 Configuring BusyBox (create a .config file):
– make defconfig
To begin with BusyBox
Configure Busybox with all the options (produce a huge system) – make allnoconfig
Unselect all the options
Allow to include only wanted features (produce a small system)
9 Same interface as the kernel configuration tool
– make menuconfig (texte) make xconfig (graphique)
9 Possibility to configure the wanted commands and all the options and functionalities wanted for these
commands
Compiling BusyBox
9 When Cross-Compiling
– Choose the microprocessor architecture and the right cross- compiler in the Makefile (as for kernel)
ARCH ?= arm
CROSS_COMPILE ?= arm-linux-gnueabi- – Add path to the cross-compiler in our PATH
export PATH=/usr/local/arm/3.3.2/bin:$PATH
9 BusyBox Compiling
– Make
9 BusyBox Installing
– make install
9 Just need to copy all files to the target filesystem
– cp -a _install/* /mnt/rootfs/
ssh, http, …
Servers for the Target
Advantages of an Embedded Web Server
9 Several devices need something to be able to configure it (for example, the network address)
– Gateway/ Modems, IP Camera, Printer, …
9 Advantages of an embedded Web Server
– No need to develop some specific drivers
– No need to develop a specific configuration application – No need to support different OS
– Just need to develop some HTML pages (static or dynamic
ones) to allow the configuration (with the power of java-script on client side)
– Reduce the hardware costs (no LCD screen, no need to have a lot of storage capabilities on device, …)
thttpd
9 Tiny/Turbo/Throttling HTTP server:
– http://acme.com/software/thttpd/
9 Simple
– Only implement the minimum of HTTP 1.1 protocol
9 Small at all points of view
– 88KB for 2.25b version against 264KB for Apache – Very low memory consumption (no fork)
9 Portable Code
– Can compile on almost all Unix systems
9 Very quick to answer
– Almost as fast as the complete servers
9 Security
– Designed to protect Web servers from attacks
Other Embedded Web Servers
9 BusyBox (
http://busybox.net/)
– 9KB (BusyBox 1.5): includes CGI, authentication, and support for scripts (like php)
9 Klone (
http://koanlogic.com/kl/cont/gb/html/klone.html)
– Can include dynamic page
(in C/C++ <% code %> ) and compressed – Only one executable (about 150KB)
9 Boa (
http://www.boa.org/)
– Designed to be simple, fast and secured
9 Lighthttpd (
http://lighttpd.net/)– Designed to manage high number of requests
Graphical Toolboxes
Graphic Libraries
for the Target
NanoX / Microwindows
9 NanoX / Microwindows
– http://www.microwindows.org/
– Graphical library running under Linux
Framebuffer, X / Windows, SVGAlib, and some other graphical systems
9 Advantages:
– Lisence: Mozilla Public License, allowing proprietary applications
– Very light (< 100KB) – 2 APIs (C language)
API Win32: allows Windows et Windows CE
Naon-X API: small X server with an API of Xlib type – Documentation of API, FAQs and Tutorials available
9 Limitations
– Lack some support for themes
NanoX / Microwindows
MiniGUI
9 MiniGUI
– http://www.minigui.org/
– Mature graphical toolbox
9 Advantages
– Supported architectures: x86, arm, ppc, m68k, mips
– Support Linux / uClinux, eCos, some proprietary RT OS and Win32
– Seams popular and used in many Asian devices – Programming language: C
– About 700KB
9 Limitations
– Needs a commercial license to create a product with
MiniGUI
Terminals
Set‐Top Box
Industrial Tools
FLTK
9 Fast Light ToolKit (pronounce « fulltick »)
– http://fltk.org/
– Pronunciation: « fulltick »
9 Advantages
– LGPL License
– Cross-platform: Unix X11, Windows et Max OS X
– Can create new applications in few minutes with the help of FLUID builder
– C++ Libraries
– Support for 3D graphical (OpenGL)
FLTK
9 Simple Direct media Layer
– http://libsdl.org/
– Cross-platform multimedia library
– At the origin, created for video games programming
9 Advantages
– Allow a very low level access: keyboard, mouse, joystick, sound, 3D display (via OpenGL) and 2D (via framebuffer) – Now used for embedded systems
– Native C interface
– Several wrappers for many languages – Many applications and demos available
SDL
9 DirectFB
– http://www.directfb.org/
9 Advantages
– C library in user mode
– Designed for embedded systems
– Compact, powerful, flexible et easy to use
– Support for hardware acceleration (with fallback software for actions non hardware supported)
– Abstraction layer to entry possibilities
– Windowing system with transparency management – Many applications and demos available
DirectFB
Qt
9 Qt Embedded
– http://trolltech.com/products/qt/features/platforms/embedded/
9 Advantages
– Same API as the desktop (easy to develop applications)
– Based on framebuffer (rather than X) with its own windowing system
– Can easily change Look and Feel
– Completely modular: so that, you can limit the size:
Entre 1.7 et 4.1 MB compressed (3.6 et 9.0MB non compressed) – Support for: arm, x86, mips, powerpc, windows ce
– Integrated with several Java VM
9 Limitations
– Need a commercial license to create new products
Qt
GTK
9 Projet GTK+
– http://www.gtk.org/
9 Advantages
– Exactly the same version as the desktop one
– C Library that we can include in several language – Usable with X and DirectFB
– Based on Cairo for vector graphics
Solutions for system without any FPU
9 Limitations
– Important size with all libraries
4.4MB with DirectFB
13.4MB with X
9 To see an application example:
– http://www.directfb.org/docs/GTK_Embedded/
GTK
A suite of standard applications
Environments for Target
Opie .
9 Open Palmtop Integrated Environment
– http://opie.handhelds.org/
– Based on Qt Embedded
9 Advantages
– Based on framebuffer (rather than on X) – Include an application suite for PDA
Contacts, Calendar, … (Personal Information Management)
Multimedia applications for video and music playing
Device configuration
Misc: games, email, …
– Include beautiful icons and interfaces (themes)
9 Limitations
Opie
Gnome Mobile .
9 Gnome Mobile
– http://www.gnome.org/mobile/
9 Advantages
– Huge community
Gnome Mobile
GPE .
9 GPE Palmtop Environment
– http://gpe.linuxtogo.org/
– Based on the GTK+ toolkit
9 Advantages
– Based on X framebuffer X
– Easy to remotely display the screen of a PC – Set of applications for PDA with LinPhone
– Standard GTK+ application can run with no or not much modifications
– Recognize handwriting on screen display