diff --git a/m/common/base/ssh.nix b/m/common/base/ssh.nix index 5e12ede..fe0bd39 100644 --- a/m/common/base/ssh.nix +++ b/m/common/base/ssh.nix @@ -8,13 +8,6 @@ in # Enable the OpenSSH daemon. services.openssh.enable = true; - # Connect to intranet git hosts via proxy - programs.ssh.extraConfig = '' - Host bscpm02.bsc.es bscpm03.bsc.es gitlab-internal.bsc.es alya.gitlab.bsc.es - User git - ProxyCommand nc -X connect -x hut:23080 %h %p - ''; - programs.ssh.knownHosts = hostsKeys // { "gitlab-internal.bsc.es".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIF9arsAOSRB06hdy71oTvJHG2Mg8zfebADxpvc37lZo3"; "bscpm03.bsc.es".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM2NuSUPsEhqz1j5b4Gqd+MWFnRqyqY57+xMvBUqHYUS"; diff --git a/m/common/base/users.nix b/m/common/base/users.nix index 40e87a1..7f0d498 100644 --- a/m/common/base/users.nix +++ b/m/common/base/users.nix @@ -20,6 +20,7 @@ rarias = { uid = 1880; isNormalUser = true; + linger = true; home = "/home/Computational/rarias"; description = "Rodrigo Arias"; group = "Computational"; diff --git a/m/common/xeon.nix b/m/common/xeon.nix index 30cf73c..146e018 100644 --- a/m/common/xeon.nix +++ b/m/common/xeon.nix @@ -2,8 +2,9 @@ # Provides the base system for a xeon node. imports = [ ./base.nix - ./xeon/fs.nix ./xeon/console.nix + ./xeon/fs.nix ./xeon/net.nix + ./xeon/ssh.nix ]; } diff --git a/m/common/xeon/ssh.nix b/m/common/xeon/ssh.nix new file mode 100644 index 0000000..a5867df --- /dev/null +++ b/m/common/xeon/ssh.nix @@ -0,0 +1,8 @@ +{ + # Connect to intranet git hosts via proxy + programs.ssh.extraConfig = '' + Host bscpm02.bsc.es bscpm03.bsc.es gitlab-internal.bsc.es alya.gitlab.bsc.es + User git + ProxyCommand nc -X connect -x hut:23080 %h %p + ''; +} diff --git a/m/raccoon/configuration.nix b/m/raccoon/configuration.nix index be9b10c..e971515 100644 --- a/m/raccoon/configuration.nix +++ b/m/raccoon/configuration.nix @@ -32,6 +32,21 @@ nixpkgs.config.nvidia.acceptLicense = true; services.xserver.videoDrivers = [ "nvidia" ]; + services.openssh.settings.X11Forwarding = true; + + nixpkgs.overlays = [ + (final: prev: { + xilinx-xrt = prev.callPackage ./xilinx-xrt.nix { }; + xilinx-xocl = prev.callPackage ./xilinx-xocl.nix { + kernel = config.boot.kernelPackages.kernel; + }; + }) + ]; + + boot.extraModulePackages = [ pkgs.xilinx-xocl ]; + boot.kernelModules = [ "xclmgmt" "xocl" ]; + services.udev.packages = [ pkgs.xilinx-xocl ]; + users.motd = '' ⠀⠀⠀⠀⠀⠀⠀⣀⣀⣄⣠⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⢰⠇⡀⠀⠙⠻⡿⣦⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠀⠀⠀⠀ diff --git a/m/raccoon/xilinx-xocl-depmod.patch b/m/raccoon/xilinx-xocl-depmod.patch new file mode 100644 index 0000000..6f9fe07 --- /dev/null +++ b/m/raccoon/xilinx-xocl-depmod.patch @@ -0,0 +1,27 @@ +--- a/driver/xocl/mgmtpf/Makefile 2025-02-20 15:59:28.379826176 +0100 ++++ b/driver/xocl/mgmtpf/Makefile 2025-02-20 15:59:42.366892140 +0100 +@@ -119,10 +119,6 @@ all: + + install: all + $(MAKE) -C $(KERNEL_SRC) M=$(PWD) modules_install +- depmod -a +- install -m 644 99-xclmgmt.rules /etc/udev/rules.d +- -rmmod -s xclmgmt || true +- -modprobe xclmgmt + + clean: + rm -rf *.o *.o.d *.o.cmd *~ core .depend .*.cmd *.ko *.ko.unsigned \ +--- a/driver/xocl/userpf/Makefile 2025-02-20 16:03:20.751922522 +0100 ++++ b/driver/xocl/userpf/Makefile 2025-02-20 16:03:35.377991553 +0100 +@@ -138,11 +138,6 @@ all: + + install: all + $(MAKE) -C $(KERNEL_SRC) M=$(PWD) modules_install +- depmod -a +- install -m 644 99-xocl.rules /etc/udev/rules.d +- -rmmod -s xocl || true +- -rmmod -s xdma || true +- -modprobe xocl + + clean: + rm -rf *.o *.o.d *~ core .depend .*.cmd *.ko *.ko.unsigned *.mod.c \ diff --git a/m/raccoon/xilinx-xocl.nix b/m/raccoon/xilinx-xocl.nix new file mode 100644 index 0000000..6a38e2b --- /dev/null +++ b/m/raccoon/xilinx-xocl.nix @@ -0,0 +1,35 @@ +{ + stdenv +, lib +, kernel +, xilinx-xrt +}: + +with lib; + +# See: https://iotlab.sdsu.edu/index.php/flash-base-image-on-xilinx-alveo-u280/ + +stdenv.mkDerivation rec { + pname = "xilinx-xocl"; + version = "2.19.0"; + src = "${xilinx-xrt}/src/xrt-${version}"; + dontStrip = true; + preBuild = '' + cd driver/xocl + ''; + patches = [ + ./xilinx-xocl-depmod.patch + ]; + buildFlags = [ "KERNEL_SRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" ]; + installFlags = [ + "KERNEL_SRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" + "INSTALL_MOD_PATH=${placeholder "out"}" + ]; + postInstall = '' + mkdir -p $out/etc/udev/rules.d + install -m 644 userpf/99-xocl.rules $out/etc/udev/rules.d + install -m 644 mgmtpf/99-xclmgmt.rules $out/etc/udev/rules.d + ''; + nativeBuildInputs = kernel.moduleBuildDependencies; + hardeningDisable = [ "all" ]; +} diff --git a/m/raccoon/xilinx-xrt-aiebu.patch b/m/raccoon/xilinx-xrt-aiebu.patch new file mode 100644 index 0000000..71142bf --- /dev/null +++ b/m/raccoon/xilinx-xrt-aiebu.patch @@ -0,0 +1,25 @@ +--- a/src/runtime_src/core/common/aiebu/src/cpp/aiebu/utils/asm/CMakeLists.txt ++++ b/src/runtime_src/core/common/aiebu/src/cpp/aiebu/utils/asm/CMakeLists.txt +@@ -23,8 +23,6 @@ add_executable(aiebu-asm $) + target_link_libraries(aiebu-asm PRIVATE aiebu_static) + + if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") +- target_link_options(aiebu-asm PRIVATE "-static") +- set_target_properties(aiebu-asm PROPERTIES INSTALL_RPATH "" BUILD_RPATH "") + + # Create a dynamically linked executable. aiebu-asm-dyn, on Linux for running + # valgrind, etc. This binary is not released for deployment but only used for +@@ -35,13 +33,6 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + target_link_libraries(aiebu-asm-dyn PRIVATE aiebu_static) + endif() + +-# This custom target fails if aiebu-asm has any dynamic dependencies +-add_custom_target(check_dynamic_deps ALL +- COMMAND ${CMAKE_COMMAND} -E echo "Checking for dynamic dependencies ..." +- COMMAND ${CMAKE_COMMAND} -P "${AIEBU_SOURCE_DIR}/cmake/depends.cmake" $ aiebu-asm_depends.txt +- DEPENDS aiebu-asm +- ) +- + install(TARGETS aiebu-asm + RUNTIME DESTINATION ${AIEBU_INSTALL_BIN_DIR} + CONFIGURATIONS Debug Release COMPONENT Runtime diff --git a/m/raccoon/xilinx-xrt-icd.patch b/m/raccoon/xilinx-xrt-icd.patch new file mode 100644 index 0000000..edf19d0 --- /dev/null +++ b/m/raccoon/xilinx-xrt-icd.patch @@ -0,0 +1,13 @@ +diff --git a/src/CMake/icd.cmake b/src/CMake/icd.cmake +index 255a2e3d8..460a6d4c7 100644 +--- a/src/CMake/icd.cmake ++++ b/src/CMake/icd.cmake +@@ -10,7 +10,7 @@ configure_file ( + ${ICD_FILE_NAME} + ) + +-set(OCL_ICD_INSTALL_PREFIX "/etc/OpenCL/vendors") ++set(OCL_ICD_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/etc/OpenCL/vendors") + + install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${ICD_FILE_NAME} + DESTINATION ${OCL_ICD_INSTALL_PREFIX} diff --git a/m/raccoon/xilinx-xrt-u280-support.patch b/m/raccoon/xilinx-xrt-u280-support.patch new file mode 100644 index 0000000..1280aba --- /dev/null +++ b/m/raccoon/xilinx-xrt-u280-support.patch @@ -0,0 +1,204 @@ +From 6f64871f2e679ad5d3b140c8a2732edaae2dcf6a Mon Sep 17 00:00:00 2001 +From: Rodrigo Arias Mallo +Date: Thu, 20 Feb 2025 18:49:54 +0100 +Subject: [PATCH] Revert "Removed support for u50lv, u55n and u280 platforms in + XRT (#7901)" + +This reverts commit 41f4221433c6b173316b61cb2e7e3ee5152d8075. +--- + .../core/pcie/driver/linux/xocl/devices.h | 103 ++++++++++++++++++ + 1 file changed, 103 insertions(+) + +diff --git a/src/runtime_src/core/pcie/driver/linux/xocl/devices.h b/src/runtime_src/core/pcie/driver/linux/xocl/devices.h +index 971ad73d2..5fe329cfa 100644 +--- a/src/runtime_src/core/pcie/driver/linux/xocl/devices.h ++++ b/src/runtime_src/core/pcie/driver/linux/xocl/devices.h +@@ -2064,6 +2064,14 @@ struct xocl_subdev_map { + .subdev_num = ARRAY_SIZE(USER_RES_DSA52), \ + } + ++#define XOCL_BOARD_USER_DSA52_U280 \ ++ (struct xocl_board_private){ \ ++ .flags = 0, \ ++ .subdev_info = USER_RES_DSA52, \ ++ .subdev_num = ARRAY_SIZE(USER_RES_DSA52), \ ++ .p2p_bar_sz = 64, \ ++ } ++ + #define XOCL_BOARD_USER_SMARTN \ + (struct xocl_board_private){ \ + .flags = XOCL_DSAFLAG_SMARTN, \ +@@ -2370,6 +2378,30 @@ struct xocl_subdev_map { + .flash_type = FLASH_TYPE_SPI, \ + } + ++ ++#define MGMT_RES_XBB_DSA52_U280 \ ++ ((struct xocl_subdev_info []) { \ ++ XOCL_DEVINFO_FEATURE_ROM, \ ++ XOCL_DEVINFO_PRP_IORES_MGMT, \ ++ XOCL_DEVINFO_AXIGATE_ULP, \ ++ XOCL_DEVINFO_CLOCK_HBM, \ ++ XOCL_DEVINFO_AF_DSA52, \ ++ XOCL_DEVINFO_XMC, \ ++ XOCL_DEVINFO_XVC_PRI, \ ++ XOCL_DEVINFO_MAILBOX_MGMT, \ ++ XOCL_DEVINFO_ICAP_MGMT, \ ++ XOCL_DEVINFO_FMGR, \ ++ XOCL_DEVINFO_FLASH, \ ++ }) ++ ++#define XOCL_BOARD_MGMT_XBB_DSA52_U280 \ ++ (struct xocl_board_private){ \ ++ .flags = 0, \ ++ .subdev_info = MGMT_RES_XBB_DSA52_U280, \ ++ .subdev_num = ARRAY_SIZE(MGMT_RES_XBB_DSA52_U280), \ ++ .flash_type = FLASH_TYPE_SPI, \ ++ } ++ + #define MGMT_RES_XBB_SMARTN \ + ((struct xocl_subdev_info []) { \ + XOCL_DEVINFO_FEATURE_ROM_SMARTN, \ +@@ -2772,6 +2804,24 @@ struct xocl_subdev_map { + .board_name = "u50" \ + } + ++#define XOCL_BOARD_U55N_USER_RAPTOR2 \ ++ (struct xocl_board_private){ \ ++ .flags = XOCL_DSAFLAG_DYNAMIC_IP, \ ++ .board_name = "u55n", \ ++ .subdev_info = RES_USER_VSEC, \ ++ .subdev_num = ARRAY_SIZE(RES_USER_VSEC), \ ++ } ++ ++#define XOCL_BOARD_U55N_MGMT_RAPTOR2 \ ++ (struct xocl_board_private){ \ ++ .flags = XOCL_DSAFLAG_DYNAMIC_IP, \ ++ .subdev_info = RES_MGMT_VSEC, \ ++ .subdev_num = ARRAY_SIZE(RES_MGMT_VSEC), \ ++ .flash_type = FLASH_TYPE_SPI, \ ++ .board_name = "u55n", \ ++ .vbnv = "xilinx_u55n" \ ++ } ++ + #define XOCL_BOARD_U55C_USER_RAPTOR2 \ + (struct xocl_board_private){ \ + .flags = XOCL_DSAFLAG_DYNAMIC_IP, \ +@@ -2790,6 +2840,24 @@ struct xocl_subdev_map { + .vbnv = "xilinx_u55c" \ + } + ++#define XOCL_BOARD_U50LV_USER_RAPTOR2 \ ++ (struct xocl_board_private){ \ ++ .flags = XOCL_DSAFLAG_DYNAMIC_IP, \ ++ .board_name = "u50lv", \ ++ .subdev_info = RES_USER_VSEC, \ ++ .subdev_num = ARRAY_SIZE(RES_USER_VSEC), \ ++ } ++ ++#define XOCL_BOARD_U50LV_MGMT_RAPTOR2 \ ++ (struct xocl_board_private){ \ ++ .flags = XOCL_DSAFLAG_DYNAMIC_IP, \ ++ .subdev_info = RES_MGMT_VSEC, \ ++ .subdev_num = ARRAY_SIZE(RES_MGMT_VSEC), \ ++ .flash_type = FLASH_TYPE_SPI, \ ++ .board_name = "u50lv", \ ++ .vbnv = "xilinx_u50lv" \ ++ } ++ + #define XOCL_BOARD_U50C_USER_RAPTOR2 \ + (struct xocl_board_private){ \ + .flags = XOCL_DSAFLAG_DYNAMIC_IP, \ +@@ -2834,6 +2902,14 @@ struct xocl_subdev_map { + .p2p_bar_sz = 64, \ + } + ++#define XOCL_BOARD_U280_USER_RAPTOR2 \ ++ (struct xocl_board_private){ \ ++ .flags = XOCL_DSAFLAG_DYNAMIC_IP, \ ++ .subdev_info = RES_USER_VSEC, \ ++ .subdev_num = ARRAY_SIZE(RES_USER_VSEC), \ ++ .board_name = "u280", \ ++ } ++ + #define XOCL_BOARD_U250_MGMT_RAPTOR2 \ + (struct xocl_board_private){ \ + .flags = XOCL_DSAFLAG_DYNAMIC_IP, \ +@@ -2843,6 +2919,15 @@ struct xocl_subdev_map { + .board_name = "u250" \ + } + ++#define XOCL_BOARD_U280_MGMT_RAPTOR2 \ ++ (struct xocl_board_private){ \ ++ .flags = XOCL_DSAFLAG_DYNAMIC_IP, \ ++ .subdev_info = RES_MGMT_VSEC, \ ++ .subdev_num = ARRAY_SIZE(RES_MGMT_VSEC), \ ++ .flash_type = FLASH_TYPE_SPI, \ ++ .board_name = "u280" \ ++ } ++ + #define XOCL_BOARD_VERSAL_USER_RAPTOR2 \ + (struct xocl_board_private){ \ + .flags = XOCL_DSAFLAG_DYNAMIC_IP | \ +@@ -3435,6 +3520,8 @@ struct xocl_subdev_map { + { XOCL_PCI_DEVID(0x10EE, 0x6A8F, 0x4353, MGMT_6A8F_DSA52) }, \ + { XOCL_PCI_DEVID(0x10EE, 0x5000, PCI_ANY_ID, MGMT_XBB_DSA52_U200) }, \ + { XOCL_PCI_DEVID(0x10EE, 0x5004, PCI_ANY_ID, MGMT_XBB_DSA52) }, \ ++ { XOCL_PCI_DEVID(0x10EE, 0x5008, PCI_ANY_ID, MGMT_XBB_DSA52_U280) },\ ++ { XOCL_PCI_DEVID(0x10EE, 0x500C, PCI_ANY_ID, MGMT_XBB_DSA52_U280) },\ + { XOCL_PCI_DEVID(0x10EE, 0x5020, PCI_ANY_ID, MGMT_U50) }, \ + { XOCL_PCI_DEVID(0x10EE, 0x5028, PCI_ANY_ID, MGMT_VERSAL) }, \ + { XOCL_PCI_DEVID(0x10EE, 0x5044, PCI_ANY_ID, MGMT_VERSAL) }, \ +@@ -3448,7 +3535,9 @@ struct xocl_subdev_map { + { XOCL_PCI_DEVID(0x10EE, 0x5078, PCI_ANY_ID, VERSAL_MGMT_RAPTOR2) }, \ + { XOCL_PCI_DEVID(0x10EE, 0x5050, PCI_ANY_ID, MGMT_U25) }, \ + { XOCL_PCI_DEVID(0x10EE, 0x504E, PCI_ANY_ID, U26Z_MGMT_RAPTOR2) }, \ ++ { XOCL_PCI_DEVID(0x10EE, 0x5058, PCI_ANY_ID, U55N_MGMT_RAPTOR2) },\ + { XOCL_PCI_DEVID(0x10EE, 0x505C, PCI_ANY_ID, U55C_MGMT_RAPTOR2) },\ ++ { XOCL_PCI_DEVID(0x10EE, 0x5060, PCI_ANY_ID, U50LV_MGMT_RAPTOR2) },\ + { XOCL_PCI_DEVID(0x10EE, 0x506C, PCI_ANY_ID, U50C_MGMT_RAPTOR2) },\ + { XOCL_PCI_DEVID(0x10EE, 0x5074, PCI_ANY_ID, X3522PV_MGMT_RAPTOR2) }, \ + { XOCL_PCI_DEVID(0x13FE, 0x006C, PCI_ANY_ID, MGMT_6A8F) }, \ +@@ -3457,6 +3546,8 @@ struct xocl_subdev_map { + { XOCL_PCI_DEVID(0x10EE, 0xF987, PCI_ANY_ID, XBB_MFG("samsung_efuse")) },\ + { XOCL_PCI_DEVID(0x10EE, 0xD000, PCI_ANY_ID, XBB_MFG("u200")) },\ + { XOCL_PCI_DEVID(0x10EE, 0xD004, PCI_ANY_ID, XBB_MFG("u250")) },\ ++ { XOCL_PCI_DEVID(0x10EE, 0xD008, PCI_ANY_ID, XBB_MFG("u280-es1")) }, \ ++ { XOCL_PCI_DEVID(0x10EE, 0xD00C, PCI_ANY_ID, XBB_MFG("u280")) },\ + { XOCL_PCI_DEVID(0x10EE, 0xD030, PCI_ANY_ID, XBB_MFG("poc1465")) },\ + { XOCL_PCI_DEVID(0x10EE, 0xD020, PCI_ANY_ID, XBB_MFG_U50) }, \ + { XOCL_PCI_DEVID(0x10EE, 0xD03C, PCI_ANY_ID, XBB_MFG_U30) }, \ +@@ -3495,11 +3586,15 @@ struct xocl_subdev_map { + { XOCL_PCI_DEVID(0x10EE, 0x7990, 0x4352, USER_DSA52) }, \ + { XOCL_PCI_DEVID(0x10EE, 0x5001, PCI_ANY_ID, USER_DSA52) }, \ + { XOCL_PCI_DEVID(0x10EE, 0x5005, PCI_ANY_ID, USER_DSA52) }, \ ++ { XOCL_PCI_DEVID(0x10EE, 0x5009, PCI_ANY_ID, USER_DSA52_U280) }, \ ++ { XOCL_PCI_DEVID(0x10EE, 0x500D, PCI_ANY_ID, USER_DSA52_U280) }, \ + { XOCL_PCI_DEVID(0x10EE, 0x5021, PCI_ANY_ID, USER_U50) }, \ + { XOCL_PCI_DEVID(0x10EE, 0x5051, PCI_ANY_ID, USER_U25) }, \ + { XOCL_PCI_DEVID(0x10EE, 0x504F, PCI_ANY_ID, U26Z_USER_RAPTOR2) }, \ + { XOCL_PCI_DEVID(0x10EE, 0x513D, PCI_ANY_ID, U30_USER_RAPTOR2) }, \ ++ { XOCL_PCI_DEVID(0x10EE, 0x5059, PCI_ANY_ID, U55N_USER_RAPTOR2) },\ + { XOCL_PCI_DEVID(0x10EE, 0x505D, PCI_ANY_ID, U55C_USER_RAPTOR2) },\ ++ { XOCL_PCI_DEVID(0x10EE, 0x5061, PCI_ANY_ID, U50LV_USER_RAPTOR2) },\ + { XOCL_PCI_DEVID(0x10EE, 0x506D, PCI_ANY_ID, U50C_USER_RAPTOR2) },\ + { XOCL_PCI_DEVID(0x10EE, 0x5075, PCI_ANY_ID, X3522PV_USER_RAPTOR2) }, \ + { XOCL_PCI_DEVID(0x13FE, 0x0065, PCI_ANY_ID, USER_XDMA) }, \ +@@ -3561,6 +3656,14 @@ struct xocl_subdev_map { + .vbnv = "xilinx_u250", \ + .priv_data = &XOCL_BOARD_U250_MGMT_RAPTOR2, \ + .type = XOCL_DSAMAP_RAPTOR2 }, \ ++ { 0x10EE, 0x500D, PCI_ANY_ID, \ ++ .vbnv = "xilinx_u280", \ ++ .priv_data = &XOCL_BOARD_U280_USER_RAPTOR2, \ ++ .type = XOCL_DSAMAP_RAPTOR2 }, \ ++ { 0x10EE, 0x500C, PCI_ANY_ID, \ ++ .vbnv = "xilinx_u280", \ ++ .priv_data = &XOCL_BOARD_U280_MGMT_RAPTOR2, \ ++ .type = XOCL_DSAMAP_RAPTOR2 }, \ + { 0x10EE, 0x5020, PCI_ANY_ID, \ + .vbnv = "xilinx_u50", \ + .priv_data = &XOCL_BOARD_U50_MGMT_RAPTOR2, \ +-- +2.45.2 + diff --git a/m/raccoon/xilinx-xrt.nix b/m/raccoon/xilinx-xrt.nix new file mode 100644 index 0000000..199bc4e --- /dev/null +++ b/m/raccoon/xilinx-xrt.nix @@ -0,0 +1,69 @@ +{ + stdenv +, fetchFromGitHub +, enableDebug ? false +, lib +, cmake +, pkg-config +, libdrm +, libelf +, opencl-headers +, ocl-icd +, git +, boost +, ncurses +, openssl +, rapidjson +, protobuf +, python3 +, libuuid +, curl +, libsystemtap +, libxcrypt +, udev +}: + +with lib; + +stdenv.mkDerivation rec { + name = "xilinx-xrt"; + version = "dc81a9cc"; + src = fetchFromGitHub { + owner = "Xilinx"; + repo = "XRT"; + rev = "dc81a9cc852bf44e71aa3edde7c8f7d54f355eab"; + hash = "sha256-SG1gIO8Bvgs5XQ7HswjWNavPH+m8xHXqauztuJa6aEo="; + fetchSubmodules = true; + }; + dontStrip = true; + patches = [ + ./xilinx-xrt-aiebu.patch + ./xilinx-xrt-icd.patch + ./xilinx-xrt-u280-support.patch + ]; + cmakeFlags = [ + "-DXRT_INSTALL_PREFIX=${placeholder "out"}" + "-DXRT_INSTALL_DIR=${placeholder "out"}" + "-DXRT_NATIVE_BUILD=yes" + "-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON" + ]; + # A directory named "build" already exists + cmakeBuildDir = "the-build"; + + # Replace all occurences of /usr to $out, although some are not correct. By + # default they are replaced by /var/empty + dontFixCmake = true; + preConfigure = '' + find "." -type f \( -name "*.cmake" -o -name "*.cmake.in" -o -name CMakeLists.txt \) -print | + while read fn; do + sed -e 's^/usr\([ /]\|$\)^'$out'\1^g' -e 's^/opt\([ /]\|$\)^'$out'\1^g' < "$fn" > "$fn.tmp" + mv "$fn.tmp" "$fn" + done + ''; + nativeBuildInputs = [ cmake pkg-config git ]; + buildInputs = [ libdrm.dev opencl-headers ocl-icd boost.dev ncurses + openssl.dev rapidjson protobuf python3 libelf libuuid.dev curl.dev + libsystemtap libxcrypt udev.out udev.dev + ]; + hardeningDisable = [ "all" ]; +}