drm/radeon: Add build directory to include path
Subsystems (2)
PATCH 1/1 drm/radeon: Add build directory to include path
From: Michel Dänzer <[email protected]>
Fixes compile errors with out-of-tree builds, e.g.
../drivers/gpu/drm/radeon/r420.c:38:10: fatal error: r420_reg_safe.h: No such file or directory
38 | #include "r420_reg_safe.h"
| ^~~~~~~~~~~~~~~~~
--- drivers/gpu/drm/radeon/Makefile | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/radeon/Makefile +2 -0
@@ -3,6 +3,8 @@ # Makefile for the drm device driver. This driver provides support for the # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. +ccflags-y += -I$(src) + hostprogs := mkregtable targets := rn50_reg_safe.h r100_reg_safe.h r200_reg_safe.h rv515_reg_safe.h r300_reg_safe.h r420_reg_safe.h rs600_reg_safe.h r600_reg_safe.h evergreen_reg_safe.h cayman_reg_safe.h
Signature · 1 line
2.35.1
Am 13.04.22 um 18:14 schrieb Michel Dänzer:
Quoted 7 lines
From: Michel Dänzer <[email protected]>
Fixes compile errors with out-of-tree builds, e.g.
../drivers/gpu/drm/radeon/r420.c:38:10: fatal error:r420_reg_safe.h: No such file or directory38 | #include "r420_reg_safe.h" | ^~~~~~~~~~~~~~~~~
Well stuff like that usually points to a broken build environment.
Christian.
Quoted 19 lines
Signed-off-by Michel Dänzer <[email protected]>--- drivers/gpu/drm/radeon/Makefile | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/radeon/Makefile +2
-0@@ -3,6 +3,8 @@ # Makefile for the drm device driver. This driver provides support for the # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. +ccflags-y += -I$(src) + hostprogs := mkregtable targets := rn50_reg_safe.h r100_reg_safe.h r200_reg_safe.h rv515_reg_safe.h r300_reg_safe.h r420_reg_safe.h rs600_reg_safe.h r600_reg_safe.h evergreen_reg_safe.h cayman_reg_safe.h
Quoted 11 lines · Christian König
Am 13.04.22 um 18:14 schrieb Michel Dänzer:
Quoted 7 lines
From: Michel Dänzer <[email protected]>
Fixes compile errors with out-of-tree builds, e.g.
../drivers/gpu/drm/radeon/r420.c:38:10: fatal error:r420_reg_safe.h: No such file or directory 38 | #include "r420_reg_safe.h"
| ^~~~~~~~~~~~~~~~~Well stuff like that usually points to a broken build environment.
Just a separate build directory. Specifically, I'm hitting the errors with
make -C build-amd64 M=drivers/gpu/drm
Generated headers such as r420_reg_safe.h reside in the build directory, so source files in the source directory can't find them without an explicit search path. Are you saying that should get added automagically somehow?
FWIW, this is pretty common in the kernel according to git grep.
Signature · 2 lines
Earthling Michel Dänzer | https://redhat.com Libre software enthusiast | Mesa and Xwayland developer
Am 14.04.22 um 09:37 schrieb Michel Dänzer:
Quoted 10 lines · Christian König
Quoted 9 lines
Am 13.04.22 um 18:14 schrieb Michel Dänzer:
Quoted 7 lines
From: Michel Dänzer <[email protected]>
Fixes compile errors with out-of-tree builds, e.g.
../drivers/gpu/drm/radeon/r420.c:38:10: fatal error:r420_reg_safe.h: No such file or directory
38 | #include "r420_reg_safe.h"
| ^~~~~~~~~~~~~~~~~
Quoted 6 lines
Quoted 1 line
Well stuff like that usually points to a broken build environment.
Just a separate build directory. Specifically, I'm hitting the errors with
make -C build-amd64 M=drivers/gpu/drm
Generated headers such as
r420_reg_safe.hreside in the build directory, so source files in the source directory can't find them without an explicit search path.
I'm trying to swap back into my brain how all of this used to work, but that's a really long time ago that I tried this as well.
Quoted 1 line
Are you saying that should get added automagically somehow?
Yes, exactly that. I'm like 95% sure that used to work, but I don't know why exactly either.
Quoted 1 line
FWIW, this is pretty common in the kernel according to git grep.
Maybe Alex or somebody else with some more background in the kernel Makefiles could jump in and help here.
Christian.
Quoted 16 lines · Christian König
Am 14.04.22 um 09:37 schrieb Michel Dänzer:
Quoted 15 lines · Christian König
Quoted 10 lines
Am 13.04.22 um 18:14 schrieb Michel Dänzer:
Quoted 7 lines
From: Michel Dänzer <[email protected]>
Fixes compile errors with out-of-tree builds, e.g.
../drivers/gpu/drm/radeon/r420.c:38:10: fatal error:r420_reg_safe.h: No such file or directory 38 | #include "r420_reg_safe.h"
| ^~~~~~~~~~~~~~~~~Well stuff like that usually points to a broken build environment.
Just a separate build directory. Specifically, I'm hitting the errors with
make -C build-amd64 M=drivers/gpu/drm
Quoted 7 lines
Quoted 1 line
Generated headers such as
r420_reg_safe.hreside in the build directory, so source files in the source directory can't find them without an explicit search path.I'm trying to swap back into my brain how all of this used to work, but that's a really long time ago that I tried this as well.
Quoted 1 line
Are you saying that should get added automagically somehow?
Yes, exactly that. I'm like 95% sure that used to work, but I don't know why exactly either.
Maybe it worked at some point, but regressed in the meantime? I only just switched to a separate build directory (so that I can easily build-test for other architectures).
Signature · 2 lines
Earthling Michel Dänzer | https://redhat.com Libre software enthusiast | Mesa and Xwayland developer
Quoted 24 lines · Christian König
Am 14.04.22 um 09:37 schrieb Michel Dänzer:
Quoted 10 lines · Christian König
Quoted 9 lines
Am 13.04.22 um 18:14 schrieb Michel Dänzer:
Quoted 7 lines
From: Michel Dänzer <[email protected]>
Fixes compile errors with out-of-tree builds, e.g.
../drivers/gpu/drm/radeon/r420.c:38:10: fatal error:r420_reg_safe.h: No such file or directory38 | #include "r420_reg_safe.h" | ^~~~~~~~~~~~~~~~~Quoted 6 lines
Quoted 1 line
Well stuff like that usually points to a broken build environment.
Just a separate build directory. Specifically, I'm hitting the errors with
make -C build-amd64 M=drivers/gpu/drm
Generated headers such as
r420_reg_safe.hreside in the build directory, so source files in the source directory can't find them without an explicit search path.I'm trying to swap back into my brain how all of this used to work, but that's a really long time ago that I tried this as well.
Quoted 1 line
Are you saying that should get added automagically somehow?
Quoted 7 lines
Yes, exactly that. I'm like 95% sure that used to work, but I don't know why exactly either.
Quoted 1 line
FWIW, this is pretty common in the kernel according to git grep.
Maybe Alex or somebody else with some more background in the kernel Makefiles could jump in and help here.
I don't remember either. I vaguely recall the build support for the mkregtable stuff being reworked a while ago. A quick zip through the git logs shows a series from Masahiro Yamada from 2020.
Alex
Quoted 28 lines · Alex Deucher
Quoted 26 lines · Christian König
Am 14.04.22 um 09:37 schrieb Michel Dänzer:
Quoted 10 lines · Christian König
Quoted 9 lines
Am 13.04.22 um 18:14 schrieb Michel Dänzer:
Quoted 7 lines
From: Michel Dänzer <[email protected]>
Fixes compile errors with out-of-tree builds, e.g.
../drivers/gpu/drm/radeon/r420.c:38:10: fatal error:r420_reg_safe.h: No such file or directory38 | #include "r420_reg_safe.h" | ^~~~~~~~~~~~~~~~~Quoted 6 lines
Quoted 1 line
Well stuff like that usually points to a broken build environment.
Just a separate build directory. Specifically, I'm hitting the errors with
make -C build-amd64 M=drivers/gpu/drm
Generated headers such as
r420_reg_safe.hreside in the build directory, so source files in the source directory can't find them without an explicit search path.I'm trying to swap back into my brain how all of this used to work, but that's a really long time ago that I tried this as well.
Quoted 1 line
Are you saying that should get added automagically somehow?
Yes, exactly that. I'm like 95% sure that used to work, but I don't know why exactly either.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
FWIW, this is pretty common in the kernel according to git grep.
Maybe Alex or somebody else with some more background in the kernel Makefiles could jump in and help here.
I don't remember either. I vaguely recall the build support for the mkregtable stuff being reworked a while ago. A quick zip through the git logs shows a series from Masahiro Yamada from 2020.
Yamada-san, can you help us? :)
See https://patchwork.freedesktop.org/patch/482011/ for my patch.
Signature · 2 lines
Earthling Michel Dänzer | https://redhat.com Libre software enthusiast | Mesa and Xwayland developer
Hi.
Quoted 11 lines · Michel Dänzer
Quoted 9 lines · Alex Deucher
Quoted 7 lines · Christian König
Am 14.04.22 um 09:37 schrieb Michel Dänzer:
Quoted 6 lines · Christian König
Quoted 5 lines
Am 13.04.22 um 18:14 schrieb Michel Dänzer:
Quoted 4 lines
From: Michel Dänzer <[email protected]>
Fixes compile errors with out-of-tree builds, e.g.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
../drivers/gpu/drm/radeon/r420.c:38:10: fatal error:r420_reg_safe.h: No such file or directory38 | #include "r420_reg_safe.h" | ^~~~~~~~~~~~~~~~~Well stuff like that usually points to a broken build environment.
Just a separate build directory. Specifically, I'm hitting the errors with
make -C build-amd64 M=drivers/gpu/drm
Maybe
make O=build-arm64 drivers/gpu/drm/
is the way you were searching for.
It builds only drivers/gpu/drm/
in the separate directory.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Generated headers such as
r420_reg_safe.hreside in the build directory, so source files in the source directory can't find them without an explicit search path.I'm trying to swap back into my brain how all of this used to work, but that's a really long time ago that I tried this as well.
Quoted 1 line
Are you saying that should get added automagically somehow?
For the kernel tree, yes, it is done automatically.
See the code in scripts/Makefile.lib:
# $(srctree)/$(src) for including checkin headers from generated source files # $(objtree)/$(obj) for including generated headers from checkin source files ifeq ($(KBUILD_EXTMOD),)
ifdef building_out_of_srctree_c_flags += -I $(srctree)/$(src) -I $(objtree)/$(obj)_a_flags += -I $(srctree)/$(src) -I $(objtree)/$(obj)_cpp_flags += -I $(srctree)/$(src) -I $(objtree)/$(obj)
endif
endif
But, you used M=drivers/gpu/drm.
So, it did not work.
M= is intended for building external modules.
I do not recommend it for in-tree drivers.
Quoted 13 lines
Quoted 4 lines
Quoted 4 lines
Yes, exactly that. I'm like 95% sure that used to work, but I don't know why exactly either.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
FWIW, this is pretty common in the kernel according to git grep.
Maybe Alex or somebody else with some more background in the kernel Makefiles could jump in and help here.
I don't remember either. I vaguely recall the build support for the mkregtable stuff being reworked a while ago. A quick zip through the git logs shows a series from Masahiro Yamada from 2020.
Quoted 8 lines
Yamada-san, can you help us? :)
See https://patchwork.freedesktop.org/patch/482011/ for my patch.
--
Earthling Michel Dänzer | https://redhat.com
Libre software enthusiast | Mesa and Xwayland developer
--
Best Regards
Masahiro Yamada
Quoted 22 lines · Masahiro Yamada
Quoted 10 lines · Michel Dänzer
Quoted 9 lines · Alex Deucher
Quoted 7 lines · Christian König
Am 14.04.22 um 09:37 schrieb Michel Dänzer:
Quoted 6 lines · Christian König
Quoted 5 lines
Am 13.04.22 um 18:14 schrieb Michel Dänzer:
Quoted 4 lines
From: Michel Dänzer <[email protected]>
Fixes compile errors with out-of-tree builds, e.g.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
../drivers/gpu/drm/radeon/r420.c:38:10: fatal error:r420_reg_safe.h: No such file or directory38 | #include "r420_reg_safe.h" | ^~~~~~~~~~~~~~~~~Well stuff like that usually points to a broken build environment.
Just a separate build directory. Specifically, I'm hitting the errors with
make -C build-amd64 M=drivers/gpu/drm
Quoted 8 lines
Maybe
make O=build-arm64
drivers/gpu/drm/is the way you were searching for.
It builds only
drivers/gpu/drm/
in the separate directory.
Indeed, that works.
Quoted 25 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Generated headers such as
r420_reg_safe.hreside in the build directory, so source files in the source directory can't find them without an explicit search path.I'm trying to swap back into my brain how all of this used to work, but that's a really long time ago that I tried this as well.
Quoted 1 line
Are you saying that should get added automagically somehow?
For the kernel tree, yes, it is done automatically.
See the code in
scripts/Makefile.lib:# $(srctree)/$(src) for including checkin headers from generated source files # $(objtree)/$(obj) for including generated headers from checkin source files ifeq ($(KBUILD_EXTMOD),)
ifdefbuilding_out_of_srctree_c_flags+= -I $(srctree)/$(src) -I $(objtree)/$(obj)_a_flags+= -I $(srctree)/$(src) -I $(objtree)/$(obj)_cpp_flags+= -I $(srctree)/$(src) -I $(objtree)/$(obj)
endif
endif
Quoted 8 lines
But, you used M=drivers/gpu/drm.
So, it did not work.M= is intended for building external modules.
I do not recommend it for in-tree drivers.
So I've been doing it wrong for all these years... Happened to always work for in-tree builds.
Thank you so much for your help, Yamada-san!
I am retracting this patch.
Signature · 2 lines
Earthling Michel Dänzer | https://redhat.com Libre software enthusiast | Mesa and Xwayland developer
Quoted 13 lines · Michel Dänzer
Quoted 12 lines · Masahiro Yamada
Quoted 6 lines · Michel Dänzer
Quoted 5 lines · Alex Deucher
Quoted 3 lines · Christian König
Am 14.04.22 um 09:37 schrieb Michel Dänzer:
Quoted 2 lines
make -C build-amd64 M=drivers/gpu/drm
Maybe
Quoted 8 lines
Quoted 6 lines
make O=build-arm64
drivers/gpu/drm/is the way you were searching for.
It builds only
drivers/gpu/drm/
in the separate directory.Indeed, that works.
I've come to realize that this doesn't produce the actual *.ko modules though. Is there a trick for building the modules, but only under drivers/gpu/drm/ ?
Signature · 2 lines
Earthling Michel Dänzer | https://redhat.com Libre software enthusiast | Mesa and Xwayland developer
Quoted 22 lines · Michel Dänzer
Quoted 20 lines · Michel Dänzer
Quoted 18 lines · Masahiro Yamada
Quoted 6 lines · Michel Dänzer
Quoted 5 lines · Alex Deucher
Quoted 3 lines · Christian König
Am 14.04.22 um 09:37 schrieb Michel Dänzer:
Quoted 2 lines
make -C build-amd64 M=drivers/gpu/drm
Maybe
make O=build-arm64
drivers/gpu/drm/is the way you were searching for.
It builds only
drivers/gpu/drm/
in the separate directory.
Quoted 8 lines
Quoted 1 line
Indeed, that works.
I've come to realize that this doesn't produce the actual *.ko modules though. Is there a trick for building the modules, but only under
drivers/gpu/drm/?--
Earthling Michel Dänzer | https://redhat.com
Libre software enthusiast | Mesa and Xwayland developer
No.
There is no way to build *.ko
only under a specific directory.
Signature · 2 lines
Best Regards Masahiro Yamada
Den sön 19 juni 2022 kl 00:20 skrev Masahiro Yamada <[email protected]>:
Quoted 31 lines
Quoted 17 lines · Michel Dänzer
Quoted 15 lines · Michel Dänzer
Quoted 14 lines · Masahiro Yamada
Quoted 6 lines · Michel Dänzer
Quoted 5 lines · Alex Deucher
Quoted 3 lines · Christian König
Am 14.04.22 um 09:37 schrieb Michel Dänzer:
Quoted 2 lines
make -C build-amd64 M=drivers/gpu/drm
Maybe
make O=build-arm64
drivers/gpu/drm/Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
is the way you were searching for.
It builds only
drivers/gpu/drm/
in the separate directory.Indeed, that works.
I've come to realize that this doesn't produce the actual *.ko modules
though. Is there a trick for building the modules, but only under
drivers/gpu/drm/?Quoted 2 lines
Quoted 9 lines
Quoted 3 lines
--
Earthling Michel Dänzer | https://redhat.com
Libre software enthusiast | Mesa and Xwayland developerNo.
There is no way to build *.ko
only under a specific directory.
Doesn't "make modules M=drivers/gpu/drm/" do that?
Quoted 41 lines · Ernst Sjöstrand
Den sön 19 juni 2022 kl 00:20 skrev Masahiro Yamada <[email protected] <mailto:[email protected]>>:
On Wed, Jun 15, 2022 at 5:35 PM Michel Dänzer <[email protected] <mailto:[email protected]>> wrote: > > On 2022-04-14 18:57, Michel Dänzer wrote: > > On 2022-04-14 17:04, Masahiro Yamada wrote: > >> On Thu, Apr 14, 2022 at 10:50 PM Michel Dänzer > >> <[email protected] <mailto:[email protected]>> wrote: > >>> On 2022-04-14 15:34, Alex Deucher wrote: > >>>> On Thu, Apr 14, 2022 at 4:44 AM Christian König > >>>> <[email protected] <mailto:[email protected]>> wrote: > >>>>> Am 14.04.22 um 09:37 schrieb Michel Dänzer: > >>>>>> > >>>>>> make -C build-amd64 M=drivers/gpu/drm > >> > >> > >> Maybe > >> > >> make O=build-arm64 drivers/gpu/drm/ > >> > >> is the way you were searching for. > >> > >> It builds only drivers/gpu/drm/ > >> in the separate directory. > > > > Indeed, that works. > > I've come to realize that this doesn't produce the actual *.ko modules though. Is there a trick for building the modules, but only under drivers/gpu/drm/ ? > > > -- > Earthling Michel Dänzer | https://redhat.com <https://redhat.com> > Libre software enthusiast | Mesa and Xwayland developer No. There is no way to build *.ko only under a specific directory.
Quoted 1 line
Doesn't "make modules M=drivers/gpu/drm/" do that?
That again hits the compile error the patch was supposed to address. Apparently M= isn't for this but for building out-of-tree modules.
Signature · 2 lines
Earthling Michel Dänzer | https://redhat.com Libre software enthusiast | Mesa and Xwayland developer