derle.sh 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. create_links() {
  2. # create soname links
  3. find "$PKG" -type f -name '*.so*' ! -path '*xorg/*' -print0 | while read -d $'\0' _lib; do
  4. _soname=$(dirname "${_lib}")/$(readelf -d "${_lib}" | grep -Po 'SONAME.*: \[\K[^]]*' || true)
  5. _base=$(echo ${_soname} | sed -r 's/(.*).so.*/\1.so/')
  6. [[ -e "${_soname}" ]] || ln -s $(basename "${_lib}") "${_soname}"
  7. [[ -e "${_base}" ]] || ln -s $(basename "${_soname}") "${_base}"
  8. done
  9. }
  10. sh "/sources/NVIDIA-Linux-x86_64-$surum.run" --extract-only
  11. cd "NVIDIA-Linux-x86_64-$surum"
  12. bsdtar -xf nvidia-persistenced-init.tar.bz2
  13. cd kernel
  14. sed -i "s/__VERSION_STRING/${surum}/" dkms.conf
  15. sed -i 's/__JOBS/`nproc`/' dkms.conf
  16. sed -i 's/__DKMS_MODULES//' dkms.conf
  17. sed -i '$iBUILT_MODULE_NAME[0]="nvidia"\
  18. DEST_MODULE_LOCATION[0]="/kernel/drivers/video"\
  19. BUILT_MODULE_NAME[1]="nvidia-uvm"\
  20. DEST_MODULE_LOCATION[1]="/kernel/drivers/video"\
  21. BUILT_MODULE_NAME[2]="nvidia-modeset"\
  22. DEST_MODULE_LOCATION[2]="/kernel/drivers/video"\
  23. BUILT_MODULE_NAME[3]="nvidia-drm"\
  24. DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf
  25. # Gift for linux-rt guys
  26. sed -i 's/NV_EXCLUDE_BUILD_MODULES/IGNORE_PREEMPT_RT_PRESENCE=1 NV_EXCLUDE_BUILD_MODULES/' dkms.conf
  27. cd $SRC/"NVIDIA-Linux-x86_64-$surum"
  28. # OpenCL
  29. install -D -m644 nvidia.icd "${PKG}/etc/OpenCL/vendors/nvidia.icd"
  30. install -D -m755 "libnvidia-compiler.so.${surum}" "${PKG}/usr/lib/libnvidia-compiler.so.${surum}"
  31. install -D -m755 "libnvidia-opencl.so.${surum}" "${PKG}/usr/lib/libnvidia-opencl.so.${surum}"
  32. # create_links
  33. cd $SRC/"NVIDIA-Linux-x86_64-$surum"
  34. install -dm 755 "${PKG}"/usr/src
  35. cp -dr --no-preserve='ownership' kernel "${PKG}/usr/src/nvidia-${surum}"
  36. echo "blacklist nouveau" |
  37. install -Dm644 /dev/stdin "${PKG}/usr/lib/modprobe.d/${isim}.conf"
  38. # X driver
  39. install -D -m755 nvidia_drv.so "${PKG}/usr/lib/xorg/modules/drivers/nvidia_drv.so"
  40. # firmware
  41. # install -D -m644 firmware/gsp.bin "${PKG}/usr/lib/firmware/nvidia/${surum}/gsp.bin"
  42. # GLX extension module for X
  43. install -D -m755 "libglxserver_nvidia.so.${surum}" "${PKG}/usr/lib/nvidia/xorg/libglxserver_nvidia.so.${surum}"
  44. # Ensure that X finds glx
  45. ln -s "libglxserver_nvidia.so.${surum}" "${PKG}/usr/lib/nvidia/xorg/libglxserver_nvidia.so.1"
  46. ln -s "libglxserver_nvidia.so.${surum}" "${PKG}/usr/lib/nvidia/xorg/libglxserver_nvidia.so"
  47. install -D -m755 "libGLX_nvidia.so.${surum}" "${PKG}/usr/lib/libGLX_nvidia.so.${surum}"
  48. # OpenGL libraries
  49. install -D -m755 "libEGL_nvidia.so.${surum}" "${PKG}/usr/lib/libEGL_nvidia.so.${surum}"
  50. install -D -m755 "libGLESv1_CM_nvidia.so.${surum}" "${PKG}/usr/lib/libGLESv1_CM_nvidia.so.${surum}"
  51. install -D -m755 "libGLESv2_nvidia.so.${surum}" "${PKG}/usr/lib/libGLESv2_nvidia.so.${surum}"
  52. install -D -m644 "10_nvidia.json" "${PKG}/usr/share/glvnd/egl_vendor.d/10_nvidia.json"
  53. # OpenGL core library
  54. install -D -m755 "libnvidia-glcore.so.${surum}" "${PKG}/usr/lib/libnvidia-glcore.so.${surum}"
  55. install -D -m755 "libnvidia-eglcore.so.${surum}" "${PKG}/usr/lib/libnvidia-eglcore.so.${surum}"
  56. install -D -m755 "libnvidia-glsi.so.${surum}" "${PKG}/usr/lib/libnvidia-glsi.so.${surum}"
  57. # misc
  58. install -D -m755 "libnvidia-ifr.so.${surum}" "${PKG}/usr/lib/libnvidia-ifr.so.${surum}"
  59. install -D -m755 "libnvidia-fbc.so.${surum}" "${PKG}/usr/lib/libnvidia-fbc.so.${surum}"
  60. install -D -m755 "libnvidia-encode.so.${surum}" "${PKG}/usr/lib/libnvidia-encode.so.${surum}"
  61. install -D -m755 "libnvidia-cfg.so.${surum}" "${PKG}/usr/lib/libnvidia-cfg.so.${surum}"
  62. install -D -m755 "libnvidia-ml.so.${surum}" "${PKG}/usr/lib/libnvidia-ml.so.${surum}"
  63. install -D -m755 "libnvidia-ngx.so.${surum}" "${PKG}/usr/lib/libnvidia-ngx.so.${surum}"
  64. install -D -m755 "libnvidia-glvkspirv.so.${surum}" "${PKG}/usr/lib/libnvidia-glvkspirv.so.${surum}"
  65. # Vulkan ICD
  66. install -D -m644 "nvidia_icd.json" "${PKG}/usr/share/vulkan/icd.d/nvidia_icd.json"
  67. install -D -m644 "nvidia_layers.json" "${PKG}/usr/share/vulkan/implicit_layer.d/nvidia_layers.json"
  68. # VDPAU
  69. install -D -m755 "libvdpau_nvidia.so.${surum}" "${PKG}/usr/lib/vdpau/libvdpau_nvidia.so.${surum}"
  70. # nvidia-tls library
  71. install -D -m755 "libnvidia-tls.so.${surum}" "${PKG}/usr/lib/libnvidia-tls.so.${surum}"
  72. # CUDA
  73. install -D -m755 "libcuda.so.${surum}" "${PKG}/usr/lib/libcuda.so.${surum}"
  74. install -D -m755 "libnvcuvid.so.${surum}" "${PKG}/usr/lib/libnvcuvid.so.${surum}"
  75. # PTX JIT Compiler (Parallel Thread Execution (PTX) is a pseudo-assembly language for CUDA)
  76. install -D -m755 "libnvidia-ptxjitcompiler.so.${surum}" "${PKG}/usr/lib/libnvidia-ptxjitcompiler.so.${surum}"
  77. # raytracing
  78. install -D -m755 "libnvoptix.so.${surum}" "${PKG}/usr/lib/libnvoptix.so.${surum}"
  79. install -D -m755 "libnvidia-rtcore.so.${surum}" "${PKG}/usr/lib/libnvidia-rtcore.so.${surum}"
  80. install -D -m755 "libnvidia-cbl.so.${surum}" "${PKG}/usr/lib/libnvidia-cbl.so.${surum}"
  81. # Optical flow
  82. install -D -m755 "libnvidia-opticalflow.so.${surum}" "${PKG}/usr/lib/libnvidia-opticalflow.so.${surum}"
  83. # DEBUG
  84. install -D -m755 nvidia-debugdump "${PKG}/usr/bin/nvidia-debugdump"
  85. # nvidia-xconfig
  86. install -D -m755 nvidia-xconfig "${PKG}/usr/bin/nvidia-xconfig"
  87. install -D -m644 nvidia-xconfig.1.gz "${PKG}/usr/share/man/man1/nvidia-xconfig.1.gz"
  88. # nvidia-bug-report
  89. install -D -m755 nvidia-bug-report.sh "${PKG}/usr/bin/nvidia-bug-report.sh"
  90. # nvidia-smi
  91. install -D -m755 nvidia-smi "${PKG}/usr/bin/nvidia-smi"
  92. install -D -m644 nvidia-smi.1.gz "${PKG}/usr/share/man/man1/nvidia-smi.1.gz"
  93. # nvidia-cuda-mps
  94. install -D -m755 nvidia-cuda-mps-server "${PKG}/usr/bin/nvidia-cuda-mps-server"
  95. install -D -m755 nvidia-cuda-mps-control "${PKG}/usr/bin/nvidia-cuda-mps-control"
  96. install -D -m644 nvidia-cuda-mps-control.1.gz "${PKG}/usr/share/man/man1/nvidia-cuda-mps-control.1.gz"
  97. # nvidia-modprobe
  98. # This should be removed if nvidia fixed their uvm module!
  99. install -D -m4755 nvidia-modprobe "${PKG}/usr/bin/nvidia-modprobe"
  100. install -D -m644 nvidia-modprobe.1.gz "${PKG}/usr/share/man/man1/nvidia-modprobe.1.gz"
  101. # nvidia-persistenced
  102. install -D -m755 nvidia-persistenced "${PKG}/usr/bin/nvidia-persistenced"
  103. install -D -m644 nvidia-persistenced.1.gz "${PKG}/usr/share/man/man1/nvidia-persistenced.1.gz"
  104. # install -D -m644 nvidia-persistenced-init/systemd/nvidia-persistenced.service.template "${PKG}/usr/lib/systemd/system/nvidia-persistenced.service"
  105. # sed -i 's/__USER__/nvidia-persistenced/' "${PKG}/usr/lib/systemd/system/nvidia-persistenced.service"
  106. # application profiles
  107. install -D -m644 nvidia-application-profiles-${surum}-rc "${PKG}/usr/share/nvidia/nvidia-application-profiles-${surum}-rc"
  108. install -D -m644 nvidia-application-profiles-${surum}-key-documentation "${PKG}/usr/share/nvidia/nvidia-application-profiles-${surum}-key-documentation"
  109. # new power management support
  110. # install -D -m644 systemd/system/nvidia-suspend.service "${PKG}/usr/lib/systemd/system/nvidia-suspend.service"
  111. # install -D -m644 systemd/system/nvidia-hibernate.service "${PKG}/usr/lib/systemd/system/nvidia-hibernate.service"
  112. # install -D -m644 systemd/system/nvidia-resume.service "${PKG}/usr/lib/systemd/system/nvidia-resume.service"
  113. # install -D -m755 systemd/system-sleep/nvidia "${PKG}/usr/lib/systemd/system-sleep/nvidia"
  114. # install -D -m755 systemd/nvidia-sleep.sh "${PKG}/usr/bin/nvidia-sleep.sh"
  115. # distro specific files must be installed in /usr/share/X11/xorg.conf.d
  116. install -D -m644 "$SRC/10-nvidia-drm-outputclass.conf" "${PKG}/usr/share/X11/xorg.conf.d/10-nvidia-drm-outputclass.conf"
  117. install -Dm644 "$SRC/nvidia-utils.sysusers" "${PKG}/usr/lib/sysusers.d/$isim.conf"
  118. create_links