Skip to content
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

packages: add neuron kmod for 6.1 kernel #3982

Merged
merged 1 commit into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
20 changes: 20 additions & 0 deletions packages/kmod-6.1-neuron/Cargo.toml
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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this published in the amazon official sites or we generated it from the downloaded binary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the offical site per the documentation.


[build-dependencies]
kernel-6_1 = { path = "../kernel-6.1" }
58 changes: 58 additions & 0 deletions packages/kmod-6.1-neuron/kmod-6.1-neuron.spec
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
9 changes: 9 additions & 0 deletions packages/kmod-6.1-neuron/latest-srpm-url.sh
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_:/_://_'
1 change: 1 addition & 0 deletions packages/kmod-6.1-neuron/neuron-modules-load.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
neuron
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Service]
ExecStartPre=-/usr/bin/depmod
Comment on lines +1 to +2
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't be necessary after we update to a twoliter release with this change:
bottlerocket-os/twoliter#205