Skip to content

Error parsing Kconfig sources:- couldn't parse 'modules': unrecognized construct #131

@pjps

Description

@pjps
  • I'm trying to use the 'kconfiglib' module to read Linux Kconfig source files.

  • I could not get the 'scriptconfig' makefile.patch working with the latest upstream Linux version 6.4-rc4. The documentation does not seem to mention that we need to extract 'kconfiglib' scripts under the kernel source directory for make targets to work.

  • After multiple trial-&-errors, kconfiglib is showing below error while parsing the Kconfig menu about 'Loadable modules support' options.

$ srctree=. ARCH=x86 SRCARCH=x86 KERNELVERSION=`make kernelversion` \
         LD=ld CC=gcc RUSTC=false BINDGEN=false python ../kconf/kconf.py Kconfig 
Traceback (most recent call last):
   File "../kconf/kconf.py", line 55, in <module>
     kconf = Kconfig(sys.argv[1])
             ^^^^^^^^^^^^^^^^^^^^
   File "/usr/lib/python3.11/site-packages/kconfiglib/kconfiglib.py", line 947, in __init__
     self._init(filename, warn, warn_to_stderr, encoding)
   File "/usr/lib/python3.11/site-packages/kconfiglib/kconfiglib.py", line 1085, in _init
     self._parse_block(None, self.top_node, self.top_node).next = None
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/usr/lib/python3.11/site-packages/kconfiglib/kconfiglib.py", line 2989, in _parse_block
     prev = self._parse_block(None, parent, prev)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/usr/lib/python3.11/site-packages/kconfiglib/kconfiglib.py", line 2989, in _parse_block
     prev = self._parse_block(None, parent, prev)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/usr/lib/python3.11/site-packages/kconfiglib/kconfiglib.py", line 3091, in _parse_block
     self._parse_error(
   File "/usr/lib/python3.11/site-packages/kconfiglib/kconfiglib.py", line 3879, in _parse_error
     raise KconfigError("{}error: couldn't parse '{}': {}".format(
kconfiglib.KconfigError: kernel/module/Kconfig:4: error: couldn't parse 'modules': unrecognized construct 
  • I'd appreciate if you could please have a look, check if I'm missing something or using it wrongly?

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions