From 18bf234a5b3e5cafed535fd8116557b0396aef25 Mon Sep 17 00:00:00 2001 From: Brian Woods Date: Wed, 8 Sep 2021 18:29:22 -0700 Subject: Add support for loading bitstreams Signed-off-by: Brian Woods Reviewed-by: Stefano Stabellini Signed-off-by: Stefano Stabellini --- scripts/disk_image | 8 ++++++++ scripts/uboot-script-gen | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) (limited to 'scripts') diff --git a/scripts/disk_image b/scripts/disk_image index fc64386..1d71863 100755 --- a/scripts/disk_image +++ b/scripts/disk_image @@ -327,6 +327,10 @@ then i=$(( $i + 1 )) done fi +if test "${BITSTREAM}" +then + _part1_size=$(( $_part1_size + `stat -L --printf="%s" $UBOOT_OUT/$BITSTREAM` )) +fi i=0 while test $i -lt $NUM_DOMUS @@ -462,6 +466,10 @@ then i=$(( $i + 1 )) done fi +if test "${BITSTREAM}" +then + cp --parents "$BITSTREAM" "${DESTDIR_ABS}/part/disk1/" +fi i=0 while test $i -lt $NUM_DOMUS diff --git a/scripts/uboot-script-gen b/scripts/uboot-script-gen index abcc0cd..974fc5f 100755 --- a/scripts/uboot-script-gen +++ b/scripts/uboot-script-gen @@ -446,6 +446,22 @@ linux_file_loading() fi } +bitstream_load_and_config() +{ + if test "$BITSTREAM" + then + check_file_type "$BITSTREAM" "BIT data" + bitstream_addr=$memaddr + load_file $BITSTREAM "fpga_bitstream" + bitstream_size=$filesize + if test "$UBOOT_SOURCE" + then + # we assume the FPGA device is 0 here + echo "fpga load 0 $bitstream_addr $bitstream_size" >> "$UBOOT_SOURCE" + fi + fi +} + create_its_file_xen() { if test "$ramdisk_addr" != "-" @@ -608,6 +624,23 @@ create_its_file() fdt_line+=";" fi + if test "$BITSTREAM" + then + local fpga_line="fpga = \"fpga_bitstream\";" + cat >> "$its_file" <<- EOF + fpga_bitstream { + description = "FPGA bit stream"; + data = /incbin/("$BITSTREAM"); + type = "fpga"; + arch = "arm64"; + compression = "none"; + compatible = "u-boot,fpga-legacy"; + load = <$bitstream_addr>; + $fit_algo + }; + EOF + fi + # script for fit cat >> "$its_file" <<- EOF boot_scr { @@ -640,6 +673,7 @@ create_its_file() kernel = "host_kernel"; $fdt_line $ramdisk_line + $fpga_line $loadables_line }; }; @@ -903,6 +937,7 @@ fi check_file_type $DEVICE_TREE "Device Tree Blob" device_tree_addr=$memaddr load_file $DEVICE_TREE "host_fdt" +bitstream_load_and_config # bitstream is loaded last but used first device_tree_editing $device_tree_addr # disable device tree reloation -- cgit v1.2.3