1e556ba23834864afa6860c48334439268315642
[openwrt/openwrt.git] / package / system / fstools / Makefile
1 #
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
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=fstools
11 PKG_RELEASE:=1
12
13 PKG_SOURCE_PROTO:=git
14 PKG_SOURCE_URL=$(PROJECT_GIT)/project/fstools.git
15 PKG_MIRROR_HASH:=b9ee731429b36aac98288d383e39c7072c43ddd00aae7a1c0a675fb6a975270f
16 PKG_SOURCE_DATE:=2025-07-05
17 PKG_SOURCE_VERSION:=e8cd820cdbb8fba990fd79efda90c5dc10d8e45c
18 CMAKE_INSTALL:=1
19
20 PKG_LICENSE:=GPL-2.0
21 PKG_LICENSE_FILES:=
22
23 PKG_BUILD_FLAGS:=no-mips16
24 PKG_FLAGS:=nonshared
25
26 PKG_BUILD_DEPENDS := util-linux
27 PKG_CONFIG_DEPENDS := CONFIG_NAND_SUPPORT CONFIG_FSTOOLS_UBIFS_EXTROOT
28
29 PKG_MAINTAINER:=John Crispin <john@phrozen.org>
30
31 include $(INCLUDE_DIR)/package.mk
32 include $(INCLUDE_DIR)/cmake.mk
33
34 CMAKE_OPTIONS += $(if $(CONFIG_FSTOOLS_UBIFS_EXTROOT),-DCMAKE_UBIFS_EXTROOT=y)
35 CMAKE_OPTIONS += $(if $(CONFIG_FSTOOLS_OVL_MOUNT_FULL_ACCESS_TIME),-DCMAKE_OVL_MOUNT_FULL_ACCESS_TIME=y)
36 CMAKE_OPTIONS += $(if $(CONFIG_FSTOOLS_OVL_MOUNT_COMPRESS_ZLIB),-DCMAKE_OVL_MOUNT_COMPRESS_ZLIB=y)
37
38 define Package/fstools
39 SECTION:=base
40 CATEGORY:=Base system
41 DEPENDS:=+ubox +NAND_SUPPORT:ubi-utils
42 TITLE:=OpenWrt filesystem tools
43 MENU:=1
44 endef
45
46 define 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.
68 endef
69
70 define Package/snapshot-tool
71 SECTION:=base
72 CATEGORY:=Base system
73 TITLE:=rootfs snapshoting tool
74 DEPENDS:=+libubox +fstools
75 endef
76
77 define Package/block-mount/conffiles
78 /etc/config/fstab
79 endef
80
81 define 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
86 endef
87
88 define 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
93 endef
94
95 define Package/fstools/install
96 $(INSTALL_DIR) $(1)/sbin $(1)/lib
97
98 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{mount_root,factoryreset} $(1)/sbin/
99 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libfstools.so $(1)/lib/
100 $(LN) factoryreset $(1)/sbin/jffs2mark
101 $(LN) factoryreset $(1)/sbin/jffs2reset
102 endef
103
104 define Package/snapshot-tool/install
105 $(INSTALL_DIR) $(1)/sbin
106
107 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snapshot_tool $(1)/sbin/
108 $(INSTALL_BIN) ./files/snapshot $(1)/sbin/
109 endef
110
111 define Package/block-mount/install
112 $(INSTALL_DIR) $(1)/sbin $(1)/lib $(1)/usr/sbin $(1)/etc/hotplug.d/block $(1)/etc/init.d/ $(1)/etc/uci-defaults/
113
114 $(INSTALL_BIN) ./files/fstab.init $(1)/etc/init.d/fstab
115 $(INSTALL_CONF) ./files/fstab.default $(1)/etc/uci-defaults/10-fstab
116 $(INSTALL_CONF) ./files/mount.hotplug $(1)/etc/hotplug.d/block/10-mount
117 $(INSTALL_CONF) ./files/media-change.hotplug $(1)/etc/hotplug.d/block/00-media-change
118
119 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/block $(1)/sbin/
120 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libblkid-tiny.so $(1)/lib/
121 $(LN) ../../sbin/block $(1)/usr/sbin/swapon
122 $(LN) ../../sbin/block $(1)/usr/sbin/swapoff
123
124 endef
125
126 define Package/blockd/install
127 $(INSTALL_DIR) $(1)/sbin $(1)/etc/init.d/
128 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/blockd $(1)/sbin/
129 $(INSTALL_BIN) ./files/blockd.init $(1)/etc/init.d/blockd
130 endef
131
132 define Build/InstallDev
133 $(INSTALL_DIR) $(1)/usr/include
134 $(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/
135 $(INSTALL_DIR) $(1)/usr/lib/
136 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libubi-utils.a $(1)/usr/lib/
137 endef
138
139 $(eval $(call BuildPackage,fstools))
140 $(eval $(call BuildPackage,snapshot-tool))
141 $(eval $(call BuildPackage,block-mount))
142 $(eval $(call BuildPackage,blockd))