summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSandeep Gundlupet Raju <sandeep.gundlupet-raju@amd.com>2023-06-28 12:03:31 -0600
committerMark Hatle <mark.hatle@amd.com>2023-06-29 09:56:52 -0500
commitb288439e79c87cbc3d7d0ed7879e9fd4adb873c8 (patch)
treeb07e33354902f6cd3d989436b36c8c3aafc2eab5
parent9b54de80aceb7ad78c3d60fe21ef0584b34c4140 (diff)
downloadmeta-xilinx-b288439e79c87cbc3d7d0ed7879e9fd4adb873c8.tar.gz
dfx-mgr: Move dfx-mgr bbappends from meta-petalinux
Signed-off-by: Sandeep Gundlupet Raju <sandeep.gundlupet-raju@amd.com> Signed-off-by: Mark Hatle <mark.hatle@amd.com>
-rw-r--r--meta-xilinx-bsp/recipes-bsp/dfx-mgr/dfx-mgr_%.bbappend10
-rw-r--r--meta-xilinx-bsp/recipes-bsp/dfx-mgr/files/zcu106-xlnx-firmware-detect71
2 files changed, 81 insertions, 0 deletions
diff --git a/meta-xilinx-bsp/recipes-bsp/dfx-mgr/dfx-mgr_%.bbappend b/meta-xilinx-bsp/recipes-bsp/dfx-mgr/dfx-mgr_%.bbappend
new file mode 100644
index 00000000..8fdf14bb
--- /dev/null
+++ b/meta-xilinx-bsp/recipes-bsp/dfx-mgr/dfx-mgr_%.bbappend
@@ -0,0 +1,10 @@
1FILESEXTRAPATHS:append := ":${THISDIR}/files"
2
3SRC_URI += "file://zcu106-xlnx-firmware-detect"
4
5PACKAGE_ARCH:zcu106-zynqmp = "${MACHINE_ARCH}"
6
7# ZCU106 eval board firmware detection script.
8do_install:append:zcu106-zynqmp () {
9 install -m 0755 ${WORKDIR}/zcu106-xlnx-firmware-detect ${D}${bindir}/xlnx-firmware-detect
10}
diff --git a/meta-xilinx-bsp/recipes-bsp/dfx-mgr/files/zcu106-xlnx-firmware-detect b/meta-xilinx-bsp/recipes-bsp/dfx-mgr/files/zcu106-xlnx-firmware-detect
new file mode 100644
index 00000000..ef5654cc
--- /dev/null
+++ b/meta-xilinx-bsp/recipes-bsp/dfx-mgr/files/zcu106-xlnx-firmware-detect
@@ -0,0 +1,71 @@
1#! /bin/sh
2
3# Copyright (C) 2022 Xilinx, Inc. All rights reserved.
4# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
5#
6# SPDX-License-Identifier: MIT
7
8# read values from dfx-mgr conf file
9conffile="/etc/dfx-mgrd/daemon.conf"
10if [ ! -f "${conffile}" ]; then
11 echo "dfx-mgrd configuration file not found: ${conffile}"
12 exit 1
13fi
14
15fwbasedir=$(grep "firmware_location" ${conffile} | sed 's/.*:.*\[\"\(.*\)\"\],\?/\1/')
16if [ -z "${fwbasedir}" ]; then
17 echo "Property 'firmware_location' not found in ${conffile}"
18 exit 1
19fi
20
21fwfile=$(grep "default_accel" ${conffile} | sed 's/.*:.*\"\(.*\)\",\?/\1/')
22if [ -z "${fwfile}" ]; then
23 echo "Property 'default_accel' not found in ${conffile}"
24 exit 1
25fi
26
27# check if default firmware is already set and present
28if [ -f "${fwfile}" ]; then
29 fwname=$(cat ${fwfile})
30 fwdir="${fwbasedir}/${fwname}"
31 if [ -n "${fwname}" ] && [ -d "${fwdir}" ]; then
32 echo "Default firmware detected: ${fwname}"
33 exit 0
34 fi
35fi
36
37# search for firmware based on EEPROM board id
38echo "Trying to detect default firmware based on EEPROM..."
39
40#check if board is a zcu106 eval board product
41eeprom=$(ls /sys/bus/i2c/devices/*54/eeprom 2> /dev/null)
42if [ -n "${eeprom}" ]; then
43 boardid=`dd if=$eeprom bs=1 count=6 skip=208 2>/dev/null | tr '[:upper:]' '[:lower:]'`
44 revision=`dd if=$eeprom bs=1 count=3 skip=224 2>/dev/null | tr '[:upper:]' '[:lower:]'`
45
46 fwname="${boardid}-${revision}"
47 fwdir="${fwbasedir}/${fwname}"
48
49 fixed_rev=2.0
50 var=$(awk 'BEGIN{ print "'$fixed_rev'"<"'$revision'" }')
51
52 if [ "${boardid}" == "zcu106" ] && [ "${var}" -eq 1 ] ;then
53 revision=2.0
54 echo "later than 2.0 board revisions are supported in 2.0 bit and dtbo files"
55 fwname="${boardid}-${revision}"
56 fwdir="${fwbasedir}/${fwname}"
57 echo "${fwname}" > "${fwfile}"
58 exit 1
59 elif [ ! -d "${fwdir}" ] ; then
60 echo "No default firmware named ${fwname} found in ${fwbasedir} , Loading rev1.0 bitstream and dtbo as default "
61 revision=1.0
62 fwname=$(ls ${fwbasedir} | grep ${revision})
63 fwdir="${fwbasedir}/${fwname}"
64 echo "${fwname}" > "${fwfile}"
65 exit 1
66 fi
67
68 echo "Default firmware detected: ${fwname}"
69 echo "${fwname}" > "${fwfile}"
70 exit 0
71fi