Skip to contentSkip to conversation

Fixup Update Gateware Feature

PATCH Superseded Jamie Gibbons via buildroot 1 participant 10 messages Jan 21, 2025 – Feb 11, 2025

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Fixup Update Gateware Feature

Hi all,

The following patchset fixes the gateware update feature following the addition of the firmware upload API in linux v6.6. Using debugfs for firmware updating has now been removed. The update-gateware script now makes use of the firmware upload API with sysfs and enables applying overlays during boot. The README steps for updating the firmware have also been optimised, making it easier for the user.
Three configs have been added:
1. When applying overlays at boot time all dtbs need to be compiled with the -@ flag.
2. The updated update-gateware script uses stat on the target to get the size of firmware files - add coreutils and it's dependency (busybox_show_others) for this.

Thanks,
Jamie.

v1 -> v2:
- used fw_upload interface to write the overlay file, i.e. remove use of stat and dd
- removed coreutils package

Jamie Gibbons (3):
board/beagleboard/beaglev_fire: fix update gateware feature configs/beaglev_fire: add support for overlays and update script board/beagleboard/beaglev_fire: cleanup gatewate update

 board/beagleboard/beaglev_fire/README.txt     | 13 +---
 board/beagleboard/beaglev_fire/boot.cmd       |  1 +
 .../usr/share/microchip/update-gateware.sh    | 71 ++++++++++++++-----
 configs/beaglev_fire_defconfig                |  1 +
 4 files changed, 58 insertions(+), 28 deletions(-)
 mode change 100644 => 100755 board/beagleboard/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH v2 1/3 board/beagleboard/beaglev_fire: fix update gateware feature

Following the addition of the firmware upload API in linux v6.6, using debugfs for firmware updating has been removed. Update the update-gateware script to use the firmware upload API with sysfs and enable applying the overlays during boot.
The fw_upload interface can detect when there is an overlay file and will write it correctly. Use this functionality to write the overlay file and remove dd command related code.

---
 board/beagleboard/beaglev_fire/boot.cmd       |  1 +
 .../usr/share/microchip/update-gateware.sh    | 51 ++++++++++++++-----
 2 files changed, 40 insertions(+), 12 deletions(-)
 mode change 100644 => 100755 board/beagleboard/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh
board/beagleboard/beaglev_fire/boot.cmd +1 -0
index 05f4858bac..1402458d8b 100644
@@ -12,4 +12,5 @@ bootm loados ${scriptaddr};
 bootm ramdisk;
 bootm prep;
 fdt set /soc/ethernet@20110000 mac-address ${beaglevfire_mac_addr0};
+run design_overlays;
 bootm go;
board/beagleboard/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh +39 -12

59 lines not on this page · raw message

Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Re: [Buildroot] [PATCH v2 1/3] board/beagleboard/beaglev_fire: fix update gateware feature

Quoted 11 lines · Jamie Gibbons

Following the addition of the firmware upload API in linux v6.6, using
debugfs for firmware updating has been removed. Update the update-gateware script to use the firmware upload API with sysfs and enable applying the overlays during boot.
The fw_upload interface can detect when there is an overlay file and will write it correctly. Use this functionality to write the overlay file and remove dd command related code.

Quoted 8 lines

---
 board/beagleboard/beaglev_fire/boot.cmd       |  1 + .../usr/share/microchip/update-gateware.sh    | 51 ++++++++++++++--- --

 2 files changed, 40 insertions(+), 12 deletions(-)

 mode change 100644 => 100755 board/beagleboard/beaglev_fire/rootfs- overlay/usr/share/microchip/update-gateware.sh

Hi all,

Gentle reminder as I am still awaiting any response on this series. It is almost 4 months old. With updates made to source, what is currently in the Buildroot repository doesn't work so this is a required fix. Any feedback? Any changes needed? Anything holding this back from being applied?

Looking forward to a response.

Thanks again,
Jamie

Quoted 84 lines
board/beagleboard/beaglev_fire/boot.cmd +1 -0
index 05f4858bac..1402458d8b 100644
@@ -12,4 +12,5 @@ bootm loados ${scriptaddr};
  bootm ramdisk;
  bootm prep;
  fdt set /soc/ethernet@20110000 mac-address ${beaglevfire_mac_addr0};
+run design_overlays;
  bootm go;
(quoted diff) +0 -0

overlay/usr/share/microchip/update-gateware.sh
b/board/beagleboard/beaglev_fire/rootfs-
overlay/usr/share/microchip/update-gateware.sh
old mode 100644
new mode 100755
index f455037b60..249c5bd260
--- a/board/beagleboard/beaglev_fire/rootfs-
overlay/usr/share/microchip/update-gateware.sh
+++ b/board/beagleboard/beaglev_fire/rootfs-
overlay/usr/share/microchip/update-gateware.sh

(quoted diff) +0 -0
@@ -13,20 +13,47 @@ fi

 cp "$1"/mpfs_dtbo.spi /lib/firmware/mpfs_dtbo.spi cp "$1"/mpfs_bitstream.spi /lib/firmware/mpfs_bitstream.spi

board/beagleboard/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh +0 -2
-mount -t debugfs none /sys/kernel/debug
-

 # Trash existing device tree overlay in case the rest of the process fails:

board/beagleboard/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh +1 -1
-flash_erase /dev/mtd0 0 1024
+flash_erase /dev/mtd0 0 16

board/beagleboard/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh +2 -2
-# # Write device tree overlay
-dd if=/lib/firmware/mpfs_dtbo.spi of=/dev/mtd0 seek=1024
+# Initiate FPGA update for dtbo
+echo 1 > /sys/class/firmware/mpfs-auto-update/loading

board/beagleboard/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh +2 -2
-# Fake the presence of a golden image for now.
-dd if=/dev/zero of=/dev/mtd0 count=4 bs=1
+# Write device tree overlay
+cat /lib/firmware/mpfs_dtbo.spi > /sys/class/firmware/mpfs-auto-

update/data

board/beagleboard/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh +3 -0
+
+# Signal completion for dtbo load
+echo 0 > /sys/class/firmware/mpfs-auto-update/loading

board/beagleboard/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh +1 -2
-# Initiate FPGA update.
-echo 1 > /sys/kernel/debug/fpga/microchip_exec_update
+while [ "$(cat /sys/class/firmware/mpfs-auto-update/status)" !=

"idle" ]; do
+    # Do nothing, just keep checking
+    sleep 1
+done

(quoted diff) +0 -2
-# Reboot Linux for the gateware update to take effect.
-# FPGA reprogramming takes places between Linux shut-down and HSS

restarting the board.

board/beagleboard/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh +8 -1
-reboot
+# Fake the presence of a golden image for now.
+dd if=/dev/zero of=/dev/mtd0 count=1 bs=4
+
+# Initiate FPGA update for bitstream
+echo 1 > /sys/class/firmware/mpfs-auto-update/loading
+
+# Write the firmware image to the data sysfs file
+cat /lib/firmware/mpfs_bitstream.spi > /sys/class/firmware/mpfs-

auto-update/data

board/beagleboard/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh +5 -0
+
+# Signal completion for bitstream load
+echo 0 > /sys/class/firmware/mpfs-auto-update/loading
+
+while [ "$(cat /sys/class/firmware/mpfs-auto-update/status)" !=

"idle" ]; do
+    # Do nothing, just keep checking
+    sleep 1

board/beagleboard/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh +3 -0
+done
+
+# When the status is 'idle' and no error has occured, reboot the

system for
+# the gateware update to take effect. FPGA reprogramming takes places between

(quoted diff) +2 -0
+# Linux shut-down and HSS restarting the board.
+if [ "$(cat /sys/class/firmware/mpfs-auto-update/error)" = "" ];
Quoted 8 lines

then
+    echo "FPGA update ready. Rebooting."
+    reboot
+else
+    echo "FPGA update failed with status: $(cat
/sys/class/firmware/mpfs-auto-update/error)"
+    exit 1
+fi

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw

Re: [Buildroot] [PATCH v2 1/3] board/beagleboard/beaglev_fire: fix update gateware feature

In reply to Jamie Gibbons via buildroot

Hello Jamie, All,

Sorry for the delay to review your series.

Le 21/01/2025 à 10:05, Jamie Gibbons via buildroot a écrit :

Quoted 7 lines

Following the addition of the firmware upload API in linux v6.6, using debugfs for firmware updating has been removed. Update the update-gateware script to use the firmware upload API with sysfs and enable applying the overlays during boot.
The fw_upload interface can detect when there is an overlay file and will write it correctly. Use this functionality to write the overlay file and remove dd command related code.

Does it means that the update-gateware.sh script doesn't work since the update to 6.6 kernel?

If so, please add a Fixes tag:

Fixes 8ce97fd550d6 ("configs/beaglev_fire: bump Linux and U-Boot")
Quoted 14 lines
---
 board/beagleboard/beaglev_fire/boot.cmd       |  1 +
 .../usr/share/microchip/update-gateware.sh    | 51 ++++++++++++++-----
 2 files changed, 40 insertions(+), 12 deletions(-)
 mode change 100644 => 100755 board/beagleboard/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh
board/beagleboard/beaglev_fire/boot.cmd +0 -0
index 05f4858bac..1402458d8b 100644

board/beagleboard/beaglev_fire/boot.cmd bootm loados ${scriptaddr}; · line 15

Quoted 4 lines
board/beagleboard/beaglev_fire/boot.cmd +1 -0
@@ -12,4 +12,5 @@ bootm loados ${scriptaddr};
 bootm ramdisk;
 bootm prep;
 fdt set /soc/ethernet@20110000 mac-address ${beaglevfire_mac_addr0};
+run design_overlays;

design_overlays seems related to devicetree overlay support but BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT is only enabled in the following patch (2/3).

Quoted 22 lines
board/beagleboard/beaglev_fire/boot.cmd +0 -0
 bootm go;
board/beagleboard/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh +3 -5
old mode 100644
new mode 100755
index f455037b60..249c5bd260
@@ -13,20 +13,47 @@ fi
 cp "$1"/mpfs_dtbo.spi /lib/firmware/mpfs_dtbo.spi
 cp "$1"/mpfs_bitstream.spi /lib/firmware/mpfs_bitstream.spi
 
-mount -t debugfs none /sys/kernel/debug
-
 # Trash existing device tree overlay in case the rest of the process fails:
-flash_erase /dev/mtd0 0 1024
+flash_erase /dev/mtd0 0 16
 
-# # Write device tree overlay
-dd if=/lib/firmware/mpfs_dtbo.spi of=/dev/mtd0 seek=1024
+# Initiate FPGA update for dtbo
+echo 1 > /sys/class/firmware/mpfs-auto-update/loading
 

board/beagleboard/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh fi · line 28

Quoted 10 lines
board/beagleboard/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh +5 -4
-# Fake the presence of a golden image for now.
-dd if=/dev/zero of=/dev/mtd0 count=4 bs=1
+# Write device tree overlay
+cat /lib/firmware/mpfs_dtbo.spi > /sys/class/firmware/mpfs-auto-update/data
+
+# Signal completion for dtbo load
+echo 0 > /sys/class/firmware/mpfs-auto-update/loading
 
-# Initiate FPGA update.
-echo 1 > /sys/kernel/debug/fpga/microchip_exec_update

This line should not work on 6.6 kernel since debugfs for firmware updating removal. Adding a link to the kernel commit doing this change would be great.

Best regards,
Romain

Quoted 25 lines
board/beagleboard/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh +21 -3
+while [ "$(cat /sys/class/firmware/mpfs-auto-update/status)" != "idle" ]; do
+    # Do nothing, just keep checking
+    sleep 1
+done
 
-# Reboot Linux for the gateware update to take effect.
-# FPGA reprogramming takes places between Linux shut-down and HSS restarting the board.
-reboot
+# Fake the presence of a golden image for now.
+dd if=/dev/zero of=/dev/mtd0 count=1 bs=4
+
+# Initiate FPGA update for bitstream
+echo 1 > /sys/class/firmware/mpfs-auto-update/loading
+
+# Write the firmware image to the data sysfs file
+cat /lib/firmware/mpfs_bitstream.spi > /sys/class/firmware/mpfs-auto-update/data
+
+# Signal completion for bitstream load
+echo 0 > /sys/class/firmware/mpfs-auto-update/loading
+
+while [ "$(cat /sys/class/firmware/mpfs-auto-update/status)" != "idle" ]; do
+    # Do nothing, just keep checking
+    sleep 1
+done
+

board/beagleboard/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh fi · line 59

Quoted 10 lines
board/beagleboard/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh +10 -0
+# When the status is 'idle' and no error has occured, reboot the system for
+# the gateware update to take effect. FPGA reprogramming takes places between
+# Linux shut-down and HSS restarting the board.
+if [ "$(cat /sys/class/firmware/mpfs-auto-update/error)" = "" ]; then
+    echo "FPGA update ready. Rebooting."
+    reboot
+else
+    echo "FPGA update failed with status: $(cat /sys/class/firmware/mpfs-auto-update/error)"
+    exit 1
+fi

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw

Re: [Buildroot] [PATCH v2 1/3] board/beagleboard/beaglev_fire: fix update gateware feature

Hi Romain,

Quoted 6 lines · Romain Naour

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Hello Jamie, All,

Sorry for the delay to review your series.

Thank you for the feedback! All acknowledged and will get back shortly with a v3.

Thanks,
Jamie.

Quoted 134 lines · Jamie Gibbons via buildroot
Quoted 11 lines

Following the addition of the firmware upload API in linux v6.6, using
debugfs for firmware updating has been removed. Update the update-gateware script to use the firmware upload API with sysfs and
enable applying the overlays during boot.
The fw_upload interface can detect when there is an overlay file and
will write it correctly. Use this functionality to write the overlay
file and remove dd command related code.

Does it means that the update-gateware.sh script doesn't work since the update
to 6.6 kernel?

If so, please add a Fixes tag:

Fixes 8ce97fd550d6 ("configs/beaglev_fire: bump Linux and U-Boot")
Quoted 20 lines

---
 board/beagleboard/beaglev_fire/boot.cmd       |  1 + .../usr/share/microchip/update-gateware.sh    | 51 ++++++++++++++-
----

 2 files changed, 40 insertions(+), 12 deletions(-)

 mode change 100644 => 100755 board/beagleboard/beaglev_fire/rootfs- overlay/usr/share/microchip/update-gateware.sh

board/beagleboard/beaglev_fire/boot.cmd +0 -0
index 05f4858bac..1402458d8b 100644
@@ -12,4 +12,5 @@ bootm loados ${scriptaddr};
  bootm ramdisk;
  bootm prep;
Quoted 3 lines

 fdt set /soc/ethernet@20110000 mac-address
${beaglevfire_mac_addr0};
+run design_overlays;

design_overlays seems related to devicetree overlay support but BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT is only enabled in the following patch (2/3).

Quoted 33 lines

 bootm go;

(quoted diff) +0 -0

overlay/usr/share/microchip/update-gateware.sh b/board/beagleboard/beaglev_fire/rootfs- overlay/usr/share/microchip/update-gateware.sh old mode 100644
new mode 100755
index f455037b60..249c5bd260
--- a/board/beagleboard/beaglev_fire/rootfs- overlay/usr/share/microchip/update-gateware.sh +++ b/board/beagleboard/beaglev_fire/rootfs- overlay/usr/share/microchip/update-gateware.sh

board/beagleboard/beaglev_fire/boot.cmd +0 -0
@@ -13,20 +13,47 @@ fi

 cp "$1"/mpfs_dtbo.spi /lib/firmware/mpfs_dtbo.spi cp "$1"/mpfs_bitstream.spi /lib/firmware/mpfs_bitstream.spi

board/beagleboard/beaglev_fire/boot.cmd +0 -2
-mount -t debugfs none /sys/kernel/debug
-

 # Trash existing device tree overlay in case the rest of the process fails:

board/beagleboard/beaglev_fire/boot.cmd +5 -5
-flash_erase /dev/mtd0 0 1024
+flash_erase /dev/mtd0 0 16
 
-# # Write device tree overlay
-dd if=/lib/firmware/mpfs_dtbo.spi of=/dev/mtd0 seek=1024
+# Initiate FPGA update for dtbo
+echo 1 > /sys/class/firmware/mpfs-auto-update/loading
 
-# Fake the presence of a golden image for now.
-dd if=/dev/zero of=/dev/mtd0 count=4 bs=1
+# Write device tree overlay
+cat /lib/firmware/mpfs_dtbo.spi > /sys/class/firmware/mpfs-auto-

update/data

board/beagleboard/beaglev_fire/boot.cmd

Quoted 6 lines
board/beagleboard/beaglev_fire/boot.cmd +3 -2
+
+# Signal completion for dtbo load
+echo 0 > /sys/class/firmware/mpfs-auto-update/loading
 
-# Initiate FPGA update.
-echo 1 > /sys/kernel/debug/fpga/microchip_exec_update

This line should not work on 6.6 kernel since debugfs for firmware updating
removal. Adding a link to the kernel commit doing this change would be great.

Best regards,
Romain

Quoted 35 lines

+while [ "$(cat /sys/class/firmware/mpfs-auto-update/status)" != "idle" ]; do
+    # Do nothing, just keep checking
+    sleep 1

board/beagleboard/beaglev_fire/boot.cmd +1 -2
+done
 
-# Reboot Linux for the gateware update to take effect.
-# FPGA reprogramming takes places between Linux shut-down and HSS

restarting the board.

board/beagleboard/beaglev_fire/boot.cmd +8 -1
-reboot
+# Fake the presence of a golden image for now.
+dd if=/dev/zero of=/dev/mtd0 count=1 bs=4
+
+# Initiate FPGA update for bitstream
+echo 1 > /sys/class/firmware/mpfs-auto-update/loading
+
+# Write the firmware image to the data sysfs file
+cat /lib/firmware/mpfs_bitstream.spi > /sys/class/firmware/mpfs-

auto-update/data

board/beagleboard/beaglev_fire/boot.cmd +5 -0
+
+# Signal completion for bitstream load
+echo 0 > /sys/class/firmware/mpfs-auto-update/loading
+
+while [ "$(cat /sys/class/firmware/mpfs-auto-update/status)" !=

"idle" ]; do
+    # Do nothing, just keep checking
+    sleep 1

board/beagleboard/beaglev_fire/boot.cmd +3 -0
+done
+
+# When the status is 'idle' and no error has occured, reboot the

system for
+# the gateware update to take effect. FPGA reprogramming takes places between

board/beagleboard/beaglev_fire/boot.cmd +2 -0
+# Linux shut-down and HSS restarting the board.
+if [ "$(cat /sys/class/firmware/mpfs-auto-update/error)" = "" ];
Quoted 9 lines
Quoted 8 lines

then
+    echo "FPGA update ready. Rebooting."
+    reboot
+else
+    echo "FPGA update failed with status: $(cat /sys/class/firmware/mpfs-auto-update/error)"
+    exit 1
+fi

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#5 lore raw

PATCH v2 2/3 configs/beaglev_fire: add support for overlays and update script

In reply to Jamie Gibbons via buildroot

When applying overlays at boot time all dtbs need to be compiled with the -@ flag. Set the appropriate config to do this.
The updated update-gateware script uses stat on the target to get the size of firmware files, enable coreutils and it's dependency to make use of this package on the target when this script is used.
The updated update-gateware script no longer uses stat and therefore, coreutils is no longer necessary.

---
 configs/beaglev_fire_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/beaglev_fire_defconfig +1 -0
index 1d26a78f07..bfaa8208e9 100644
@@ -12,6 +12,7 @@ BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,linux4microchip,linux,li
 BR2_LINUX_KERNEL_DEFCONFIG="mpfs"
 BR2_LINUX_KERNEL_DTS_SUPPORT=y
 BR2_LINUX_KERNEL_INTREE_DTS_NAME="microchip/mpfs-beaglev-fire"
+BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT=y
 BR2_PACKAGE_MTD=y
 BR2_TARGET_ROOTFS_EXT2=y
 BR2_TARGET_ROOTFS_EXT2_4=y
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#6 lore raw

Re: [Buildroot] [PATCH v2 2/3] configs/beaglev_fire: add support for overlays and update script

Hello Jamie, All,

Le 21/01/2025 à 10:05, Jamie Gibbons via buildroot a écrit :

Quoted 2 lines

When applying overlays at boot time all dtbs need to be compiled with the -@ flag. Set the appropriate config to do this.

I think this patch should be first in this series.

Quoted 5 lines

The updated update-gateware script uses stat on the target to get the size of firmware files, enable coreutils and it's dependency to make use of this package on the target when this script is used.
The updated update-gateware script no longer uses stat and therefore, coreutils is no longer necessary.

Keeping this part in the commit log is actually confusing.
It actually explain the update of this patch between v1 and v2, so it should go under --- below as patch change log.

Best regards,
Romain

Quoted 12 lines
---
 configs/beaglev_fire_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/beaglev_fire_defconfig +0 -0
index 1d26a78f07..bfaa8208e9 100644

configs/beaglev_fire_defconfig BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,linux4microchip,linux,li · line 18

Quoted 7 lines
configs/beaglev_fire_defconfig +1 -0
@@ -12,6 +12,7 @@ BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,linux4microchip,linux,li
 BR2_LINUX_KERNEL_DEFCONFIG="mpfs"
 BR2_LINUX_KERNEL_DTS_SUPPORT=y
 BR2_LINUX_KERNEL_INTREE_DTS_NAME="microchip/mpfs-beaglev-fire"
+BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT=y
 BR2_PACKAGE_MTD=y
 BR2_TARGET_ROOTFS_EXT2=y
 BR2_TARGET_ROOTFS_EXT2_4=y

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#7 lore raw

PATCH v2 3/3 board/beagleboard/beaglev_fire: cleanup gatewate update

In reply to Jamie Gibbons via buildroot

Update the README following the update gateware fix and optimise the script, making it easier for the user to use.

---
 board/beagleboard/beaglev_fire/README.txt     | 13 +++-------
 .../usr/share/microchip/update-gateware.sh    | 24 ++++++++++++-------
 2 files changed, 19 insertions(+), 18 deletions(-)
board/beagleboard/beaglev_fire/README.txt +3 -10
index c9a824b67f..6484cca8e1 100644
@@ -113,7 +113,7 @@ https://docs.beagleboard.org/latest/boards/beaglev/fire/demos-and-tutorials/gate
   On your Linux host development computer, copy the bitstream to BeagleV-Fire
   board, replacing </path/to/your/> with the path to your BeagleV-Fire root file
   system.
-    'cp -r ./LinuxProgramming /path/to/your/buildroot/board/beagleboard/beaglev_fire/rootfs-overlay/etc/'
+    'cp -r ./LinuxProgramming /path/to/your/buildroot/board/beagleboard/beaglev_fire/rootfs-overlay/lib/firmware/'
 
   To apply these changes to your image, make sure to re-build it with:
     `make`
@@ -121,14 +121,7 @@ https://docs.beagleboard.org/latest/boards/beaglev/fire/demos-and-tutorials/gate
   Then, re-flash your image - to ensure you have the necessary firmware files - by
   following the above section "Flashing the image to your eMMC".
 
-  On BeagleV-Fire,
-    1. Make your update gateware script executable
-      'chmod +x /usr/share/microchip/update-gateware.sh'
-    2. Create a firmware directory
-      'mkdir /lib/firmware'
-    3. Change to the directory of your gateware script
-      `cd /usr/share/microchip/`
-    3. initiate the reprogramming of the FPGA with your gateware bitstream:
-      './update-gateware.sh /etc/LinuxProgramming/'
+  On BeagleV-Fire initiate the reprogramming of the FPGA with your gateware bitstream:
+    `/usr/share/microchip/update-gateware.sh`
 
   Wait for a couple of minutes for the BeagleV-Fire to reprogram itself.
board/beagleboard/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh +16 -8
index 249c5bd260..7e05d4b7eb 100755
@@ -1,17 +1,25 @@
 #!/bin/sh
 
-if [ ! -e "$1"/mpfs_bitstream.spi ]; then
+if [ $# -eq 0 ]; then
+    echo "No gateware location provided. Checking default location."
+    if [ ! -e /lib/firmware/mpfs_bitstream.spi ]; then
         echo "No gateware file found."
         exit 1
+    fi
+else
+    echo "Gateware location provided: $1"
+    if [ ! -e "$1"/mpfs_bitstream.spi ]; then
+        echo "No gateware file found."
+        exit 1
+    else
+        if [ ! -d /lib/firmware ]; then
+            mkdir /lib/firmware
+        fi
+        cp "$1"/mpfs_dtbo.spi /lib/firmware/mpfs_dtbo.spi
+        cp "$1"/mpfs_bitstream.spi /lib/firmware/mpfs_bitstream.spi
+    fi
 fi
 
-if [ ! -d /lib/firmware ]
-then
-    mkdir /lib/firmware
-fi
-
-cp "$1"/mpfs_dtbo.spi /lib/firmware/mpfs_dtbo.spi
-cp "$1"/mpfs_bitstream.spi /lib/firmware/mpfs_bitstream.spi
 
 # Trash existing device tree overlay in case the rest of the process fails:
 flash_erase /dev/mtd0 0 16
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#8 lore raw

Re: [Buildroot] [PATCH v2 3/3] board/beagleboard/beaglev_fire: cleanup gatewate update

Hello Jamie,

Le 21/01/2025 à 10:05, Jamie Gibbons via buildroot a écrit :

Quoted 15 lines

Update the README following the update gateware fix and optimise the script, making it easier for the user to use.

---
 board/beagleboard/beaglev_fire/README.txt     | 13 +++-------
 .../usr/share/microchip/update-gateware.sh    | 24 ++++++++++++-------
 2 files changed, 19 insertions(+), 18 deletions(-)
board/beagleboard/beaglev_fire/README.txt +0 -0
index c9a824b67f..6484cca8e1 100644

board/beagleboard/beaglev_fire/README.txt https://docs.beagleboard.org/latest/boards/beaglev/fire/demos-and-tutorials/gate · line 116

Quoted 5 lines
board/beagleboard/beaglev_fire/README.txt +1 -1
@@ -113,7 +113,7 @@ https://docs.beagleboard.org/latest/boards/beaglev/fire/demos-and-tutorials/gate
   On your Linux host development computer, copy the bitstream to BeagleV-Fire
   board, replacing </path/to/your/> with the path to your BeagleV-Fire root file
   system.
-    'cp -r ./LinuxProgramming /path/to/your/buildroot/board/beagleboard/beaglev_fire/rootfs-overlay/etc/'
+    'cp -r ./LinuxProgramming /path/to/your/buildroot/board/beagleboard/beaglev_fire/rootfs-overlay/lib/firmware/'

Here, the LinuxProgramming directory is copied to rootfs-overlay/lib/firmware/

Quoted 8 lines
board/beagleboard/beaglev_fire/README.txt +0 -1
   To apply these changes to your image, make sure to re-build it with:
     `make`
@@ -121,14 +121,7 @@ https://docs.beagleboard.org/latest/boards/beaglev/fire/demos-and-tutorials/gate
   Then, re-flash your image - to ensure you have the necessary firmware files - by
   following the above section "Flashing the image to your eMMC".
 
-  On BeagleV-Fire,

board/beagleboard/beaglev_fire/README.txt https://docs.beagleboard.org/latest/boards/beaglev/fire/demos-and-tutorials/gate · line 125

Quoted 10 lines
board/beagleboard/beaglev_fire/README.txt +2 -8
-    1. Make your update gateware script executable
-      'chmod +x /usr/share/microchip/update-gateware.sh'
-    2. Create a firmware directory
-      'mkdir /lib/firmware'
-    3. Change to the directory of your gateware script
-      `cd /usr/share/microchip/`
-    3. initiate the reprogramming of the FPGA with your gateware bitstream:
-      './update-gateware.sh /etc/LinuxProgramming/'
+  On BeagleV-Fire initiate the reprogramming of the FPGA with your gateware bitstream:
+    `/usr/share/microchip/update-gateware.sh`

It seems you have still to provide the Gateware location path:

/usr/share/microchip/update-gateware.sh /lib/firmware/LinuxProgramming

board/beagleboard/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh line 4

Quoted 12 lines
board/beagleboard/beaglev_fire/README.txt +0 -0
   Wait for a couple of minutes for the BeagleV-Fire to reprogram itself.
board/beagleboard/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh +2 -1
index 249c5bd260..7e05d4b7eb 100755
@@ -1,17 +1,25 @@
 #!/bin/sh
 
-if [ ! -e "$1"/mpfs_bitstream.spi ]; then
+if [ $# -eq 0 ]; then
+    echo "No gateware location provided. Checking default location."

Otherwise the new gateware file is located to
/lib/firmware/LinuxProgramming/mpfs_bitstream.spi

And this script only check if there is an existing gareware file:

board/beagleboard/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh line 8

Quoted 4 lines
board/beagleboard/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh +2 -0
+    if [ ! -e /lib/firmware/mpfs_bitstream.spi ]; then
         echo "No gateware file found."
         exit 1
+    fi

Can you double check this part?

Best regards,
Romain

Quoted 14 lines
board/beagleboard/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh +12 -0
+else
+    echo "Gateware location provided: $1"
+    if [ ! -e "$1"/mpfs_bitstream.spi ]; then
+        echo "No gateware file found."
+        exit 1
+    else
+        if [ ! -d /lib/firmware ]; then
+            mkdir /lib/firmware
+        fi
+        cp "$1"/mpfs_dtbo.spi /lib/firmware/mpfs_dtbo.spi
+        cp "$1"/mpfs_bitstream.spi /lib/firmware/mpfs_bitstream.spi
+    fi
 fi
 

board/beagleboard/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh line 25

Quoted 10 lines
board/beagleboard/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh +0 -7
-if [ ! -d /lib/firmware ]
-then
-    mkdir /lib/firmware
-fi
-
-cp "$1"/mpfs_dtbo.spi /lib/firmware/mpfs_dtbo.spi
-cp "$1"/mpfs_bitstream.spi /lib/firmware/mpfs_bitstream.spi
 
 # Trash existing device tree overlay in case the rest of the process fails:
 flash_erase /dev/mtd0 0 16

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#9 lore raw

Re: [Buildroot] [PATCH v2 3/3] board/beagleboard/beaglev_fire: cleanup gatewate update

Hi Romain,

Quoted 92 lines · Romain Naour

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Hello Jamie,

Quoted 22 lines · Jamie Gibbons via buildroot

Update the README following the update gateware fix and optimise the
script, making it easier for the user to use.

---
 board/beagleboard/beaglev_fire/README.txt     | 13 +++------- .../usr/share/microchip/update-gateware.sh    | 24 ++++++++++++---
----

 2 files changed, 19 insertions(+), 18 deletions(-)
board/beagleboard/beaglev_fire/README.txt +0 -0
index c9a824b67f..6484cca8e1 100644
@@ -113,7 +113,7 @@

https://docs.beagleboard.org/latest/boards/beaglev/fire/demos-and-tutorials/gate
   On your Linux host development computer, copy the bitstream to BeagleV-Fire
   board, replacing </path/to/your/> with the path to your BeagleV-

Quoted 8 lines

Fire root file
   system.
-    'cp -r ./LinuxProgramming /path/to/your/buildroot/board/beagleboard/beaglev_fire/rootfs- overlay/etc/'
+    'cp -r ./LinuxProgramming /path/to/your/buildroot/board/beagleboard/beaglev_fire/rootfs- overlay/lib/firmware/'

Here, the LinuxProgramming directory is copied to rootfs- overlay/lib/firmware/

Quoted 10 lines

   To apply these changes to your image, make sure to re-build it with:
     make

board/beagleboard/beaglev_fire/README.txt +0 -0
@@ -121,14 +121,7 @@

https://docs.beagleboard.org/latest/boards/beaglev/fire/demos-and-tutorials/gate
   Then, re-flash your image - to ensure you have the necessary firmware files - by
   following the above section "Flashing the image to your eMMC".

Quoted 13 lines

-  On BeagleV-Fire,
-    1. Make your update gateware script executable
-      'chmod +x /usr/share/microchip/update-gateware.sh' -    2. Create a firmware directory
-      'mkdir /lib/firmware'
-    3. Change to the directory of your gateware script -      cd /usr/share/microchip/
-    3. initiate the reprogramming of the FPGA with your gateware bitstream:
-      './update-gateware.sh /etc/LinuxProgramming/'
+  On BeagleV-Fire initiate the reprogramming of the FPGA with your gateware bitstream:
+    /usr/share/microchip/update-gateware.sh

It seems you have still to provide the Gateware location path:

  /usr/share/microchip/update-gateware.sh
/lib/firmware/LinuxProgramming

Quoted 18 lines

   Wait for a couple of minutes for the BeagleV-Fire to reprogram itself.

(quoted diff) +0 -0

overlay/usr/share/microchip/update-gateware.sh
b/board/beagleboard/beaglev_fire/rootfs-
overlay/usr/share/microchip/update-gateware.sh
index 249c5bd260..7e05d4b7eb 100755
--- a/board/beagleboard/beaglev_fire/rootfs-
overlay/usr/share/microchip/update-gateware.sh
+++ b/board/beagleboard/beaglev_fire/rootfs-
overlay/usr/share/microchip/update-gateware.sh

board/beagleboard/beaglev_fire/README.txt +2 -1
@@ -1,17 +1,25 @@
  #!/bin/sh
 
-if [ ! -e "$1"/mpfs_bitstream.spi ]; then
+if [ $# -eq 0 ]; then
+    echo "No gateware location provided. Checking default
Quoted 1 line

location."

Otherwise the new gateware file is located to /lib/firmware/LinuxProgramming/mpfs_bitstream.spi

Quoted 8 lines

And this script only check if there is an existing gareware file:

Quoted 4 lines

+    if [ ! -e /lib/firmware/mpfs_bitstream.spi ]; then echo "No gateware file found."
         exit 1
+    fi

Can you double check this part?

Ah yes, it seems the README instructions need a further update to fix the paths. Thanks for noticing, I will update in v3!

Thanks,
Jamie.

Quoted 28 lines

Best regards,
Romain

Quoted 23 lines

+else
+    echo "Gateware location provided: $1"
+    if [ ! -e "$1"/mpfs_bitstream.spi ]; then
+        echo "No gateware file found."
+        exit 1
+    else
+        if [ ! -d /lib/firmware ]; then
+            mkdir /lib/firmware
+        fi
+        cp "$1"/mpfs_dtbo.spi /lib/firmware/mpfs_dtbo.spi +        cp "$1"/mpfs_bitstream.spi /lib/firmware/mpfs_bitstream.spi
+    fi
 fi

board/beagleboard/beaglev_fire/README.txt +0 -7
-if [ ! -d /lib/firmware ]
-then
-    mkdir /lib/firmware
-fi
-
-cp "$1"/mpfs_dtbo.spi /lib/firmware/mpfs_dtbo.spi
-cp "$1"/mpfs_bitstream.spi /lib/firmware/mpfs_bitstream.spi
Quoted 4 lines
Quoted 3 lines

 # Trash existing device tree overlay in case the rest of the process fails:
 flash_erase /dev/mtd0 0 16

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot