Skip to content

Commit

Permalink
Merge pull request #3982 from bcressey/neuron-kmod
Browse files Browse the repository at this point in the history
packages: add neuron kmod for 6.1 kernel
  • Loading branch information
bcressey authored May 24, 2024
2 parents 87aed3a + bdb49c3 commit 1982df7
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 0 deletions.
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"

[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

0 comments on commit 1982df7

Please sign in to comment.