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 my first time trying to do that.
Please help.
On 7/26/21 9:41 PM, Sampson Fung wrote:
I am trying to build custom kernel on Fedora-34 following this quick-doc
...
fatal: fetch-pack: invalid index-pack output Could not execute clone: Failed to execute command.
I had similar fails ...
Are you building to pkg for Fedora-compliant distribution?
Or for your own use, e.g. to patch/bisect/etc?
On 7/26/21 10:29 PM, Sampson Fung wrote:
For my own use. Trying to enable more btrfs debug options.
for me, fedpkg mockbuilds were ... unsuccessful. same errors you're seeing; and then some.
if you're !building for official pkg'ing, you can live without it.
asking in #fedora-kernel, i got some experienced "don't bother" advice ... instead, worked out the following for myself.
it works reliably for me.
I exec'd this once, to ensure all kernel build deps were in place
git clone --branch f34 https://src.fedoraproject.org/rpms/kernel.git cd kernel dnf builddep kernel.spec cd ../ rm -rf kernel
then, for repeatable builds, checkout source
git clone --filter=tree:0 https://gitlab.com/cki-project/kernel-ark.git cd kernel-ark
and checkout branch/tag as req'd. or, start a bisect, etc.
never hurts to clean/reset
git clean -xfd git reset --hard
clean-up your rmpbuild tree (might want to use a smaller hammer here ...)
rm -rf ~/rpmbuild/* rpmdev-setuptree tree ~/rpmbuild/ ~/rpmbuild/ ├── BUILD ├── RPMS ├── SOURCES ├── SPECS └── SRPMS
clean the build
make clean
copy your config of choice, e.g.
/bin/cp -f /boot/config-5.12.15-300.fc34.x86_64 .config
modify, &/or, create a custom config. i label mine for convenience
_LABEL=$( git rev-parse --short HEAD ) perl -pi -e 's|^(EXTRAVERSION).*|${1} = -custom-'${_LABEL}'|g' Makefile
prep the config
make oldconfig
and build; here, I'm building the rpm target, as I build locally on a big box, and transport/install on a small one
make -j16 binrpm-pkg
this is useful to have around
https://www.kernel.org/doc/makehelp.txt
with that^, you'll end up with
tree ~/rpmbuild/RPMS/ ~/rpmbuild/RPMS/ └── x86_64 ├── kernel-5.12.15_custom_XXXXXXXX.x86_64.rpm └── kernel-headers-5.12.15_custom_XXXXXXXX.x86_64.rpm
install the
kernel-5.12.15_custom_XXXXXXXX.x86_64.rpm
rebuild your initrd. reboot. enjoy.
hth.
Got below error during git clone-
2021-07-27 11:18:13 $ git clone --branch f34 https://src.fedoraproject.org/rpms/kernel.git 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
No kernel folder created.
On 7/26/21 11:27 PM, Sampson Fung wrote:
Got below error during git clone-
2021-07-27 11:18:13 $ git clone --branch f34 https://src.fedoraproject.org/rpms/kernel.git Cloning into 'kernel'...
As mentioned, this step was only to grab/ensure the builddeps. You don't NEED the whole tree.
if you can't pull the tree, pull the BuildRequires directly from the spec
https://src.fedoraproject.org/rpms/kernel/blob/rawhide/f/kernel.spec#_563
and install them manually.
or, assuming you're running a close-to-current kernel, this should do it as well
dnf builddep kernel
if anything's missing @ build time, your build will tell you.
Thank you very much!
My first build just finished after ~8 hours.
du -ah 1.3M ./kernel-headers-5.14.0_custom_437467a359f+-1.x86_64.rpm 1.1G ./kernel-5.14.0_custom_437467a359f+-1.x86_64.rpm
It is huge!
On 7/27/21 7:48 PM, Sampson Fung wrote:
Thank you very much!
My first build just finished after ~8 hours.
8! What are you building on?
On a Ryzen 3700X desktop, with -j12, it's taking <~20 mins here ...
du -ah 1.3M ./kernel-headers-5.14.0_custom_437467a359f+-1.x86_64.rpm 1.1G ./kernel-5.14.0_custom_437467a359f+-1.x86_64.rpm
It is huge!
Without knowing more ... I'm gonna guess you've built kernel & modules with debug info enabled?
Did you simply copy config from /boot?
Note, e.g.,
grep CONFIG_DEBUG_INFO= /boot/config-* /boot/config-5.12.15-300.fc34.x86_64:CONFIG_DEBUG_INFO=y /boot/config-5.12.17-300.fc34.x86_64:CONFIG_DEBUG_INFO=y /boot/config-5.13.4-200.fc34.x86_64:CONFIG_DEBUG_INFO=y
I am on AMD A10-7850K . Last build is with -j2
Yes, I just copied /boot/config-5.13.4-200.fc34.x86_64
I changed CONFIG_DEBUG_INFO= and rebuilding with -j5 now.
After disabled CONFIG_DEBUG_INFO, stop background tasts, the second build finished in about 1 hour.
The result kernel installed OK but failed to boot.
$ du -a 1288 ./kernel-headers-5.14.0_custom_437467a359f+-2.x86_64.rpm 83120 ./kernel-5.14.0_custom_437467a359f+-2.x86_64.rpm
Do I need to build the kernel-modules and kernel-core as well?
On Tue, 27 Jul 2021 01:41:58 -0000 "Sampson Fung" sampsonfung@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.
I got "user mockbuild does not exist - using root"
$ rpm -ivh kernel-5.13.5-200.fc34.src.rpm Updating / installing... 1:kernel-5.13.5-200.fc34 warning: user mockbuild does not exist - using root warning: user mockbuild does not exist - using root warning: user mockbuild does not exist - using root
Edit the kernel.spec
file and uncomment the #define line and add something like 20210727 to distinguish this kernel from repository kernel.
I find at line 107: # define .local, after un-comment it: $ rpmbuild -bp kernel.spec error: line 107: Unknown tag: define buildid .local Thus I undo and continue.
rpmbuild -bb kernel.spec
Exit with error:
Processing /home/fcc/rpmbuild/BUILD/kernel-5.13.5/linux-5.13.5-200.fc34.x86_64/configs/kernel-5.13.5-s390x.config ... done Processing /home/fcc/rpmbuild/BUILD/kernel-5.13.5/linux-5.13.5-200.fc34.x86_64/configs/kernel-5.13.5-x86_64-debug.config ... Error: Mismatches found in configuration files Found CONFIG_CC_VERSION_TEXT="gcc (scripts/dummy-tools/gcc)" after generation, had CONFIG_CC_VERSION_TEXT="gcc (GCC) 11.1.1 20210531 (Red Hat 11.1.1-3)" in Source tree Found CONFIG_GCC_VERSION=200000 after generation, had CONFIG_GCC_VERSION=110101 in Source tree Found CONFIG_AS_VERSION=25000 after generation, had CONFIG_AS_VERSION=23501 in Source tree Found CONFIG_LD_VERSION=25000 after generation, had CONFIG_LD_VERSION=23501 in Source tree error: Bad exit status from /var/tmp/rpm-tmp.wCoe4b (%prep)
RPM build errors: Bad exit status from /var/tmp/rpm-tmp.wCoe4b (%prep)
On Wed, 28 Jul 2021 00:25:42 -0000
I see you got the other method working, so you really don't need this, but I'll comment just in case someone else reads this in the far future. :-)
"Sampson Fung" sampsonfung@gmail.com wrote:
I got "user mockbuild does not exist - using root"
$ rpm -ivh kernel-5.13.5-200.fc34.src.rpm Updating / installing... 1:kernel-5.13.5-200.fc34 warning: user mockbuild does not exist - using root warning: user mockbuild does not exist - using root warning: user mockbuild does not exist - using root
Harmless.
Edit the kernel.spec
file and uncomment the #define line and add something like 20210727 to distinguish this kernel from repository kernel.
I find at line 107: # define .local, after un-comment it: $ rpmbuild -bp kernel.spec error: line 107: Unknown tag: define buildid .local Thus I undo and continue.
It has to be %define buildid .local Note the % sign in front of the define, it matters.
rpmbuild -bb kernel.spec
Exit with error:
Processing /home/fcc/rpmbuild/BUILD/kernel-5.13.5/linux-5.13.5-200.fc34.x86_64/configs/kernel-5.13.5-s390x.config ... done Processing /home/fcc/rpmbuild/BUILD/kernel-5.13.5/linux-5.13.5-200.fc34.x86_64/configs/kernel-5.13.5-x86_64-debug.config ... Error: Mismatches found in configuration files Found CONFIG_CC_VERSION_TEXT="gcc (scripts/dummy-tools/gcc)" after generation, had CONFIG_CC_VERSION_TEXT="gcc (GCC) 11.1.1 20210531 (Red Hat 11.1.1-3)" in Source tree Found CONFIG_GCC_VERSION=200000 after generation, had CONFIG_GCC_VERSION=110101 in Source tree Found CONFIG_AS_VERSION=25000 after generation, had CONFIG_AS_VERSION=23501 in Source tree Found CONFIG_LD_VERSION=25000 after generation, had CONFIG_LD_VERSION=23501 in Source tree error: Bad exit status from /var/tmp/rpm-tmp.wCoe4b (%prep)
RPM build errors: Bad exit status from /var/tmp/rpm-tmp.wCoe4b (%prep)
You can try the below. It will show whether the installed gcc on your system is the same as the config files are expecting.
What is the output of rpm -q gcc? What is the output of grep -i cc_version /home/fcc/rpmbuild/BUILD/kernel-5.13.5/linux-5.13.5-200.fc34.x86_64/configs/kernel-5.13.5-x86_64-debug.confiG ? Are they different? I think that creating the ~/rpmbuild/SOURCES/kernel-local file will fix this.
You can turn off debug config in the kernel.spec file. Set the switch to 0 as it is set below. # kernel-debug %define with_debug %{?_without_debug: 0} %{?!_without_debug: 0} # kernel-debuginfo %define with_debuginfo %{?_without_debuginfo: 0} %{?!_without_debuginfo: 0}
You might as well turn off PAE as well as you don't need it. # kernel PAE (only valid for ARM (lpae)) %define with_pae %{?_without_pae: 0} %{?!_without_pae: 0}
You can also turn off the build of architectures that you are not interested in. Add the last line to your spec (it won't be there). %define nobuildarches i386 i686 %{arm} %endif %define nobuildarches i386 i686 ppc64 s390x %{arm} %{power64} aarch64 ppc64le
That should get you a little further, if the other method doesn't work out. It is more user friendly than this technique, which is a lot more manual. Probably why it was replaced.
I recommend you put your effort into getting the other method working.
On Wed, 28 Jul 2021 00:25:42 -0000
I see you got the other method working, so you really don't need this, but I'll comment just in case someone else reads this in the far future. :-)
"Sampson Fung" <sampsonfung(a)gmail.com> wrote:
Harmless.
got it.
It has to be %define buildid .local Note the % sign in front of the define, it matters.
got it.
You can try the below. It will show whether the installed gcc on your system is the same as the config files are expecting.
What is the output of rpm -q gcc?
$ rpm -q gcc gcc-11.1.1-3.fc34.x86_64
What is the output of grep -i cc_version /home/fcc/rpmbuild/BUILD/kernel-5.13.5/linux-5.13.5-200.fc34.x86_64/configs/kernel-5.13.5-x86_64-debug.confiG ?
$ grep -i cc_version ~/rpmbuild/BUILD/kernel-5.13.5/linux-5.13.5-200.local.20210729.fc34.x86_64/configs/kernel-5.13.5-x86_64-debug.config CONFIG_CC_VERSION_TEXT="gcc (GCC) 11.1.1 20210531 (Red Hat 11.1.1-3)" CONFIG_GCC_VERSION=110101
Are they different? I think that creating the ~/rpmbuild/SOURCES/kernel-local file will fix this.
both reads like 11.1.1 to me. I did cp .config as kernel-local after make menuconfig. After rm -rf ~/rpmbuild and start over, exit with same error.
You can turn off debug config in the kernel.spec file. Set the switch to 0 as it is set below. # kernel-debug %define with_debug %{?_without_debug: 0} %{?!_without_debug: 0} # kernel-debuginfo %define with_debuginfo %{?_without_debuginfo: 0} %{?!_without_debuginfo: 0}
You might as well turn off PAE as well as you don't need it. # kernel PAE (only valid for ARM (lpae)) %define with_pae %{?_without_pae: 0} %{?!_without_pae: 0}
You can also turn off the build of architectures that you are not interested in. Add the last line to your spec (it won't be there). %define nobuildarches i386 i686 %{arm} %endif %define nobuildarches i386 i686 ppc64 s390x %{arm} %{power64} aarch64 ppc64le
That should get you a little further, if the other method doesn't work out. It is more user friendly than this technique, which is a lot more manual. Probably why it was replaced.
I recommend you put your effort into getting the other method working.
I will. And come back to using kernel-spec later.
On Thu, 29 Jul 2021 14:55:25 -0000 "Sampson Fung" sampsonfung@gmail.com wrote:
both reads like 11.1.1 to me. I did cp .config as kernel-local after make menuconfig. After rm -rf ~/rpmbuild and start over, exit with same error.
I agree, the gcc version isn't the problem. I suggest you turn on verbose in the spec file, # verbose build, i.e. no silent rules and V=1 %define with_verbose %{?_with_verbose: 1} %{?!_with_verbose: 1}
It is set to 0 as default.
You might as well make the other changes to the spec file at the same time.
Then run the rpmbuild as
rpmbuild -bb kernel.spec > build_output 2> error_output
If they aren't too large, could you attach them to an email (< 30k?). If they are too large, could you put them on fedora paste (Fedora Pastebin at http://paste.fedoraproject.org) and provide a link. I think fedora has fpaste to do that easily, you might have to install it.
There can be errors further back, or at least warnings, so they may point to the problem.
If I get time I'll try to reproduce the issue. It has to be something simple, a switch or configuration option, I *think*.
On Fri, 30 Jul 2021 12:07:19 -0700 stan upaitag@zoho.com wrote:
On Thu, 29 Jul 2021 14:55:25 -0000 "Sampson Fung" sampsonfung@gmail.com wrote:
both reads like 11.1.1 to me. I did cp .config as kernel-local after make menuconfig. After rm -rf ~/rpmbuild and start over, exit with same error.
If I get time I'll try to reproduce the issue. It has to be something simple, a switch or configuration option, I *think*.
I looked at the output from a successful kernel build (under ~/rpmbuild/BUILD/kernel []/linux []) here using rpmbuild. I checked for the error message you received. This is the output.
configs/kernel-5.14.0-x86_64.config:CONFIG_GCC_VERSION=200000 configs/kernel-local:CONFIG_GCC_VERSION=110101 configs/kernel-5.14.0-armv7hl-lpae.config:CONFIG_GCC_VERSION=200000 configs/kernel-5.14.0-aarch64.config:CONFIG_GCC_VERSION=200000 configs/kernel-5.14.0-ppc64le.config:CONFIG_GCC_VERSION=200000 configs/kernel-5.14.0-i686.config:CONFIG_GCC_VERSION=200000 configs/kernel-5.14.0-armv7hl.config:CONFIG_GCC_VERSION=200000 configs/kernel-5.14.0-s390x.config:CONFIG_GCC_VERSION=200000 include/config/auto.conf:CONFIG_GCC_VERSION=110101 include/generated/autoconf.h:#define CONFIG_GCC_VERSION 110101 kernel/config_data:CONFIG_GCC_VERSION=110101
So the compiler version set in the kernel-local is overriding the default. Can you do a grep on your kernel-local to be sure it has the version set as above. It should be in ~/rpmbuild/SOURCES/ grep -i -e 'config_gcc_version' ~/rpmbuild/SOURCES/kernel-local
You could also run the grep I did to see what it shows, in ~/rpmbuild/BUILD/kernel []/linux [] grep -i -r -e 'config_gcc_version' * | less
Thank you for your help.
Here I start with a empty ~/rpmbuild: - build error is 64K, so I uploaded to pastebin the content of kernel.spec, build_report and build_error to http://cwillu.com:8080/112.119.240.206/3 (in step 16)
1. https://kojipkgs.fedoraproject.org//packages/kernel/5.14.0/0.rc3.29.fc35/src...
2. mount ~/rpmbuild to /mnt/250G/rpmbild
3. rpmdev-setuptree
4. rpm -ivh kernel-5.14.0-0.rc3.29.fc35.src.rpm
5. kernel.spec: %define .20210803
6. rpmbuild -bp kernel.spec
7. sudo cp /boot/config-5.13.6-200.fc34.x86_64 ~/rpmbuild/BUILD/kernel-5.14-rc3/linux-5.14.0-0.rc3.29.20210803.fc34.x86_64/.config
8. make oldconfig #press enter for all prompts
9. make menuconfig #CONFIG_BTRFS_ASSERT=y
10. cp ~/rpmbuild/BUILD/kernel-5.14-rc3//linux-5.14.0-0.rc3.29.20210803.fc34.x86_64/.config ~/rpmbuild/SOURCES/kernel-local
11. rpmbuild -bb kernel.spec + ./process_configs.sh -w -n -c kernel 5.14.0 Processing /home/fcc/rpmbuild/BUILD/kernel-5.14-rc3/linux-5.14.0-0.rc3.29.20210803.fc34.x86_64/configs/kernel-5.14.0-aarch64-debug.config ... done Processing /home/fcc/rpmbuild/BUILD/kernel-5.14-rc3/linux-5.14.0-0.rc3.29.20210803.fc34.x86_64/configs/kernel-5.14.0-aarch64.config ... done Processing /home/fcc/rpmbuild/BUILD/kernel-5.14-rc3/linux-5.14.0-0.rc3.29.20210803.fc34.x86_64/configs/kernel-5.14.0-armv7hl-debug.config ... done Processing /home/fcc/rpmbuild/BUILD/kernel-5.14-rc3/linux-5.14.0-0.rc3.29.20210803.fc34.x86_64/configs/kernel-5.14.0-armv7hl-lpae-debug.config ... done Processing /home/fcc/rpmbuild/BUILD/kernel-5.14-rc3/linux-5.14.0-0.rc3.29.20210803.fc34.x86_64/configs/kernel-5.14.0-armv7hl-lpae.config ... done Processing /home/fcc/rpmbuild/BUILD/kernel-5.14-rc3/linux-5.14.0-0.rc3.29.20210803.fc34.x86_64/configs/kernel-5.14.0-armv7hl.config ... done Processing /home/fcc/rpmbuild/BUILD/kernel-5.14-rc3/linux-5.14.0-0.rc3.29.20210803.fc34.x86_64/configs/kernel-5.14.0-i686-debug.config ... done Processing /home/fcc/rpmbuild/BUILD/kernel-5.14-rc3/linux-5.14.0-0.rc3.29.20210803.fc34.x86_64/configs/kernel-5.14.0-i686.config ... done Processing /home/fcc/rpmbuild/BUILD/kernel-5.14-rc3/linux-5.14.0-0.rc3.29.20210803.fc34.x86_64/configs/kernel-5.14.0-ppc64le-debug.config ... done Processing /home/fcc/rpmbuild/BUILD/kernel-5.14-rc3/linux-5.14.0-0.rc3.29.20210803.fc34.x86_64/configs/kernel-5.14.0-ppc64le.config ... done Processing /home/fcc/rpmbuild/BUILD/kernel-5.14-rc3/linux-5.14.0-0.rc3.29.20210803.fc34.x86_64/configs/kernel-5.14.0-s390x-debug.config ... done Processing /home/fcc/rpmbuild/BUILD/kernel-5.14-rc3/linux-5.14.0-0.rc3.29.20210803.fc34.x86_64/configs/kernel-5.14.0-s390x.config ... done Processing /home/fcc/rpmbuild/BUILD/kernel-5.14-rc3/linux-5.14.0-0.rc3.29.20210803.fc34.x86_64/configs/kernel-5.14.0-x86_64-debug.config ... Error: Mismatches found in configuration files Found CONFIG_CC_VERSION_TEXT="gcc (scripts/dummy-tools/gcc)" after generation, had CONFIG_CC_VERSION_TEXT="gcc (GCC) 11.2.1 20210728 (Red Hat 11.2.1-1)" in Source tree Found CONFIG_GCC_VERSION=200000 after generation, had CONFIG_GCC_VERSION=110201 in Source tree Found CONFIG_AS_VERSION=25000 after generation, had CONFIG_AS_VERSION=23501 in Source tree Found CONFIG_LD_VERSION=25000 after generation, had CONFIG_LD_VERSION=23501 in Source tree error: Bad exit status from /var/tmp/rpm-tmp.b3Ax1d (%prep)
RPM build errors: Bad exit status from /var/tmp/rpm-tmp.b3Ax1d (%prep)
12. pm -q gcc gcc-11.2.1-1.fc34.x86_64
13. grep -i cc_version ~/rpmbuild/BUILD/kernel-5.14-rc3/linux-5.14.0-0.rc3.29.20210803.fc34.x86_64/configs/kernel-5.14.0-x86_64-debug.config CONFIG_CC_VERSION_TEXT="gcc (GCC) 11.2.1 20210728 (Red Hat 11.2.1-1)" CONFIG_GCC_VERSION=110201
14. (before redo 11, modify kernel.spec) - #kernel-debug -> 0 - #kernel-debuginfo -> 0 - #kernel PAE (only valid for ARM (lpae)) -> 0 - %define nobuildarches i386 i686 ppc64 s390x %{arm} %{power64} aarch64 ppc64le - # verbose build, i.e. no silent rules and V=1 -> 1
15. rpmbuild -bb kernel.spec > build_output 2> error_output + cp /home/fcc/rpmbuild/SOURCES/kernel-aarch64-debug-fedora.config /home/fcc/rpmbuild/SOURCES/kernel-aarch64-debug-rhel.config /home/fcc/rpmbuild/SOURCES/kernel-aarch64-fedora.config /home/fcc/rpmbuild/SOURCES/kernel-aarch64-rhel.config /home/fcc/rpmbuild/SOURCES/kernel-armv7hl-debug-fedora.config /home/fcc/rpmbuild/SOURCES/kernel-armv7hl-fedora.config /home/fcc/rpmbuild/SOURCES/kernel-armv7hl-lpae-debug-fedora.config /home/fcc/rpmbuild/SOURCES/kernel-armv7hl-lpae-fedora.config /home/fcc/rpmbuild/SOURCES/kernel-i686-debug-fedora.config /home/fcc/rpmbuild/SOURCES/kernel-i686-fedora.config /home/fcc/rpmbuild/SOURCES/kernel-ppc64le-debug-fedora.config /home/fcc/rpmbuild/SOURCES/kernel-ppc64le-debug-rhel.config /home/fcc/rpmbuild/SOURCES/kernel-ppc64le-fedora.config /home/fcc/rpmbuild/SOURCES/kernel-ppc64le-rhel.config /home/fcc/rpmbuild/SOURCES/kernel-s390x-debug-fedora.config /home/fcc/rpmbuild/SOURCES/kernel-s390x-debug-rhel.config /home/fcc/rpmbuild/SOURCES/kernel-s390x-fedora.config /home/fcc/rpmbuild/SOURCES/kernel-s390x-rhel.config /home/fcc/rpmbuild/SOURCES/kernel-s390x-zfcpdump-rhel.config /home/fcc/rpmbuild/SOURCES/kernel-x86_64-debug-fedora.config /home/fcc/rpmbuild/SOURCES/kernel-x86_64-debug-rhel.config /home/fcc/rpmbuild/SOURCES/kernel-x86_64-fedora.config /home/fcc/rpmbuild/SOURCES/kernel-x86_64-rhel.config . + cp /home/fcc/rpmbuild/SOURCES/generate_all_configs.sh . + cp /home/fcc/rpmbuild/SOURCES/merge.pl . + cp /home/fcc/rpmbuild/SOURCES/kernel-local . + VERSION=5.14.0 + ./generate_all_configs.sh fedora 1 + for i in kernel-5.14.0-x86_64*.config + mv kernel-5.14.0-x86_64-debug.config kernel-5.14.0-x86_64-debug.config.tmp + ./merge.pl /home/fcc/rpmbuild/SOURCES/kernel-local kernel-5.14.0-x86_64-debug.config.tmp + rm kernel-5.14.0-x86_64-debug.config.tmp + for i in kernel-5.14.0-x86_64*.config + mv kernel-5.14.0-x86_64.config kernel-5.14.0-x86_64.config.tmp + ./merge.pl /home/fcc/rpmbuild/SOURCES/kernel-local kernel-5.14.0-x86_64.config.tmp + rm kernel-5.14.0-x86_64.config.tmp + cp /home/fcc/rpmbuild/SOURCES/process_configs.sh . + OPTS= + OPTS=' -w -n -c' + ./process_configs.sh -w -n -c kernel 5.14.0 error: Bad exit status from /var/tmp/rpm-tmp.yeTFEV (%prep) Bad exit status from /var/tmp/rpm-tmp.yeTFEV (%prep)
16. cat kernel.spec build_output error_output | nc cwillu.com 10101 http://cwillu.com:8080/112.119.240.206/3
17. grep -i -e 'config_gcc_version' ~/rpmbuild/SOURCES/kernel-local CONFIG_GCC_VERSION=110201
18. grep -i -r -e 'config_gcc_version' * configs/kernel-local:CONFIG_GCC_VERSION=110201 configs/kernel-5.14.0-x86_64-debug.config:CONFIG_GCC_VERSION=110201 configs/kernel-5.14.0-x86_64.config:CONFIG_GCC_VERSION=110201 configs/kernel-5.14.0-aarch64-debug.config:CONFIG_GCC_VERSION=200000 configs/kernel-5.14.0-aarch64.config:CONFIG_GCC_VERSION=200000 configs/kernel-5.14.0-armv7hl-debug.config:CONFIG_GCC_VERSION=200000 configs/kernel-5.14.0-armv7hl-lpae-debug.config:CONFIG_GCC_VERSION=200000 configs/kernel-5.14.0-armv7hl-lpae.config:CONFIG_GCC_VERSION=200000 configs/kernel-5.14.0-armv7hl.config:CONFIG_GCC_VERSION=200000 configs/kernel-5.14.0-i686-debug.config:CONFIG_GCC_VERSION=200000 configs/kernel-5.14.0-i686.config:CONFIG_GCC_VERSION=200000 configs/kernel-5.14.0-ppc64le-debug.config:CONFIG_GCC_VERSION=200000 configs/kernel-5.14.0-ppc64le.config:CONFIG_GCC_VERSION=200000 configs/kernel-5.14.0-s390x-debug.config:CONFIG_GCC_VERSION=200000 configs/kernel-5.14.0-s390x.config:CONFIG_GCC_VERSION=200000 configs/kernel-5.14.0-x86_64-debug.config.orig.old:CONFIG_GCC_VERSION=110201 configs/kernel-5.14.0-x86_64-debug.config.orig:CONFIG_GCC_VERSION=200000 configs/kernel-5.14.0-x86_64-debug.config.tmp:CONFIG_GCC_VERSION=200000 include/config/auto.conf:CONFIG_GCC_VERSION=200000 include/generated/autoconf.h:#define CONFIG_GCC_VERSION 200000 scripts/Makefile.compiler:cc-ifversion = $(shell [ $(CONFIG_GCC_VERSION)0 $(1) $(2)000 ] && echo $(3) || echo $(4))
On Tue, 03 Aug 2021 07:00:56 -0000 "Sampson Fung" sampsonfung@gmail.com wrote:
This all looks OK.
Here is my relevant error output from the configuration step.
+ cp /home/stan/rpmbuild/SOURCES/generate_all_configs.sh . + cp /home/stan/rpmbuild/SOURCES/merge.pl . + cp /home/stan/rpmbuild/SOURCES/kernel-local . + VERSION=5.14.0 + ./generate_all_configs.sh fedora 0 + for i in kernel-5.14.0-x86_64*.config + mv kernel-5.14.0-x86_64.config kernel-5.14.0-x86_64.config.tmp + ./merge.pl /home/stan/rpmbuild/SOURCES/kernel-local kernel-5.14.0-x86_64.config.tmp + rm kernel-5.14.0-x86_64.config.tmp + cp /home/stan/rpmbuild/SOURCES/process_configs.sh . + OPTS= + ./process_configs.sh kernel 5.14.0 /home/stan/rpmbuild/BUILD/kernel-5.14-rc3-38-g4010a528219e/linux-5.14.0-0.rc3.20210728git4010a528219e.32.20210731.fc35.x86_64/configs/kernel-5.14.0-x86_64.config.orig:4950:warning: override: PSTORE_LZ4HC_COMPRESS_DEFAULT changes choice state + cp /home/stan/rpmbuild/SOURCES/update_scripts.sh . + RPM_SOURCE_DIR=/home/stan/rpmbuild/SOURCES + ./update_scripts.sh fedora + cd .. + find . '(' -name '*.orig' -o -name '*~' ')' -delete
Here is your error output, as you also posted, but here unwrapped because replying wrapped it.
+ cp /home/fcc/rpmbuild/SOURCES/generate_all_configs.sh . + cp /home/fcc/rpmbuild/SOURCES/merge.pl . + cp /home/fcc/rpmbuild/SOURCES/kernel-local . + VERSION=5.14.0 + ./generate_all_configs.sh fedora 1 + for i in kernel-5.14.0-x86_64*.config + mv kernel-5.14.0-x86_64-debug.config kernel-5.14.0-x86_64-debug.config.tmp + ./merge.pl /home/fcc/rpmbuild/SOURCES/kernel-local kernel-5.14.0-x86_64-debug.config.tmp + rm kernel-5.14.0-x86_64-debug.config.tmp + for i in kernel-5.14.0-x86_64*.config + mv kernel-5.14.0-x86_64.config kernel-5.14.0-x86_64.config.tmp + ./merge.pl /home/fcc/rpmbuild/SOURCES/kernel-local kernel-5.14.0-x86_64.config.tmp + rm kernel-5.14.0-x86_64.config.tmp + cp /home/fcc/rpmbuild/SOURCES/process_configs.sh . + OPTS= + OPTS=' -w -n -c' + ./process_configs.sh -w -n -c kernel 5.14.0 error: Bad exit status from /var/tmp/rpm-tmp.yeTFEV (%prep)
Your output has an extra for loop. I'm not sure where that comes from. The OPTS line is also different when you run process_configs.sh
I ran a diff between your spec file and mine, and I found that there were setting changes that I have that you do not have. That first one looks like the culprit.
%define with_configchecks %{?_without_configchecks: 0} %{?!_without_configchecks: 0}
%define with_headers 1
%define with_perf 1
%define with_tools 1
# bpftool btf dump file vmlinux format c > $RPM_BUILD_ROOT/$DevelDir/vmlinux.h
#config(noreplace) /etc/modprobe.d/*-blacklist.conf\
Try these, and see if they work for you. If they don't, I can post the spec file and the kernel-local I use. The kernel-local is tuned to my hardware, so won't build a system you want, but they can show if what works here works there. I don't think it will be necessary, I think it is the configchecks setting above that is causing the problem. I should have thought of it, but I have been setting it for years, so it's on autopilot.
Thank you very much!
This is the kernel.spec file after modification. http://cwillu.com:8080/112.119.240.206/5
Then I got build dependencies errors:
$ rpmbuild -bb kernel.spec setting SOURCE_DATE_EPOCH=1627084800 error: Failed build dependencies: asciidoc is needed by kernel-5.14.0-0.rc3.29.20210803.fc34.x86_64 audit-libs-devel is needed by kernel-5.14.0-0.rc3.29.20210803.fc34.x86_64 libbabeltrace-devel is needed by kernel-5.14.0-0.rc3.29.20210803.fc34.x86_64 libbpf-devel is needed by kernel-5.14.0-0.rc3.29.20210803.fc34.x86_64 libcap-ng-devel is needed by kernel-5.14.0-0.rc3.29.20210803.fc34.x86_64 libtraceevent-devel is needed by kernel-5.14.0-0.rc3.29.20210803.fc34.x86_64 newt-devel is needed by kernel-5.14.0-0.rc3.29.20210803.fc34.x86_64 numactl-devel is needed by kernel-5.14.0-0.rc3.29.20210803.fc34.x86_64 perl(ExtUtils::Embed) is needed by kernel-5.14.0-0.rc3.29.20210803.fc34.x86_64 xmlto is needed by kernel-5.14.0-0.rc3.29.20210803.fc34.x86_64
I will try to install all of them then try again.
After installation of the reported dependency issues, building can proceed without the previous error.
A million thanks!
On Tue, 03 Aug 2021 17:02:34 -0000 "Sampson Fung" sampsonfung@gmail.com wrote:
After installation of the reported dependency issues, building can proceed without the previous error.
Excellent!
A million thanks!
You're welcome.
The compile stopped with error. But I did not capture it.
When I rerun the command rpmbuild -bb kernel.spec, will it continue (so that all built .o modules do not need to recompile) or it will start fresh?
The second run is much faster.
build_output: http://cwillu.com:8080/112.119.240.206/7
error_output: http://cwillu.com:8080/112.119.240.206/8
kernel.spec: http://cwillu.com:8080/112.119.240.206/9
On Wed, 04 Aug 2021 02:18:55 -0000 "Sampson Fung" sampsonfung@gmail.com wrote:
The second run is much faster.
build_output: http://cwillu.com:8080/112.119.240.206/7
error_output: http://cwillu.com:8080/112.119.240.206/8
kernel.spec: http://cwillu.com:8080/112.119.240.206/9
My builds choke if I have this uncommented, but yours obviously need it. #config(noreplace) /etc/modprobe.d/*-blacklist.conf\ Change it to: %config(noreplace) /etc/modprobe.d/*-blacklist.conf\
On the plus side, you are almost there. The file checking only occurs as the rpms are being created. The compile successfully completed.
Finally!
I started with a fresh install of Fedora-34 and kernel-5.13.6-200.fc34.src.rpm
Before the previous build, I did not done `sudo rpmbuild builddep kernel.spec`, so some builddep is not installed before build starts.
The critical change to kernel.spec to allow the build to go ahead:
%define with_configchecks %{?_without_configchecks: 0} %{?!_without_configchecks: 0}
With this :
# We only build kernel-headers on the following... %if 0%{?fedora} %define nobuildarches i386 i686 ppc64 s390x %{arm} %{power64} aarch64 ppc64le %else %define nobuildarches i386 i686 %{arm} %endif
# kernel PAE (only valid for ARM (lpae)) %define with_pae %{?_without_pae: 0} %{?!_without_pae: 0} # kernel-debug %define with_debug %{?_without_debug: 0} %{?!_without_debug: 0} # kernel-debuginfo %define with_debuginfo %{?_without_debuginfo: 0} %{?!_without_debuginfo: 0}
I got: $ ls -lsh total 97M 68K -rw-rw-r--. 1 fcc fcc 66K Aug 5 03:00 kernel-5.13.6-200.0805.fc34.x86_64.rpm 38M -rw-rw-r--. 1 fcc fcc 38M Aug 5 03:00 kernel-core-5.13.6-200.0805.fc34.x86_64.rpm 15M -rw-rw-r--. 1 fcc fcc 15M Aug 5 03:00 kernel-devel-5.13.6-200.0805.fc34.x86_64.rpm 42M -rw-rw-r--. 1 fcc fcc 42M Aug 5 03:00 kernel-modules-5.13.6-200.0805.fc34.x86_64.rpm 2.3M -rw-rw-r--. 1 fcc fcc 2.3M Aug 5 03:00 kernel-modules-extra-5.13.6-200.0805.fc34.x86_64.rpm 272K -rw-rw-r--. 1 fcc fcc 272K Aug 5 03:00 kernel-modules-internal-5.13.6-200.0805.fc34.x86_64.rpm
After doing `rpm -ivh kernel-5* kernel-core-5* kernel-modules-5* kernel-devel-5*`, it booted OK.
On Wed, 04 Aug 2021 19:35:20 -0000 "Sampson Fung" sampsonfung@gmail.com wrote:
Finally!
[snip]
I got: $ ls -lsh total 97M 68K -rw-rw-r--. 1 fcc fcc 66K Aug 5 03:00 kernel-5.13.6-200.0805.fc34.x86_64.rpm 38M -rw-rw-r--. 1 fcc fcc 38M Aug 5 03:00 kernel-core-5.13.6-200.0805.fc34.x86_64.rpm 15M -rw-rw-r--. 1 fcc fcc 15M Aug 5 03:00 kernel-devel-5.13.6-200.0805.fc34.x86_64.rpm 42M -rw-rw-r--. 1 fcc fcc 42M Aug 5 03:00 kernel-modules-5.13.6-200.0805.fc34.x86_64.rpm 2.3M -rw-rw-r--. 1 fcc fcc 2.3M Aug 5 03:00 kernel-modules-extra-5.13.6-200.0805.fc34.x86_64.rpm 272K -rw-rw-r--. 1 fcc fcc 272K Aug 5 03:00 kernel-modules-internal-5.13.6-200.0805.fc34.x86_64.rpm
After doing `rpm -ivh kernel-5* kernel-core-5* kernel-modules-5* kernel-devel-5*`, it booted OK.
Good job.
I think it would be better to use dnf -C install so that the package manager knows about the packages in its database. It is possible that it will refresh its database from the rpm database, though it didn't in the past. If you do a dnf list installed kernel* , are your new packages in the list.
Anyway, all's well that ends well.
rpm -qa and dnf list installed return the same result.
$ rpm -qa kernel* kernel-core-5.11.12-300.fc34.x86_64 kernel-modules-5.11.12-300.fc34.x86_64 kernel-5.11.12-300.fc34.x86_64 kernel-modules-extra-5.11.12-300.fc34.x86_64 kernel-core-5.13.6-200.fc34.x86_64 kernel-modules-5.13.6-200.fc34.x86_64 kernel-5.13.6-200.fc34.x86_64 kernel-headers-5.13.3-200.fc34.x86_64 kernel-modules-extra-5.13.6-200.fc34.x86_64 kernel-srpm-macros-1.0-4.fc34.noarch kernel-core-5.13.6-200.0805.fc34.x86_64 kernel-modules-5.13.6-200.0805.fc34.x86_64 kernel-5.13.6-200.0805.fc34.x86_64 kernel-devel-5.13.6-200.0805.fc34.x86_64
$ dnf list intalled kernel* Fedora 34 - x86_64 - Updates 6.6 kB/s | 6.0 kB 00:00 Fedora 34 - x86_64 - Updates 382 kB/s | 444 kB 00:01 Fedora Modular 34 - x86_64 - Updates 22 kB/s | 5.9 kB 00:00 Installed Packages kernel.x86_64 5.11.12-300.fc34 @anaconda kernel.x86_64 5.13.6-200.fc34 @updates kernel.x86_64 5.13.6-200.0805.fc34 @System kernel-core.x86_64 5.11.12-300.fc34 @anaconda kernel-core.x86_64 5.13.6-200.fc34 @updates kernel-core.x86_64 5.13.6-200.0805.fc34 @System kernel-devel.x86_64 5.13.6-200.0805.fc34 @System kernel-headers.x86_64 5.13.3-200.fc34 @updates kernel-modules.x86_64 5.11.12-300.fc34 @anaconda kernel-modules.x86_64 5.13.6-200.fc34 @updates kernel-modules.x86_64 5.13.6-200.0805.fc34 @System kernel-modules-extra.x86_64 5.11.12-300.fc34 @anaconda kernel-modules-extra.x86_64 5.13.6-200.fc34 @updates kernel-srpm-macros.noarch 1.0-4.fc34 @fedora Available Packages
Regarding the kernel.spec issue, I reported it as https://bugzilla.redhat.com/show_bug.cgi?id=1990129
Change the below from 1 to 0 allow rpmbuild to finish building the kernel RPM packages.
diff kernel.spec.dist kernel.spec.works 202c202 < %define with_configchecks %{?_without_configchecks: 0} %{?!_without_configchecks: 1} ---
%define with_configchecks %{?_without_configchecks: 0} %{?!_without_configchecks: 0}
If I want to learn how to read kernel.spec, where should I start?
On Thu, 05 Aug 2021 02:33:57 -0000 "Sampson Fung" sampsonfung@gmail.com wrote:
rpm -qa and dnf list installed return the same result.
Thanks for the info, looks like you are in business.
Regarding the kernel.spec issue, I reported it as https://bugzilla.redhat.com/show_bug.cgi?id=1990129
Change the below from 1 to 0 allow rpmbuild to finish building the kernel RPM packages.
diff kernel.spec.dist kernel.spec.works 202c202 < %define with_configchecks %{?_without_configchecks: 0} %{?!_without_configchecks: 1} ---
%define with_configchecks %{?_without_configchecks: 0} %{?!_without_configchecks: 0}
It might get accepted, though the policy of the fedora kernel team has been that anyone who builds their own kernels is on their own. It makes sense because there are so many combinatorial possibilities. But maybe it has changed.
If I want to learn how to read kernel.spec, where should I start?
Well, the first thing is to understand the spec file organization.
https://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/Pac...
I'm not aware of any spec file documentation specific to the kernel. I think it is institutional awareness within the fedora kernel team. You can create a new thread here on the kernel list with something like "can you point me to documentation of the kernel spec file" as the subject, and maybe someone with more knowledge than me will give you links to such documentation, if it exists.
kernel@lists.fedoraproject.org