add failsafe support for x86-2.6 and fix mdev support for platforms using /etc/preinit
[openwrt.git] / package / base-files / Makefile
1 #
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$
8
9 include $(TOPDIR)/rules.mk
10 include $(INCLUDE_DIR)/kernel.mk
11
12 PKG_NAME:=base-files
13 PKG_RELEASE:=8
14
15 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)
16 PKG_FILE_DEPEND:=$(PLATFORM_DIR)
17
18 REV:=$(shell LANG=C svn info | awk '/^Revision:/ { print$$2 }' )
19 ifeq ($(REV),)
20 REV:=0
21 endif
22 include $(INCLUDE_DIR)/package.mk
23
24 ifneq ($(DUMP),1)
25 TARGET:=-$(BOARD)-$(KERNEL)
26 UCLIBC_VERSION:=${shell cat $(STAGING_DIR)/uclibc_version 2>/dev/null}
27 LIBGCC_VERSION:=${shell cat $(STAGING_DIR)/gcc_version 2>/dev/null}
28 else
29 UCLIBC_VERSION:=<UCLIBC_VERSION>
30 LIBGCC_VERSION:=<LIBGCC_VERSION>
31 endif
32
33 CONFIG_PACKAGE_base-files$(TARGET):=$(CONFIG_PACKAGE_base-files)
34
35 define Package/base-files$(TARGET)
36 SECTION:=base
37 CATEGORY:=Base system
38 TITLE:=Base filesystem for OpenWrt
39 DESCRIPTION:=\
40 This package contains a base filesystem and system scripts for OpenWrt.
41 URL:=http://openwrt.org/
42 VERSION:=$(PKG_RELEASE)-$(REV)
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.0.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/ipkg.conf
59 /etc/sysctl.conf
60 $(call $(TARGET)/conffiles)
61 endef
62
63 define Package/libgcc
64 SECTION:=libs
65 CATEGORY:=Base system
66 DEPENDS:=@!NATIVE_TOOLCHAIN
67 TITLE:=GCC support library
68 URL:=http://gcc.gnu.org/
69 VERSION:=$(LIBGCC_VERSION)-$(PKG_RELEASE)
70 endef
71
72 define Package/libpthread
73 SECTION:=libs
74 CATEGORY:=Libraries
75 DEPENDS:=@!NATIVE_TOOLCHAIN
76 TITLE:=POSIX thread library
77 URL:=http://uclibc.org/
78 VERSION:=$(UCLIBC_VERSION)-$(PKG_RELEASE)
79 endef
80
81 define Package/uclibc
82 SECTION:=libs
83 CATEGORY:=Base system
84 DEPENDS:=@!NATIVE_TOOLCHAIN
85 TITLE:=C library embedded systems
86 URL:=http://uclibc.org/
87 VERSION:=$(UCLIBC_VERSION)-$(PKG_RELEASE)
88 endef
89
90 define Build/Prepare
91 mkdir -p $(PKG_BUILD_DIR)
92 endef
93
94 define Build/Compile/Default
95 endef
96
97 define Build/Compile
98 $(call Build/Compile/Default)
99 endef
100
101 define Package/base-files$(TARGET)/install
102 $(CP) ./files/* $(1)/
103 if [ -d $(PLATFORM_DIR)/base-files/default/. ]; then \
104 $(CP) $(PLATFORM_DIR)/base-files/default/* $(1)/; \
105 fi
106 if [ "$(PROFILE)" != "Default" ]; then \
107 if [ -d $(PLATFORM_DIR)/base-files/profile-$(PROFILE)/. ]; then \
108 $(CP) $(PLATFORM_DIR)/base-files/profile-$(PROFILE)/* $(1)/; \
109 fi; \
110 fi
111 $(SED) 's,$$$$R,r$(REV),g' $(1)/etc/banner
112 $(SED) 's,$$$$S,$(BOARD)-$(KERNEL),g' $(1)/etc/ipkg.conf
113 mkdir -p $(1)/dev
114 mkdir -p $(1)/etc/crontabs
115 mkdir -p $(1)/jffs
116 mkdir -p $(1)/lib
117 mkdir -p $(1)/mnt
118 mkdir -p $(1)/proc
119 mkdir -p $(1)/tmp
120 mkdir -p $(1)/usr/lib
121 mkdir -p $(1)/usr/bin
122 mkdir -p $(1)/sys
123 mkdir -p $(1)/www
124 ln -sf /proc/mounts $(1)/etc/mtab
125 rm -f $(1)/var
126 ln -sf /tmp $(1)/var
127 mkdir -p $(1)/etc
128 ln -sf /tmp/resolv.conf $(1)/etc/resolv.conf
129 $(call Package/base-files/install-target,$(1))
130 for conffile in $(1)/etc/config/*; do \
131 if [ -f "$$$$conffile" ]; then \
132 grep "$$$$conffile" $(1)/CONTROL/conffiles || \
133 echo "$$$${conffile##$(1)}" >> $(1)/CONTROL/conffiles; \
134 fi \
135 done
136 endef
137
138 define Package/libgcc/install
139 $(INSTALL_DIR) $(1)/lib
140 $(CP) $(STAGING_DIR)/lib/libgcc_s.so.* $(1)/lib/
141 endef
142
143 define Package/libpthread/install
144 $(INSTALL_DIR) $(1)/lib
145 $(CP) $(STAGING_DIR)/lib/libpthread.so.* $(1)/lib/
146 $(CP) $(STAGING_DIR)/lib/libpthread-$(UCLIBC_VERSION).so $(1)/lib/
147 endef
148
149 define Package/uclibc/install
150 $(INSTALL_DIR) $(1)/lib
151 for file in ld-uClibc libc libcrypt libdl libm libnsl libresolv librt libuClibc libutil; do \
152 $(CP) $(STAGING_DIR)/lib/$$$$file.so.* $(1)/lib/; \
153 $(CP) $(STAGING_DIR)/lib/$$$$file-$(UCLIBC_VERSION).so $(1)/lib/; \
154 done
155 endef
156
157 ifneq ($(DUMP),1)
158 -include $(PLATFORM_DIR)/base-files.mk
159 endif
160
161 $(eval $(call BuildPackage,base-files$(TARGET)))
162 $(eval $(call BuildPackage,libgcc))
163 $(eval $(call BuildPackage,libpthread))
164 $(eval $(call BuildPackage,uclibc))
165
166
This page took 0.052223 seconds and 5 git commands to generate.