LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 01-11-2019, 11:37 AM   #1
TheLexx
Member
 
Registered: Apr 2013
Distribution: Gentoo
Posts: 79

Rep: Reputation: Disabled
Change many symbols from builtin to modules


Are there methods to move lots of tri-state symbols from built-in to modules in the kernel dot config file?

I have a kernel dot config file that produces a working kernel that I can use to boot one of my machines. I would however like to move lots of drivers from builtin to modules. I don't want everything to be modules, because I would like to boot without having to use a initram that contains modules. I understand this means that hard drive and other drivers must be builtin. In addition I have created short list of a few drivers I would like builtin. Other than under those categories, I would like most other things to be modules such as sound card, Ethernet, Frame buffer.

In the config file, I am only interested in turning symbols set at "=y" to symbols set at "=m". The lines that are "=n" I wish to leave as "=n". I have some ideas how I can run "make xconfig" and go on a hunt and destroy mission, but that seems labor intensive. What might help is to have an automation that will look at symbols that lie under a submenu and change those to "=m"

From what I understand,, "make allmodconfig" will turn both "=y" and "=n" into "=m" where as I want "=n" to remain "=n". Also From what I understand, "make localmodconfig" will only effect symbols that are already set to "=m".

::Background::
I am moving from a discontinued longterm stable kernel to 4.9.X LTS. I am currently experimenting with configuration files. I would like to build a kernel that I will use on a few wintel computers. They use different sound, video and networking hardware.

Do you have any suggestions that could make the task easier and less dependent on searching by hand?
 
Old 01-12-2019, 04:41 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Unless you intimately understand the make dependencies, labour intensive is the way to go. Dicking with the .config directly is definitely off the radar.

IMHO only.
 
Old 01-12-2019, 06:16 AM   #3
ehartman
Senior Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 1,674

Rep: Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888
Quote:
Originally Posted by syg00 View Post
Unless you intimately understand the make dependencies, labour intensive is the way to go. Dicking with the .config directly is definitely off the radar.
Especially as you cannot know which ones of those =y config file options DO have a =m alternative, there are a lot that only have =n as the other choice.
And quite a lot of those modules would get loaded in all cases anyway, so there's no memory saving BY making them into a module instead of built-in.
 
Old 01-13-2019, 04:46 PM   #4
TheLexx
Member
 
Registered: Apr 2013
Distribution: Gentoo
Posts: 79

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by syg00 View Post
Unless you intimately understand the make dependencies, labour intensive is the way to go. Dicking with the .config directly is definitely off the radar.

IMHO only.

I was hoping there was some sort of automated or simi-automated way to make the change, rather than manually changing the .config directly. At this point, it is more of an aside as to how well the "make oldconfig" can repair a .config file that has been set to an untenable state. Many years ago, I did create a python script that took two .config files and merged them, but the two files were different in very slight ways. I was able able to compile the kernel without a hitch. Again the changes were only minor, and I used "make oldconfig" and "make xconfig" to warn me of an untenable state.

It looks like I will use the more laborious method of boot the computer with a live distro. Armed with a list of modules, I will hunt the "make xconfig" to see what can be formed into modules.

I considered running "make allmodconfig" and comparing the .config to the .config I am using, but to make the comparison in any meaningful way I don't think would be worth the time.
 
Old 01-22-2019, 01:40 PM   #5
TheLexx
Member
 
Registered: Apr 2013
Distribution: Gentoo
Posts: 79

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ehartman View Post
<snip> quite a lot of those modules would get loaded in all cases anyway, so there's no memory saving BY making them into a module instead of built-in.
I suppose it depends on how well the original kernel configuration was trimmed to work on the computer it runs on. If the modules never get loaded in the first place, or many of the modules rarely get loaded that can produce a less portly kernel. Also, I have more than one computer with different sound cards and other hardware I wish to modularize the drivers for. In my case, I started with a somewhat generic configuration. I was able to go from 4.9 LTS kernel that was 6.1MB in size down to 3.7MB. With nostalgia, I look at a 2.2MB 3.4.X kernel on my HD. I suppose it is sort of old school to worry about kernel size in an age when computers with less than 4GiB are considered obsolete.



Contrary to my previous statement, I decide it was worth the time to compare my kernel to a "make allmodconfig" config file.

The idea is to make an allmodconfig file then compare the =m in that file to the =y in your file to create a file if what is common. I was able to look through "cfg-common-list.txt" and research symbols using "make xconfig". Many of which I was able to change.

Here is a step by step outline to help anyone in the future who finds this thread searching the archive.

Code:
## copy the current config file to current.config
cp .config current.config

## run "make allmodconfig"
## copy the new config file to allmod.config 
cp .config allmod.config

## restore .config to it's original state
cp current.config .config

## filter and sort all the "=y" from your original config
egrep -i '=y$' current.config | sed s/=y$//g | sort > cfg-yes-list.txt

## filter and sort all the "=m" from allmod.config
egrep -i '=m$' allmod.config | sed s/=m$//g | sort > cfg-mod-list.txt

## create a list that contains only those symboles common to both list
comm -1 -2  cfg-yes-list.txt cfg-mod-list.txt > cfg-common-list.txt
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
'nm' lists all symbols - including static library symbols painulyarun Programming 4 04-06-2010 04:04 AM
how can i change archtecure for ARM in MAEMO2 builtin SCRATCHBOX2 heavenly.park Linux - Mobile 1 09-11-2009 05:47 AM
Debugger selectively not using symbols in library with symbols Millenniumman Programming 5 03-25-2007 09:44 AM
Debugger selectively not using symbols in library with symbols Millenniumman Programming 1 03-03-2007 07:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 04:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration