Skip to content

Commit

Permalink
kernel-sdfat: Add to repo
Browse files Browse the repository at this point in the history
Add kernel-sdfat to repo
Patch adapted from cryptomilk/kernel-sdfat#4
Updated/Successor to exfat-nofuse module

Signed-off-by: Daniel Engberg <[email protected]>
  • Loading branch information
diizzyy committed Jun 8, 2018
1 parent 48d5f1a commit bb74cf4
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
49 changes: 49 additions & 0 deletions kernel/kernel-sdfat/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#
# Copyright (C) 2018 Daniel Engberg <[email protected]>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk

PKG_NAME:=kernel-sdfat
PKG_VERSION:=20180522
PKG_RELEASE:=1
PKG_MAINTAINER:=
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=LICENSE

PKG_SOURCE_URL:=https://codeload.github.com/cryptomilk/$(PKG_NAME)/tar.gz/aa8183f?dummy=/
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_HASH:=17e171bd9d6cdcb617d2e92ec8c06c308108e61fdf6ff70bcb1335b59d4d2c44
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-aa8183f

include $(INCLUDE_DIR)/package.mk

define KernelPackage/fs-sdfat
SUBMENU:=Filesystems
TITLE:=sdFAT kernel driver
FILES:=$(PKG_BUILD_DIR)/sdfat_fs.ko
AUTOLOAD:=$(call AutoLoad,30,sdfat_fs,1)
DEPENDS:=+kmod-nls-base +kmod-nls-utf8 +kmod-nls-cp437 +kmod-nls-iso8859-1 @BUILD_PATENTED
endef

define KernelPackage/fs-sdfat/description
Kernel module for FAT12/16/32/VFAT and exFAT filesytems
endef

MAKE_OPTS:= \
ARCH="$(LINUX_KARCH)" \
CROSS_COMPILE="$(TARGET_CROSS)" \
M="$(PKG_BUILD_DIR)"

define Build/Compile
$(MAKE) -C "$(LINUX_DIR)" \
$(MAKE_OPTS) \
CONFIG_SDFAT_FS=m \
modules
endef

$(eval $(call KernelPackage,fs-sdfat))
20 changes: 20 additions & 0 deletions kernel/kernel-sdfat/patches/001-module-fix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
diff --git a/blkdev.c b/blkdev.c
index 264c670..046f688 100644
--- a/blkdev.c
+++ b/blkdev.c
@@ -118,8 +118,14 @@ s32 bdev_readahead(struct super_block *sb, u64 secno, u64 num_secs)

blk_start_plug(&plug);
for (i = 0; i < num_secs; i++) {
- if (i && !(i & (sects_per_page - 1)))
+ if (i && !(i & (sects_per_page - 1))) {
+#ifdef MODULE
+ blk_finish_plug(&plug);
+ blk_start_plug(&plug);
+#else
blk_flush_plug(current);
+#endif
+ }
sb_breadahead(sb, (sector_t)(secno + i));
}
blk_finish_plug(&plug);

1 comment on commit bb74cf4

@diizzyy
Copy link
Owner Author

@diizzyy diizzyy commented on bb74cf4 Jun 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pprindeville

Hi, if you have a few minutes to spare I would be grateful.

I'm having trouble getting this filesystem driver to properly announce supported filesystems to the kernel but it probably boils down to me in the end. ;-)

As far as I can tell they're defined here:
https://github.com/cryptomilk/kernel-sdfat/blob/master/sdfat.c#L75

...and turned on by default here:
https://github.com/cryptomilk/kernel-sdfat/blob/master/Kconfig#L18

However, I'm not sure if Kconfig gets imported by default of if I need to define variables for make.

It currently looks like this which seems to confuse block-mount and friends.

root@LEDE:~# cat /proc/filesystems
nodev   sysfs
nodev   rootfs
nodev   tmpfs
nodev   bdev
nodev   proc
nodev   debugfs
nodev   sockfs
nodev   bpf
nodev   pipefs
nodev   ramfs
nodev   devpts
        ext3
        ext2
        ext4
        squashfs
nodev   jffs2
nodev   overlay
        f2fs
nodev   ubifs
        sdfat
Fri Jun  8 07:18:27 2018 kern.notice kernel: [ 1151.995716] sd 2:0:0:0: [sda] Attached SCSI removable disk
Fri Jun  8 07:18:27 2018 daemon.err block: No "mount.exfat" utility available

It works if you try to mount manually (busybox mount) however it seems to be a bit noisy but that's because it tries all available filesystems?

Fri Jun  8 07:04:56 2018 kern.info kernel: [  341.415388] F2FS-fs (sda1): Magic Mismatch, valid(0xf2f52010) - read(0x0)
Fri Jun  8 07:04:56 2018 kern.err kernel: [  341.422222] F2FS-fs (sda1): Can't find valid F2FS filesystem in 1th superblock
Fri Jun  8 07:04:56 2018 kern.info kernel: [  341.429827] F2FS-fs (sda1): Magic Mismatch, valid(0xf2f52010) - read(0x0)
Fri Jun  8 07:04:56 2018 kern.err kernel: [  341.436645] F2FS-fs (sda1): Can't find valid F2FS filesystem in 2th superblock
Fri Jun  8 07:04:56 2018 kern.info kernel: [  341.443953] F2FS-fs (sda1): Magic Mismatch, valid(0xf2f52010) - read(0x0)
Fri Jun  8 07:04:56 2018 kern.err kernel: [  341.450778] F2FS-fs (sda1): Can't find valid F2FS filesystem in 1th superblock
Fri Jun  8 07:04:56 2018 kern.info kernel: [  341.458035] F2FS-fs (sda1): Magic Mismatch, valid(0xf2f52010) - read(0x0)
Fri Jun  8 07:04:56 2018 kern.err kernel: [  341.464851] F2FS-fs (sda1): Can't find valid F2FS filesystem in 2th superblock
Fri Jun  8 07:04:56 2018 kern.info kernel: [  341.472582] [SDFAT](sda1[8:1]): trying to mount...
Fri Jun  8 07:04:56 2018 kern.info kernel: [  341.477653] [SDFAT](sda1[8:1]): set logical sector size  : 512
Fri Jun  8 07:04:56 2018 kern.info kernel: [  341.483514] [SDFAT](sda1[8:1]): detected volume info     : exfat (bps : 512, spc : 64, data start : 4096, aligned)
Fri Jun  8 07:04:56 2018 kern.info kernel: [  341.493928] [SDFAT](sda1[8:1]): detected volume size     : 7550 MB (disk_size : 7552 MB)
Fri Jun  8 07:04:57 2018 kern.info kernel: [  341.517224] [SDFAT](sda1[8:1]): mounted successfully!

A hack would be to symlink mount as mount.exfat but that seems like a strange solution as other modules works fine without that workaround.

Please sign in to comment.