Hello everyone,
I would like to rebuild openSUSE kernel RPM, from the respective SRPM.
Main reason for rebuilding is that I want to test recent patches hopefully fixing my suspend issues.
I was thinking SRPM because I want kernel with same settings as openSUSE kernels. Also, if I master the process I will be able to move it to OBS (openSUSE Build Service).
I have already received nice help from @Sauerland in my another post: How to download source package using Zypper
He advised me that the kernel-vanilla.rpm is build with the kernel-source package; for example kernel-vanilla-6.14~rc6-1.1.g5af2a0b.rpm
is produced by:
kernel-source-6.14~rc6-1.1.g5af2a0b.src.rpm
and
kernel-syms-6.14~rc6-1.1.g5af2a0b.src.rpm
.
Zypper is not very helpful in these matters so I downloaded them using browser from the openSUSE official vanilla kernel repository: https://download.opensuse.org/repositories/Kernel:/HEAD/standard/src
I downloaded the patches from here:
(They look like emails so I copied only that part that looked like a patch and tested it with diffstat
and kompare
for validity).
I’m going to build the source RPMs as ordinary user, under my home directory. As advised I configured my RPM build environment:
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros
echo '%_tmppath %{_topdir}/tmp' >> ~/.rpmmacros
As advised I installed the the two downloaded source packages.
cd ~/Downloads
rpm -ivv kernel-source-6.14~rc6-1.1.g5af2a0b.src.rpm
rpm -ivv kernel-syms-6.14~rc6-1.1.g5af2a0b.src.rpm
The -i
is for install, -vv
is for extra verbose output. Only from verbose output one learns where exactly what is installed.
This copies lots of compressed files to ~/rpmbuild/SOURCES/
, including Linux kernel sources as tar.bz2, build configs, and a spec file to ~/rpmbuild/SPECS/
. I was quite surprised everything is copied directly to SOURCES, there is nothing like per package subdirectory.
I wasn’t sure how to “add the patches”. I found several empty patches.*.tar.bz2
archives, with just a directory in there. I picked one and put the patch files there, in that archive directory, with this command:
cd ~/rpmbuild
cd patches
tar -cjf patches.fixes.tar.bz2 --transform='s|^|patches.fixes/|' *.patch
cp patches.fixes.tar.bz2 ../SOURCES/patches.fixes.tar.bz2
As advised I run the rpmbuild -ba
commands:
rpmbuild -ba SPECS/kernel-source.spec
rpmbuild -ba SPECS/kernel-syms.spec
The -ba
means that both binary and source packages are built.
I recommend this variant, with outputs also saved to a log file:
cd ~/rpmbuild
alias now='date +%Y-%m-%d-%H.%M.%S'
rpmbuild -ba SPECS/kernel-source.spec |& tee build_log_$(now).txt
Build was reported as successful, but was much faster than expected and clearly nothing was being compiled.
As a result, I found in ~/rpmbuild/RPMS/noarch/
:
- kernel-devel-6.14~rc6-1.1.noarch.rpm
- kernel-macros-6.14~rc6-1.1.noarch.rpm
- kernel-source-6.14~rc6-1.1.noarch.rpm
- kernel-source-vanilla-6.14~rc6-1.1.noarch.rpm
…and in ~/rpmbuild/RPMS/x86_64/
only:
- kernel-syms-6.14~rc6-1.1.x86_64.rpm
…and two source packages in ~/rpmbuild/SRPMS/
:
- kernel-source-6.14~rc6-1.1.src.rpm
- kernel-syms-6.14~rc6-1.1.src.rpm
…which look exactly same as those I have downloaded from the kernel repo.
No actual installable binary kernel RPM
Please, what am I doing wrong?