first commit

This commit is contained in:
Ward 2023-02-23 22:04:10 +02:00
commit c334396843
15 changed files with 189 additions and 0 deletions

1
orig.source.txt Normal file
View File

@ -0,0 +1 @@
Source is this git's root

View File

@ -0,0 +1,23 @@
pika-amdgpu-core (100:22.40.50401-1518373~22.04) kinetic; urgency=low
* add a firmware apt hook
-- Ward Nakchbandi <hotrod.master@hotmail.com> Sat, 01 Oct 2022 14:50:00 +0200
pika-amdgpu-core (100:22.20.50205-1511376~22.04-14) kinetic; urgency=low
* switch to systemd service
-- Ward Nakchbandi <hotrod.master@hotmail.com> Sat, 01 Oct 2022 14:50:00 +0200
pika-amdgpu-core (100:22.20.50205-1511376~22.04-13) kinetic; urgency=low
* remove broken apt hook
-- Ward Nakchbandi <hotrod.master@hotmail.com> Sat, 01 Oct 2022 14:50:00 +0200
pika-amdgpu-core (100:22.20.50205-1511376~22.04) kinetic; urgency=low
* Initial Creation
-- Ward Nakchbandi <hotrod.master@hotmail.com> Sat, 01 Oct 2022 14:50:00 +0200

View File

@ -0,0 +1,17 @@
Source: pika-amdgpu-core
Section: metapackages
Priority: optional
Maintainer: Ward Nakchbandi <hotrod.master@hotmail.com>
Build-Depends: debhelper-compat (= 13)
Standards-Version: 4.6.1
Homepage: https://repo.radeon.com/
Package: pika-amdgpu-core
Section: metapackages
Architecture: all
Depends: ${misc:Depends}, libdrm-amdgpu-amdgpu1, libdrm-amdgpu-radeon1, libdrm2-amdgpu, libdrm-amdgpu-common, amdgpu-dkms-firmware
Suggests: amdgpu-vulkan-switcher, amdgpu-opengl-switcher, amdgpu-opencl-switcher, pika-amdgpu-config
Provides: amdgpu-core, amdgpu-pro-core, amdgpu-dkms, amdgpu-pro-lib32
Multi-Arch: foreign
Description: Core meta package for Pro components of the unified amdgpu driver, with mesa priority.

View File

@ -0,0 +1,8 @@
Files: *
Copyright: 2022 Ward Nakchbandi <hotrod.master@hotmail.com>
License: GPL-2
Files: debian/*
Copyright: 2022 Ward Nakchbandi <hotrod.master@hotmail.com>
License: GPL-2

View File

@ -0,0 +1,2 @@
etc
usr

View File

@ -0,0 +1,21 @@
#!/bin/sh
set -e
# Enable systemd service
systemctl enable --now amdgpu-pro-lib.service || echo "amdgpu-pro-lib service could not be enabled"
# Add firmware
rm -r /usr/src/amdgpu-official || echo
ln -s /usr/src/"$(ls /usr/src/ | grep amdgpu- | sort -nr | head -n1)" /usr/src/amdgpu-official
rm -r /usr/lib/firmware/amdgpu || echo
ln -s /usr/src/amdgpu-official/firmware/amdgpu /usr/lib/firmware/
update-initramfs -c -k all
#

View File

@ -0,0 +1,11 @@
#!/bin/sh
set -e
systemctl disable --now amdgpu-pro-lib.service || echo "amdgpu-pro-lib service could not be disabled"
rm -r /usr/lib/firmware/amdgpu || echo
update-initramfs -c -k all
# Add firmware

3
pika-amdgpu-core/debian/rules Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/make -f
%:
dh $@

View File

@ -0,0 +1 @@
3.0 (native)

View File

@ -0,0 +1,2 @@
DPkg::Pre-Install-Pkgs {"/usr/share/dpkg/scripts/amdgpu-firmware-hook.sh pre";};
DPkg::Post-Invoke {"/usr/share/dpkg/scripts/amdgpu-firmware-hook.sh post";};

View File

@ -0,0 +1,2 @@
DISABLE_LAYER_AMD_SWITCHABLE_GRAPHICS_1=1
ROC_ENABLE_PRE_VEGA=1

View File

@ -0,0 +1,8 @@
[Unit]
Description=Prevents AMDGPU-PRO dangerous behaviour and symlinks its firmware and libraries to sytem path.
[Service]
ExecStart=/usr/bin/amdgpu-lib-refresh
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,5 @@
#! /bin/bash
sudo /usr/bin/amdgpu-lib-refresh
sudo update-initramfs -c -k all

View File

@ -0,0 +1,61 @@
#! /bin/bash
# Disables amdgpu-pro libraries to fallback to mesa
# USE wrappers instead
export PRO_DISABLED=0
export AMD_DISABLED=0
export BIN_AMD_DISABLED=0
export BIN_INTEL_DISABLED=0
export ENC_EXISTS=0
export AMF_EXISTS=0
# Add firmware
rm -r /usr/src/amdgpu-official || echo
ln -s /usr/src/"$(ls /usr/src/ | grep amdgpu- | sort -nr | head -n1)" /usr/src/amdgpu-official
rm -r /usr/lib/firmware/amdgpu || echo
ln -s /usr/src/amdgpu-official/firmware/amdgpu /usr/lib/firmware/
#
cat /etc/ld.so.conf.d/10-amdgpu-pro.conf | grep "#" && export PRO_DISABLED=1
cat /etc/ld.so.conf.d/20-amdgpu.conf | grep "#" && export AMD_DISABLED=1
cat /etc/ld.so.conf.d/10-amdgpu-pro-x86_64.conf | grep "#" && export BIN_AMD_DISABLED=1
cat /etc/ld.so.conf.d/10-amdgpu-pro-i386.conf | grep "#" && export BIN_INTEL_DISABLED=1
ls /opt/amdgpu-pro/lib/x86_64-linux-gnu/libamdenc* && export ENC_EXISTS=1
ls /opt/amdgpu-pro/lib/x86_64-linux-gnu/libamf* && export AMF_EXISTS=1
if [[ "${PRODISABLED}" != 1 ]]; then
sed -i.old -e 's/^/#/' /etc/ld.so.conf.d/10-amdgpu-pro.conf
fi
if [[ "${AMDDISABLED}" != 1 ]]; then
sed -i.old -e 's/^/#/' /etc/ld.so.conf.d/20-amdgpu.conf
fi
if [[ "${BIN_AMD_DISABLED}" != 1 ]]; then
sed -i.old -e 's/^/#/' /etc/ld.so.conf.d/10-amdgpu-pro-x86_64.conf
fi
if [[ "${BIN_INTEL_DISABLED}" != 1 ]]; then
sed -i.old -e 's/^/#/' /etc/ld.so.conf.d/10-amdgpu-pro-i386.conf
fi
if [[ "${ENC_EXISTS}" != 0 ]]; then
ln -s /opt/amdgpu-pro/lib/x86_64-linux-gnu/libamdenc* /usr/lib/x86_64-linux-gnu/
fi
if [[ "${AMF_EXISTS}" != 0 ]]; then
ln -s /opt/amdgpu-pro/lib/x86_64-linux-gnu/libamf* /usr/lib/x86_64-linux-gnu/
fi
ldconfig

View File

@ -0,0 +1,24 @@
#! /bin/bash
if [[ $1 == pre ]]
then
if grep -q amdgpu-dkms-firmware
then
mkdir -p /var/lib/apt/hooks
touch /var/lib/apt/hooks/amdgpu-dkms-firmware
else
exit 0
fi
fi
if [[ $1 == post ]]
then
if [[ -f /var/lib/apt/hooks/amdgpu-dkms-firmware ]]
then
amdgpu-firmware-refresh
rm -rf /var/lib/apt/hooks/amdgpu-dkms-firmware
else
exit 0
fi
fi