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

fix(fofb-init):Correction on recipe, use init.d/functions

* Recipe parse & build errors fixed
* Use A proper init.d script skeleton
* change RC update params
parent 8c54e20c
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
. /etc/init.d/functions
PATH_CONF="/opt/fofb/cfg/configuration"
logger -t "fofb-fpgainit" "Reading configuration file ${PATH_CONF}"
if [ ! -f ${PATH_CONF} ]; then
logger -s -t "fofb-fpgainit" "Configuration file not found: ${PATH_CONF}"
exit 1
fi
source ${PATH_CONF}
start() {
if [ ! -f ${PATH_CONF} ]; then
echo "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
# 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}
# Linking the correct MAP file
PATH_MAP="/opt/fofb/map/app_${FOFB_APP}.mapt"
echo "Linking map file ${PATH_MAP}"
ln -sf ${PATH_MAP} /opt/fofb/map/app.mapt
}
case $FOFB_APP in
cellnode|centralnode)
logger -t "fofb-fpgainit" "Found configuration ${FOFB_APP}"
stop() {
echo "Nothing to be done"
}
### main logic ###
case "$1" in
start)
start
;;
stop)
stop
;;
status)
echo "Cannot give any status"
;;
restart|reload|condrestart)
stop
start
;;
*)
logger -s -t "fofb-fpgainit" "Could not establish FOFB application"
echo $"Usage: $0 {start|stop|restart|reload|status}"
exit 1
;;
esac
# Taking the last binary file in the sorted list (higher tag)
PATH_FPGABIN=$(ls -S /lib/firmware/base/${FOFB_APP}/*.bin | tail -n 1)
logger -t "fofb-fpgainit" "Loading FPGA image ${PATH_FPGABIN}"
fpgautil -b ${PATH_FPGABIN}
# Linking the correct MAP file
PATH_MAP="/opt/fofb/map/app_{FOFB_APP}.mapt"
logger -t "fofb-fpgainit" "Linking map file ${PATH_MAP}"
ln -s ${PATH_MAP} /opt/fofb/map/app.mapt
exit 0
......@@ -3,18 +3,21 @@ SECTION = "opt"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
# RC script
# This will add startup scripts
INITSCRIPT_NAME = "fofb-init.sh"
INITSCRIPT_PARAMS = "start 50 2"
INITSCRIPT_PARAMS = "defaults 50 2"
inherit update-rc.d
SRC_URI = " file://fofb-init.sh"
SRC_URI += " file://configuration
SRC_URI += " file://configuration"
SRC_URI += " file://fpgaversion.sh"
RDEPENDS_${PN}=" fpga-manager-script bash"
FILES_${PN}+="/etc/init.d/fofb-init.sh"
FILES_${PN}+="/usr/bin/fpgaversion"
FILES_${PN}+="/opt/fofb/cfg/configuration"
do_install() {
install -d ${D}/etc/init.d/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment