Re: Kbuilds and Makefiles in building the kernel
Nagy Ábrahám Zsombor <[email protected]> Thu, 27 Nov 2025 18:36:31 +0100
| Newsgroups | gmane.linux.newbie |
|---|---|
| Message-ID | <[email protected]> |
On Thu, 2025-11-27 at 19:26 +0800, Nick Huang wrote: > Abraham Zsombor Nagy <[email protected]> =E6=96=BC 2025=E5=B9=B411=E6= =9C=8827=E6=97=A5=E9=80=B1=E5=9B=9B =E4=B8=8B=E5=8D=886:43=E5=AF=AB=E9=81= =93=EF=BC=9A > >=20 > > Hello, > >=20 > > https://docs.kernel.org/kbuild/makefiles.html#the-kbuild-files=C2=A0sta= t > > es > > that when a directory contains a Kbuild file, the Makefile is > > skipped in > > that directory. > >=20 > > It feels to me that both files are in use e.g. under arch/x86/ > > directory. > >=20 > > I'm trying to see what files are the core of the kernel and what > > files > > can be configured for x86 by partially parsing the Makefiles and > > the > > Kbuild files. Would it be sufficient to parse them as: > >=20 > > if file =3D=3D "Makefile" or file =3D=3D "Kbuild": > >=20 > > =C2=A0> parse(file) > >=20 > > or it should prefer the Kbuild file when present, or it is using > > some > > other logic? > >=20 > > Sincerely, > >=20 > > Abraham Nagy > >=20 > >=20 >=20 > Hi=C2=A0 Abraham Zsombor Nagy > What functionality are you trying to add that would require modifying > the Makefile or Kbuild? >=20 > Sincerely, > Nick Huang Hi Nick, I'm not modifying the build files, only writing a script that walks through the source tree and parses Makefiles and Kbuild files to list what source files are linked to the kernel by default and by CONFIG_* options. This is to see what to read through to get a basic understanding of the kernel at a given config. As I understand the documentation linked above, I should skip Makefiles when Kbuild files are present in a directory, but Makefiles feels to have important lines too. The approach is something like to extract object files and subdirectories from lines that start with python regex "^\S+-y" or "^\S+-\$\(CONFIG.*\)". Sincerely, Abraham