EPICS Base Install
準備
EPICS コンパイルに必要なパッケージをインストールする(screen, emacs, tcsh などは趣味の問題なので必須ではない)
[root@centos-rpi2 ~]# yum install --skip-broken which gcc gcc-c++ make wget bind-utils perl perl-devel readline-devel screen emacs lsof telnet tcsh
--skip-broken を指定する必用があった。 (GtkなどのXwindow 関連パッケージを先に入れておけば出ないのかもしれないし、ARM用だからなのかもしれない。未調査。)
re2c をパッケージで入れようとしたが
いつものように EPEL追加してインストールしようとしたが.... 参考:https://wiki.centos.org/SpecialInterestGroup/AltArch/Arm32#head-f2a772703b3caa90cc284e01bc87423ce9a87bcd の手順に従って
# vi /etc/yum.repos.d/epel.repo [epel] name=Epel rebuild for armhfp baseurl=https://armv7.dev.centos.org/repodir/epel-pass-1/ enabled=0 gpgcheck=0
としておいて、
yum --enablerepo=epel install re2c
とする ---> この方式ではインストールできなかった。
re2c をソースからインストール
https://sourceforge.net/projects/re2c/files/ からソースをダウンロードして、configure, make, make install したのみ。/usr/localにインストールした。
EPICS
http://cerldev.kek.jp/trac/EpicsUsersJP/wiki/epics/install/epics_base と同じ方針で ユーザー作成
# useradd -s /bin/bash epics # passwd epics
[root@centos-rpi2 /]# cd opt/ [root@centos-rpi2 opt]# ls [root@centos-rpi2 opt]# mkdir epics [root@centos-rpi2 opt]# chown epics:epics epics
あとは epics ユーザーで作業
[epics@centos-rpi2 ~]$ cd /opt/epics/ [epics@centos-rpi2 epics]$ mkdir R315.5 arc [epics@centos-rpi2 epics]$ cd arc/ [epics@centos-rpi2 arc]$ wget https://www.aps.anl.gov/epics/download/base/base-3.15.5.tar.gz [epics@centos-rpi2 arc]$ /opt/epics/R315.5 [epics@centos-rpi2 R315.5]$ gzip -dc ../arc/base-3.15.5.tar.gz | tar xvf - [epics@centos-rpi2 R315.5]$ mv base-3.15.5 base [epics@centos-rpi2 R315.5]$ cd base
[epics@centos-rpi2 base]$ export EPICS_HOST_ARCH=linux-arm [epics@centos-rpi2 base]$ export LANG=C [epics@centos-rpi2 base]$ make
約30分でmake終了した。
EPICS Application 作成
export EPICS_HOST_ARCH=linux-arm PATH=$PATH:$HOME/.local/bin:$HOME/bin PATH=$PATH:/opt/epics/R315.5/base/bin/$EPICS_HOST_ARCH export PATH
[epics@centos-rpi2 ~]$ mkdir -p app/example
[epics@centos-rpi2 ~]$ cd app/example/
[epics@centos-rpi2 example]$ makeBaseApp.pl -l
Valid application types are:
example
caClient
support
caServer
ioc
Valid iocBoot types are:
ioc
example
[epics@centos-rpi2 example]$ makeBaseApp.pl -t example example
[epics@centos-rpi2 example]$ makeBaseApp.pl -i -t example example
Using target architecture linux-arm (only one available)
The following applications are available:
example
What application should the IOC(s) boot?
The default uses the IOC's name, even if not listed above.
Application name? <---------- enter 押すのみ
[epics@centos-rpi2 example]$
[epics@centos-rpi2 example]$ make
make -C ./configure install
make[1]: ディレクトリ `/home/epics/app/example/configure' に入ります
perl -CSD /opt/epics/R315.5/base/bin/linux-arm/makeMakefile.pl O.linux-arm ../..
mkdir O.Common
make -C O.linux-arm -f ../Makefile TOP=../.. \
......................................
perl -CSD /opt/epics/R315.5/base/bin/linux-arm/convertRelease.pl -t /home/epics/app/example envPaths
make[2]: ディレクトリ `/home/epics/app/example/iocBoot/iocexample' から出ます
make[1]: ディレクトリ `/home/epics/app/example/iocBoot' から出ます
[epics@centos-rpi2 example]$
[epics@centos-rpi2 example]$ cd iocBoot/iocexample/
[epics@centos-rpi2 iocexample]$ ls
Makefile README envPaths st.cmd
[epics@centos-rpi2 iocexample]$ chmod +x st.cmd
[epics@centos-rpi2 iocexample]$ ./st.cmd
#!../../bin/linux-arm/example
## You may have to change example to something else
## everywhere it appears in this file
< envPaths
epicsEnvSet("IOC","iocexample")
epicsEnvSet("TOP","/home/epics/app/example")
epicsEnvSet("EPICS_BASE","/opt/epics/R315.5/base")
cd "/home/epics/app/example"
## Register all support components
dbLoadDatabase "dbd/example.dbd"
example_registerRecordDeviceDriver pdbbase
## Load record instances
dbLoadTemplate "db/user.substitutions"
dbLoadRecords "db/dbSubExample.db", "user=epics"
## Set this to see messages from mySub
#var mySubDebug 1
## Run this to trace the stages of iocInit
#traceIocInit
cd "/home/epics/app/example/iocBoot/iocexample"
iocInit
Starting iocInit
############################################################################
## EPICS R3.15.5
## EPICS Base built Jun 1 2017
############################################################################
iocRun: All initialization complete
## Start any sequence programs
#seq sncExample, "user=epics"
epics> dbl
epics:xxxExample
epics:compressExample
epics:calcExample
epics:calcExample1
epics:calc1
epics:calcExample2
epics:calc2
epics:calcExample3
epics:calc3
epics:aSubExample
epics:subExample
epics:aiExample
epics:aiExample1
epics:ai1
epics:aiExample2
epics:ai2
epics:aiExample3
epics:ai3
IOCの起動はOK. dbpr などで値を確認。
firewall 設定
デフォルトではfirewallが有効になっている。SELinuxまで含め、全部無効にする手はあるが、CentOS7の流儀を知る良い機会と思ってポートを開ける方法を調べる。
参考:http://qiita.com/haminiku/items/56fcb578d86abcd0b571
設定確認
[root@centos-rpi2 ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: active (running) since 木 1970-01-01 09:00:12 JST; 47 years 4 months ago
Docs: man:firewalld(1)
Main PID: 235 (firewalld)
CGroup: /system.slice/firewalld.service
mq235 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
1月 01 09:00:08 centos-rpi2 systemd[1]: Starting firewalld - dynamic firew....
1月 01 09:00:12 centos-rpi2 systemd[1]: Started firewalld - dynamic firewa....
Hint: Some lines were ellipsized, use -l to show in full.
稼働状況の確認
[root@centos-rpi2 services]# firewall-cmd --list-all public (active) target: default icmp-block-inversion: no interfaces: eth0 sources: services: dhcpv6-client ssh ports: protocols: masquerade: no forward-ports: sourceports: icmp-blocks: rich rules:
上にも記述されているが、サービスのみリストすると
[root@centos-rpi2 ~]# firewall-cmd --list-services --zone=public --permanent dhcpv6-client ssh
利用可能なサービスの一覧は以下のコマンドで参照可能
[root@centos-rpi2 services]# firewall-cmd --get-services RH-Satellite-6 amanda-client ..... xmpp-client xmpp-local xmpp-server
コマンドラインで指定しても良いが、epics用の設定ファイルを作る方針とする。
/usr/lib/firewalld/services ディレクトリにサービスごとの定義ファイルがある。
ここからコピーして使用
[root@centos-rpi2 ~]# cd /usr/lib/firewalld/services [root@centos-rpi2 services]# cp amanda-client.xml epics.xml [root@centos-rpi2 services]# vi epics.xml 以下のように編集 <?xml version="1.0" encoding="utf-8"?> <service> <short>EPICS</short> <description>EPICS Control System port</description> <port protocol="tcp" port="5064"/> <port protocol="tcp" port="5065"/> <port protocol="udp" port="5064"/> <port protocol="udp" port="5065"/> </service>
サービス追加
[root@centos-rpi2 services]# firewall-cmd --add-service=epics --zone=public --permanent success [root@centos-rpi2 services]# [root@centos-rpi2 services]# firewall-cmd --list-services --zone=public --permanent dhcpv6-client epics ssh [root@centos-rpi2 services]# firewall-cmd --reload
念のため一覧表示してみて、epics がpublic ゾーンで有効になっていることを確認
[root@centos-rpi2 services]# firewall-cmd --list-all-zones public (active) target: default icmp-block-inversion: no interfaces: eth0 sources: services: dhcpv6-client epics ssh ports: protocols: masquerade: no forward-ports: sourceports: icmp-blocks: rich rules:
EPICS Client
[epics@centos-rpi2 ~]$ camonitor epics:ai1 epics:ai1 2017-06-01 17:59:22.096207 8 HIHI MAJOR epics:ai1 2017-06-01 17:59:23.096240 9 HIHI MAJOR epics:ai1 2017-06-01 17:59:24.096190 0 LOLO MAJOR ....
O.K.! 外部ホストであるノートPCクライアントからも値が取れることを確認した。
[epics@centos-rpi2 ~]$ netstat -an | grep 5064 tcp 0 0 0.0.0.0:5064 0.0.0.0:* LISTEN udp 0 0 0.0.0.0:5064 0.0.0.0:*
