[package] sysupgrade: use sysrq-trigger if available
[openwrt/svn-archive/archive.git] / package / base-files / Makefile
1 #
2 # Copyright (C) 2007-2009 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/kernel.mk
10
11 PKG_NAME:=base-files
12 PKG_RELEASE:=20
13
14 PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
15
16 include $(INCLUDE_DIR)/package.mk
17
18 ifneq ($(DUMP),1)
19 TARGET:=-$(BOARD)
20 ifneq ($(wildcard $(PLATFORM_DIR)/base-files-$(PROFILE) $(PLATFORM_SUBDIR)/base-files-$(PROFILE)),)
21 TARGET:=$(TARGET)-$(PROFILE)
22 endif
23 LIBGCC_VERSION:=$(GCC_VERSION)
24 ifeq ($(ARCH),x86_64)
25 LIB_SUFFIX:=64
26 endif
27 ifeq ($(ARCH),mips64)
28 LIB_SUFFIX:=64
29 endif
30 else
31 LIBC_VERSION:=<LIBC_VERSION>
32 LIBGCC_VERSION:=<LIBGCC_VERSION>
33 endif
34
35 CONFIG_PACKAGE_base-files$(TARGET):=$(CONFIG_PACKAGE_base-files)
36
37 define Package/base-files$(TARGET)
38 SECTION:=base
39 CATEGORY:=Base system
40 TITLE:=Base filesystem for OpenWrt
41 URL:=http://openwrt.org/
42 VERSION:=$(PKG_RELEASE)-$(REVISION)
43 $(call Config,network.lan.proto,string,static,LAN Protocol)
44 $(call Config,network.lan.ipaddr,ip,192.168.1.1,LAN IP Address)
45 $(call Config,network.lan.netmask,netmask,255.255.255.0,LAN Network Mask)
46 $(call Config,network.lan.gateway,ip,,LAN Gateway)
47 $(call Config,network.lan.dns,ip,,LAN DNS server)
48 endef
49
50 define Package/base-files$(TARGET)/conffiles
51 /etc/banner
52 /etc/hosts
53 /etc/inittab
54 /etc/group
55 /etc/passwd
56 /etc/profile
57 /etc/shells
58 /etc/sysctl.conf
59 $(call $(TARGET)/conffiles)
60 endef
61
62 define Package/base-files$(TARGET)/description
63 This package contains a base filesystem and system scripts for OpenWrt.
64 endef
65
66 define Package/gcc/Default
67 SECTION:=libs
68 CATEGORY:=Base system
69 DEPENDS:=@!NATIVE_TOOLCHAIN
70 URL:=http://gcc.gnu.org/
71 VERSION:=$(LIBGCC_VERSION)-$(PKG_RELEASE)
72 endef
73
74 define Package/libgcc
75 $(call Package/gcc/Default)
76 TITLE:=GCC support library
77 DEPENDS+=@!TARGET_avr32
78 endef
79
80 define Package/libssp
81 $(call Package/gcc/Default)
82 DEPENDS+=@SSP_SUPPORT
83 TITLE:=GCC support library
84 endef
85
86 define Package/libstdcpp
87 $(call Package/gcc/Default)
88 NAME:=libstdc++
89 TITLE:=GNU Standard C++ Library v3
90 DEPENDS+=@INSTALL_LIBSTDCPP
91 endef
92
93 define Package/libc/Default
94 SECTION:=libs
95 CATEGORY:=Base system
96 DEPENDS:=@!NATIVE_TOOLCHAIN
97 VERSION:=$(LIBC_VERSION)-$(PKG_RELEASE)
98 URL:=$(LIBC_URL)
99 endef
100
101 define Package/libc
102 $(call Package/libc/Default)
103 TITLE:=C library
104 endef
105
106 define Package/libpthread
107 $(call Package/libc/Default)
108 TITLE:=POSIX thread library
109 DEPENDS:= +librt
110 endef
111
112 define Package/librt
113 $(call Package/libc/Default)
114 TITLE:=POSIX.1b RealTime extension library
115 endef
116
117 define Package/ldd
118 $(call Package/libc/Default)
119 SECTION:=utils
120 CATEGORY:=Utilities
121 TITLE:=LDD trace utility
122 endef
123
124 define Package/ldconfig
125 $(call Package/libc/Default)
126 SECTION:=utils
127 CATEGORY:=Utilities
128 TITLE:=Shared library path configuration
129 endef
130
131
132 define Build/Prepare
133 mkdir -p $(PKG_BUILD_DIR)
134 endef
135
136 define Build/Compile/Default
137 endef
138
139 define Build/Compile
140 $(call Build/Compile/Default)
141 endef
142
143 define Package/base-files$(TARGET)/install
144 $(CP) ./files/* $(1)/
145 if [ -d $(GENERIC_PLATFORM_DIR)/base-files/. ]; then \
146 $(CP) $(GENERIC_PLATFORM_DIR)/base-files/* $(1)/; \
147 fi
148 if [ -d $(PLATFORM_DIR)/base-files/. ]; then \
149 $(CP) $(PLATFORM_DIR)/base-files/* $(1)/; \
150 fi
151 if [ -d $(PLATFORM_DIR)/base-files-$(PROFILE)/. ]; then \
152 $(CP) $(PLATFORM_DIR)/base-files-$(PROFILE)/* $(1)/; \
153 fi
154 if [ -d $(PLATFORM_DIR)/$(PROFILE)/base-files/. ]; then \
155 $(CP) $(PLATFORM_DIR)/$(PROFILE)/base-files/* $(1)/; \
156 fi
157 $(if $(filter-out $(PLATFORM_DIR),$(PLATFORM_SUBDIR)), \
158 if [ -d $(PLATFORM_SUBDIR)/base-files/. ]; then \
159 $(CP) $(PLATFORM_SUBDIR)/base-files/* $(1)/; \
160 fi; \
161 if [ -d $(PLATFORM_SUBDIR)/base-files-$(PROFILE)/. ]; then \
162 $(CP) $(PLATFORM_SUBDIR)/base-files-$(PROFILE)/* $(1)/; \
163 fi; \
164 if [ -d $(PLATFORM_SUBDIR)/$(PROFILE)/base-files/. ]; then \
165 $(CP) $(PLATFORM_SUBDIR)/$(PROFILE)/base-files/* $(1)/; \
166 fi \
167 )
168 # Form valid /etc/shadow entries, by copying the user:pw pairs
169 # from /etc/passwd, and adding on pw change data
170 $(if $(CONFIG_BUSYBOX_CONFIG_FEATURE_SHADOWPASSWDS), \
171 cut -d ':' -f 1-2 $(1)/etc/passwd > $(1)/etc/shadow; \
172 $(SED) 's/$$$$/:13848:0:99999:7:::/' $(1)/etc/shadow \
173 )
174 $(SED) 's,$$$$R,$(REVISION),g' $(1)/etc/banner
175 mkdir -p $(1)/CONTROL
176 mkdir -p $(1)/dev
177 mkdir -p $(1)/etc/crontabs
178 mkdir -p $(1)/jffs
179 mkdir -p $(1)/lib/firmware
180 $(if $(LIB_SUFFIX),ln -s lib $(1)/lib$(LIB_SUFFIX))
181 mkdir -p $(1)/mnt
182 mkdir -p $(1)/proc
183 mkdir -p $(1)/tmp
184 mkdir -p $(1)/usr/lib
185 $(if $(LIB_SUFFIX),ln -s lib $(1)/usr/lib$(LIB_SUFFIX))
186 mkdir -p $(1)/usr/bin
187 mkdir -p $(1)/sys
188 mkdir -p $(1)/www
189 mkdir -p $(1)/root
190 ln -sf /proc/mounts $(1)/etc/mtab
191 rm -f $(1)/var
192 ln -sf /tmp $(1)/var
193 mkdir -p $(1)/etc
194 ln -sf /tmp/resolv.conf /tmp/fstab /tmp/TZ $(1)/etc/
195 $(call Package/base-files/install-target,$(1))
196 for conffile in $(1)/etc/config/*; do \
197 if [ -f "$$$$conffile" ]; then \
198 grep "$$$$conffile" $(1)/CONTROL/conffiles || \
199 echo "$$$${conffile##$(1)}" >> $(1)/CONTROL/conffiles; \
200 fi \
201 done
202 endef
203
204 define Package/libgcc/install
205 $(INSTALL_DIR) $(1)/lib
206 $(CP) $(TOOLCHAIN_DIR)/lib$(LIB_SUFFIX)/libgcc_s.so.* $(1)/lib/
207 endef
208
209 define Package/libssp/install
210 $(INSTALL_DIR) $(1)/lib
211 $(CP) $(TOOLCHAIN_DIR)/lib$(LIB_SUFFIX)/libssp.so.* $(1)/lib/
212 endef
213
214 define Package/libstdcpp/install
215 $(INSTALL_DIR) $(1)/usr/lib
216 $(CP) $(TOOLCHAIN_DIR)/usr/lib$(LIB_SUFFIX)/libstdc++.so.* $(1)/usr/lib/
217 endef
218
219 use_libutil=$(if $(CONFIG_USE_GLIBC)$(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP),libutil)
220 use_libnsl=$(if $(CONFIG_USE_GLIBC)$(CONFIG_EGLIBC_OPTION_EGLIBC_NIS),libnsl)
221 use_nsswitch=$(if $(CONFIG_USE_GLIBC)$(CONFIG_EGLIBC_OPTION_EGLIBC_NSSWITCH),libnss_dns libnss_files)
222
223 define Package/glibc/install
224 $(INSTALL_DIR) $(1)/lib
225 $(CP) $(TOOLCHAIN_DIR)/lib/ld*.so.* $(1)/lib/
226 $(CP) $(TOOLCHAIN_DIR)/lib/ld-$(LIBC_SO_VERSION).so $(1)/lib/
227 for file in libanl libc libcidn libcrypt libdl libm $(use_libnsl) $(use_nsswitch) libresolv $(use_libutil); do \
228 $(CP) $(TOOLCHAIN_DIR)/lib/$$$$file.so.* $(1)/lib/; \
229 $(CP) $(TOOLCHAIN_DIR)/lib/$$$$file-$(LIBC_SO_VERSION).so $(1)/lib/; \
230 done
231 endef
232
233 define Package/eglibc/install
234 $(call Package/glibc/install,$1)
235 endef
236
237 define Package/uClibc/install
238 $(INSTALL_DIR) $(1)/lib
239 for file in ld$(LIB_SUFFIX)-uClibc libc libcrypt libdl libm libnsl libresolv libuClibc libutil; do \
240 $(CP) $(TOOLCHAIN_DIR)/lib/$$$$file.so.* $(1)/lib/; \
241 $(CP) $(TOOLCHAIN_DIR)/lib/$$$$file-$(LIBC_SO_VERSION).so $(1)/lib/; \
242 done
243 endef
244
245 define Package/libc/install
246 $(call Package/$(LIBC)/install,$1)
247 endef
248
249 define Package/libpthread/install
250 $(INSTALL_DIR) $(1)/lib
251 $(CP) $(TOOLCHAIN_DIR)/lib/libpthread.so.* $(1)/lib/
252 $(CP) $(TOOLCHAIN_DIR)/lib/libpthread-$(LIBC_SO_VERSION).so $(1)/lib/
253 endef
254
255 define Package/librt/install
256 $(INSTALL_DIR) $(1)/lib
257 $(CP) $(TOOLCHAIN_DIR)/lib/librt.so.* $(1)/lib/
258 $(CP) $(TOOLCHAIN_DIR)/lib/librt-$(LIBC_SO_VERSION).so $(1)/lib/
259 endef
260
261 define Package/ldd/install
262 $(INSTALL_DIR) $(1)/usr/bin/
263 $(CP) $(TOOLCHAIN_DIR)/usr/bin/ldd $(1)/usr/bin/
264 endef
265
266 define Package/ldconfig/install
267 $(INSTALL_DIR) $(1)/sbin/
268 $(CP) $(TOOLCHAIN_DIR)/sbin/ldconfig $(1)/sbin/
269 endef
270
271 ifneq ($(DUMP),1)
272 -include $(PLATFORM_DIR)/base-files.mk
273 endif
274
275 $(eval $(call BuildPackage,base-files$(TARGET)))
276 $(eval $(call BuildPackage,libc))
277 $(eval $(call BuildPackage,libgcc))
278 $(eval $(call BuildPackage,libssp))
279 $(eval $(call BuildPackage,libstdcpp))
280 $(eval $(call BuildPackage,libpthread))
281 $(eval $(call BuildPackage,librt))
282 $(eval $(call BuildPackage,ldd))
283 $(eval $(call BuildPackage,ldconfig))