View previous topic :: View next topic |
Author |
Message |
pietinger Moderator
Joined: 17 Oct 2006 Posts: 5050 Location: Bavaria
|
|
Back to top |
|
|
Genone Retired Dev
Joined: 14 Mar 2003 Posts: 9605 Location: beyond the rim
|
Posted: Mon Aug 05, 2024 4:11 pm Post subject: |
|
|
RomikB wrote: | Thats why they use current system kernel source to build compatible to system kernel module. |
Yeah, but unlike most other distros on Gentoo you don't have a standard kernel everyone uses, so that approach doesn't work quite the same. If you really need to work with the installed kernel sources vs. packaging it yourself, just check if they exist in src_prepare, fail if they don't and let the user sort it out. Don't try to pull them yourself as chances are high that you'll pull the wrong version or patchset. |
|
Back to top |
|
|
RomikB n00b
Joined: 03 Aug 2024 Posts: 23
|
Posted: Mon Aug 05, 2024 5:14 pm Post subject: |
|
|
Genone wrote: | Yeah, but unlike most other distros on Gentoo you don't have a standard kernel everyone uses, so that approach doesn't work quite the same. If you really need to work with the installed kernel sources vs. packaging it yourself, just check if they exist in src_prepare, fail if they don't and let the user sort it out. Don't try to pull them yourself as chances are high that you'll pull the wrong version or patchset. | Thats why me idea was to get current emerged kernel sources or emerge them. |
|
Back to top |
|
|
Genone Retired Dev
Joined: 14 Mar 2003 Posts: 9605 Location: beyond the rim
|
Posted: Mon Aug 05, 2024 5:44 pm Post subject: |
|
|
RomikB wrote: | Thats why me idea was to get current emerged kernel sources or emerge them. |
Wrong approach. When the user build their own kernels the sources are usually already installed. When they use a -bin kernel chances are high that they don't want to install a full kernel sourcetree on their system. And there simply is no such function as "get package containing sources for currently running kernel" (you can have a lot more than one kernel installed).
So just check if /usr/src/linux contains a valid and compatible source tree (pretty sure linux_mod eclass can help with that) and notify the user if there is a problem. Not everything needs to be fully automated. |
|
Back to top |
|
|
RomikB n00b
Joined: 03 Aug 2024 Posts: 23
|
Posted: Mon Aug 05, 2024 8:38 pm Post subject: |
|
|
Zucca wrote: | Nope. At least gentoo-kernel does contain sources. | I change my kernel from gentoo-kernel-bin to gentoo-kernel and get the same result. gentoo-kernel also not provide sources for virtual/linux-sources. Both packages download base kernel sources, patch them, use them for compilation, but user is have no option to leave the sources on disk.
The result will be unpatched base kernel sources and patches separately. Not the best option
Genone wrote: | Wrong approach. When the user build their own kernels the sources are usually already installed. When they use a -bin kernel chances are high that they don't want to install a full kernel sourcetree on their system. And there simply is no such function as "get package containing sources for currently running kernel" (you can have a lot more than one kernel installed).
So just check if /usr/src/linux contains a valid and compatible source tree (pretty sure linux_mod eclass can help with that) and notify the user if there is a problem. Not everything needs to be fully automated. |
You are right, Gentoo is often used with a complex setups. I try to cover only a way when a single kernel, for example gentoo-kernel-bin or gentoo-kernel is used. One kernel and a valid sources at /usr/src/linux.
Now I'm stuck trying to get the kernel sources for gentoo-kernel-bin and gentoo-kernel. The only way I found is fetch unpatched sources and manually patch them. |
|
Back to top |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3683 Location: Rasi, Finland
|
Posted: Mon Aug 05, 2024 9:02 pm Post subject: |
|
|
RomikB wrote: | Both packages download base kernel sources, patch them, use them for compilation, but user is have no option to leave the sources on disk. | Well that's strange... Code: | zucca@NBLK-WAX9X ~ $ find /usr/src/linux/ -type f -name Makefile | fgrep wireguard
/usr/src/linux/drivers/net/wireguard/Makefile
/usr/src/linux/tools/testing/selftests/wireguard/qemu/Makefile
zucca@NBLK-WAX9X ~ $ equery b /usr/src/linux/drivers/net/wireguard/Makefile
* Searching for /usr/src/linux/drivers/net/wireguard/Makefile ...
sys-kernel/gentoo-kernel-6.1.100 (/usr/src/linux-6.1.100-NBLK-WAX9X/drivers/net/wireguard/Makefile) | ... and no USE -flag seem to affect that: Code: | zucca@NBLK-WAX9X ~ $ equery u gentoo-kernel
[ Legend : U - final flag setting for installation]
[ : I - package is installed with flag ]
[ Colors : set, unset ]
* Found these USE flags for sys-kernel/gentoo-kernel-6.1.100:
U I
- - debug : Enable extra debug codepaths, like asserts and extra output. If you
want to get meaningful backtraces see
https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Backtraces
- - hardened : Use selection of hardening options recommended by Kernel Self
Protection Project
- - savedconfig : Use this to restore your config from /etc/portage/savedconfig
${CATEGORY}/${PN}. Make sure your USE flags allow for appropriate
dependencies
+ + strip : Allow symbol stripping to be performed by the ebuild for special
files
- - test : Enable dependencies and/or preparations necessary to run tests
(usually controlled by FEATURES=test but can be toggled
independently) |
I have the sources, you don't. But why?
What's the contents of your /usr/src/? _________________ ..: Zucca :..
My gentoo installs: | init=/sbin/openrc-init
-systemd -logind -elogind seatd |
Quote: | I am NaN! I am a man! |
|
|
Back to top |
|
|
RomikB n00b
Joined: 03 Aug 2024 Posts: 23
|
Posted: Mon Aug 05, 2024 10:22 pm Post subject: |
|
|
Zucca wrote: | I have the sources, you don't. But why?
What's the contents of your /usr/src/? |
I have headers, Kconfigs and Makefiles in /usr/src/. No *.c files. |
|
Back to top |
|
|
logrusx Advocate
Joined: 22 Feb 2018 Posts: 2380
|
Posted: Tue Aug 06, 2024 4:55 am Post subject: |
|
|
Zucca wrote: |
I have the sources, you don't. But why? |
Are you sure you can actually build a kernel from those sources or you're relying only on your command? My memory is gentoo-kernel didn't provide sources and I had to reemerge it if I wanted to rebuild a kernel.
Best Regards,
Georgi |
|
Back to top |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3683 Location: Rasi, Finland
|
Posted: Tue Aug 06, 2024 6:15 am Post subject: |
|
|
RomikB wrote: | I have headers, Kconfigs and Makefiles in /usr/src/. No *.c files. |
logrusx wrote: | Are you sure you can actually build a kernel from those sources or you're relying only on your command? |
Indeed, I was wrong. I only have few .c files. Code: | zucca@NBLK-WAX9X ~ $ find /usr/src/linux/ -type f -name '*.c' | wc -l
68 | This is interesting. As I have modified my kernel config by make nconfig then edit the parts I needed, then save the config, and finally run ./scripts/diffconfig -m to create a config snippet which I place under /etc/kernel/config.d/. Then I would re-emerge the kernel.
But now I get this Code: | NBLK-WAX9X /usr/src/linux # make nconfig
Makefile:2143: !!!! WARNING !!!!
Makefile:2144: This kernel was configured and installed by the package manager.
Makefile:2145: "make" should not be run manually here.
Makefile:2146: See also: https://wiki.gentoo.org/wiki/Project:Distribution_Kernel
Makefile:2147: See also: https://wiki.gentoo.org/wiki/Kernel/Configuration
Makefile:2148: !!!! WARNING !!!! | ... however I can still create kernel config this way.
So I'm not sure if the kernel sources were left in to the system before or if this warning has been added lately and there were no sources ever present. _________________ ..: Zucca :..
My gentoo installs: | init=/sbin/openrc-init
-systemd -logind -elogind seatd |
Quote: | I am NaN! I am a man! |
|
|
Back to top |
|
|
|