fs: exfat: Add support for building inside kernel

Change-Id: I963dfd24ffbb488efcbb7a504e9b811f54adcff7
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
Signed-off-by: azrim <mirzaspc@gmail.com>
This commit is contained in:
UtsavBalar1231 2022-02-26 20:27:24 +05:30 committed by azrim
parent 9ece1cd8bd
commit 71153430f2
No known key found for this signature in database
GPG Key ID: 497F8FB059B45D1C
6 changed files with 2 additions and 187 deletions

View File

@ -128,6 +128,7 @@ if BLOCK
menu "DOS/FAT/NT Filesystems"
source "fs/fat/Kconfig"
source "fs/exfat/Kconfig"
source "fs/ntfs/Kconfig"
endmenu

View File

@ -80,6 +80,7 @@ obj-$(CONFIG_HUGETLBFS) += hugetlbfs/
obj-$(CONFIG_CODA_FS) += coda/
obj-$(CONFIG_MINIX_FS) += minix/
obj-$(CONFIG_FAT_FS) += fat/
obj-$(CONFIG_EXFAT_FS) += exfat/
obj-$(CONFIG_BFS_FS) += bfs/
obj-$(CONFIG_ISO9660_FS) += isofs/
obj-$(CONFIG_HFSPLUS_FS) += hfsplus/ # Before hfs to find wrapped HFS+

View File

@ -1,65 +0,0 @@
#!/usr/bin/perl
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
# Copyright (C) 2019 Samsung Electronics Co., Ltd.
#
use strict;
sub tweak_sysctl()
{
`sudo sysctl kernel.hardlockup_panic=0`;
`sudo sysctl kernel.hung_task_panic=0`;
`sudo sysctl kernel.panic=128`;
`sudo sysctl kernel.panic_on_io_nmi=0`;
`sudo sysctl kernel.panic_on_oops=0`;
`sudo sysctl kernel.panic_on_rcu_stall=0`;
`sudo sysctl kernel.panic_on_unrecovered_nmi=0`;
`sudo sysctl kernel.panic_on_warn=0`;
`sudo sysctl kernel.softlockup_panic=0`;
`sudo sysctl kernel.unknown_nmi_panic=0`;
}
sub execute($$)
{
my $cmd = shift;
my $timeout = shift;
my $output = "Timeout";
my $status = 1;
$timeout = 8 * 60 if (!defined $timeout);
tweak_sysctl();
eval {
local $SIG{ALRM} = sub {
print "TIMEOUT:\n";
system("top -n 1"), print "top\n";
system("free"), print "free\n";
system("dmesg"), print "dmesg\n";
die "Timeout\n";
};
print "Executing $cmd with timeout $timeout\n";
alarm $timeout;
$output = `$cmd`;
$status = $?;
alarm 0;
print $output."\n";
print "Finished: status $status\n";
};
if ($@) {
die unless $@ eq "Timeout\n";
}
}
if (! defined $ARGV[0]) {
print "Usage:\n\t./.travis_cmd_wrapper.pl command [timeout seconds]\n";
exit 1;
}
execute($ARGV[0], $ARGV[1]);

View File

@ -1,37 +0,0 @@
#!/bin/sh
#
# A simple script we are using to get the latest mainline kernel
# tar ball
#
wget https://www.kernel.org/releases.json
if [ $? -ne 0 ]; then
echo "Could not download kernel.org/releases.json"
exit 1
fi
VER=$(cat releases.json | python2.7 -c "import sys, json; print json.load(sys.stdin)['latest_stable']['version']")
if [ $? -ne 0 ]; then
echo "Could not parse release.json"
exit 1
fi
if [ "z$VER" = "z" ]; then
echo "Could not determine latest release version"
exit 1
fi
wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-"$VER".tar.gz
if [ $? -ne 0 ]; then
echo "Could not download $VER kernel version"
exit 1
fi
tar xf linux-"$VER".tar.gz
if [ $? -ne 0 ]; then
echo "Could not untar kernel tar ball"
exit 1
fi
mv linux-"$VER" linux

View File

@ -2,39 +2,7 @@
#
# Makefile for the linux exFAT filesystem support.
#
ifneq ($(KERNELRELEASE),)
obj-$(CONFIG_EXFAT_FS) += exfat.o
exfat-y := inode.o namei.o dir.o super.o fatent.o cache.o nls.o misc.o \
file.o balloc.o
else
# Called from external kernel module build
KERNELRELEASE ?= $(shell uname -r)
KDIR ?= /lib/modules/${KERNELRELEASE}/build
MDIR ?= /lib/modules/${KERNELRELEASE}
PWD := $(shell pwd)
export CONFIG_EXFAT_FS := m
all:
$(MAKE) -C $(KDIR) M=$(PWD) modules
clean:
$(MAKE) -C $(KDIR) M=$(PWD) 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
uninstall:
rm -rf ${MDIR}/kernel/fs/exfat
depmod -aq
endif
.PHONY : all clean install uninstall

View File

@ -1,53 +0,0 @@
## exFAT filesystem
This is the exfat filesystem for support from the linux 4.1 kernel
to the latest kernel.
## Installing as a stand-alone module
Install prerequisite package for Fedora, RHEL:
```
yum install kernel-devel-$(uname -r)
```
Build step:
```
make
sudo make install
```
To load the driver manually, run this as root:
```
modprobe exfat
```
## Installing as a part of the kernel
1. Let's take [linux] as the path to your kernel source dir.
```
cd [linux]
cp -ar exfat [linux]/fs/
```
2. edit [linux]/fs/Kconfig
```
source "fs/fat/Kconfig"
+source "fs/exfat/Kconfig"
source "fs/ntfs/Kconfig"
```
3. edit [linux]/fs/Makefile
```
obj-$(CONFIG_FAT_FS) += fat/
+obj-$(CONFIG_EXFAT_FS) += exfat/
obj-$(CONFIG_BFS_FS) += bfs/
```
4. make menuconfig and set exfat
```
File systems --->
DOS/FAT/NT Filesystems --->
<M> exFAT filesystem support
(utf8) Default iocharset for exFAT
```
build your kernel