diff --git a/packages/kmod-6.1-neuron/Cargo.toml b/packages/kmod-6.1-neuron/Cargo.toml new file mode 100644 index 00000000000..32e69917313 --- /dev/null +++ b/packages/kmod-6.1-neuron/Cargo.toml @@ -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" } diff --git a/packages/kmod-6.1-neuron/kmod-6.1-neuron.spec b/packages/kmod-6.1-neuron/kmod-6.1-neuron.spec new file mode 100644 index 00000000000..fec667013ef --- /dev/null +++ b/packages/kmod-6.1-neuron/kmod-6.1-neuron.spec @@ -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 diff --git a/packages/kmod-6.1-neuron/latest-srpm-url.sh b/packages/kmod-6.1-neuron/latest-srpm-url.sh new file mode 100755 index 00000000000..5bb6c85ec9c --- /dev/null +++ b/packages/kmod-6.1-neuron/latest-srpm-url.sh @@ -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_:/_://_' diff --git a/packages/kmod-6.1-neuron/neuron-modules-load.conf b/packages/kmod-6.1-neuron/neuron-modules-load.conf new file mode 100644 index 00000000000..aba019c2e22 --- /dev/null +++ b/packages/kmod-6.1-neuron/neuron-modules-load.conf @@ -0,0 +1 @@ +neuron diff --git a/packages/kmod-6.1-neuron/neuron-systemd-modules-load.drop-in.conf b/packages/kmod-6.1-neuron/neuron-systemd-modules-load.drop-in.conf new file mode 100644 index 00000000000..0b1302960d1 --- /dev/null +++ b/packages/kmod-6.1-neuron/neuron-systemd-modules-load.drop-in.conf @@ -0,0 +1,2 @@ +[Service] +ExecStartPre=-/usr/bin/depmod