I currently build a custom Rocky Linux 10 kernel rpm using rpmbuild. It’s broken up into three main steps:
- I run
rmbuild -bpto run %prep - Apply some kernel patches to kernel.spec.
- I run
rpmbuild --with baseonly --without debug --without debuginfo --without kabichk -bbto build the kernel rpms.
I try to keep the modifications to kernel.spec to a minimum, but a recent addition in 10.1 (6.12.0-124.8.1.el10.x86_64) is messing with my process. In particular these five lines:
# SBAT data
%if 0%{?rocky}
sed -i '2a kernel-uki-virt.rocky,1,RESF,kernel-uki-virt,@KVER,mailto:security@rockylinux.org' %{SOURCE83}
sed -i '2a kernel-uki-virt-addons.rocky,1,RESF,kernel-uki-virt-addons,@KVER,mailto:security@rockylinux.org' %{SOURCE84}
%endif
The problem is that this is updating both source templates (SOURCE83==uki.sbat.template and SOURCE84==uki-addons.sbat.template) twice, once in step 1 and a second time in step 3. This then causes ukify to bomb out when building the rpms:
# ukify build --linux /root/rpmbuild/BUILD/kernel-6.12.0-124.8.1.el10_1/linux-6.12.0-124.8.1.ath_hack.el10.x86_64/arch/x86/boot/bzImage --initrd /root/rpmbuild/BUILDROOT/kernel-6.12.0-124.8.1.ath_hack.el10.x86_64/lib/modules/6.12.0-124.8.1.ath_hack.el10.x86_64/vmlinuz-virt.img --sbat @sbat --os-release @/etc/os-release --uname 6.12.0-124.8.1.ath_hack.el10.x86_64 --cmdline 'console=tty0 console=ttyS0' --output /root/rpmbuild/BUILDROOT/kernel-6.12.0-124.8.1.ath_hack.el10.x86_64/lib/modules/6.12.0-124.8.1.ath_hack.el10.x86_64/vmlinuz-virt.efi
Traceback (most recent call last):
File "/bin/ukify", line 2198, in <module>
main()
File "/bin/ukify", line 2187, in main
make_uki(opts)
File "/bin/ukify", line 1274, in make_uki
pe_add_sections(uki, unsigned_output)
File "/bin/ukify", line 953, in pe_add_sections
raise PEError(f'Not enough space in existing section {section.name} to append new data.')
Now this is a relatively easy fix (I can remove the sed statements after step 1, but it strikes me as going against the spirit of a deterministic %prep% section. Shouldn’t those lines already exist in the template files without needing to be added or alternatively shouldn’t the spec file check to verify the lines don’t already exist in the templates before adding them? I’m not sure where to report this, maybe a github issue somewhere?
edit: Adding the --noprep argument to step 3 isn’t an option. Doing so causes the rpmbuild to fail entirely.