1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
|
# This file is part of the OpenADK project. OpenADK is copyrighted
# material, please see the LICENCE file in the top-level directory.
include $(ADK_TOPDIR)/rules.mk
include $(ADK_TOPDIR)/mk/rootfs.mk
PKG_NAME:= base-files
PKG_VERSION:= 1.1
PKG_RELEASE:= 22
PKG_SECTION:= base/apps
PKG_DESCR:= basic files and scripts
WRKDIST= ${WRKDIR}/base-files
NO_DISTFILES:= 1
include $(ADK_TOPDIR)/mk/package.mk
$(eval $(call PKG_template,BASE_FILES,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},force_etc))
CONFIG_STYLE:= manual
BUILD_STYLE:= manual
INSTALL_STYLE:= manual
do-install:
$(CP) ./src/* $(IDIR_BASE_FILES)
ifeq ($(ADK_RUNTIME_DEV_MDEV),y)
$(CP) ./files/rcdev.mdev $(IDIR_BASE_FILES)/etc/init.d/rcdev
else ifeq ($(ADK_RUNTIME_DEV_UDEV),y)
$(CP) ./files/rcdev.udev $(IDIR_BASE_FILES)/etc/init.d/rcdev
endif
ifeq (${ADK_TARGET_PACKAGE_IPKG},y)
$(CP) ./files/ipkg.conf $(IDIR_BASE_FILES)/etc/
$(SED) 's,@ARCH@,$(ADK_TARGET_CPU_ARCH),g' $(IDIR_BASE_FILES)/etc/ipkg.conf
$(SED) 's,@SYSTEM@,$(ADK_TARGET_SYSTEM),g' $(IDIR_BASE_FILES)/etc/ipkg.conf
$(SED) 's,@LIBC@,$(ADK_TARGET_LIBC),g' $(IDIR_BASE_FILES)/etc/ipkg.conf
$(SED) 's,@HOST@,$(ADK_HOST),g' $(IDIR_BASE_FILES)/etc/ipkg.conf
$(SED) 's,@VENDOR@,$(ADK_VENDOR),g' $(IDIR_BASE_FILES)/etc/ipkg.conf
mkdir -p $(IDIR_BASE_FILES)/usr/lib/ipkg/lists
endif
ifeq (${ADK_TARGET_PACKAGE_OPKG},y)
$(CP) ./files/ipkg.conf $(IDIR_BASE_FILES)/etc/
$(SED) 's,@ARCH@,$(ADK_TARGET_CPU_ARCH),g' $(IDIR_BASE_FILES)/etc/ipkg.conf
$(SED) 's,@SYSTEM@,$(ADK_TARGET_SYSTEM),g' $(IDIR_BASE_FILES)/etc/ipkg.conf
$(SED) 's,@LIBC@,$(ADK_TARGET_LIBC),g' $(IDIR_BASE_FILES)/etc/ipkg.conf
$(SED) 's,@HOST@,$(ADK_HOST),g' $(IDIR_BASE_FILES)/etc/ipkg.conf
$(SED) 's,@VENDOR@,$(ADK_VENDOR),g' $(IDIR_BASE_FILES)/etc/ipkg.conf
mkdir -p $(IDIR_BASE_FILES)/usr/lib/opkg/lists
endif
echo /bin/sh >${IDIR_BASE_FILES}/etc/shells
echo /bin/mksh >>${IDIR_BASE_FILES}/etc/shells
ifneq (${ADK_PACKAGE_ASH},)
echo /bin/ash >>${IDIR_BASE_FILES}/etc/shells
endif
ifneq (${ADK_PACKAGE_HUSH},)
echo /bin/hush >>${IDIR_BASE_FILES}/etc/shells
endif
ifneq (${ADK_PACKAGE_BASH},)
echo /bin/bash >>${IDIR_BASE_FILES}/etc/shells
endif
ifneq (${ADK_PACKAGE_ZSH},)
echo /bin/zsh >>${IDIR_BASE_FILES}/etc/shells
endif
mkdir -p $(IDIR_BASE_FILES)/etc/crontabs
mkdir -p $(IDIR_BASE_FILES)/{dev,boot,root,sys,proc,tmp,mnt,media}
mkdir -p $(IDIR_BASE_FILES)/etc/network/{if-pre-up.d,if-up.d,if-down.d,if-post-down.d}
mkdir -p $(IDIR_BASE_FILES)/usr/{lib,bin}
chmod 600 $(IDIR_BASE_FILES)/etc/shadow
ifeq ($(ADK_TARGET_WITH_NETDEVICE),y)
cp ./files/interfaces-dhcp $(IDIR_BASE_FILES)/etc/network/interfaces
cp ./files/rc.netinfo $(IDIR_BASE_FILES)/etc/
else
cp ./files/interfaces-lo $(IDIR_BASE_FILES)/etc/network/interfaces
endif
chmod 600 $(IDIR_BASE_FILES)/etc/network/interfaces
ifeq (${ADK_TARGET_ROOTFS_NFSROOT},y)
echo '#' > $(IDIR_BASE_FILES)/etc/network/interfaces
(cd $(IDIR_BASE_FILES)/etc; ln -sf ../proc/net/pnp resolv.conf)
else
(cd $(IDIR_BASE_FILES)/etc; ln -sf ../tmp/resolv.conf .)
endif
chmod 1777 ${IDIR_BASE_FILES}/tmp
ln -sf ../proc/mounts $(IDIR_BASE_FILES)/etc/mtab
rm -rf $(IDIR_BASE_FILES)/var
ln -sf tmp $(IDIR_BASE_FILES)/var
ln -sf var/run $(IDIR_BASE_FILES)/run
ifeq ($(ADK_RUNTIME_INIT_SYSV),y)
test -z $(ADK_RUNTIME_SHELL) || \
cat ./files/inittab.shell >> $(IDIR_BASE_FILES)/etc/inittab
ifeq ($(ADK_TARGET_WITH_VGA),y)
test -z $(ADK_RUNTIME_SHELL) || \
cat ./files/inittab.shellvga >> $(IDIR_BASE_FILES)/etc/inittab
endif
test -z $(ADK_RUNTIME_GETTY_VGA) || \
cat ./files/inittab.vga >> $(IDIR_BASE_FILES)/etc/inittab
test -z $(ADK_RUNTIME_GETTY_SERIAL) || \
cat ./files/inittab.serial >> $(IDIR_BASE_FILES)/etc/inittab
$(SED) 's#@DEVICE@#$(ADK_RUNTIME_CONSOLE_SERIAL_DEVICE)#g' $(IDIR_BASE_FILES)/etc/inittab
$(SED) 's#@SPEED@#$(ADK_RUNTIME_CONSOLE_SERIAL_SPEED)#' $(IDIR_BASE_FILES)/etc/inittab
endif
ifeq ($(ADK_RUNTIME_INIT_SYSVINIT),y)
cp ./files/inittab.sysv $(IDIR_BASE_FILES)/etc/inittab
endif
test -z $(ADK_RUNTIME_HOSTNAME) || \
echo $(ADK_RUNTIME_HOSTNAME) > $(IDIR_BASE_FILES)/etc/hostname; \
echo "127.0.0.1 localhost" > $(IDIR_BASE_FILES)/etc/hosts
echo "127.0.1.1 $(ADK_RUNTIME_HOSTNAME)" >> $(IDIR_BASE_FILES)/etc/hosts
echo "::1 ip6-localhost ip6-loopback" >> $(IDIR_BASE_FILES)/etc/hosts
echo "fe00::0 ip6-localnet" >> $(IDIR_BASE_FILES)/etc/hosts
echo "ff00::0 ip6-mcastprefix" >> $(IDIR_BASE_FILES)/etc/hosts
echo "ff02::1 ip6-allnodes" >> $(IDIR_BASE_FILES)/etc/hosts
echo "ff02::2 ip6-allrouters" >> $(IDIR_BASE_FILES)/etc/hosts
echo "ff02::3 ip6-allhosts" >> $(IDIR_BASE_FILES)/etc/hosts
test -z '$(ADK_RUNTIME_PASSWORD)' || \
$(SED) 's,\*NP\*,'"$$(awk -F\= '/^ADK_RUNTIME_PASSWORD/ { print $$2 }' $(ADK_TOPDIR)/.config|sed -e 's^\"^^g'),g" \
$(IDIR_BASE_FILES)/etc/shadow
echo $(ADK_RUNTIME_TMPFS_SIZE) > $(IDIR_BASE_FILES)/etc/tmpfs
ifeq ($(ADK_PACKAGE_MKSH),y)
$(CP) ./files/profile $(IDIR_BASE_FILES)/etc/profile
ifeq ($(ADK_TARGET_WITH_ROOT_RW),y)
echo 'export IPKGTMPDIR=/root/.ipkg' >> $(IDIR_BASE_FILES)/etc/profile
else
echo 'export IPKGTMPDIR=/tmp' >> $(IDIR_BASE_FILES)/etc/profile
endif
ifeq ($(ADK_TARGET_BOARD_BCM28XX),y)
echo 'export LD_LIBRARY_PATH=/opt/vc/lib' >> $(IDIR_BASE_FILES)/etc/profile
endif
endif
# simple network configuration
ifneq (${ADK_SIMPLE_NETWORK_CONFIG},)
${INSTALL_DIR} ${IDIR_BASE_FILES}/etc/network
printf "auto lo\niface lo inet loopback\n" > ${IDIR_BASE_FILES}/etc/network/interfaces
ifeq (${ADK_SIMPLE_NETWORK_CONFIG_ETH0_DHCP},y)
printf "\nauto eth0\niface eth0 inet dhcp\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
endif
ifeq (${ADK_SIMPLE_NETWORK_CONFIG_ETH0_STATIC},y)
printf "\nauto eth0\niface eth0 inet static\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
printf " address ${ADK_SIMPLE_NETWORK_CONFIG_ETH0_IP}\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
printf " netmask ${ADK_SIMPLE_NETWORK_CONFIG_ETH0_NM}\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
printf " broadcast +\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
ifneq (${ADK_SIMPLE_NETWORK_CONFIG_ETH0_GW},)
printf " gateway ${ADK_SIMPLE_NETWORK_CONFIG_ETH0_GW}\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
endif
endif
ifeq (${ADK_SIMPLE_NETWORK_CONFIG_WLAN0_DHCP},y)
printf "\nauto wlan0\niface wlan0 inet dhcp\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
ifeq (${ADK_SIMPLE_NETWORK_CONFIG_WLAN0_WPA2},y)
printf " wireless-mode sta\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
printf " wireless-ssid ${ADK_SIMPLE_NETWORK_CONFIG_WLAN0_WPA2_SSID}\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
printf " wireless-security wpa2\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
printf " wireless-passphrase ${ADK_SIMPLE_NETWORK_CONFIG_WLAN0_WPA2_PW}\n\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
endif
endif
ifeq (${ADK_SIMPLE_NETWORK_CONFIG_WLAN0_STATIC},y)
printf "\nauto wlan0\niface wlan0 inet static\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
ifeq (${ADK_SIMPLE_NETWORK_CONFIG_WLAN0_WPA2},y)
printf " wireless-mode sta\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
printf " wireless-ssid ${ADK_SIMPLE_NETWORK_CONFIG_WLAN0_WPA2_SSID}\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
printf " wireless-security wpa2\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
printf " wireless-passphrase ${ADK_SIMPLE_NETWORK_CONFIG_WLAN0_WPA2_PW}\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
endif
printf " address ${ADK_SIMPLE_NETWORK_CONFIG_WLAN0_IP}\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
printf " netmask ${ADK_SIMPLE_NETWORK_CONFIG_WLAN0_NM}\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
printf " broadcast +\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
ifneq (${ADK_SIMPLE_NETWORK_CONFIG_WLAN0_GW},)
printf " gateway ${ADK_SIMPLE_NETWORK_CONFIG_WLAN0_GW}\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
endif
endif
ifeq (${ADK_SIMPLE_NETWORK_CONFIG_ETH1_DHCP},y)
printf "\nauto eth1\niface eth1 inet dhcp\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
endif
ifeq (${ADK_SIMPLE_NETWORK_CONFIG_ETH1_STATIC},y)
printf "\nauto eth1\niface eth1 inet static\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
printf " address ${ADK_SIMPLE_NETWORK_CONFIG_ETH1_IP}\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
printf " netmask ${ADK_SIMPLE_NETWORK_CONFIG_ETH1_NM}\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
printf " broadcast +\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
ifneq (${ADK_SIMPLE_NETWORK_CONFIG_ETH1_GW},)
printf " gateway ${ADK_SIMPLE_NETWORK_CONFIG_ETH1_GW}\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
endif
endif
printf "\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
ifneq (${ADK_SIMPLE_NETWORK_CONFIG_NS},)
rm ${IDIR_BASE_FILES}/etc/resolv.conf
printf "nameserver ${ADK_SIMPLE_NETWORK_CONFIG_NS}\n" > ${IDIR_BASE_FILES}/etc/resolv.conf
endif
ifneq (${ADK_SIMPLE_NETWORK_CONFIG_PROXY},)
printf "http_proxy=${ADK_SIMPLE_NETWORK_CONFIG_PROXY}\n" >> ${IDIR_BASE_FILES}/etc/profile
printf "https_proxy=${ADK_SIMPLE_NETWORK_CONFIG_PROXY}\n" >> ${IDIR_BASE_FILES}/etc/profile
printf "ftp_proxy=${ADK_SIMPLE_NETWORK_CONFIG_PROXY}\n" >> ${IDIR_BASE_FILES}/etc/profile
endif
endif
ifeq ($(ADK_RUNTIME_ADDUSER),y)
mkdir -p ${IDIR_BASE_FILES}/$(ADK_RUNTIME_USER_HOME)
printf "$(ADK_RUNTIME_USER_NAME):x:100:100:$(ADK_RUNTIME_USER_NAME):$(ADK_RUNTIME_USER_HOME):$(ADK_RUNTIME_USER_SHELL)" >> ${IDIR_BASE_FILES}/etc/passwd
printf "$(ADK_RUNTIME_USER_NAME):$(ADK_RUNTIME_USER_PASSWORD):16514:0:::::" >> ${IDIR_BASE_FILES}/etc/shadow
printf "$(ADK_RUNTIME_USER_NAME):x:100:" >> ${IDIR_BASE_FILES}/etc/group
endif
include ${ADK_TOPDIR}/mk/pkg-bottom.mk
|