dkms: Use relative path for TRACE_INCLUDE_PATH

install_dkms currently patches the absolute path of DKMSDIR into
trace.h, but this is fragile. For instance, if the DKMSDIR path
contains the word "linux", then the __stringify in define_trace.h
replaces it with its macro expansion "1" and breaks the path. It's
better to just keep it relative.

@koverstreet will have to figure out how to merge the libbcachefs part
of this correctly.
This commit is contained in:
Will Fancher 2025-09-19 22:32:49 -04:00
parent 991fb55fc6
commit ff51fb28cf
3 changed files with 7 additions and 3 deletions

View File

@ -194,7 +194,7 @@ install_dkms: dkms/dkms.conf
$(INSTALL) -m0644 -D libbcachefs/Makefile -t $(DESTDIR)$(DKMSDIR)/src/fs/bcachefs
$(INSTALL) -m0644 -D libbcachefs/*.[ch] -t $(DESTDIR)$(DKMSDIR)/src/fs/bcachefs
$(INSTALL) -m0644 -D libbcachefs/vendor/*.[ch] -t $(DESTDIR)$(DKMSDIR)/src/fs/bcachefs/vendor
sed -i "s|^#define TRACE_INCLUDE_PATH \\.\\./\\.\\./fs/bcachefs$$|#define TRACE_INCLUDE_PATH $(DKMSDIR)/src/fs/bcachefs|" \
sed -i "s|^#define TRACE_INCLUDE_PATH \\.\\./\\.\\./fs/bcachefs$$|#define TRACE_INCLUDE_PATH .|" \
$(DESTDIR)$(DKMSDIR)/src/fs/bcachefs/trace.h
.PHONY: clean

View File

@ -5,8 +5,8 @@ else
KDIR ?= /lib/modules/`uname -r`/build
default:
$(MAKE) -C $(KDIR) M=$$PWD modules
$(MAKE) -C $(KDIR) M=$$PWD BCACHEFS_DKMS=1 modules
clean:
$(MAKE) -C $(KDIR) M=$$PWD clean
$(MAKE) -C $(KDIR) M=$$PWD BCACHEFS_DKMS=1 clean
endif

View File

@ -105,3 +105,7 @@ obj-$(CONFIG_MEAN_AND_VARIANCE_UNIT_TEST) += mean_and_variance_test.o
# Silence "note: xyz changed in GCC X.X" messages
subdir-ccflags-y += $(call cc-disable-warning, psabi)
ifdef BCACHEFS_DKMS
subdir-ccflags-y += -I$(src)
endif