0

I am trying to extend the built-in xfs module of linux kernel. Following this SO post, I am now able to compile it locally. But to avoid conflict with the existing kernel xfs module, I would like to rename my extension to, say xxfs, without changing the name of the source files.

I've found a related post, following which I changed the relevant lines in Makefile to:

obj-$(CONFIG_XFS_FS)            += xxfs.o
xxfs-objs                       := xfs.o

But I got an error saying

make[1]: *** No rule to make target '/home/dev/tmp/xxfs/xfs.o', needed by '/home/dev/tmp/xxfs/xxfs.o'. Stop.
Makefile:1403: recipe for target '_module_/home/dev/tmp/xxfs' failed
make: *** [_module_/home/dev/tmp/xxfs] Error 2
make: Leaving directory '/usr/src/linux-headers-4.4.0-28-generic'

Environment:

Ubuntu 16.04 with kernel 4.4.0-28-generic.


EDIT

I got the xfs kernel module source file by

  1. installing the linux kernel source with apt-get source linux-source-4.4.0
  2. copy the linux-4.4.0/fs/xfs to another directory (merely for easy maintenance), currently /home/dev/tmp/xxfs

To compile the module, I run the command make -C /lib/modules/$(uname -r)/build M=$(pwd) modules from the /home/dev/tmp/xxfs directory, after which a xfs.ko will be generated in the same directory.

However after I change the following line in Makefile

obj-$(CONFIG_XFS_FS)            += xfs.o

to

obj-$(CONFIG_XFS_FS)            += xxfs.o
xxfs-objs                       := xfs.o

Everything else is not touched, but I am no longer able to compile the module with the same command.

Community
  • 1
  • 1
wlnirvana
  • 1,811
  • 20
  • 36

0 Answers0