FAQ General: Difference between revisions

From Wiki-DB
Jump to navigationJump to search
Lzenz (talk | contribs)
Lzenz (talk | contribs)
Line 4: Line 4:
==== ''Do the DHCOM modules have a serial numbers included? If yes, how is it accessible?'' ====
==== ''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”
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”
==== ''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/*** 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/*** 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.


== Bootloader ==
== Bootloader ==

Revision as of 08:21, 24 May 2016

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.

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.

An (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)

Finding 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)

Clone/copy a SD/µSD card

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