Open main menu

DAVE Developer's Wiki β

Changes

XELK-AN-008: How to use systemd on an Embedded system

213 bytes added, 15:06, 16 February 2023
Wired interface
{{AppliesToAxelEsatta}}
{{AppliesToAxelLite}}
{{AppliesToAXEL Lite AN}}
{{AppliesToSMARX AN}}
{{AppliesToSBCX}}
{{AppliesToSBC Axel AN}}
{{InfoBoxBottom}}
systemd uses a slightly different configuration mechanism than SystemV. The configuration file is the following one with an example of configuration:
/etc/systemd/network/20-eth0.network
<pre>
ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
</pre>
 
Activate the new network configuration restarting the <code>systemd</code> services:
 
systemctl restart systemd-networkd
systemctl restart systemd-resolved
==== Wireless interface ====
systemctl enable wpa_supplicant@wlan0
=== Logging with systemd (<code>journalctl</code>) ===
systemd has its own logging process called <code>journal</code> avoiding to start the ''syslog'' daemon. For the status information it is possible to use <code>journalctl</code>.
</pre>
=== Analyze the boot time===
Boot time analysis is one of the most important and interesting activity for an embedded system: systemd provide an userspace command called <code>systemd-analyze</code> to help in this (hard) task
<code>systemd-analyze</code> provides a good level of boot time information for further optimizations:
==== time ====
The <code>time</code> parameter gives the total amount of seconds used for starting the kernel and reaching the userspace.
</pre>
==== blame ====
The <code>blame</code> parameter gives the list of started services and how long they took for starting:
</pre>
==== critical-chain ====
The <code>critical-chain</code> parameter shows the startup process flow and the time consumed by each service.
|}
=== Putting it all together: create a new service ===
For creating a new service the following file has to be created:
/etc/systemd/system/''<service_name>''.service
==== Service example ====
The following paragraph shows how to create a new service called <code>iperf3</code> executing the iperf3 command in server mode
</pre>
===== Basic settings =====
{| class="wikitable"
|}
===== Running a service =====
Starting the service from userspace:
8,221
edits