Useful command lines

Determining the Board’s IP Address

Use ip a command:

root@m3ulcb:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
    inet 127.0.0.1/8 scope host lo
      valid_lft forever preferred_lft forever
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    inet 10.0.12.15/24 brd 10.0.2.255 scope global eth0
      valid_lft forever preferred_lft forever

dnf / package management

Add repo (1st time)

dnf config-manager --add-repo repository_url

List the repositories

dnf repolist

Update the repo

dnf update --refresh

Install the package on board

sudo dnf install my-package

Uninstall a package

sudo dnf remove my-package

Power saving management

Kernel

CPU Freq

Most boards now use SoC that usually supports dynamic CPU frequency/voltage scaling. This technology allows the CPU frequency to be changed according to some kernel events (like the load of the system or using scripts and algorithms).

The Linux Kernel natively supports that and users can learn how it works using the Linux documentation available here:

Quick tips and examples

Here are some tips to help users change the CPU frequency (and voltage: this is usually done by driver management automatically).

To see which CPU scaling governor is available :

cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_governors

To change actual CPU scaling governor:

echo "powersave" > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor

To get actual CPU frequency:

cat /sys/devices/system/cpu/cpufreq/policy0/scaling_cur_freq

Linux Sleep States

To reduce power of the system, it could be interesting to suspend the system during the time where nothing is done. The kernel Linux provides a feature that allows the system to sleep during this phase of “doing nothing”. In this mode, the system will sleep (no user code can be run and devices are suspended) and wait for an event to wake up and restore everything to be able to run user code again.

Depending on your system, the Linux kernel can support up to 4 different sleep modes known as “system sleep states”:

  • Suspend-to-Idle
  • Standby
  • Suspend-to-RAM
  • Hibernation

To learn more about how it works, please read the linux documentation available here:

NOTE:
See your BSP vendors’s characteristics to know which mode is supported or not

Quick tips and examples

Looking for available “wakeup” devices:

find /sys/devices/ -name wakeup

Allow a serial port to wakeup the system from a sleep state:

echo enabled > /sys/devices/soc0/soc.1/2100000.aipsbus/21f0000.serial/tty/ttymxc3/power/wakeup

Putting the system into a sleeping state to reduce power consumption:

echo mem > /sys/power/state

or

echo standby > /sys/power/state