-
Notifications
You must be signed in to change notification settings - Fork 37
Amd gpu support dkms #320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Amd gpu support dkms #320
Conversation
Signed-off-by: Gaurav Sharma <[email protected]>
Signed-off-by: Gaurav Sharma <[email protected]>
| @@ -0,0 +1,72 @@ | |||
| %global kernel_major 6.12 | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can move this into the kernel-6.12 build so its just included with the rest of the kernel built in one shot.
| @@ -0,0 +1,22 @@ | |||
| [package] | |||
| name = "linux-firmware-amd" | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had expected this to just be a sub-package of linux-firmware instead of a new top level package. Can we move this logic into the existing package?
|
|
||
| %files | ||
| %dir %{fwdir} | ||
| %{fwdir}/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we want everything, I think there is a specific set of firmware we want that is only amdgpu related.
| [[package.metadata.build-package.external-files]] | ||
| url = "https://repo.radeon.com/amdgpu/30.10.2/el/10/main/x86_64/amdgpu-dkms-6.14.14-2226257.el10.noarch.rpm" | ||
| sha512 = "ffe054d3673f729786a32cf8a67d69b942348eb12d800073a7efc873fcba8a760485a003ed1bfb5273eda5f7d514263c80a97243371d36bf69ea986137f8c41e" | ||
| force-upstream = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can skip this and treat it like a normal source.
| pushd amdgpu | ||
|
|
||
| # Build using the DKMS Makefile with static configuration | ||
| make modules KERNELVER=%{_cross_kver} kernel_build_dir=%{_cross_usrsrc}/kernels/6.12 CC=%{_cross_target}-gcc ARCH=%{_cross_karch} CROSS_COMPILE=%{_cross_target}- EXTRA_CFLAGS=-DPACKAGE_VERSION=\\\"%{version}\\\" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need the triple \ at the end?
| Version: 30.10 | ||
| Release: 1%{?dist} | ||
| Summary: AMD GPU drivers for the 6.12 kernel | ||
| License: GPL-2.0 WITH Linux-syscall-note |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The license doesn't match the license in the RPM.
| @@ -0,0 +1,20 @@ | |||
| The Linux Kernel is provided under: | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the correct license, the RPM includes a license already:
./share/doc/amdgpu-dkms/LICENSE
| %{summary}. | ||
|
|
||
| %prep | ||
| # Extract DKMS source from RPM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not compiling with DKMS so you could just say extract driver srouces.
| pushd amdgpu | ||
|
|
||
| # Configure DKMS | ||
| KERNELVER=%{_cross_kver} amd/dkms/configure --with-linux=%{kernel_sources} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use the cross_configure macro and likely avoid the flags in the make modules call.
bcressey
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When aarch64 fails, that's a sign that cross-compiling might not be set up correctly. It's not always true, but it's the theory you should work hard to disprove.
Based on that I'd say you should get the aarch64 build at least to the point where it fails from some source-level compatibility. Otherwise I don't trust that the x86_64 build is doing what we think, meaning the configure / make logic may not be correct.
| # Configure DKMS | ||
| KERNELVER=%{_cross_kver} amd/dkms/configure --with-linux=%{kernel_sources} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
configure scripts should not be run during %prep, they go in %build
| %install | ||
| # Install license file | ||
| install -d %{buildroot}%{_cross_licensedir}/%{name} | ||
| install -p -m 0644 %{S:1} %{buildroot}%{_cross_licensedir}/%{name}/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This license should come from usr/share/doc/amdgpu-dkms/LICENSE in the RPM, it shouldn't be included as a source file.
|
|
||
| # Install AMD GPU kernel modules to correct location | ||
| install -d %{buildroot}%{_cross_kmoddir}/kernel/drivers/gpu/drm/amd/amdgpu | ||
| install -p -m 644 amdgpu/amd/amdkcl/amdkcl.ko %{buildroot}%{_cross_kmoddir}/kernel/drivers/gpu/drm/amd/amdgpu/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these should use the %{_ko} macro:
| install -p -m 644 amdgpu/amd/amdkcl/amdkcl.ko %{buildroot}%{_cross_kmoddir}/kernel/drivers/gpu/drm/amd/amdgpu/ | |
| install -p -m 644 amdgpu/amd/amdkcl/amdkcl.%{_ko} %{buildroot}%{_cross_kmoddir}/kernel/drivers/gpu/drm/amd/amdgpu/ |
| install -p -m 644 amdgpu/ttm/amdttm.ko %{buildroot}%{_cross_kmoddir}/kernel/drivers/gpu/drm/amd/amdgpu/ | ||
| install -p -m 644 amdgpu/amddrm_ttm_helper.ko %{buildroot}%{_cross_kmoddir}/kernel/drivers/gpu/drm/amd/amdgpu/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A for loop over the .ko files would be more readable if all these kmods are going into the same directory.
Description of changes:
This PR adds support for AMD GPU drivers to the Bottlerocket kernel kit by introducing two new packages:
These packages enable AMD GPU support for Bottlerocket instances with AMD hardware accelerators.
Testing done:
Terms of contribution:
By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.