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
$(filter-out $(PLATFORM_DIR
),$(PLATFORM_SUBDIR
)), \
152 if
[ -d
$(PLATFORM_SUBDIR
)/base-files
/.
]; then \
153 $(CP
) $(PLATFORM_SUBDIR
)/base-files
/* $(1)/; \
155 if
[ -d
$(PLATFORM_SUBDIR
)/base-files-
$(PROFILE
)/.
]; then \
156 $(CP
) $(PLATFORM_SUBDIR
)/base-files-
$(PROFILE
)/* $(1)/; \
159 # Form valid /etc/shadow entries, by copying the user:pw pairs
160 # from /etc/passwd, and adding on pw change data
161 $(if
$(CONFIG_BUSYBOX_CONFIG_FEATURE_SHADOWPASSWDS
), \
162 cut
-d
':' -f
1-2 $(1)/etc
/passwd
> $(1)/etc
/shadow
; \
163 $(SED
) 's/$$$$/:13848:0:99999:7:::/' $(1)/etc
/shadow \
165 $(SED
) 's,$$$$R,$(REVISION),g' $(1)/etc
/banner
166 mkdir
-p
$(1)/CONTROL
168 mkdir
-p
$(1)/etc
/crontabs
170 mkdir
-p
$(1)/lib
/firmware
174 mkdir
-p
$(1)/usr
/lib
175 mkdir
-p
$(1)/usr
/bin
179 ln
-sf
/proc
/mounts
$(1)/etc
/mtab
183 ln
-sf
/tmp
/resolv.conf
/tmp
/fstab
/tmp
/TZ
$(1)/etc
/
184 $(call Package
/base-files
/install-target
,$(1))
185 for conffile in
$(1)/etc
/config
/*; do \
186 if
[ -f
"$$$$conffile" ]; then \
187 grep
"$$$$conffile" $(1)/CONTROL
/conffiles || \
188 echo
"$$$${conffile##$(1)}" >> $(1)/CONTROL
/conffiles
; \
193 define Package
/libgcc
/install
194 $(INSTALL_DIR
) $(1)/lib
195 $(CP
) $(TOOLCHAIN_DIR
)/lib
$(LIB_SUFFIX
)/libgcc_s.so.
* $(1)/lib
/
198 define Package
/libssp
/install
199 $(INSTALL_DIR
) $(1)/lib
200 $(CP
) $(TOOLCHAIN_DIR
)/lib
$(LIB_SUFFIX
)/libssp.so.
* $(1)/lib
/
203 define Package
/libstdcpp
/install
204 $(INSTALL_DIR
) $(1)/usr
/lib
205 $(CP
) $(TOOLCHAIN_DIR
)/usr
/lib
$(LIB_SUFFIX
)/libstdc
++.so.
* $(1)/usr
/lib
/
208 use_libutil
=$(if
$(CONFIG_USE_GLIBC
)$(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP
),libutil
)
209 use_libnsl
=$(if
$(CONFIG_USE_GLIBC
)$(CONFIG_EGLIBC_OPTION_EGLIBC_NIS
),libnsl
)
210 use_nsswitch
=$(if
$(CONFIG_USE_GLIBC
)$(CONFIG_EGLIBC_OPTION_EGLIBC_NSSWITCH
),libnss_dns libnss_files
)
212 define Package
/glibc
/install
213 $(INSTALL_DIR
) $(1)/lib
214 $(CP
) $(TOOLCHAIN_DIR
)/lib
/ld*.so.
* $(1)/lib
/
215 $(CP
) $(TOOLCHAIN_DIR
)/lib
/ld-
$(LIBC_SO_VERSION
).so
$(1)/lib
/
216 for file in libanl libc libcidn libcrypt libdl libm
$(use_libnsl
) $(use_nsswitch
) libresolv
$(use_libutil
); do \
217 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file.so.
* $(1)/lib
/; \
218 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file-$(LIBC_SO_VERSION
).so
$(1)/lib
/; \
222 define Package
/eglibc
/install
223 $(call Package
/glibc
/install,$1)
226 define Package
/uClibc
/install
227 $(INSTALL_DIR
) $(1)/lib
228 for file in
ld$(LIB_SUFFIX
)-uClibc libc libcrypt libdl libm libnsl libresolv libuClibc libutil
; do \
229 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file.so.
* $(1)/lib
/; \
230 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file-$(LIBC_SO_VERSION
).so
$(1)/lib
/; \
234 define Package
/libc
/install
235 $(call Package
/$(LIBC
)/install,$1)
238 define Package
/libpthread
/install
239 $(INSTALL_DIR
) $(1)/lib
240 $(CP
) $(TOOLCHAIN_DIR
)/lib
/libpthread.so.
* $(1)/lib
/
241 $(CP
) $(TOOLCHAIN_DIR
)/lib
/libpthread-
$(LIBC_SO_VERSION
).so
$(1)/lib
/
244 define Package
/librt
/install
245 $(INSTALL_DIR
) $(1)/lib
246 $(CP
) $(TOOLCHAIN_DIR
)/lib
/librt.so.
* $(1)/lib
/
247 $(CP
) $(TOOLCHAIN_DIR
)/lib
/librt-
$(LIBC_SO_VERSION
).so
$(1)/lib
/
250 define Package
/ldd
/install
251 $(INSTALL_DIR
) $(1)/usr
/bin
/
252 $(CP
) $(TOOLCHAIN_DIR
)/usr
/bin
/ldd
$(1)/usr
/bin
/
255 define Package
/ldconfig
/install
256 $(INSTALL_DIR
) $(1)/sbin
/
257 $(CP
) $(TOOLCHAIN_DIR
)/sbin
/ldconfig
$(1)/sbin
/
261 -include $(PLATFORM_DIR
)/base-files.mk
264 $(eval
$(call BuildPackage
,base-files
$(TARGET
)))
265 $(eval
$(call BuildPackage
,libc
))
266 $(eval
$(call BuildPackage
,libgcc
))
267 $(eval
$(call BuildPackage
,libssp
))
268 $(eval
$(call BuildPackage
,libstdcpp
))
269 $(eval
$(call BuildPackage
,libpthread
))
270 $(eval
$(call BuildPackage
,librt
))
271 $(eval
$(call BuildPackage
,ldd
))
272 $(eval
$(call BuildPackage
,ldconfig
))