Getting The RX 480 Running With AMDGPU on Linux

The Basics

Building The Kernel

Getting The Source

git clone -b drm-fixes-4.7 git://people.freedesktop.org/~agd5f/linux

linux

firmware

/lib/firmware

amdgpu

Configuring The Kernel

# apt-get install build-essential gcc-multilib linux-headers ncurses-dev xz-utils fakeroot kernel-package # apt-get build-dep linux

cd

# cp /boot/config-$(uname -r) .config

make menuconfig

Processor type and features - - - > [*] MTRR (Memory Type Range Register) support Device Drivers - - - > Generic Driver Options - - - > -*- Userspace firmware loading support # If you wish to compile the firmware in use the below, if not, don’t. [*] Include in-kernel firmware blobs in kernel binary (amdgpu/polaris10_ce.bin amdgpu/polaris10_mc.bin amdgpu/polaris10_me.bin amdgpu/polaris10_mec2.bin amdgpu/polaris10_mec.bin amdgpu/polaris10_pfp.bin amdgpu/polaris10_rlc.bin amdgpu/polaris10_sdma1.bin amdgpu/polaris10_sdma.bin amdgpu/polaris10_smc.bin amdgpu/polaris10_smc_sk.bin amdgpu/polaris10_uvd.bin amdgpu/polaris10_vce.bin) # Either way point this at where you chose to put the firmware (/lib/firmware) Firmware blobs root directory # For many of the following options you can choose between compiling in or modules Graphics support - - - > Direct Rendering Manager (XFree86 4.1.0 and higher DRI support) AMD GPU [*] Enable amdgpu for CIK parts Sound card support - - - > Advanced Linux Sound Architecture - - - > [*] PCI sound devices - - - > HD-Audio - - - > HD Audio PCI [*] Support initialization patch loading for HD-audio Your sound card Build HDMI/DisplayPort HD-audio codec supported (2048) Pre-allocated buffer size for HD-audio driver

.config

@debian

Building and Installing The Kernel

$ make-kpkg clean $ fakeroot make-kpkg --initrd --revision=1.0.AMDGPU kernel_image kernel_headers -j 9

-j 9

cd

# dpkg -i linux-image-4.7*.deb # dpkg -i linux-headers-4.7*.deb

Mesa

Debian

# apt-get build-dep mesa # apt-get install llvm-3.9 llvm-3.9-dev clang-3.9 clang-3.9-dev libxvmc-dev libxcb-xvmc0-dev libvdpau-dev libomxil-bellagio-dev

llvm-config

ln -s /usr/bin/llvm-config-3.9 /usr/bin/llvm-config

cd

$ git clone git://anongit.freedesktop.org/mesa/mesa $ cd mesa

$ ./autogen.sh --prefix=/usr --enable-texture-float --libdir=/usr/lib/x86_64-linux-gnu/ --with-gallium-drivers=radeonsi,swrast --with-egl-platforms=drm,x11 --enable-glx-tls --enable-shared-glapi --enable-glx --enable-driglx-direct --enable-gles1 --enable-gles2 --enable-gbm --enable-openmax --enable-xa --enable-osmesa --with-radeonsi-llvm-compiler --enable-sysfs --enable-vdpau --enable-xvmc --enable-openmax --enable-nine $ make -j9 # make install

-j9

Ubuntu

$ sudo add-apt-repository ppa:paulo-miguel-dias/mesa $ sudo apt-get update $ sudo apt-get install mesa

Arch Linux

sudo

$ makepkg -sri

llvm-svn lib32-llvm-svn mesa-git lib32-mesa-git

# pacman -U package-name.pkg.tar.xz

Installing Libdrm/AMDGPU

# apt-get install libdrm-amdgpu1 libdrm2 xserver-xorg-video-amdgpu

# pacman -S libdrm xf86-video-amdgpu

DRI

Section "Device" Identifier "AMDGPU" Driver "amdgpu" Option "AccelMethod" "glamor" Option "DRI" "3" EndSection

AMD’s RX 480 has been out for a little over a week now, and in that week Linux gamers have been clamoring or information on whether and how the card works on their favorite distribution. Sure, Ubuntu 16.04 is officially supported by AMD’s proprietary Pro drivers, but what about everyone else, and what if you want to use those AMDGPU open source drivers that have been in the works for so long? Well, it’s definitely possible, but it’s not all that easy.: Here be dragons, big ones. They’re pretty much the kind you’d expect to see flying around Mereen, so if you don’t want to take the chance of breaking your install and some singed eyebrows, turn back now.The parts of the AMDGPU driver that are needed to get the RX 480 working are new, so new that they’re in release candidates and Git repositories. For that reason, this guide is going to focus on Debian Sid, Ubuntu 16.04, and Arch Linux. It is possible elsewhere, but these three are probably going to be the easiest and least frustrating.There is a basic recipe that is required to get the RX 480 running, and that all starts with a build of the kernel that includes firmware support. The best way to do this is using a release candidate of 4.7 from the developers that have been working on Polaris support. The next piece of the puzzle is Mesa 12.1. It’s only available from Git at this point. The last two things are a version of libdrm equal to or newer than 2.4.68 and xf86-video-amdgpu(the package name differs slightly by distro) equal to or newer than 1.1.0. If they are being built from source, LLVM and Clang 3.7 or better are also needed.The first step in getting the RX 480 working with AMDGPU is to get a kernel that supports it. There is a branch of the kernel available though Git that will work perfectly. Create a build directory to work in and clone the branch into there.It will take several minutes to finish, but afterward, the source will be available in a folder called. Before going any further, get the Polaris firmware blobs from Alex Deucher’s repository. It can be found here here . The Polaris 10 blobs are the ones needed for the RX 480. There’s two options for where to put them, either in thedirectory with the kernel source or in the root directory atEither way create a directory calledto put them in. On Arch, it might actually be there already.As of now, Kernel 4.7-rc7 supports AMDGPU as well. You can use the source from Kernel.org , and use that instead.Arch Linux users should switch over to the Arch documentation on traditional kernel builds for this part. There’s no sense in reinventing the wheel. You can find it here . For Debian and Ubuntu, there are some packages that you need to install first.When that finishes,into the folder. You can either choose to configure the kernel entirely from scratch, or you can copy the existing configuration. To copy the configuration, run:Either way, when you’re ready to configure the kernel, run. This guide isn’t going to go too far into kernel configuration. If you’re not too comfortable with it, go back and copy the configuration.The above is the set of configuration options needed for AMDGPU to work. The rest of the kernel is up to you. On Debian, if you copied the configuration, one of the developers decided to require a key to build the kernel. To get around that(There’s probably a more secure way to handle this), comment out the line requiring it in the. To find it, just open the file in an editor that supports search and search forNow that the kernel is configured, it’s time to build the kernel packages. To do so, run the following two commands.Theshould be the number of CPU cores on the system plus one. It will help to cut down on the lengthy kernel compile process. After the compile, there will be two .deb packages located in the parent directory of the build.into that directory and install the packages as root.The exact package names that are created will be slightly different from the ones above, but the commands above should work. If not, you can always enter the full names of the packages. Once the packages are installed, and you’re sure they’ve installed correctly, restart.The absolute latest Mesa(12.1 as of writing this) is required for AMDGPU to work properly. The the best way to install Mesa differs based on the distribution being used, so he next part is broken down by distribution.Debian doesn’t have a packaged version of Mesa 12.1, so it has to be pulled directly from the Git repository and built. Before doing that, make sure that all of the dependencies to build Mesa are installed.Try to run. If that doesn't work, you need to link llvm-config-3.9 to llvm-config.Choose a directory to clone the Mesa repository into and clone it. Theninto the Mesa directory.Once inside the directory, configure, compile, and install Mesa.That ridiculously long configuration string basically just configures Mesa to include the RadeonSI drivers and the useful additions that will make it a more complete experience. Again thereferences the number of CPU cores plus one. The good thing is that after these commands, Mesa will be installed. The bad is that it won’t be in the form of a .deb and won’t be as easy to manage.On Ubuntu, the process of installing the latest version of Mesa has been made extremely easy through the use of the Padoka PPA. Simply add the PPA, update, and install mesa.Welcome back Arch users! You don’t have it quite as easy as the Ubuntu people, but there are packages available in the AUR. Before doing this, make sure your computer is set up to use the AUR and that you haveset up on your user account. This guide also assumes that packages are being made with:Pull and install the following packages from the AUR in the order they appear.Beware. This will take a long time. LLVM is a large piece of software. If, for some reason, some packages aren’t automatically installed, they will be in their respective build folders and can be manually installed.It’s almost done! The only thing left to do is to install libdrm and xf86-video-amdgpu. At this point, they should be easily available to the package manager of all three distributions.Once the packages are installed, you can write in some Xorg configuration. It doesn’t appear to be mandatory with AMDGPU, but can help for certain options, like. This basic configuration should work.After that’s written and saved, you can restart your computer and see if everything worked. These drivers are, of course, very experimental. There may be bugs, misconfiguration, or any host of problems. If, however, they do work, you will be one of the first to enjoy a nearly fully open source driver stack that easily rivals the closed source options. It’s pretty clear that if these drivers can remain updated in the mainstream code, AMD will be a very strong option for Linux users in the future.