* M= modules build w/ objects in different directory
@ 2024-03-19 23:18 Daniel Walker (danielwa)
2024-03-20 15:01 ` Masahiro Yamada
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Walker (danielwa) @ 2024-03-19 23:18 UTC (permalink / raw)
To: Masahiro Yamada
Cc: Jing Leng,
Valerii Chernous -X (vchernou - GLOBALLOGIC INC at Cisco),
xe-linux-external(mailer list), linux-kbuild@vger.kernel.org
Masahiro,
I found this commit,
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=23a0cb8e3225122496bfa79172005c587c2d64bf
It had this note,
[masahiro: I do not think "M=$(OUT_DIR) src=$(PWD)" is the official way,
but this patch is a nice clean up anyway.]
Is there an official way or recommended way to build objects in a directory
outside the external modules source directory and outside the original kernel
source directory ?
Daniel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: M= modules build w/ objects in different directory
2024-03-19 23:18 M= modules build w/ objects in different directory Daniel Walker (danielwa)
@ 2024-03-20 15:01 ` Masahiro Yamada
2024-03-27 16:40 ` Daniel Walker (danielwa)
0 siblings, 1 reply; 4+ messages in thread
From: Masahiro Yamada @ 2024-03-20 15:01 UTC (permalink / raw)
To: Daniel Walker (danielwa)
Cc: Jing Leng,
Valerii Chernous -X (vchernou - GLOBALLOGIC INC at Cisco),
xe-linux-external(mailer list), linux-kbuild@vger.kernel.org
On Wed, Mar 20, 2024 at 8:20 AM Daniel Walker (danielwa)
<danielwa@cisco.com> wrote:
>
>
> Masahiro,
>
> I found this commit,
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=23a0cb8e3225122496bfa79172005c587c2d64bf
>
> It had this note,
>
> [masahiro: I do not think "M=$(OUT_DIR) src=$(PWD)" is the official way,
> but this patch is a nice clean up anyway.]
>
> Is there an official way or recommended way to build objects in a directory
> outside the external modules source directory and outside the original kernel
> source directory ?
>
> Daniel
There is no official way.
One known tip is to use a relative path for M=.
For example, the relative path from your kernel source
to your external module directory is ../path/to/module
$ make O=path/to/output M=../path/to/module
The module objects will be output into
path/to/output/../path/to/module/.
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: M= modules build w/ objects in different directory
2024-03-20 15:01 ` Masahiro Yamada
@ 2024-03-27 16:40 ` Daniel Walker (danielwa)
2024-03-30 23:10 ` Masahiro Yamada
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Walker (danielwa) @ 2024-03-27 16:40 UTC (permalink / raw)
To: Masahiro Yamada
Cc: Jing Leng,
Valerii Chernous -X (vchernou - GLOBALLOGIC INC at Cisco),
xe-linux-external(mailer list), linux-kbuild@vger.kernel.org
On Thu, Mar 21, 2024 at 12:01:23AM +0900, Masahiro Yamada wrote:
> On Wed, Mar 20, 2024 at 8:20 AM Daniel Walker (danielwa)
> <danielwa@cisco.com> wrote:
> >
> >
> > Masahiro,
> >
> > I found this commit,
> >
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=23a0cb8e3225122496bfa79172005c587c2d64bf
> >
> > It had this note,
> >
> > [masahiro: I do not think "M=$(OUT_DIR) src=$(PWD)" is the official way,
> > but this patch is a nice clean up anyway.]
> >
> > Is there an official way or recommended way to build objects in a directory
> > outside the external modules source directory and outside the original kernel
> > source directory ?
> >
> > Daniel
>
>
> There is no official way.
> One known tip is to use a relative path for M=.
>
> For example, the relative path from your kernel source
> to your external module directory is ../path/to/module
>
> $ make O=path/to/output M=../path/to/module
>
>
> The module objects will be output into
> path/to/output/../path/to/module/.
It seems that this does place objects into the output directory, but there is an
issue where the build system expects include files to exist inside the output
directory as well. For example if the modules includes linux/module.h this file
exists and is found, but module.h also includes asm/rwonce.h which is not found.
I think it's located in include/asm-generic/rwonce.h . I think these asm location
are linked or added as special -I additions during the build but using O=
results in these asm directories not appearing to exist correctly.
Daniel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: M= modules build w/ objects in different directory
2024-03-27 16:40 ` Daniel Walker (danielwa)
@ 2024-03-30 23:10 ` Masahiro Yamada
0 siblings, 0 replies; 4+ messages in thread
From: Masahiro Yamada @ 2024-03-30 23:10 UTC (permalink / raw)
To: Daniel Walker (danielwa)
Cc: Jing Leng,
Valerii Chernous -X (vchernou - GLOBALLOGIC INC at Cisco),
xe-linux-external(mailer list), linux-kbuild@vger.kernel.org
On Thu, Mar 28, 2024 at 1:41 AM Daniel Walker (danielwa)
<danielwa@cisco.com> wrote:
>
> On Thu, Mar 21, 2024 at 12:01:23AM +0900, Masahiro Yamada wrote:
> > On Wed, Mar 20, 2024 at 8:20 AM Daniel Walker (danielwa)
> > <danielwa@cisco.com> wrote:
> > >
> > >
> > > Masahiro,
> > >
> > > I found this commit,
> > >
> > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=23a0cb8e3225122496bfa79172005c587c2d64bf
> > >
> > > It had this note,
> > >
> > > [masahiro: I do not think "M=$(OUT_DIR) src=$(PWD)" is the official way,
> > > but this patch is a nice clean up anyway.]
> > >
> > > Is there an official way or recommended way to build objects in a directory
> > > outside the external modules source directory and outside the original kernel
> > > source directory ?
> > >
> > > Daniel
> >
> >
> > There is no official way.
> > One known tip is to use a relative path for M=.
> >
> > For example, the relative path from your kernel source
> > to your external module directory is ../path/to/module
> >
> > $ make O=path/to/output M=../path/to/module
> >
> >
> > The module objects will be output into
> > path/to/output/../path/to/module/.
>
> It seems that this does place objects into the output directory, but there is an
> issue where the build system expects include files to exist inside the output
> directory as well. For example if the modules includes linux/module.h this file
> exists and is found, but module.h also includes asm/rwonce.h which is not found.
> I think it's located in include/asm-generic/rwonce.h . I think these asm location
> are linked or added as special -I additions during the build but using O=
> results in these asm directories not appearing to exist correctly.
>
> Daniel
To use this workaround, you need to build the kernel
with O= first.
asm/rwonce.h is a generated header, and exists in
the output directory specified with O=.
# configure and build the kernel
$ make O=path/to/output defconfig
$ make O=path/to/output
# build the module
$ make O=path/to/output M=../path/to/module
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-03-30 23:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-19 23:18 M= modules build w/ objects in different directory Daniel Walker (danielwa)
2024-03-20 15:01 ` Masahiro Yamada
2024-03-27 16:40 ` Daniel Walker (danielwa)
2024-03-30 23:10 ` Masahiro Yamada
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox