-
Notifications
You must be signed in to change notification settings - Fork 519
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3982 from bcressey/neuron-kmod
packages: add neuron kmod for 6.1 kernel
- Loading branch information
Showing
5 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[package] | ||
name = "kmod-6_1-neuron" | ||
version = "0.1.0" | ||
edition = "2021" | ||
publish = false | ||
build = "../build.rs" | ||
|
||
[lib] | ||
path = "../packages.rs" | ||
|
||
[package.metadata.build-package] | ||
package-name = "kmod-6.1-neuron" | ||
releases-url = "https://awsdocs-neuron.readthedocs-hosted.com/en/latest/release-notes/runtime/aws-neuronx-dkms/index.html" | ||
|
||
[[package.metadata.build-package.external-files]] | ||
url = "https://yum.repos.neuron.amazonaws.com/aws-neuronx-dkms-2.16.7.0.noarch.rpm" | ||
sha512 = "8e66feb4051af31321c08b6663a950172da65c4e5b432c0b5609785be34ccb193c0eb50c9aadfeec8b6410ccbe05264a3fb6fc7cb66dc87b172bc5be5c4d92d0" | ||
|
||
[build-dependencies] | ||
kernel-6_1 = { path = "../kernel-6.1" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
Name: %{_cross_os}kmod-6.1-neuron | ||
Version: 2.16.7.0 | ||
Release: 1%{?dist} | ||
Summary: Neuron drivers for the 6.1 kernel | ||
License: GPL-2.0-only | ||
URL: https://awsdocs-neuron.readthedocs-hosted.com/en/latest/ | ||
|
||
Source0: https://yum.repos.neuron.amazonaws.com/aws-neuronx-dkms-%{version}.noarch.rpm | ||
Source1: neuron-modules-load.conf | ||
Source2: neuron-systemd-modules-load.drop-in.conf | ||
|
||
BuildRequires: %{_cross_os}glibc-devel | ||
BuildRequires: %{_cross_os}kernel-6.1-archive | ||
|
||
%description | ||
%{summary}. | ||
|
||
%prep | ||
rpm2cpio %{SOURCE0} | cpio -idmv | ||
tar -xf %{_cross_datadir}/bottlerocket/kernel-devel.tar.xz | ||
|
||
%global neuron_sources usr/src/aws-neuronx-%{version} | ||
%global kernel_sources %{_builddir}/kernel-devel | ||
|
||
%build | ||
pushd %{_builddir}/%{neuron_sources} | ||
%make_build \ | ||
-C %{kernel_sources} \ | ||
M=${PWD} \ | ||
ARCH=%{_cross_karch} \ | ||
CROSS_COMPILE=%{_cross_target}- \ | ||
INSTALL_MOD_STRIP=1 \ | ||
%{nil} | ||
gzip -9 neuron.ko | ||
popd | ||
|
||
%install | ||
pushd %{_builddir}/%{neuron_sources} | ||
export KVER="$(cat %{kernel_sources}/include/config/kernel.release)" | ||
export KMODDIR="%{_cross_libdir}/modules/${KVER}/extra" | ||
install -d "%{buildroot}${KMODDIR}" | ||
install -p -m 0644 neuron.ko.gz "%{buildroot}${KMODDIR}" | ||
popd | ||
|
||
# Install modules-load.d drop-in to autoload required kernel modules | ||
install -d %{buildroot}%{_cross_libdir}/modules-load.d | ||
install -p -m 0644 %{S:1} %{buildroot}%{_cross_libdir}/modules-load.d/neuron.conf | ||
|
||
# Install systemd-modules-load drop-in to ensure that depmod runs. | ||
install -d %{buildroot}%{_cross_unitdir}/systemd-modules-load.service.d | ||
install -p -m 0644 %{S:2} %{buildroot}%{_cross_unitdir}/systemd-modules-load.service.d/neuron.conf | ||
|
||
%files | ||
%license %{neuron_sources}/LICENSE | ||
%{_cross_attribution_file} | ||
%{_cross_libdir}/modules/*/extra/neuron.ko.gz | ||
%{_cross_libdir}/modules-load.d/neuron.conf | ||
%{_cross_unitdir}/systemd-modules-load.service.d/neuron.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
cmd=" | ||
dnf install -q -y --releasever=latest yum-utils && | ||
dnf download -q --repofrompath neuron,https://yum.repos.neuron.amazonaws.com --repo=neuron --urls aws-neuronx-dkms | ||
" | ||
docker run --rm amazonlinux:2023 bash -c "${cmd}" \ | ||
| grep '^http' \ | ||
| xargs --max-args=1 --no-run-if-empty realpath --canonicalize-missing --relative-to=. \ | ||
| sed 's_:/_://_' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
neuron |
2 changes: 2 additions & 0 deletions
2
packages/kmod-6.1-neuron/neuron-systemd-modules-load.drop-in.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[Service] | ||
ExecStartPre=-/usr/bin/depmod |