diff options
Diffstat (limited to 'meta-xilinx-demos/scripts/generate-machines-sdt.sh')
| -rwxr-xr-x | meta-xilinx-demos/scripts/generate-machines-sdt.sh | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/meta-xilinx-demos/scripts/generate-machines-sdt.sh b/meta-xilinx-demos/scripts/generate-machines-sdt.sh new file mode 100755 index 00000000..aaeef385 --- /dev/null +++ b/meta-xilinx-demos/scripts/generate-machines-sdt.sh | |||
| @@ -0,0 +1,79 @@ | |||
| 1 | #! /bin/bash -e | ||
| 2 | |||
| 3 | ### The following table controls the automatic generated of the firmware demos | ||
| 4 | ### Machine Recipe | ||
| 5 | #M# vek280-pl-bram-gpio-fw recipes-firmware/vek280-pl-bram-uart-gpio-fw/vek280-pl-bram-uart-gpio-fw_1.0-2024.2.bb | ||
| 6 | #M# zcu104-pl-vcu-fw recipes-firmware/zcu104-pl-vcu-fw/zcu104-pl-vcu-fw_1.0-2024.2.bb | ||
| 7 | |||
| 8 | this=$(realpath $0) | ||
| 9 | |||
| 10 | if [ $# -lt 2 ]; then | ||
| 11 | echo "$0: <conf_path> <machine_url_index> [machine]" >&2 | ||
| 12 | exit 1 | ||
| 13 | fi | ||
| 14 | |||
| 15 | conf_path=$(realpath $1) | ||
| 16 | if [ ! -d ${conf_path} ]; then | ||
| 17 | mkdir -p ${conf_path} | ||
| 18 | fi | ||
| 19 | |||
| 20 | |||
| 21 | mach_index=$(realpath $2) | ||
| 22 | count=0 | ||
| 23 | while read mach_id mach_url; do | ||
| 24 | if [ ${mach_id} = '#' ]; then | ||
| 25 | continue | ||
| 26 | fi | ||
| 27 | |||
| 28 | MACHINE_ID[$count]=${mach_id} | ||
| 29 | MACHINE_URL[$count]=${mach_url} | ||
| 30 | |||
| 31 | count=$(expr $count + 1) | ||
| 32 | done < ${mach_index} | ||
| 33 | |||
| 34 | |||
| 35 | # Load in the arrays from this script | ||
| 36 | count=0 | ||
| 37 | while read marker machine recipe ; do | ||
| 38 | if [ "${marker}" != "#M#" ]; then | ||
| 39 | continue | ||
| 40 | fi | ||
| 41 | |||
| 42 | MACHINES[$count]=${machine} | ||
| 43 | RECIPES[$count]=${recipe} | ||
| 44 | for mach in ${!MACHINE_ID[@]}; do | ||
| 45 | if [ ${MACHINE_ID[${mach}]} = ${machine} ]; then | ||
| 46 | URLS[$count]=${MACHINE_URL[${mach}]} | ||
| 47 | break | ||
| 48 | fi | ||
| 49 | done | ||
| 50 | if [ -z "${URLS[$count]}" ]; then | ||
| 51 | echo "ERROR: Unable to find ${machine} in ${mach_index}" >&2 | ||
| 52 | exit 1 | ||
| 53 | fi | ||
| 54 | |||
| 55 | count=$(expr $count + 1) | ||
| 56 | done < ${this} | ||
| 57 | |||
| 58 | |||
| 59 | for mach in ${!MACHINES[@]}; do | ||
| 60 | if [ -n "$3" -a "$3" != "${MACHINES[${mach}]}" ]; then | ||
| 61 | continue | ||
| 62 | fi | ||
| 63 | |||
| 64 | echo "Machine: ${MACHINES[${mach}]}" | ||
| 65 | echo "Recipe: ${RECIPES[${mach}]}" | ||
| 66 | echo "URL: ${URLS[${mach}]}" | ||
| 67 | echo | ||
| 68 | |||
| 69 | url=${URLS[${mach}]} | ||
| 70 | url=$(echo $url | sed 's,https://petalinux.xilinx.com/sswreleases/.*/sdt,https://artifactory.xilinx.com/artifactory/petalinux-hwproj-dev/sdt,') | ||
| 71 | |||
| 72 | wget $url -O ${conf_path}/output.sdt | ||
| 73 | sha=$(sha256sum ${conf_path}/output.sdt | cut -d ' ' -f 1) | ||
| 74 | rm -f ${conf_path}/output.sdt | ||
| 75 | |||
| 76 | sed -e 's,SRC_URI = .*,SRC_URI = "'${URLS[${mach}]}'",' \ | ||
| 77 | -e 's,SRC_URI\[sha256sum\] = .*,SRC_URI\[sha256sum\] = "'${sha}'",' \ | ||
| 78 | -i $(dirname $0)/../${RECIPES[${mach}]} | ||
| 79 | done | ||
