[DTrace-devel] [PATCH 3/7] build: support kernel builds with object directory

Kris Van Hees kris.van.hees at oracle.com
Tue Oct 31 16:17:03 UTC 2023


Ignore this patch for now...  Since make install for the kernel seems to be
doing the right thing anyway with using build and source as symbolic links to
the kernel object tree and source tree (and for non-O= builds they are the
same), it would seem that KERNELODIR is not even needed.

I'm working on a patch that simply ensures that generated heder files are
looked for under build and standard ones under source.

Stay tuned...

On Tue, Oct 31, 2023 at 11:25:29AM -0400, Kris Van Hees via DTrace-devel wrote:
> Some kernels are built with an explicit object directory rather than
> in the actual source tree.  In that case, /lib/modules will usually
> contain a source link to the kernel source tree and a build link to
> the object directory.  Generated header files will be found under
> the build link whereas regular header files will be under source.
> 
> Signed-off-by: Kris Van Hees <kvanhees at oracle.com>
> ---
>  GNUmakefile     | 2 +-
>  libdtrace/Build | 6 +++---
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/GNUmakefile b/GNUmakefile
> index 54a3c48c..eddcc362 100644
> --- a/GNUmakefile
> +++ b/GNUmakefile
> @@ -70,7 +70,7 @@ KERNELDIRPREFIX=/lib/modules
>  KERNELODIR=
>  # This allows you to build using a locally installed kernel built with O= by
>  # just specifying KERNELODIR=relative/path/to/your/kernel/o/dir.
> -KERNELDIRSUFFIX=$(if $(KERNELODIR),/source,/build)
> +KERNELDIRSUFFIX=$(if $(KERNELODIR),/build,/source)
>  KERNELARCH := $(subst sparc64,sparc,$(subst aarch64,arm64,$(subst x86_64,x86,$(ARCH))))
>  
>  # Paths.
> diff --git a/libdtrace/Build b/libdtrace/Build
> index 7dc2d5d6..349f4f71 100644
> --- a/libdtrace/Build
> +++ b/libdtrace/Build
> @@ -178,14 +178,14 @@ $(m4-dlib-targets): $(objdir)/dlibs/%.d: $$(foreach name,$$(notdir %.d.in), \
>  			$(objdir)/dlibs/.dir.stamp
>  	$(call describe-target,M4,$<)
>  	$(PREPROCESS) -P -x c -Ilibdtrace/$(ARCHINC) \
> -		      -I$(KERNELDIRPREFIX)/$(KERNELVER)$(KERNELDIRSUFFIX)/arch/$(KERNELARCH)/include \
> +		      -I$(KERNELDIRPREFIX)/$(KERNELVER)/source/arch/$(KERNELARCH)/include \
>  		      $(if $(KERNELODIR),-I$(KERNELDIRPREFIX)/$(KERNELVER)$(KERNELDIRSUFFIX)/$(KERNELODIR)/arch/$(KERNELARCH)/include/generated/uapi) \
>  		      -I$(KERNELDIRPREFIX)/$(KERNELVER)$(KERNELDIRSUFFIX)/$(KERNELODIR)/arch/$(KERNELARCH)/include/generated/uapi \
>  		      $(if $(KERNELODIR),-I$(KERNELDIRPREFIX)/$(KERNELVER)$(KERNELDIRSUFFIX)/$(KERNELODIR)/arch/$(KERNELARCH)include/generated) \
>  		      -I$(KERNELDIRPREFIX)/$(KERNELVER)$(KERNELDIRSUFFIX)/$(KERNELODIR)/arch/$(KERNELARCH)/include/generated \
>  		      $(if $(KERNELODIR),-I$(KERNELDIRPREFIX)/$(KERNELVER)$(KERNELDIRSUFFIX)/$(KERNELODIR)/include) \
> -		      -I$(KERNELDIRPREFIX)/$(KERNELVER)$(KERNELDIRSUFFIX)/include \
> -		      -I$(KERNELDIRPREFIX)/$(KERNELVER)$(KERNELDIRSUFFIX)/arch/$(KERNELARCH)/include/uapi \
> +		      -I$(KERNELDIRPREFIX)/$(KERNELVER)/source/include \
> +		      -I$(KERNELDIRPREFIX)/$(KERNELVER)/source/arch/$(KERNELARCH)/include/uapi \
>  		      $(if $(KERNELODIR),-I$(KERNELDIRPREFIX)/$(KERNELVER)$(KERNELDIRSUFFIX)/$(KERNELODIR)/include/generated/uapi) \
>  		      -I$(KERNELDIRPREFIX)/$(KERNELVER)$(KERNELDIRSUFFIX)/$(KERNELODIR)/include/generated/uapi \
>  		      -I$(KERNELDIRPREFIX)/$(KERNELVER)$(KERNELDIRSUFFIX)/include/uapi \
> -- 
> 2.39.2
> 
> 
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel



More information about the DTrace-devel mailing list