#!/bin/bash # Made by Andrew Shark, The author of LinuxComp Tutorial Youtube channel # To install amdgpu-pro on ubuntu 19.04 we want to use the following: # ./amdgpu-install --pro --opencl=lagacy,pal # But there are several problems: # 1) amdgpu-dkms fails to build in 19.10 (probably could be fixed, I did not explored it yet). I checked that this driver actually works without dkms version of amdgpu kernel modules, so solution is omitting it. # 2) amdgpu-core checks ubuntu version before installation and refuses to continue if ubuntu version is not 18.04. Solution is to remove this check. It is in preinst script. # 3) amdgpu-pro(-hwe) and amdgpu-pro-lib32 depends on amdgpu(-hwe), however they should depend on amdgpu-lib(-hwe) instead. amdgpu(-hwe) itself depends on amdgpu-dkms and amdgpu-lib(-hwe). Because of this issue, amdgpu-dkms package is still in installation list when we use --no-dkms. So solution is to modify depends array of amdgpu-pro(-hwe) and amdgpu-pro-lib32. Or just use a fake empty amdgpu-dkms package. # 4) Then we need to edit packages hashsums and filesizes of modified packages in Packages file and hashsums of Packages file in Release file. # 5) And we need to edit amdgpu-install script to use hwe packages (they are more recent versions of non-hwe ones). # After that we could install amdgpu-pro 19.10-785425 in ubuntu 19.04. # Ok, lets start! # remove installation if it was done previously if command -v amdgpu-uninstall; then amdgpu-uninstall -y; elif command -v amdgpu-pro-uninstall; then amdgpu-pro-uninstall -y; fi # Solving problem 1: # We just do not install it. # Solving problem 2: # ag_core_orig_md5=6181300cd4027e11cc6d807a85e0314b # original (with preinst script) DEBFILE="amdgpu-core_19.10-785425_all.deb" TMPDIR=`mktemp -d /tmp/deb.XXXXXXXXXX` || exit 1 OUTPUT=`basename "$DEBFILE" .deb`.no_ub_ver_chk.deb dpkg-deb -x "$DEBFILE" "$TMPDIR" dpkg-deb --control "$DEBFILE" "$TMPDIR"/DEBIAN rm "$TMPDIR"/DEBIAN/preinst rm $OUTPUT # remove modded deb if already exist dpkg -b "$TMPDIR" "$OUTPUT" rm -r "$TMPDIR" # for some reason hashsum is different after every build. Not explored why yet. So I will get it in this script dinamically ag_core_mod_md5=$(md5sum $OUTPUT | cut -f1 -d" ") ag_core_mod_sha1=$(sha1sum $OUTPUT | cut -f1 -d" ") ag_core_mod_sha256=$(sha256sum $OUTPUT | cut -f1 -d" ") ag_core_mod_size=$(wc -c < $OUTPUT) # Solving problem 3: # ag_dkms_orig_md5=5a1a0330f609c1b927a212bd4b14a95a # original amdgpu-dkms_19.10-785425_all.deb package rm -rf amdgpu-dkms-fake mkdir -p amdgpu-dkms-fake/DEBIAN echo -e " Package: amdgpu-dkms Version: 19.10-785425 Architecture: all Maintainer: Unreal Person Section: misc Priority: optional Description: Fake empty package to workaround pro stack dependcy on dkms" > amdgpu-dkms-fake/DEBIAN/control dpkg-deb --build amdgpu-dkms-fake > /dev/null rm -rf amdgpu-dkms-fake ag_dkms_mod_md5=$(md5sum amdgpu-dkms-fake.deb | cut -f1 -d" ") ag_dkms_mod_sha1=$(sha1sum amdgpu-dkms-fake.deb | cut -f1 -d" ") ag_dkms_mod_sha256=$(sha256sum amdgpu-dkms-fake.deb | cut -f1 -d" ") ag_dkms_mod_size=$(wc -c < amdgpu-dkms-fake.deb) # Solving problem 4: sed -i "36{s/.*/Filename: .\/amdgpu-core_19.10-785425_all.no_ub_ver_chk.deb/}" Packages sed -i "37{s/.*/Size: $ag_core_mod_size/}" Packages sed -i "38{s/.*/MD5sum: $ag_core_mod_md5/}" Packages sed -i "39{s/.*/SHA1: $ag_core_mod_sha1/}" Packages sed -i "40{s/.*/SHA256: $ag_core_mod_sha256/}" Packages sed -i "52{s/.*/Filename: .\/amdgpu-dkms-fake.deb/}" Packages sed -i "53{s/.*/Size: $ag_dkms_mod_size/}" Packages sed -i "54{s/.*/MD5sum: $ag_dkms_mod_md5/}" Packages sed -i "55{s/.*/SHA1: $ag_dkms_mod_sha1/}" Packages sed -i "56{s/.*/SHA256: $ag_dkms_mod_sha256/}" Packages # packages_mod_md5=$(md5sum Packages | cut -f1 -d" ") # packages_mod_sha1=$(sha1sum Packages | cut -f1 -d" ") packages_mod_sha256=$(sha256sum Packages | cut -f1 -d" ") packages_mod_sha1=$(sha1sum Packages | cut -f1 -d" ") packages_mod_size=$(wc -c < Packages) echo -e "Date: `date -R -u` SHA256: $packages_mod_sha256 $packages_mod_size Packages" > Release # Solving problem 5: sed -i '147{s/^\t/#/}' amdgpu-install # commenting out this condition: if dpkg -s "xserver-xorg-hwe-18.04" sed -i '151{s/^\t/#/}' amdgpu-install # and its closing fi # Finally, we are ready to install: ./amdgpu-install --pro --opencl=legacy,pal --no-dkms sudo ldconfig