Difference between revisions of "Install BeagleBone"

From xPL
Jump to: navigation, search
(Audio)
(Control user)
Line 113: Line 113:
 
  useradd -m -g users -G dialout,audio -s /bin/bash control
 
  useradd -m -g users -G dialout,audio -s /bin/bash control
 
  passwd control
 
  passwd control
 +
 +
== Audio ==
 +
 +
Try to play a tone:
 +
su
 +
SOUND_FILES_LOCATION='/home/control/Documents/Controls/Sounds'
 +
ll $SOUND_FILES_LOCATION
 +
aplay $SOUND_FILES_LOCATION/pop.wav
  
 
= Checks =
 
= Checks =

Revision as of 10:36, 6 July 2014

The xPL protocol is light enough to run on simple machines such as the BeagleBone.

Install Ubuntu

The BeagleBone comes with an Angstrom distribution. Whilst this Linux distribution is tailored for embedded devices, Ubuntu's ARM port is easier to use for people used to Ubuntu.

Different methods allow to install Ubuntu on the BeagleBone. If one intends to use the serial port, an image with debugfs is preferred.

Having Ubuntu running, a few configuration steps might be helpful.

Change root password

sudo su
passwd
apt-get update

Swap space

Create a swap file:

dd if=/dev/zero of=/root/swapfile bs=1M count=1024
chmod 600 /root/swapfile
mkswap /root/swapfile

Enable the swapfile:

swapon /root/swapfile
swapon -s
free -k

To enable at reboot, edit /etc/fstab:

/root/swapfile    swap    swap    defaults    0 0

Ethernet

Check the Ethernet connection:

ifconfig | grep inet
ping google.com

Connect to the BeagleBone via SSH to continue working (on a larger window).

ssh root@192.168.1.165

Change host name:

nano /etc/hosts
  change: "127.0.1.1 ubuntu-armhf" to: "127.0.1.1 beagleBoneHostname"
nano /etc/hostname

Set up a bonjour discovery:

apt-get install avahi-daemon libnss-mdns

Give a static address:

nano /etc/network/interfaces
iface eth0 inet static
  address 192.168.1.14
  gateway 192.168.1.1
  netmask 255.255.255.0
  dns-nameservers 192.168.1.1
/etc/init.d/networking restart

Set-up Apple FileProtocol (AFP) sharing:

apt-get install netatalk
nano /etc/netatalk/AppleVolumes.default

Locales

Install locales (for PERL and others):

cd
apt-get install locales
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen en_US.UTF-8
dpkg-reconfigure locales

Then edit .bashrc and add: export LC_ALL=C

Command-line editing

Enable history search and bash tab autocompletion:

nano .bashrc
nano /etc/inputrc
apt-get update && apt-get install bash-completion

Install manuals:

apt-get install man-db

Programming tools

Install compilation tools (make, gcc, …):

apt-get install build-essential

Install Perl documentation reader:

apt-get install perl-doc

Local time

Set local time:

ls -lr /usr/share/zoneinfo/Europe/
rm /etc/localtime
ln -s /usr/share/zoneinfo/Europe/Zurich /etc/localtime

Update time on a daily basis with the help of the script /etc/cron.daily/ntpdate containing:

#!/bin/sh
ntpdate ntp.ubuntu.com

Make the script executable:

chmod 755 /etc/cron.daily/ntpdate

Control user

Add the control user:

useradd -m -g users -G dialout,audio -s /bin/bash control
passwd control

Audio

Try to play a tone:

su
SOUND_FILES_LOCATION='/home/control/Documents/Controls/Sounds'
ll $SOUND_FILES_LOCATION
aplay $SOUND_FILES_LOCATION/pop.wav

Checks

CPU usage

Check CPU usage:

ps -eo pcpu,user,args | sort -k 1 -r | head -10
echo && ps -eo pcpu,user,args | grep -v ' 0.0 ' | grep -v '%CPU' | sort -k 1 -r | sed 's/[ ^I]\/.*\/perl//' | sed 's/.pl[ ^I].*/.pl/'

Process priorities

Check process priorities:

ps ax -o nice,pid,user,args | grep -v ' NI ' | sort

The lowest numbers correspond to the highest priorities.

Change the priority level of xPL devices:

ps ax -o nice,pid,user,args | grep -v ' grep ' | grep -i xpl-

USER='control'
NEW_LEVEL=-10
SYSTEM_IFS=$IFS; IFS=$'\n'; 
task_list=(`ps ax -o pid,user,args | grep -v ' grep ' | grep -i '/xpl-'`)
IFS=$SYSTEM_IFS
for item in "${task_list[@]}" ;  do
  task_id=`echo "${item}" | sed "s/$USER.*//"`
# echo $task_id
  renice $NEW_LEVEL -p $task_id >/dev/null
done
ps ax -o nice,pid,user,args | grep -v ' grep ' | grep -i xpl-

Upstart daemons

Check the status of init daemons:

initctl list
initctl list | grep xpl-