2 # Copyright (C) 2006 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 REV
:=$(shell LANG
=C svn
info | awk
'/^Revision:/ { print$$2 }' )
21 include $(INCLUDE_DIR
)/package.mk
24 TARGET
:=-$(BOARD
)-$(KERNEL
)
25 LIBGCC_VERSION
:=$(GCC_VERSION
)
27 UCLIBC_VERSION
:=<UCLIBC_VERSION
>
28 LIBGCC_VERSION
:=<LIBGCC_VERSION
>
31 CONFIG_PACKAGE_base-files
$(TARGET
):=$(CONFIG_PACKAGE_base-files
)
33 define Package
/base-files
$(TARGET
)
36 TITLE
:=Base filesystem for OpenWrt
37 URL
:=http
://openwrt.org
/
38 VERSION
:=$(PKG_RELEASE
)-$(REV
)
39 $(call Config
,network.lan.proto
,string
,static
,LAN Protocol
)
40 $(call Config
,network.lan.ipaddr
,ip
,192.168.1.1,LAN IP Address
)
41 $(call Config
,network.lan.netmask
,netmask
,255.255.255.0,LAN Network Mask
)
42 $(call Config
,network.lan.gateway
,ip
,,LAN Gateway
)
43 $(call Config
,network.lan.dns
,ip
,,LAN DNS server
)
46 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 @
!NATIVE_TOOLCHAIN
78 $(call Package
/gcc
/Default
)
79 TITLE
:=GCC support library
82 define Package
/libstdcpp
83 $(call Package
/gcc
/Default
)
85 TITLE
:=GNU Standard C
++ Library v3
86 DEPENDS
:=@
!NATIVE_TOOLCHAIN
&&@INSTALL_LIBSTDCPP
89 define Package
/uclibc
/Default
92 DEPENDS
:=@
!NATIVE_TOOLCHAIN
93 URL
:=http
://uclibc.org
/
94 VERSION
:=$(UCLIBC_VERSION
)$(UCLIBC_PATCHVER
)-$(PKG_RELEASE
)
97 define Package
/libpthread
98 $(call Package
/uclibc
/Default
)
99 TITLE
:=POSIX thread library
102 define Package
/uclibc
103 $(call Package
/uclibc
/Default
)
104 TITLE
:=C library embedded systems
108 mkdir
-p
$(PKG_BUILD_DIR
)
111 define Build
/Compile
/Default
115 $(call Build
/Compile
/Default
)
118 define Package
/base-files
$(TARGET
)/install
119 $(CP
) .
/files
/* $(1)/
120 if
[ -d
$(GENERIC_PLATFORM_DIR
)/base-files
/.
]; then \
121 $(CP
) $(GENERIC_PLATFORM_DIR
)/base-files
/* $(1)/; \
123 if
[ -d
$(PLATFORM_DIR
)/base-files
/default
/.
]; then \
124 $(CP
) $(PLATFORM_DIR
)/base-files
/default
/* $(1)/; \
126 $(if
$(filter-out $(PLATFORM_DIR
),$(PLATFORM_SUBDIR
)), \
127 if
[ -d
$(PLATFORM_SUBDIR
)/base-files
/default
/.
]; then \
128 $(CP
) $(PLATFORM_SUBDIR
)/base-files
/default
/* $(1)/; \
131 if
[ "$(PROFILE)" != "Default" ]; then \
132 if
[ -d
$(PLATFORM_DIR
)/base-files
/profile-
$(PROFILE
)/.
]; then \
133 $(CP
) $(PLATFORM_DIR
)/base-files
/profile-
$(PROFILE
)/* $(1)/; \
136 $(SED
) 's,$$$$R,r$(REV),g' $(1)/etc
/banner
137 $(SED
) 's,$$$$S,$(BOARD)-$(KERNEL),g' -e
's,$$$$A,$(ARCH),g' $(1)/etc
/ipkg.conf
139 mkdir
-p
$(1)/etc
/crontabs
141 mkdir
-p
$(1)/lib
/firmware
145 mkdir
-p
$(1)/usr
/lib
146 mkdir
-p
$(1)/usr
/bin
149 ln
-sf
/proc
/mounts
$(1)/etc
/mtab
153 ln
-sf
/tmp
/resolv.conf
$(1)/etc
/resolv.conf
154 $(call Package
/base-files
/install-target
,$(1))
155 for conffile in
$(1)/etc
/config
/*; do \
156 if
[ -f
"$$$$conffile" ]; then \
157 grep
"$$$$conffile" $(1)/CONTROL
/conffiles || \
158 echo
"$$$${conffile##$(1)}" >> $(1)/CONTROL
/conffiles
; \
163 define Package
/libgcc
/install
164 $(INSTALL_DIR
) $(1)/lib
165 $(CP
) $(TOOLCHAIN_DIR
)/lib
/libgcc_s.so.
* $(1)/lib
/
168 ifeq ($(word 1,$(subst .
, ,$(LIBGCC_VERSION
))),4)
169 define Package
/libssp
/install
170 $(INSTALL_DIR
) $(1)/lib
171 $(CP
) $(TOOLCHAIN_DIR
)/lib
/libssp.so.
* $(1)/lib
/
175 define Package
/libstdcpp
/install
176 $(INSTALL_DIR
) $(1)/lib
177 $(CP
) $(TOOLCHAIN_DIR
)/lib
/libstdc
++.so.
* $(1)/lib
/
180 define Package
/libpthread
/install
181 $(INSTALL_DIR
) $(1)/lib
182 $(CP
) $(TOOLCHAIN_DIR
)/lib
/libpthread.so.
* $(1)/lib
/
183 $(CP
) $(TOOLCHAIN_DIR
)/lib
/libpthread-
$(UCLIBC_VERSION
).so
$(1)/lib
/
186 define Package
/uclibc
/install
187 $(INSTALL_DIR
) $(1)/lib
188 for file in ld-uClibc libc libcrypt libdl libm libnsl libresolv librt libuClibc libutil
; do \
189 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file.so.
* $(1)/lib
/; \
190 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file-$(UCLIBC_VERSION
).so
$(1)/lib
/; \
194 define Package
/ldd
/install
195 $(INSTALL_DIR
) $(1)/bin
/
196 $(CP
) $(TOOLCHAIN_DIR
)/utils
/ldd
$(1)/bin
/
199 define Package
/ldconfig
/install
200 $(INSTALL_DIR
) $(1)/bin
/
201 $(CP
) $(TOOLCHAIN_DIR
)/utils
/ldconfig
$(1)/bin
/
205 -include $(PLATFORM_DIR
)/base-files.mk
208 $(eval
$(call BuildPackage
,base-files
$(TARGET
)))
209 $(eval
$(call BuildPackage
,libgcc
))
210 $(eval
$(call BuildPackage
,libssp
))
211 $(eval
$(call BuildPackage
,libstdcpp
))
212 $(eval
$(call BuildPackage
,libpthread
))
213 $(eval
$(call BuildPackage
,uclibc
))