On Tue, 27 Jul 2021 01:41:58 -0000
"Sampson Fung" <sampsonfung(a)gmail.com> wrote:
I am trying to build custom kernel on Fedora-34 following this
quick-doc
https://docs.fedoraproject.org/en-US/quick-docs/kernel/build-custom-kernel/
I got error:
# fedpkg clone -a kernel
Cloning into 'kernel'...
remote: Enumerating objects: 2656, done.
remote: Counting objects: 100% (2656/2656), done.
remote: Compressing objects: 100% (926/926), done.
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output
Could not execute clone: Failed to execute command.
This is an old and deprecated way to do this.
You can also build using the src.rpm from here
https://koji.fedoraproject.org/koji/packageinfo?packageID=8
run in /home/[your home]
rpmdev-setuptree
to create the rpmbuild heirarchy. Then run, as *user* (important)
rpm -ivh [kernel*src.rpm]
to install the src.rpm in the rpmbuild heirarchy. Edit the kernel.spec
file and uncomment the #define line and add something like 20210727 to
distinguish this kernel from repository kernel.
Run rpmbuild -bp kernel.spec
in the SPECS directory of the rpmbuild heirarchy to expand the src.rpm
Switch to ~/rpmbuild/BUILD/kernel[]/linux[] Then cp a
/boot/config-[] of a kernel to ./.config and run
make oldconfig
Then run
makemenuconfig
and make the changes to the kernel configuration that you want in your
custom kernel. Save them. Then cp the .config file to a local config
to override the defaults.
cp ./.config ~/rpmbuild/SOURCES/kernel-local
Switch back to ~/rpmbuild/SPECS and run
rpmbuild -bb kernel.spec
The output rpms will be in ~/rpmbuild/RPMS/x86_64. Run
dnf -C install $(ls *.rpm)
in that directory to install them.
Seems complicated, but really isn't. If you are going to do this a
lot, you could set up a screen instance to have access to all the
directories needed just by using Ctrl-A [#] to make it easier.
This does not sign the kernel so it can be booted via UEFI secure boot.
So, you either have to turn that off in the BIOS when running it, or
create your own signing key and sign it using pesign. I recommed the
former for a one off.