Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Trim kernel configuration
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Dwosky
Tux's lil' helper
Tux's lil' helper


Joined: 07 Nov 2018
Posts: 87

PostPosted: Mon Nov 26, 2018 12:28 pm    Post subject: Trim kernel configuration Reply with quote

I was wondering if there is some documentation or tool which we can check to see what items are not being used by our kernel / system in order to remove them from the configuration in a way of improving kernel build times on lower spec systems.

I know the basic ones to remove mostly drivers that you know your system isn't going to use, but I was wondering if there is a more in depth system to try to reduce the kernel configuration to a bare minimum or at least not to a bloated default config one.
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


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

PostPosted: Mon Nov 26, 2018 1:02 pm    Post subject: Reply with quote

The only way I know is start with 'make allnoconfig' and add what you need. But if you find an application which can read your mind - for instance if I want firewall or not - then I'd gladly use it. :P
_________________
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
Dwosky
Tux's lil' helper
Tux's lil' helper


Joined: 07 Nov 2018
Posts: 87

PostPosted: Mon Nov 26, 2018 1:06 pm    Post subject: Reply with quote

I don't know what's better now, start from zero and try to build a running kernel that doesn't end in panic or start removing pieces from the actual one until you reach panic and rollback :lol:

Still in my case the issue is not "I don't know if I want X feature", but just fit the kernel to all the features the system has/works with right now.
Back to top
View user's profile Send private message
ct85711
Veteran
Veteran


Joined: 27 Sep 2005
Posts: 1696

PostPosted: Mon Nov 26, 2018 4:01 pm    Post subject: Reply with quote

I know for me, I prefer to go with the second route (I have done the first before when I first learned how to compile a kernel, pre-gentoo). My reasoning, is that I would rather have a running machine first, and less hassle when trying to figure out what all you need. The big thing that I would think you need to consider, is if you are space limited or not (on if a bigger kernel size is going to cause issues).
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 5761

PostPosted: Mon Nov 26, 2018 6:31 pm    Post subject: Reply with quote

"make localyesconfig" will build a kernel with only the drivers you're currently using. Use menuconfig to go in and re-add modules for things like disconnected USB peripherals and you're 99% done.
Back to top
View user's profile Send private message
PrSo
Tux's lil' helper
Tux's lil' helper


Joined: 01 Jun 2017
Posts: 128

PostPosted: Mon Nov 26, 2018 7:11 pm    Post subject: Reply with quote

Ant P. wrote:
"make localyesconfig" will build a kernel with only the drivers you're currently using. Use menuconfig to go in and re-add modules for things like disconnected USB peripherals and you're 99% done.


+1

More stuff you will find in gentoo wiki like i.e. iptables(firewall), cups, sane, graphic card (intel/radeon/amdgpu/nvidia), and enable those kernel prerequisites when your machine needs it.

When you are decided to set the CFLAGS to "native" only in portage make.conf (gcc optimization) without using distcc, you could disable intel/amd (or others) stuff that you wont use in "Processor type and futures".

This is the beginning.
Later you should explore kernel config with make menuconfig and disable/enable what your machine will use.

This is my 2c.
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


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

PostPosted: Mon Nov 26, 2018 7:29 pm    Post subject: Reply with quote

CFLAGS from make.conf are not used for kernel compile. Enable 'experimental' use flag for sources, then you can enable -march=native inside kernel configuration.
_________________
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
PrSo
Tux's lil' helper
Tux's lil' helper


Joined: 01 Jun 2017
Posts: 128

PostPosted: Mon Nov 26, 2018 7:45 pm    Post subject: Reply with quote

Jaglover wrote:
CFLAGS from make.conf are not used for kernel compile. Enable 'experimental' use flag for sources, then you can enable -march=native inside kernel configuration.


100% correct.
Back to top
View user's profile Send private message
Dwosky
Tux's lil' helper
Tux's lil' helper


Joined: 07 Nov 2018
Posts: 87

PostPosted: Mon Nov 26, 2018 9:40 pm    Post subject: Reply with quote

Ant P. wrote:
"make localyesconfig" will build a kernel with only the drivers you're currently using. Use menuconfig to go in and re-add modules for things like disconnected USB peripherals and you're 99% done.

Thanks for the info, I didn't knew about that option.
Back to top
View user's profile Send private message
1clue
Advocate
Advocate


Joined: 05 Feb 2006
Posts: 2549

PostPosted: Mon Nov 26, 2018 10:09 pm    Post subject: Reply with quote

Yeah, the drivers are the easy part. The only way I know for the rest is read, read, read...

I've thought about building a minimal Gentoo system to get a bare-bones kernel config, but it seems like a huge amount of very repetitive work.
Back to top
View user's profile Send private message
Anon-E-moose
Advocate
Advocate


Joined: 23 May 2008
Posts: 3929
Location: Dallas area

PostPosted: Mon Nov 26, 2018 10:12 pm    Post subject: Reply with quote

pappy's preconfig are a pretty good place to start.
_________________
Asus m5a99fx, FX 8320 - nouveau, oss4, rx550 for qemu passthrough
Acer laptop E5-575, i3-7100u - i965, alsa
---both---
5.0.13 zen kernel, profile 17.0 (no-pie) amd64-no-multilib
gcc 8.2.0, eudev, openrc, openbox, palemoon
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


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

PostPosted: Mon Nov 26, 2018 11:26 pm    Post subject: Reply with quote

Dwosky wrote:
Ant P. wrote:
"make localyesconfig" will build a kernel with only the drivers you're currently using. Use menuconfig to go in and re-add modules for things like disconnected USB peripherals and you're 99% done.

Thanks for the info, I didn't knew about that option.

I'm not sure it will not include all modules currently loaded. Never used it. Usually there is a rather big number of unnecessary modules loaded when you boot live CD.
_________________
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
Dwosky
Tux's lil' helper
Tux's lil' helper


Joined: 07 Nov 2018
Posts: 87

PostPosted: Tue Nov 27, 2018 6:05 am    Post subject: Reply with quote

Jaglover wrote:
I'm not sure it will not include all modules currently loaded. Never used it. Usually there is a rather big number of unnecessary modules loaded when you boot live CD.

Yeah, I know. The idea its to use it on an actual running system instead of via LiveCD in order to avoid all the drivers loaded by default for compatibility purposes.
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


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

PostPosted: Tue Nov 27, 2018 1:06 pm    Post subject: Reply with quote

So this is a chicken-egg problem. First you need to build a lean kernel, run it, and then you can use make localyesconfig ...
_________________
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
1clue
Advocate
Advocate


Joined: 05 Feb 2006
Posts: 2549

PostPosted: Tue Nov 27, 2018 3:02 pm    Post subject: Reply with quote

Jaglover wrote:
So this is a chicken-egg problem. First you need to build a lean kernel, run it, and then you can use make localyesconfig ...


You should be able to use localyesconfig from the system rescue cd. All the modules are there, but only the ones relevant to your installed hardware will be loaded.
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


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

PostPosted: Thu Dec 06, 2018 2:24 am    Post subject: Reply with quote

I just tried and make localyesconfig resulted in a terribly bloated config. Thanks but no thanks.
_________________
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
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