Skip to content

Commit

Permalink
Big patchset to exFAT version v1.2.24-dragon
Browse files Browse the repository at this point in the history
Linux non-fuse read/write kernel driver for exFat and vFat file systems

remote https://github.com/AndyLavr/exfat-nofuse
branch exfat-v1.2.24-dragon

 - Full adaptation to Kernel 4.19.y

 - Support exFat capacity more than 2TB


Signed-off-by: Andy Lavr <andy.lavr@gmail.com>
  • Loading branch information
AndyLavr committed Nov 16, 2018
1 parent b94f76d commit 30de62d
Show file tree
Hide file tree
Showing 32 changed files with 3,905 additions and 3,456 deletions.
44 changes: 35 additions & 9 deletions Kconfig
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
config EXFAT_FS
tristate "exFAT fs support"
default m
select NLS
select NLS_UTF8
select NLS_CODEPAGE_437
select NLS_ISO8859_1
help
This adds support for the exFAT file system.
If you want to use the exFAT file systems, then you must say Y or M here
to inlucde exFAT support.

config EXFAT_DISCARD
bool "enable discard support"
depends on EXFAT_FS
config EXFAT_USE_FOR_VFAT
bool "Register exFAT as VFAT"
default y
depends on EXFAT_FS && !VFAT_FS
help
If you want to register exFAT as available for VFAT, say Y.

config EXFAT_DELAYED_SYNC
bool "enable delayed sync"
config EXFAT_DISCARD
bool "Enable discard support"
depends on EXFAT_FS
default n
default y

config EXFAT_KERNEL_DEBUG
bool "enable kernel debug features via ioctl"
bool "Enable kernel debug features via ioctl"
depends on EXFAT_FS
default n

config EXFAT_DEBUG_MSG
bool "print debug messages"
bool "Print debug messages"
depends on EXFAT_FS
default n

Expand All @@ -37,3 +44,22 @@ config EXFAT_DEFAULT_IOCHARSET
depends on EXFAT_FS
help
Set this to the default input/output character set you'd like exFAT to use.

config EXFAT_VIRTUAL_XATTR
bool "Virtual xattr support for exFAT filesystem"
default y
depends on EXFAT_FS
help
Modification of exFAT filesystem for virtual xattr

config EXFAT_VIRTUAL_XATTR_SELINUX_LABEL
string "Default string for SELinux label"
depends on EXFAT_FS && EXFAT_VIRTUAL_XATTR
default "u:object_r:sdcard_external:s0"
help
Set this to the default string for SELinux label.

config EXFAT_SUPPORT_STLOG
bool "Enable storage log"
default y
depends on EXFAT_FS && PROC_STLOG
903 changes: 619 additions & 284 deletions LICENSE

Large diffs are not rendered by default.

41 changes: 29 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,19 @@
ifneq ($(KERNELRELEASE),)
# call from kernel build system

obj-$(CONFIG_EXFAT_FS) += exfat.o
obj-$(CONFIG_EXFAT_FS) += exfat_core.o exfat_fs.o

exfat-objs := exfat_core.o exfat_super.o exfat_api.o exfat_blkdev.o exfat_cache.o \
exfat_data.o exfat_bitmap.o exfat_nls.o exfat_oal.o exfat_upcase.o
exfat_fs-y := exfat_super.o

exfat_core-y := exfat.o exfat_api.o exfat_blkdev.o exfat_cache.o \
exfat_data.o exfat_global.o exfat_nls.o \
exfat_oal.o exfat_upcase.o exfat_xattr.o

all:
$(MAKE) -C /lib/modules/$(KERNELRELEASE)/build M=$(PWD) modules

clean:
$(MAKE) -C /lib/modules/$(KERNELRELEASE)/build M=$(PWD) clean

else
# external module build
Expand All @@ -24,9 +33,11 @@ EXTRA_FLAGS += -I$(PWD)
# 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)
KVER ?= $(shell uname -r)
KDIR := /lib/modules/$(KVER)/build
MDIR := /lib/modules/$(KVER)
PWD := $(shell pwd)
KREL := $(shell cd ${KDIR} && make -s kernelrelease)
PWD := $(shell pwd)

export CONFIG_EXFAT_FS := m
Expand All @@ -40,14 +51,20 @@ clean:
help:
$(MAKE) -C $(KDIR) M=$(PWD) help

install: exfat.ko
rm -f ${MDIR}/kernel/fs/exfat/exfat.ko
install -m644 -b -D exfat.ko ${MDIR}/kernel/fs/exfat/exfat.ko
depmod -aq

install:all
rm -f ${DESTDIR}${MDIR}/kernel/fs/exfat/exfat.ko
rm -f ${DESTDIR}${MDIR}/kernel/fs/exfat/exfat_fs.ko
rm -f ${DESTDIR}${MDIR}/kernel/fs/exfat/exfat_core.ko
install -m644 -b -D exfat_core.ko ${DESTDIR}${MDIR}/kernel/fs/exfat/exfat_core.ko
install -m644 -b -D exfat_fs.ko ${DESTDIR}${MDIR}/kernel/fs/exfat/exfat_fs.ko
ifeq ($(DESTDIR),)
depmod -a
endif
uninstall:
rm -rf ${MDIR}/kernel/fs/exfat
depmod -aq
rm -rf ${DESTDIR}/${MDIR}/kernel/fs/exfat
ifeq ($(DESTDIR),)
depmod -a
endif

endif

Expand Down
99 changes: 21 additions & 78 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,98 +1,41 @@
exfat-nofuse
exFAT-nofuse v1.2.24-dragon
============

Linux non-fuse read/write kernel driver for the exFAT, FAT12, FAT16 and vfat (FAT32) file systems.<br />
Originally ported from Android kernel v3.0.

Kudos to ksv1986 for the mutex patch!<br />
Thanks to JackNorris for being awesome and providing the clear_inode() patch.<br />
<br />
Big thanks to lqs for completing the driver!<br />
Big thanks to benpicco for fixing 3.11.y compatibility!

**Full adaptation to kernel 4.19.y**

Special thanks to github user AndreiLux for spreading the word about the leak!<br />


Installing as a stand-alone module:
====================================

make
sudo make install

To load the driver manually, run this as root:
==============================================

modprobe exfat

You may also specify custom toolchains by using CROSS_COMPILE flag, in my case:
>CROSS_COMPILE=../dorimanx-SG2-I9100-Kernel/android-toolchain/bin/arm-eabi-
Installing as a part of the kernel:
======================================

Let's take [linux] as the path to your kernel source dir...

cd [linux]
cp -rvf exfat-nofuse [linux]/fs/exfat

edit [linux]/fs/Kconfig
```
menu "DOS/FAT/NT Filesystems"
source "fs/fat/Kconfig"
+source "fs/exfat/Kconfig"
source "fs/ntfs/Kconfig"
endmenu
```


edit [linux]/fs/Makefile
```
obj-$(CONFIG_FAT_FS) += fat/
+obj-$(CONFIG_EXFAT_FS) += exfat/
obj-$(CONFIG_BFS_FS) += bfs/
```

cd [linux]
make menuconfig

Go to:
> File systems > DOS/FAT/NT
> check exfat as MODULE (M)
> (437) Default codepage for exFAT
> (utf8) Default iocharset for exFAT
> ESC to main menu
> Save an Alternate Configuration File
> ESC ESC
build your kernel

Have fun.


Installing as a DKMS module:
=================================
modprobe exfat_core
modprobe exfat_fs

You can have even more fun with exfat-nofuse by installing it as a DKMS module has the main advantage of being auto-compiled (and thus, possibly surviving) between kernel upgrades.

First, get dkms. On Ubuntu this should be:
Enable exFAT module and install exfat-utils:
============================================

sudo apt install dkms
Add to /etc/initramfs-tools/modules:

Then copy the root of this repository to /usr/share:
exfat_core
exfat_fs

sudo cp -R . /usr/src/exfat-1.2.8 (or whatever version number declared on dkms.conf is)
sudo dkms add -m exfat -v 1.2.8
For filesystem creation and manipulation beyond that of the mount command it is necessary to install the exfat-utils package:
=============================================================================================================================

Build and load the module:
$ sudo apt install exfat-utils
$ sudo apt purge exfat-fuse

sudo dkms build -m exfat -v 1.2.8
sudo dkms install -m exfat -v 1.2.8

Now you have a proper dkms module that will work for a long time... hopefully.
To create an exFAT file system, use mkfs.exfat (or the mkexfatfs command, which is synonymous):
===============================================================================================

root #mkfs.exfat
mkexfatfs 1.2.8
Usage: mkfs.exfat [-i volume-id] [-n label] [-p partition-first-sector] [-s sectors-per-cluster] [-V] <device>
For instance, to create it on a removable device present at /dev/sde1 while assigning "Flash" as the file system label:

root #mkfs.exfat -n Flash /dev/sde1

Free Software for the Free Minds!
=================================
7 changes: 0 additions & 7 deletions dkms.conf

This file was deleted.

11 changes: 0 additions & 11 deletions exfat-km.mk

This file was deleted.

Loading

0 comments on commit 30de62d

Please sign in to comment.