35
Setup Computer Debian 11
watts edited this page 2023-07-19 15:05:49 +02:00
Prepare Computer
- Install a Debian 11 Desktop 64 Bit, username: control with sudo permissions (add control to group sudo and to dialout)
- disable sleep modes in /etc/systemd/sleep.conf
[Sleep]
AllowSuspend=no
AllowHibernation=no
AllowSuspendThenHibernate=no
AllowHybridSleep=no
- set NTP server (if defaults are not working) in /etc/systemd/timesyncd.conf
[Time]
NTP=d.psi.ch
- Add various packages:
sudo apt-get install fakeroot build-essential cvs flex bison openssh-server git-core geany synaptic joe jed subversion autoconf-archive cmake libreadline-dev libhdf5-dev pkg-config libxml2-dev libzmq3-dev liblog4cpp5-dev libelf-dev libssl-dev libarchive-dev libgtkmm-3.0-dev libatkmm-1.6-dev libglibmm-2.4-dev libncurses5-dev libxerces-c-dev libboost-dev xsltproc cifs-utils xterm meld default-jre autogen autoconf libtool libqwt-qt5-dev libqt5webkit5-dev rsync libboost-all-dev strace python3-numpy python3-pip python3-h5py python3-zmq python3-matplotlib python3-attr python3-scipy hdf5-tools
pip3 install pyepics
- get the software from the repository, including the System Installation files:
cd
mkdir work
cd work
git clone https://gitlab.psi.ch/microspectro/pixelator.git stxm
- Compile Epics
cd /usr/local/
sudo mkdir epics
cd epics/
sudo chown control .
wget https://epics.anl.gov/download/base/base-7.0.6.1.tar.gz
tar xfvz base-7.0.6.1.tar.gz
rm base-7.0.6.1.tar.gz
cd base-7.0.6.1
make
# edit /etc/profile:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/epics/base-7.0.6.1/bin/linux-x86_64"
export EPICS_CA_ADDR_LIST="sls-x07da-cagw.psi.ch:5822"
sudo cp ~/work/stxm/SystemInstall/epics-64.conf /etc/ld.so.conf.d
# edit to match lib Path
sudo ldconfig
- Install Intens
cd /usr/local
sudo mkdir intens
sudo tar xfvz ~/work/stxm/SystemInstall/intens-4.5.15-snapshot-64-qt5.tar.gz
sudo cp ~/work/stxm/SystemInstall/libpython3.8.so.1.0 /lib/x86_64-linux-gnu/
- Install PI libs
cd ~/BaseSystem
tar xfvj ../work/stxm/SystemInstall/PI_Application_Software-1.4.0.1-INSTALL.tar.bz2
cd PI_Application_Software/
sudo ./INSTALL
#n
#n 32 bit Lib
#y 64 bit lib
#n UBS rights
#y PiPython
#y Stage Database
#n PiTerminal 32
#y PiTerminal 64
#n USB rights
- Compile RT Kernel and untar RTAI
cd ~/BaseSystem
wget https://mirrors.edge.kernel.org/pub/linux/kernel/v4.x/linux-4.19.177.tar.gz
tar xfz linux-4.19.177.tar.gz
wget https://github.com/mmorandi/RTAI/raw/main/userfiles/downloads/RTAI/rtai-5.3.tar.bz2
tar xfj rtai-5.3.tar.bz2
cd linux-4.19.177
patch -p1 < ../rtai-5.3/base/arch/x86/patches/hal-linux-4.19.177-cip44-x86-17.patch
cp ~/work/stxm/SystemInstall/linux-4.19.177rt.config .config
make localmodconfig # Compile only Modules, as they are used on the current computer
make -j5 deb-pkg LOCALVERSION=-rt1
cd ..
sudo dpkg -i linux-headers-4.19.177-rt1_4.19.177-rt1-1_amd64.deb linux-image-4.19.177-rt1_4.19.177-rt1-1_amd64.deb
# remove not used kernels
sudo dpkg -r linux-image-amd64
# e.g. # sudo dpkg -r linux-image-5.10.0-20-amd64 linux-image-5.10.0-21-amd64
- To modify Grub load order with a gui:
cd ~/BaseSystem
tar xfvz ../work/stxm/SystemInstall/grub-customizer_5.1.0.tar.gz
cd grub-customizer-5.1.0/
cmake .
make
sudo make install
- Compile RTAI 1st run
cd ~/BaseSystem
cd rtai-5.3
cp ../../work/stxm/SystemInstall/rtai-5.3_config-4.19.177-1st .rtai_config
make
#- check that numer of CPU (in Machine (x86)) matches your computer
#- check, that Net RPC is disabled (Base System -> Supported Services)
#- check eager inlining (General)
#- check path to linux source tree is correct (General)
sudo make install
#- to test installation
cd /usr/realtime/testsuite/kern/latency/
./run
- Compile Comedi
cd ~/BaseSystem
git clone https://github.com/Linux-Comedi/comedi.git
git clone https://github.com/Linux-Comedi/comedilib.git
cd comedi
cp ../../work/stxm/SystemInstall/N1231B_reg.h comedi/drivers
patch -p1 < ~/work/stxm/SystemInstall/comedi.patch
./autogen.sh
./configure --with-rtaidir=/usr/realtime
make
sudo make install
sudo depmod -a
sudo mkdir /usr/local/include/linux
sudo cp include/linux/comedi.h /usr/local/include/linux/
cd ../comedilib
./autogen.sh
./configure
make
sudo make install
- Compile RTAI 2nd run
cd ~/BaseSystem
cd rtai-5.3
cp ../../work/stxm/SystemInstall/rtai-5.3_config-4.19.177-2nd .rtai_config
make clean
make menuconfig
#- check that numer of CPU (in Machine (x86)) matches your computer
#- check, that Net RPC is disabled (Base System -> Supported Services)
#- check eager inlining (General)
#- check comedi path (Add-ons)
sudo make install
- Install either Orchestra or Orocos
Orchestra is no longer maintained and so Orocos is the new, preferred choice
For Orchestra:
cd ~/BaseSystem
tar xfvz ../work/stxm/SystemInstall/Orchestra-master.tar.gz
cd Orchestra-master/OrchestraCoreLib
make
sudo make install
cd ../OrchestraHostSupervisor
make
sudo make install
cd ../OrchestraCore
# edit lib/CoreMbxModule.cpp
# in line 558: change to "sleep (0.05);"
# this makes connect faster...
make
sudo make install
cd /usr/local/Orchestra/
sudo cp -a ~/BaseSystem/Orchestra-master/HMI/ .
cd /usr/local/bin
sudo ln -s /usr/local/Orchestra/HMI/OrchestraHMI .
cd /etc/rc5.d/
sudo ln -s ../init.d/OrchestraRTOS S90OrchestraRTOS
sudo ln -s ../init.d/OrchestraAutoRun S92OrchestraAutoRun
For Orocos:
git clone --recursive https://github.com/orocos-toolchain/orocos_toolchain.git
cd orocos_toolchain
./configure --prefix=/home/control/orocos
- Load Comedi driver and configure cards
sudo cp ~/work/stxm/SystemInstall/ComediLoadModules /etc/init.d
cd /etc/rc5.d
sudo ln -s ../init.d/ComediLoadModules S98ComediLoadModules
sudo cp ~/work/stxm/SystemInstall/comedi.conf /etc/modprobe.d
- Install latest hdf5 Version
cd ~/BaseSystem/
#download hdf5-1.14.0.tar.gz
tar xf hdf5-1.14.0.tar.gz
cd hdf5-1.14.0
mkdir build
cd build
cmake -DHDF5_BUILD_CPP_LIB=1 -DCMAKE_INSTALL_PREFIX=/usr/local ..
make
sudo make install
- Install STXM Software
cd ~/work/stxm/
autoreconf -i
mkdir build
cd build
../configure
make
cd PixelatorController/config/
make
cd ../../PixelatorGUI/config/
make
- Adapt configuration
edit /etc/security/limits.conf
add at the end:
control soft memlock 2000000
control hard memlock 2000000
- copy startup scripts
cp -a ~/work/stxm/SystemInstall/PolLux/StartupScripts/ ~