2 # Copyright (C) 2007-2013 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
16 PKG_FILE_DEPENDS
:=$(PLATFORM_DIR
)/ $(GENERIC_PLATFORM_DIR
)/base-files
/
17 PKG_BUILD_DEPENDS
:=opkg
/host
19 include $(INCLUDE_DIR
)/package.mk
23 ifneq ($(wildcard $(PLATFORM_DIR
)/base-files-
$(PROFILE
) $(PLATFORM_SUBDIR
)/base-files-
$(PROFILE
)),)
24 TARGET
:=$(TARGET
)-$(PROFILE
)
28 define Package
/base-files
31 DEPENDS
:=+netifd
+libc
+procd
32 TITLE
:=Base filesystem for OpenWrt
33 URL
:=http
://openwrt.org
/
34 VERSION
:=$(PKG_RELEASE
)-$(REVISION
)
37 define Package
/base-files
/conffiles
51 $(call
$(TARGET
)/conffiles
)
54 define Package
/base-files
/description
55 This package contains a base filesystem and system scripts for OpenWrt.
58 ifneq ($(CONFIG_PREINITOPT
),)
59 define ImageConfigOptions
60 mkdir
-p
$(1)/lib
/preinit
61 echo
'pi_suppress_stderr="$(CONFIG_TARGET_PREINIT_SUPPRESS_STDERR)"' >$(1)/lib
/preinit
/00_preinit.conf
62 echo
'fs_failsafe_wait_timeout=$(if $(CONFIG_TARGET_PREINIT_TIMEOUT),$(CONFIG_TARGET_PREINIT_TIMEOUT),2)' >>$(1)/lib
/preinit
/00_preinit.conf
63 echo
'pi_init_path=$(if $(CONFIG_TARGET_INIT_PATH),$(CONFIG_TARGET_INIT_PATH),"/bin:/sbin:/usr/bin:/usr/sbin")' >>$(1)/lib
/preinit
/00_preinit.conf
64 echo
'pi_init_env=$(if $(CONFIG_TARGET_INIT_ENV),$(CONFIG_TARGET_INIT_ENV),"")' >>$(1)/lib
/preinit
/00_preinit.conf
65 echo
'pi_init_cmd=$(if $(CONFIG_TARGET_INIT_CMD),$(CONFIG_TARGET_INIT_CMD),"/sbin/init")' >>$(1)/lib
/preinit
/00_preinit.conf
66 echo
'pi_init_suppress_stderr="$(CONFIG_TARGET_INIT_SUPPRESS_STDERR)"' >>$(1)/lib
/preinit
/00_preinit.conf
67 echo
'pi_ifname=$(if $(CONFIG_TARGET_PREINIT_IFNAME),$(CONFIG_TARGET_PREINIT_IFNAME),"")' >>$(1)/lib
/preinit
/00_preinit.conf
68 echo
'pi_ip=$(if $(CONFIG_TARGET_PREINIT_IP),$(CONFIG_TARGET_PREINIT_IP),"192.168.1.1")' >>$(1)/lib
/preinit
/00_preinit.conf
69 echo
'pi_netmask=$(if $(CONFIG_TARGET_PREINIT_NETMASK),$(CONFIG_TARGET_PREINIT_NETMASK),"255.255.255.0")' >>$(1)/lib
/preinit
/00_preinit.conf
70 echo
'pi_broadcast=$(if $(CONFIG_TARGET_PREINIT_BROADCAST),$(CONFIG_TARGET_PREINIT_BROADCAST),"192.168.1.255")' >>$(1)/lib
/preinit
/00_preinit.conf
71 echo
'pi_preinit_net_messages="$(CONFIG_TARGET_PREINIT_SHOW_NETMSG)"' >>$(1)/lib
/preinit
/00_preinit.conf
72 echo
'pi_preinit_no_failsafe_netmsg="$(CONFIG_TARGET_PREINIT_SUPPRESS_FAILSAFE_NETMSG)"' >>$(1)/lib
/preinit
/00_preinit.conf
77 mkdir
-p
$(PKG_BUILD_DIR
)
80 define Build
/Compile
/Default
83 Build
/Compile
= $(Build
/Compile
/Default
)
85 define Package
/base-files
/install
87 if
[ -d
$(GENERIC_PLATFORM_DIR
)/base-files
/.
]; then \
88 $(CP
) $(GENERIC_PLATFORM_DIR
)/base-files
/* $(1)/; \
90 if
[ -d
$(PLATFORM_DIR
)/base-files
/.
]; then \
91 $(CP
) $(PLATFORM_DIR
)/base-files
/* $(1)/; \
93 if
[ -d
$(PLATFORM_DIR
)/base-files-
$(PROFILE
)/.
]; then \
94 $(CP
) $(PLATFORM_DIR
)/base-files-
$(PROFILE
)/* $(1)/; \
96 if
[ -d
$(PLATFORM_DIR
)/$(PROFILE
)/base-files
/.
]; then \
97 $(CP
) $(PLATFORM_DIR
)/$(PROFILE
)/base-files
/* $(1)/; \
99 $(if
$(filter-out $(PLATFORM_DIR
),$(PLATFORM_SUBDIR
)), \
100 if
[ -d
$(PLATFORM_SUBDIR
)/base-files
/.
]; then \
101 $(CP
) $(PLATFORM_SUBDIR
)/base-files
/* $(1)/; \
103 if
[ -d
$(PLATFORM_SUBDIR
)/base-files-
$(PROFILE
)/.
]; then \
104 $(CP
) $(PLATFORM_SUBDIR
)/base-files-
$(PROFILE
)/* $(1)/; \
106 if
[ -d
$(PLATFORM_SUBDIR
)/$(PROFILE
)/base-files
/.
]; then \
107 $(CP
) $(PLATFORM_SUBDIR
)/$(PROFILE
)/base-files
/* $(1)/; \
113 $(1)/etc
/openwrt_version \
114 $(1)/etc
/openwrt_release
116 mkdir
-p
$(1)/CONTROL
118 mkdir
-p
$(1)/etc
/crontabs
119 mkdir
-p
$(1)/etc
/rc.d
120 mkdir
-p
$(1)/overlay
121 mkdir
-p
$(1)/lib
/firmware
122 $(if
$(LIB_SUFFIX
),-ln
-s lib
$(1)/lib
$(LIB_SUFFIX
))
126 mkdir
-p
$(1)/usr
/lib
127 $(if
$(LIB_SUFFIX
),-ln
-s lib
$(1)/usr
/lib
$(LIB_SUFFIX
))
128 mkdir
-p
$(1)/usr
/bin
132 ln
-sf
/proc
/mounts
$(1)/etc
/mtab
136 ln
-sf
/tmp
/resolv.conf
/tmp
/fstab
/tmp
/TZ
$(1)/etc
/
138 chmod
0600 $(1)/etc
/shadow
141 $(call ImageConfigOptions
,$(1))
142 $(call Package
/base-files
/install-target
,$(1))
143 for conffile in
$(1)/etc
/config
/*; do \
144 if
[ -f
"$$$$conffile" ]; then \
145 grep
"$$$${conffile##$(1)}" $(1)/CONTROL
/conffiles || \
146 echo
"$$$${conffile##$(1)}" >> $(1)/CONTROL
/conffiles
; \
152 -include $(PLATFORM_DIR
)/base-files.mk
155 $(eval
$(call BuildPackage
,base-files
))