I want to build a custom kernel with some modules and patches added, and package this as an rpm to install. I have tried adding it like building the kernel from the git source, but it doesnt have the modules. I think it might have to do with the .spec file. I added the patches to the rpm, and I modified the source tarball so it has the modules added. I ran ``` dnf install -y fedora-packager git curl pesign ncurses-devel libkcapi libkcapi-devel libkcapi-static libkcapi-tools libbpf fedpkg rpmdevtools dwarves rpmdev-setuptree cd ~/rpmbuild/SOURCES
koji download-build --arch=src kernel-${FEDORA_KERNEL_VERSION} rpm -Uvh kernel-${FEDORA_KERNEL_VERSION}.src.rpm
cd /root/rpmbuild/SPECS dnf -y builddep kernel.spec
cp /path/to/driver /path/to/kernel source tarbal from spec/drivers/staging tar -cJf ~/rpmbuild/SOURCES/kernel-version.tar.xz /path/to/kernel/src rpmbuild -bb --with baseonly --without debug --without debuginfo --target=x86_64 kernel.spec ``` I know that I install some extra useless dependencies. When I do the same process to the kernel sources, but instead use make to build the vanilla kernel git, the modules are built. I noticed this https://fedoraproject.org/wiki/KernelStagingPolicy, but I dont know if it is related. The necessary drivers are in drivers/staging, and I added the sources to the spec file. Can someone please help me make this modifications into a kernel rpm.
You would have to change the correct config options. make menuconfig used to bring up the interface for that and then you need to figure out which corner of the menu your modules are hiding. the rpmbuild is going to be very hardwired to make it harder to do what you are wanting to do.
When doing kernels I typically do not build into an RPM and see no point in starting with the fedora kernel source (I started with a stable released kernel.org and apply the extra patches). Once you have the install tree compiled bringing down a patch and recompiling is typically much faster.
and once compiled "make install" will do the steps to add the kernel to grub. The only complication is that you will have to manually clean up the kernel, initramfs, /lib/modules/kernelversion yourself when you are doing with it.
On Thu, Sep 1, 2022 at 8:42 PM Sharpened Blade via users users@lists.fedoraproject.org wrote:
I want to build a custom kernel with some modules and patches added, and package this as an rpm to install. I have tried adding it like building the kernel from the git source, but it doesnt have the modules. I think it might have to do with the .spec file. I added the patches to the rpm, and I modified the source tarball so it has the modules added. I ran
dnf install -y fedora-packager git curl pesign ncurses-devel libkcapi libkcapi-devel libkcapi-static libkcapi-tools libbpf fedpkg rpmdevtools dwarves rpmdev-setuptree cd ~/rpmbuild/SOURCES koji download-build --arch=src kernel-${FEDORA_KERNEL_VERSION} rpm -Uvh kernel-${FEDORA_KERNEL_VERSION}.src.rpm cd /root/rpmbuild/SPECS dnf -y builddep kernel.spec cp /path/to/driver /path/to/kernel source tarbal from spec/drivers/staging tar -cJf ~/rpmbuild/SOURCES/kernel-version.tar.xz /path/to/kernel/src rpmbuild -bb --with baseonly --without debug --without debuginfo --target=x86_64 kernel.specI know that I install some extra useless dependencies. When I do the same process to the kernel sources, but instead use make to build the vanilla kernel git, the modules are built. I noticed this https://fedoraproject.org/wiki/KernelStagingPolicy, but I dont know if it is related. The necessary drivers are in drivers/staging, and I added the sources to the spec file. Can someone please help me make this modifications into a kernel rpm. _______________________________________________ users mailing list -- users@lists.fedoraproject.org To unsubscribe send an email to users-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
I can get the kernel to build from the vanilla sources in the method you outlined, I want to make it an RPM to distribute it in a repo. I am using fedoras spec file because I want it to be as much of a drop in replacement of the normal kernel possible.
You would have to run "make menuconfig" and update the config file used in the source rpm.
The config file controls what modules and/or other drivers get compiled, if you did not change the config file none of the add-ons would get compiled.
On Fri, Sep 2, 2022 at 6:43 PM Sharpened Blade via users users@lists.fedoraproject.org wrote:
I can get the kernel to build from the vanilla sources in the method you outlined, I want to make it an RPM to distribute it in a repo. I am using fedoras spec file because I want it to be as much of a drop in replacement of the normal kernel possible. _______________________________________________ users mailing list -- users@lists.fedoraproject.org To unsubscribe send an email to users-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
I have to rebuild every new kernel because of the simple-drm module issue. I modify my config with the file /rpmbuild/SOURCES/kernel-local
kernel-local :
# This file is intentionally left empty in the stock kernel. Its a nicety # added for those wanting to do custom rebuilds with altered config opts.
CONFIG_FRAME_POINTER=y CONFIG_KGDB=y CONFIG_KGDB_SERIAL_CONSOLE=y CONFIG_KGDB_KDB=y CONFIG_KDB_DEFAULT_ENABLE=0x1 CONFIG_KDB_KEYBOARD=y
CONFIG_SYSFB_SIMPLEFB=y CONFIG_DRM_SIMPLEDRM=m # CONFIG_FB_SIMPLE is not set
I added the CONFIG_NAMEOFMODULE=m to local-config. which works for the normal kernel, do I have to do something else, I would prefer to be able to do it without a TUI because I want to script the build process. Should I run `./scripts/config --module nameofmodule` and `make olddefconfig`.
That may or may not be the right CONFIG_* option. "make oldconfig" I think will copy the current config and question you on any new options.
You could also look at the source code for the modules you want to build (or make menuconfig and enable them and diff the config file) to figure out what options that you need. There should be files in the modules directories you are adding that shows what config options they use.
On Sat, Sep 3, 2022 at 11:13 AM Sharpened Blade via users users@lists.fedoraproject.org wrote:
I added the CONFIG_NAMEOFMODULE=m to local-config. which works for the normal kernel, do I have to do something else, I would prefer to be able to do it without a TUI because I want to script the build process. Should I run `./scripts/config --module nameofmodule` and `make olddefconfig`. _______________________________________________ users mailing list -- users@lists.fedoraproject.org To unsubscribe send an email to users-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
I am sure it is not the config, unless there is something fedora specific, because there is an arch linux packagebuild that uses the the same config additions and works. I diffed menuconfig and got the same thing to. Does the spec do something to prevent drivers in staging from being built.
On Sun, 04 Sep 2022 01:58:08 -0000 Sharpened Blade via users users@lists.fedoraproject.org wrote:
I am sure it is not the config, unless there is something fedora specific, because there is an arch linux packagebuild that uses the the same config additions and works. I diffed menuconfig and got the same thing to. Does the spec do something to prevent drivers in staging from being built.
You will be more likely to get an authoritative answer to your question on the fedora-kernel mailing list. I build a custom kernel from the src.rpm using rpmbuild, and Justin, and others, have helped me with problems in the past, though the official policy is if you build a custom kernel, you are on your own. I don't build any out of tree drivers, so I have not dealt with your problem. I vaguely recall that Fedora doesn't allow out of tree drivers, so your question about the spec file ignoring them is reasonable. It is probably a workaround to get them to build in a custom kernel.
I haven't patched the kernel for a while, and when I looked at the spec file, it was different than I remember. There have been several ways of patching, as the build process changed, and the spec file was enhanced. And it looks like it has changed again. There have been a lot of changes to the spec file over the past year as ARC has been implemented. The archives of the kernel mailing list show all the changes.