Difference between revisions of "Install BeagleBone"
(→Control user) |
(→Programming tools) |
||
(22 intermediate revisions by one user not shown) | |||
Line 31: | Line 31: | ||
To enable at reboot, edit <code>/etc/fstab</code>: | To enable at reboot, edit <code>/etc/fstab</code>: | ||
/root/swapfile swap swap defaults 0 0 | /root/swapfile swap swap defaults 0 0 | ||
+ | |||
+ | == Locales == | ||
+ | |||
+ | Install locales (for PERL and others): | ||
+ | su | ||
+ | locale-gen en_US.UTF-8 | ||
+ | |||
+ | Then edit <code>~.bashrc</code> and add: | ||
+ | export LC_ALL=C | ||
== Ethernet == | == Ethernet == | ||
Line 46: | Line 55: | ||
nano /etc/hostname | nano /etc/hostname | ||
− | Set up a bonjour discovery: | + | Set up a [http://en.wikipedia.org/wiki/Bonjour_(software) bonjour] discovery: |
apt-get install avahi-daemon libnss-mdns | apt-get install avahi-daemon libnss-mdns | ||
Give a static address: | Give a static address: | ||
nano /etc/network/interfaces | nano /etc/network/interfaces | ||
+ | auto eth0 | ||
iface eth0 inet static | iface eth0 inet static | ||
address 192.168.1.14 | address 192.168.1.14 | ||
Line 61: | Line 71: | ||
apt-get install netatalk | apt-get install netatalk | ||
nano /etc/netatalk/AppleVolumes.default | nano /etc/netatalk/AppleVolumes.default | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Command-line editing == | == Command-line editing == | ||
Line 88: | Line 85: | ||
Install compilation tools (make, gcc, …): | Install compilation tools (make, gcc, …): | ||
− | apt | + | apt install build-essential |
Install Perl documentation reader: | Install Perl documentation reader: | ||
− | apt | + | apt install perl-doc |
== Local time == | == Local time == | ||
Line 107: | Line 104: | ||
Make the script executable: | Make the script executable: | ||
chmod 755 /etc/cron.daily/ntpdate | chmod 755 /etc/cron.daily/ntpdate | ||
+ | |||
+ | == Beaglebone Capes == | ||
+ | |||
+ | List the capes known by the system: | ||
+ | cat /sys/devices/bone_capemgr*/slots | ||
+ | |||
+ | List the firmware capes definitions: | ||
+ | ll /lib/firmware/*.dtbo | ||
+ | |||
+ | === UART enabling on the fly === | ||
+ | |||
+ | Get UART cape definitions from [http://www.armhf.com/beaglebone-black-serial-uart-device-tree-overlays-for-ubuntu-and-debian-wheezy-tty01-tty02-tty04-tty05-dtbo-files/ ARMhf]. | ||
+ | |||
+ | Add an UART cape definition in a running system: | ||
+ | echo ttyO1_armhf.com > /sys/devices/bone_capemgr*/slots | ||
+ | ll /dev/ttyO* | ||
+ | |||
+ | === UART enabling at boot === | ||
+ | |||
+ | This shows [http://www.armhf.com/beaglebone-black-serial-uart-device-tree-overlays-for-ubuntu-and-debian-wheezy-tty01-tty02-tty04-tty05-dtbo-files/ how to enable ttyO1] at system boot. | ||
+ | |||
+ | Decompile the system <code>dtb</code>: | ||
+ | cd /tmp | ||
+ | apt-get install device-tree-compiler | ||
+ | dtc -I dtb -O dts -o am335x-boneblack.dts /boot/dtbs/am335x-boneblack.dtb | ||
+ | |||
+ | Add in the <code>dts</code>, at the end of the <code>pinmux@44e10800</code> section: | ||
+ | pinmux_serial1_pins { | ||
+ | pinctrl-single,pins = <0x180 0x20 0x184 0x0>; | ||
+ | linux,phandle = <0x81>; | ||
+ | phandle = <0x81>; | ||
+ | }; | ||
+ | |||
+ | Change in the <code>dts</code>, at the end of the <code>pinmux@44e10800</code> section: | ||
+ | status = "disabled"; | ||
+ | with: | ||
+ | pinctrl-names = "default"; | ||
+ | pinctrl-0 = <0x81>; | ||
+ | status = "okay"; | ||
+ | Note the use of handle <code>0x81</code> in both parts. | ||
+ | |||
+ | Recompile the <code>dts</code>: | ||
+ | dtc -I dts -O dtb -o /boot/dtbs/am335x-boneblack.dtb am335x-boneblack.dts | ||
+ | |||
+ | [http://interactingobjects.com/loading-a-custom-device-tree-overlay-on-ubuntu/ An alternative] | ||
+ | is to write the <code>echo ttyO1_armhf.com > /sys/devices/bone_capemgr*/slots</code> command in <code>/etc/rc.local</code>. | ||
= Control user = | = Control user = | ||
+ | |||
+ | == Create user == | ||
Add the <code>control</code> user: | Add the <code>control</code> user: | ||
− | useradd -m -g users -G dialout,audio -s /bin/bash control | + | useradd -m -g users -G users,dialout,audio -s /bin/bash control |
passwd control | passwd control | ||
+ | |||
+ | == Upstart == | ||
+ | |||
+ | If using upstart, allow all users to send events by adding to <code>/etc/sudoers</code>: | ||
+ | # Allow users to emit upstart events | ||
+ | %users ALL=(ALL) NOPASSWD:/sbin/initctl | ||
== Audio == | == Audio == | ||
Line 118: | Line 169: | ||
Try to play a tone: | Try to play a tone: | ||
su | su | ||
+ | aplay -l | ||
SOUND_FILES_LOCATION='/home/control/Documents/Controls/Sounds' | SOUND_FILES_LOCATION='/home/control/Documents/Controls/Sounds' | ||
ll $SOUND_FILES_LOCATION | ll $SOUND_FILES_LOCATION | ||
aplay $SOUND_FILES_LOCATION/pop.wav | aplay $SOUND_FILES_LOCATION/pop.wav | ||
+ | |||
+ | Disable the HDMI audio interface by adding to <code>/boot/uboot/uEnv.txt</code>: | ||
+ | optargs=quiet capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN capemgr.enable_partno=BB-BONE-AUDI-01 | ||
+ | |||
+ | echo BB-BONE-AUDI-01 > /sys/devices/bone*/slots | ||
+ | |||
+ | edit <code>/etc/modules</code>: | ||
+ | snd_soc_tlv320aic3x | ||
+ | snd_soc_davinci | ||
+ | snd_soc_davinci_mcasp | ||
+ | snd_soc_evm | ||
+ | |||
+ | Setup line out sound path: | ||
+ | amixer scontrols | ||
+ | amixer set PCM 100% | ||
+ | amixer set Line mute | ||
+ | amixer set 'Line DAC' 0 | ||
+ | amixer set 'Line Line2 Bypass' 0 | ||
+ | amixer set 'Line PGA Bypass' 0 | ||
+ | amixer set Mono mute | ||
+ | amixer set 'Mono DAC' 0 | ||
+ | amixer set 'Mono Line2 Bypass' 0 | ||
+ | amixer set 'Mono Mixer DACL1' mute | ||
+ | amixer set 'Mono Mixer DACR1' mute | ||
+ | amixer set 'Mono Mixer Line2L Bypass' mute | ||
+ | amixer set 'Mono Mixer Line2R Bypass' mute | ||
+ | amixer set 'Mono Mixer PGAL Bypass' mute | ||
+ | amixer set 'Mono Mixer PGAR Bypass' mute | ||
+ | amixer set 'Mono PGA Bypass' 0 | ||
+ | amixer set AGC mute | ||
+ | amixer set De-emphasis mute | ||
+ | amixer set HP unmute | ||
+ | amixer set 'HP DAC' 100% | ||
+ | amixer set 'HP Line2 Bypass' 0 | ||
+ | amixer set 'HP PGA Bypass' 0 | ||
+ | amixer set 'HPCOM' mute | ||
+ | amixer set 'HPCOM DAC' 0 | ||
+ | amixer set 'HPCOM Line2 Bypass' 0 | ||
+ | amixer set 'HPCOM PGA Bypass' 0 | ||
+ | amixer set 'Left HP Mixer DACL1' unmute | ||
+ | amixer set 'Left HP Mixer DACR1' 0 | ||
+ | amixer set 'Left HP Mixer Line2L' mute | ||
+ | amixer set 'Left HP Mixer Line2R Bypass' 0 | ||
+ | amixer set 'Left HP Mixer PGAL Bypass' unmute | ||
+ | amixer set 'Left HP Mixer PGAR Bypass' 0 | ||
+ | amixer set 'Left HPCOM Mixer DACL1' mute | ||
+ | amixer set 'Left HPCOM Mixer DACR1' 0 | ||
+ | amixer set 'Left HPCOM Mixer Line2L Bypass' mute | ||
+ | amixer set 'Left HPCOM Mixer Line2R Bypass' 0 | ||
+ | amixer set 'Left HPCOM Mixer PGAL Bypass' mute | ||
+ | amixer set 'Left HPCOM Mixer PGAR Bypass' 0 | ||
+ | amixer set 'Left Line Mixer DACL1' mute | ||
+ | amixer set 'Left Line Mixer DACR1' 0 | ||
+ | amixer set 'Left Line Mixer Line2L Bypass' mute | ||
+ | amixer set 'Left Line Mixer Line2R Bypass' 0 | ||
+ | amixer set 'Left Line Mixer PGAL Bypass' mute | ||
+ | amixer set 'Left Line Mixer PGAR Bypass' 0 | ||
+ | |||
+ | speaker-test -c 2 -t sine | ||
= Checks = | = Checks = | ||
Line 156: | Line 267: | ||
initctl list | initctl list | ||
initctl list | grep xpl- | initctl list | grep xpl- | ||
+ | |||
+ | == Systemd daemons == | ||
+ | |||
+ | Check the status of init daemons: | ||
+ | systemctl list-units --type=service --state=running | grep running | ||
+ | |||
+ | [[Category: all]] [[Category: Install]] |
Latest revision as of 10:47, 30 December 2017
The xPL protocol is light enough to run on simple machines such as the BeagleBone.
Contents
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
Locales
Install locales (for PERL and others):
su locale-gen en_US.UTF-8
Then edit ~.bashrc
and add:
export LC_ALL=C
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 auto eth0 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
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 install build-essential
Install Perl documentation reader:
apt 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
Beaglebone Capes
List the capes known by the system:
cat /sys/devices/bone_capemgr*/slots
List the firmware capes definitions:
ll /lib/firmware/*.dtbo
UART enabling on the fly
Get UART cape definitions from ARMhf.
Add an UART cape definition in a running system:
echo ttyO1_armhf.com > /sys/devices/bone_capemgr*/slots ll /dev/ttyO*
UART enabling at boot
This shows how to enable ttyO1 at system boot.
Decompile the system dtb
:
cd /tmp apt-get install device-tree-compiler dtc -I dtb -O dts -o am335x-boneblack.dts /boot/dtbs/am335x-boneblack.dtb
Add in the dts
, at the end of the pinmux@44e10800
section:
pinmux_serial1_pins { pinctrl-single,pins = <0x180 0x20 0x184 0x0>; linux,phandle = <0x81>; phandle = <0x81>; };
Change in the dts
, at the end of the pinmux@44e10800
section:
status = "disabled";
with:
pinctrl-names = "default"; pinctrl-0 = <0x81>; status = "okay";
Note the use of handle 0x81
in both parts.
Recompile the dts
:
dtc -I dts -O dtb -o /boot/dtbs/am335x-boneblack.dtb am335x-boneblack.dts
An alternative
is to write the echo ttyO1_armhf.com > /sys/devices/bone_capemgr*/slots
command in /etc/rc.local
.
Control user
Create user
Add the control
user:
useradd -m -g users -G users,dialout,audio -s /bin/bash control passwd control
Upstart
If using upstart, allow all users to send events by adding to /etc/sudoers
:
# Allow users to emit upstart events %users ALL=(ALL) NOPASSWD:/sbin/initctl
Audio
Try to play a tone:
su aplay -l SOUND_FILES_LOCATION='/home/control/Documents/Controls/Sounds' ll $SOUND_FILES_LOCATION aplay $SOUND_FILES_LOCATION/pop.wav
Disable the HDMI audio interface by adding to /boot/uboot/uEnv.txt
:
optargs=quiet capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN capemgr.enable_partno=BB-BONE-AUDI-01
echo BB-BONE-AUDI-01 > /sys/devices/bone*/slots
edit /etc/modules
:
snd_soc_tlv320aic3x snd_soc_davinci snd_soc_davinci_mcasp snd_soc_evm
Setup line out sound path:
amixer scontrols amixer set PCM 100% amixer set Line mute amixer set 'Line DAC' 0 amixer set 'Line Line2 Bypass' 0 amixer set 'Line PGA Bypass' 0 amixer set Mono mute amixer set 'Mono DAC' 0 amixer set 'Mono Line2 Bypass' 0 amixer set 'Mono Mixer DACL1' mute amixer set 'Mono Mixer DACR1' mute amixer set 'Mono Mixer Line2L Bypass' mute amixer set 'Mono Mixer Line2R Bypass' mute amixer set 'Mono Mixer PGAL Bypass' mute amixer set 'Mono Mixer PGAR Bypass' mute amixer set 'Mono PGA Bypass' 0 amixer set AGC mute amixer set De-emphasis mute amixer set HP unmute amixer set 'HP DAC' 100% amixer set 'HP Line2 Bypass' 0 amixer set 'HP PGA Bypass' 0 amixer set 'HPCOM' mute amixer set 'HPCOM DAC' 0 amixer set 'HPCOM Line2 Bypass' 0 amixer set 'HPCOM PGA Bypass' 0 amixer set 'Left HP Mixer DACL1' unmute amixer set 'Left HP Mixer DACR1' 0 amixer set 'Left HP Mixer Line2L' mute amixer set 'Left HP Mixer Line2R Bypass' 0 amixer set 'Left HP Mixer PGAL Bypass' unmute amixer set 'Left HP Mixer PGAR Bypass' 0 amixer set 'Left HPCOM Mixer DACL1' mute amixer set 'Left HPCOM Mixer DACR1' 0 amixer set 'Left HPCOM Mixer Line2L Bypass' mute amixer set 'Left HPCOM Mixer Line2R Bypass' 0 amixer set 'Left HPCOM Mixer PGAL Bypass' mute amixer set 'Left HPCOM Mixer PGAR Bypass' 0 amixer set 'Left Line Mixer DACL1' mute amixer set 'Left Line Mixer DACR1' 0 amixer set 'Left Line Mixer Line2L Bypass' mute amixer set 'Left Line Mixer Line2R Bypass' 0 amixer set 'Left Line Mixer PGAL Bypass' mute amixer set 'Left Line Mixer PGAR Bypass' 0 speaker-test -c 2 -t sine
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-
Systemd daemons
Check the status of init daemons:
systemctl list-units --type=service --state=running | grep running