How to install AMDGPU drivers on Debian 9 Stretch Linux

Introduction

So, you’ve got an AMD GPU, and you want to use it on Debian Stretch. Well, you’re actually in luck.

Installing the open source AMD drivers on Debian Stretch may just be the easiest and simplest install process in the history of Linux graphics drivers.

Anyone who tried to install the open source AMDGPU drivers when they first launched alongside AMD’s Polaris cards will tell you that the process is long and painful, and they were right.

Now, all of the packages required have entered the mainstream, and most are actually installed by default with your Debian Stretch installation.

Required Packages

There are still some packages that need to be installed and some things that need to be done to get the drivers working. The first thing you need to do is enable the contrib and non-free repositories in Debian.

Yes, the drivers are open source, but they do require firmware blobs to function properly.

In your /etc/apt/sources.list add contrib non-free after main on every line. When that’s done, close your text editor and run:

# apt update && apt upgrade

You should be using apt instead of apt-get by now. apt is the newer and better command. In creating this guide, kernel 4.9 was being kept back by apt-get but installed perfectly fine with apt.

Linux Firmware

Alright, so now you’re ready to install the single package that makes this possible. Because Debian doesn’t ship firmware blobs by default, the required firmware is available but not installed. Install it with the command below.

# apt install firmware-linux

That’s really it. Now, don’t restart just yet. There is another important part.



LLVM

LLVM is required to build Mesa, and it is used by some of the graphical packages. You may be able to get by without it, but it’s a good idea to make sure that your system has the right version installed, just in case.

In order for Mesa to be built with AMDGPU support, LLVM 3.9 or greater is needed. At the time of this article, 3.9 is still the latest version, but 4.0 is available as a release client.

Meanwhile, Stretch is still shipping 3.7 and 3.8 as well as 3.9. Install 3.9 or 4.X now to make sure that the older versions are not pulled in.

# apt install llvm-3.9 clang-3.9

Restart and Test

Now you can restart your system for the changes to take effect and the firmware to be loaded. On the reboot, you should see the screen change while loading and possibly hear the fan spin up on your graphics card.

That’s an indication that the firmware has been loaded.

To test out your graphics card, download the Phoronix Test Suite Debian package

http://phoronix-test-suite.com/releases/repo/pts.debian/files/phoronix-test-suite_6.8.0_all.deb

It’s dependent on PHP, so install that first, and install it with dpkg.

# apt install php7.0 php7.0-cli php7.0-xml
$ cd ~/Downloads
# dpkg -i phoronix-test-suite_6.8.0_all.deb

After the packages install, you can run the Unigine tests or any of the tests available to see what your card can do.

$ phoronix-test-suite run unigine-heaven

Conclusion

AMDGPU has reached the beginning of the realization of the dream; no driver installs.

With Stretch, Debian has reached a point where getting a top-quality graphics experience from an AMD card is as simple as installing a couple of packages.

That’s an amazing thing, considering how far Linux drivers have come.