View previous topic :: View next topic |
Author |
Message |
Cheesyjuggler64 n00b
Joined: 16 May 2024 Posts: 39
|
Posted: Fri Dec 27, 2024 6:38 pm Post subject: Scripting the kernel configuration. |
|
|
I've been trying to understand how interact with the kconfig system that the Linux kernel operates on to script it and I've got no idea how. Is there anyway to programmatically traverse the kconfig structure like menu config does but instead save it is some sort of custom data structure or do you have to individually read the kconfig and set up the structure yourself. Is there no way to hook into some preexisting configuration scripts which all ready have to read all this data like make menuconfig and work from there? |
|
Back to top |
|
|
zen_desu Tux's lil' helper
Joined: 25 Oct 2024 Posts: 80
|
Posted: Fri Dec 27, 2024 6:42 pm Post subject: |
|
|
I'd like to be wrong, but I think you have to read the kconfig files in each dir and handle the includes in them.
that being said, you could use the parser from an existing script, and i think there are libraries for this. _________________ µgRD dev
Wiki writer |
|
Back to top |
|
|
Cheesyjuggler64 n00b
Joined: 16 May 2024 Posts: 39
|
Posted: Fri Dec 27, 2024 11:04 pm Post subject: |
|
|
So if I were to try and build one is the best way to just read in all the kconfig files and assimilate a structure from there? |
|
Back to top |
|
|
Cheesyjuggler64 n00b
Joined: 16 May 2024 Posts: 39
|
|
Back to top |
|
|
Goverp Advocate
Joined: 07 Mar 2007 Posts: 2189
|
Posted: Sat Dec 28, 2024 11:31 am Post subject: |
|
|
Cheesyjuggler,
If you're into python, you might like https://pypi.org/project/kconfiglib/.
My experience writing an awk parser for Kconfig files is that their syntax is pretty horrible - basically an agglomeration of ad-hoc rules, resulting in such horrors as parsing producing different results depending on tab settings. Also, there are a heck of a lot of them in the kernel tree, not all of which will be relevant to any particular enquiry.
Net of that is, if someone's already gone through the pain and written a parser, then use it, don't reinvent the wheel! _________________ Greybeard |
|
Back to top |
|
|
|