From dbbd5eef58fb5617b45802f98b5a73981fc4f4f2 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 6 Sep 2016 13:12:17 +0200 Subject: [PATCH] f2fs-tools: import from packages, clean up, and update to latest Signed-off-by: Felix Fietkau --- package/utils/f2fs-tools/Makefile | 90 +++++++++++++++++++ .../f2fs-tools/patches/001-compile.patch | 19 ++++ .../patches/010-include-byteswap-h.patch | 10 +++ .../f2fs-tools/patches/020-no_selinux.patch | 55 ++++++++++++ 4 files changed, 174 insertions(+) create mode 100644 package/utils/f2fs-tools/Makefile create mode 100644 package/utils/f2fs-tools/patches/001-compile.patch create mode 100644 package/utils/f2fs-tools/patches/010-include-byteswap-h.patch create mode 100644 package/utils/f2fs-tools/patches/020-no_selinux.patch diff --git a/package/utils/f2fs-tools/Makefile b/package/utils/f2fs-tools/Makefile new file mode 100644 index 0000000000..8414052339 --- /dev/null +++ b/package/utils/f2fs-tools/Makefile @@ -0,0 +1,90 @@ +# +# Copyright (C) 2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=f2fs-tools +PKG_VERSION:=1.7.0 +PKG_RELEASE:=1 + +PKG_LICENSE:=GPLv2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://git.kernel.org/cgit/linux/kernel/git/jaegeuk/f2fs-tools.git/snapshot/ +PKG_MD5SUM:=9db22274264f0c88dbee012f257917b1 + +PKG_FIXUP:=autoreconf +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +PKG_MAINTAINER:=Felix Fietkau + +include $(INCLUDE_DIR)/package.mk + +define Package/f2fs-tools/Default + SECTION:=utils + CATEGORY:=Utilities + SUBMENU:=Filesystem + DEPENDS:=+libf2fs + URL:=http://git.kernel.org/cgit/linux/kernel/git/jaegeuk/f2fs-tools.git +endef + +define Package/mkf2fs + $(Package/f2fs-tools/Default) + TITLE:=Utility for creating a Flash-Friendly File System (F2FS) +endef + +define Package/f2fsck + $(Package/f2fs-tools/Default) + TITLE:=Utility for checking/repairing a Flash-Friendly File System (F2FS) +endef + +define Package/f2fs-tools + $(Package/f2fs-tools/Default) + TITLE:=Tools for Flash-Friendly File System (F2FS) + DEPENDS += +mkf2fs +f2fsck +endef + +define Package/libf2fs + SECTION:=libs + CATEGORY:=Libraries + TITLE:=Library for Flash-Friendly File System (F2FS) tools + DEPENDS:=+libuuid +endef + +define Package/libf2fs/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/libf2fs.so* $(1)/usr/lib/ +endef + +define Package/mkf2fs/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/mkfs.f2fs $(1)/usr/sbin +endef + +define Package/f2fsck/install + $(INSTALL_DIR) $(1)/usr/sbin + + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/fsck.f2fs $(1)/usr/sbin + ln -s /usr/sbin/fsck.f2fs $(1)/usr/sbin/defrag.f2fs + ln -s /usr/sbin/fsck.f2fs $(1)/usr/sbin/dump.f2fs + ln -s /usr/sbin/fsck.f2fs $(1)/usr/sbin/sload.f2fs + ln -s /usr/sbin/fsck.f2fs $(1)/usr/sbin/resize.f2fs +endef + +define Package/f2fs-tools/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/f2fstat $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/fibmap.f2fs $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/parse.f2fs $(1)/usr/sbin +endef + +$(eval $(call BuildPackage,libf2fs)) +$(eval $(call BuildPackage,mkf2fs)) +$(eval $(call BuildPackage,f2fsck)) +$(eval $(call BuildPackage,f2fs-tools)) diff --git a/package/utils/f2fs-tools/patches/001-compile.patch b/package/utils/f2fs-tools/patches/001-compile.patch new file mode 100644 index 0000000000..2ff6ee832d --- /dev/null +++ b/package/utils/f2fs-tools/patches/001-compile.patch @@ -0,0 +1,19 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -20,14 +20,9 @@ AC_DEFINE([F2FS_MINOR_VERSION], m4_bpats + [\([0-9]*\).\([0-9]*\)\(\w\|\W\)*], [\2]), + [Minor version for f2fs-tools]) + +-AC_CHECK_FILE(.git, +- AC_DEFINE([F2FS_TOOLS_DATE], +- "m4_bpatsubst(f2fs_tools_gitdate, +- [\([0-9-]*\)\(\w\|\W\)*], [\1])", +- [f2fs-tools date based on Git commits]), +- AC_DEFINE([F2FS_TOOLS_DATE], ++AC_DEFINE([F2FS_TOOLS_DATE], + "f2fs_tools_date", +- [f2fs-tools date based on Source releases])) ++ [f2fs-tools date based on Source releases]) + + AC_CONFIG_SRCDIR([config.h.in]) + AC_CONFIG_HEADER([config.h]) diff --git a/package/utils/f2fs-tools/patches/010-include-byteswap-h.patch b/package/utils/f2fs-tools/patches/010-include-byteswap-h.patch new file mode 100644 index 0000000000..ff7e4e7d3e --- /dev/null +++ b/package/utils/f2fs-tools/patches/010-include-byteswap-h.patch @@ -0,0 +1,10 @@ +--- a/include/f2fs_fs.h ++++ b/include/f2fs_fs.h +@@ -15,6 +15,7 @@ + #include + #include + #include ++#include + + #ifdef HAVE_CONFIG_H + #include diff --git a/package/utils/f2fs-tools/patches/020-no_selinux.patch b/package/utils/f2fs-tools/patches/020-no_selinux.patch new file mode 100644 index 0000000000..dcb3bd24c4 --- /dev/null +++ b/package/utils/f2fs-tools/patches/020-no_selinux.patch @@ -0,0 +1,55 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -49,7 +49,7 @@ AC_PATH_PROG([LDCONFIG], [ldconfig], + + # Checks for libraries. + PKG_CHECK_MODULES([libuuid], [uuid]) +-PKG_CHECK_MODULES([libselinux], [libselinux]) ++# PKG_CHECK_MODULES([libselinux], [libselinux]) + + # Checks for header files. + AC_CHECK_HEADERS([linux/fs.h fcntl.h mntent.h stdlib.h string.h \ +--- a/fsck/sload.c ++++ b/fsck/sload.c +@@ -16,10 +16,11 @@ + #include + #include + #include ++ ++#ifdef WITH_ANDROID + #include + #include + +-#ifdef WITH_ANDROID + #include + #include + +@@ -110,10 +111,12 @@ static int build_directory(struct f2fs_s + handle_selabel(dentries + i, S_ISDIR(stat.st_mode), + target_out_dir); + ++#ifdef WITH_ANDROID + if (sehnd && selabel_lookup(sehnd, &dentries[i].secon, + dentries[i].path, stat.st_mode) < 0) + ERR_MSG("Cannot lookup security context for %s\n", + dentries[i].path); ++#endif + + dentries[i].pino = dir_ino; + +@@ -218,6 +221,7 @@ int f2fs_sload(struct f2fs_sb_info *sbi, + return ret; + } + ++#ifdef WITH_ANDROID + if (sehnd) { + char *secontext = NULL; + +@@ -233,6 +237,7 @@ int f2fs_sload(struct f2fs_sb_info *sbi, + } + free(secontext); + } ++#endif + + /* update curseg info; can update sit->types */ + move_curseg_info(sbi, SM_I(sbi)->main_blkaddr); -- 2.30.2