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_DEPEND
:=$(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 ifneq ($(LIBC_VERSION
),0.9.28)
33 LIBC_VERSION
:=$(LIBC_VERSION
)$(LIBC_PATCHVER
)
36 CONFIG_PACKAGE_base-files
$(TARGET
):=$(CONFIG_PACKAGE_base-files
)
38 define Package
/base-files
$(TARGET
)
41 TITLE
:=Base filesystem for OpenWrt
42 URL
:=http
://openwrt.org
/
43 VERSION
:=$(PKG_RELEASE
)-$(REVISION
)
44 $(call Config
,network.lan.proto
,string
,static
,LAN Protocol
)
45 $(call Config
,network.lan.ipaddr
,ip
,192.168.1.1,LAN IP Address
)
46 $(call Config
,network.lan.netmask
,netmask
,255.255.255.0,LAN Network Mask
)
47 $(call Config
,network.lan.gateway
,ip
,,LAN Gateway
)
48 $(call Config
,network.lan.dns
,ip
,,LAN DNS server
)
51 define Package
/base-files
$(TARGET
)/conffiles
60 $(call
$(TARGET
)/conffiles
)
63 define Package
/base-files
$(TARGET
)/description
64 This package contains a base filesystem and system scripts for OpenWrt.
67 define Package
/gcc
/Default
70 DEPENDS
:=@
!NATIVE_TOOLCHAIN
71 URL
:=http
://gcc.gnu.org
/
72 VERSION
:=$(LIBGCC_VERSION
)-$(PKG_RELEASE
)
76 $(call Package
/gcc
/Default
)
77 TITLE
:=GCC support library
78 DEPENDS
+=@
!TARGET_avr32
82 $(call Package
/gcc
/Default
)
84 TITLE
:=GCC support library
87 define Package
/libstdcpp
88 $(call Package
/gcc
/Default
)
90 TITLE
:=GNU Standard C
++ Library v3
91 DEPENDS
+=@INSTALL_LIBSTDCPP
94 define Package
/libc
/Default
97 DEPENDS
:=@
!NATIVE_TOOLCHAIN
98 VERSION
:=$(LIBC_VERSION
)-$(PKG_RELEASE
)
103 $(call Package
/libc
/Default
)
107 define Package
/libpthread
108 $(call Package
/libc
/Default
)
109 TITLE
:=POSIX thread library
114 $(call Package
/libc
/Default
)
115 TITLE
:=POSIX
.1b RealTime extension library
119 $(call Package
/libc
/Default
)
122 TITLE
:=LDD trace utility
125 define Package
/ldconfig
126 $(call Package
/libc
/Default
)
129 TITLE
:=Shared library path configuration
134 mkdir
-p
$(PKG_BUILD_DIR
)
137 define Build
/Compile
/Default
141 $(call Build
/Compile
/Default
)
144 define Package
/base-files
$(TARGET
)/install
145 $(CP
) .
/files
/* $(1)/
146 if
[ -d
$(GENERIC_PLATFORM_DIR
)/base-files
/.
]; then \
147 $(CP
) $(GENERIC_PLATFORM_DIR
)/base-files
/* $(1)/; \
149 if
[ -d
$(PLATFORM_DIR
)/base-files
/.
]; then \
150 $(CP
) $(PLATFORM_DIR
)/base-files
/* $(1)/; \
152 if
[ -d
$(PLATFORM_DIR
)/base-files-
$(PROFILE
)/.
]; then \
153 $(CP
) $(PLATFORM_DIR
)/base-files-
$(PROFILE
)/* $(1)/; \
155 $(if
$(filter-out $(PLATFORM_DIR
),$(PLATFORM_SUBDIR
)), \
156 if
[ -d
$(PLATFORM_SUBDIR
)/base-files
/.
]; then \
157 $(CP
) $(PLATFORM_SUBDIR
)/base-files
/* $(1)/; \
159 if
[ -d
$(PLATFORM_SUBDIR
)/base-files-
$(PROFILE
)/.
]; then \
160 $(CP
) $(PLATFORM_SUBDIR
)/base-files-
$(PROFILE
)/* $(1)/; \
163 # Form valid /etc/shadow entries, by copying the user:pw pairs
164 # from /etc/passwd, and adding on pw change data
165 $(if
$(CONFIG_BUSYBOX_CONFIG_FEATURE_SHADOWPASSWDS
), \
166 cut
-d
':' -f
1-2 $(1)/etc
/passwd
> $(1)/etc
/shadow
; \
167 $(SED
) 's/$$$$/:13848:0:99999:7:::/' $(1)/etc
/shadow \
169 $(SED
) 's,$$$$R,$(REVISION),g' $(1)/etc
/banner
170 mkdir
-p
$(1)/CONTROL
172 mkdir
-p
$(1)/etc
/crontabs
174 mkdir
-p
$(1)/lib
/firmware
178 mkdir
-p
$(1)/usr
/lib
179 mkdir
-p
$(1)/usr
/bin
183 ln
-sf
/proc
/mounts
$(1)/etc
/mtab
187 ln
-sf
/tmp
/resolv.conf
/tmp
/fstab
/tmp
/TZ
$(1)/etc
/
188 $(call Package
/base-files
/install-target
,$(1))
189 for conffile in
$(1)/etc
/config
/*; do \
190 if
[ -f
"$$$$conffile" ]; then \
191 grep
"$$$$conffile" $(1)/CONTROL
/conffiles || \
192 echo
"$$$${conffile##$(1)}" >> $(1)/CONTROL
/conffiles
; \
197 define Package
/libgcc
/install
198 $(INSTALL_DIR
) $(1)/lib
199 $(CP
) $(TOOLCHAIN_DIR
)/lib
$(LIB_SUFFIX
)/libgcc_s.so.
* $(1)/lib
/
202 define Package
/libssp
/install
203 $(INSTALL_DIR
) $(1)/lib
204 $(CP
) $(TOOLCHAIN_DIR
)/lib
$(LIB_SUFFIX
)/libssp.so.
* $(1)/lib
/
207 define Package
/libstdcpp
/install
208 $(INSTALL_DIR
) $(1)/usr
/lib
209 $(CP
) $(TOOLCHAIN_DIR
)/usr
/lib
$(LIB_SUFFIX
)/libstdc
++.so.
* $(1)/usr
/lib
/
212 use_libutil
=$(if
$(CONFIG_USE_GLIBC
)$(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP
),libutil
)
213 use_libnsl
=$(if
$(CONFIG_USE_GLIBC
)$(CONFIG_EGLIBC_OPTION_EGLIBC_NIS
),libnsl
)
214 use_nsswitch
=$(if
$(CONFIG_USE_GLIBC
)$(CONFIG_EGLIBC_OPTION_EGLIBC_NSSWITCH
),libnss_dns libnss_files
)
216 define Package
/glibc
/install
217 $(INSTALL_DIR
) $(1)/lib
218 $(CP
) $(TOOLCHAIN_DIR
)/lib
/ld*.so.
* $(1)/lib
/
219 $(CP
) $(TOOLCHAIN_DIR
)/lib
/ld-
$(LIBC_VERSION
).so
$(1)/lib
/
220 for file in libanl libc libcidn libcrypt libdl libm
$(use_libnsl
) $(use_nsswitch
) libresolv
$(use_libutil
); do \
221 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file.so.
* $(1)/lib
/; \
222 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file-$(LIBC_VERSION
).so
$(1)/lib
/; \
226 define Package
/eglibc
/install
227 $(call Package
/glibc
/install,$1)
230 define Package
/uClibc
/install
231 $(INSTALL_DIR
) $(1)/lib
232 for file in
ld$(LIB_SUFFIX
)-uClibc libc libcrypt libdl libm libnsl libresolv libuClibc libutil
; do \
233 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file.so.
* $(1)/lib
/; \
234 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file-$(LIBC_VERSION
).so
$(1)/lib
/; \
238 define Package
/libc
/install
239 $(call Package
/$(LIBC
)/install,$1)
242 define Package
/libpthread
/install
243 $(INSTALL_DIR
) $(1)/lib
244 $(CP
) $(TOOLCHAIN_DIR
)/lib
/libpthread.so.
* $(1)/lib
/
245 $(CP
) $(TOOLCHAIN_DIR
)/lib
/libpthread-
$(LIBC_VERSION
).so
$(1)/lib
/
248 define Package
/librt
/install
249 $(INSTALL_DIR
) $(1)/lib
250 $(CP
) $(TOOLCHAIN_DIR
)/lib
/librt.so.
* $(1)/lib
/
251 $(CP
) $(TOOLCHAIN_DIR
)/lib
/librt-
$(LIBC_VERSION
).so
$(1)/lib
/
254 define Package
/ldd
/install
255 $(INSTALL_DIR
) $(1)/usr
/bin
/
256 $(CP
) $(TOOLCHAIN_DIR
)/usr
/bin
/ldd
$(1)/usr
/bin
/
259 define Package
/ldconfig
/install
260 $(INSTALL_DIR
) $(1)/sbin
/
261 $(CP
) $(TOOLCHAIN_DIR
)/sbin
/ldconfig
$(1)/sbin
/
265 -include $(PLATFORM_DIR
)/base-files.mk
268 $(eval
$(call BuildPackage
,base-files
$(TARGET
)))
269 $(eval
$(call BuildPackage
,libc
))
270 $(eval
$(call BuildPackage
,libgcc
))
271 $(eval
$(call BuildPackage
,libssp
))
272 $(eval
$(call BuildPackage
,libstdcpp
))
273 $(eval
$(call BuildPackage
,libpthread
))
274 $(eval
$(call BuildPackage
,librt
))
275 $(eval
$(call BuildPackage
,ldd
))
276 $(eval
$(call BuildPackage
,ldconfig
))