FAQ General: Difference between revisions

From Wiki-DB
Jump to navigationJump to search
Lzenz (talk | contribs)
→‎Root Filesystem: Added section for autologin
 
(23 intermediate revisions by 3 users not shown)
Line 27: Line 27:


== Linux ==
== Linux ==
=== Root Filesystem ===
==== ''How to handle "FATAL: Could not load /lib/modules/.../modules.dep: No such file or directory"?'' ====
==== ''How to handle "FATAL: Could not load /lib/modules/.../modules.dep: No such file or directory"?'' ====
Check the path to your loadable kernel modules. It has to be <tt>/lib/modules/$(uname -r)</tt>.
Check the path to your loadable kernel modules. It has to be <tt>/lib/modules/$(uname -r)</tt>.
Line 35: Line 36:
<tt># depmod –m</tt>
<tt># depmod –m</tt>
|}
|}
==== ''Could not install standard packages on the Debian Squeeze based file system'' ====
Reason: The Debian package server address was changed.
Fix: Add the following lines into the <tt>/etc/apt/sources.list</tt> file
{| class="wikitable" | style="width: 100%; color: #000000; background: #FFFFFF;" valign="top" |
|
<tt>deb http://archive.debian.org/debian squeeze main<br/></tt>
<tt>deb-src http://archive.debian.org/debian squeeze main</tt>
|}
==== ''Ethernet does not work'' ====
Check if the line "allow-hotplug eth0" in the file "/etc/network/interfaces" is activated. You can activate the ethernet interface on a running system with the command:
{| class="wikitable" | style="width: 100%; color: #000000; background: #FFFFFF;" valign="top" |
|<tt>''ifconfig eth0 up''</tt>
|}
'''Remark:''' To work with a nfs-rootfilesystem you have to disable the line "allow-hotplug eth0" in the file "/etc/network/interfaces". Maybe the system was prepared for this method for development and nobody did change it back.
==== ''How to set a Linux environment variable?'' ====
This example shows you how to configure the system to use a proxy-server with a environment variable.
{| class="wikitable" | style="width: 100%; color: #000000; background: #FFFFFF;" valign="top" |
|<tt>''export http_proxy=http://192.168.xxx.xxx:xxxx</tt>
|}
==== ''How to schedule jobs to run periodically at certain times or dates?'' ====
You can use the cron daemon and/or anacron. To use anacron you have to copy or link your program or script into one of the the following folders:
{| class="wikitable" | style="width: 100%; color: #000000; background: #FFFFFF;" valign="top" |
|
<tt>/etc/cron.hourly<br/></tt>
<tt>/etc/cron.daily<br/></tt>
<tt>/etc/cron.weekly<br/></tt>
<tt>/etc/cron.monthly</tt>
|}
For further information have a look at the general linux documentation.
==== ''Enable autologin on a serial console with systemd'' ====
If you want to automaticly log into the serial console at bootup, you can alter the configuration of systemd.
Open the file <tt>/lib/systemd/system/serial-getty@.service</tt> with a text editor.
Look for the following line:
{| class="wikitable" | style="width: 100%; color: #000000; background: #FFFFFF;" valign="top" |
|<tt>ExecStart=-/sbin/agetty -8 -L %I 115200 $TERM</tt>
|}
Add <tt>--autologin <username></tt> before the <tt>%I</tt> so it looks like this (with root as an example):
{| class="wikitable" | style="width: 100%; color: #000000; background: #FFFFFF;" valign="top" |
|<tt>ExecStart=-/sbin/agetty -8 -L '''--autologin root''' %I 115200 $TERM</tt>
|}
'''Remark''': If the <tt>-o</tt> option of agetty is used to alter the call of the login-program, then you have to add <tt>-f</tt> to the options which are given to the login program. If you do not this, you will have still enter your password. Here is an example:
{| class="wikitable" | style="width: 100%; color: #000000; background: #FFFFFF;" valign="top" |
|<tt>ExecStart=-/sbin/agetty -8 -L -o '-p '''-f''' -- \\u' --autologin root %I 115200 $TERM</tt>
|}
=== NAND ===
=== NAND ===
==== ''We would like to use UBIFS for the root filesystem volume'' ====
==== ''We would like to use UBIFS for the root filesystem volume'' ====
Line 145: Line 196:
* The '''critical trip point''' should not be exceeded to avoid damaging the SoC and as such when this threshold is reached the operating systems shutdown function is called to attempt to shut down the OS.
* The '''critical trip point''' should not be exceeded to avoid damaging the SoC and as such when this threshold is reached the operating systems shutdown function is called to attempt to shut down the OS.


An (carefully) example for industrial grade i.MX6 SoC (-40 to 105C):
A (carefull) example for industrial grade i.MX6 SoC (-40 to 105C):
* critical Trip Point = maxT – 5C = 100C
* critical Trip Point = maxT – 5C = 100C
* passive Trip Point = maxT – 20C = 85C
* passive Trip Point = maxT – 20C = 85C
Line 164: Line 215:
{| class="wikitable" | style="width: 100%; color: #000000; background: #FFFFFF;" valign="top" |
{| class="wikitable" | style="width: 100%; color: #000000; background: #FFFFFF;" valign="top" |
|
|
<tt> echo 3 > /sys/module/galcore/parameters/gpu3DMinClock  </tt> # set gpu frequency divisor to 3/64
<tt># echo 3 > /sys/module/galcore/parameters/gpu3DMinClock  </tt> # set gpu frequency divisor to 3/64
|}
'''Remark:''' It is possible to do some further customizations at other parameters, too. This should be done depending on your use case.
 
=== Tweaks ===
==== ''Simulate SoC with less cpu cores'' ====
To use ony n number of CPU cores instead of available cores for example to simulate another system on chip performane add "maxcpus=n" to the linux bootargs. For example add "optargs='maxcpus=1'" to /boot/uLinuxEnv.txt to use only one cpu core.
 
=== Kernel version ===
==== ''Get Kernel version (on target)'' ====
{| class="wikitable" | style="width: 100%; color: #000000; background: #FFFFFF;" valign="top" |
|
<tt># uname -a</tt>
|}
'''Example:'''<br/>
Linux dhcom 3.14.12-rt9-g'''a81067a''' #1 SMP PREEMPT RT Thu Mar 3 09:32:46 CET 2016 armv7l GNU/Linux<br/>
short git SHA = a81067a (this is an identifier for each git commit)
 
==== ''git commit of a specific version (on a develop machine)'' ====
{| class="wikitable" | style="width: 100%; color: #000000; background: #FFFFFF;" valign="top" |
|
<tt># git show SHA</tt>
|}
'''Example:'''
{| class="wikitable" | style="width: 100%; color: #000000; background: #FFFFFF;" valign="top" |
|
<tt># git show a81067a</tt>
|}
'''Remark:''' Before you can do this you have to clone the DH repository from GitHub (look at the Linux section of your module type)
 
=== Write/Clone/Copy a SD/µSD card Images ===
==== ''How to write a *.sdcard binary image to a sdcard?'' ====
The easiest way is to use <tt>'''dd'''</tt> on your Linux development PC.
* Insert your µSD Card in your Card-Reader and connect it to your PC.
* Find out the /dev/DEVNAME device name for example with <tt>'''dmesg'''</tt> in the terminal.
* '''Important:''' Be sure to write in the following step to the correct device.
* Flash your Image.sdcard with:
{| class="wikitable" | style="width: 100%; color: #000000; background: #FFFFFF;" valign="top" |
|<tt>dd if=/path/to/Image.sdcard of=/dev/DEVNAME bs=1M</tt>
|}
* You can use <tt>'''dd'''</tt> to create a backup of a µSD card when you swap the <tt>'''if='''</tt> and <tt>'''of='''</tt> args.
 
==== ''Cloning the complete card (bit by bit)'' ====
{| class="wikitable" | style="width: 100%; color: #000000; background: #FFFFFF;" valign="top" |
|
Insert source card<br/>
<tt># mount | grep ^/dev </tt># Identify the device name DEVNAME of the sd card (the device name is without a number at the end: e.g. sde / sdf / ...)<br/>
<tt># sudo dd if=/dev/DEVNAME of=image.sdcard bs=1M </tt># Copy the source card content to an image file image.sdcard<br/>
Replace source card with target card<br/>
<tt># sudo dd if=image.sdcard of=/dev/DEVNAME bs=1M </tt># Copy the image file to the target card<br/>
<tt># sync </tt># write cached content to card<br/>
|}
'''Remark:''' Only possible if the card size are identical or the target card is greater!
 
==== ''Copy the sd card content via a copmpressed archive file'' ====
{| class="wikitable" | style="width: 100%; color: #000000; background: #FFFFFF;" valign="top" |
|
Insert source card<br/>
<tt># mount | grep ^/dev </tt># Identify the partition SOURCEPART to copy e.g. /media/devel/rootfs<br/>
<tt># cd SOURCEPART </tt># change to source partition<br/>
<tt># sudo tar cfJv path/image.tar.xz . </tt># Compress the source card to an archive file image.tar.xz<br/>
Replace source card with target card<br/>
<tt># cd TARGETPART </tt># change to target partition</tt><br/>
<tt># sudo tar xfJv path/image.tar.xz</tt># Decompress the archive file to the target partition<br/>
<tt># sync </tt># write cached content to card<br/>
|}
'''Remark:'''
You have to partition an format the target sd card<br/>
We therefore recommend the tool "Disks"<br/>
Our recommendation is to use two partitions:<br/>
1. ext3 partition named "boot" with 50BM - 100MB<br/>
2. ext3 partition named "rootfs" with the remaining storage size
 
=== fb_videomode struct description ===
To integrate support for an additional display it is necessary to expand the fb_videomode struct in linux.
struct fb_videomode {
        const char *name; /* optional */
        u32 refresh; /* optional */
        u32 xres;
        u32 yres;
        u32 pixclock; /* value in pico seconds */
        u32 left_margin;        /* H back porch */
        u32 right_margin;        /* H front porch */
        u32 upper_margin; /* V back porch */
        u32 lower_margin; /* V front porch */
        u32 hsync_len;
        u32 vsync_len;
        u32 sync;
        u32 vmode;
        u32 flag;
};
 
{| class="wikitable" | style="width: 100%; color: #000000; background: #FFFFFF;" valign="top" |
|
sync flags:<br/>
<tt>FB_SYNC_HOR_HIGH_ACT </tt> --> HSYNC pulse is active high<br/>
<tt>FB_SYNC_VERT_HIGH_ACT </tt> --> VSYNC pulse is active high<br/>
<tt>FB_SYNC_CLK_LAT_FALL </tt>  --> Display must sample data on falling edge<br/>
<tt>FB_SYNC_OE_LOW_ACT </tt>  --> OE pulse is active low<br/>
<tt>FB_SYNC_DATA_INVERT </tt>  --> Data inverted<br/>
|}
|}
'''Remark:''' It is possible to do some further customizations at other parameters, too. This should be done depending your use case.

Latest revision as of 13:16, 27 April 2021

General

Do the DHCOM modules have a serial numbers included? If yes, how is it accessible?

The serial number of a DHCOM module is stored inside the bootloader environment. It can be retrieved by u-boot commands like printenv or by Linux commands like “fw_printenv”

Bootloader

How can I access the bootloader u-boot console?

It is not possible to enter to the bootloader console by pressing a various key (e.g. "Enter") on your keyboard. You have to send "DEL" (ASCII 0x7F) to the device. We recommend you to use the terminal program teraterm if you are working on windows and to use kermit or minicom if you use a linux operating system on your pc.

  • You can configure teraterm to send "DEL" when the delete key or the backspace key is pressed by clicking through the menu to Setup->Keyboard-Setup and enable the required checkbox.
  • Kermit is sending a "DEL" if you hit the backspace key.
  • Minicom is able to send "DEL" when you hit the backspace key if you configure minicom to do that within a terminal window: run $ minicom -s and navigate to Screen and keyboard press "B"

The automatic update does not execute before the operating system boots!

Check if the command update auto is included in the bootloader environment variable bootcmd or in a script-variable which is called within bootcmd before bootm .

The automatic update does not work with my desired update-media!

The command update auto can be configured with flags within the DHCOM settings.bin block. It is possible to disable a interface for the update mechanism. You can run a update from a disabled interface if you use the command update without the argument auto .

Which USB Port should i use to run updates with the bootloader?

Our systems are designed to run updates via the DHCOM USB Host 1 interface. We can support additional usb nterfaces on request.

My usb stick (flash memory) device is not recognized by the bootloader

The are limitations when you use usb flash memory devices with u-boot. Please check that a master boot record is available and that a FAT32 filesystem is used on the first primary partition of the device. Please use gparted to format the device.

Linux

Root Filesystem

How to handle "FATAL: Could not load /lib/modules/.../modules.dep: No such file or directory"?

Check the path to your loadable kernel modules. It has to be /lib/modules/$(uname -r). If your system works without loadable Linux kernel modules:

# mkdir /lib/modules/$(uname -r)
# depmod –m

Could not install standard packages on the Debian Squeeze based file system

Reason: The Debian package server address was changed.

Fix: Add the following lines into the /etc/apt/sources.list file

deb http://archive.debian.org/debian squeeze main
deb-src http://archive.debian.org/debian squeeze main

Ethernet does not work

Check if the line "allow-hotplug eth0" in the file "/etc/network/interfaces" is activated. You can activate the ethernet interface on a running system with the command:

ifconfig eth0 up

Remark: To work with a nfs-rootfilesystem you have to disable the line "allow-hotplug eth0" in the file "/etc/network/interfaces". Maybe the system was prepared for this method for development and nobody did change it back.

How to set a Linux environment variable?

This example shows you how to configure the system to use a proxy-server with a environment variable.

export http_proxy=http://192.168.xxx.xxx:xxxx

How to schedule jobs to run periodically at certain times or dates?

You can use the cron daemon and/or anacron. To use anacron you have to copy or link your program or script into one of the the following folders:

/etc/cron.hourly
/etc/cron.daily
/etc/cron.weekly
/etc/cron.monthly

For further information have a look at the general linux documentation.

Enable autologin on a serial console with systemd

If you want to automaticly log into the serial console at bootup, you can alter the configuration of systemd. Open the file /lib/systemd/system/serial-getty@.service with a text editor. Look for the following line:

ExecStart=-/sbin/agetty -8 -L %I 115200 $TERM

Add --autologin <username> before the %I so it looks like this (with root as an example):

ExecStart=-/sbin/agetty -8 -L --autologin root %I 115200 $TERM

Remark: If the -o option of agetty is used to alter the call of the login-program, then you have to add -f to the options which are given to the login program. If you do not this, you will have still enter your password. Here is an example:

ExecStart=-/sbin/agetty -8 -L -o '-p -f -- \\u' --autologin root %I 115200 $TERM

NAND

We would like to use UBIFS for the root filesystem volume

UBI/UBIFS is the standard file system for DHCOM systems with NAND flash storage.

We have the need for additional UBI/UBIFS volumens (partitions)

It shouldn't be necessary to make changes in the Bootloader u-boot, the Linux kernel, or devicetree. We recommend to use the available NAND Flash storage as a single UBI partition and create if needed multiple UBIFS volumes on it.

We want to backup the root filesystem from the NAND-Flash of the target

You can use the DHCOM Update Mechanism of root filesystem of the bootloader for the rootfs in the backup mode. This feature is available on i.MX25 and AM35x DHCOMs. Further information at: DHCOM Update: Linux Root Filesystem

GPIOs

How to use the GPIO sysfs?

export

# echo <GPIO#> >/sys/class/gpio/export

Remark: Have a look into /sys/class/gpio/ for already configured gpios.

Set direction

# echo in >/sys/class/gpio/gpio<GPIO#>/direction
# echo out >/sys/class/gpio/gpio<GPIO#>/direction

Set state

# echo 0 >/sys/class/gpio/gpio<GPIO#>/value
# echo 1 >/sys/class/gpio/gpio<GPIO#>/value

unexport

# echo <GPIO#> >/sys/class/gpio/unexport

I want to use GPIO buttons/keys

We recommend to add a gpio-keys section to the devicetree of your board. For example:

gpio-keys {
	compatible = "gpio-keys";

	volume-up {
		label = "Volume Up";
		gpios = <&gpio1 4 0>;
		gpio-key,wakeup;
		linux,code = <115>; /* KEY_VOLUMEUP */
	};

	volume-down {
		label = "Volume Down";
		gpios = <&gpio1 5 0>;
		gpio-key,wakeup;
		linux,code = <114>; /* KEY_VOLUMEDOWN */
	};
};

Please check for the "input/gpio-keys.c" driver to be enabled. For further details how to customize the device tree please refer to www.kernel.org.

You should get a device /dev/input/eventX which provides the key events. Validate your configuration with cat /dev/input/eventX or use "evtest" which is available on debian .

How to cleanly shutdown the target using a GPIO?

A common solution is to define a gpio key "KEY_POWER" in the devicetree of your target. Please have a look on the following example:

gpio-keys {
   compatible = "gpio-keys";
   pinctrl-names = "default";
   pinctrl-0 = <&pinctrl_gpiopowerkey>;
   power {
           label = "Power-Key";
           gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>;
           linux,code = <KEY_POWER>;
           debounce-interval = <5>;
   };
};

Depending on your root filesystem configuration you have to add a daemon which handles the event. Please have a look at "esekeyd" or "triggerhappy". There are Debian Packages available (esekeydtriggerhappy ). Alternative it is possible to use a udev rule (e.g. /etc/udev/rules.d/..).

The target should power off ifself after a shutdown

To switch off the power after shutdown you can use a GPIO. Keep in mind that the hardware design of you baseboard has to support this feature (The Premium Developer Kit does not). The Linux Kernel provides a specific GPIO power-off driver to handle this requirement. It has to be enabled with CONFIG_POWER_RESET_GPIO in the kernel configuration. Add a gpio-poweroff section to the device-tree of your board:

gpio-poweroff {
    compatible = "gpio-poweroff";
    gpios = <&gpio1 2 GPIO_ACTIVE_LOW>;
};

Use the poweroff command to power-off the system

# poweroff

For further details please have a look at www.kernel.org

Features

We want to capture the screen content

The VLC media player provides the necessary features: Capture Sceen Content with VLC media player: http://www.howtogeek.com A x-window-system is required. Have a look at our Yocto tutorial: Building Chromium, VLC and X11VNC using Yocto

View and interact (mouse, keyboard) with a target running the x window system

Install x11vnc and execute on the target. You can use ssvnc to connect via SSH. See ' Building Chromium, VLC and X11VNC using Yocto' and 'SSVNC (SSL/SSH VNC viewer): http://www.karlrunge.com/x11vnc/ssvnc.html'

Power Management

How to use CPU Frequency scaling?

If your target supports CPU Frequency scaling (e.g. DHCOM i.MX6, DHCOM AM335x) it is possible to change the clock speed of CPUs on the fly. Check if CONFIG_CPU_FREQ=y is enabled in your kernel configuration. Note that this driver doesn't automatically change the CPU clock speed, you need to either enable a dynamic cpufreq governor after boot, or use a userspace tool. Have a look at the cpufreq user guide.

  • So far we use the CPU Frequency scaling with the dynamic cpufreq governor. Please have a look at www.kernel.org.

Thermal Management: Reasonable Values For Thermal Thresholds

To get some general information we reference to www.kernel.org. The general meaning of passive and critical threshold:

  • The passive trip point is a preventative measure before reaching critical that does things to lower temperature such as reducing cpu/gpu frequencies
  • The critical trip point should not be exceeded to avoid damaging the SoC and as such when this threshold is reached the operating systems shutdown function is called to attempt to shut down the OS.

A (carefull) example for industrial grade i.MX6 SoC (-40 to 105C):

  • critical Trip Point = maxT – 5C = 100C
  • passive Trip Point = maxT – 20C = 85C

Sysfs path on i.MX6 with Linux Kernel based on Freescale 3.10.17_1.0.2

/sys/class/thermal/thermal_zone0
/sys/class/thermal/thermal_zone0/trip_point_0_temp (critical trip point)
/sys/class/thermal/thermal_zone0/trip_point_1_temp (passive trip point)

Attention: The thermal driver does not detect the thermal grade of your SoC. This does mean that you have to adjust the thresholds in some cases.

Thermal Management: i.MX6 Vivante GPU

The Vivante GPU does some frequency scaling based on temperature which enabled by default in the Vivante driver. If enabled the driver will scale the GPU frequency down by a specified divisor. By default it is 1/64. Please have a look the your sysfs (when using 3.10.17_1.0.2 Kernel):

# echo 3 > /sys/module/galcore/parameters/gpu3DMinClock # set gpu frequency divisor to 3/64

Remark: It is possible to do some further customizations at other parameters, too. This should be done depending on your use case.

Tweaks

Simulate SoC with less cpu cores

To use ony n number of CPU cores instead of available cores for example to simulate another system on chip performane add "maxcpus=n" to the linux bootargs. For example add "optargs='maxcpus=1'" to /boot/uLinuxEnv.txt to use only one cpu core.

Kernel version

Get Kernel version (on target)

# uname -a

Example:
Linux dhcom 3.14.12-rt9-ga81067a #1 SMP PREEMPT RT Thu Mar 3 09:32:46 CET 2016 armv7l GNU/Linux
short git SHA = a81067a (this is an identifier for each git commit)

git commit of a specific version (on a develop machine)

# git show SHA

Example:

# git show a81067a

Remark: Before you can do this you have to clone the DH repository from GitHub (look at the Linux section of your module type)

Write/Clone/Copy a SD/µSD card Images

How to write a *.sdcard binary image to a sdcard?

The easiest way is to use dd on your Linux development PC.

  • Insert your µSD Card in your Card-Reader and connect it to your PC.
  • Find out the /dev/DEVNAME device name for example with dmesg in the terminal.
  • Important: Be sure to write in the following step to the correct device.
  • Flash your Image.sdcard with:
dd if=/path/to/Image.sdcard of=/dev/DEVNAME bs=1M
  • You can use dd to create a backup of a µSD card when you swap the if= and of= args.

Cloning the complete card (bit by bit)

Insert source card
# mount | grep ^/dev # Identify the device name DEVNAME of the sd card (the device name is without a number at the end: e.g. sde / sdf / ...)
# sudo dd if=/dev/DEVNAME of=image.sdcard bs=1M # Copy the source card content to an image file image.sdcard
Replace source card with target card
# sudo dd if=image.sdcard of=/dev/DEVNAME bs=1M # Copy the image file to the target card
# sync # write cached content to card

Remark: Only possible if the card size are identical or the target card is greater!

Copy the sd card content via a copmpressed archive file

Insert source card
# mount | grep ^/dev # Identify the partition SOURCEPART to copy e.g. /media/devel/rootfs
# cd SOURCEPART # change to source partition
# sudo tar cfJv path/image.tar.xz . # Compress the source card to an archive file image.tar.xz
Replace source card with target card
# cd TARGETPART # change to target partition
# sudo tar xfJv path/image.tar.xz# Decompress the archive file to the target partition
# sync # write cached content to card

Remark: You have to partition an format the target sd card
We therefore recommend the tool "Disks"
Our recommendation is to use two partitions:
1. ext3 partition named "boot" with 50BM - 100MB
2. ext3 partition named "rootfs" with the remaining storage size

fb_videomode struct description

To integrate support for an additional display it is necessary to expand the fb_videomode struct in linux.

struct fb_videomode {
       const char *name;	/* optional */
       u32 refresh;		/* optional */
       u32 xres;
       u32 yres;
       u32 pixclock;		/* value in pico seconds */
       u32 left_margin;         /* H back porch */
       u32 right_margin;        /* H front porch */
       u32 upper_margin;	/* V back porch */
       u32 lower_margin;	/* V front porch */
       u32 hsync_len;
       u32 vsync_len;
       u32 sync;
       u32 vmode;
       u32 flag;
};

sync flags:
FB_SYNC_HOR_HIGH_ACT --> HSYNC pulse is active high
FB_SYNC_VERT_HIGH_ACT --> VSYNC pulse is active high
FB_SYNC_CLK_LAT_FALL --> Display must sample data on falling edge
FB_SYNC_OE_LOW_ACT --> OE pulse is active low
FB_SYNC_DATA_INVERT --> Data inverted