Utilite Linux User How-To's

From Utilite Wiki

Jump to: navigation, search

Contents

Xorg tools

xorg.conf Auto Generator

Package location utilite-tools-udev-rules-compulab_1.01_all.deb.

Admolition note.png Requires "fbset" to be installed first.

Install

# wget http://utilite-computer.com/download/utilite/ubuntu/misc/utilite-tools-udev-rules-compulab_1.01_all.deb
# dpkg -i utilite-tools-udev-rules-compulab_1.01_all.deb

Uninstall

# dpkg -r udev-rules-compulab
# rm -rf “/etc/X11/xorg.conf.d/”
# rm -rf ~/.config

Xorg Dual Screen Config

Package location utilite-tools-dual-screen-compulab_1.01_all.deb.

# wget http://utilite-computer.com/download/utilite/ubuntu/misc/utilite-tools-dual-screen-compulab_1.01_all.deb
# dpkg -i utilite-tools-dual-screen-compulab_1.01_all.deb
# restart lightdm

Settings custom windows border thickness in GNOME

Find out which theme is currently set:

utilite@utilite-desktop:~$ gsettings get org.gnome.desktop.interface gtk-theme
'Ambiance'

Edit theme settings file located in the sub-folder with the theme name:

gedit /usr/share/themes/Ambiance/metacity-1/metacity-theme-1.xml

Set desired thickness in the "value" fields:

<!-- general window layout -->
<frame_geometry name="frame_geometry_normal" title_scale="medium" rounded_top_left="true" rounded_top_right="true" rounded_bottom_left="false" rounded_bottom_right="false">
  <distance name="left_width" value="2"/>
  <distance name="right_width" value="2"/>
  <distance name="bottom_height" value="2"/>
...
...

Adding a 512 MiB swap

Create a file for 512 MiB size you want:

sudo fallocate -l 512m /mnt/512MiB.swap
sudo chmod 600 /mnt/512MiB.swap

Format that file to create a swapping device:

sudo mkswap /mnt/512MiB.swap

Add the swap to the running system:

sudo swapon /mnt/512MiB.swap

Make the change permanent:

sudo gedit /etc/fstab

Add this line at the end of the file:

/mnt/512MiB.swap  none  swap  sw  0 0

Save. After the next reboot the swap will be used automatically.

For more details see here SwapFaq

Changing u-Boot environment from Linux

Read-out U-Boot environment variables:

utilite@utilite-desktop:~$ sudo fw_printenv 

Example of setting boot delay to 5 seconds:

utilite@utilite-desktop:~$ sudo fw_setenv bootdelay '5'

Running GPU support example applications

Change current directory:

utilite@utilite-desktop:~$ cd /opt/viv_samples/vdk/

Run sample application:

utilite@utilite-desktop:/opt/viv_samples/vdk$ ./tutorial3_es20

Install XScreensavers

Uninstall conflicting package:

utilite@utilite-desktop:~$ sudo apt-get remove gnome-screensaver

Install the screen savers:

utilite@utilite-desktop:~$ sudo apt-get install xscreensaver xscreensaver-data-extra xscreensaver-gl-extra

Enable SSH connection to the unit

Generate RSA, DSA and ECDSA keys for the board:

utilite@utilite-desktop:~$ sudo dpkg-reconfigure openssh-server

For more details see here Post Install Procedure

Enable / Disable automatic updates

Edit the following file:

utilite@utilite-desktop:~$ sudo gedit /etc/apt/apt.conf.d/10periodic

Enable automatic updates:

APT::Periodic::Update-Package-Lists "1";

Disable automatic updates:

APT::Periodic::Update-Package-Lists "0";

Disable linux firmware update

utilite@utilite-desktop:~$ sudo apt-mark hold linux-firmware

Disable Network Manager

utilite@utilite-desktop:~$ sudo -i
# cat << eof > /etc/init/network-manager.override
manual
eof

Disable Lightdm (Ubuntu 12.04 LTS)

utilite@utilite-desktop:~$ sudo -i
# cat << eof > /etc/init/lightdm.override
manual
eof

HDMI/DVI port status

utilite@utilite-desktop:~$ sudo udevadm info -a -p /sys/devices/platform/mxc_hdmi
utilite@utilite-desktop:~$ sudo udevadm info -a -p /sys/devices/platform/mxc_dvi.0

Analog Audio Playback Test

utilite@utilite-desktop:~$ aplay -vD hw:0,0 sample.wav
utilite@utilite-desktop:~$ mplayer -ao alsa:device=hw=0.0 sample.mp3

HDMI Audio Playback Test

utilite@utilite-desktop:~$ aplay -vD hw:2,0 sample.wav
utilite@utilite-desktop:~$ mplayer -ao alsa:device=hw=2.0 sample.mp3

Manual setting of RTC time

Disable NTP time updates by setting System Settings -> Date and Time -> Network Time to OFF.

Set the desired system time and propagate the changes to the hardware clock:

utilite@utilite-desktop:~$ sudo date --set="2 Dec 2013 10:10:10 +0002"
utilite@utilite-desktop:~$ sudo hwclock --systohc

Prevent renaming of network devices names when using rootfs media on another unit

When using root file system media (like SD card) with another Utilite unit the network devices named will be different on that unit. For example, eth1 may become eth2 etc. In order to prevent this, remove the following file and reboot:

utilite@utilite-desktop:~$ sudo rm /etc/udev/rules.d/70-persistent-net.rules

Erase downloaded archive files

In order to free some space on the media the downloaded archive files can be safely erased:

utilite@utilite-desktop:~$ sudo apt-get clean

or

utilite@utilite-desktop:~$ sudo rm /var/cache/apt/archives/*.deb

Add new user with the terminal console

Execute the following commands:

utilite@utilite-desktop:~$ su
Password: 
root@utilite-desktop:/home/utilite# export USER_NAME="new_user"
root@utilite-desktop:/home/utilite# useradd -c $USER_NAME -m -s /bin/bash $USER_NAME
root@utilite-desktop:/home/utilite# usermod -aG adm,dialout,cdrom,audio,dip,video,plugdev,sudo $USER_NAME 

Screen Rotation

Portrait Mode

  • Boot console

Make use of this kernel boot parameter

fbcon=rotate:1
  • Window Manager

CM-FX6 support portrait mode with fbdev only. Here is an example of the xorg.conf "Device" section:

Section "Device"
    Identifier    "i.MX Accelerated Framebuffer Device"
    Driver        "fbdev"
    Option        "fbdev"  "/dev/fb0"
    Option        "Rotate" "CW"
EndSection

180-degree angle rotation

Execute the following commands:

utilite@utilite-desktop:~$ su
Password: 
root@utilite-desktop:/home/utilite#
root@utilite-desktop:/home/utilite# echo 1 > /sys/class/graphics/fb0/rotate

GST Rotation Samples

  • FreeScale Comunity Resources

https://community.freescale.com/docs/DOC-93788

  • Rotation using the "mfw_isink"

Here is an example that shows how to display a jpg-file in the portrait mode.

VSALPHA=1 gst-launch filesrc location=/var/tmp/sample.jpg ! jpegdec ! imagefreeze ! mfw_isink rotation=4

TFTP Boot and NFS Root Filesystems

Requirements

Linux Desktop, USB to Serial adapter, DHCP server.

nfs-server

  • Install

Get the required software if not already set up:

sudo apt-get install nfs-kernel-server
  • Set up the NFS Directory
sudo mkdir -p /export/rootfs
  • Update NFS Exports File

Issue this command in order to allow the nfs server export the /export/rootfs directory:

sudo sed -i '$ a \
/export/rootfs  *(rw,insecure,no_subtree_check,async,no_root_squash)
' /etc/exports
  • Ubuntu tarball to /export/rootfs

Unpack the latest available Ubuntu utilite_ubuntu-12.04.3_2014-12-17.tar.bz2 tarball into the /export/rootfs

sudo tar -C /export/rootfs --numeric-owner -xpf imx6.ubuntu-12.04.3_utilite-2_kernel-6.3.tar.bz2


Admolition note.png For the NFS boot the network-manager must be disabled
echo manual | sudo tee > /dev/null /export/rootfs/etc/init/network-manager.override
  • Restart the nfs-server

Make the NFS service reapply the new configuration issue:

sudo /etc/init.d/nfs-kernel-server restart

tftpserver

  • Install

Get the required software if not already set up:

sudo apt-get install tftpd-hpa
  • Start it
sudo /etc/init.d/tftpd-hpa start
  • Kernel binary to tftp-server-export-directory

Copy the uImage-cm-fx6 file into the tftp-server-export-directory

TFTP_DIR=$(awk -F"=" '($0~/TFTP_DIRECTORY/)&&(gsub(/\"/,"")&&($0=$2))' /etc/default/tftpd-hpa)
cp /export/rootfs/boot/uImage-cm-fx6 ${TFTP_DIR}/

SBC-FX6(m) Boot Environment

Stop in U-Boot and prepare the boot environment:

Admolition note.png <nfs-server-ip> and <tftp-server-ip> is the Linux Desktop ip-address
setenv nfsroot /export/rootfs
setenv nfsserver <nfs-server-ip>
setenv tftpserver <tftp-server-ip>
setenv bootargs "console=ttymxc3,115200  root=/dev/nfs rw ip=dhcp nfsroot=${nfsserver}:${nfsroot}"
setenv bootcmd 'dhcp; tftpboot ${loadaddr} ${tftpserver}:${kernel}; bootm'
saveenv
reset

iNet resources

Useful links about diskless system and NFS/TFTP server configuration:

NAND flash as rootfs

This section shows how to deploy the CompuLab rootfs tarball onto the NAND flash.

  • Requirements:
  1. A Utilite up and running with the rootfs on either SD, SSD or NFS.
  2. Available NAND flash device.
  • linux and rootfs partition are present:
# cat /proc/mtd 
dev:    size   erasesize  name
mtd0: 000c0000 00001000 "uboot"
mtd1: 00040000 00001000 "uboot environment"
mtd2: 00100000 00001000 "reserved"
mtd3: 00800000 00080000 "linux"
mtd4: 3f800000 00080000 "rootfs"
  • rootfs partition is able to fit the unpacked content of the rootfs tarball:
# mtdinfo /dev/mtd4
mtd4
Name:                           rootfs
Type:                           nand
Eraseblock size:                524288 bytes, 512.0 KiB
Amount of eraseblocks:          2032 (1065353216 bytes, 1016.0 MiB)
Minimum input/output unit size: 4096 bytes
Sub-page size:                  4096 bytes
OOB size:                       224 bytes
Character device major/minor:   90:8
Bad blocks are allowed:         true
Device is writable:             true

Install on the NAND flash

  • Format the NAND flash root filesystem partition:
# ubiformat /dev/mtd4
  • Attach the NAND flash root filesystem partition:
# ubiattach -m 4 -d 0
  • Create a ubi volume and name it "rootfs":
# ubimkvol /dev/ubi0 -m -N rootfs
  • Mount the ubi volume:
# mkdir -p /media/rootfs && mount -t ubifs ubi0:rootfs /media/rootfs
Admolition note.png Let's assume that the tarball name is armhf-jessie-buildd-java.tar.bz2
  • Set the ROOTFS_TARBALL environment variable:
# export ROOTFS_TARBALL=armhf-jessie-buildd-java.tar.bz2
  • Extract the content of the tarrball onto the /media/rootfs:
# tar -xpjf /<path-to-rootfs-tarball>/${ROOTFS_TARBALL} -C /media/rootfs && sync
  • Format the NAND flash kernel partition and write the kernel image onto it:
# flash_erase /dev/mtd3 0 0
# nandwrite -p /dev/mtd3 /media/rootfs/boot/uImage-cm-fx6
  • Unmount the ubi volume:
# umount /media/rootfs

NAND flash Boot Environment

  • Set the bootargs environment variable:
CM-FX6 # setenv bootargs "console=ttymxc3,115200 root=ubi0:rootfs rw rootfstype=ubifs ubi.mtd=rootfs ip=dhcp"
  • To boot Linux, type:
CM-FX6 # setenv bootdelay 3
CM-FX6 # setenv bootcmd "nand read 10800000 0 600000; bootm"
CM-FX6 # saveenv
CM-FX6 # boot
Personal tools