Skip to content

Commit

Permalink
new patch to Makefile for building as stand alone.
Browse files Browse the repository at this point in the history
I've been thinking about the patch I submitted and have concluded that it could have been much better.

Now that the patch has been applied, if someone wants to build and install the exfat module for a kernel other than the one currently running,
(s)he has to provide values for both KDIR and MDIR when calling make.
Clearly that is not good.
That can, however, be trivially fixed by changing the assignment to MDIR as follows:

MDIR   := $(shell dirname ${KDIR})

In addition, however, in my experience of building external modules a user can set KDIR to any path to the kernel source.
For example, on my system the source for the currently-running kernel is in $HOME/kernel/linux-$(uname-r)
and it should be possible to use that as a value for KDIR instead of /lib/modules/$(uname -r)/build.
The patch below implements this idea as well as fixing the KDIR+MDIR badness I describe above.

Trivially, the patch also aligns the assignment to PWD with the earlier assignments.

Signed-off-by: Chris Clayton <[email protected]>
  • Loading branch information
dorimanx committed Jan 12, 2014
1 parent 5c2e3b4 commit 1691cda
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,21 @@ else

EXTRA_FLAGS += -I$(PWD)

#KDIR := /usr/src/linux/
#
# KDIR is a path to a directory containing kernel source.
# It can be specified on the command line passed to make to enable the module to
# be built and installed for a kernel other than the one currently running.
# By default it is the path to the symbolic link created when
# the current kernel's modules were installed, but
# any valid path to the directory in which the target kernel's source is located
# can be provided on the command line.
#
KDIR := /lib/modules/$(shell uname -r)/build
MDIR := /lib/modules/$(shell uname -r)
PWD := $(shell pwd)
PWD := $(shell pwd)
KREL := $(shell cd ${KDIR} && make -s kernelrelease)
MDIR := /lib/modules/${KREL}
PWD := $(shell pwd)

export CONFIG_EXFAT_FS := m

Expand Down

0 comments on commit 1691cda

Please sign in to comment.