Quick start Ubuntu 16.04

From RidgeRun Developer Connection
Jump to: navigation, search

Set root password

Amazingly, after installing Ubuntu, I have no idea how to log in as root! If something goes wrong with sudo, you will be glad you first set the root password.

sudo passwd root

sudo configuration

You can configure sudo to not ask for your password:

sudo addgroup admin
sudo adduser $USER admin
sudo sh -c "echo '%admin ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers"

Switch shell from dash to bash

sudo rm /bin/sh
sudo ln -s /bin/bash /bin/sh

Packages to install

General utilities and RR SDK required packages

These are packages that are typically required to put your system in shape for general utilities, and also packages necessary to compile typical RidgeRun SDKs.

sudo apt install vim
touch install_packages.sh
vim install_packages.sh

then add the following on it:

#!/bin/sh
apt update  # To get the latest package lists
apt upgrade
apt install build-essential fakeroot graphviz gdb openssh-server git zip subversion git-core nfs­-kernel­-server nfs­-common meld portmap xinetd tftpd tftp curl libncurses5-dev texinfo picocom quilt autoconf libcrypt-ssleay-perl libusb-dev libexpect-perl mono-devel libgtk2.0-dev bison flex xclip liblzo2-dev uuid-dev python-virtualenv terminator tree doxygen vlc libdbus-glib-1-dev iftop libxml2-dev gstreamer-tools libgstreamer0.10-dev libgstrtspserver-0.10-dev libreadline-dev valac libtool subversion libterm-readkey-perl libwww-perl gparted gperf libgmp-dev libgmp3-dev libmpfr-dev libmpc-dev imagemagick ddd cmake cmake-curses-gui ccache mtd-utils intltool xsltproc libusb-1.0-0-dev libbz2-dev libjpeg62 autoconf libcrypt-ssleay-perl libusb-dev libexpect-perl libcrypt-ssleay-perl libusb-dev libgtk2.0-dev meld asciidoc ubuntu-restricted-extras autopoint unzip

Then you should type:

chmod +x install_packages.sh
sudo ./install_packages.sh

Common packages used by RR Developers

RidgeRun developers often install:

# Editors
sudo apt install -y geany geany-plugin-addons emacs eclipse-cdt 

# Version Control
sudo apt install -y git subversion

# Development Tools
sudo apt install -y gdb valgrind cscope oprofile

# Miscellaneous
sudo apt install -y hamster-indicator pidgin filezilla gimp wireshark wireshark-doc xdot 

# GStreamer 0.10
sudo apt install -y gstreamer-tools gstreamer0.10-alsa gstreamer0.10-nice gstreamer0.10-plugins-base gstreamer0.10-plugins-base-apps gstreamer0.10-plugins-base-dbg gstreamer0.10-plugins-good gstreamer0.10-plugins-good-dbg gstreamer0.10-pulseaudio gstreamer0.10-tools gstreamer0.10-x libgstreamer-plugins-bad1.0-0 libgstreamer-plugins-bad1.0-dev libgstreamer-plugins-base0.10-0 libgstreamer-plugins-base0.10-dev libgstreamer0.10-0 libgstreamer0.10-0-dbg libgstreamer0.10-dev

# GStreamer 1.0
sudo apt install -y gstreamer1.0-clutter gstreamer1.0-espeak gstreamer1.0-fluendo-mp3 gstreamer1.0-libav gstreamer1.0-libav-dbg gstreamer1.0-nice gstreamer1.0-plugins-bad gstreamer1.0-plugins-bad-dbg gstreamer1.0-plugins-bad-faad gstreamer1.0-plugins-bad-videoparsers gstreamer1.0-plugins-ugly gstreamer1.0-plugins-ugly-dbg gstreamer1.0-pocketsphinx libgstrtspserver-1.0-0 libgstrtspserver-1.0-0-dbg libgstrtspserver-1.0-dev libnice-dbg libnice-dev 

Tuning bash startup script

echo "alias h='history 100'" >> $HOME/.bashrc
echo "alias e='source make env 2> /dev/null'" >> $HOME/.bashrc

When you're ready you can source the file:

source $HOME/.bashrc

SDK downloads

The location /opt/ridgerun/downloads is conveniently used to hold all the packages and tarballs downloaded by the RR SDK, and is convenient because it can be re-used if you have more than one RR SDK installed in your machine.

sudo mkdir --parents /opt/ridgerun/downloads
sudo chmod ugo+rwx /opt/ridgerun/downloads

If you have another computer setup that has built the RidgeRun SDK before, you will find it much faster on the first build if you copy the downloads directory to your new machine.

EXISTING_MACHINE_IP=192.168.0.1
scp -r $EXISTING_MACHINE_IP:/opt/ridgerun/downloads/* /opt/ridgerun/downloads

Host ldconfig does not support ARM architecture

If you get the error

Kernel panic - not syncing: No init found.  Try passing init= option to kernel.

when you first boot your target hardware, you may have run into the ldconfig issue. On the host computer check the file length of

$DEVDIR/fs/fs/etc/ld.so.cache

If that file is less than 200 bytes long, you need to use a different version of the host application ldconfig.

When the 2.19 version of ldconfig that comes with Ubuntu 14.04 tries to create the /etc/ld.so.cache shared library cache on the target file system, it ignores all ARM shared libraries. This is a known defect. To work around the defect, the RidgeRun SDK has been enhanced to fetch the 2.15 version of ldconfig and use it to create the target file system /etc/ld.so.cache file.

If you are using a older version of the RidgeRun SDK, you can follow these commands to resolve the issue.

cd $DEVDIR
mkdir tmp
cd tmp
wget https://launchpad.net/~ubuntu-security/+archive/ubuntu/ppa/+build/5061964/+files/libc-bin_2.15-0ubuntu10.5_i386.deb
dpkg-deb -x libc-bin_2.15-0ubuntu10.5_i386.deb libc-bin_2.15-0ubuntu10.5_i386
install -Dm 755 libc-bin_2.15-0ubuntu10.5_i386/sbin/ldconfig.real $DEVDIR/bsp/local/bin/ldconfig.2_15
sed -i -e 's!LDCONFIG?=.*!LDCONFIG?=ldconfig.2_15!' $DEVDIR/bsp/classes/common.defs
cd $DEVDIR
rm -rf tmp

Build the $DEVDIR after you run the steps mentioned above and check for the ld.so.cache filesize is changed to not less than 200 bytes long.

Building a RR SDK

After the steps above, you can try out building your RR SDK. See the SDK User Guides for reference.

Steps needed to install toolchain on versions newer than ubuntu 12.04

In order to run the toolchain installer you need to install the 32-bits libs, since this versions removed ia32-libs ia32-libs-gtk packages from the repository you need to run

sudo apt-get install libgtk2.0-0:i386 libxtst6:i386 gtk2-engines-murrine:i386 lib32stdc++6 libxt6:i386 libdbus-glib-1-2:i386 libasound2:i386

Special steps when installing the dvsdk

Running the dvsdk installer, use the --forcehost switch to enable the installation, for example:

./dvsdk_dm368-evm_4_02_00_06_setuplinux --forcehost

note: During the DVSDK installation process you will be asked for the toolchain's path, assuming that you installed it on /opt, the path that you need to provide is /opt/codesourcery/arm-2009q1/bin/

Packages that will be asked by the Ridgerun SDK

sudo apt-get install libdbus-glib-1-dev libgtk2.0-dev bison flex libglib2.0-dev
sudo apt-get install python-prettytable lzop libpopt-dev binutils-dev libiberty-dev

Disabling auto mount

Since the SDK is used to write a bootable images to an SD card, it is often useful to disable automount. When automount is enabled, the SDK can not reliabily write to the SD card if the card is under the control of the Nautilus file system manager.

Run:

dconf-editor

Browse to org.gnome.desktop.media-handling and uncheck the automount key.

Switching desktop environments

I haven't gotten used to Unity yet. I prefer Gnome panel. You could start by loading the official Gnome Ubuntu distro, which is likely easier. If you already installed Ubuntu, then you might find these steps helpful.

To see what desktops are available, I ran:

aptitude search desktop

I found one that looked good, so I ran:

sudo apt-get install ubuntu-gnome-desktop gnome-panel

Pick gdm the Gnome Display Manager, when asked.

Get gnome panel to auto-start, by adding it to your session properties (fill in all boxes with gnome-panel)

gnome-session-properties

Log out, and when you go to log back in again, first click on the Ubuntu circle icon in the dialog box asking for your password and select GNOME Flashback (metacity).

Customizing desktop

Run dconf Editor and wander around org.gnome tree. Here are some of my favorites:

  • org.gnome.desktop.wm.preferences
    • button-layout : close,maximize,minimize:
    • auto-raise : select
    • auto-raise-delay : 500
    • num-workspaces : 4
    • workspace-names : ['mail', 'chat', 'customer 1', 'personal']

Creating ssh key for github

To make git clone work easily, I created and uploaded an ssh key to github.com. Create a key using:

YOUR_EMAIL_ADDRESS=foo.bar@baz.com
ssh-keygen -t rsa -C "$YOUR_EMAIL_ADDRESS"

Then browse to http://github.com, log in, click on your name in the upper right corner, then pick SSH keys from the left side panel. You can view the key you created by running:

cat ~/.ssh/id_rsa.pub

Resize Window Border To Small

If you have having trouble resizing the windows because the borders are too small, you might find these ideas helpful:

  • Hold down the Alt key and use the middle mouse button to resize the window from anywhere inside the window.
  • Edit /usr/share/themes/Ambiance/metacity-1/metacity-theme-1.xml then log out and log back in again.
<distance name="left_width" value="3"/>
<distance name="right_width" value="3"/>
<distance name="bottom_height" value="3"/> 

Suggestions from: http://ubuntuforums.org/showthread.php?t=1482247

Common problems and how to solve them

grammar.tab.c error too few arguments to function _gst_parse_yylex

Put that patch into $DEVDIR/fs/apps/gstreamer-0.10.36/patches:

From 90622bb35544655cf641e3ab65cf35a6d01869bc Mon Sep 17 00:00:00 2001
From: Kerrick Staley <kerrick@kerrickstaley.com>
Date: Tue, 20 Aug 2013 23:59:29 -0700
Subject: [PATCH] Make grammar.y work with Bison 3

YYLEX_PARAM is no longer supported in Bison 3.
---
 gst/parse/grammar.y | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gst/parse/grammar.y b/src/gst/parse/grammar.y
index 8a9019c..f533389 100644
--- a/src/gst/parse/grammar.y
+++ b/src/gst/parse/grammar.y
@@ -26,7 +26,6 @@
  */
 
 #define YYERROR_VERBOSE 1
-#define YYLEX_PARAM scanner
 
 #define YYENABLE_NLS 0
 
@@ -659,6 +658,7 @@ static int yyerror (void *scanner, graph_t *graph, const char *s);
 %right '.'
 %left '!' '='
 
+%lex-param { void *scanner }
 %parse-param { void *scanner }
 %parse-param { graph_t *graph }
 %pure-parser
-- 
1.8.3.4

and add its name to $DEVDIR/fs/apps/gstreamer-0.10.36/patches/series.

Rebuild gstreamer.

See also

Quick start ubuntu 11.10