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
17 PKG_FILE_DEPENDS
:=$(PLATFORM_DIR
)/ $(GENERIC_PLATFORM_DIR
)/base-files
/
18 PKG_BUILD_DEPENDS
:=usign
/host
21 PKG_CONFIG_DEPENDS
:= CONFIG_SIGNED_PACKAGES CONFIG_TARGET_INIT_PATH CONFIG_TARGET_PREINIT_DISABLE_FAILSAFE
23 include $(INCLUDE_DIR
)/package.mk
26 STAMP_CONFIGURED
:=$(strip $(STAMP_CONFIGURED
))_
$(shell $(SH_FUNC
) echo
$(CONFIG_TARGET_INIT_PATH
) | md5s
)
28 ifneq ($(wildcard $(PLATFORM_DIR
)/base-files-
$(PROFILE
) $(PLATFORM_SUBDIR
)/base-files-
$(PROFILE
)),)
29 TARGET
:=$(TARGET
)-$(PROFILE
)
33 define Package
/base-files
36 DEPENDS
:=+netifd
+libc
+procd
+jsonfilter
+SIGNED_PACKAGES
:usign
+SIGNED_PACKAGES
:lede-keyring
+fstools
37 TITLE
:=Base filesystem for Lede
38 URL
:=http
://openwrt.org
/
39 VERSION
:=$(PKG_RELEASE
)-$(REVISION
)
42 define Package
/base-files
/conffiles
60 /etc
/sysctl.d
/local.conf
62 /etc
/iproute2
/rt_tables
63 $(call
$(TARGET
)/conffiles
)
66 define Package
/base-files
/description
67 This package contains a base filesystem and system scripts for OpenWrt.
70 ifneq ($(CONFIG_PREINITOPT
),)
71 define ImageConfigOptions
72 mkdir
-p
$(1)/lib
/preinit
73 echo
'pi_suppress_stderr="$(CONFIG_TARGET_PREINIT_SUPPRESS_STDERR)"' >$(1)/lib
/preinit
/00_preinit.conf
74 echo
'fs_failsafe_wait_timeout=$(if $(CONFIG_TARGET_PREINIT_TIMEOUT),$(CONFIG_TARGET_PREINIT_TIMEOUT),2)' >>$(1)/lib
/preinit
/00_preinit.conf
75 echo
'pi_init_path="$(TARGET_INIT_PATH)"' >>$(1)/lib
/preinit
/00_preinit.conf
76 echo
'pi_init_env=$(if $(CONFIG_TARGET_INIT_ENV),$(CONFIG_TARGET_INIT_ENV),"")' >>$(1)/lib
/preinit
/00_preinit.conf
77 echo
'pi_init_cmd=$(if $(CONFIG_TARGET_INIT_CMD),$(CONFIG_TARGET_INIT_CMD),"/sbin/init")' >>$(1)/lib
/preinit
/00_preinit.conf
78 echo
'pi_init_suppress_stderr="$(CONFIG_TARGET_INIT_SUPPRESS_STDERR)"' >>$(1)/lib
/preinit
/00_preinit.conf
79 echo
'pi_ifname=$(if $(CONFIG_TARGET_PREINIT_IFNAME),$(CONFIG_TARGET_PREINIT_IFNAME),"")' >>$(1)/lib
/preinit
/00_preinit.conf
80 echo
'pi_ip=$(if $(CONFIG_TARGET_PREINIT_IP),$(CONFIG_TARGET_PREINIT_IP),"192.168.1.1")' >>$(1)/lib
/preinit
/00_preinit.conf
81 echo
'pi_netmask=$(if $(CONFIG_TARGET_PREINIT_NETMASK),$(CONFIG_TARGET_PREINIT_NETMASK),"255.255.255.0")' >>$(1)/lib
/preinit
/00_preinit.conf
82 echo
'pi_broadcast=$(if $(CONFIG_TARGET_PREINIT_BROADCAST),$(CONFIG_TARGET_PREINIT_BROADCAST),"192.168.1.255")' >>$(1)/lib
/preinit
/00_preinit.conf
83 echo
'pi_preinit_net_messages="$(CONFIG_TARGET_PREINIT_SHOW_NETMSG)"' >>$(1)/lib
/preinit
/00_preinit.conf
84 echo
'pi_preinit_no_failsafe_netmsg="$(CONFIG_TARGET_PREINIT_SUPPRESS_FAILSAFE_NETMSG)"' >>$(1)/lib
/preinit
/00_preinit.conf
85 echo
'pi_preinit_no_failsafe="$(CONFIG_TARGET_PREINIT_DISABLE_FAILSAFE)"' >>$(1)/lib
/preinit
/00_preinit.conf
90 mkdir
-p
$(PKG_BUILD_DIR
)
93 define Build
/Compile
/Default
96 Build
/Compile
= $(Build
/Compile
/Default
)
98 ifdef CONFIG_SIGNED_PACKAGES
99 define Build
/Configure
100 [ -s
$(BUILD_KEY
) -a
-s
$(BUILD_KEY
).pub
] || \
101 $(STAGING_DIR_HOST
)/bin
/usign
-G
-s
$(BUILD_KEY
) -p
$(BUILD_KEY
).pub
-c
"Local build key"
105 define Package
/base-files
/install-key
106 mkdir
-p
$(1)/etc
/opkg
/keys
107 $(CP
) $(BUILD_KEY
).pub
$(1)/etc
/opkg
/keys
/`$(STAGING_DIR_HOST)/bin/usign -F -p $(BUILD_KEY).pub`
112 define Package
/base-files
/install
113 $(CP
) .
/files
/* $(1)/
114 $(Package
/base-files
/install-key
)
115 if
[ -d
$(GENERIC_PLATFORM_DIR
)/base-files
/.
]; then \
116 $(CP
) $(GENERIC_PLATFORM_DIR
)/base-files
/* $(1)/; \
118 if
[ -d
$(PLATFORM_DIR
)/base-files
/.
]; then \
119 $(CP
) $(PLATFORM_DIR
)/base-files
/* $(1)/; \
121 if
[ -d
$(PLATFORM_DIR
)/base-files-
$(PROFILE
)/.
]; then \
122 $(CP
) $(PLATFORM_DIR
)/base-files-
$(PROFILE
)/* $(1)/; \
124 if
[ -d
$(PLATFORM_DIR
)/$(PROFILE
)/base-files
/.
]; then \
125 $(CP
) $(PLATFORM_DIR
)/$(PROFILE
)/base-files
/* $(1)/; \
127 $(if
$(filter-out $(PLATFORM_DIR
),$(PLATFORM_SUBDIR
)), \
128 if
[ -d
$(PLATFORM_SUBDIR
)/base-files
/.
]; then \
129 $(CP
) $(PLATFORM_SUBDIR
)/base-files
/* $(1)/; \
131 if
[ -d
$(PLATFORM_SUBDIR
)/base-files-
$(PROFILE
)/.
]; then \
132 $(CP
) $(PLATFORM_SUBDIR
)/base-files-
$(PROFILE
)/* $(1)/; \
134 if
[ -d
$(PLATFORM_SUBDIR
)/$(PROFILE
)/base-files
/.
]; then \
135 $(CP
) $(PLATFORM_SUBDIR
)/$(PROFILE
)/base-files
/* $(1)/; \
141 $(1)/etc
/openwrt_version
143 $(VERSION_SED_SCRIPT
) \
144 $(1)/etc
/openwrt_release \
147 $(SED
) "s#%PATH%#$(TARGET_INIT_PATH)#g" \
148 $(1)/sbin
/hotplug-call \
152 mkdir
-p
$(1)/CONTROL
154 mkdir
-p
$(1)/etc
/crontabs
155 mkdir
-p
$(1)/etc
/rc.d
156 mkdir
-p
$(1)/overlay
157 mkdir
-p
$(1)/lib
/firmware
158 $(if
$(LIB_SUFFIX
),-$(LN
) lib
$(1)/lib
$(LIB_SUFFIX
))
162 mkdir
-p
$(1)/usr
/lib
163 $(if
$(LIB_SUFFIX
),-$(LN
) lib
$(1)/usr
/lib
$(LIB_SUFFIX
))
164 mkdir
-p
$(1)/usr
/bin
168 $(LN
) /proc
/mounts
$(1)/etc
/mtab
172 $(LN
) /tmp
/resolv.conf
/tmp
/fstab
/tmp
/TZ
/tmp
/localtime
$(1)/etc
/
174 chmod
0600 $(1)/etc
/shadow
177 $(call ImageConfigOptions
,$(1))
178 $(call Package
/base-files
/install-target
,$(1))
179 for conffile in
$(1)/etc
/config
/*; do \
180 if
[ -f
"$$$$conffile" ]; then \
181 grep
"$$$${conffile##$(1)}" $(1)/CONTROL
/conffiles || \
182 echo
"$$$${conffile##$(1)}" >> $(1)/CONTROL
/conffiles
; \
188 -include $(PLATFORM_DIR
)/base-files.mk
191 $(eval
$(call BuildPackage
,base-files
))