Skip to content
Snippets Groups Projects
Commit 457f4927 authored by BRONES Romain's avatar BRONES Romain
Browse files

feat(init):Change log, add links in /dev

* Use alias to log, redirect command outputs to log
* Parse through uio names to find which is axiapp and ddr4, make alias
  link in /dev
parent 1782b8d2
Branches
Tags
No related merge requests found
......@@ -4,47 +4,62 @@
PATH_CONF="/opt/fofb/cfg/configuration"
logger -t "fofb-fpgainit" "Reading configuration file ${PATH_CONF}"
shopt -s expand_aliases
alias log="logger -t \"fofb-fpgainit\""
log "Reading configuration file ${PATH_CONF}"
start() {
if [ ! -f ${PATH_CONF} ]; then
echo "Configuration file not found: ${PATH_CONF}"
log -p user.error "Configuration file not found: ${PATH_CONF}"
exit 1
fi
source ${PATH_CONF}
case $FOFB_APP in
cellnode|centralnode)
echo "Found configuration ${FOFB_APP}"
;;
*)
echo "Could not establish FOFB application"
exit 1
;;
esac
if [ -e /lib/firmware/base/${FOFB_APP} ]; then
log "Found configuration ${FOFB_APP}"
else
log -p user.error "Could not establish FOFB application"
exit 1
fi
# Taking the last binary file in the sorted list (higher tag)
PATH_FPGABIN=$(ls -S /lib/firmware/base/${FOFB_APP}/*.bin | tail -n 1)
echo "Loading FPGA image ${PATH_FPGABIN}"
fpgautil -b ${PATH_FPGABIN}
log "Loading FPGA image ${PATH_FPGABIN}"
fpgautil -b ${PATH_FPGABIN} |& log
# Reset the FPGA
/etc/init.d/fw_plreset.sh
log "Reset the FPGA"
/etc/init.d/fw_plreset.sh |& log
# Linking the correct MAP file
PATH_MAP="/opt/fofb/map/app_${FOFB_APP}.mapt"
echo "Linking map file ${PATH_MAP}"
log "Linking map file ${PATH_MAP}"
ln -sf ${PATH_MAP} /opt/fofb/map/app.mapt
# Applying configuration
fofb-configurator --config /opt/fofb/cfg/config_register --dmap /opt/fofb/opcua-server/devices.dmap
fofb-configurator --config /opt/fofb/cfg/config_register --dmap /opt/fofb/opcua-server/devices.dmap |& log
# Installing /dev links
for uio in /sys/class/uio/*
do
name=$(cat ${uio}/name)
uiobn=$(basename $uio)
case $name in
axiapp|ddr4)
log "Installing link /dev/$name -> /dev/$uiobn"
ln -sf /dev/$uiobn /dev/$name
;;
*)
;;
esac
done
}
stop() {
echo "Nothing to be done"
log "Nothing to be done"
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment