@@ -12,9 +12,11 @@ URL: https://www.kernel.org/
1212# Use latest-kernel-srpm-url.sh to get this.
1313Source0: https://cdn.amazonlinux.com/al2023/blobstore/90e970acea5d658008c0707a6c4953b0e877f85b122cd967525bfecb043af96b/kernel6.12-6.12.46-66.121.amzn2023.src.rpm
1414Source1: gpgkey-B21C50FA44A99720EAA72F7FE951904AD832C631.asc
15- # Use latest-neuron-srpm-url.sh to get this.
15+ # Use latest-2.21- neuron-srpm-url.sh to get this.
1616Source2: https://yum.repos.neuron.amazonaws.com/aws-neuronx-dkms-2.21.37.0.noarch .rpm
17- Source3: gpgkey-00FA2C1079260870A76D2C285749CAD8646D9185.asc
17+ # Use latest-neuron-srpm-url.sh to get this.
18+ Source3: https://yum.repos.neuron.amazonaws.com/aws-neuronx-dkms-2.24.7.0.noarch .rpm
19+ Source4: gpgkey-00FA2C1079260870A76D2C285749CAD8646D9185.asc
1820
1921# Custom Bottlerocket kernel configurations.
2022Source100: config-bottlerocket
@@ -33,9 +35,12 @@ Source202: fipsmodules-aarch64
3335# Adjust kernel-devel mount behavior if not squashfs.
3436Source210: var-lib-kernel-devel-lower.mount.drop-in.conf.in
3537
36- # Neuron-related drop-ins.
37- Source220: neuron-sysinit.target.drop-in.conf
38- 38+ # Neuron-related configuration and unit files
39+ Source220: neuron-tmpfiles.conf
40+ Source221: neuron-inf1.toml
41+ Source222: neuron-latest.toml
42+ Source223: load-neuron-inf1-modules.service
43+ Source224: load-neuron-latest-modules.service
3944
4045# Bootconfig snippets to adjust the default kernel command line for the platform.
4146Source300: bootconfig-aws.conf
@@ -228,11 +233,20 @@ rm -f ../config-* ../*.patch
228233
229234%if "%{_cross_arch }" == "x86_64 "
230235cd %{_builddir }
231- rpmkeys --import %{S:3 } --dbpath "${PWD}/rpmdb"
236+ # 2.21 for inf1 support
237+ rpmkeys --import %{S:4 } --dbpath "${PWD}/rpmdb"
232238rpmkeys --checksig %{S:2 } --dbpath "${PWD}/rpmdb"
233239rm -rf "${PWD}/rpmdb"
234240rpm2cpio %{S:2 } | cpio -idmu './usr/src/aws-neuronx-*'
235- find usr/src/ -mindepth 1 -maxdepth 1 -type d -exec mv {} neuron \;
241+ find usr/src/ -mindepth 1 -maxdepth 1 -type d -exec mv {} neuron_2_21 \;
242+ rm -r usr
243+
244+ # latest neuron driver
245+ rpmkeys --import %{S:4 } --dbpath "${PWD}/rpmdb"
246+ rpmkeys --checksig %{S:3 } --dbpath "${PWD}/rpmdb"
247+ rm -rf "${PWD}/rpmdb"
248+ rpm2cpio %{S:3 } | cpio -idmu './usr/src/aws-neuronx-*'
249+ find usr/src/ -mindepth 1 -maxdepth 1 -type d -exec mv {} neuron_latest \;
236250rm -r usr
237251%endif
238252
@@ -252,7 +266,8 @@ make -s\\\
252266%kmake %{?_smp_mflags } modules
253267
254268%if "%{_cross_arch }" == "x86_64 "
255- %kmake %{?_smp_mflags } M= %{_builddir }/neuron
269+ %kmake %{?_smp_mflags } M= %{_builddir }/neuron_2_21
270+ %kmake %{?_smp_mflags } M= %{_builddir }/neuron_latest
256271%endif
257272
258273make -C tools/bpf/bpftool bootstrap
@@ -263,7 +278,12 @@ make -C tools/bpf/bpftool bootstrap
263278%kmake %{?_smp_mflags } modules_install
264279
265280%if "%{_cross_arch }" == "x86_64 "
266- %kmake %{?_smp_mflags } M= %{_builddir }/neuron modules_install
281+ install -d %{buildroot }%{_cross_libexecdir }/neuron/neuron_2_21/
282+ install -d %{buildroot }%{_cross_libexecdir }/neuron/neuron_latest/
283+ %kmake %{?_smp_mflags } INSTALL_MOD_DIR= neuron_2_21 M= %{_builddir }/neuron_2_21 modules_install
284+ %kmake %{?_smp_mflags } INSTALL_MOD_DIR= neuron_latest M= %{_builddir }/neuron_latest modules_install
285+ mv %{buildroot }%{_cross_kmoddir }/neuron_2_21/neuron.%{_ko } %{buildroot }%{_cross_libexecdir }/neuron/neuron_2_21/
286+ mv %{buildroot }%{_cross_kmoddir }/neuron_latest/neuron.%{_ko } %{buildroot }%{_cross_libexecdir }/neuron/neuron_latest/
267287%endif
268288
269289install -d %{buildroot }/boot
@@ -387,12 +407,23 @@ mkdir -p %{buildroot}%{_cross_datadir}/xfsprogs/mkfs
387407ln -s lts_6.12.conf %{buildroot }%{_cross_datadir }/xfsprogs/mkfs/default.conf
388408
389409%if "%{_cross_arch }" == "x86_64 "
390- # Add Neuron-related drop-ins to load the module when the hardware is present.
391- mkdir -p %{buildroot }%{_cross_unitdir }/sysinit.target.d
392- install -p -m 0644 %{S:220 } %{buildroot }%{_cross_unitdir }/sysinit.target.d/neuron.conf
410+ # Add Neuron-related configuration files to load the module when the hardware is present.
411+ install -d 0644 %{buildroot }%{_cross_tmpfilesdir }
412+ sed \
413+ -e "s|__KERNEL_VERSION__|%{kmajor }|" \
414+ -e "s|__PREFIX__|%{_cross_prefix }|" %{S:220 } > neuron.conf
415+ install -p -m 0644 neuron.conf %{buildroot }%{_cross_tmpfilesdir }/
416+ install -d 0644 %{buildroot }%{_cross_factorydir }%{_cross_sysconfdir }/drivers
417+ # inf1
418+ sed -e 's|__NEURON_MODULES__|%{_cross_datadir }/neuron|' %{S:221 } > \
419+ neuron-inf1.toml
420+ install -m 0644 neuron-inf1.toml %{buildroot }%{_cross_factorydir }%{_cross_sysconfdir }/drivers
421+ # latest
422+ sed -e 's|__NEURON_MODULES__|%{_cross_datadir }/neuron|' %{S:222 } > \
423+ neuron-latest.toml
424+ install -m 0644 neuron-latest.toml %{buildroot }%{_cross_factorydir }%{_cross_sysconfdir }/drivers
425+ install -p -m 0644 %{S:223 } %{S:224 } %{buildroot }%{_cross_unitdir }
393426
394- mkdir -p %{
buildroot }%{
_cross_unitdir }/
[email protected] 395- install -p -m 0644 %{
S:221 } %{
buildroot }%{
_cross_unitdir }/
[email protected] /neuron.conf
396427%endif
397428
398429# Install platform-specific bootconfig snippets.
@@ -1412,9 +1443,13 @@ install -p -m 0644 %{S:301} %{buildroot}%{_cross_bootconfigdir}/05-vmware.conf
14121443
14131444%if "%{_cross_arch }" == "x86_64 "
14141445%files modules-neuron
1415- %{_cross_kmoddir }/updates/neuron.%{_ko }
1416- %{_cross_unitdir }/sysinit.target.d/neuron.conf
1417- %{
_cross_unitdir }/
[email protected] /neuron.conf
1446+ %{_cross_libexecdir }/neuron/neuron_2_21/neuron.%{_ko }
1447+ %{_cross_libexecdir }/neuron/neuron_latest/neuron.%{_ko }
1448+ %{_cross_tmpfilesdir }/neuron.conf
1449+ %{_cross_unitdir }/load-neuron-inf1-modules.service
1450+ %{_cross_unitdir }/load-neuron-latest-modules.service
1451+ %{_cross_factorydir }%{_cross_sysconfdir }/drivers/neuron-inf1.toml
1452+ %{_cross_factorydir }%{_cross_sysconfdir }/drivers/neuron-latest.toml
14181453%endif
14191454
14201455%changelog
0 commit comments