6. Software configuration possibilities

This section describes specific details for the configurability of the software components in the system, such as default configuration files, startup scripts and networking settings.

6.1 Installing new drivers, applications and system packages

The recommended approach for adding or installing a new user applications, libraries and binaries is from RAUC packages as described in CCLinux-RaucGuide [2]. By default, the application filesystem which holds the user applications, libraries and binaries is write protected. For some testing purposes, it is possible to temporarily mount the application filesystem as writeable, to allow edit of protected files.

6.1.1 Remounting application filesystem in read-write mode

The application filesystem can be remounted as writeable using the command:

$ sudo mount –o remount,rw /appfs

Important: remember to use the following command to remount the file system as write protected again, before shutting down or restarting the device. Note that any changes to the write-protected file system will be overwritten when performing an operating system upgrade.

$ sudo mount –o remount,ro /appfs

6.2 Systemd Management

Systemd is a system and service manager for Linux operating systems. When run as first process on boot (as PID 1), it acts as init system that brings up and maintains userspace services. Separate instances are started for logged-in users to start their services.

Systemd is usually not invoked directly by the user, but is installed as the /sbin/init symlink and started during early boot. The user manager instances are started automatically through the user@.service service.

The basic object that systemd manages and acts upon is a “unit”. Units can be of many types, but the most common type is a “service” (indicated by a unit file ending in .service). To manage services on a systemd enabled device, our main tool is the systemctl command.

The user has the possibility to start applications and scripts by modifying or adding systemd services.

We can start the service by typing:

$ sudo systemctl start weston.service

To stop it again, type:

$ sudo systemctl stop weston.service

To restart the service, type:

$ sudo systemctl restart weston.service

To attempt to reload the service without interrupting normal functionality, type:

$ sudo systemctl reload weston.service

Most systemd service files are not started automatically at boot. To configure this functionality, you need to enable the service. This hooks it up to a certain boot target, causing it to be triggered when that target is started.

To enable a service to start automatically at boot, type:

$ sudo systemctl enable weston.service

Disable the service, type:

$ sudo systemctl disable weston.service

There is a great deal of information one can pull from systemd to get an overview of the system state.

To list all the units systemd has loaded or has attempted to load into memory, including those that are not currently active, type:

$ sudo systemctl list-units --all

A systemd component called journald collects and manages journal entries from all parts of the system. This is basically log information from applications and the kernel.

To see all log entries from current boot, type:

$ sudo journalctl -b

For more information on journalctl, see:

$ journalctl --help

To see an overview of the current state of a service, you can use the status option with the systemctl command.

$ systemctl status weston.service

6.2.1 Systemd targets

In systemd, targets are basically synchronization points which the device can use to bring the device into a specific state. Service and other unit files can be tied to a target and multiple targets can be active at the same time. See Table 6 for a short description of systemd targets.

Table 6: Systemd targets

Systemd target

Description

poweroff.target, systemctl halt

Shutdown

multi-user.target

Start the system normally

graphical.target

Same as multi-user.target + display manager

reboot.target, systemctl reboot

Reboots the system

emergency.target

Emergency shell

All targets available on the device, type:

$ systemctl list-unit-files --type=target

Default target:

$ systemctl get-default

6.2.2 Example service

The default target is multi-user.target, so applications should at least have a startup service file for this target.

To start applications in multi-user.target, create a new service file:

$ sudo systemctl edit --full --force mycustomapp.service

Example mycustomapp.service:

[Unit]
Description=mycystomapp description

[Service]
ExecStart=/usr/sbin/mycustomapp start
ExecStop=/usr/sbin/mycustomapp stop

[Install]
WantedBy=multi-user.target

After modifying a unit file, you should reload the systemd process itself to pick up your changes:

$ sudo systemctl daemon-reload

Start new service:

$ sudo systemctl start mycustomapp.service

Enable new service on boot:

$ sudo systemctl enable mycustomapp.service

For more information on systemd and how the service files should be created, see[12]

6.2.3 Power off or reboot the system

To power off the device, type:

$ sudo systemctl poweroff

Reboot the device, type:

$ sudo systemctl reboot

6.3 Text editor

The console text editor nano is available per default for text editing, as well as the vi editor.

6.4 Terminal

It is possible to access a local device by connecting an external keyboard to the device and opening an on screen terminal by pressing down ctrl+alt+F4 keys. The login credentials are stated in chapter [2.1]

6.5 IP address configuration

There are several ways of setting the IP address of a device. The default method is DHCP, but a static IP address can also be used. This can be done through the network interfaces configuration file.

6.5.1 File method for IP address configuration

NetworkManager is used for network configuration. This method requires knowledge about the interfaces and the basic usage of NetworkManager daemon. You can see the active connections by using the command below.

$ sudo nmcli con show --active

To set a static IP address to the connection, you can use the command below. Please note that the connection name will be different than the interface name. (e.g ‘Wired connection 1’ for eth0):

$ sudo nmcli con mod ‘{Connection Name}’ ipv4.method manual ipv4.address {Static IP}/24

To set it back as a dynamic IP interface, you can use the command below:

$ sudo nmcli con mod ‘{Connection Name}’ ipv4.method auto ipv4.address “”

Once the file has been edited, it is recommended to either reboot the device, or to bring the network interfaces down and up again, for the IP address configuration to take effect:

$ sudo nmcli con up ‘{Connection Name}’

6.5.2 Firewall

The system uses iptables for the firewall. The following systemd units are responsible for the IPv4 and IPv6 firewall:

# IPv4
$ systemctl status iptables
# IPv6
$ systemctl status ip6tables

You can see the current active firewall rules with the following commands:

# IPv4
$ sudo iptables-save
# IPv6
$ sudo ip6tables-save

To configure the firewall, the following steps can be used. Add the new firewall rule:

$ sudo iptables -A INPUT -p tcp -s 0/0 -d 0/0 --dport 80 -j DROP

Update the firewall configuration:

# IPv4
$ sudo iptables-save > /tmp/iptables.rules
$ sudo cp /tmp/iptables.rules /etc/iptables/iptables.rules

# IPv6
$ sudo ip6tables-save > /tmp/ip6tables.rules
$ sudo cp /tmp/ip6tables.rules /etc/iptables/ip6tables.rules

Reboot and check that the firewall configuration works as desired.

6.6 IP Wireless LAN

The needed radio firmware is loaded at boot. Use the NetworkManager to connect to a Wi-Fi access point:

nmcli device wifi connect SSID password SSID_PASSWORD

6.7 Bluetooth

To use Bluetooth, you need to run the following commands.

sudo systemctl enable bluetooth-attach
sudo systemctl start bluetooth-attach

** ccs@v1200:# sudo /usr/bin/bluetoothctl
Agent registered>

** [bluetooth]# power on
Changing power on succeeded
[CHG] Controller 00:16:A4:4A:09:37 Powered: yes

** [bluetooth]# scan on
Discovery started
[CHG] Controller 00:16:A4:4A:09:37 Discovering: yes
[NEW] Device 11:75:58:E5:C3:99 TimeBox-mini-light
[NEW] Device 70:26:05:0D:49:46 LE_WH-1000XM2
[bluetooth]#

6.8 Remote access

The methods described in this chapter require an IP address being assigned to the device.

6.8.1 Firewall

To connect to the device from a host, issue the following command (and give password when asked):

$ ssh ccs@X.X.X.X

To connect to a host from the device, issue the following command:

~$ ssh Username@X.X.X.X

Above X.X.X.X is known as an SSH server IP address, with username Username. A password might be necessary.

Please note that root access over SSH is disabled.

The default login and password can be found in chapter 2.

6.8.2 SCP

To copy a file to the device (while on the host) use the following command (and give password when asked):

$ scp File1 ccs@X.X.X.X:

To copy a file from the device (while on the host) use the following command (and give password when asked):

$ scp ccs@X.X.X.X:File File

To copy a file to the host (while on the device), use the following command:

~$ scp File Username@X.X.X.X:File

To copy a file from the host (while on the device), use the following command:

~$ scp Username@X.X.X.X:File File

Above X.X.X.X is known as an SSH server IP address, username Username. A password might be necessary.

6.8.3 Password-free login for SSH and SCP

Even though the ccs user is password protected, SSH-connections can be configured to connect without password, using identity files. This method is mainly useful for remotely executed scripts or similar.

On the connecting host (not the target device), execute the command below and enter an empty passphrase when prompted.

~$ ssh-keygen -t rsa -f vs_rsa

Copy (or append) the created vs_rsa.pub file into target device as a /etc/ssh/authorized_keys -file.

On the host, move the vs_rsa file to a usable location (e.g. ~/.ssh/ )

Either configure the id-file into use in ssh_config or assign it when executing ssh or scp.

~$ ssh -i ~/.ssh/vs_rsa ccs@X.X.X.X

6.8.4 Remote command execution

After password-free login is enabled, any commands can be started remotely without login.

~$ ssh ccs@X.X.X:X "ls -al /opt/"

If starting services or background tasks, append “&” to command between quotes.

6.9 Weston Graphics

The graphics framework uses the Wayland protocol reference implementation Weston for graphics operations. Wayland is fast and efficient, and is used by most major Linux desktop systems, giving it vast standard support in the Linux user space world.

For instance, Qt has a plugin that enables the Qt libraries to be built for Weston. For Qt applications the impact for that means that it simply needs to be started with a specific flag, ‑platform wayland, and built with the correct development libraries.

Weston includes a windowing system, enabling several applications to be run overlapped.

By default, Weston is not enabled on start up. This can be easily changed with systemctl:

~$ systemctl enable weston

6.9.1 Graphical application launch

In order to launch a graphical application on Weston, the XDG_RUNTIME_DIR environment variable needs to be set. This can easily be done by either adding the following line to the application’s startup script, or running it from the command line before launching the application:

export XDG_RUNTIME_DIR=/run/user/994

6.10 Boot splash

CC Linux comes with a default boot splash screen containing a black background with a white progress bar. The boot splash used is called psplash; third party software released under the GPL2 license. If desired, it is possible to add a picture/logo and change the colors of the boot splash. In order to do so, the psplash source code needs to be modified and the binaries recompiled. Please refer to the document CC Linux-ChangeBootsplashAppearance guide which can be found at the Knowledge base on the CrossControl support site.

6.11 Serial Number Broadcast configuration

The device can identify itself over the IP network by sending out its serial number as a broadcast IP packet. The Serial Number Broadcast (SNB) service is started by default at the device boot-up and will broadcast a specific identification message to the local network every fifth second. The frequency of the broadcast can be modified, and the service can be completely disabled using the configuration file /etc/ccsnb.conf. Default values are used if any value is unset or the file does not exist.

# Serial Number Broadcast – configuration.
# Lines beginning with ‘#’ are comments.  Unnecessary options can be omitted.

# Message send interval in seconds
INTERVAL=5

# Service disable switch (DISABLE|OFF|0)
#ACTIVE=DISABLE

# Advanced features only. Use with discretion.
#
# Firmware-field is auto discovered, but can be overwritten. String value
#FIRMWARE=1.0.0
#
# UnitType, if unset '0' is used. String value
UNITTYPE=VS

6.12 Watchdog configuration

The device has watchdog daemon (WDT) that keeps updating watchdog after start. If watchdog is enabled, but it’s not updated often enough or system has crashed, watchdog will reset the system. WDT is default implementation of watchdog daemon and user can replace it but implementing same functionality to their own application. Setting timeout to zero disables watchdog functionality. Watchdog configuration file is /etc/watchdog_timeout.conf

# Set to 20sec by default. For systems with Systemd see
# DefaultTimeoutStopSec.
# If this is shorter than the systemd value, there is a risk that the watchdog
# will reboot the system before all services have shut down.
#
# Timeout = 0 disables the WDT from ever using WDT, but still keeps WDT
# daemon running. In this case it can be disabled/killed without watchdog
# causing reboot.
#
[wdt]
Timeout=20

6.13 USB memory installer

If a USB memory is inserted after startup, the USB will be automounted and if the USB has any of the update bundles as mentioned in [7.4] in its root folder, then the automatic software update will be done as described in [7.4.1]

6.14 Video file playback

Video file playback is supported by the gstreamer multimedia framework, which supports multiple video (MPEG2, H.264/AVC, H.265/HEVC, DivX, Xvid) and container formats (MPEG, AVI, mkv).

Generally, each supported kind of video can be played with the command:

$ gst-launch-1.0 playbin uri=file://path-to-file

There are some exceptions on the i.MX8-based devices using VPU decoding. Gstreamer must be explicitly forced to use the imxvideoconvert_g2d-plugin.

$ gst-launch-1.0 playbin uri=file://path-to-file video-sink="imxvideoconvert_g2d ! queue ! autovideosink"

Additionally, gplay-1.0 should be used (not gst-play1.0). These limitations are related to the platform using a specifically imx-patched version of gstreamer.

This command can also be used to play video files over a network and plays the file automatically so it can be launched from a script. For custom applications, gstreamer-1.0 C API can also be used, see documentation at [8].

6.15 Audio files playback

Audio playback is also supported by gstreamer multimedia framework, which supports multiple audio codecs (wav, MP3, AAC). Note that the device currently supports only codecs for WAV audio playback. Audio files can be played with the command:

# aplay <audiofile>

This command launches a player and plays the file automatically so it can also be launched from a script.

By default, the device will play on both the speaker and line out simultaneously. To play on one at a time, use amixer to mute the unwanted peripheral.

To mute the speaker:

#amixer set ‘Line Out’ mute

To mute audio out:

#amixer set ‘Speaker’ mute

Note: the speaker in amixer is physically wired to the audio out on the device, and vice versa.

Table 1: Audio playback availability

X1200

V700

V1x00

Vx10

Yukon

Yes

No

No

No

No

6.16 Adding user defined fonts to system

CC Linux uses fontconfig to handle installed fonts. Pre-installed fonts reside in /usr/share/fonts/ttf. New fonts can be added to a user specific directory, such as /opt/user-fonts directory. The new fonts need to be added to fontconfig using:

$ fc-cache </opt/user-fonts>

It is possible to list all the installed fonts by running:

$ fc-list

6.17 Triggers

The triggers are configurable actions which can be used to request change for the system state. Triggers are driven by external inputs such as ignition signal and buttons. The following categories of triggers are available.

Wakeup triggers

Causes the device to resume from the suspend mode. The wakeup triggers are configured with the –wakeup_trigger_prefix in ccsettingsconsole.

Startup triggers

Causes the device to start-up from the Off mode. The startup triggers are configured with the –startup_trigger_prefix in ccsettingsconsole.

Action triggers

Causes the device to either suspend or shutdown depending on the trigger configuration. Action triggers are configured with the –action_trigger_prefix in ccsettingsconsole.

On/off signal trigger The on/off signal (device specific implementation) causes the device to suspend or shutdown depending on the trigger configuration. The on/off trigger is configured with the –onoff_signal parameter in ccsettingsconsole.

Please note that supported triggers vary depending on the device used. The CCSettingsConsole help text shows the available trigger configurations. The following trigger configurations are under development and are currently not available:
  • IO MCU triggers (startup/action/wakeup triggers)

  • Ethernet trigger (startup/wakeup triggers)

  • CAN trigger (startup/wakeup triggers)