procd: prepare NAND sysupgrade for making upgraded dynamically linked
[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=$(LEDE_GIT)/project/fstools.git
15 PKG_SOURCE_DATE:=2017-05-09
16 PKG_SOURCE_VERSION:=c43ae11e71abf607a1998800f8ced489ec5d1e88
17 PKG_MIRROR_HASH:=f305bfc6f2aed6f13e59581969d9da7cdf76a823f7e1fe3f1dfdc221788374dd
18 CMAKE_INSTALL:=1
19
20 PKG_LICENSE:=GPL-2.0
21 PKG_LICENSE_FILES:=
22
23 PKG_USE_MIPS16:=0
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 TARGET_LDFLAGS += $(if $(CONFIG_USE_GLIBC),-lrt)
35 CMAKE_OPTIONS += $(if $(CONFIG_FSTOOLS_UBIFS_EXTROOT),-DCMAKE_UBIFS_EXTROOT=y)
36
37 define Package/fstools
38 SECTION:=base
39 CATEGORY:=Base system
40 DEPENDS:=+ubox +USE_GLIBC:librt +NAND_SUPPORT:ubi-utils
41 TITLE:=OpenWrt filesystem tools
42 MENU:=1
43 endef
44
45 define Package/fstools/config
46 config FSTOOLS_UBIFS_EXTROOT
47 depends on PACKAGE_fstools
48 depends on NAND_SUPPORT
49 bool "Support extroot functionality with UBIFS"
50 default y
51 help
52 This option makes it possible to use extroot functionality if the root filesystem resides on an UBIFS partition
53 endef
54
55 define Package/snapshot-tool
56 SECTION:=base
57 CATEGORY:=Base system
58 TITLE:=rootfs snapshoting tool
59 DEPENDS:=+libubox +fstools
60 endef
61
62 define Package/block-mount
63 SECTION:=base
64 CATEGORY:=Base system
65 TITLE:=Block device mounting and checking
66 DEPENDS:=+ubox +libubox +libuci
67 endef
68
69 define Package/blockd
70 SECTION:=base
71 CATEGORY:=Base system
72 TITLE:=Block device automounting
73 DEPENDS:=+block-mount +fstools +libubus +kmod-fs-autofs4
74 endef
75
76 define Package/fstools/install
77 $(INSTALL_DIR) $(1)/sbin $(1)/lib
78
79 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{mount_root,jffs2reset} $(1)/sbin/
80 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libfstools.so $(1)/lib/
81 $(LN) jffs2reset $(1)/sbin/jffs2mark
82 endef
83
84 define Package/snapshot-tool/install
85 $(INSTALL_DIR) $(1)/sbin
86
87 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snapshot_tool $(1)/sbin/
88 $(INSTALL_BIN) ./files/snapshot $(1)/sbin/
89 endef
90
91 define Package/block-mount/install
92 $(INSTALL_DIR) $(1)/sbin $(1)/lib $(1)/usr/sbin $(1)/etc/hotplug.d/block $(1)/etc/init.d/ $(1)/etc/uci-defaults/
93
94 $(INSTALL_BIN) ./files/fstab.init $(1)/etc/init.d/fstab
95 $(INSTALL_DATA) ./files/fstab.default $(1)/etc/uci-defaults/10-fstab
96 $(INSTALL_DATA) ./files/mount.hotplug $(1)/etc/hotplug.d/block/10-mount
97
98 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/block $(1)/sbin/
99 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libblkid-tiny.so $(1)/lib/
100 $(LN) ../../sbin/block $(1)/usr/sbin/swapon
101 $(LN) ../../sbin/block $(1)/usr/sbin/swapoff
102
103 endef
104
105 define Package/blockd/install
106 $(INSTALL_DIR) $(1)/sbin $(1)/etc/init.d/
107 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/blockd $(1)/sbin/
108 $(INSTALL_BIN) ./files/blockd.init $(1)/etc/init.d/blockd
109 endef
110
111 define Build/InstallDev
112 $(INSTALL_DIR) $(1)/usr/include
113 $(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/
114 $(INSTALL_DIR) $(1)/usr/lib/
115 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libubi-utils.a $(1)/usr/lib/
116 endef
117
118 $(eval $(call BuildPackage,fstools))
119 $(eval $(call BuildPackage,snapshot-tool))
120 $(eval $(call BuildPackage,block-mount))
121 $(eval $(call BuildPackage,blockd))