Compare commits

..

No commits in common. '6f6191b67dcc12703ea30b22500a41c02c9e8f83' and 'a2bbfafeda15453cfc1b93973defa528446a357b' have entirely different histories.

@ -31,10 +31,10 @@ build-v6.6-debian-13-riscv64:
- ./05_generate_payload.bin.sh - ./05_generate_payload.bin.sh
- ./06_generate_debian_console_root.sh - ./06_generate_debian_console_root.sh
- ./07_create_sdcard_img.sh - ./07_create_sdcard_img.sh
- xz -vT8 deploy/images/sdcard.img
- tree -s deploy/ - tree -s deploy/
- cp -v deploy/images/sdcard.img.xz ./deploy/ - cp -v deploy/images/sdcard.img.xz ./deploy/
- cp -v deploy/images/sdcard.bmap ./deploy/ - cp -v deploy/images/sdcard.bmap ./deploy/
- cp -v deploy/images/image.yml.txt ./deploy/
artifacts: artifacts:
when: on_success when: on_success
expire_in: 4 week expire_in: 4 week
@ -43,7 +43,6 @@ build-v6.6-debian-13-riscv64:
- "deploy/sdcard.img.xz" - "deploy/sdcard.img.xz"
- "deploy/sdcard.bmap" - "deploy/sdcard.bmap"
- "deploy/readme.md" - "deploy/readme.md"
- "deploy/image.yml.txt"
build-v6.6-ubuntu-2404-riscv64: build-v6.6-ubuntu-2404-riscv64:
image: robertcnelson/beagle-devscripts-kernel-debian-12-amd64:latest image: robertcnelson/beagle-devscripts-kernel-debian-12-amd64:latest
@ -71,10 +70,10 @@ build-v6.6-ubuntu-2404-riscv64:
- ./05_generate_payload.bin.sh - ./05_generate_payload.bin.sh
- ./06_generate_ubuntu_console_root.sh - ./06_generate_ubuntu_console_root.sh
- ./07_create_sdcard_img.sh - ./07_create_sdcard_img.sh
- xz -vT8 deploy/images/sdcard.img
- tree -s deploy/ - tree -s deploy/
- cp -v deploy/images/sdcard.img.xz ./deploy/ - cp -v deploy/images/sdcard.img.xz ./deploy/
- cp -v deploy/images/sdcard.bmap ./deploy/ - cp -v deploy/images/sdcard.bmap ./deploy/
- cp -v deploy/images/image.yml.txt ./deploy/
artifacts: artifacts:
when: on_success when: on_success
expire_in: 4 week expire_in: 4 week
@ -83,4 +82,3 @@ build-v6.6-ubuntu-2404-riscv64:
- "deploy/sdcard.img.xz" - "deploy/sdcard.img.xz"
- "deploy/sdcard.bmap" - "deploy/sdcard.bmap"
- "deploy/readme.md" - "deploy/readme.md"
- "deploy/image.yml.txt"

@ -30,12 +30,6 @@ if [ ! -f ./images/sdcard.img ]; then
exit 2 exit 2
fi fi
extract_size=$(du -b ./images/sdcard.img | awk '{print $1}')
echo " extract_size: ${extract_size}" > ./images/image.yml.txt
extract_sha256=$(sha256sum ./images/sdcard.img | awk '{print $1}')
echo " extract_sha256: ${extract_sha256}" >> ./images/image.yml.txt
if [ -f /usr/bin/bmaptool ] ; then if [ -f /usr/bin/bmaptool ] ; then
if [ -f ./images/sdcard.bmap ] ; then if [ -f ./images/sdcard.bmap ] ; then
rm -rf ./images/sdcard.bmap || true rm -rf ./images/sdcard.bmap || true
@ -43,22 +37,4 @@ if [ -f /usr/bin/bmaptool ] ; then
/usr/bin/bmaptool -d create -o ./images/sdcard.bmap ./images/sdcard.img /usr/bin/bmaptool -d create -o ./images/sdcard.bmap ./images/sdcard.img
fi fi
xz -T0 -z ./images/sdcard.img
if [ ! -f ./images/sdcard.img.xz ]; then
echo "Error: ./images/sdcard.img.xz was not generated"
exit 2
fi
image_download_size=$(du -b ./images/sdcard.img.xz | awk '{print $1}')
echo " image_download_size: ${image_download_size}" >> ./images/image.yml.txt
image_download_sha256=$(sha256sum ./images/sdcard.img.xz | awk '{print $1}')
echo " image_download_sha256: ${image_download_sha256}" >> ./images/image.yml.txt
TIME=$(date +%Y-%m-%d)
echo " release_date: '${TIME}'" >> ./images/image.yml.txt
echo " init_format: sysconf" >> ./images/image.yml.txt
# #

@ -1,9 +1,5 @@
#!/bin/bash #!/bin/bash
kernel_version=$(uname -r)
kernel_major_minor=$(echo "$kernel_version" | cut -d '.' -f 1,2)
if ! id | grep -q root; then if ! id | grep -q root; then
echo "must be run as root" echo "must be run as root"
exit exit
@ -11,20 +7,21 @@ fi
if [ -d $1 ] if [ -d $1 ]
then then
echo "Changing gateware." echo "Changing gateware."
if [ -e $1/LinuxProgramming/mpfs_bitstream.spi ] if [ -e $1/mpfs_bitstream.spi ]
then then
if [ "$kernel_major_minor" == "6.1" ]; then if [ -e $1/mpfs_dtbo.spi ]
cp -v $1/LinuxProgramming/mpfs_dtbo.spi /lib/firmware/mpfs_dtbo.spi then
cp -v $1/LinuxProgramming/mpfs_bitstream.spi /lib/firmware/mpfs_bitstream.spi cp -v $1/mpfs_dtbo.spi /lib/firmware/mpfs_dtbo.spi
sync cp -v $1/mpfs_bitstream.spi /lib/firmware/mpfs_bitstream.spi
source /usr/share/microchip/gateware/update-gateware-6-1.sh $1/LinuxProgramming sync
else . /etc/microchip/update-gateware.sh
source /usr/share/microchip/gateware/update-gateware.sh $1/LinuxProgramming else
fi echo "No device tree overlay file found."
else fi
echo "No xxx gateware file found." else
fi echo "No gateware file found."
fi
else else
echo "No directory found for this requested gateware." echo "No directory found for this requested gateware."
fi fi

@ -1,49 +0,0 @@
#!/bin/bash
echo "================================================================================"
echo "| FPGA Gateware Update |"
echo "| |"
echo "| Please ensure that the mpfs_bitstream.spi file containing the gateware |"
echo "| update has been copied to directory /lib/firmware. |"
echo "| |"
echo "| !!! This will take a couple of minutes. !!! |"
echo "| |"
echo "| Give the system a few minutes to reboot itself |"
echo "| after Linux has shutdown. |"
echo "| |"
echo "================================================================================"
if [ ! -f /usr/sbin/mtd_debug ] ; then
echo "Install mtd-utils package"
exit 2
fi
if [ ! -f /lib/firmware/mpfs_bitstream.spi ] ; then
exit 2
fi
#read -rsp $'Press any key to continue...\n' -n1 key
if [ ! -f /sys/kernel/debug/fpga/microchip_exec_update ] ; then
/usr/bin/mount -t debugfs none /sys/kernel/debug
fi
# Trash exisitng device tree overlay in case the rest of the process fails:
/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)
echo "Writing mpfs_dtbo.spi to /dev/mtd0"
/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.
/usr/sbin/mtd_debug write /dev/mtd0 0 4 /dev/zero > /dev/zero
# Initiate FPGA update.
echo "Triggering FPGA Gateware Update (/sys/kernel/debug/fpga/microchip_exec_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.
/usr/sbin/reboot

@ -1,66 +1,49 @@
#!/bin/sh #!/bin/bash
echo "================================================================================"
echo "| FPGA Gateware Update |"
echo "| |"
echo "| Please ensure that the mpfs_bitstream.spi file containing the gateware |"
echo "| update has been copied to directory /lib/firmware. |"
echo "| |"
echo "| !!! This will take a couple of minutes. !!! |"
echo "| |"
echo "| Give the system a few minutes to reboot itself |"
echo "| after Linux has shutdown. |"
echo "| |"
echo "================================================================================"
if [ ! -f /usr/sbin/mtd_debug ] ; then
echo "Install mtd-utils package"
exit 2
fi
if [ $# -eq 0 ]; then if [ ! -f /lib/firmware/mpfs_bitstream.spi ] ; then
echo "No gateware location provided. Checking default location." exit 2
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 fi
# Trash existing device tree overlay in case the rest of the process fails: #read -rsp $'Press any key to continue...\n' -n1 key
flash_erase /dev/mtd0 0 16
if [ ! -f /sys/kernel/debug/fpga/microchip_exec_update ] ; then
/usr/bin/mount -t debugfs none /sys/kernel/debug
fi
# Initiate FPGA update for dtbo # Trash exisitng device tree overlay in case the rest of the process fails:
echo 1 > /sys/class/firmware/mpfs-auto-update/loading /usr/sbin/mtd_debug erase /dev/mtd0 0x0 0x10000
# Write device tree overlay # Write device tree overlay
cat /lib/firmware/mpfs_dtbo.spi > /sys/class/firmware/mpfs-auto-update/data dtbo_ls=$(ls -l /lib/firmware/mpfs_dtbo.spi)
dtbo_size=$(echo $dtbo_ls | cut -d " " -f 5)
# Signal completion for dtbo load
echo 0 > /sys/class/firmware/mpfs-auto-update/loading
while [ "$(cat /sys/class/firmware/mpfs-auto-update/status)" != "idle" ]; do echo "Writing mpfs_dtbo.spi to /dev/mtd0"
# Do nothing, just keep checking /usr/sbin/mtd_debug write /dev/mtd0 0x400 $dtbo_size /lib/firmware/mpfs_dtbo.spi > /dev/zero
sleep 1
done
# Fake the presence of a golden image for now. # Fake the presence of a golden image for now.
dd if=/dev/zero of=/dev/mtd0 count=1 bs=4 /usr/sbin/mtd_debug write /dev/mtd0 0 4 /dev/zero > /dev/zero
# Initiate FPGA update for bitstream # Initiate FPGA update.
echo 1 > /sys/class/firmware/mpfs-auto-update/loading echo "Triggering FPGA Gateware Update (/sys/kernel/debug/fpga/microchip_exec_update)"
echo 1 > /sys/kernel/debug/fpga/microchip_exec_update
# Write the firmware image to the data sysfs file # Reboot Linux for the gateware update to take effect.
cat /lib/firmware/mpfs_bitstream.spi > /sys/class/firmware/mpfs-auto-update/data # FPGA reprogramming takes places between Linux shut-down and HSS restarting the board.
/usr/sbin/reboot
# 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
# 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

Loading…
Cancel
Save