29d4726af7dff31e59c6f320bf4464fce3410a5d
[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:=cf9e09885954e0e43b58126ce4b6f5552462cf1495b89330ce4e66056249787e
16 PKG_SOURCE_DATE:=2024-01-22
17 PKG_SOURCE_VERSION:=08cd7083cac4bddf88459efa0881ee52858e7d0a
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,jffs2reset} $(1)/sbin/
99 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libfstools.so $(1)/lib/
100 $(LN) jffs2reset $(1)/sbin/jffs2mark
101 endef
102
103 define 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/
108 endef
109
110 define 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
123 endef
124
125 define 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
129 endef
130
131 define 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/
136 endef
137
138 $(eval $(call BuildPackage,fstools))
139 $(eval $(call BuildPackage,snapshot-tool))
140 $(eval $(call BuildPackage,block-mount))
141 $(eval $(call BuildPackage,blockd))