2 # Copyright (C) 2007-2016 OpenWrt.org
3 # Copyright (C) 2010 Vertical Communications
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
9 include $(TOPDIR
)/rules.mk
10 include $(INCLUDE_DIR
)/kernel.mk
11 include $(INCLUDE_DIR
)/version.mk
12 include $(INCLUDE_DIR
)/feeds.mk
18 PKG_FILE_DEPENDS
:=$(PLATFORM_DIR
)/ $(GENERIC_PLATFORM_DIR
)/base-files
/
19 PKG_BUILD_DEPENDS
:=usign
/host
22 # Extend depends from version.mk
23 PKG_CONFIG_DEPENDS
+= \
24 CONFIG_SIGNED_PACKAGES CONFIG_TARGET_INIT_PATH CONFIG_TARGET_PREINIT_DISABLE_FAILSAFE \
26 CONFIG_PER_FEED_REPO \
27 CONFIG_PER_FEED_REPO_ADD_DISABLED \
28 CONFIG_PER_FEED_REPO_ADD_COMMENTED \
29 $(foreach feed
,$(FEEDS_INSTALLED
),CONFIG_FEED_
$(feed
))
31 include $(INCLUDE_DIR
)/package.mk
34 STAMP_CONFIGURED
:=$(strip $(STAMP_CONFIGURED
))_
$(shell echo
$(CONFIG_TARGET_INIT_PATH
) | mkhash md5
)
38 define Package
/base-files
41 DEPENDS
:=+netifd
+libc
+procd
+jsonfilter
+SIGNED_PACKAGES
:usign
+SIGNED_PACKAGES
:lede-keyring
+NAND_SUPPORT
:ubi-utils
+fstools
+fwtool
42 TITLE
:=Base filesystem for OpenWrt
43 URL
:=http
://openwrt.org
/
44 VERSION
:=$(PKG_RELEASE
)-$(REVISION
)
47 define Package
/base-files
/conffiles
56 /etc
/iproute2
/rt_protos
57 /etc
/iproute2
/rt_tables
68 /etc
/sysctl.d
/local.conf
70 $(call
$(TARGET
)/conffiles
)
73 define Package
/base-files
/description
74 This package contains a base filesystem and system scripts for OpenWrt.
77 define ImageConfigOptions
78 mkdir
-p
$(1)/lib
/preinit
79 echo
'pi_suppress_stderr="$(CONFIG_TARGET_PREINIT_SUPPRESS_STDERR)"' >$(1)/lib
/preinit
/00_preinit.conf
80 echo
'fs_failsafe_wait_timeout=$(if $(CONFIG_TARGET_PREINIT_TIMEOUT),$(CONFIG_TARGET_PREINIT_TIMEOUT),2)' >>$(1)/lib
/preinit
/00_preinit.conf
81 echo
'pi_init_path="$(TARGET_INIT_PATH)"' >>$(1)/lib
/preinit
/00_preinit.conf
82 echo
'pi_init_env=$(if $(CONFIG_TARGET_INIT_ENV),$(CONFIG_TARGET_INIT_ENV),"")' >>$(1)/lib
/preinit
/00_preinit.conf
83 echo
'pi_init_cmd=$(if $(CONFIG_TARGET_INIT_CMD),$(CONFIG_TARGET_INIT_CMD),"/sbin/init")' >>$(1)/lib
/preinit
/00_preinit.conf
84 echo
'pi_init_suppress_stderr="$(CONFIG_TARGET_INIT_SUPPRESS_STDERR)"' >>$(1)/lib
/preinit
/00_preinit.conf
85 echo
'pi_ifname=$(if $(CONFIG_TARGET_PREINIT_IFNAME),$(CONFIG_TARGET_PREINIT_IFNAME),"")' >>$(1)/lib
/preinit
/00_preinit.conf
86 echo
'pi_ip=$(if $(CONFIG_TARGET_PREINIT_IP),$(CONFIG_TARGET_PREINIT_IP),"192.168.1.1")' >>$(1)/lib
/preinit
/00_preinit.conf
87 echo
'pi_netmask=$(if $(CONFIG_TARGET_PREINIT_NETMASK),$(CONFIG_TARGET_PREINIT_NETMASK),"255.255.255.0")' >>$(1)/lib
/preinit
/00_preinit.conf
88 echo
'pi_broadcast=$(if $(CONFIG_TARGET_PREINIT_BROADCAST),$(CONFIG_TARGET_PREINIT_BROADCAST),"192.168.1.255")' >>$(1)/lib
/preinit
/00_preinit.conf
89 echo
'pi_preinit_net_messages="$(CONFIG_TARGET_PREINIT_SHOW_NETMSG)"' >>$(1)/lib
/preinit
/00_preinit.conf
90 echo
'pi_preinit_no_failsafe_netmsg="$(CONFIG_TARGET_PREINIT_SUPPRESS_FAILSAFE_NETMSG)"' >>$(1)/lib
/preinit
/00_preinit.conf
91 echo
'pi_preinit_no_failsafe="$(CONFIG_TARGET_PREINIT_DISABLE_FAILSAFE)"' >>$(1)/lib
/preinit
/00_preinit.conf
95 mkdir
-p
$(PKG_BUILD_DIR
)
98 define Build
/Compile
/Default
101 Build
/Compile
= $(Build
/Compile
/Default
)
103 ifdef CONFIG_SIGNED_PACKAGES
104 define Build
/Configure
105 [ -s
$(BUILD_KEY
) -a
-s
$(BUILD_KEY
).pub
] || \
106 $(STAGING_DIR_HOST
)/bin
/usign
-G
-s
$(BUILD_KEY
) -p
$(BUILD_KEY
).pub
-c
"Local build key"
110 define Package
/base-files
/install-key
111 mkdir
-p
$(1)/etc
/opkg
/keys
112 $(CP
) $(BUILD_KEY
).pub
$(1)/etc
/opkg
/keys
/`$(STAGING_DIR_HOST)/bin/usign -F -p $(BUILD_KEY).pub`
117 ifeq ($(CONFIG_NAND_SUPPORT
),)
118 define Package
/base-files
/nand-support
119 rm -f
$(1)/lib
/upgrade
/nand.sh
123 define Package
/base-files
/install
124 $(CP
) .
/files
/* $(1)/
125 $(Package
/base-files
/install-key
)
126 $(Package
/base-files
/nand-support
)
127 if
[ -d
$(GENERIC_PLATFORM_DIR
)/base-files
/.
]; then \
128 $(CP
) $(GENERIC_PLATFORM_DIR
)/base-files
/* $(1)/; \
130 if
[ -d
$(PLATFORM_DIR
)/base-files
/.
]; then \
131 $(CP
) $(PLATFORM_DIR
)/base-files
/* $(1)/; \
133 $(if
$(filter-out $(PLATFORM_DIR
),$(PLATFORM_SUBDIR
)), \
134 if
[ -d
$(PLATFORM_SUBDIR
)/base-files
/.
]; then \
135 $(CP
) $(PLATFORM_SUBDIR
)/base-files
/* $(1)/; \
141 $(1)/etc
/openwrt_version \
142 $(1)/usr
/lib
/os-release
144 $(VERSION_SED_SCRIPT
) \
145 $(1)/etc
/openwrt_release \
146 $(1)/etc
/device_info \
147 $(1)/usr
/lib
/os-release
149 $(SED
) "s#%PATH%#$(TARGET_INIT_PATH)#g" \
150 $(1)/sbin
/hotplug-call \
154 mkdir
-p
$(1)/CONTROL
156 mkdir
-p
$(1)/etc
/config
157 mkdir
-p
$(1)/etc
/crontabs
158 mkdir
-p
$(1)/etc
/rc.d
159 mkdir
-p
$(1)/overlay
160 mkdir
-p
$(1)/lib
/firmware
161 $(if
$(LIB_SUFFIX
),-$(LN
) lib
$(1)/lib
$(LIB_SUFFIX
))
165 mkdir
-p
$(1)/usr
/lib
166 $(if
$(LIB_SUFFIX
),-$(LN
) lib
$(1)/usr
/lib
$(LIB_SUFFIX
))
167 mkdir
-p
$(1)/usr
/bin
171 $(LN
) /proc
/mounts
$(1)/etc
/mtab
175 $(LN
) /tmp
/resolv.conf
/tmp
/TZ
/tmp
/localtime
$(1)/etc
/
177 chmod
0600 $(1)/etc
/shadow
180 $(call ImageConfigOptions
,$(1))
181 $(call Package
/base-files
/install-target
,$(1))
182 for conffile in
$(1)/etc
/config
/*; do \
183 if
[ -f
"$$$$conffile" ]; then \
184 grep
"$$$${conffile##$(1)}" $(1)/CONTROL
/conffiles || \
185 echo
"$$$${conffile##$(1)}" >> $(1)/CONTROL
/conffiles
; \
189 $(if
$(CONFIG_INCLUDE_CONFIG
), \
190 echo
-e
"# Build configuration for board $(BOARD)/$(SUBTARGET)/$(PROFILE)\n" >$(1)/etc
/build.config
; \
191 cat
$(BIN_DIR
)/config.seed
>>$(1)/etc
/build.config
)
193 $(call FeedSourcesAppend
,$(1)/etc
/opkg
/distfeeds.conf
)
194 $(VERSION_SED
) $(1)/etc
/opkg
/distfeeds.conf
198 -include $(PLATFORM_DIR
)/base-files.mk
199 -include $(PLATFORM_SUBDIR
)/base-files.mk
202 $(eval
$(call BuildPackage
,base-files
))