Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ members = [
"packages/kernel-6.12",
"packages/kmod-6.1-nvidia-r570",
"packages/kmod-6.1-nvidia-r580",
"packages/kmod-6.12-amdgpu",
"packages/kmod-6.12-nvidia-r570",
"packages/kmod-6.12-nvidia-r580",
"packages/nvidia-migmanager",
Expand Down
1 change: 1 addition & 0 deletions kits/bottlerocket-kernel-kit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ kernel-6_1 = { path = "../../packages/kernel-6.1" }
kernel-6_12 = { path = "../../packages/kernel-6.12" }
kmod-6_1-nvidia-r570 = { path = "../../packages/kmod-6.1-nvidia-r570" }
kmod-6_1-nvidia-r580 = { path = "../../packages/kmod-6.1-nvidia-r580" }
kmod-6_12-amdgpu = { path = "../../packages/kmod-6.12-amdgpu" }
kmod-6_12-nvidia-r570 = { path = "../../packages/kmod-6.12-nvidia-r570" }
kmod-6_12-nvidia-r580 = { path = "../../packages/kmod-6.12-nvidia-r580" }
nvidia-migmanager = { path = "../../packages/nvidia-migmanager" }
Expand Down
1 change: 1 addition & 0 deletions packages/kmod-6.12-amdgpu/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.rpm
20 changes: 20 additions & 0 deletions packages/kmod-6.12-amdgpu/COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The Linux Kernel is provided under:
Copy link
Contributor

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


SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note

Being under the terms of the GNU General Public License version 2 only,
according with:

LICENSES/preferred/GPL-2.0

With an explicit syscall exception, as stated at:

LICENSES/exceptions/Linux-syscall-note

In addition, other licenses may also apply. Please see:

Documentation/process/license-rules.rst

for more details.

All contributions to the Linux Kernel are subject to this COPYING file.
20 changes: 20 additions & 0 deletions packages/kmod-6.12-amdgpu/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "kmod-6_12-amdgpu"
version = "0.1.0"
edition = "2021"
publish = false
build = "../build.rs"

[package.metadata.build-package]
package-name = "kmod-6.12-amdgpu"

[lib]
path = "../packages.rs"

[[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
Copy link
Contributor

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.


[build-dependencies]
kernel-6_12 = { path = "../kernel-6.12" }
72 changes: 72 additions & 0 deletions packages/kmod-6.12-amdgpu/kmod-6.12-amdgpu.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
%global kernel_major 6.12
Copy link
Contributor

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.

%global kernel_sources %{_cross_usrsrc}/kernels/%{kernel_major}
%global _cross_kver %{kernel_major}.55
%global _cross_kmoddir %{_cross_libdir}/modules/%{_cross_kver}
%global _ko ko

Name: %{_cross_os}kmod-6.12-amdgpu
Version: 30.10
Release: 1%{?dist}
Summary: AMD GPU drivers for the 6.12 kernel
License: GPL-2.0 WITH Linux-syscall-note
Copy link
Contributor

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.

URL: https://www.amd.com/

Source0: https://repo.radeon.com/amdgpu/30.10.2/el/10/main/x86_64/amdgpu-dkms-6.14.14-2226257.el10.noarch.rpm
Source1: COPYING

BuildRequires: %{_cross_os}kernel-6.12-devel
Requires: %{_cross_os}kernel-6.12
Requires: %{_cross_os}linux-firmware-amd

%description
%{summary}.

%prep
# Extract DKMS source from RPM
Copy link
Contributor

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.

rpm2cpio %{S:0} | cpio -idmu './usr/src/amdgpu-*'
find usr/src/ -mindepth 1 -maxdepth 1 -type d -exec mv {} amdgpu \;
rm -r usr

# Apply Bottlerocket DKMS configuration
pushd amdgpu

# Configure DKMS
KERNELVER=%{_cross_kver} amd/dkms/configure --with-linux=%{kernel_sources}
Copy link
Contributor

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.

Comment on lines +33 to +34
Copy link
Contributor

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


popd

%build
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}\\\"
Copy link
Contributor

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?


popd

%install
# Install license file
install -d %{buildroot}%{_cross_licensedir}/%{name}
install -p -m 0644 %{S:1} %{buildroot}%{_cross_licensedir}/%{name}/
Copy link
Contributor

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/
Copy link
Contributor

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:

Suggested change
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/
Comment on lines +54 to +55
Copy link
Contributor

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.

install -p -m 644 amdgpu/amddrm_buddy.ko %{buildroot}%{_cross_kmoddir}/kernel/drivers/gpu/drm/amd/amdgpu/
install -p -m 644 amdgpu/amddrm_exec.ko %{buildroot}%{_cross_kmoddir}/kernel/drivers/gpu/drm/amd/amdgpu/
install -p -m 644 amdgpu/scheduler/amd-sched.ko %{buildroot}%{_cross_kmoddir}/kernel/drivers/gpu/drm/amd/amdgpu/
install -p -m 644 amdgpu/amd/amdxcp/amdxcp.ko %{buildroot}%{_cross_kmoddir}/kernel/drivers/gpu/drm/amd/amdgpu/
install -p -m 644 amdgpu/amd/amdgpu/amdgpu.ko %{buildroot}%{_cross_kmoddir}/kernel/drivers/gpu/drm/amd/amdgpu/

%files
%license %{_cross_licensedir}/%{name}/COPYING
%{_cross_attribution_file}
%{_cross_kmoddir}/kernel/drivers/gpu/drm/amd/amdgpu/amdkcl.%{_ko}
%{_cross_kmoddir}/kernel/drivers/gpu/drm/amd/amdgpu/amdttm.%{_ko}
%{_cross_kmoddir}/kernel/drivers/gpu/drm/amd/amdgpu/amddrm_ttm_helper.%{_ko}
%{_cross_kmoddir}/kernel/drivers/gpu/drm/amd/amdgpu/amddrm_buddy.%{_ko}
%{_cross_kmoddir}/kernel/drivers/gpu/drm/amd/amdgpu/amddrm_exec.%{_ko}
%{_cross_kmoddir}/kernel/drivers/gpu/drm/amd/amdgpu/amd-sched.%{_ko}
%{_cross_kmoddir}/kernel/drivers/gpu/drm/amd/amdgpu/amdxcp.%{_ko}
%{_cross_kmoddir}/kernel/drivers/gpu/drm/amd/amdgpu/amdgpu.%{_ko}
Loading