@@ -9,9 +9,11 @@ URL: https://www.kernel.org/
99# Use latest-kernel-srpm-url.sh to get this.
1010Source0: https://cdn.amazonlinux.com/al2023/blobstore/f3b09a804dce910af99d51994144a9e73322ac17d13feb47547b70b7833fa40a/kernel-6.1.155-176.282.amzn2023.src.rpm
1111Source1: gpgkey-B21C50FA44A99720EAA72F7FE951904AD832C631.asc
12- # Use latest-neuron-srpm-url.sh to get this.
12+ # Use latest-2.21- neuron-srpm-url.sh to get this.
1313Source2: https://yum.repos.neuron.amazonaws.com/aws-neuronx-dkms-2.21.37.0.noarch .rpm
14- Source3: gpgkey-00FA2C1079260870A76D2C285749CAD8646D9185.asc
14+ # Use latest-neuron-srpm-url.sh to get this.
15+ Source3: https://yum.repos.neuron.amazonaws.com/aws-neuronx-dkms-2.24.7.0.noarch .rpm
16+ Source4: gpgkey-00FA2C1079260870A76D2C285749CAD8646D9185.asc
1517
1618# Custom Bottlerocket kernel configurations.
1719Source100: config-bottlerocket
@@ -30,9 +32,12 @@ Source202: fipsmodules-aarch64
3032# Adjust kernel-devel mount behavior if not squashfs.
3133Source210: var-lib-kernel-devel-lower.mount.drop-in.conf.in
3234
33- # Neuron-related drop-ins.
34- Source220: neuron-sysinit.target.drop-in.conf
35- 35+ # Neuron-related configuration and unit files
36+ Source220: neuron-tmpfiles.conf.in
37+ Source221: neuron-inf1.toml.in
38+ Source222: neuron-latest.toml.in
39+ Source223: load-neuron-inf1-modules.service
40+ Source224: load-neuron-latest-modules.service
3641
3742# Bootconfig snippets to adjust the default kernel command line for the platform.
3843Source300: bootconfig-aws.conf
@@ -252,11 +257,20 @@ rm -f ../config-* ../*.patch
252257
253258%if "%{_cross_arch }" == "x86_64 "
254259cd %{_builddir }
255- rpmkeys --import %{S:3 } --dbpath "${PWD}/rpmdb"
260+ # 2.21 for inf1 support
261+ rpmkeys --import %{S:4 } --dbpath "${PWD}/rpmdb"
256262rpmkeys --checksig %{S:2 } --dbpath "${PWD}/rpmdb"
257263rm -rf "${PWD}/rpmdb"
258264rpm2cpio %{S:2 } | cpio -idmu './usr/src/aws-neuronx-*'
259- find usr/src/ -mindepth 1 -maxdepth 1 -type d -exec mv {} neuron \;
265+ find usr/src/ -mindepth 1 -maxdepth 1 -type d -exec mv {} neuron_2_21 \;
266+ rm -r usr
267+
268+ # latest neuron driver
269+ rpmkeys --import %{S:4 } --dbpath "${PWD}/rpmdb"
270+ rpmkeys --checksig %{S:3 } --dbpath "${PWD}/rpmdb"
271+ rm -rf "${PWD}/rpmdb"
272+ rpm2cpio %{S:3 } | cpio -idmu './usr/src/aws-neuronx-*'
273+ find usr/src/ -mindepth 1 -maxdepth 1 -type d -exec mv {} neuron_latest \;
260274rm -r usr
261275%endif
262276
@@ -276,15 +290,21 @@ make -s\\\
276290%kmake %{?_smp_mflags } modules
277291
278292%if "%{_cross_arch }" == "x86_64 "
279- %kmake %{?_smp_mflags } M= %{_builddir }/neuron
293+ %kmake %{?_smp_mflags } M= %{_builddir }/neuron_2_21
294+ %kmake %{?_smp_mflags } M= %{_builddir }/neuron_latest
280295%endif
281296
282297%install
283298%kmake %{?_smp_mflags } headers_install
284299%kmake %{?_smp_mflags } modules_install
285300
286301%if "%{_cross_arch }" == "x86_64 "
287- %kmake %{?_smp_mflags } M= %{_builddir }/neuron modules_install
302+ install -d %{buildroot }%{_cross_libexecdir }/neuron/neuron_2_21/
303+ install -d %{buildroot }%{_cross_libexecdir }/neuron/neuron_latest/
304+ %kmake %{?_smp_mflags } INSTALL_MOD_DIR= neuron_2_21 M= %{_builddir }/neuron_2_21 modules_install
305+ %kmake %{?_smp_mflags } INSTALL_MOD_DIR= neuron_latest M= %{_builddir }/neuron_latest modules_install
306+ mv %{buildroot }%{_cross_kmoddir }/neuron_2_21/neuron.ko.gz %{buildroot }%{_cross_libexecdir }/neuron/neuron_2_21/
307+ mv %{buildroot }%{_cross_kmoddir }/neuron_latest/neuron.ko.gz %{buildroot }%{_cross_libexecdir }/neuron/neuron_latest/
288308%endif
289309
290310install -d %{buildroot }/boot
@@ -426,12 +446,22 @@ sed -e 's|PREFIX|%{_cross_prefix}|g' %{S:210} \
426446 > %{buildroot }%{_cross_unitdir }/"${LOWERPATH}.mount.d"/no-squashfs.conf
427447
428448%if "%{_cross_arch }" == "x86_64 "
429- # Add Neuron-related drop-ins to load the module when the hardware is present.
430- mkdir -p %{buildroot }%{_cross_unitdir }/sysinit.target.d
431- install -p -m 0644 %{S:220 } %{buildroot }%{_cross_unitdir }/sysinit.target.d/neuron.conf
432-
433- mkdir -p %{
buildroot }%{
_cross_unitdir }/
[email protected] 434- install -p -m 0644 %{
S:221 } %{
buildroot }%{
_cross_unitdir }/
[email protected] /neuron.conf
449+ # Add Neuron-related configuration files to load the module when the hardware is present.
450+ install -d 0644 %{buildroot }%{_cross_tmpfilesdir }
451+ sed \
452+ -e "s|__KERNEL_VERSION__|%{version }|" \
453+ -e "s|__PREFIX__|%{_cross_prefix }|" %{S:220 } > neuron.conf
454+ install -p -m 0644 neuron.conf %{buildroot }%{_cross_tmpfilesdir }/
455+ install -d 0644 %{buildroot }%{_cross_factorydir }%{_cross_sysconfdir }/drivers
456+ # inf1
457+ sed -e 's|__NEURON_MODULES__|%{_cross_libexecdir }/neuron|' %{S:221 } > \
458+ neuron-inf1.toml
459+ install -m 0644 neuron-inf1.toml %{buildroot }%{_cross_factorydir }%{_cross_sysconfdir }/drivers
460+ # latest
461+ sed -e 's|__NEURON_MODULES__|%{_cross_libexecdir }/neuron|' %{S:222 } > \
462+ neuron-latest.toml
463+ install -m 0644 neuron-latest.toml %{buildroot }%{_cross_factorydir }%{_cross_sysconfdir }/drivers
464+ install -p -m 0644 %{S:223 } %{S:224 } %{buildroot }%{_cross_unitdir }
435465%endif
436466
437467# Install platform-specific bootconfig snippets.
@@ -1501,9 +1531,13 @@ install -p -m 0644 %{S:302} %{buildroot}%{_cross_bootconfigdir}/05-metal.conf
15011531
15021532%if "%{_cross_arch }" == "x86_64 "
15031533%files modules-neuron
1504- %{_cross_kmoddir }/extra/neuron.ko.gz
1505- %{_cross_unitdir }/sysinit.target.d/neuron.conf
1506- %{
_cross_unitdir }/
[email protected] /neuron.conf
1534+ %{_cross_libexecdir }/neuron/neuron_2_21/neuron.ko.gz
1535+ %{_cross_libexecdir }/neuron/neuron_latest/neuron.ko.gz
1536+ %{_cross_tmpfilesdir }/neuron.conf
1537+ %{_cross_unitdir }/load-neuron-inf1-modules.service
1538+ %{_cross_unitdir }/load-neuron-latest-modules.service
1539+ %{_cross_factorydir }%{_cross_sysconfdir }/drivers/neuron-inf1.toml
1540+ %{_cross_factorydir }%{_cross_sysconfdir }/drivers/neuron-latest.toml
15071541%endif
15081542
15091543%changelog
0 commit comments