amdgpu-ucode-20161121.ebuild 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit linux-info
  5. AMDGPU_UCODE_LINUX_FIRMWARE="linux-firmware-20170113"
  6. DESCRIPTION="Microcode for C.Islands/V.Islands/A.Islands Radeon GPUs and APUs"
  7. HOMEPAGE="https://people.freedesktop.org/~agd5f/radeon_ucode/"
  8. SRC_URI="mirror://gentoo/${AMDGPU_UCODE_LINUX_FIRMWARE}.tar.xz"
  9. LICENSE="radeon-ucode"
  10. SLOT="0"
  11. KEYWORDS="amd64 x86"
  12. IUSE="legacy"
  13. RDEPEND="legacy? ( !sys-firmware/radeon-ucode )
  14. !>sys-kernel/linux-firmware-20150812[-savedconfig]"
  15. S=${WORKDIR}/${AMDGPU_UCODE_LINUX_FIRMWARE}/amdgpu
  16. AMDGPU_LEGACY_CIK="bonaire hainan hawaii kabini kaveri mullins oland pitcairn tahiti verde"
  17. src_unpack() {
  18. unpack ${A}
  19. mv linux-firmware-* "${AMDGPU_UCODE_LINUX_FIRMWARE}" || die
  20. }
  21. src_install() {
  22. local chip files legacyfiles
  23. if use legacy; then
  24. pushd ../radeon || die
  25. for chip in ${AMDGPU_LEGACY_CIK}; do
  26. legacyfiles+=( ${chip}*.bin )
  27. done
  28. insinto /lib/firmware/radeon
  29. doins ${legacyfiles[@]}
  30. popd
  31. fi
  32. files=( *.bin )
  33. insinto /lib/firmware/amdgpu
  34. doins ${files[@]}
  35. FILES=( ${files[@]/#/amdgpu/} ${legacyfiles[@]/#/radeon/} )
  36. }
  37. pkg_postinst() {
  38. if linux_config_exists && linux_chkconfig_builtin DRM_AMDGPU; then
  39. if ! linux_chkconfig_present FIRMWARE_IN_KERNEL || \
  40. ! [[ "$(linux_chkconfig_string EXTRA_FIRMWARE)" == *_rlc.bin* ]]; then
  41. ewarn "Your kernel has amdgpu DRM built-in but not the microcode."
  42. ewarn "For kernel modesetting to work, please set in kernel config"
  43. ewarn "CONFIG_FIRMWARE_IN_KERNEL=y"
  44. ewarn "CONFIG_EXTRA_FIRMWARE_DIR=\"/lib/firmware\""
  45. ewarn "CONFIG_EXTRA_FIRMWARE=\"${FILES[@]}\""
  46. ewarn "You may skip microcode files for which no hardware is installed."
  47. ewarn "More information at https://wiki.gentoo.org/wiki/AMDGPU#Firmware"
  48. fi
  49. fi
  50. }