add dkms support
Some checks failed
build / bcachefs-tools-deb (ubuntu-24.04) (push) Has been cancelled
build / bcachefs-tools-rpm (push) Has been cancelled
build / bcachefs-tools-msrv (push) Has been cancelled
Nix Flake actions / nix-matrix (push) Has been cancelled
Nix Flake actions / ${{ matrix.name }} (${{ matrix.system }}) (push) Has been cancelled

Signed-off-by: Frederik Schwan <frederik@tty42.de>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Frederik Schwan 2025-09-10 21:14:38 +02:00 committed by Kent Overstreet
parent b271bb146e
commit 00ad9b1ed1
4 changed files with 135 additions and 0 deletions

View File

@ -2,6 +2,7 @@ VERSION=$(shell cargo metadata --format-version 1 | jq -r '.packages[] | select(
PREFIX?=/usr/local
LIBEXECDIR?=$(PREFIX)/libexec
DKMSDIR?=$(PREFIX)/src/bcachefs-$(VERSION)
PKG_CONFIG?=pkg-config
INSTALL=install
LN=ln
@ -224,6 +225,16 @@ install_systemd: $(systemd_services) $(systemd_libexecfiles)
$(INSTALL) -m0755 -D $(systemd_libexecfiles) -t $(DESTDIR)$(LIBEXECDIR)
$(INSTALL) -m0644 -D $(systemd_services) -t $(DESTDIR)$(PKGCONFIG_SERVICEDIR)
.PHONY: install_dkms
install_dkms:
$(INSTALL) -m0644 -D dkms/Makefile -t $(DESTDIR)$(DKMSDIR)
$(INSTALL) -m0644 -D dkms/dkms.conf -t $(DESTDIR)$(DKMSDIR)
$(INSTALL) -m0644 -D libbcachefs/Makefile -t $(DESTDIR)$(DKMSDIR)/src/fs/bcachefs
$(INSTALL) -m0644 -D libbcachefs/*.[ch] -t $(DESTDIR)$(DKMSDIR)/src/fs/bcachefs
sed -i "s|@PACKAGE_VERSION@|$(VERSION)|g" $(DESTDIR)$(DKMSDIR)/dkms.conf
sed -i "s|^#define TRACE_INCLUDE_PATH \\.\\./\\.\\./fs/bcachefs$$|#define TRACE_INCLUDE_PATH $(DKMSDIR)/src/fs/bcachefs|" \
$(DESTDIR)$(DKMSDIR)/src/fs/bcachefs/trace.h
.PHONY: clean
clean:
@echo "Cleaning all"

12
dkms/Makefile Normal file
View File

@ -0,0 +1,12 @@
ifneq (${KERNELRELEASE},)
ccflags-y := -I$(src)/include
obj-m += src/fs/bcachefs/
else
KDIR ?= /lib/modules/`uname -r`/build
default:
$(MAKE) -C $(KDIR) M=$$PWD modules
clean:
$(MAKE) -C $(KDIR) M=$$PWD clean
endif

5
dkms/dkms.conf Normal file
View File

@ -0,0 +1,5 @@
PACKAGE_NAME="bcachefs"
PACKAGE_VERSION="@PACKAGE_VERSION@"
BUILT_MODULE_NAME[0]="bcachefs"
BUILT_MODULE_LOCATION[0]="src/fs/bcachefs"
DEST_MODULE_LOCATION[0]="/kernel/fs/bcachefs"

107
libbcachefs/Makefile Normal file
View File

@ -0,0 +1,107 @@
obj-$(CONFIG_BCACHEFS_FS) += bcachefs.o
bcachefs-y := \
acl.o \
alloc_background.o \
alloc_foreground.o \
backpointers.o \
bkey.o \
bkey_methods.o \
bkey_sort.o \
bset.o \
btree_cache.o \
btree_gc.o \
btree_io.o \
btree_iter.o \
btree_journal_iter.o \
btree_key_cache.o \
btree_locking.o \
btree_node_scan.o \
btree_trans_commit.o \
btree_update.o \
btree_update_interior.o \
btree_write_buffer.o \
buckets.o \
buckets_waiting_for_journal.o \
chardev.o \
checksum.o \
clock.o \
compress.o \
darray.o \
data_update.o \
debug.o \
dirent.o \
disk_accounting.o \
disk_groups.o \
ec.o \
enumerated_ref.o \
errcode.o \
error.o \
extents.o \
extent_update.o \
eytzinger.o \
fast_list.o \
fs.o \
fs-ioctl.o \
fs-io.o \
fs-io-buffered.o \
fs-io-direct.o \
fs-io-pagecache.o \
fsck.o \
inode.o \
io_read.o \
io_misc.o \
io_write.o \
journal.o \
journal_io.o \
journal_reclaim.o \
journal_sb.o \
journal_seq_blacklist.o \
keylist.o \
logged_ops.o \
lru.o \
mean_and_variance.o \
migrate.o \
move.o \
movinggc.o \
namei.o \
nocow_locking.o \
opts.o \
printbuf.o \
progress.o \
quota.o \
rebalance.o \
rcu_pending.o \
recovery.o \
recovery_passes.o \
reflink.o \
replicas.o \
sb-clean.o \
sb-counters.o \
sb-downgrade.o \
sb-errors.o \
sb-members.o \
siphash.o \
six.o \
snapshot.o \
str_hash.o \
subvolume.o \
super.o \
super-io.o \
sysfs.o \
tests.o \
time_stats.o \
thread_with_file.o \
trace.o \
two_state_shared_lock.o \
util.o \
varint.o \
xattr.o
bcachefs-$(CONFIG_BCACHEFS_ASYNC_OBJECT_LISTS) += async_objs.o
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)