blob: b5ab9ba14cf9d53bc1afd598bb899af8346ac5fb [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001#
2# Copyright (C) 2014-2015 OpenWrt.org
3#
4# This is free software, licensed under the GNU General Public License v2.
5# See /LICENSE for more information.
6#
7
8include $(TOPDIR)/rules.mk
9
10PKG_NAME:=fstools
11PKG_RELEASE:=1
12
13PKG_SOURCE_PROTO:=git
14PKG_SOURCE_URL=$(PROJECT_GIT)/project/fstools.git
15PKG_MIRROR_HASH:=b03b3109044466c4f75fa5c80838de66b255d37148f63610599b9efd157e9af7
16PKG_SOURCE_DATE:=2024-07-14
17PKG_SOURCE_VERSION:=408c2cc48e6694446c89da7f8121b399063e1067
18CMAKE_INSTALL:=1
19
20PKG_LICENSE:=GPL-2.0
21PKG_LICENSE_FILES:=
22
23PKG_BUILD_FLAGS:=no-mips16
24PKG_FLAGS:=nonshared
25
26PKG_BUILD_DEPENDS := util-linux
27PKG_CONFIG_DEPENDS := CONFIG_NAND_SUPPORT CONFIG_FSTOOLS_UBIFS_EXTROOT
28
29PKG_MAINTAINER:=John Crispin <john@phrozen.org>
30
31include $(INCLUDE_DIR)/package.mk
32include $(INCLUDE_DIR)/cmake.mk
33
34CMAKE_OPTIONS += $(if $(CONFIG_FSTOOLS_UBIFS_EXTROOT),-DCMAKE_UBIFS_EXTROOT=y)
35CMAKE_OPTIONS += $(if $(CONFIG_FSTOOLS_OVL_MOUNT_FULL_ACCESS_TIME),-DCMAKE_OVL_MOUNT_FULL_ACCESS_TIME=y)
36CMAKE_OPTIONS += $(if $(CONFIG_FSTOOLS_OVL_MOUNT_COMPRESS_ZLIB),-DCMAKE_OVL_MOUNT_COMPRESS_ZLIB=y)
37
38define Package/fstools
39 SECTION:=base
40 CATEGORY:=Base system
41 DEPENDS:=+ubox +NAND_SUPPORT:ubi-utils
42 TITLE:=OpenWrt filesystem tools
43 MENU:=1
44endef
45
46define Package/fstools/config
47 config FSTOOLS_UBIFS_EXTROOT
48 depends on PACKAGE_fstools
49 depends on NAND_SUPPORT
50 bool "Support extroot functionality with UBIFS"
51 default y
52 help
53 This option makes it possible to use extroot functionality if the root filesystem resides on an UBIFS partition
54
55 config FSTOOLS_OVL_MOUNT_FULL_ACCESS_TIME
56 depends on PACKAGE_fstools
57 bool "Full access time accounting"
58 default n
59 help
60 This option enables the full access time accounting (warning: it will increase the flash writes).
61
62 config FSTOOLS_OVL_MOUNT_COMPRESS_ZLIB
63 depends on PACKAGE_fstools
64 bool "Compress using zlib"
65 default n
66 help
67 This option enables the compression using zlib on the storage device.
68endef
69
70define Package/snapshot-tool
71 SECTION:=base
72 CATEGORY:=Base system
73 TITLE:=rootfs snapshoting tool
74 DEPENDS:=+libubox +fstools
75endef
76
77define Package/block-mount/conffiles
78/etc/config/fstab
79endef
80
81define Package/block-mount
82 SECTION:=base
83 CATEGORY:=Base system
84 TITLE:=Block device mounting and checking
85 DEPENDS:=+ubox +libubox +libuci +libblobmsg-json +libjson-c
86endef
87
88define Package/blockd
89 SECTION:=base
90 CATEGORY:=Base system
91 TITLE:=Block device automounting
92 DEPENDS:=+block-mount +fstools +libubus +kmod-fs-autofs4 +libblobmsg-json +libjson-c
93endef
94
95define Package/fstools/install
96 $(INSTALL_DIR) $(1)/sbin $(1)/lib
97
98 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{mount_root,jffs2reset} $(1)/sbin/
99 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libfstools.so $(1)/lib/
100 $(LN) jffs2reset $(1)/sbin/jffs2mark
101endef
102
103define Package/snapshot-tool/install
104 $(INSTALL_DIR) $(1)/sbin
105
106 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snapshot_tool $(1)/sbin/
107 $(INSTALL_BIN) ./files/snapshot $(1)/sbin/
108endef
109
110define Package/block-mount/install
111 $(INSTALL_DIR) $(1)/sbin $(1)/lib $(1)/usr/sbin $(1)/etc/hotplug.d/block $(1)/etc/init.d/ $(1)/etc/uci-defaults/
112
113 $(INSTALL_BIN) ./files/fstab.init $(1)/etc/init.d/fstab
114 $(INSTALL_CONF) ./files/fstab.default $(1)/etc/uci-defaults/10-fstab
115 $(INSTALL_CONF) ./files/mount.hotplug $(1)/etc/hotplug.d/block/10-mount
116 $(INSTALL_CONF) ./files/media-change.hotplug $(1)/etc/hotplug.d/block/00-media-change
117
118 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/block $(1)/sbin/
119 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libblkid-tiny.so $(1)/lib/
120 $(LN) ../../sbin/block $(1)/usr/sbin/swapon
121 $(LN) ../../sbin/block $(1)/usr/sbin/swapoff
122
123endef
124
125define Package/blockd/install
126 $(INSTALL_DIR) $(1)/sbin $(1)/etc/init.d/
127 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/blockd $(1)/sbin/
128 $(INSTALL_BIN) ./files/blockd.init $(1)/etc/init.d/blockd
129endef
130
131define Build/InstallDev
132 $(INSTALL_DIR) $(1)/usr/include
133 $(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/
134 $(INSTALL_DIR) $(1)/usr/lib/
135 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libubi-utils.a $(1)/usr/lib/
136endef
137
138$(eval $(call BuildPackage,fstools))
139$(eval $(call BuildPackage,snapshot-tool))
140$(eval $(call BuildPackage,block-mount))
141$(eval $(call BuildPackage,blockd))