Overview

This guide is for building the laser locker application on a RHEL7 platform.  Before building the Laser Locker binary, we should ensure that its various dependencies --such as third-party libraries and SLAC-developed packages and other EPICS modules-- are compiled first in the native RHEL7 environment.  As of now, there is no list of recommended RHEL7 hosts to use.  However, the host used to prepare and produce the libraries and binaries for this effort was aird-b50-srv01.

The main approach used to complete this task was to build code in a personal sandbox and then install the compiled libraries and binaries in the central LCLS package directory (i.e./afs/slac/g/lcls/package/).

Note: To check out packages and modules in your sandbox, use the eco tool:

eco -m <pkg_name> <version or tag>

If no version or tag is provided, the current master branch will be checked out instead.


To get eco in your path, do the following:

source /afs/slac/g/lcls/tools/script/ENVS64.bash


Workflow

We start off with the interface to the firmware.  The middleware layer predominantly used at SLAC is the CPSW library.  For the Laser Locker module, the required version of CPSW is version R4.4.1.  The steps are the following:

  1. Build CPSW R4.4.1 dependencies
  2. Build CPSW R4.4.1
  3. Build CPSW FirmwareLoader R1.3.0
  4. Build CPSW-dependent packages
  5. Build EPICS modules dependent on CPSW & CPSW-dependent packages
  6. Build remaining prerequisite EPICS modules
  7. Build the Laser Locker EPICS module

Note: The resulting laser locker version will be tagged as R1.5.0-1.0.

Build CPSW R4.4.1 Dependencies

The CPSW middleware depends on the yaml-cpp and boost third-party libraries.  In this step, we build and install yaml-cpp 0.5.3 and boost 1.64.

TPL Library NameVersion #
yaml-cpp0.5.3
boost1.64

yaml-cpp 0.5.3

From the yaml-cpp build directory (i.e. <yaml-cpp source path>/build/), do:

cmake ../ -DCMAKE_INSTALL_PREFIX=/afs/slac/g/lcls/package/yaml-cpp/yaml-cpp-0.5.3_boost-1.64.0/rhel7-x86_64 -DCMAKE_CXX_FLAGS="-fPIC" -DBOOST_ROOT=/afs/slac/g/lcls/package/boost/1.64.0/rhel7-x86_64/ -DBOOST_INCLUDEDIR=/afs/slac/g/lcls/package/boost/1.64.0/rhel7-x86_64/include/ -DBOOST_LIBRARYDIR=/afs/slac/g/lcls/package/boost/1.64.0/rhel7-x86_64/lib/
make
make install

boost 1.64

From the boost source directory, do:

./bootstrap.sh
./b2

Then copy boost/ and stage/lib to directories include/ and lib/ respectively in /afs/slac/g/lcls/package/boost/1.64.0/rhel7-x86_64/.

Build CPSW 4.4.1

From the CPSW source directory, edit config.mak as described below in the various code blocks.


Change host architecture to RHEL7:

HARCH=rhel7-x86_64


Comment out buildroot-related lines:

#ARCHES += buildroot-2019.08-x86_64 buildroot-2019.08-i686 buildroot-2019.08-arm
#BR_HARCH=linux-x86_64
#BR_VERSN=$(word 2,$(subst -, ,$(TARCH)))
#BR_TARCH=$(subst zynq,arm,$(word 3,$(subst -, ,$(TARCH))))
#BR_CROSS=/afs/slac/package/linuxRT/buildroot-$(BR_VERSN)/host/$(BR_HARCH)/$(BR_TARCH)/usr/bin/$(BR_TARCH)-linux-
#BR_ARNAMS=$(subst .,_,$(subst -,_,$(filter buildroot-%,$(ARCHES))))
#$(foreach brarnam,$(BR_ARNAMS),$(eval CROSS_$(brarnam)=$$(BR_CROSS)))


Specify the install path:

INSTALL_DIR=$(PACKAGE_TOP)/cpsw/framework/R4.4.1/


Note that CPSW is built in the form of both static and shared libraries.  To check the dependency of the CPSW shared library on other libraries, use ldd:

-bash-4.2$ ldd /afs/slac/g/lcls/package/cpsw/framework/R4.4.1/rhel7-x86_64/lib/libcpsw.so  
linux-vdso.so.1 =>  (0x00007fffd65c9000)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fab7ae89000)
libm.so.6 => /lib64/libm.so.6 (0x00007fab7ab87000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fab7a971000)
libc.so.6 => /lib64/libc.so.6 (0x00007fab7a5a3000)
/lib64/ld-linux-x86-64.so.2 (0x00007fab7b589000)


Also, you can see the contents of the static library (which is simply an archive of object files) with:

readelf -I libcpsw.a


Then do:

make
make install

Build CPSW FirmwareLoader

Check out FirmwareLoader R1.3.0 with eco and modify the release.mak file to point to CPSW 4.4.1's source directory that was used to build CPSW on RHEL7. 


Then, simply do the following to produce the FirmwareLoader binary.

make
make install

Build CPSW-Dependent Packages

Find the relevant packages for the Laser Locker module that depend on CPSW.  Those are the following:


Package Name Revision #

commonATCA

R1.3.0

timing/jitterCleaner

R1.1.0

timing/hpsTpr

R2.0.1

timing/bsa

R2.0.0

commonATCA R1.3.0

Edit the CPSW_DIR (to use CPSW 4.4.1) and INSTALL path variables in src/makefile.  Then do:

make
make install

timing/jitterCleaner R1.1.0

Edit the CPSW_DIR (to use CPSW 4.4.1) and INSTALL path variables in src/makefile.  Then do:

make
make install

timing/hpsTpr R2.0.1

Edit the CPSW_DIR (to use CPSW 4.4.1) and INSTALL path variables in src/makefile.  Then do:

make
make install

timing/bsa R2.0.0

Edit the CPSW_DIR (to use CPSW 4.4.1) and INSTALL path variables in src/makefile.  Then do:

make
make install

Build EPICS Modules Dependent On CPSW & Other CPSW-Dependent Packages

The EPICS modules that depend on both CPSW and CPSW-dependent packages and modules are the following:


EPICS Module NameStarting Revision #New Revision #
yamlLoaderR2.1.0R2.1.0 - 1.0
ycpswasynR3.3.3R3.3.3 - 1.0
tprTriggerR1.5.0R1.5.0 - 1.0
tprPatternR1.4.0R1.4.0 - 1.0
crossbarControlR1.2.0R1.2.0 - 1.0
ATCACommonR1.4.0R1.4.0 - 1.0


As shown in the table above, new tags will be created to capture the relevant changes for RHEL7 support.  The reason for new tags is because the original source code (i.e. configuration files in this case) is modified to accommodate support for a new platform.

yamlLoader R2.1.0-1.0

In the configure/ directory, create a new file named CONFIG_SITE.Common.rhel7-x86_64 with a single line in it:

PKG_ARCH=rhel7-x86_64

Also, ensure that configure/RELEASE or /configure/RELEASE.local point to compatible tags of required modules.  Then simply do make or make CROSS_COMPILER_TARGET_ARCHS= to build the static library.

ycpswasyn R3.3.3-1.0

In the configure/ directory, create a new file named CONFIG_SITE.Common.rhel7-x86_64 with a single line in it:

PKG_ARCH=rhel7-x86_64

Also, ensure that configure/RELEASE or /configure/RELEASE.local point to compatible tags of required modules.  Then simply do make or make CROSS_COMPILER_TARGET_ARCHS= to build the static library.

tprTrigger R1.5.0-1.0

In the configure/ directory, create a new file named CONFIG_SITE.Common.rhel7-x86_64 with a single line in it:

PKG_ARCH=rhel7-x86_64

Also, ensure that configure/RELEASE or /configure/RELEASE.local point to compatible tags of required modules.  Then simply do make or make CROSS_COMPILER_TARGET_ARCHS= to build the static library.

tprPattern R1.4.0-1.0

In the configure/ directory, create a new file named CONFIG_SITE.Common.rhel7-x86_64 with a single line in it:

PKG_ARCH=rhel7-x86_64

Also, ensure that configure/RELEASE or /configure/RELEASE.local point to compatible tags of required modules.  Then simply do make or make CROSS_COMPILER_TARGET_ARCHS= to build the static library.

crossbarControl R1.2.0-1.0

In the configure/ directory, create a new file named CONFIG_SITE.Common.rhel7-x86_64 with a single line in it:

PKG_ARCH=rhel7-x86_64

Also, ensure that configure/RELEASE or /configure/RELEASE.local point to compatible tags of required modules.  Then simply do make or make CROSS_COMPILER_TARGET_ARCHS= to build the static library.

ATCACommon R1.4.0-1.0

In the configure/ directory, create a new file named CONFIG_SITE.Common.rhel7-x86_64 with a single line in it:

PKG_ARCH=rhel7-x86_64

Also, ensure that configure/RELEASE or /configure/RELEASE.local point to compatible tags of required modules.  Then simply do make or make CROSS_COMPILER_TARGET_ARCHS= to build the static library.

Build Remaining Prerequisite EPICS Modules

Also build the RHEL7 libraries for iocAdmin, seq, caPutLog without creating new tags, since no dependencies exist on updated epics modules or third-party-libraries in these.


EPICS Module NameRevision #
iocAdminR3.1.15-1.9.0
seqR2.2.4-1.1
caPutLogR3.5-1.0.0


For "host only" module builds (i.e. for RHEL7 in this case) simply do:

make  CROSS_COMPILER_TARGET_ARCHS=

Build The Laser Locker EPICS Module

In the configure/ directory, create a new file named CONFIG_SITE.Common.rhel7-x86_64 with a single line in it:

PKG_ARCH=rhel7-x86_64

In configure/RELEASE, update the tags to point to the new newly created tags and modules above.


Finally, do the following to build the Laser Locker binary.  The latter will be built statically and should be ready to be ported into the production environment.

make

There is no content with the specified labels

  • No labels