slitaz-forge view arm/codex/pibook.html @ rev 709

boot: add mypizza.slitaz.org link
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Dec 15 17:55:16 2019 +0100 (2019-12-15)
parents 58f67fe7e0bd
children
line source
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <title>SliTaz PiBook</title>
5 <meta charset="utf-8" />
6 <meta name="viewport" content="width=device-width, initial-scale=1.0">
7 <link rel="stylesheet" type="text/css" href="../style.css" />
8 <link rel="stylesheet" type="text/css" href="../style-tiny.css" />
9 <link rel="shortcut icon" href="../favicon.ico" />
10 <!-- Raspberry color -->
11 <style type="text/css">
12 h2 { color: #bc1142; }
13 </style>
14 </head>
15 <body>
17 <!--
18 TODO: Overscan settings, GPU memory split, VideoCore Tools, Edu/Scratch
19 -->
21 <div id="header">
22 <div id="network"><a href="http://arm.slitaz.org/">SliTaz ARM</a></div>
23 <h1><a href=".">SliTaz ARM Codex</a></h1>
24 </div>
26 <nav id="nav" role="navigation" tabindex="0">
27 <ul>
28 <li><a class="nav1" href="faq.html">FAQ</a></li>
29 <li><a class="nav2" href="system.html">System</a></li>
30 <li><a class="nav1" href="apps.html">Apps</a></li>
31 <li><a class="nav2" href="setup.html">Setup</a></li>
32 </ul>
33 </nav>
35 <!-- Content -->
36 <div id="content">
38 <h2>SliTaz Raspberry Pi book</h2>
40 <p>
41 With the PiBook you will learn how to get started with SliTaz ARM and
42 the Raspberry Pi, configure the system, install additional software
43 packages, setup a custom desktop and use pre-installed applications.
44 The book also covers GPIO usage, add-on boards setup such as the official
45 Raspberry Pi Camera or PiGlow and basic electronic usage.
46 </p>
48 <ul>
49 <li><a href="#install">Installation instructions</a></li>
50 <li><a href="#firstboot">First boot setup</a></li>
51 <li><a href="#config">System configuration</a></li>
52 <li><a href="#audio">Audio settings</a></li>
53 <li><a href="#update">System &amp; kernel update</a></li>
54 <li><a href="#add-apps">Installing new packages</a></li>
55 <li><a href="#def-apps">Installed applications</a></li>
56 <li><a href="#pi-pkgs">Raspberry Pi packages</a></li>
57 <li><a href="#remote">GUI &amp; secure remote control</a></li>
58 <li><a href="#setup">Pi setup suggestions</a></li>
59 <li><a href="#desktop">Desktop customization</a></li>
60 <li><a href="#gpio">GPIO Pins &amp; I2C Bus</a></li>
61 <li><a href="#pileds">Using leds with the RPi</a></li>
62 <li><a href="#picam">Pi Camera - Pi NoIR</a></li>
63 <li><a href="#piglow">PiGlow from Pimorini</a></li>
64 <li><a href="#piface">PiFace Digital setup and usage</a></li>
65 <li><a href="#raspicomm">RaspiComm init and usage</a></li>
66 </ul>
68 <p>
69 The Pibook is complemented by the general documentation found in the
70 <a href="./.">SliTaz ARM Codex</a>.
71 </p>
73 <h2 id="install">Installation instructions</h2>
75 <pre class="box-up">
76 boot/ : Must be copied to a FAT32 partition
77 rootfs/ : Must be copied to an ext4 or btrfs partition
78 </pre>
80 <p>
81 Be sure the SD card has got 3 partitions (boot, swap, root). The
82 recommended partition sizes are 40Mb for /boot, 420Mb for swap and
83 using all available free space for root. Then you simply have to
84 run the install.sh script from the SliTaz Raspberry Pi release
85 directory:
86 </p>
87 <pre>
88 # ./install.sh
89 </pre>
91 <h2 id="firstboot">First boot setup</h2>
93 <p>
94 On the first SliTaz Raspberry Pi boot you will be prompted to configure
95 basic system settings such as the system keymap and the root password.
96 Then you will be prompted to create the default user with its password.
97 </p>
98 <p>
99 On any secure GNU/Linux system you will have to have at least the administrator
100 (root) and the default human user. In this way, users can fully use
101 the system but can't break it.
102 </p>
103 <p>
104 You can preconfigure the system before the first boot by editing the
105 configurations on the SD card and you can skip the post installation
106 steps. More info on the SliTaz ARM Codex:
107 <a href="system.html#firstboot">System configs</a>
108 </p>
110 <h2 id="config">System configuration</h2>
112 <p>
113 All SliTaz Raspberry Pi basic configurations can be done via a nice
114 Ncurses driven GUI with mouse support under an X session and via
115 a CGI/web administration interface. Please check the detailed
116 <a href="#remote">remote control section</a> in the book for more
117 information about the CGI/Web control panel.
118 </p>
120 <pre class="box-up">
121 tazberry : Dedicated tool for all Raspberry Pi specific configs
122 slitaz-config : SliTaz system configs such as keymaps, lang, users
123 </pre>
125 <p>
126 Tazberry and slitaz-config tool are accessible from the 'System Tools'
127 menu or can be run from a cmdline:
128 </p>
130 <pre>
131 # tazberry
132 # slitaz-config
133 </pre>
135 <h2 id="audio">Audio settings</h2>
137 <p>
138 The Raspberry Pi has two audio output modes: HDMI and headphone jack.
139 You can switch between these two modes at any time. SliTaz Raspberry Pi
140 provides a custom web admin plugin to graphically configure and check
141 audio settings locally or remotely. The web audio control lets you
142 switch audio output and play a sound to test settings. You can directly
143 access the audio control panel with a URL in the form of:
144 </p>
145 <pre>
146 http://192.168.x.xxx/adm/tools.cgi?audio
147 </pre>
148 <p>
149 You can also configure the Raspberry Pi audio output from the command
150 line where the last number is the output mode (0=auto 1=jack 2=hdmi):
151 </p>
152 <pre>
153 # amxier cset numid=3 1
154 </pre>
155 <p>
156 The desktop flavor includes Alsa audio mixer and mpg123 cmdline
157 audio player. Please check the Codex apps page for a common list of
158 <a href="apps.html#multimedia">multimedia applications</a>.
159 </p>
161 <h2 id="update">System &amp; kernel update</h2>
162 <p>
163 It is always a good idea to check for updates! It will bring you fixes
164 and new features. With SliTaz Raspberry Pi you have to upgrade all
165 the installed packages and the custom Linux Kernel. Updates can be done
166 via spk-dialog and tazberry found in the "System Tools menu" or directly
167 from a command line:
168 </p>
169 <pre>
170 # spk-dialog
171 # tazberry
172 </pre>
174 <h2 id="add-apps">Installing new packages</h2>
176 <p>
177 After your system is configured and connected to the web, you may want
178 to install new packages to add functionality to your SliTaz system.
179 You can install new applications via spk-dialog GUI or from the command
180 line with spk-add:
181 </p>
182 <pre>
183 # spk-add package package1 packageN
184 </pre>
185 <p>
186 You can find a list of packages on the SliTaz Raspberry Pi website
187 or by using the spk-find utility. You can search by package name, keyword
188 or description:
189 </p>
190 <pre>
191 # spk-find i2c
192 </pre>
194 <h2 id="def-apps">Installed applications</h2>
196 <p>
197 SliTaz Raspberry Pi can come in many flavors with a custom pre-installed
198 packages set. This section will cover the base and desktop flavors, more
199 information about a spécific flavor may be found on the SliTaz Raspberry
200 Pi website.
201 </p>
203 <h3>Base system</h3>
204 <p>
205 The base flavor provides a text mode system with cmdline only tools, all
206 Busybox applets are present. It supports wireless networks but no sound.
207 The default and most useful applications are:
208 </p>
210 <ul>
211 <li>Dropbear SSH client &amp; server</li>
212 <li>Busybox HTTPd, NTPd, FTPd servers</li>
213 <li>The CGI/Web admin interface and TazBerry</li>
214 <li>Clex file manager and Lynx web browser</li>
215 <li>TazIRC IRC client and Spk packages manager</li>
216 <li>Joe text editor and wget :-)</li>
217 </ul>
219 <h3>Desktop environment</h3>
220 <p>
221 The SliTaz Raspberry Pi desktop flavor focuses on providing a fast,
222 elegant, and easy to use desktop environment. The desktop is powered
223 by JWM window manger and you will find all the base applications plus GUI
224 programs:
225 </p>
227 <ul>
228 <li>Text editors: Adie + FLTK Editor</li>
229 <li>File manager: PathFinder</li>
230 <li>Web browser: Dillo</li>
231 <li>X terminal: Xterm</li>
232 <li>Audio mixer: Alsamixer</li>
233 <li>Audio player: mpg123</li>
234 <li>2 nice games: Blocks Attack + Sudoku</li>
235 <li>Fluid FLTK GUI designer</li>
236 <li>Lua programming language</li>
237 <li>SQLite database support</li>
238 <li>Htop processes monitor</li>
239 </ul>
241 <h2 id="pi-pkgs">Raspberry Pi Packages</h2>
243 <p>
244 Some custom tools and libraries have been packaged specially for the
245 SliTaz Raspberry Pi distribution. Here is a list of packages and
246 a short description:
247 </p>
249 <ul>
250 <li>slitaz-arm-rpi - Provides the CGI/adm plugins, tazberry and custom
251 config files.</li>
253 <li>raspberrypi-boot - Provides the R-Pi bootloader firmware.</li>
255 <li>raspberrypi-boot-x - Provides the R-Pi bootloader firmware with
256 Pi Camera support.</li>
258 <li>raspberrypi-vc -Raspberry Pi VideoCore Tools, including
259 raspistill and raspivid.</li>
261 <li>gst-omx - A gstreamer-1.0 plugin which can do hardware-accelerated
262 video decoding on the Raspberry Pi. </li>
264 <li>wiringpi - A GPIO access library written in C for the BCM2835
265 used in the Raspberry Pi.</li>
267 <li>wiringpi-piglow - The WiringPi tool for PiGlow, useful to handle
268 leds from SHell scripts.</li>
270 <li>picamera - Provides a pure Python interface to the Raspberry
271 Pi camera module.</li>
273 <li>libbcm2835 - Provides access to GPIO and other IO functions on
274 the Broadcom BCM 2835 chip.</li>
276 <li>rcswitch-pi - RCSwitch implementation for the Raspberry Pi.</li>
278 <li>python-rpi-gpio - Python class to control the GPIO on a Raspberry Pi.</li>
280 <li>python-rpi-pyglow - Control Piglow from Python. Includes a custom
281 SliTaz utility to easily play with PiGlow.</li>
283 <li>pi-blaster - Enables PWM on the GPIO pins you request of a Raspberry Pi.</li>
285 <li>libmcp23s17 - A simple C library for accessing an MCP23S17 port expander
286 found on PiFace board.</li>
288 <li>libpifacedigital - A simple library for controlling PiFace Digital</li>
290 <li>(xorg-xf86-video-fbturbo) - Buggy Xorg server module for the R-Pi.</li>
291 </ul>
293 <h2 id="remote">GUI &amp; secure remote control</h2>
295 <p>
296 This section will cover remote control using the SliTaz CGI/Web admin
297 interface, SSH secure SHell connections and graphical desktop control
298 with VNC.
299 </p>
301 <h3>CGI/Web interface</h3>
303 <p>
304 The CGI/Web interface is a nice way to control your Raspberry Pi machine
305 using Dillo from the desktop or any web browser from another computer,
306 mobile or tablet device. Remote control via the CGI interface is enabled
307 by default. To stop/start the service or to use another port, please refer
308 to the SliTaz ARM Codex: <a href="system.html#cgi-adm">System page</a>
309 </p>
311 <p>
312 SliTaz Raspberry Pi provides plugins to easily handle your Pi. In a nifty
313 and clean interface you can: poweroff/reboot the system, configure boot
314 settings including blacklisted modules, set audio output and test sound,
315 play with GPIO pins and get I2C information, and turn on/off the green led :-)
316 The tool lets you do quite a few more handy actions that you will discover
317 browsing the interface.
318 </p>
320 <p>
321 First you must found out the local IP address of your Raspberry Pi machine.
322 On your SliTaz Pi you can use 'ipinfo' to get the IP, then connect using
323 this IP. To connect you must use 'root' as user name with the correct
324 system administrator password.
325 </p>
326 <pre>
327 $ ipinfo
328 </pre>
330 <h3>Secure SSH connection</h3>
331 <p>
332 By default all flavors provide Dropbear Secure SHell, a lightweight but
333 powerful and standard compliant SSH client and server. The server is
334 not started by default, you can start it manually from the cmdline or
335 edit /etc/init.d/rcS.conf to start it automatically on each boot:
336 </p>
337 <pre>
338 # startd dropbear
339 # editor /etc/rcS.conf
340 </pre>
342 <h3>VNC Desktop control</h3>
343 <p>
344 VNC is great tool for letting you remotely control a desktop. The steps are:
345 install and start the VNC server on your Pi, then install a VNC client on
346 your desktop machine, mobile phone or tablet. To install the server
347 and start it on your Raspberry Pi (via an SSH connection or with an
348 attached keyboard and screen):
349 </p>
350 <pre>
351 # spk-add x11vnc
352 # startd x11vnc
353 </pre>
355 <h2 id="setup">Pi setup suggestions</h2>
357 <p>
358 What can you do with your SliTaz Raspberry Pi distro? Use it as a tiny
359 desktop! Learn Linux, Lua, Python, SHell scripting. Play with some
360 electronics circuits, sensors, leds and Raspberry Pi pluggable boards.
361 Setup servers, use the cam for fun or security purposes, create a secure
362 wifi network, ...- So much can be done with a Pi!
363 </p>
365 <ul>
366 <li>Kids learn about computers with Scratch and games</li>
367 <li>Web server with SHell and Python CGI support</li>
368 <li>Secure and anonymous wifi network with Tor</li>
369 <li>Development system including a wide range of tools</li>
370 <li>Electronic circuits playground with breadboards</li>
371 <li>Security camera with infra red support</li>
372 <li>Audio player and streamer with MPD</li>
373 <li>Video player with MPlayer or gst-omx (provides hardware
374 accelerated decoding on the Raspberry Pi)</li>
375 <li>Video streamer with gst-omx or ffserver</li>
376 <li><a href="setup.html">Codex setup guides</a></li>
377 </ul>
379 <h2 id="desktop">Desktop customization</h2>
381 <p>
382 Your SliTaz Raspberry Pi Desktop can be customized to infinity! With
383 a little editing of configuration files and autostart scripts you can
384 configure the entire environment. The default window manager is
385 JWM, but it can be replaced by OpenBox, Enlightenment (e17) or the
386 DWM dynamic window manager.
387 </p>
389 <p>
390 JWM autostarted applications and themes are set in a xml.jwmrc file.
391 By default the system wide config is used, lets copy it to your home
392 folder as a .jwmrc hidden file and then edit it:
393 </p>
394 <pre>
395 $ cp /etc/xdg/jwm/system.jwmrc ~/.jwmrc
396 $ editor .jwmrc
397 </pre>
398 <p>
399 The system wide menu path is: <b>/etc/xdg/jwm/menus.jwmrc</b> and
400 is updated by SliTaz packages manager. You can also copy it to
401 your home folder if you want to customize it. See the official
402 <a href="http://joewing.net/projects/jwm/config.shtml">configuration documentation</a>
403 for comprehensive documentation on configuring JWM.
404 </p>
406 <h3>Icon bar &amp; panel</h3>
407 <p>
408 To have a transparent icon bar with the applications of your choice,
409 you can use Wbar2. Install it and test it:
410 </p>
411 <pre>
412 $ sudo spk-add wbar2
413 $ wbar
414 </pre>
415 <p>
416 To have a desktop panel with Openbox you can use Tint2. Install it
417 and test it:
418 </p>
419 <pre>
420 $ sudo spk-add tint2
421 $ tint2
422 </pre>
424 <h2 id="gpio">GPIO Pins &amp; I2C Bus</h2>
426 <p>
427 SliTaz provides all the necessary tools to work with the Raspberry Pi
428 GPIO pins and I2C bus. The CGI/Web admin interface lets you control
429 the GPIO pins and get I2C information. Pi I2C kernel module is
430 blacklisted by default and can be loaded manually, by on-demand scripts
431 or at boot by commenting the blacklist line in:
432 </p>
433 <pre class="box-up">
434 /etc/modprobe.d/rpi-blacklist.conf
435 </pre>
437 <p>
438 To have a full working I2C bus system we must also load the 'i2c-dev'
439 kernel module which is not autoloaded by udev. In this case we must
440 use a SliTaz boot time configuration file, lets edit the config file
441 to modify the line LOAD_MODULES to look like below:
442 </p>
444 <pre>
445 $ editor /etc/rcS.conf
446 # Kernel modules to load earlier in boot.
447 LOAD_MODULES="snd-bcm2835 i2c-dev"
448 </pre>
450 <h2 id="pileds">Using leds with the RPi</h2>
452 <p>
453 Leds can be used for many purposes such as for a notification or as a light show.
454 SliTaz Raspberry Pi provides a built-in utility to help set up and
455 use leds. The RPi has an onboard green led (ACT) that you can
456 turn on or off:
457 </p>
458 <pre>
459 # pileds act
460 </pre>
462 <p>
463 Pileds also provides examples and usable commands for Adafruit 7segment
464 LED Backpack and the 8x8 LED Matrix. Creating visual elements with
465 Kids is fun and lets them learn mathematics at the same time, since
466 the leds must be mapped (ie: 0, 3) on a grid. Let's display a nice
467 little boat and pileds built in help:
468 </p>
470 <pre>
471 # pileds 8x8 --boat
472 # pileds help
473 </pre>
475 <p>
476 PiLeds uses some example code from Adafruit and PiClass Git Hub
477 repositories. We have packaged them for easy install/updates and
478 to provide some code right under the hood. Adafruit and PiClass
479 code examples are located in:
480 </p>
482 <pre class="box-up">
483 /usr/share/adafruit
484 /usr/share/piclass
485 </pre>
487 <!-- Camera -->
488 <h2 id="picam">Pi Camera - Pi NoIR</h2>
490 <p>
491 Raspberry Pi onboard camera works flawlessly with SliTaz. You can
492 setup then shot, record and stream video with our easy to use and
493 home made tools and the official VideoCore Tools from The Raspberry Pi
494 foundation. Official documentation can be found on elinux.org wiki:
495 <a href="http://elinux.org/Rpi_Camera_Module">Rpi Camera Module</a>
496 </p>
498 <p>
499 To setup your camera from your Pi device, you can run TazBerry from
500 the desktop menu or directly start the cam setup from a cmdline:
501 </p>
502 <pre>
503 # tazberry cam-setup
504 </pre>
506 <p>
507 After reboot you can test the camera with <b>raspivid</b> and take a
508 picture via the CGI/Web Camera plugin. To test the camera:
509 </p>
510 <pre>
511 $ su -
512 # raspivid -d
513 </pre>
515 <h3>Pictures with Raspistill</h3>
517 <p>
518 The official tool to take pictures with the camera board is
519 <b>raspistill</b>. The following command will take a picture
520 and create the PNG image shot.png:
521 </p>
522 <pre>
523 # raspistill -o shot.png
524 </pre>
526 <!-- PiGlow -->
527 <h2 id="piglow">PiGlow from Pimorini</h2>
529 <p>
530 PiGlow is a fun and cheap little board to learn and play with leds. It
531 can do very nice effects and also supports easy on/off switches and brightness
532 settings. Plug in your PiGlow board, boot your Raspberry Pi, install the Python
533 PyGlow examples and utilities testsuite:
534 </p>
536 <pre>
537 # spk-add python-rpi-pyglow
538 # pyglow test
539 # pyglow help
540 </pre>
542 <p>
543 In the package database you will also find <b>wiringpi-piglow</b>
544 providing the 'piglow' utility. On the Python side, we provide some
545 examples that you can use to learn and code your own scripts. Have
546 a look in the folder:
547 </p>
549 <pre class="box-up">
550 /usr/share/pyglow
551 </pre>
553 <!-- PiFace -->
554 <h2 id="piface">PiFace Digital</h2>
556 <p>
557 The PiFace Digital board allows you to connect things like switches,
558 lights and motors so that your Raspberry Pi can become aware of, and
559 influence the world around it. Plug in your PiFace board then use
560 SliTaz <b>piface</b> utility to install the official C library,
561 the 'pifacedigital' utility and set of tiny tools:
562 </p>
564 <pre>
565 # piface help
566 </pre>
568 <p>
569 To test your Piface Digital board on SliTaz Raspberry Pi you simply
570 have to run the testsuite from the cmdline. The tool will test GPIO
571 pins, leds and input buttons:
572 </p>
574 <pre>
575 # piface testsuite
576 </pre>
578 <h3>PiFace Metronome</h3>
580 <p>
581 The Piface SliTaz utility uses WiringPi to provide a simple metronome
582 using PiFace relays. The default is 80 beats per minutes but you can
583 specify any beats in a range of 40 to 200. To turn on and off the
584 metronome:
585 </p>
587 <pre>
588 # piface metronome 120
589 # piface metronome
590 </pre>
592 <h3>Piface Reaction game</h3>
594 <p>
595 Let's play a reaction game with PiFace Digital. Run the command
596 below then press a button and wait until 2 LEDs are on and press
597 the corresponding button as fast as you can:
598 </p>
600 <pre>
601 # piface reaction
602 </pre>
604 <h3>Piface Digital info</h3>
606 <pre>
607 Kernel modules : i2c_bcm2708 i2c-dev
608 SliTaz packages : libpifacedigital wiringpi-piface
609 Official website : <a href="http://www.piface.org.uk/">www.piface.org.uk</a>
610 Official guides : <a href="http://www.piface.org.uk/guides/">www.piface.org.uk/guides</a>
611 </pre>
613 <!-- RaspiComm -->
614 <h2 id="raspicomm">RaspiComm</h2>
616 <p>
617 RaspiComm is a pluggable board which uses advanced features like a 5-way
618 joystick, two serial ports (RS-232 and RS-485), l2c output and a
619 realtime clock. The board lets you directly control a display, a stepper
620 motor controller, relays and more.
621 </p>
623 <p>
624 SliTaz Raspberry Pi provides a built-in tool to let you use and test
625 the RaspiComm board out-of-the-box. Shutdown down your Pi if needed,
626 plug in the board on to the GPIO pins and boot the system, then run the
627 testsuite:
628 </p>
630 <pre>
631 # raspicomm init
632 # raspicomm testsuite
633 </pre>
635 <p>
636 The testsuite will prompt you to move the Joystick left and top
637 after the LED tests. To initialize the board on each boot, setup
638 the system clock and automatically load the i2c kernel modules, you
639 need to edit the <b>local.sh</b> boot script and add a line to start
640 'raspicomm init'. This can be done in one command or by using a text
641 editor:
642 </p>
644 <pre>
645 # echo 'raspicomm init' >> /etc/init.d/local.sh
646 </pre>
648 <p>
649 The Real Time Clock uses the i2c bus. When the clock is initialized you
650 can find information in: /sys/class/i2c-adapter/i2c-1/1-0068. On the
651 first setup you need to sync the system clock from the web and then
652 set the RTC from the system clock. On next reboot the system clock
653 will be sync'd with the Real Time Clock:
654 </p>
656 <pre>
657 # rdate -s tick.greyware.com
658 # hwclock --systohc
659 </pre>
661 <p>
662 Here is a small SHell example to turn on/off LED1. The led uses the
663 gpio pin number 18. The raspicomm utility already exported the
664 LED pins so we just have to set the value: 1 to turn it on and 0
665 to switch it off:
666 </p>
668 <pre>
669 # echo 1 > /sys/class/gpio/gpio18/value
670 # echo 0 > /sys/class/gpio/gpio18/value
671 </pre>
673 <p>
674 Official RaspiComm:
675 <a href="http://amescon.com/media/5277/Raspicomm_User_Manual.pdf">PDF User Manual</a>
676 </p>
678 <!-- Close content -->
679 </div>
681 <div id="footer">
682 &copy; 2014 - <a href="http://www.slitaz.org/">SliTaz GNU/Linux</a>
683 </div>
685 </body>
686 </html>