2 # Copyright (C) 2007 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
9 include $(TOPDIR
)/rules.mk
10 include $(INCLUDE_DIR
)/kernel.mk
15 PKG_FILE_DEPEND
:=$(PLATFORM_DIR
)/ $(GENERIC_PLATFORM_DIR
)/base-files
/
17 include $(INCLUDE_DIR
)/package.mk
21 ifneq ($(wildcard $(PLATFORM_DIR
)/base-files-
$(PROFILE
) $(PLATFORM_SUBDIR
)/base-files-
$(PROFILE
)),)
22 TARGET
:=$(TARGET
)-$(PROFILE
)
24 LIBGCC_VERSION
:=$(GCC_VERSION
)
29 LIBC_VERSION
:=<LIBC_VERSION
>
30 LIBGCC_VERSION
:=<LIBGCC_VERSION
>
33 CONFIG_PACKAGE_base-files
$(TARGET
):=$(CONFIG_PACKAGE_base-files
)
35 define Package
/base-files
$(TARGET
)
38 TITLE
:=Base filesystem for OpenWrt
39 URL
:=http
://openwrt.org
/
40 VERSION
:=$(PKG_RELEASE
)-$(REVISION
)
41 $(call Config
,network.lan.proto
,string
,static
,LAN Protocol
)
42 $(call Config
,network.lan.ipaddr
,ip
,192.168.1.1,LAN IP Address
)
43 $(call Config
,network.lan.netmask
,netmask
,255.255.255.0,LAN Network Mask
)
44 $(call Config
,network.lan.gateway
,ip
,,LAN Gateway
)
45 $(call Config
,network.lan.dns
,ip
,,LAN DNS server
)
48 define Package
/base-files
$(TARGET
)/conffiles
57 $(call
$(TARGET
)/conffiles
)
60 define Package
/base-files
$(TARGET
)/description
61 This package contains a base filesystem and system scripts for OpenWrt.
64 define Package
/gcc
/Default
67 DEPENDS
:=@
!NATIVE_TOOLCHAIN
68 URL
:=http
://gcc.gnu.org
/
69 VERSION
:=$(LIBGCC_VERSION
)-$(PKG_RELEASE
)
73 $(call Package
/gcc
/Default
)
74 TITLE
:=GCC support library
75 DEPENDS
+=@
!TARGET_avr32
79 $(call Package
/gcc
/Default
)
81 TITLE
:=GCC support library
84 define Package
/libstdcpp
85 $(call Package
/gcc
/Default
)
87 TITLE
:=GNU Standard C
++ Library v3
88 DEPENDS
+=@INSTALL_LIBSTDCPP
91 define Package
/libc
/Default
94 DEPENDS
:=@
!NATIVE_TOOLCHAIN
95 VERSION
:=$(LIBC_VERSION
)-$(PKG_RELEASE
)
100 $(call Package
/libc
/Default
)
104 define Package
/libpthread
105 $(call Package
/libc
/Default
)
106 TITLE
:=POSIX thread library
111 $(call Package
/libc
/Default
)
112 TITLE
:=POSIX
.1b RealTime extension library
116 $(call Package
/uclibc
/Default
)
117 TITLE
:=LDD trace utility
120 define Package
/ldconfig
121 $(call Package
/libc
/Default
)
122 TITLE
:=Shared library path configuration
127 mkdir
-p
$(PKG_BUILD_DIR
)
130 define Build
/Compile
/Default
134 $(call Build
/Compile
/Default
)
137 define Package
/base-files
$(TARGET
)/install
138 $(CP
) .
/files
/* $(1)/
139 if
[ -d
$(GENERIC_PLATFORM_DIR
)/base-files
/.
]; then \
140 $(CP
) $(GENERIC_PLATFORM_DIR
)/base-files
/* $(1)/; \
142 if
[ -d
$(PLATFORM_DIR
)/base-files
/.
]; then \
143 $(CP
) $(PLATFORM_DIR
)/base-files
/* $(1)/; \
145 if
[ -d
$(PLATFORM_DIR
)/base-files-
$(PROFILE
)/.
]; then \
146 $(CP
) $(PLATFORM_DIR
)/base-files-
$(PROFILE
)/* $(1)/; \
148 $(if
$(filter-out $(PLATFORM_DIR
),$(PLATFORM_SUBDIR
)), \
149 if
[ -d
$(PLATFORM_SUBDIR
)/base-files
/.
]; then \
150 $(CP
) $(PLATFORM_SUBDIR
)/base-files
/* $(1)/; \
152 if
[ -d
$(PLATFORM_SUBDIR
)/base-files-
$(PROFILE
)/.
]; then \
153 $(CP
) $(PLATFORM_SUBDIR
)/base-files-
$(PROFILE
)/* $(1)/; \
156 # Form valid /etc/shadow entries, by copying the user:pw pairs
157 # from /etc/passwd, and adding on pw change data
158 $(if
$(CONFIG_BUSYBOX_CONFIG_FEATURE_SHADOWPASSWDS
), \
159 cut
-d
':' -f
1-2 $(1)/etc
/passwd
> $(1)/etc
/shadow
; \
160 $(SED
) 's/$$$$/:13848:0:99999:7:::/' $(1)/etc
/shadow \
162 $(SED
) 's,$$$$R,$(REVISION),g' $(1)/etc
/banner
164 mkdir
-p
$(1)/etc
/crontabs
166 mkdir
-p
$(1)/lib
/firmware
170 mkdir
-p
$(1)/usr
/lib
171 mkdir
-p
$(1)/usr
/bin
175 ln
-sf
/proc
/mounts
$(1)/etc
/mtab
179 ln
-sf
/tmp
/resolv.conf
/tmp
/fstab
/tmp
/TZ
$(1)/etc
/
180 $(call Package
/base-files
/install-target
,$(1))
181 for conffile in
$(1)/etc
/config
/*; do \
182 if
[ -f
"$$$$conffile" ]; then \
183 grep
"$$$$conffile" $(1)/CONTROL
/conffiles || \
184 echo
"$$$${conffile##$(1)}" >> $(1)/CONTROL
/conffiles
; \
189 define Package
/libgcc
/install
190 $(INSTALL_DIR
) $(1)/lib
191 $(CP
) $(TOOLCHAIN_DIR
)/lib
$(LIB_SUFFIX
)/libgcc_s.so.
* $(1)/lib
/
194 define Package
/libssp
/install
195 $(INSTALL_DIR
) $(1)/lib
196 $(CP
) $(TOOLCHAIN_DIR
)/lib
$(LIB_SUFFIX
)/libssp.so.
* $(1)/lib
/
199 define Package
/libstdcpp
/install
200 $(INSTALL_DIR
) $(1)/usr
/lib
201 $(CP
) $(TOOLCHAIN_DIR
)/usr
/lib
$(LIB_SUFFIX
)/libstdc
++.so.
* $(1)/usr
/lib
/
204 define Package
/glibc
/install
205 $(INSTALL_DIR
) $(1)/lib
206 $(CP
) $(TOOLCHAIN_DIR
)/lib
/ld*.so.
* $(1)/lib
/
207 $(CP
) $(TOOLCHAIN_DIR
)/lib
/ld-
$(LIBC_VERSION
).so
$(1)/lib
/
208 for file in libanl libc libcidn libcrypt libdl libm libnsl libnss_dns libnss_files libresolv libutil
; do \
209 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file.so.
* $(1)/lib
/; \
210 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file-$(LIBC_VERSION
).so
$(1)/lib
/; \
214 define Package
/eglibc
/install
215 $(call Package
/glibc
/install,$1)
218 define Package
/uClibc
/install
219 $(INSTALL_DIR
) $(1)/lib
220 for file in
ld$(LIB_SUFFIX
)-uClibc libc libcrypt libdl libm libnsl libresolv libuClibc 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
/libc
/install
227 $(call Package
/$(LIBC
)/install,$1)
230 define Package
/libpthread
/install
231 $(INSTALL_DIR
) $(1)/lib
232 $(CP
) $(TOOLCHAIN_DIR
)/lib
/libpthread.so.
* $(1)/lib
/
233 $(CP
) $(TOOLCHAIN_DIR
)/lib
/libpthread-
$(LIBC_VERSION
).so
$(1)/lib
/
236 define Package
/librt
/install
237 $(INSTALL_DIR
) $(1)/lib
238 $(CP
) $(TOOLCHAIN_DIR
)/lib
/librt.so.
* $(1)/lib
/
239 $(CP
) $(TOOLCHAIN_DIR
)/lib
/librt-
$(LIBC_VERSION
).so
$(1)/lib
/
242 define Package
/ldd
/install
243 $(INSTALL_DIR
) $(1)/usr
/bin
/
244 $(CP
) $(TOOLCHAIN_DIR
)/usr
/bin
/ldd
$(1)/usr
/bin
/
247 define Package
/ldconfig
/install
248 $(INSTALL_DIR
) $(1)/sbin
/
249 $(CP
) $(TOOLCHAIN_DIR
)/sbin
/ldconfig
$(1)/sbin
/
253 -include $(PLATFORM_DIR
)/base-files.mk
256 $(eval
$(call BuildPackage
,base-files
$(TARGET
)))
257 $(eval
$(call BuildPackage
,libc
))
258 $(eval
$(call BuildPackage
,libgcc
))
259 $(eval
$(call BuildPackage
,libssp
))
260 $(eval
$(call BuildPackage
,libstdcpp
))
261 $(eval
$(call BuildPackage
,libpthread
))
262 $(eval
$(call BuildPackage
,librt
))
263 $(eval
$(call BuildPackage
,ldd
))
264 $(eval
$(call BuildPackage
,ldconfig
))