Message ID | 20241022102426.220196-2-jamie.gibbons@microchip.com |
---|---|
State | Superseded |
Headers | show |
Series | Fixup Update Gateware Feature | expand |
On Tue, 2024-10-22 at 11:24 +0100, Jamie Gibbons wrote: > 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. > Hi all, Anything holding this series back from being applied? Also a reviewed-by tag was sent by my colleague however, it may not have been picked up as he is not on the mailing list. Reviewed-by: Conor Dooley <conor.dooley@microchip.com> Thanks, Jamie > Signed-off-by: Jamie Gibbons <jamie.gibbons@microchip.com> > --- > board/beagleboard/beaglev_fire/boot.cmd | 1 + > .../usr/share/microchip/update-gateware.sh | 41 ++++++++++++++--- > -- > 2 files changed, 31 insertions(+), 11 deletions(-) > mode change 100644 => 100755 board/beagleboard/beaglev_fire/rootfs- > overlay/usr/share/microchip/update-gateware.sh > > diff --git a/board/beagleboard/beaglev_fire/boot.cmd > b/board/beagleboard/beaglev_fire/boot.cmd > index 05f4858bac..1402458d8b 100644 > --- a/board/beagleboard/beaglev_fire/boot.cmd > +++ b/board/beagleboard/beaglev_fire/boot.cmd > @@ -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; > diff --git 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 > old mode 100644 > new mode 100755 > index f455037b60..ce55394343 > --- 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 > @@ -13,20 +13,39 @@ 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 > + > +# Get device tree overlay size > +dtbo_size=$(stat -c %s /lib/firmware/mpfs_dtbo.spi) > > -# # Write device tree overlay > -dd if=/lib/firmware/mpfs_dtbo.spi of=/dev/mtd0 seek=1024 > +# Write device tree overlay > +dd if=/lib/firmware/mpfs_dtbo.spi of=/dev/mtd0 bs=1 seek=$((0x400)) > count="$dtbo_size" status=progress > > # Fake the presence of a golden image for now. > -dd if=/dev/zero of=/dev/mtd0 count=4 bs=1 > +dd if=/dev/zero of=/dev/mtd0 count=1 bs=4 > > # 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 > +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 > +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 > + > +# 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
Hi all, On Wed, 2024-12-11 at 09:45 +0000, Jamie.Gibbons--- via buildroot wrote: > EXTERNAL EMAIL: Do not click links or open attachments unless you > know the content is safe > > On Tue, 2024-10-22 at 11:24 +0100, Jamie Gibbons wrote: > > 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. > > > Hi all, > > Anything holding this series back from being applied? > > Also a reviewed-by tag was sent by my colleague however, it may not > have been picked up as he is not on the mailing list. > > Reviewed-by: Conor Dooley <conor.dooley@microchip.com> > This patch series was sent 2.5 months ago and I have not received any feedback, replies nor has it been merged. This series is important as what is currently in master does not work anymore. Please let me know if there is anything holding this back from being merged. Thanks, Jamie. > Thanks, > Jamie > > Signed-off-by: Jamie Gibbons <jamie.gibbons@microchip.com> > > --- > > board/beagleboard/beaglev_fire/boot.cmd | 1 + > > .../usr/share/microchip/update-gateware.sh | 41 ++++++++++++++- > > -- > > -- > > 2 files changed, 31 insertions(+), 11 deletions(-) > > mode change 100644 => 100755 > > board/beagleboard/beaglev_fire/rootfs- > > overlay/usr/share/microchip/update-gateware.sh > > > > diff --git a/board/beagleboard/beaglev_fire/boot.cmd > > b/board/beagleboard/beaglev_fire/boot.cmd > > index 05f4858bac..1402458d8b 100644 > > --- a/board/beagleboard/beaglev_fire/boot.cmd > > +++ b/board/beagleboard/beaglev_fire/boot.cmd > > @@ -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; > > diff --git 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 > > old mode 100644 > > new mode 100755 > > index f455037b60..ce55394343 > > --- 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 > > @@ -13,20 +13,39 @@ 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 > > + > > +# Get device tree overlay size > > +dtbo_size=$(stat -c %s /lib/firmware/mpfs_dtbo.spi) > > > > -# # Write device tree overlay > > -dd if=/lib/firmware/mpfs_dtbo.spi of=/dev/mtd0 seek=1024 > > +# Write device tree overlay > > +dd if=/lib/firmware/mpfs_dtbo.spi of=/dev/mtd0 bs=1 > > seek=$((0x400)) > > count="$dtbo_size" status=progress > > > > # Fake the presence of a golden image for now. > > -dd if=/dev/zero of=/dev/mtd0 count=4 bs=1 > > +dd if=/dev/zero of=/dev/mtd0 count=1 bs=4 > > > > # 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 > > +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 > > +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 > > + > > +# 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 > buildroot@buildroot.org > https://lists.buildroot.org/mailman/listinfo/buildroot
diff --git a/board/beagleboard/beaglev_fire/boot.cmd b/board/beagleboard/beaglev_fire/boot.cmd index 05f4858bac..1402458d8b 100644 --- a/board/beagleboard/beaglev_fire/boot.cmd +++ b/board/beagleboard/beaglev_fire/boot.cmd @@ -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; diff --git 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 old mode 100644 new mode 100755 index f455037b60..ce55394343 --- 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 @@ -13,20 +13,39 @@ 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 + +# Get device tree overlay size +dtbo_size=$(stat -c %s /lib/firmware/mpfs_dtbo.spi) -# # Write device tree overlay -dd if=/lib/firmware/mpfs_dtbo.spi of=/dev/mtd0 seek=1024 +# Write device tree overlay +dd if=/lib/firmware/mpfs_dtbo.spi of=/dev/mtd0 bs=1 seek=$((0x400)) count="$dtbo_size" status=progress # Fake the presence of a golden image for now. -dd if=/dev/zero of=/dev/mtd0 count=4 bs=1 +dd if=/dev/zero of=/dev/mtd0 count=1 bs=4 # 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 +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 +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 + +# 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
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. Signed-off-by: Jamie Gibbons <jamie.gibbons@microchip.com> --- board/beagleboard/beaglev_fire/boot.cmd | 1 + .../usr/share/microchip/update-gateware.sh | 41 ++++++++++++++----- 2 files changed, 31 insertions(+), 11 deletions(-) mode change 100644 => 100755 board/beagleboard/beaglev_fire/rootfs-overlay/usr/share/microchip/update-gateware.sh