Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
What are pros and cons of genkernel?
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3  Next  
Reply to topic    Gentoo Forums Forum Index Gentoo Chat
View previous topic :: View next topic  
Author Message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Fri Feb 28, 2020 7:08 pm    Post subject: Reply with quote

That's a good point. I let `make install` manage /boot/vmlinuz and vmlinuz.old but I keep a third boot entry that's only updated by hand. It's saved me from needing a USB stick a few times now.
Back to top
View user's profile Send private message
figueroa
Advocate
Advocate


Joined: 14 Aug 2005
Posts: 2965
Location: Edge of marsh USA

PostPosted: Fri Feb 28, 2020 8:11 pm    Post subject: Reply with quote

Ant P. wrote:
figueroa wrote:
Ant P. wrote:
`make oldconfig` takes literally 20 seconds and an incremental build takes minutes, not hours.

I've been using `make olddefconfig` for the last year or so. Do you believe that's a sound practice?

It's mostly a matter of preference. I prefer to audit the new options because there's still the occasional default-Y hardware driver sneaking in, and sometimes an interesting thing appears like SENSORS_DRIVETEMP that I'd miss otherwise.

Either way, there's scripts/diffconfig that can show you exactly what you agreed to.


Thanks those reasons and hints. I guess I need to audit my current .config.

I got the idea of changing to use olddefconfig from the Gentoo Kernel Upgrade Wiki at https://wiki.gentoo.org/wiki/Kernel/Upgrade that doesn't even mention using `make oldconfig` :-(
_________________
Andy Figueroa
hp pavilion hpe h8-1260t/2AB5; spinning rust x3
i7-2600 @ 3.40GHz; 16 gb; Radeon HD 7570
amd64/23.0/split-usr/desktop (stable), OpenRC, -systemd -pulseaudio -uefi
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Fri Feb 28, 2020 8:46 pm    Post subject: Reply with quote

Yes, it is real poor advice there. Any wiki should be taken with a grain of salt.
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
Section_8
l33t
l33t


Joined: 22 May 2004
Posts: 627

PostPosted: Fri Feb 28, 2020 11:04 pm    Post subject: Reply with quote

erm67 wrote:

I don't think those are updated anymore:
RIP pappy:
https://forums.gentoo.org/viewtopic-t-1108804.html

The idea was good however, since everybody wants a different kernel, the only way is to start with a generic and apply to it what you need. You don't certainly want systemd options in your kernel .....

So sorry - I lurk here a lot, but missed that post that Pappy passed away. He contributed a lot to Gentoo.
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 21714

PostPosted: Sat Feb 29, 2020 1:46 am    Post subject: Reply with quote

Tuning a kernel to its intended use can be helpful for several reasons. Omitting unnecessary code means less attack surface. It reduces kernel memory usage, which means more memory is available for the system to do useful work. (On non-embedded systems, the percentage savings here is probably not enough to be interesting, though.) It reduces kernel build time, by not building functionality you won't be using. It may improve kernel startup performance by not initializing drivers which then find no hardware to manage.
Back to top
View user's profile Send private message
figueroa
Advocate
Advocate


Joined: 14 Aug 2005
Posts: 2965
Location: Edge of marsh USA

PostPosted: Sat Feb 29, 2020 3:13 am    Post subject: Reply with quote

Ant P. wrote:
It's mostly a matter of preference. I prefer to audit the new options because there's still the occasional default-Y hardware driver sneaking in, and sometimes an interesting thing appears like SENSORS_DRIVETEMP that I'd miss otherwise.

Re: make olddefconfig vs make oldconfig
Of course, I didn't say it, but I'm still using 4.9 series (currently at 4.9.210 stable), so I'm not expecting biggie new features. But, I think I'll change my slovenly lazy habits and go back to oldconfig.
_________________
Andy Figueroa
hp pavilion hpe h8-1260t/2AB5; spinning rust x3
i7-2600 @ 3.40GHz; 16 gb; Radeon HD 7570
amd64/23.0/split-usr/desktop (stable), OpenRC, -systemd -pulseaudio -uefi
Back to top
View user's profile Send private message
C1REX
l33t
l33t


Joined: 02 Jan 2004
Posts: 774
Location: Poland/UK

PostPosted: Sat Feb 29, 2020 11:46 am    Post subject: Reply with quote

Hu - thanks for yet another good argument :)

So to summarise if config is done right then compiling may:

- reduce boot time
- reduce compilation time
- less or even 0 module mess
- less security holes
- little bit less Ram usage what might help old hardware
- potentially performance boost if genkernel is missing some options
_________________
CLICK HERE to help move gentoo up on distrowatch.

If you like Gentoo you can thank devs here - https://www.gentoo.org/donate/
Back to top
View user's profile Send private message
erm67
l33t
l33t


Joined: 01 Nov 2005
Posts: 653
Location: EU

PostPosted: Sat Feb 29, 2020 6:34 pm    Post subject: Reply with quote

C1REX wrote:

- potentially performance boost if genkernel is missing some options

Only in the unlikely case of a macroscopic error .... don't count on a noticeable boost. And there are no secret patches that boosts performance ......
_________________
Ok boomer
True ignorance is not the absence of knowledge, but the refusal to acquire it.
Ab esse ad posse valet, a posse ad esse non valet consequentia

My fediverse account: @erm67@erm67.dynu.net
Back to top
View user's profile Send private message
Dr.Willy
Guru
Guru


Joined: 15 Jul 2007
Posts: 547
Location: NRW, Germany

PostPosted: Wed Mar 04, 2020 7:50 pm    Post subject: Reply with quote

figueroa wrote:
I used to use https://kmuto.jp/debian/hcl/ to help me with hardware drivers, but it's been discontinued. Anybody know of a similar resource?

Sure: /lib/modules/${yourkernel}/modules.alias
It contains a list of all (installed) modules and the hardware it works on as a glob pattern on the hardwares modalias id.
You can find the ids all presently plugged in /sys
Code:
find /sys/devices/ -name modalias -exec sort -u {} +

_________________
gentoo repos: kakoune | oil | hyper-v
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Wed Mar 04, 2020 11:48 pm    Post subject: Reply with quote

erm67 wrote:
C1REX wrote:

- potentially performance boost if genkernel is missing some options

Only in the unlikely case of a macroscopic error .... don't count on a noticeable boost. And there are no secret patches that boosts performance ......

There are no secret options, there are plain options which need to be chosen properly. Genkernel does not do it. As there is not possible to have a generic set of USE flags which satisfies everyone there cannot be generic kernel which is perfect for all use cases.

We have had such threads in past. And we will have them in the future. These are started by people who skip kernel configuration in favor of some generic solution. I guess they do 'make menuconfig', look at all those options and think: aw @#$%, this hurts. And then there is a little voice inside their head, it keeps telling them: you are missing out, you got to do your own kernel. To silence this voice they come here and start a thread like this. Ten people can tell them ten times custom kernel will perform better than generic and they will ignore all these ten, this is not the answer they want to hear. And then when someone comes along and tells them: yea, genkernel is as good as custom then they can happily rest. Unfortunately this is not true, but who cares about truth. Appearances are what count.
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
C1REX
l33t
l33t


Joined: 02 Jan 2004
Posts: 774
Location: Poland/UK

PostPosted: Thu Mar 05, 2020 12:21 am    Post subject: Reply with quote

Jaglover - in my case it's the opposite. I ask about genkernel as I've never tried one. Not sure why. It just feels more clean I guess.
_________________
CLICK HERE to help move gentoo up on distrowatch.

If you like Gentoo you can thank devs here - https://www.gentoo.org/donate/
Back to top
View user's profile Send private message
ff11
l33t
l33t


Joined: 10 Mar 2014
Posts: 664

PostPosted: Thu Mar 05, 2020 12:43 am    Post subject: Reply with quote

Well, I use my "sys-kernel/gentoo-sources" with the flags "experimental symlink".
Each update of kernel, I copy my old config in "/etc/kernels/" to the new name-version
After this, genkernel:
Code:
# genkernel --menuconfig all

Update my configuration. Then let the genkernel do the job.
After genkernel, I update my grub and modules:
Code:
# grub-mkconfig -o /boot/grub/grub.cfg
# emerge -1av @module-rebuild


And if I need change something on one compiled kernel, I use:
Code:
# genkernel --no-clean --no-mrproper --menuconfig all


I could make a better use of "/etc/genkernel.conf", but at least I know what I'm doing.
I'm happy with genkernel :)
_________________
| Proverbs 26:12 |
| There is more hope for a fool than for a wise man that are wise in his own eyes. |
* AlphaGo - The Movie - Full Documentary "I want to apologize for being so powerless" - Lee
Back to top
View user's profile Send private message
axl
Veteran
Veteran


Joined: 11 Oct 2002
Posts: 1144
Location: Romania

PostPosted: Thu Mar 05, 2020 3:14 am    Post subject: Reply with quote

When you have one machine, with one kernel... I don't know how much genkernel can help. But when you have like 30... it begins to be very clear.

LIke:

Code:
find /hosts/ -maxdepth 2 -name config | xargs -i dirname {} | xargs -i echo genkernel --kernel-config={}/config --bootdir={} kernel
genkernel --kernel-config=/hosts/ruja/config --bootdir=/hosts/ruja kernel
genkernel --kernel-config=/hosts/liodiana/config --bootdir=/hosts/liodiana kernel
genkernel --kernel-config=/hosts/sky/config --bootdir=/hosts/sky kernel
genkernel --kernel-config=/hosts/catarina/config --bootdir=/hosts/catarina kernel
genkernel --kernel-config=/hosts/zalina/config --bootdir=/hosts/zalina kernel
genkernel --kernel-config=/hosts/kasandra/config --bootdir=/hosts/kasandra kernel
genkernel --kernel-config=/hosts/dragaia/config --bootdir=/hosts/dragaia kernel
genkernel --kernel-config=/hosts/foiofia/config --bootdir=/hosts/foiofia kernel
genkernel --kernel-config=/hosts/marina/config --bootdir=/hosts/marina kernel
genkernel --kernel-config=/hosts/tiranda/config --bootdir=/hosts/tiranda kernel
genkernel --kernel-config=/hosts/rudeana/config --bootdir=/hosts/rudeana kernel
genkernel --kernel-config=/hosts/ruxanda/config --bootdir=/hosts/ruxanda kernel
genkernel --kernel-config=/hosts/lacargia/config --bootdir=/hosts/lacargia kernel
genkernel --kernel-config=/hosts/aya/config --bootdir=/hosts/aya kernel
genkernel --kernel-config=/hosts/adela/config --bootdir=/hosts/adela kernel
genkernel --kernel-config=/hosts/lemnica/config --bootdir=/hosts/lemnica kernel
genkernel --kernel-config=/hosts/dumernica/config --bootdir=/hosts/dumernica kernel
genkernel --kernel-config=/hosts/todosia/config --bootdir=/hosts/todosia kernel
genkernel --kernel-config=/hosts/cosanzeana/config --bootdir=/hosts/cosanzeana kernel
genkernel --kernel-config=/hosts/self/config --bootdir=/hosts/self kernel


this is just on a small old server. genkernel is for automating building kernels. it's not for a single kernel. although you could use it for that. But it really shines at building multiple automated builds.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Thu Mar 05, 2020 12:04 pm    Post subject: Reply with quote

from time to time i do a make oldmodconfig kernel, then look at what new modules are use (it's not magic, simply delegating to eudev the task of telling me what modules are ok for my hardware)
of course it's a pain, it takes lot of time building all these modules, but if you ever do it, you'll be surprise by the result
Back to top
View user's profile Send private message
C1REX
l33t
l33t


Joined: 02 Jan 2004
Posts: 774
Location: Poland/UK

PostPosted: Thu Mar 05, 2020 4:09 pm    Post subject: Reply with quote

Delete, please :)
_________________
CLICK HERE to help move gentoo up on distrowatch.

If you like Gentoo you can thank devs here - https://www.gentoo.org/donate/


Last edited by C1REX on Thu Mar 05, 2020 7:35 pm; edited 1 time in total
Back to top
View user's profile Send private message
figueroa
Advocate
Advocate


Joined: 14 Aug 2005
Posts: 2965
Location: Edge of marsh USA

PostPosted: Thu Mar 05, 2020 5:10 pm    Post subject: Reply with quote

krinn wrote:
from time to time i do a make oldmodconfig kernel, then look at what new modules are use (it's not magic, simply delegating to eudev the task of telling me what modules are ok for my hardware)
of course it's a pain, it takes lot of time building all these modules, but if you ever do it, you'll be surprise by the result

Do you mean "make allmodconfig?" Ref: https://wiki.gentoo.org/wiki/Kernel/Configuration "make help" doesn't show any oldmodconfig.
_________________
Andy Figueroa
hp pavilion hpe h8-1260t/2AB5; spinning rust x3
i7-2600 @ 3.40GHz; 16 gb; Radeon HD 7570
amd64/23.0/split-usr/desktop (stable), OpenRC, -systemd -pulseaudio -uefi
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Fri Mar 06, 2020 2:48 pm    Post subject: Reply with quote

figueroa wrote:
krinn wrote:
from time to time i do a make oldmodconfig kernel, then look at what new modules are use (it's not magic, simply delegating to eudev the task of telling me what modules are ok for my hardware)
of course it's a pain, it takes lot of time building all these modules, but if you ever do it, you'll be surprise by the result

Do you mean "make allmodconfig?" Ref: https://wiki.gentoo.org/wiki/Kernel/Configuration "make help" doesn't show any oldmodconfig.

i mean all not old :D
but you guess good from the idea, making everything as modules (except critical to boot ones) then boot that kernel and see what modules are loaded by your dev manager
it is as the debian website you used, but it's more complete (as it work with hwdb list of devices) and it's easier to get the list of modules you should/could have (as you do nothing except an lsmod)
Back to top
View user's profile Send private message
5UrNkC27BJ
n00b
n00b


Joined: 27 Mar 2022
Posts: 28

PostPosted: Tue Apr 26, 2022 7:02 pm    Post subject: Re: What are pros and cons of genkernel? Reply with quote

C1REX wrote:
I've never tried genkernel. Main reason is probably pride and ego.

- Does genkernel use -march=native -O2 flag from make.conf?


maybe?

i prefer the simple -march=native but i can't find any part of genkernel documentation the any longer supports kernel CFLAGS. just --util-cflags

what i see here is march=core2 and to the best of my knowledge I am exporting HOSTCFLAGS, KERNEL_CFLAGS and hitting a wall with it.

i don't need initrd and have never seen where the contents of initrd are fully maintained and up-to-date.


```
gcc -Wp,-MMD,arch/x86/entry/vdso/.vma.o.d -nostdinc -I./arch/x86/include -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -fmacro-prefix-map=./= -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-protection=none -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -march=core2 -mno-red-zone -mcmodel=kernel -DCONFIG_X86_X32_ABI -Wno-sign-compare -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 -fno-allow-store-data-races -Wframe-larger-than=2048 -fstack-protector-strong -Wimplicit-fallthrough=5 -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -fno-stack-clash-protection -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation -Wno-zero-length-bounds -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -Wno-alloc-size-larger-than -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wno-packed-not-aligned -DKBUILD_MODFILE='"arch/x86/entry/vdso/vma"' -DKBUILD_BASENAME='"vma"' -DKBUILD_MODNAME='"vma"' -D__KBUILD_MODNAME=kmod_vma -c -o arch/x86/entry/vdso/vma.o arch/x86/entry/vdso/vma.c ; ./tools/objtool/objtool orc generate --no-fp --uaccess arch/x86/entry/vdso/vma.o
```
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54308
Location: 56N 3W

PostPosted: Tue Apr 26, 2022 7:15 pm    Post subject: Reply with quote

5UrNkC27BJ,

No part of make.conf is used in the kernel build.

Its just you, the .config file, make and any options you care to pass to make.
Its possible to pass compiler flags to make when you build the kernel but if you do that, you get to keep all the pieces when it breaks.

USE=experimental when you emerge the kernel gets you experimental patch set of the day.

Genkernel itself, when its being built, follows make.conf but i don't think that was the intent of the question,
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
5UrNkC27BJ
n00b
n00b


Joined: 27 Mar 2022
Posts: 28

PostPosted: Wed Apr 27, 2022 9:14 am    Post subject: Reply with quote

NeddySeagoon wrote:
5UrNkC27BJ,
Its possible to pass compiler flags to make when you build the kernel but if you do that, you get to keep all the pieces when it breaks.



thanks how, and where is that documented? many years ago kernel CFLAGS was right up front in the GK docs.

i have seen that all of my attempts to be in the env and find switches, short of reading genkernel source, appear to intercept and deleted or string-replaced relating to '-march'.

if is set+export env vars, they do no survive to the makefiles they appear in.

if i set the CC, the -march= gets deleted and the compiler errors everything out.

if i make something clever in makeopts again the variable doesn't translate so well through n levels of escape nesting, and this is clearly a bad idea to bring forward in any write-once-and-forget type of config. and aside from the bad idea part, fails.

for my home-gamer needs, having a localmodconfig setup with RCU i have carried over from vanilla kernels on ubuntu it seems like the best bet is indeed to just inform the build of grub2 and maybe carry along some version string fs-turds to increment.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54308
Location: 56N 3W

PostPosted: Wed Apr 27, 2022 4:57 pm    Post subject: Reply with quote

5UrNkC27BJ,

Hint: Read the kernel makefile. Its documented in the comments.

Make sure to practice on a spare kernel, so that the binary and modules are kept separate from your working kernel.
When it breaks, sympathy will be minimal.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
5UrNkC27BJ
n00b
n00b


Joined: 27 Mar 2022
Posts: 28

PostPosted: Thu Apr 28, 2022 4:24 am    Post subject: Reply with quote

NeddySeagoon wrote:
5UrNkC27BJ,

Hint: Read the kernel makefile. Its documented in the comments.

Make sure to practice on a spare kernel, so that the binary and modules are kept separate from your working kernel.
When it breaks, sympathy will be minimal.



ok so more specifically, how does one use genkernel and not have -march=native squashed as i have seen by abiding linus's makefile? anyone else?

here's what's producing -march=core2 above:


cfg=(

--bootloader=grub2
--no-mrproper
--no-clean
--no-firmware
--no-busybox
--no-keymap
--real-root=UUID=efea9656-2c14-4290-b2c8-0e45b65b6634
--no-zfs
--no-btrfs
--no-virtio
--no-iscsi
--no-ssh
--no-splash
--no-microcode-initramfs
--nice=19
--no-postclear
--compress-initramfs-type=zstd
)
export KERNEL_CFLAGS=' -march=native '
export HOSTCFLAGS=' -march=native '

HOSTCFLAGS=' -march=native ' genkernel all ${cfg[*]} --makeopts='-j8'&& {
Back to top
View user's profile Send private message
Juippisi
Developer
Developer


Joined: 30 Sep 2005
Posts: 727
Location: /home

PostPosted: Thu Apr 28, 2022 6:24 am    Post subject: Reply with quote

Alternatively use the cpu-optimizations patch, available with gentoo-sources through +experimental use flag, and by default in pf-sources. It enables setting -march through menuconfig (or just kernel config).
https://dev.gentoo.org/~mpagano/genpatches/trunk/5.17/5010_enable-cpu-optimizations-universal.patch
Back to top
View user's profile Send private message
5UrNkC27BJ
n00b
n00b


Joined: 27 Mar 2022
Posts: 28

PostPosted: Thu Apr 28, 2022 7:04 pm    Post subject: Reply with quote

Juippisi wrote:
Alternatively use the cpu-optimizations patch, available with gentoo-sources through +experimental use flag, and by default in pf-sources. It enables setting -march through menuconfig (or just kernel config).
https://dev.gentoo.org/~mpagano/genpatches/trunk/5.17/5010_enable-cpu-optimizations-universal.patch


thanks. this patch is in zen, and i used that until the papercuts involved outweighed the efficacy.


sed 's,-march=core2,-march=native,' -i $(find Makefile)

is on my list of simple things to try if i keep with GK, and i really do like GK but for this nit.

'-march' follows all the spelled out -mno flags which presumably come from linus's chosen config switch --march gcc -n choices. (or whatever dumps the arch flags)
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54308
Location: 56N 3W

PostPosted: Thu Apr 28, 2022 7:45 pm    Post subject: Reply with quote

5UrNkC27BJ,

Makefile:
# Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
KBUILD_CPPFLAGS += $(KCPPFLAGS)
KBUILD_AFLAGS   += $(KAFLAGS)
KBUILD_CFLAGS   += $(KCFLAGS)

is the fragment I had in mind.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo Chat All times are GMT
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum