From d1d34c97f1e1b2acb0a627695782d80998892e66 Mon Sep 17 00:00:00 2001 From: Romain BROUCQUART <romain.broucquart@synchrotron-soleil.fr> Date: Mon, 27 Feb 2023 10:21:35 +0100 Subject: [PATCH] feat(fpgainit):Add a startup script to load FPGA * This parse a configuration file and then load the FPGA with the correct bitstream (centralnode or cellnode) --- .../fofb-fpgainit/files/fofb-fpgainit.sh | 28 +++++++++++++++++++ .../fofb-fpgainit/fofb-fpgainit_1.0.bb | 20 +++++++++++++ recipes-core/images/zup-image-soleil-fofb.bb | 4 ++- 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 recipes-app/fofb-fpgainit/files/fofb-fpgainit.sh create mode 100644 recipes-app/fofb-fpgainit/fofb-fpgainit_1.0.bb diff --git a/recipes-app/fofb-fpgainit/files/fofb-fpgainit.sh b/recipes-app/fofb-fpgainit/files/fofb-fpgainit.sh new file mode 100644 index 0000000..2bdbba1 --- /dev/null +++ b/recipes-app/fofb-fpgainit/files/fofb-fpgainit.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +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} + +case $FOFB_APP in + cellnode|centralnode) + logger -t "fofb-fpgainit" "Found configuration ${FOFB_APP}" + ;; + *) + logger -s -t "fofb-fpgainit" "Could not establish FOFB application" + exit 1 + ;; +esac + +# Taking the last binary fil 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} + diff --git a/recipes-app/fofb-fpgainit/fofb-fpgainit_1.0.bb b/recipes-app/fofb-fpgainit/fofb-fpgainit_1.0.bb new file mode 100644 index 0000000..509af03 --- /dev/null +++ b/recipes-app/fofb-fpgainit/fofb-fpgainit_1.0.bb @@ -0,0 +1,20 @@ +SUMMARY = "Program the FPGA depending on the configuration CellNode/CentralNode" +SECTION = "opt" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +# RC script +INITSCRIPT_NAME = "fofb-fpgainit.sh" +INITSCRIPT_PARAMS = "defaults 50" +inherit update-rc.d + +SRC_URI = " file://fofb-fpgainit.sh" + +RDEPENDS_${PN}=" fpga-manager-script bash" + +FILES_${PN}+="/etc/init.d/fofb-fpgainit.sh" + +do_install() { + install -d ${D}/etc/init.d/ + install -m 0755 ${WORKDIR}/fofb-fpgainit.sh ${D}/etc/init.d/fofb-fpgainit.sh +} diff --git a/recipes-core/images/zup-image-soleil-fofb.bb b/recipes-core/images/zup-image-soleil-fofb.bb index 30ff69a..c8d71bc 100644 --- a/recipes-core/images/zup-image-soleil-fofb.bb +++ b/recipes-core/images/zup-image-soleil-fofb.bb @@ -27,12 +27,14 @@ IMAGE_INSTALL_append = " python3-asyncua" IMAGE_INSTALL_append = " deviceaccess" IMAGE_INSTALL_append = " deviceaccess-python-bindings" IMAGE_INSTALL_append = " fofb-opcua-server" +IMAGE_INSTALL_append = " fofb-fpgainit" IMAGE_INSTALL_append = " xilinx-xvc-server" + IMAGE_FEATURES_append = " fpga-manager" -#IMAGE_INSTALL_append = " python3-pytango" # We do not need that IMAGE_INSTALL_remove = " git python3-pip sudo" +IMAGE_INSTALL_remove = " fpgautil-init" # Remove graphical features DISTRO_FEATURES_remove = " x11 wayland opengl qt jupyter" -- GitLab