76 lines
2.9 KiB
Nix
76 lines
2.9 KiB
Nix
{
|
|
stdenv
|
|
, lib
|
|
, dpkg
|
|
, fetchurl
|
|
, xilinx-xrt
|
|
}:
|
|
|
|
with lib;
|
|
|
|
# Must read: https://xilinx.github.io/XRT/master/html/platforms_partitions.html#shell
|
|
# Taken from:
|
|
# - https://aur.archlinux.org/packages/xilinx-sc-fw-u280
|
|
# - https://aur.archlinux.org/packages/xilinx-u280-gen3x16-xdma-base
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "xilinx-fw";
|
|
version = "1.3.5-3592445";
|
|
srcs = [
|
|
# List packages with: curl https://packages.xilinx.com/artifactory/debian-packages-cache/pool/
|
|
(fetchurl {
|
|
url = "https://packages.xilinx.com/artifactory/debian-packages-cache/pool/xilinx-cmc-u280_1.3.5-3592445_all.deb";
|
|
hash = "sha256-H48bdeuBc9dK6LExMnw1RCfY85PKntBk/X8CMcAI+zI=";
|
|
})
|
|
(fetchurl {
|
|
url = "https://packages.xilinx.com/artifactory/debian-packages-cache/pool/xilinx-sc-fw-u280_4.3.28-1.ea1b92f_all.deb";
|
|
hash = "sha256-JxQal2IqYAgebAgfjs2noFG5ghxC9sJQFppJFUCx6jA=";
|
|
})
|
|
(fetchurl {
|
|
url = "https://packages.xilinx.com/artifactory/debian-packages-cache/pool/xilinx-u280-gen3x16-xdma-base_1-3585717_all.deb";
|
|
hash = "sha256-oe84YgmmRFZjNa63j0pIneuFUG0Bb4aA7wulyU4bCrY=";
|
|
})
|
|
(fetchurl {
|
|
url = "https://packages.xilinx.com/artifactory/debian-packages-cache/pool/xilinx-u280-gen3x16-xdma-validate_1-3585755_all.deb";
|
|
hash = "sha256-F+IAzR8NVc9FDsgQstpBcKeq3ogH1PI8nuq94sEExCg=";
|
|
})
|
|
# Needed for the ERT firmware
|
|
(fetchurl {
|
|
url = "https://packages.xilinx.com/artifactory/debian-packages-cache/pool/xrt_202320.2.16.204_22.04-amd64-xrt.deb";
|
|
hash = "sha256-FEhzx2KlIYpunXmTSBjtyAtblbuz5tkvnt2qp21gUho=";
|
|
})
|
|
];
|
|
|
|
dontStrip = true;
|
|
hardeningDisable = [ "all" ];
|
|
nativeBuildInputs = [ dpkg ];
|
|
unpackPhase = ''
|
|
for f in $srcs; do
|
|
dpkg-deb -x "$f" deb
|
|
done
|
|
sourceRoot=deb
|
|
'';
|
|
# Generate the xsabin firmware file by fixing the original script
|
|
buildPhase = ''
|
|
set -x
|
|
|
|
ln -rs lib/firmware/xilinx/283bab8f654d8674968f4da57f7fa5d7 lib/firmware/xilinx/fb2b2c5a19ed63593fea95f51fbc8eb9
|
|
ln -rs lib/firmware/xilinx/283bab8f654d8674968f4da57f7fa5d7/partition_metadata.json opt/xilinx/firmware/u280/gen3x16-xdma/base/partition_metadata.json
|
|
ln -rs lib/firmware/xilinx/283bab8f654d8674968f4da57f7fa5d7/partition.xsabin opt/xilinx/firmware/u280/gen3x16-xdma/base/partition.xsabin
|
|
ln -rs opt/xilinx/xrt/share/fw opt/xilinx/firmware/u280/gen3x16-xdma/base/firmware/ert-v30
|
|
ln -rs opt/xilinx/firmware/cmc/u280 opt/xilinx/firmware/u280/gen3x16-xdma/base/firmware/cmc-u280
|
|
ln -rs opt/xilinx/firmware/sc-fw/u280 opt/xilinx/firmware/u280/gen3x16-xdma/base/firmware/sc-fw-u280
|
|
|
|
find
|
|
|
|
export xclbinutil=${xilinx-xrt}/xrt/bin/xclbinutil
|
|
cp -a ${./xilinx-create-xsabin.sh} opt/xilinx/firmware/u280/gen3x16-xdma/base/scripts/create_xsabin.sh
|
|
bash -x opt/xilinx/firmware/u280/gen3x16-xdma/base/scripts/create_xsabin.sh xilinx-u280-gen3x16-xdma-base 1 3585717
|
|
set +x
|
|
'';
|
|
installPhase = ''
|
|
mkdir -p $out
|
|
cp -a * $out
|
|
'';
|
|
}
|