This repository has been archived on 2021-11-24. You can view files and clone it, but cannot push or open issues or pull requests.
fsfw_example_public/unlockRealtime
2021-04-27 17:22:34 +02:00

32 lines
802 B
Bash

#!/bin/bash
# Run this script to unlock all permissions to run the linux binaries
# and create threads
binaries=$(find $directory -type f -name "*.elf")
# Set up the soft realtime limit to maximum (99)
# Please note that the hard limit needs to be set to 99 too
# for this to work (check with ulimit -Hr).
# If that has not been done yet, add
# <username> hard rtprio 99
# to /etc/security/limits.conf
ulimit -Sr 99
echo Unlocking real time permissions for binaries...
for binary in ${binaries}; do
sudo setcap 'cap_sys_nice=eip' ${binary}
result=$?
if [ ${result} = 0 ];then
echo ${binary} was unlocked
fi
done
# Safety issues, so this should not be done.
# sudo setcap 'cap_sys_nice=eip' /bin/bash
# result=$?
# if [ ${result} = 0 ];then
# echo /bin/bash was unlocked
# fi