source: trunk/package/base-files/Makefile @ 16488

Last change on this file since 16488 was 16488, checked in by jow, 7 years ago

[package] sysupgrade: sync *before* mtd write, only fallback to sysrq-trigger if standard reboot fails

  • Property svn:copyright set to Copyright (C) 2006 OpenWrt.org
  • Property svn:eol-style set to native
File size: 7.5 KB
Line 
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
8include $(TOPDIR)/rules.mk
9include $(INCLUDE_DIR)/kernel.mk
10
11PKG_NAME:=base-files
12PKG_RELEASE:=23
13
14PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
15
16include $(INCLUDE_DIR)/package.mk
17
18ifneq ($(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  ifneq ($(findstring mips64,$(ARCH)),)
28    LIB_SUFFIX:=64
29  endif
30else
31  LIBC_VERSION:=<LIBC_VERSION>
32  LIBGCC_VERSION:=<LIBGCC_VERSION>
33endif
34
35CONFIG_PACKAGE_base-files$(TARGET):=$(CONFIG_PACKAGE_base-files)
36
37define 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)
48endef
49
50define 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)
60endef
61
62define Package/base-files$(TARGET)/description
63 This package contains a base filesystem and system scripts for OpenWrt.
64endef
65
66define 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)
72endef
73
74define Package/libgcc
75$(call Package/gcc/Default)
76  TITLE:=GCC support library
77  DEPENDS+=@!TARGET_avr32
78endef
79
80define Package/libssp
81$(call Package/gcc/Default)
82  DEPENDS+=@SSP_SUPPORT
83  TITLE:=GCC support library
84endef
85
86define Package/libstdcpp
87$(call Package/gcc/Default)
88  NAME:=libstdc++
89  TITLE:=GNU Standard C++ Library v3
90  DEPENDS+=@INSTALL_LIBSTDCPP
91endef
92
93define Package/libc/Default
94  SECTION:=libs
95  CATEGORY:=Base system
96  DEPENDS:=@!NATIVE_TOOLCHAIN
97  VERSION:=$(LIBC_VERSION)-$(PKG_RELEASE)
98  URL:=$(LIBC_URL)
99endef
100
101define Package/libc
102$(call Package/libc/Default)
103  TITLE:=C library
104endef
105
106define Package/libpthread
107$(call Package/libc/Default)
108  TITLE:=POSIX thread library
109  DEPENDS:= +librt
110endef
111
112define Package/librt
113$(call Package/libc/Default)
114  TITLE:=POSIX.1b RealTime extension library
115endef
116
117define Package/ldd
118$(call Package/libc/Default)
119  SECTION:=utils
120  CATEGORY:=Utilities
121  TITLE:=LDD trace utility
122endef
123
124define Package/ldconfig
125$(call Package/libc/Default)
126  SECTION:=utils
127  CATEGORY:=Utilities
128  TITLE:=Shared library path configuration
129endef
130
131
132define Build/Prepare
133        mkdir -p $(PKG_BUILD_DIR)
134endef
135
136define Build/Compile/Default
137endef
138
139define Build/Compile
140        $(call Build/Compile/Default)
141endef
142
143define 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
202endef
203
204define Package/libgcc/install
205        $(INSTALL_DIR) $(1)/lib
206        $(CP) $(TOOLCHAIN_DIR)/lib$(LIB_SUFFIX)/libgcc_s.so.* $(1)/lib/
207endef
208
209define Package/libssp/install
210        $(INSTALL_DIR) $(1)/lib
211        $(CP) $(TOOLCHAIN_DIR)/lib$(LIB_SUFFIX)/libssp.so.* $(1)/lib/
212endef
213
214define Package/libstdcpp/install
215        $(INSTALL_DIR) $(1)/usr/lib
216        $(CP) $(TOOLCHAIN_DIR)/usr/lib$(LIB_SUFFIX)/libstdc++.so.* $(1)/usr/lib/
217endef
218
219use_libutil=$(if $(CONFIG_USE_GLIBC)$(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP),libutil)
220use_libnsl=$(if $(CONFIG_USE_GLIBC)$(CONFIG_EGLIBC_OPTION_EGLIBC_NIS),libnsl)
221use_nsswitch=$(if $(CONFIG_USE_GLIBC)$(CONFIG_EGLIBC_OPTION_EGLIBC_NSSWITCH),libnss_dns libnss_files)
222
223define 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
231endef
232
233define Package/eglibc/install
234$(call Package/glibc/install,$1)
235endef
236
237define 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
243endef
244
245define Package/libc/install
246$(call Package/$(LIBC)/install,$1)
247endef
248
249define 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/
253endef
254
255define 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/
259endef
260
261define Package/ldd/install
262        $(INSTALL_DIR) $(1)/usr/bin/
263        $(CP) $(TOOLCHAIN_DIR)/usr/bin/ldd $(1)/usr/bin/
264endef
265
266define Package/ldconfig/install
267        $(INSTALL_DIR) $(1)/sbin/
268        $(CP) $(TOOLCHAIN_DIR)/sbin/ldconfig $(1)/sbin/
269endef
270
271ifneq ($(DUMP),1)
272  -include $(PLATFORM_DIR)/base-files.mk
273endif
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))
Note: See TracBrowser for help on using the repository browser.