From dc36cf2a44cb9e2bec1e489d367aa681a7ad0647 Mon Sep 17 00:00:00 2001 From: Robert Nelson Date: Wed, 13 Sep 2023 20:24:15 -0500 Subject: [PATCH] Flash Gateware (needs mtd-utils installed) Signed-off-by: Robert Nelson --- .gitignore | 1 + 01_git_sync.sh | 6 +++++- 06_generate_debian_console_root.sh | 6 +++++- rootfs/etc/microchip/update-gateware.sh | 11 ++++++----- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 8618d91..65d579b 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ deploy/debian* /hart-software-services/ /u-boot/ /linux/ +/gateware-snapshots/ diff --git a/01_git_sync.sh b/01_git_sync.sh index 05a415a..39bfb9a 100755 --- a/01_git_sync.sh +++ b/01_git_sync.sh @@ -51,6 +51,10 @@ fi echo "git clone -b ${LINUX_BRANCH} ${LINUX_REPO} ./linux/ --depth=${GIT_DEPTH}" git clone -b ${LINUX_BRANCH} ${LINUX_REPO} ./linux/ --depth=${GIT_DEPTH} +if [ -d ./gateware-snapshots ] ; then + rm -rf ./gateware-snapshots || true +fi +git clone git@git.beagleboard.org:beaglev-fire/gateware-snapshots.git #BUILDROOT_BRANCH="bvf" #BUILDROOT_REPO="https://git.beagleboard.org/beaglev-fire/buildroot-external-microchip.git" @@ -62,4 +66,4 @@ git clone -b ${LINUX_BRANCH} ${LINUX_REPO} ./linux/ --depth=${GIT_DEPTH} #echo "git clone -b ${BUILDROOT_BRANCH} ${BUILDROOT_REPO} ./buildroot/ --depth=${GIT_DEPTH}" #git clone -b ${BUILDROOT_BRANCH} ${BUILDROOT_REPO} ./buildroot/ --depth=${GIT_DEPTH} -# \ No newline at end of file +# diff --git a/06_generate_debian_console_root.sh b/06_generate_debian_console_root.sh index 1e19e80..8939d8c 100755 --- a/06_generate_debian_console_root.sh +++ b/06_generate_debian_console_root.sh @@ -72,7 +72,8 @@ fi # setuid root ping+ping6 chmod u+s ./ignore/.root/usr/bin/ping ./ignore/.root/usr/bin/ping6 -mkdir -p ./ignore/.root/etc/beagleboard/gateware/ +mkdir -p ./ignore/.root/etc/beagleboard/gateware/board-tests/ +mkdir -p ./ignore/.root/etc/beagleboard/gateware/default/ mkdir -p ./ignore/.root/etc/microchip/ cp -v ./rootfs/etc/beagleboard/gateware/* ./ignore/.root/etc/beagleboard/gateware/ @@ -80,6 +81,9 @@ cp -v ./rootfs/etc/microchip/* ./ignore/.root/etc/microchip/ chmod +x ./ignore/.root/etc/beagleboard/gateware/change-gateware.sh chmod +x ./ignore/.root/etc/microchip/update-gateware.sh +cp -v ./gateware-snapshots/board-tests/*.spi ./ignore/.root/etc/beagleboard/gateware/board-tests/ +cp -v ./gateware-snapshots/default/*.spi ./ignore/.root/etc/beagleboard/gateware/default/ + if [ -f ./deploy/.modules ] ; then version=$(cat ./deploy/.modules || true) if [ -f ./deploy/${version}-modules.tar.gz ] ; then diff --git a/rootfs/etc/microchip/update-gateware.sh b/rootfs/etc/microchip/update-gateware.sh index f65daf6..75ed310 100644 --- a/rootfs/etc/microchip/update-gateware.sh +++ b/rootfs/etc/microchip/update-gateware.sh @@ -14,23 +14,24 @@ echo "========================================================================== read -rsp $'Press any key to continue...\n' -n1 key -mount -t debugfs none /sys/kernel/debug +# Already mounted by default... +#/usr/bin/mount -t debugfs none /sys/kernel/debug # Trash exisitng device tree overlay in case the rest of the process fails: -mtd_debug erase /dev/mtd0 0x0 0x10000 +/usr/sbin/mtd_debug erase /dev/mtd0 0x0 0x10000 # Write device tree overlay dtbo_ls=$(ls -l /lib/firmware/mpfs_dtbo.spi) dtbo_size=$(echo $dtbo_ls | cut -d " " -f 5) -mtd_debug write /dev/mtd0 0x400 $dtbo_size /lib/firmware/mpfs_dtbo.spi > /dev/zero +/usr/sbin/mtd_debug write /dev/mtd0 0x400 $dtbo_size /lib/firmware/mpfs_dtbo.spi > /dev/zero # Fake the presence of a golden image for now. -mtd_debug write /dev/mtd0 0 4 /dev/zero > /dev/zero +/usr/sbin/mtd_debug write /dev/mtd0 0 4 /dev/zero > /dev/zero # Initiate FPGA update. echo 1 > /sys/kernel/debug/fpga/microchip_exec_update # Reboot Linux for the gateware update to take effect. # FPGA reprogramming takes places between Linux shut-down and HSS restarting the board. -reboot +/usr/sbin/reboot