2 # Copyright (C) 2007-2009 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR
)/rules.mk
9 include $(INCLUDE_DIR
)/kernel.mk
14 PKG_FILE_DEPENDS
:=$(PLATFORM_DIR
)/ $(GENERIC_PLATFORM_DIR
)/base-files
/
16 include $(INCLUDE_DIR
)/package.mk
20 ifneq ($(wildcard $(PLATFORM_DIR
)/base-files-
$(PROFILE
) $(PLATFORM_SUBDIR
)/base-files-
$(PROFILE
)),)
21 TARGET
:=$(TARGET
)-$(PROFILE
)
23 LIBGCC_VERSION
:=$(GCC_VERSION
)
28 LIBC_VERSION
:=<LIBC_VERSION
>
29 LIBGCC_VERSION
:=<LIBGCC_VERSION
>
32 CONFIG_PACKAGE_base-files
$(TARGET
):=$(CONFIG_PACKAGE_base-files
)
34 define Package
/base-files
$(TARGET
)
37 TITLE
:=Base filesystem for OpenWrt
38 URL
:=http
://openwrt.org
/
39 VERSION
:=$(PKG_RELEASE
)-$(REVISION
)
40 $(call Config
,network.lan.proto
,string
,static
,LAN Protocol
)
41 $(call Config
,network.lan.ipaddr
,ip
,192.168.1.1,LAN IP Address
)
42 $(call Config
,network.lan.netmask
,netmask
,255.255.255.0,LAN Network Mask
)
43 $(call Config
,network.lan.gateway
,ip
,,LAN Gateway
)
44 $(call Config
,network.lan.dns
,ip
,,LAN DNS server
)
47 define Package
/base-files
$(TARGET
)/conffiles
56 $(call
$(TARGET
)/conffiles
)
59 define Package
/base-files
$(TARGET
)/description
60 This package contains a base filesystem and system scripts for OpenWrt.
63 define Package
/gcc
/Default
66 DEPENDS
:=@
!NATIVE_TOOLCHAIN
67 URL
:=http
://gcc.gnu.org
/
68 VERSION
:=$(LIBGCC_VERSION
)-$(PKG_RELEASE
)
72 $(call Package
/gcc
/Default
)
73 TITLE
:=GCC support library
74 DEPENDS
+=@
!TARGET_avr32
78 $(call Package
/gcc
/Default
)
80 TITLE
:=GCC support library
83 define Package
/libstdcpp
84 $(call Package
/gcc
/Default
)
86 TITLE
:=GNU Standard C
++ Library v3
87 DEPENDS
+=@INSTALL_LIBSTDCPP
90 define Package
/libc
/Default
93 DEPENDS
:=@
!NATIVE_TOOLCHAIN
94 VERSION
:=$(LIBC_VERSION
)-$(PKG_RELEASE
)
99 $(call Package
/libc
/Default
)
103 define Package
/libpthread
104 $(call Package
/libc
/Default
)
105 TITLE
:=POSIX thread library
110 $(call Package
/libc
/Default
)
111 TITLE
:=POSIX
.1b RealTime extension library
115 $(call Package
/libc
/Default
)
118 TITLE
:=LDD trace utility
121 define Package
/ldconfig
122 $(call Package
/libc
/Default
)
125 TITLE
:=Shared library path configuration
130 mkdir
-p
$(PKG_BUILD_DIR
)
133 define Build
/Compile
/Default
137 $(call Build
/Compile
/Default
)
140 define Package
/base-files
$(TARGET
)/install
141 $(CP
) .
/files
/* $(1)/
142 if
[ -d
$(GENERIC_PLATFORM_DIR
)/base-files
/.
]; then \
143 $(CP
) $(GENERIC_PLATFORM_DIR
)/base-files
/* $(1)/; \
145 if
[ -d
$(PLATFORM_DIR
)/base-files
/.
]; then \
146 $(CP
) $(PLATFORM_DIR
)/base-files
/* $(1)/; \
148 if
[ -d
$(PLATFORM_DIR
)/base-files-
$(PROFILE
)/.
]; then \
149 $(CP
) $(PLATFORM_DIR
)/base-files-
$(PROFILE
)/* $(1)/; \
151 if
[ -d
$(PLATFORM_DIR
)/$(PROFILE
)/base-files
/.
]; then \
152 $(CP
) $(PLATFORM_DIR
)/$(PROFILE
)/base-files
/* $(1)/; \
154 $(if
$(filter-out $(PLATFORM_DIR
),$(PLATFORM_SUBDIR
)), \
155 if
[ -d
$(PLATFORM_SUBDIR
)/base-files
/.
]; then \
156 $(CP
) $(PLATFORM_SUBDIR
)/base-files
/* $(1)/; \
158 if
[ -d
$(PLATFORM_SUBDIR
)/base-files-
$(PROFILE
)/.
]; then \
159 $(CP
) $(PLATFORM_SUBDIR
)/base-files-
$(PROFILE
)/* $(1)/; \
161 if
[ -d
$(PLATFORM_SUBDIR
)/$(PROFILE
)/base-files
/.
]; then \
162 $(CP
) $(PLATFORM_SUBDIR
)/$(PROFILE
)/base-files
/* $(1)/; \
165 # Form valid /etc/shadow entries, by copying the user:pw pairs
166 # from /etc/passwd, and adding on pw change data
167 $(if
$(CONFIG_BUSYBOX_CONFIG_FEATURE_SHADOWPASSWDS
), \
168 cut
-d
':' -f
1-2 $(1)/etc
/passwd
> $(1)/etc
/shadow
; \
169 $(SED
) 's/$$$$/:13848:0:99999:7:::/' $(1)/etc
/shadow \
171 $(SED
) 's,$$$$R,$(REVISION),g' $(1)/etc
/banner
172 mkdir
-p
$(1)/CONTROL
174 mkdir
-p
$(1)/etc
/crontabs
176 mkdir
-p
$(1)/lib
/firmware
180 mkdir
-p
$(1)/usr
/lib
181 mkdir
-p
$(1)/usr
/bin
185 ln
-sf
/proc
/mounts
$(1)/etc
/mtab
189 ln
-sf
/tmp
/resolv.conf
/tmp
/fstab
/tmp
/TZ
$(1)/etc
/
190 $(call Package
/base-files
/install-target
,$(1))
191 for conffile in
$(1)/etc
/config
/*; do \
192 if
[ -f
"$$$$conffile" ]; then \
193 grep
"$$$$conffile" $(1)/CONTROL
/conffiles || \
194 echo
"$$$${conffile##$(1)}" >> $(1)/CONTROL
/conffiles
; \
199 define Package
/libgcc
/install
200 $(INSTALL_DIR
) $(1)/lib
201 $(CP
) $(TOOLCHAIN_DIR
)/lib
$(LIB_SUFFIX
)/libgcc_s.so.
* $(1)/lib
/
204 define Package
/libssp
/install
205 $(INSTALL_DIR
) $(1)/lib
206 $(CP
) $(TOOLCHAIN_DIR
)/lib
$(LIB_SUFFIX
)/libssp.so.
* $(1)/lib
/
209 define Package
/libstdcpp
/install
210 $(INSTALL_DIR
) $(1)/usr
/lib
211 $(CP
) $(TOOLCHAIN_DIR
)/usr
/lib
$(LIB_SUFFIX
)/libstdc
++.so.
* $(1)/usr
/lib
/
214 use_libutil
=$(if
$(CONFIG_USE_GLIBC
)$(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP
),libutil
)
215 use_libnsl
=$(if
$(CONFIG_USE_GLIBC
)$(CONFIG_EGLIBC_OPTION_EGLIBC_NIS
),libnsl
)
216 use_nsswitch
=$(if
$(CONFIG_USE_GLIBC
)$(CONFIG_EGLIBC_OPTION_EGLIBC_NSSWITCH
),libnss_dns libnss_files
)
218 define Package
/glibc
/install
219 $(INSTALL_DIR
) $(1)/lib
220 $(CP
) $(TOOLCHAIN_DIR
)/lib
/ld*.so.
* $(1)/lib
/
221 $(CP
) $(TOOLCHAIN_DIR
)/lib
/ld-
$(LIBC_SO_VERSION
).so
$(1)/lib
/
222 for file in libanl libc libcidn libcrypt libdl libm
$(use_libnsl
) $(use_nsswitch
) libresolv
$(use_libutil
); do \
223 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file.so.
* $(1)/lib
/; \
224 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file-$(LIBC_SO_VERSION
).so
$(1)/lib
/; \
228 define Package
/eglibc
/install
229 $(call Package
/glibc
/install,$1)
232 define Package
/uClibc
/install
233 $(INSTALL_DIR
) $(1)/lib
234 for file in
ld$(LIB_SUFFIX
)-uClibc libc libcrypt libdl libm libnsl libresolv libuClibc libutil
; do \
235 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file.so.
* $(1)/lib
/; \
236 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file-$(LIBC_SO_VERSION
).so
$(1)/lib
/; \
240 define Package
/libc
/install
241 $(call Package
/$(LIBC
)/install,$1)
244 define Package
/libpthread
/install
245 $(INSTALL_DIR
) $(1)/lib
246 $(CP
) $(TOOLCHAIN_DIR
)/lib
/libpthread.so.
* $(1)/lib
/
247 $(CP
) $(TOOLCHAIN_DIR
)/lib
/libpthread-
$(LIBC_SO_VERSION
).so
$(1)/lib
/
250 define Package
/librt
/install
251 $(INSTALL_DIR
) $(1)/lib
252 $(CP
) $(TOOLCHAIN_DIR
)/lib
/librt.so.
* $(1)/lib
/
253 $(CP
) $(TOOLCHAIN_DIR
)/lib
/librt-
$(LIBC_SO_VERSION
).so
$(1)/lib
/
256 define Package
/ldd
/install
257 $(INSTALL_DIR
) $(1)/usr
/bin
/
258 $(CP
) $(TOOLCHAIN_DIR
)/usr
/bin
/ldd
$(1)/usr
/bin
/
261 define Package
/ldconfig
/install
262 $(INSTALL_DIR
) $(1)/sbin
/
263 $(CP
) $(TOOLCHAIN_DIR
)/sbin
/ldconfig
$(1)/sbin
/
267 -include $(PLATFORM_DIR
)/base-files.mk
270 $(eval
$(call BuildPackage
,base-files
$(TARGET
)))
271 $(eval
$(call BuildPackage
,libc
))
272 $(eval
$(call BuildPackage
,libgcc
))
273 $(eval
$(call BuildPackage
,libssp
))
274 $(eval
$(call BuildPackage
,libstdcpp
))
275 $(eval
$(call BuildPackage
,libpthread
))
276 $(eval
$(call BuildPackage
,librt
))
277 $(eval
$(call BuildPackage
,ldd
))
278 $(eval
$(call BuildPackage
,ldconfig
))