Re: [PATCH] drm/radeon: Add build directory to include path
Den sön 19 juni 2022 kl 00:20 skrev Masahiro Yamada : > On Wed, Jun 15, 2022 at 5:35 PM Michel Dänzer > 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 > > >> wrote: > > >>> On 2022-04-14 15:34, Alex Deucher wrote: > > On Thu, Apr 14, 2022 at 4:44 AM Christian König > > 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 > > Libre software enthusiast | Mesa and Xwayland developer > > > No. > There is no way to build *.ko > only under a specific directory. > Doesn't "make modules M=drivers/gpu/drm/" do that?
Re: [PATCH] drm/radeon: Add build directory to include path
On Wed, Jun 15, 2022 at 5:35 PM Michel Dänzer 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 > >> wrote: > >>> On 2022-04-14 15:34, Alex Deucher wrote: > On Thu, Apr 14, 2022 at 4:44 AM Christian König > 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 > Libre software enthusiast | Mesa and Xwayland developer No. There is no way to build *.ko only under a specific directory. -- Best Regards Masahiro Yamada
Re: [PATCH] drm/radeon: Add build directory to include path
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 >> wrote: >>> On 2022-04-14 15:34, Alex Deucher wrote: On Thu, Apr 14, 2022 at 4:44 AM Christian König 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 Libre software enthusiast | Mesa and Xwayland developer
Re: [PATCH] drm/radeon: Add build directory to include path
Hi. On Thu, Apr 14, 2022 at 10:50 PM Michel Dänzer wrote: > > On 2022-04-14 15:34, Alex Deucher wrote: > > On Thu, Apr 14, 2022 at 4:44 AM Christian König > > wrote: > >> Am 14.04.22 um 09:37 schrieb Michel Dänzer: > >>> On 2022-04-14 08:24, Christian König wrote: > Am 13.04.22 um 18:14 schrieb Michel Dänzer: > > From: Michel Dänzer > > > > 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 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. > >>> > >>> 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. > >> > >> 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. > >> > >>> 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. > >> > >> Yes, exactly that. I'm like 95% sure that used to work, but I don't know > >> why exactly either. > >> > >>> 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. > > > -- > Earthling Michel Dänzer| https://redhat.com > Libre software enthusiast | Mesa and Xwayland developer -- Best Regards Masahiro Yamada
Re: [PATCH] drm/radeon: Add build directory to include path
On Thu, Apr 14, 2022 at 4:44 AM Christian König wrote: > > Am 14.04.22 um 09:37 schrieb Michel Dänzer: > > On 2022-04-14 08:24, Christian König wrote: > >> Am 13.04.22 um 18:14 schrieb Michel Dänzer: > >>> From: Michel Dänzer > >>> > >>> 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. > > 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. > > > 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. > > > 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
Re: [PATCH] drm/radeon: Add build directory to include path
Am 14.04.22 um 09:37 schrieb Michel Dänzer: On 2022-04-14 08:24, Christian König wrote: Am 13.04.22 um 18:14 schrieb Michel Dänzer: From: Michel Dänzer 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. 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. 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. 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.
Re: [PATCH] drm/radeon: Add build directory to include path
Am 13.04.22 um 18:14 schrieb Michel Dänzer: From: Michel Dänzer 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. Christian. Signed-off-by: Michel Dänzer --- drivers/gpu/drm/radeon/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/radeon/Makefile b/drivers/gpu/drm/radeon/Makefile index 11c97edde54d..37caf5236048 100644 --- a/drivers/gpu/drm/radeon/Makefile +++ b/drivers/gpu/drm/radeon/Makefile @@ -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
[PATCH] drm/radeon: Add build directory to include path
From: Michel Dänzer 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" | ^ Signed-off-by: Michel Dänzer --- drivers/gpu/drm/radeon/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/radeon/Makefile b/drivers/gpu/drm/radeon/Makefile index 11c97edde54d..37caf5236048 100644 --- a/drivers/gpu/drm/radeon/Makefile +++ b/drivers/gpu/drm/radeon/Makefile @@ -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 -- 2.35.1