SliTaz Raspberry Pi book
With the PiBook you will learn how to get started with SliTaz ARM and the Raspberry Pi, configure the system, install additional software packages, setup a custom desktop and use pre-installed applications. The book also covers GPIO usage, add-on boards setup such as the official Raspberry Pi Camera or PiGlow and basic electronic usage.
- Installation instructions
- First boot setup
- System configuration
- Audio settings
- System & kernel update
- Installing new packages
- Installed applications
- Raspberry Pi packages
- GUI & secure remote control
- Pi setup suggestions
- Desktop customization
- GPIO Pins & I2C Bus
- Using leds with the RPi
- Pi Camera - Pi NoIR
- PiGlow from Pimorini
- PiFace Digital setup and usage
- RaspiComm init and usage
The Pibook is complemented by the general documentation found in the SliTaz ARM Codex.
Installation instructions
boot/ : Must be copied to a FAT32 partition rootfs/ : Must be copied to an ext4 or btrfs partition
Be sure the SD card has got 3 partitions (boot, swap, root). The recommended partition sizes are 40Mb for /boot, 420Mb for swap and using all available free space for root. Then you simply have to run the install.sh script from the SliTaz Raspberry Pi release directory:
# ./install.sh
First boot setup
On the first SliTaz Raspberry Pi boot you will be prompted to configure basic system settings such as the system keymap and the root password. Then you will be prompted to create the default user with its password.
On any secure GNU/Linux system you will have to have at least the administrator (root) and the default human user. In this way, users can fully use the system but can't break it.
You can preconfigure the system before the first boot by editing the configurations on the SD card and you can skip the post installation steps. More info on the SliTaz ARM Codex: System configs
System configuration
All SliTaz Raspberry Pi basic configurations can be done via a nice Ncurses driven GUI with mouse support under an X session and via a CGI/web administration interface. Please check the detailed remote control section in the book for more information about the CGI/Web control panel.
tazberry : Dedicated tool for all Raspberry Pi specific configs slitaz-config : Slitaz system configs such as keymaps, lang, users
Tazberry and slitaz-config tool are accessible from the 'System Tools' menu or can be run from a cmdline:
# tazberry # slitaz-config
Audio settings
The Raspberry Pi has two audio output modes: HDMI and headphone jack. You can switch between these two modes at any time. SliTaz Raspberry Pi provides a custom web admin plugin to graphically configure and check audio settings locally or remotely. The web audio control lets you switch audio output and play a sound to test settings. You can directly access the audio control panel with a URL in the form of:
http://192.168.x.xxx/adm/tools.cgi?audio
You can also configure the Raspberry Pi audio output from the command line where the last number is the output mode (0=auto 1=jack 2=hdmi):
# amxier cset numid=3 1
The desktop flavor includes Alsa audio mixer and mpg123 cmdline audio player. Please check the Codex apps page for a common list of multimedia applications.
System & kernel update
It is always a good idea to check for updates! It will bring you fixes and new features. With SliTaz Raspberry Pi you have to upgrade all the installed packages and the custom Linux Kernel. Updates can be done via spk-dialog and tazberry found in the "System Tools menu" or directly from a command line:
# spk-dialog # tazberry
Installing new packages
After your system is configured and connected to the web, you may want to install new packages to add functionality to your SliTaz system. You can install new applications via spk-dialog GUI or from the command line with spk-add:
# spk-add package package1 packageN
You can find a list of packages on the SliTaz Raspberry Pi website or by using the spk-find utility. You can search by package name, keyword or description:
# spk-find i2c
Installed applications
SliTaz Raspberry Pi can come in many flavors with a custom pre-installed packages set. This section will cover the base and desktop flavors, more information about a spécific flavor may be found on the SliTaz Raspberry Pi website.
Base system
The base flavor provides a text mode system with cmdline only tools, all Busybox applets are present. It supports wireless networks but no sound. The default and most useful applications are:
- Dropbear SSH client & server
- Busybox HTTPd, NTPd, FTPd servers
- The CGI/Web admin interface and TazBerry
- Clex file manager and Lynx web browser
- TazIRC IRC client and Spk packages manager
- Joe text editor and wget :-)
Desktop environment
The SliTaz Raspberry Pi desktop flavor focuses on providing a fast, elegant, and easy to use desktop environment. The desktop is powered by JWM window manger and you will find all the base applications plus GUI programs:
- Text editors: Adie + FLTK Editor
- File manager: PathFinder
- Web browser: Dillo
- X terminal: Xterm
- Audio mixer: Alsamixer
- Audio player: mpg123
- 2 nice games: Blocks Attack + Sudoku
- Fluid FLTK GUI designer
- Lua programming language
- SQLite database support
- Htop processes monitor
Raspberry Pi Packages
Some custom tools and libraries have been packaged specially for the SliTaz Raspberry Pi distribution. Here is a list of packages and a short description:
- slitaz-arm-rpi - Provides the CGI/adm plugins, tazberry and custom config files.
- raspberrypi-boot - Provides the R-Pi bootloader firmware.
- raspberrypi-boot-x - Provides the R-Pi bootloader firmware with Pi Camera support.
- raspberrypi-vc -Raspberry Pi VideoCore Tools, including raspistill and raspivid.
- gst-omx - A gstreamer-1.0 plugin which can do hardware-accelerated video decoding on the Raspberry Pi.
- wiringpi - A GPIO access library written in C for the BCM2835 used in the Raspberry Pi.
- wiringpi-piglow - The WiringPi tool for PiGlow, useful to handle leds from SHell scripts.
- picamera - Provides a pure Python interface to the Raspberry Pi camera module.
- libbcm2835 - Provides access to GPIO and other IO functions on the Broadcom BCM 2835 chip.
- rcswitch-pi - RCSwitch implementation for the Raspberry Pi.
- python-rpi-gpio - Python class to control the GPIO on a Raspberry Pi.
- python-rpi-pyglow - Control Piglow from Python. Includes a custom SliTaz utility to easily play with PiGlow.
- pi-blaster - Enables PWM on the GPIO pins you request of a Raspberry Pi.
- libmcp23s17 - A simple C library for accessing an MCP23S17 port expander found on PiFace board.
- libpifacedigital - A simple library for controlling PiFace Digital
- (xorg-xf86-video-fbturbo) - Buggy Xorg server module for the R-Pi.
GUI & secure remote control
This section will cover remote control using the SliTaz CGI/Web admin interface, SSH secure SHell connections and graphical desktop control with VNC.
CGI/Web interface
The CGI/Web interface is a nice way to control your Raspberry Pi machine using Dillo from the desktop or any web browser from another computer, mobile or tablet device. Remote control via the CGI interface is enabled by default. To stop/start the service or to use another port, please refer to the SliTaz ARM Codex: System page
SliTaz Raspberry Pi provides plugins to easily handle your Pi. In a nifty and clean interface you can: poweroff/reboot the system, configure boot settings including blacklisted modules, set audio output and test sound, play with GPIO pins and get I2C information, and turn on/off the green led :-) The tool lets you do quite a few more handy actions that you will discover browsing the interface.
First you must found out the local IP address of your Raspberry Pi machine. On your SliTaz Pi you can use 'ipinfo' to get the IP, then connect using this IP. To connect you must use 'root' as user name with the correct system administrator password.
$ ipinfo
Secure SSH connection
By default all flavors provide Dropbear Secure SHell, a lightweight but powerful and standard compliant SSH client and server. The server is not started by default, you can start it manually from the cmdline or edit /etc/init.d/rcS.conf to start it automatically on each boot:
# startd dropbear # editor /etc/rcS.conf
VNC Desktop control
VNC is great tool for letting you remotely control a desktop. The steps are: install and start the VNC server on your Pi, then install a VNC client on your desktop machine, mobile phone or tablet. To install the server and start it on your Raspberry Pi (via an SSH connection or with an attached keyboard and screen):
# spk-add x11vnc # startd x11vnc
Pi setup suggestions
What can you do with your SliTaz Raspberry Pi distro? Use it as a tiny desktop! Learn Linux, Lua, Python, SHell scripting. Play with some electronics circuits, sensors, leds and Raspberry Pi pluggable boards. Setup servers, use the cam for fun or security purposes, create a secure wifi network, ...- So much can be done with a Pi!
- Kids learn about computers with Scratch and games
- Web server with SHell and Python CGI support
- Secure and anonymous wifi network with Tor
- Development system including a wide range of tools
- Electronic circuits playground with breadboards
- Security camera with infra red support
- Audio player and streamer with MPD
- Video player with MPlayer or gst-omx (provides hardware accelerated decoding on the Raspberry Pi)
- Video streamer with gst-omx or ffserver
- Codex setup guides
Desktop customization
Your SliTaz Raspberry Pi Desktop can be customized to infinity! With a little editing of configuration files and autostart scripts you can configure the entire environment. The default window manager is JWM, but it can be replaced by OpenBox, Enlightenment (e17) or the DWM dynamic window manager.
JWM autostarted applications and themes are set in a xml.jwmrc file. By default the system wide config is used, lets copy it to your home folder as a .jwmrc hidden file and then edit it:
$ cp /etc/xdg/jwm/system.jwmrc ~/.jwmrc $ editor .jwmrc
The system wide menu path is: /etc/xdg/jwm/menus.jwmrc and is updated by SliTaz packages manager. You can also copy it to your home folder if you want to customize it. See the official configuration documentation for comprehensive documentation on configuring JWM.
Icon bar & panel
To have a transparent icon bar with the applications of your choice, you can use Wbar2. Install it and test it:
$ sudo spk-add wbar2 $ wbar
To have a desktop panel with Openbox you can use Tint2. Install it and test it:
$ sudo spk-add tint2 $ tint2
GPIO Pins & I2C Bus
SliTaz provides all the necessary tools to work with the Raspberry Pi GPIO pins and I2C bus. The CGI/Web admin interface lets you control the GPIO pins and get I2C information. Pi I2C kernel module is blacklisted by default and can be loaded manually, by on-demand scripts or at boot by commenting the blacklist line in:
/etc/modprobe.d/rpi-blacklist.conf
To have a full working I2C bus system we must also load the 'i2c-dev' kernel module which is not autoloaded by udev. In this case we must use a SliTaz boot time configuration file, lets edit the config file to modify the line LOAD_MODULES to look like below:
$ editor /etc/rcS.conf # Kernel modules to load earlier in boot. LOAD_MODULES="snd-bcm2835 i2c-dev"
Using leds with the RPi
Leds can be used for many purposes such as for a notification or as a light show. SliTaz Raspberry Pi provides a built-in utility to help set up and use leds. The RPi has an onboard green led (ACT) that you can turn on or off:
# pileds act
Pileds also provides examples and usable commands for Adafruit 7segment LED Backpack and the 8x8 LED Matrix. Creating visual elements with Kids is fun and lets them learn mathematics at the same time, since the leds must be mapped (ie: 0, 3) on a grid. Let's display a nice little boat and pileds built in help:
# pileds 8x8 --boat # pileds help
PiLeds uses some example code from Adafruit and PiClass Git Hub repositories. We have packaged them for easy install/updates and to provide some code right under the hood. Adafruit and PiClass code examples are located in:
/usr/share/adafruit /usr/share/piclass
Pi Camera - Pi NoIR
Raspberry Pi onboard camera works flawlessly with SliTaz. You can setup then shot, record and stream video with our easy to use and home made tools and the official VideoCore Tools from The Raspberry Pi foundation. Official documentation can be found on elinux.org wiki: Rpi Camera Module
To setup your camera from your Pi device, you can run TazBerry from the desktop menu or directly start the cam setup from a cmdline:
# tazberry cam-setup
After reboot you can test the camera with raspivid and take a picture via the CGI/Web Camera plugin. To test the camera:
$ su - # raspivid -d
Pictures with Raspistill
The official tool to take pictures with the camera board is raspistill. The following command will take a picture and create the PNG image shot.png:
# raspistill -o shot.png
PiGlow from Pimorini
PiGlow is a fun and cheap little board to learn and play with leds. It can do very nice effects and also supports easy on/off switches and brightness settings. Plug in your PiGlow board, boot your Raspberry Pi, install the Python PyGlow examples and utilities testsuite:
# spk-add python-rpi-pyglow # pyglow test # pyglow help
In the package database you will also find wiringpi-piglow providing the 'piglow' utility. On the Python side, we provide some examples that you can use to learn and code your own scripts. Have a look in the folder:
/usr/share/pyglow
PiFace Digital
The PiFace Digital board allows you to connect things like switches, lights and motors so that your Raspberry Pi can become aware of, and influence the world around it. Plug in your PiFace board then use SliTaz piface utility to install the official C library, the 'pifacedigital' utility and set of tiny tools:
# piface help
To test your Piface Digital board on SliTaz Raspberry Pi you simply have to run the testsuite from the cmdline. The tool will test GPIO pins, leds and input buttons:
# piface testsuite
PiFace Metronome
The Piface Slitaz utility uses WiringPi to provide a simple metronome using PiFace relays. The default is 80 beats per minutes but you can specify any beats in a range of 40 to 200. To turn on and off the metronome:
# piface metronome 120 # piface metronome
Piface Reaction game
Let's play a reaction game with PiFace Digital. Run the command below then press a button and wait until 2 LEDs are on and press the corresponding button as fast as you can:
# piface reaction
Piface Digital info
Kernel modules : i2c_bcm2708 i2c-dev SliTaz packages : libpifacedigital wiringpi-piface Official website : www.piface.org.uk Official guides : www.piface.org.uk/guides
RaspiComm
RaspiComm is a pluggable board which uses advanced features like a 5-way joystick, two serial ports (RS-232 and RS-485), l2c output and a realtime clock. The board lets you directly control a display, a stepper motor controller, relays and more.
SliTaz Raspberry Pi provides a built-in tool to let you use and test the RaspiComm board out-of-the-box. Shutdown down your Pi if needed, plug in the board on to the GPIO pins and boot the system, then run the testsuite:
# raspicomm init # raspicomm testsuite
The testsuite will prompt you to move the Joystick left and top after the LED tests. To initialize the board on each boot, setup the system clock and automatically load the i2c kernel modules, you need to edit the local.sh boot script and add a line to start 'raspicomm init'. This can be done in one command or by using a text editor:
# echo 'raspicomm init' >> /etc/init.d/local.sh
The Real Time Clock uses the i2c bus. When the clock is initialized you can find information in: /sys/class/i2c-adapter/i2c-1/1-0068. On the first setup you need to sync the system clock from the web and then set the RTC from the system clock. On next reboot the system clock will be sync'd with the Real Time Clock:
# rdate -s tick.greyware.com # hwclock --systohc
Here is a small SHell example to turn on/off LED1. The led uses the gpio pin number 18. The raspicomm utility already exported the LED pins so we just have to set the value: 1 to turn it on and 0 to switch it off:
# echo 1 > /sys/class/gpio/gpio18/value # echo 0 > /sys/class/gpio/gpio18/value
Official RaspiComm: PDF User Manual