Re: [PATCH v2] gen_compile_command: Add support for separate KBUILD_OUTPUT directory

From: Matthias Kaehlcke
Date: Wed Jul 10 2019 - 18:01:39 EST


On Thu, Jul 04, 2019 at 02:08:27PM +0900, Masahiro Yamada wrote:
> On Tue, Jun 25, 2019 at 1:31 AM Matthias Kaehlcke <mka@xxxxxxxxxxxx> wrote:
> >
> > gen_compile_command.py currently assumes that the .cmd files and the
> > source code live in the same directory, which is not the case when
> > a separate KBUILD_OUTPUT directory is used.
> >
> > Add a new option to specify this the kbuild output directory. If the
> > option is not set the kernel source directory is used.
>
> I do not understand this patch.
>
> In my understanding, this tool already provides
> -d, --directory option, which is supposed to point to
> the kbuild output directory, not a source directory.

You are right specifying the output path with -d works.

The help string claims the directory passed to -d is the kernel
*source* directory though:

-d DIRECTORY, --directory DIRECTORY
Path to the kernel source directory to search
(defaults to the working directory)

I recall getting plenty of errors of files not being found (possibly
after adding debug logs). Chrome OS builds the kernel inside a chroot,
I guess I ran the script from outside the chroot and got the errors
because the (chroot) file paths in the .cmd files don't exist outside
the chroot, but drew wrong conclusions.

Please disregard this patch.

Matthias