Changes

From Studiosg
Jump to navigationJump to search
Added article about building TDE 14.0.1 on a Raspberry Pi 2 and SlackwareARM 14.1
Welcome to Simone Giustetti's wiki pages.


Languages: '''English''' - [[Trinity_desktop_environment_raspberry_pi_2 |Italiano]]

----

The '''Raspberry Pi''' is a compact, credit card sized, cheap, priced around 35 Euros, computer aimed at '''teaching programming to a young audience'''. The first version was released the 29th February 2012 by the [https://www.raspberrypi.org Raspberry Pi foundation], that has been managing its development and updates to this day. In February 2015 the first model of the next generation Raspberry Pi was released: The '''Raspberry Pi 2'''. The new computer comes equipped with a Quad Core CPU, 900 MHz clock speed and 1 Gb of integrated RAM: a considerable computing power, thousand of times the specifics of servers I used to install not so many years ago. A fact proving how the Raspberry Pi is an ideal platform for large projects and that I'm growing really old >_< .

'''Raspian''', a '''Debian GNU Linux''' expressly modified spin-off, is the official operating system provided and supported by the [https://www.raspberrypi.org Raspberry Pi foundation]. It is however possible to install an operating systems of choice on the device. Any '''Linux''' distribution meant for the '''ARM platform''', '''SlackwareARM 14.1''' for example, will run flawlessly on the Raspberry Pi 2 providing users with all of the applications and programs available on a standard PC. Many applications result fast and reactive, while some others loose the comparison in performances with a recent laptop. Sadly the '''KDE 4''' desktop environment ranks among the latter bunch requiring a somewhat excessive amount of resources from the Raspberry Pi. A potential solution consists of switching to a lighter desktop environment like '''XFCE''', but that means giving up some great KDE included applications. Another solution, requiring some hard work, but resulting in a better alternative, consists of installing TDE. The '''Trinity Desktop Environment''' project aims to continue supporting and further developing release 3 of KDE providing a good user experience while keeping hardware support up to date. TDE is a fully developed, stable and feature rich desktop environment and a lighter alternative to KDE 4 therefore better suited for low resources computers.

The present paper will provide You step by step instructions for installing release 14.0.1 of the '''Trinity Desktop Environment''', '''TDE''' in short, on a SlackwareARM 14.1 powered Raspberry Pi 2.


== Installing Slackware ARM on a Raspberry Pi 2 ==

The first step of the project obviously consist of installing the latest available SlackwareARM release on a Raspberry Pi 2. The [https://www.raspberrypi.org Raspberry Pi foundation] provides no support for the Slackware derived distribution, similarly SlackwareARM provides no support for the Raspberry Pi platform. Nevertheless the procedure does not differ that much from a standard PC installation of Slackware and is well [http://rpi2.fatdog.eu/index.php?p=installer documented] on the net. The few discrepancies echo the platform differences between an embedded system and a personal computer namely the absence of a '''BIOS''', a '''CD/DVD''' reader and a few other devices common in a PC.

Some devices are needed for the installation:
* A MicroSD card with 16 Gb free space we'll install the operating system to.
* A PC compatible MicroSD card reader.
* A USB stick with 4 Gb or more free disk space where to copy the installation packages.
* USB mouse, USB keyboard, monitor, cables an everything else needed by the the Raspberry Pi to run.

=== Configure the MicroSD card ===
'''Root''' privileges are needed to perform a successful installation. From now on, if not otherwise specified, assume to work as root user.

Connect the MicroSD card to the PC through the card reader. When correctly detected by the operating system the card will appear in the disk list returned by command '''fdisk''' like in the example below:
'''fdisk''' ''-l''
Disk /dev/sdc: 15.9 GB, 15931539456 bytes
255 heads, 63 sectors/track, 1936 cylinders, total 31116288 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Device Boot Start End Blocks Id System
/dev/sdc1 8192 31116287 15554048 c W95 FAT32 (LBA)

Download the '''SlacwareArm''' installation image to a local directory:
: '''cd''' /tmp
: '''wget''' http://rpi2.fatdog.eu/files/img/rpi2-slackwarearm-install_13Mar15_fd.img.xz
: '''wget''' http://rpi2.fatdog.eu/files/img/rpi2-slackwarearm-install_13Mar15_fd.img.xz.md5

When the download concludes check the image for consistency errors that could be a consequence of a partial or incomplete download:
: '''md5sum''' ''-c'' rpi2-slackwarearm-install_13Mar15_fd.img.xz.md5

Should the command return an error, please try downloading the image again. Hopefully the problem will not represent itself. In case no error is detected go on and copy the image on the card using the '''dd''' command:
: '''xz''' ''-dc'' rpi2-slackwarearm-install_13Mar15_fd.img.xz | '''dd''' of=/dev/sdc bs=65536

Where /dev/sdc is the MicroSD card previously connected to the PC and detected by the operating system. The outcome of the copy can be tested using the '''fdisk''' command. Check for '''the partition size to be smaller''' and the '''boot flag to be active''':
'''fdisk''' ''-l''
Disk /dev/sdc: 15.9 GB, 15931539456 bytes
4 heads, 32 sectors/track, 243096 cylinders, total 31116288 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x08dd8e65

Device Boot Start End Blocks Id System
/dev/sdc1 * 32 156287 78128 c W95 FAT32 (LBA)

=== Installation Packages ===
'''SlackwareARM does not distribute ISO images''' as the majority of ARM based devices do not have a CD/DVD reader and, even if an external one were attached through the USB port '''they could not boot from it'''. There are two convenient ways to install SlackwareARM after starting the setup program:
# Reading packages shared thorough the network via NFS.
# Reading packages from an USB attached drive or storage.
We'll recur to the latter option. A list of download locations for the packages can be found [http://arm.slackware.com/getslack/ here]. Once downloaded, copy SlackwareARM packages on the USB stick. We'll connect it to the Raspberry Pi later on during the installation.

=== Start the SlackwareARM installation ===
To start the installation:
* Connect the MicroSD card in the Raspberry Pi integrated reader.
* Connect USB mouse and keyboard.
* Connect the USB stick containing the previously downloaded installation packages.
* Connect the HDMI/RCA cable to the monitor.
* Turn the monitor on.
* Connect the power cable to the Raspberry Pi.
If everything goes as planned the Raspberry Pi power red led will switch on briefly followed by the green one, connected to the MicroSD reader, the latter will then start blinking. On top of the monitor will appear a '''number of raspberries equal to the number of cores''' and somewhat lower the keyboard selection window will open. Were something not working: it could be a problem with the installation image that can be solved by overwriting the MicroSD card, or an issue with the card itself; then You should replace it and try with a new one.

=== Set Date and time ===
The Raspberry Pi does not include a hardware clock: '''the system date resets to 1st January 1970 at every shutdown and the current date and time must be configured at each boot'''. The date and time set up must be performed during the installation too otherwise the program will refuse to install packages younger than the system thinking of a configuration error. To set date and time:
* Select a keyboard layout from the provided list.
* Log-in as user root (You will not be required a password during the installation).
* Run command '''date''' with the ''-s'' option to set the date:
: '''date''' ''-s'' "<day> <month> <date> <hour>:<minute>:<second> <year>"
Where
: <day> = 3 character string setting the day of the week.
: <month> = 3 character string setting the month of the year.
: <date> = Day of the month represented with 2 numerical characters.
: <year> = Year represented with 4 numerical characters.
: <hour> = Hour represented with 2 numerical characters.
: <minute> = Minutes represented with 2 numerical characters.
: <second> = Seconds represented with 2 numerical characters.
: Example: '''date''' ''-s'' "Thu Sep 3 16:06:35 2015"
Were the net configured and up it would be possible to update the system date querying a public '''NTP server''' through command:
: '''ntpdate''' pool.ntp.org

=== Partition the MicroSD Card ===
The MicroSD card is managed like a hard disk and as such needs partitioning. Creating a number of partitions greater than one means better security for data against file system corruption and an increased flexibility when upgrading, backing-up or reinstalling the system. The first step consist of searching the card among the system detected devices through command '''fdisk'''. A synthesis of its output follows:
'''fdisk''' ''-l''
/dev/mmcblk0
/dev/mmcblk0p1
The card corresponds to device '''/dev/mmcblk0''' while '''/dev/mmcblk0p1''' is its first partition, the one containing boot files. Run standard command '''cfdisk''' to partition the card:
: '''cfdisk''' /dev/mmcblk0
The existing partition '''should not be touched'''. Create some other ones in addition to it: a '''swap partition''' of at least 256 Mb, a '''root partition''', where to install the system binaries, and a '''home partition''' for user data. It is possible to create many more, the listed ones represent a bare minimum. Always check for '''the boot flag of the first VFAT partition to be active''' before writing the partition table and exit cfdisk.

=== Copy Packages ===
Mount the USB stick containing the SlackwareARM packages to a local directory then run the installation program typing '''setup''' at the command prompt. The program will run through the standard Slackware Linux installation steps.
* Activate a swap partition.
* Activate the system partition and the remaining ones.
* Save the partition configuration in file '''/etc/fstab'''.
* Activate the boot partition (VFAT) being careful to '''set umask 177''' while mounting it in order not to overwrite its content by mistake.
* Select a package source: the directory where the USB stick was mounted.
* Select the installation type then start package copy.
As previously stated the goal of this paper consist of proving for TDE to be a perfect replacement for KDE 4 therefore You are invited '''not to install KDE 4 packages nor the Qt4 libraries'''. Qt4 could be needed by programs other than KDE 4 ones and the library can in fact coexist with '''TQt''': the Trinity project maintained version of Qt 3. Unfortunately Qt4 presence could arise issues while building the many packages forming the Trinity Desktop Environment thus You are strongly suggested to install Qt4 after concluding the installation of TDE.

=== System Configuration ===
The SlackwareARM installation program follows step by step the standard Slackware one and the configuration procedure touches every aspect of the latter:
* Mouse configuration.
* Network configuration.
** Setting a hostname.
** Setting a domain for the host.
** Set a static IP address or configure a client for the DHCP service.
* Configure daemons and services to start at boot time.
* Select a font for the console.
* Configure the local timezone.
* Configure the predefined Window Manager. This step should be performed again after TDE installation.
* Set the root password.
Last the installation program will require a system reboot. '''Do not reboot immediately the machine''' and log-in to another terminal instead:
* Remove unneeded packages:
: ROOT=/mnt '''removepkg''' kernel_kirkwood kernel-modules-kirkwood
: ROOT=/mnt '''removepkg''' kernel_armv7 kernel-modules-armv7
* Remove the '''initrd.gz''' file from the root partition:
: '''mount''' ''-t'' vfat /dev/mmcblk0p1 /mnt/boot
: '''rm''' /mnt/boot/initrd.gz
* Install the Raspberry Pi firmware and kernel data:
: ROOT=/mnt '''installpkg''' /rpi2-extra/kernel* /rpi2-extra/rpi2*
After performing the above listed actions it is possible to proceed umounting the packages source then '''rebooting the system'''. The SlackwareARM installation on the Raspberry Pi is concluded and after rebooting the system it will be possible to log-in to the newly installed system and perform the TDE installation.


== Installing Trinity Desktop Environment on Raspberry Pi 2 ==

'''Trinity Desktop Environment 14.0.1''' was released 6th September 2015. A '''bug fix''' release resulting from months of work fixing user reported issues. '''No binary TDE packages are available for Slackware Linux'''. None available for PC nor for the ARM architecture. The only feasible way to install TDE consists of building packages from the source code. Compressed archives of the source code for packages can be downloaded from the following [http://tde-mirror.yosemite.net/trinity/releases/R14.0.1/downloads.html link]. Being a bug fix release, 14.0.1 does not differ much from the previous one: 14.0.0 whose build procedure was the subject of a [[trinity_desktop_environment_14.0.0 |previous article]] of mine: You are encouraged to read such article for a detailed description of the build scripts. Below I'll describe the differences introduced with new version 14.0.1.

=== Parallel Build ===
Modern CPUs are made of many cores: a feature permitting to execute many instructions concurrently. Modern compilers can take advantage of such a feature and '''drastically reduce build time while compiling code'''. Many packages included in the Trinity Desktop Environment can take advantage of parallel builds, but for others it is a source of errors. To avoid potential errors, the build scripts for release 14.0.0 '''did not enable any concurrency at all''' while building packages. A waste of resources and CPU power considering that the Raspberry Pi 2, like many other devices in commerce, comes equipped with '''4 cores'''. What seemed a safe choice some months ago, is also a lack I decided to fill introducing a new variable to manage concurrency level in the scripts: '''JOB_NUM'''.

The new variable was added to the line of code invoking the '''make''' command, just after source code configuration:
'''make''' VERBOSE=1 ${JOB_NUM}
As a standard rule '''a concurrency level equal to 6''' was introduced in accordance to the old KDE 3 official Slackware build scripts. The added variable is assigned a null value inside scripts: the real assignment happens in the '''TDE.options''' file containing global build options for the whole environment.
JOB_NUM=-j6
To set a greater or lesser value please modify the numeric value following the ''-j'' option. A value of ''-j1'' means using a single core '''disabling de facto concurrent building'''.

=== Parallel Build Errors ===
Some users reported errors while building TDE packages with a parallelism level greater than 1. Many reports interest only 2 packages: '''tdebindings''' and '''tdemultimedia'''. Tests executed while writing this paper revealed no problem, anyway should issues arise it is possible to bypass them during build setting a concurrency level equal to one. This can be done updating the '''TDE.options''' file or the option file specific to any package: '''local.options'''. To build the '''tdebindings''' package without recurring to a parallel build for example You'll need to move in the root directory for the package, the one containing the source code and local.options file: /usr/src/trinity/base/tdebindings in our example. Then edit the '''local.options''' file with Your text editor of choice adding line:
JOB_NUM=-j1
Save the update and run the SlackBuild script available in the very same directory:
'''sh''' ./tdebindings.SlackBuild
A standard build will start.

The instructions listed above have general value and can be used for tdemultimedia or any other package failing because of parallel build related errors.

=== Updated SlackBuild Scripts ===
The great majority of packages remain basically unchanged from release 14.0.0 to 14.0.1, but some introduced '''new dependencies''' or
'''new errors''' requiring a fix through a patch. Updates are listed below together with the build scripts:

==== TDELIBS ====
The first try at building a package for '''tdelibs''' resulted in a failure. The procedure exited with the following error:
[ 0%] Building C object dcop/KDE-ICE/CMakeFiles/kICE-static.dir/accept.c.o
In file included from <command-line>:0:0:
/usr/include/tqt/tqt.h:54:23: fatal error: ntqglobal.h: No such file or directory
#include <ntqglobal.h>
^
compilation terminated.
make[2]: *** [dcop/KDE-ICE/CMakeFiles/kICE-static.dir/accept.c.o] Error 1
make[1]: *** [dcop/KDE-ICE/CMakeFiles/kICE-static.dir/all] Error 2
make: *** [all] Error 2

Initially I thought of a problem introduced by the parallel build as release 14.0.0 of the package presents no such problem. A second try executed setting value '''-j1''' returned the same error. Parallel building was not originating the problem thus I checked for all prerequisites to be correctly installed and for the presence of a file named '''ntqglobal.h''' in the file system. The '''find''' command quickly confirmed the presence of the file:
'''find''' / ''-name'' "ntqglobal.h"
/opt/trinity/include/ntqglobal.h
Reading package details I was able to check that was the right file:
'''grep''' ntqglobal.h /var/log/packages/*
/var/log/packages/'''tqt3-R14.0.1-arm-1sg''':opt/trinity/include/ntqglobal.h

The issue was solved '''adding a new path where to search for include files''' while building the source code. A couple of lines of code were added to to the build script:
# Add some include paths to the standard compiler flags otherwise the build
# process will fail with an error
SLKCFLAGS="${SLKCFLAGS} -I${PREFIX}/include"
Which concatenate '''/opt/trinity/include''' to the path list. The updated script works flawlessly.

==== TDENETWORK ====
With package '''tdenetwork''' the problem did not arise soon, but later on after build: while copying files to the temporary installation directory. The specific error is:
[ 71%] Building CXX object krdc/vnc/CMakeFiles/vnc-static.dir/threads.cpp.o
/tmp/build/tmp-tdenetwork/tdenetwork/krdc/vnc/threads.cpp: In function 'void output(const char*, ...)':
/tmp/build/tmp-tdenetwork/tdenetwork/krdc/vnc/threads.cpp:113:10: error: 'class TQString' has no member named 'vsprintf'
message.vsprintf(format, args);
^
make[2]: *** [krdc/vnc/CMakeFiles/vnc-static.dir/threads.cpp.o] Error 1
make[1]: *** [krdc/vnc/CMakeFiles/vnc-static.dir/all] Error 2
make: *** [all] Error 2

Again my first check regarded the parallelism level set to 6 and again tests revealed the origin of the issue to be searched for somewhere else. Reading the documentation for the TQString and TQCString involved classes:
'''man''' tqt3-tqcstring
'''man''' tqt3-tqstring
turns out that they do not include any member named '''vsprintf''', as per error message. Both include a method named '''sprintf''' consisting in a call to the previous one. The solution consists in '''replacing method vsprintf with sprintf''' in the lines of code of the '''output''' function of the '''threads.php''' file. Running command '''make install''' after the update resulted in a successful build.

To solve the problem once and for all a patch was introduced:
*** krdc/vnc/threads.cpp 2015-09-13 20:01:24.889992277 +0200
--- krdc/vnc/threads.cpp 2015-09-13 19:59:20.899992324 +0200
***************
*** 110,116 ****
va_start(args, format);

TQString message;
! message.vsprintf(format, args);

va_end(args);

--- 110,116 ----
va_start(args, format);

TQString message;
! message.sprintf(format, args);

va_end(args);

Applied by the SlackBuild script through lines:
# Patch the krdc/vncn/threads.cpp source file in order to solve an issue with the
# output function.
'''patch''' ''-p0 -i'' ${SRCDIR}/threads_sprintf.patch

A couple of days later, while searching the Trinity project bug tracker, I stumbled in a bug report concerning the error above: [http://bugs.pearsoncomputing.net/show_bug.cgi?id=2525 BUG 2525]. The patch was suggested as a potential solution to the problem.

'''Update''': The patch was refused because the error origin was found elsewhere. It seems some code from the tentative 14.1.0 release ended up in the 14.0.1 package. To solve the issue it is possible to:
# Download and build the code from the '''TDE GIT repository'''.
# Wait for an updated archive of the tdenetwork source code.
Either way applying the patch will probably result in an error with correct code so You need to '''comment out the lines of code added to the SlackBuild script'''.


No update was needed by any other package included in the base, library and prerequisite TDE group.


=== Tie Everything Together ===
To easily build TDE I wrote a '''main script: TDE.SlackBuild''' meant to drive the whole procedure building the single packages in the correct, documentation suggested order. A copy of the script and the whole build tree can be downloaded as a compressed archive [http://www.giustetti.net/resource/slackbuild/tde/1401/tde_build_tree_sg-14.0.1.tar.bz2 here]. Download the build tree and the source code for the TDE project in a local directory like '''/tmp''' then follow the steps listed below:
* Create directory '''/usr/src/trinity''':
: '''mkdir''' /usr/src/trinity
* Copy the build tree archive in the new directory
: '''cp''' /tmp/tde_build_tree_sg-14.0.1.tar.bz2 /usr/src/trinity
* Move to directory /usr/src/trinity
: '''cd''' /usr/src/trinity
* Extract the archive using the '''tar''' command:
: '''tar''' ''-jxf'' tde_build_tree_sg-14.0.1.tar.bz2
The /usr/src/trinity directory will be populated with files and sub-directories
'''ls''' ''-la''
total 14
drwxr-xr-x 7 root root 1024 Sep 14 19:52 .
drwxr-xr-x 5 root root 1024 Sep 14 19:52 ..
-rw-r--r-- 1 root root 314 Sep 14 14:53 TDE.options
drwxr-xr-x 113 root root 7168 Sep 14 17:40 application
drwxr-xr-x 22 root root 1024 Jan 1 1970 base
drwxr-xr-x 13 root root 1024 Jan 1 1970 library
drwxr-xr-x 16 root root 1024 Jan 1 1970 prerequisite
drwxr-xr-x 4 root root 1024 Jan 1 1970 tde_build_script

* Distribute the source file archives among the sub-directories in '''base''', '''library''' and '''prerequisite'''. The '''TDE.options''' file, a synthesis follows, includes build options for the whole environment:
# Global options used to build TDE.
#
# Do not place here package specific options. Use a file named
# "local.options" in the build root directory of the package
# instead.

ARCH="arm"
ARCHIVE_FORMAT="tar.bz2"
BUILD="1"
JOB_NUM="-j6"
MARCH="arm"
PREFIX="/opt/trinity"
SRCVER="R14.0.1"
TAG="sg"
TAR_OPTION="-xjvf"

* Open the options file with a text editor of choice and set the desired values for the variables therein. A minimum number of variables should be assigned a value fitting the target architecture and personal preferences:
** '''ARCH''' and '''MARCH''' used to set the target architecture for the build: '''arm for the Raspberry Pi 2'''.
** '''BUILD''' should be incremented for each update to the procedure.
** '''JOB_NUM''' sets the concurrency level while building packages.
** '''PREFIX''' sets the root directory for TDE. Use '''/opt/trinity to grant TDE and KDE 4 coexistence'''.
** '''SRCVER''' the TDE release.
** '''TAG''' a customizable identifier for the person performing the build.

* Move into directory '''/usr/src/trinity/tde_build_script/bin''' then run the build script:
: '''cd''' /usr/src/trinity/tde_build_script/bin
: '''sh''' ./TDE.SlackBuild

The script will autonomously build and install every package. '''A copy of each built package and related log files will be saved in directory /tmp'''.

The '''tde-i18n''' package, containing localizations for each TDE supported language, needs special mentioning. The main script contains the lines of code needed to build packages, but the procedure is a time consuming one thus the '''lines were commented out''' and localization packages are ignored. To build the localization packages the TDE.SlackBuild script should be modified removing the comment from line:
# bash ./${PKG}.SlackBuild
changing it to
bash ./${PKG}.SlackBuild

=== Build time ===
To understand how much the build time of the whole environment is affected by the newly introduced parallel build some basic data were collected while generating packages for '''Trinity Desktop Environment''' on a '''Rasperry Pi 2'''. The collected data cover the time required for the '''prerequisites packages, base packages with the exclusion of the localization ones and for the optional libraries packages'''. The many additional TDE applications were ignored. I don't personally use any of the applications and the environment can work without. The build operation executed wit a '''parallelism level equal to 1''' required '''47''' hours to complete. Setting a '''parallelism level equal to 6''' the required time decreased to '''less than 20 hours''' resulting in a consistent time save.


== Conclusions ==

This paper described how to install SlackwareARM then Trinity Desktop Environment on a Raspberry Pi model2. The whole experience turned out to be rather easy and straightforward providing the Raspberry Pi with a full, light and feature rich desktop environment. Some images depicting the running desktop are available below.

[[File:desktop_clean.jpeg]]

Fig: 1 - The TDE desktop at start time.

[[File:desktop_krdc.jpeg]]

Fig: 2 - The KRDC start window. An application that raised some issues while compiling the source code.

[[File:desktop_ksirtet.jpeg]]

Fig: 3 - Mighty Ksirtet.

[[File:desktop_tdevelop.jpeg]]

Fig: 4 - TDevelop an IDE for developers integrated in the desktop environment.


For any feedback, questions, errors and such, please e-mail me at ''studiosg [at] giustetti [dot] net''


External links

----

* [https://www.raspberrypi.org Raspberry Pi foundation home page]
* [https://it.wikipedia.org/wiki/Raspberry_Pi Raspberry Pi page in Wikipedia]
* [http://www.slackware.com Slackware home page]
* [http://arm.slackware.com Slackware Linux for the ARM architecture]
* [http://rpi2.fatdog.eu/index.php?p=home Unofficial Support page for Slackware and Raspberry Pi 2]
* [http://www.trinitydesktop.org TDE home page]

----

Languages: '''English''' - [[Trinity_desktop_environment_raspberry_pi_2 |Italiano]]

Navigation menu