mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-24 19:14:05 +08:00
Compare commits
427 Commits
kernel-cc
...
fredrik_uc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c78a961168 | ||
|
|
47f57dd721 | ||
|
|
82c830c563 | ||
|
|
f76e919f45 | ||
|
|
8dbb05a6c1 | ||
|
|
41574ab1f9 | ||
|
|
e9d0e4559e | ||
|
|
eb19a91087 | ||
|
|
103964b2d1 | ||
|
|
cb19eafc50 | ||
|
|
bdef362e9e | ||
|
|
a2fcc88238 | ||
|
|
0df441879e | ||
|
|
6a34f36cbd | ||
|
|
f371d1fb1a | ||
|
|
c39744a030 | ||
|
|
55c0ab8163 | ||
|
|
f7deb35e16 | ||
|
|
379c5677a4 | ||
|
|
52f8ff2b5d | ||
|
|
57f9214964 | ||
|
|
c41ccdaf89 | ||
|
|
5566c4b885 | ||
|
|
e484e5ba8d | ||
|
|
27959db5d6 | ||
|
|
0379fefdd5 | ||
|
|
a016f2f4ba | ||
|
|
42650be9ea | ||
|
|
07292dd5cf | ||
|
|
b6d5ff232d | ||
|
|
33498543d8 | ||
|
|
3bcfcdaa1e | ||
|
|
523682006f | ||
|
|
cd640462c1 | ||
|
|
97201fc0b9 | ||
|
|
5251859485 | ||
|
|
9ddba9536f | ||
|
|
23dea02d7b | ||
|
|
ee521f9609 | ||
|
|
f788ac8368 | ||
|
|
adcd3bca40 | ||
|
|
315e29d78f | ||
|
|
9ac0c35f4f | ||
|
|
fc74862f11 | ||
|
|
085d43c3a4 | ||
|
|
72738752d9 | ||
|
|
6ed8c8527b | ||
|
|
b5003a80e1 | ||
|
|
58bd42f827 | ||
|
|
a2b9e5d674 | ||
|
|
b5be4d7dd6 | ||
|
|
5a46f910df | ||
|
|
5da8017639 | ||
|
|
bf2b51bd82 | ||
|
|
adc94ff3a5 | ||
|
|
b1ce1a9b13 | ||
|
|
7bb3854889 | ||
|
|
adad2c8a75 | ||
|
|
47b1d90487 | ||
|
|
1bd79f9e7e | ||
|
|
4fa973ad54 | ||
|
|
1967f8895e | ||
|
|
3c674b984c | ||
|
|
aef3f9421e | ||
|
|
c103a267ff | ||
|
|
9be82ab295 | ||
|
|
fb3ac14e5f | ||
|
|
edf1d929d0 | ||
|
|
fc3e9d0418 | ||
|
|
c39aca40fa | ||
|
|
a32f730626 | ||
|
|
e498e91cde | ||
|
|
d5d0f963fb | ||
|
|
32d10209da | ||
|
|
be6737b028 | ||
|
|
09e4e7cde2 | ||
|
|
b334565e90 | ||
|
|
eb07e8868f | ||
|
|
728da91a8f | ||
|
|
26a44ab3e5 | ||
|
|
b1ba9c1826 | ||
|
|
eadb49e55c | ||
|
|
68a39be532 | ||
|
|
333fbe25b1 | ||
|
|
c83a88ceb6 | ||
|
|
ae3d22ab45 | ||
|
|
59285541e3 | ||
|
|
2f312659d8 | ||
|
|
659a36547b | ||
|
|
24700f6162 | ||
|
|
17d2905283 | ||
|
|
93e9c0e4cb | ||
|
|
df039df5b3 | ||
|
|
3a30ea8209 | ||
|
|
0e22871a96 | ||
|
|
650f941dfc | ||
|
|
d563bfa099 | ||
|
|
840670bf80 | ||
|
|
645a9d919f | ||
|
|
aea3f66f51 | ||
|
|
650957082a | ||
|
|
d893622fb3 | ||
|
|
82d4fef6a6 | ||
|
|
92a6b78786 | ||
|
|
c32ced2cfe | ||
|
|
e0be33b76a | ||
|
|
117c5224cc | ||
|
|
3917419263 | ||
|
|
a6047dadbf | ||
|
|
906307df05 | ||
|
|
e8a6ff899b | ||
|
|
1d5ca37f1e | ||
|
|
98170bdb79 | ||
|
|
97306df0a9 | ||
|
|
a6abec5787 | ||
|
|
88cf2ea0c2 | ||
|
|
103bbebad0 | ||
|
|
c7b88666d8 | ||
|
|
22e014b587 | ||
|
|
ce9ac288ff | ||
|
|
87df5f9117 | ||
|
|
9073b24182 | ||
|
|
82d37cefd5 | ||
|
|
93eaaa0aa9 | ||
|
|
b5db57ba45 | ||
|
|
3db08a8ec8 | ||
|
|
75ec580e89 | ||
|
|
12a7183a32 | ||
|
|
73e4a225bb | ||
|
|
3a9685332d | ||
|
|
12609ec471 | ||
|
|
c2788f796d | ||
|
|
0144ce9606 | ||
|
|
63ee5d4091 | ||
|
|
0ab812d222 | ||
|
|
06679bd124 | ||
|
|
141b0c32e7 | ||
|
|
9abc466d79 | ||
|
|
93064cadd4 | ||
|
|
fc82c65364 | ||
|
|
150b9bd694 | ||
|
|
5ccec170d9 | ||
|
|
86cc70f753 | ||
|
|
3a7e94e956 | ||
|
|
a2220489b3 | ||
|
|
c1363317ba | ||
|
|
667e0b1073 | ||
|
|
39733b6227 | ||
|
|
789d2e2a42 | ||
|
|
353b048596 | ||
|
|
5e50e59c46 | ||
|
|
fa134b86f8 | ||
|
|
1258a086bc | ||
|
|
a9d22d5e6b | ||
|
|
b3af9d3695 | ||
|
|
e83748b3e4 | ||
|
|
fea6fc95a0 | ||
|
|
ba1337720e | ||
|
|
1d9619dfd9 | ||
|
|
8f63a74197 | ||
|
|
482a88a65b | ||
|
|
351ca030d4 | ||
|
|
b306dffa63 | ||
|
|
baeaa7cc4c | ||
|
|
df9e651719 | ||
|
|
f8e7362648 | ||
|
|
378310828c | ||
|
|
1fa651ddd2 | ||
|
|
b5b88e6335 | ||
|
|
f59e3fa4bf | ||
|
|
6fdf16fc81 | ||
|
|
905423d589 | ||
|
|
a2cf8beaed | ||
|
|
d3bf187a66 | ||
|
|
0afa6e264c | ||
|
|
45e33d565a | ||
|
|
e6bc413a9b | ||
|
|
b3c28656a7 | ||
|
|
7e70ce6c5d | ||
|
|
92fafa4245 | ||
|
|
50c3c52edd | ||
|
|
01fd665c51 | ||
|
|
3409632353 | ||
|
|
0e4cf8941d | ||
|
|
7d5d9f4fd2 | ||
|
|
6445cba038 | ||
|
|
595de81dff | ||
|
|
67e42d5efd | ||
|
|
12000972d7 | ||
|
|
e83347616c | ||
|
|
8d2bdd90fd | ||
|
|
fef609fb46 | ||
|
|
169c157cbd | ||
|
|
048546b175 | ||
|
|
a17f3718af | ||
|
|
70855e0a4f | ||
|
|
9c4ede538b | ||
|
|
e16d6d9b5b | ||
|
|
f656693f25 | ||
|
|
d065eef18c | ||
|
|
d2511509ef | ||
|
|
85fcb1f033 | ||
|
|
074f459bea | ||
|
|
abe069dc3c | ||
|
|
1342f71b77 | ||
|
|
c617d393ee | ||
|
|
c293e680dc | ||
|
|
4f20ba679e | ||
|
|
b926cf4c34 | ||
|
|
d7030c4785 | ||
|
|
f33296afa9 | ||
|
|
be2de2f1c3 | ||
|
|
211525095b | ||
|
|
fc9e3e34e6 | ||
|
|
0650265216 | ||
|
|
1fe72d82aa | ||
|
|
5771b3bde6 | ||
|
|
1ce684c01e | ||
|
|
7e5ff6567a | ||
|
|
d2713b3bbd | ||
|
|
991eeff106 | ||
|
|
93cd4c477d | ||
|
|
c208c12ef3 | ||
|
|
7bfdea5ff3 | ||
|
|
ab88b8e133 | ||
|
|
2d7baa91e2 | ||
|
|
66ad2e3158 | ||
|
|
0981bc9ccd | ||
|
|
c9601eb4aa | ||
|
|
2f6fed6d92 | ||
|
|
6fbf823167 | ||
|
|
7833470f7a | ||
|
|
0ff160345d | ||
|
|
a63d88c100 | ||
|
|
169ebea761 | ||
|
|
069de32121 | ||
|
|
6eecfcd238 | ||
|
|
e49d908f94 | ||
|
|
24b6106ddd | ||
|
|
8cd62ff81f | ||
|
|
0d3466445c | ||
|
|
cde3056c2f | ||
|
|
5ffec072d5 | ||
|
|
6e9f0fafa3 | ||
|
|
0feb577f1a | ||
|
|
d4d189bd1e | ||
|
|
8143b29d38 | ||
|
|
78863e3174 | ||
|
|
3324bd6c94 | ||
|
|
a1a8e179d8 | ||
|
|
3e6ce7dd21 | ||
|
|
74e087814d | ||
|
|
3069b113f2 | ||
|
|
ae4bd347d0 | ||
|
|
b534f1f164 | ||
|
|
b0a857c7c9 | ||
|
|
106982c69a | ||
|
|
b24cb6f4d4 | ||
|
|
ed2f0381a0 | ||
|
|
bbede82173 | ||
|
|
256948792c | ||
|
|
b173df6ff5 | ||
|
|
31361b2bfb | ||
|
|
fb2181f279 | ||
|
|
2ef80243bf | ||
|
|
5811d46d56 | ||
|
|
e0d7cb9caa | ||
|
|
5b22a2dce6 | ||
|
|
dd481c8bfe | ||
|
|
fa760967a1 | ||
|
|
ce8bf2872c | ||
|
|
faa17d8679 | ||
|
|
ceca1c1a53 | ||
|
|
7862c07454 | ||
|
|
22129691d0 | ||
|
|
9625c3b81c | ||
|
|
a1d6b02a20 | ||
|
|
d6ab9d1a12 | ||
|
|
97ad605a1c | ||
|
|
3e66393c7b | ||
|
|
9b02ee98d2 | ||
|
|
8a2939ddde | ||
|
|
a17530309f | ||
|
|
d6f0f38524 | ||
|
|
4c99a2fb98 | ||
|
|
701cc69a03 | ||
|
|
da5615d50a | ||
|
|
6ea1aa0a2b | ||
|
|
09e49e54eb | ||
|
|
e92bc0ea7d | ||
|
|
a1e4de11f0 | ||
|
|
750d5ff091 | ||
|
|
1f5c527959 | ||
|
|
4dba945466 | ||
|
|
ce942da01f | ||
|
|
a6139059a3 | ||
|
|
a58ac037fd | ||
|
|
5ec0992e1d | ||
|
|
71c459b27d | ||
|
|
4021526a61 | ||
|
|
009d2b613c | ||
|
|
cee25ad753 | ||
|
|
221020162e | ||
|
|
6e7e03544a | ||
|
|
65dd02c8ad | ||
|
|
4b193200ed | ||
|
|
64c89e3778 | ||
|
|
46bbd6e198 | ||
|
|
351814d4eb | ||
|
|
bc7260e31f | ||
|
|
a88e8ca92a | ||
|
|
fac97aafc4 | ||
|
|
67bf9c7cc6 | ||
|
|
416807ec6d | ||
|
|
bf68e19da1 | ||
|
|
f668805565 | ||
|
|
09595f0343 | ||
|
|
0a221ad2a2 | ||
|
|
47a918ff4d | ||
|
|
4ae7bdd609 | ||
|
|
cae2808318 | ||
|
|
6f600d6f37 | ||
|
|
fdb3f55a35 | ||
|
|
486b1a854c | ||
|
|
5fb7c59fb3 | ||
|
|
86bca8523b | ||
|
|
af1516bf6c | ||
|
|
b167e072ac | ||
|
|
e11fef0a1d | ||
|
|
70597bb8de | ||
|
|
fa4e426d33 | ||
|
|
ca2d6ac266 | ||
|
|
201d3e9b69 | ||
|
|
27173c0d40 | ||
|
|
a0749cd0cf | ||
|
|
02e15998da | ||
|
|
178b836aff | ||
|
|
b2184b2b45 | ||
|
|
bba5a9e3d6 | ||
|
|
a350812bfd | ||
|
|
5eccb99fce | ||
|
|
ae92433819 | ||
|
|
dd91c8823b | ||
|
|
ab0294c188 | ||
|
|
c0fe19f4d7 | ||
|
|
803bfdd345 | ||
|
|
7a31cda783 | ||
|
|
361f3404d1 | ||
|
|
35427c3ad2 | ||
|
|
2d569ff935 | ||
|
|
b76d2ee06a | ||
|
|
207c769970 | ||
|
|
4940ba3428 | ||
|
|
4c377f65b5 | ||
|
|
9a0dcfd895 | ||
|
|
fbcf382a64 | ||
|
|
09413abb61 | ||
|
|
f29c51e68c | ||
|
|
8cce20ecb6 | ||
|
|
3f77b219b9 | ||
|
|
8bae398da7 | ||
|
|
1576532e0e | ||
|
|
8f4fdc0f7d | ||
|
|
7f34e8b807 | ||
|
|
cb0d37c698 | ||
|
|
5aee44ba2c | ||
|
|
17c2361a90 | ||
|
|
00555a7a2e | ||
|
|
de7cf6298c | ||
|
|
f9ac50cf4f | ||
|
|
be791726a4 | ||
|
|
0879221d1a | ||
|
|
ab80d8a243 | ||
|
|
8e5d63d7d3 | ||
|
|
5e7bfbd977 | ||
|
|
75e6c3f089 | ||
|
|
4b1dbd91cd | ||
|
|
52321de1ca | ||
|
|
97d6f8604e | ||
|
|
7b9db30978 | ||
|
|
eb6dc4b927 | ||
|
|
e628a79588 | ||
|
|
c5d25fdfad | ||
|
|
b207009cb4 | ||
|
|
1b94f625ea | ||
|
|
5c5c9d53a4 | ||
|
|
6403153076 | ||
|
|
17b0fcba98 | ||
|
|
4339dcddbe | ||
|
|
1f6143cdeb | ||
|
|
4cf9d8a93d | ||
|
|
10bdb7a8dc | ||
|
|
659ec81047 | ||
|
|
0513a124dc | ||
|
|
330f79b31f | ||
|
|
43be9fd282 | ||
|
|
1e3195e1ee | ||
|
|
9dea956039 | ||
|
|
7e60791000 | ||
|
|
e8bdb6bc24 | ||
|
|
3400265f13 | ||
|
|
5e797bf457 | ||
|
|
58f1084714 | ||
|
|
69a79e6b3e | ||
|
|
8f48ff9e83 | ||
|
|
794223e29e | ||
|
|
7ed295b977 | ||
|
|
9599e9fad5 | ||
|
|
96c9277e1a | ||
|
|
a1b0964e0a | ||
|
|
807f7c520f | ||
|
|
94b3e0b975 | ||
|
|
5345917eaa | ||
|
|
1f5d3f2eed | ||
|
|
be1d548163 | ||
|
|
05489b127a | ||
|
|
c525acc002 | ||
|
|
65f799faa0 | ||
|
|
8cabb87357 | ||
|
|
c19546bbdd | ||
|
|
6699e1a741 | ||
|
|
d20174daed | ||
|
|
b08557465f | ||
|
|
e46fa1b3ae | ||
|
|
e4258501a9 | ||
|
|
3dc434eb24 | ||
|
|
aa9d058747 |
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
local usb_dir uVid uPid uMa uPr uSe bConf bNumConfs vendor product mdmtyp netdev comdev cdcdev ttydev usbno usbbr
|
||||
local usb_dir uVid uPid uMa uPr uSe bConf bNumConfs vendor product mdmtyp netdev comdev cdcdev ttydev interface usbno usbbr
|
||||
|
||||
sanitize() {
|
||||
sed -e 's/[[:space:]]\+$//; s/[[:space:]]\+/_/g' "$@"
|
||||
@@ -20,6 +20,7 @@ find_usb_attrs() {
|
||||
netdev=$(find $usb_dir -name wwan* | awk -F'/' '{print$NF}' | head -2 | tail -1)
|
||||
cdcdev=$(find $usb_dir -name cdc-wdm* | awk -F'/' '{print$NF}' | head -2 | tail -1)
|
||||
ttydev=$(ls $(find $usb_dir -name tty | head -2 | tail -1) | tail -1)
|
||||
interface=$(cat $usb_dir/interface)
|
||||
if [ -n "$cdcdev" ]; then
|
||||
comdev=$cdcdev
|
||||
mdmtyp=$(grep $uVid:$uPid /etc/modemdb | grep 'qmi\|mbim' | awk '{print$2}' | head -1)
|
||||
@@ -48,6 +49,8 @@ case "$usbbr" in
|
||||
*:*) usbbr=$(echo $DEVPATH | cut -d'/' -f6) ;;
|
||||
esac
|
||||
|
||||
#devno=$(basename $DEVPATH)
|
||||
|
||||
find_usb_attrs
|
||||
if [ "$ACTION" = add ]; then
|
||||
convert_to_mbim "$uVid:$uPid"
|
||||
@@ -55,6 +58,9 @@ if [ "$ACTION" = add ]; then
|
||||
if [ -n "$usbno" ] && [ -n "$usbbr" ]; then
|
||||
sed -i "/$usbno:$usbbr/ d" /var/usbnets
|
||||
echo $usbno:$usbbr $uVid:$uPid $uMa $uPr $netdev $comdev $mdmtyp $vendor $product >> /var/usbnets
|
||||
ubus send hotplug.usb "{'action': 'add', 'devpath': '$DEVPATH', 'manufacturer': '$uMa', 'product': '$uPr', 'serial': '$uSe', 'vendor_id': '$uVid', \
|
||||
'product_id': '$uPid', 'driver_interface': '$interface', 'driver': '$DRIVER', 'devtype': '$DEVTYPE'}"
|
||||
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@@ -62,5 +68,7 @@ fi
|
||||
if [ "$ACTION" = remove ]; then
|
||||
if [ -n "$usbno" ] && [ -n "$usbbr" ]; then
|
||||
sed -i "/$usbno:$usbbr/ d" /var/usbnets
|
||||
ubus send hotplug.usb "{'action': 'remove', 'devpath': '$DEVPATH', 'manufacturer': '$uMa', 'product': '$uPr', 'serial': '$uSe', 'vendor_id': '$uVid', \
|
||||
'product_id': '$uPid', 'driver_interface': '$interface', 'driver': '$DRIVER', 'devtype': '$DEVTYPE'}"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
config server 'default'
|
||||
list network 'lan'
|
||||
option rd 'server'
|
||||
option dhcpv6 'server'
|
||||
option management_level '1'
|
||||
option compat_ula '1'
|
||||
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=1
|
||||
PKG_SOURCE_URL:=git://git.carnivore.it/users/common/af_alg.git
|
||||
PKG_SOURCE_VERSION:=1851bbb010c38878c83729be844f168192059189
|
||||
|
||||
PKG_NAME:=af_alg
|
||||
PKG_VERSION:=0.1
|
||||
|
||||
DEPENDS:=libopenssl
|
||||
|
||||
export BUILD_DIR
|
||||
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
|
||||
|
||||
TARGET_LDFLAGS+= \
|
||||
-Wl,-rpath-link=$(STAGING_DIR)/usr/lib
|
||||
MAKE_FLAGS += TARGET="$(target)"
|
||||
TARGET_CFLAGS += -Dtarget_$(target)=1 -Wall
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
||||
define Package/af_alg
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=Openssl af_alg engine
|
||||
URL:=
|
||||
endef
|
||||
|
||||
define Package/af_alg/description
|
||||
Openssl af_alg engine
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE_VARS) \
|
||||
$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/$(MAKE_PATH) \
|
||||
$(MAKE_FLAGS)
|
||||
endef
|
||||
|
||||
define Package/af_alg/install
|
||||
$(INSTALL_DIR) $(1)/usr
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/usr/lib/engines
|
||||
cp $(PKG_BUILD_DIR)/libaf_alg.so $(1)/usr/lib/engines/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,af_alg))
|
||||
@@ -1,11 +0,0 @@
|
||||
--- a/Makefile 2014-02-17 13:00:44.161670649 +0100
|
||||
+++ b/Makefile 2014-02-17 13:00:51.633670316 +0100
|
||||
@@ -24,7 +24,7 @@
|
||||
LDFLAGS =
|
||||
|
||||
SPEC_LDFLAGS = \
|
||||
- -lcrypto
|
||||
+ -lcrypt
|
||||
|
||||
CC = cc
|
||||
LD = $(CC)
|
||||
@@ -1,188 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=alleato-base
|
||||
|
||||
PKG_VERSION:=14.49.2
|
||||
PKG_RELEASE=$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE_URL:=git@iopsys.inteno.se:alleato_base.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=8314aed451255410a2cd4fa43ac3235504e8f018
|
||||
|
||||
PKG_MAINTAINER:=Martin Assarsson, ALLEATO
|
||||
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
######################################################
|
||||
|
||||
define Package/alleato3
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Alleato
|
||||
DEPENDS:=+python
|
||||
TITLE:=Alleato python libraries
|
||||
endef
|
||||
|
||||
define Package/zwaved
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Alleato
|
||||
DEPENDS:=+jansson
|
||||
TITLE:=Alleato zwave daemon
|
||||
endef
|
||||
|
||||
define Package/zwave-mgr
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Alleato
|
||||
DEPENDS:=+alleato3
|
||||
TITLE:=Alleato zwave manager
|
||||
endef
|
||||
|
||||
define Package/zwave-profiler
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Alleato
|
||||
DEPENDS:=+alleato3
|
||||
TITLE:=Alleato zwave profiler
|
||||
endef
|
||||
|
||||
define Package/alleato-scheduler
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Alleato
|
||||
DEPENDS:=+alleato3
|
||||
TITLE:=Alleato scheduler
|
||||
endef
|
||||
|
||||
define Package/alleato-boxconfig
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Alleato
|
||||
DEPENDS:=+alleato3
|
||||
TITLE:=Alleato boxconfig
|
||||
endef
|
||||
|
||||
define Package/all-omc
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Alleato
|
||||
DEPENDS:=+alleato3 +screen
|
||||
TITLE:=Alleato remote tunnel
|
||||
endef
|
||||
|
||||
define Package/ubus-kicker
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Alleato
|
||||
DEPENDS:=
|
||||
TITLE:=Alleato ubus-kicker
|
||||
endef
|
||||
|
||||
define Package/mqttnagios
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Alleato
|
||||
DEPENDS:=
|
||||
TITLE:=Alleato mqttnagios
|
||||
endef
|
||||
|
||||
define Package/all4-alleato-tools
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Alleato
|
||||
DEPENDS:=
|
||||
TITLE:=Alleato tools
|
||||
endef
|
||||
|
||||
######################################################
|
||||
|
||||
define Package/alleato3/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/python2.7/
|
||||
$(CP) -r $(PKG_BUILD_DIR)/python-2.7/* $(1)/usr/lib/python2.7/
|
||||
endef
|
||||
|
||||
define Package/zwaved/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init.d/zwaved $(1)/etc/init.d/zwaved
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/zwaved $(1)/usr/sbin/zwaved
|
||||
endef
|
||||
|
||||
define Package/zwave-mgr/install
|
||||
$(INSTALL_DIR) $(1)/usr/mqttrules $(1)/etc/init.d $(1)/etc/alleato/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init.d/zwave-mgr $(1)/etc/init.d/zwave-mgr
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/zwave_mgr $(1)/usr/mqttrules/zwave_mgr
|
||||
endef
|
||||
|
||||
define Package/zwave-profiler/install
|
||||
$(INSTALL_DIR) $(1)/usr/mqttrules $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init.d/zwave-profiler $(1)/etc/init.d/zwave-profiler
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/zwave-profiler $(1)/usr/mqttrules/zwave-profiler
|
||||
endef
|
||||
|
||||
define Package/alleato-scheduler/install
|
||||
$(INSTALL_DIR) $(1)/usr/mqttrules $(1)/etc/init.d $(1)/etc/crontabs/sched
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init.d/scheduler $(1)/etc/init.d/scheduler
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/scheduler $(1)/usr/mqttrules/scheduler
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/data/schedule $(1)/etc/crontabs/sched/schedule
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/data/schedule $(1)/etc/crontabs/schedule
|
||||
endef
|
||||
|
||||
define Package/alleato-boxconfig/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin $(1)/usr/bin $(1)/etc/init.d $(1)/etc/alleato $(1)/home/mosquitto
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init.d/boxconfig $(1)/etc/init.d/boxconfig
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/boxconfig $(1)/usr/bin/boxconfig
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/genmosquittoconf $(1)/usr/bin/genmosquittoconf
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/check_client_id $(1)/usr/sbin/check_client_id
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/data/boxconfig.conf $(1)/etc/boxconfig.conf
|
||||
endef
|
||||
|
||||
define Package/all-omc/install
|
||||
$(INSTALL_DIR) $(1)/root $(1)/etc/init.d $(1)/etc/config $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init.d/omc $(1)/etc/init.d/omc
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/root/ssh_key $(1)/root/ssh_key
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/data/alleato.config $(1)/etc/config/alleato
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/omc $(1)/usr/bin/omc
|
||||
endef
|
||||
|
||||
define Package/ubus-kicker/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init.d/ubus-kicker $(1)/etc/init.d/ubus-kicker
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/ubus-kicker $(1)/usr/sbin/ubus-kicker
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/akick $(1)/usr/sbin/akick
|
||||
endef
|
||||
|
||||
define Package/mqttnagios/install
|
||||
$(INSTALL_DIR) $(1)/etc/nagios.d $(1)/usr/bin $(1)/etc/crontabs $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init.d/mqttnagios $(1)/etc/init.d/mqttnagios
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/send_mqtt_nag $(1)/usr/bin/send_mqtt_nag
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/nagios.d/dropbear $(1)/etc/nagios.d/dropbear.nag
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/nagios.d/mosquitto $(1)/etc/nagios.d/mosquitto.nag
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/nagios.d/ssh $(1)/etc/nagios.d/ssh.nag
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/nagios.d/zwaved $(1)/etc/nagios.d/zwaved.nag
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/data/mqttnagios $(1)/etc/crontabs/mqttnagios
|
||||
echo '/5 * * * * /usr/sbin/check_client_id' >> $(1)/etc/crontabs/root
|
||||
endef
|
||||
|
||||
define Package/all4-alleato-tools/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin $(1)/etc/init.d $(1)/opt/alleato
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init.d/house $(1)/etc/init.d/house
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init.d/rulesd $(1)/etc/init.d/rulesd
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/alleato_tools $(1)/usr/bin/alleato_tools
|
||||
endef
|
||||
|
||||
######################################################
|
||||
|
||||
$(eval $(call BuildPackage,alleato3))
|
||||
$(eval $(call BuildPackage,zwaved))
|
||||
$(eval $(call BuildPackage,zwave-mgr))
|
||||
$(eval $(call BuildPackage,zwave-profiler))
|
||||
$(eval $(call BuildPackage,alleato-scheduler))
|
||||
$(eval $(call BuildPackage,alleato-boxconfig))
|
||||
$(eval $(call BuildPackage,all-omc))
|
||||
$(eval $(call BuildPackage,ubus-kicker))
|
||||
$(eval $(call BuildPackage,mqttnagios))
|
||||
$(eval $(call BuildPackage,all4-alleato-tools))
|
||||
@@ -1,135 +0,0 @@
|
||||
AJ_SERVICE:=config
|
||||
AJ_SERVICE_NAME:=Config
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=alljoyn-$(AJ_SERVICE)
|
||||
PKG_BASE_VERSION:=14.12
|
||||
PKG_PATCHLEVEL:=.00
|
||||
PKG_RELEASE:=1
|
||||
PKG_MD5SUM:=389c2623619281e6849da25cee7e1bb7
|
||||
PKG_VERSION:=$(PKG_BASE_VERSION)$(PKG_PATCHLEVEL)
|
||||
PKG_TARBALL_VERSION:=$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/alljoyn-services-$(PKG_TARBALL_VERSION)-src
|
||||
PKG_SOURCE:=alljoyn-services-$(PKG_TARBALL_VERSION)-src.tar.gz
|
||||
PKG_SOURCE_URL:=https://allseenalliance.org/releases/alljoyn/$(PKG_BASE_VERSION)/
|
||||
|
||||
|
||||
# SCons supports parallel builds but does not support make's jobserver
|
||||
PKG_BUILD_PARALLEL:=$(if $(CONFIG_PKG_BUILD_USE_JOBSERVER),0,1)
|
||||
|
||||
PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_$(PKG_NAME)-samples
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
ifneq ($(CONFIG_CCACHE),)
|
||||
TARGET_CC=$(TARGET_CC_NOCACHE)
|
||||
TARGET_CXX=$(TARGET_CXX_NOCACHE)
|
||||
endif
|
||||
|
||||
ALLJOYN_BINDINGS:=cpp,
|
||||
ALLJOYN_BUILD_SERVICES_SAMPLES:=off
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
TITLE:=AllJoyn $(AJ_SERVICE_NAME) service library
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
DEPENDS:=alljoyn \
|
||||
+alljoyn-about
|
||||
URL:=http://www.allseenalliance.org
|
||||
MAINTAINER:=AllSeen Alliance <allseen-core@lists.allseenalliance.org>
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
AllJoyn $(AJ_SERVICE_NAME) service library.
|
||||
endef
|
||||
|
||||
|
||||
define Package/$(PKG_NAME)-samples
|
||||
$(call Package/$(PKG_NAME))
|
||||
TITLE+=- testing samples
|
||||
DEPENDS:=$(PKG_NAME) \
|
||||
+alljoyn-services_common
|
||||
MENU:=0
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)-samples/description
|
||||
Alljoyn $(AJ_SERVICE_NAME) service library samples. (This is primarily for testing.
|
||||
The contents of this package vary according which other alljoyn packages
|
||||
are selected.)
|
||||
endef
|
||||
|
||||
|
||||
ifeq ($(CONFIG_DEBUG),y)
|
||||
ALLJOYN_BUILD_VARIANT:=debug
|
||||
else
|
||||
ALLJOYN_BUILD_VARIANT:=release
|
||||
endif
|
||||
|
||||
|
||||
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/services/base/$(AJ_SERVICE)/build/openwrt/openwrt/$(ALLJOYN_BUILD_VARIANT)/dist/$(AJ_SERVICE)
|
||||
|
||||
TARGET_CFLAGS+=-fPIC
|
||||
TARGET_CPPFLAGS+=-fPIC
|
||||
|
||||
ifdef CONFIG_PACKAGE_$(PKG_NAME)-samples
|
||||
ifdef CONFIG_PACKAGE_alljoyn-about
|
||||
ALLJOYN_BUILD_SERVICES_SAMPLES:=on
|
||||
endif
|
||||
endif
|
||||
|
||||
define Build/Configure/Default
|
||||
# Override default to do nothing
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
scons -C $(PKG_BUILD_DIR)/services/base/$(AJ_SERVICE) \
|
||||
$(PKG_JOBS) \
|
||||
WS=off \
|
||||
CPU=openwrt \
|
||||
OS=openwrt \
|
||||
"BINDINGS=$(ALLJOYN_BINDINGS)" \
|
||||
"BUILD_SERVICES_SAMPLES=$(ALLJOYN_BUILD_SERVICES_SAMPLES)" \
|
||||
"VARIANT=$(ALLJOYN_BUILD_VARIANT)" \
|
||||
BR=off \
|
||||
BT=off \
|
||||
ICE=off \
|
||||
"TARGET_CC=$$(TARGET_CC)" \
|
||||
"TARGET_CXX=$$(TARGET_CXX)" \
|
||||
"TARGET_CFLAGS=$$(TARGET_CFLAGS)" \
|
||||
"TARGET_CPPFLAGS=$$(TARGET_CPPFLAGS)" \
|
||||
"TARGET_PATH=$$(TARGET_PATH)" \
|
||||
"TARGET_LINKFLAGS=$$(TARGET_LDFLAGS)" \
|
||||
"TARGET_LINK=$$(TARGET_CC)" \
|
||||
"TARGET_AR=$$(TARGET_AR)" \
|
||||
"TARGET_RANLIB=$$(TARGET_RANLIB)" \
|
||||
"STAGING_DIR=$$(STAGING_DIR)"
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include/alljoyn/$(AJ_SERVICE)
|
||||
$(CP) $(PKG_INSTALL_DIR)/inc/alljoyn/$(AJ_SERVICE)/*.h $(1)/usr/include/alljoyn/$(AJ_SERVICE)
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/lib/liballjoyn_$(AJ_SERVICE).a $(1)/usr/lib/
|
||||
$(CP) $(PKG_INSTALL_DIR)/lib/liballjoyn_$(AJ_SERVICE).so $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/lib/liballjoyn_$(AJ_SERVICE).so $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
|
||||
define Package/$(PKG_NAME)-samples/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/bin/* $(1)/usr/bin/
|
||||
$(INSTALL_DIR) $(1)/etc/alljoyn-config
|
||||
$(CP) $(PKG_BUILD_DIR)/services/base/config/cpp/samples/ConfigServiceSample/ConfigService.conf $(1)/etc/alljoyn-config/
|
||||
endef
|
||||
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)-samples))
|
||||
|
||||
@@ -1,133 +0,0 @@
|
||||
AJ_SERVICE:=controlpanel
|
||||
AJ_SERVICE_NAME:=ControlPanel
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=alljoyn-$(AJ_SERVICE)
|
||||
PKG_BASE_VERSION:=14.12
|
||||
PKG_PATCHLEVEL:=.00
|
||||
PKG_RELEASE:=1
|
||||
PKG_MD5SUM:=389c2623619281e6849da25cee7e1bb7
|
||||
PKG_VERSION:=$(PKG_BASE_VERSION)$(PKG_PATCHLEVEL)
|
||||
PKG_TARBALL_VERSION:=$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/alljoyn-services-$(PKG_TARBALL_VERSION)-src
|
||||
PKG_SOURCE:=alljoyn-services-$(PKG_TARBALL_VERSION)-src.tar.gz
|
||||
PKG_SOURCE_URL:=https://allseenalliance.org/releases/alljoyn/$(PKG_BASE_VERSION)/
|
||||
|
||||
# SCons supports parallel builds but does not support make's jobserver
|
||||
PKG_BUILD_PARALLEL:=$(if $(CONFIG_PKG_BUILD_USE_JOBSERVER),0,1)
|
||||
|
||||
PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_$(PKG_NAME)-samples
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
ifneq ($(CONFIG_CCACHE),)
|
||||
TARGET_CC=$(TARGET_CC_NOCACHE)
|
||||
TARGET_CXX=$(TARGET_CXX_NOCACHE)
|
||||
endif
|
||||
|
||||
ALLJOYN_BINDINGS:=cpp,
|
||||
ALLJOYN_BUILD_SERVICES_SAMPLES:=off
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
TITLE:=AllJoyn $(AJ_SERVICE_NAME) service library
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
DEPENDS:=alljoyn
|
||||
URL:=http://www.allseenalliance.org
|
||||
MAINTAINER:=AllSeen Alliance <allseen-core@lists.allseenalliance.org>
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
AllJoyn $(AJ_SERVICE_NAME) service library.
|
||||
endef
|
||||
|
||||
|
||||
define Package/$(PKG_NAME)-samples
|
||||
$(call Package/$(PKG_NAME))
|
||||
TITLE+=- testing samples
|
||||
DEPENDS:=$(PKG_NAME) \
|
||||
+alljoyn-about \
|
||||
+alljoyn-notification \
|
||||
+alljoyn-services_common
|
||||
MENU:=0
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)-samples/description
|
||||
Alljoyn $(AJ_SERVICE_NAME) service library samples. (This is primarily for testing.
|
||||
The contents of this package vary according which other alljoyn packages
|
||||
are selected.)
|
||||
endef
|
||||
|
||||
|
||||
ifeq ($(CONFIG_DEBUG),y)
|
||||
ALLJOYN_BUILD_VARIANT:=debug
|
||||
else
|
||||
ALLJOYN_BUILD_VARIANT:=release
|
||||
endif
|
||||
|
||||
|
||||
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/services/base/$(AJ_SERVICE)/build/openwrt/openwrt/$(ALLJOYN_BUILD_VARIANT)/dist/$(AJ_SERVICE)
|
||||
|
||||
TARGET_CFLAGS+=-fPIC
|
||||
TARGET_CPPFLAGS+=-fPIC
|
||||
|
||||
ifdef CONFIG_PACKAGE_$(PKG_NAME)-samples
|
||||
ifdef CONFIG_PACKAGE_alljoyn-about
|
||||
ALLJOYN_BUILD_SERVICES_SAMPLES:=on
|
||||
endif
|
||||
endif
|
||||
|
||||
define Build/Configure/Default
|
||||
# Override default to do nothing
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
scons -C $(PKG_BUILD_DIR)/services/base/$(AJ_SERVICE) \
|
||||
$(PKG_JOBS) \
|
||||
WS=off \
|
||||
CPU=openwrt \
|
||||
OS=openwrt \
|
||||
"BINDINGS=$(ALLJOYN_BINDINGS)" \
|
||||
"BUILD_SERVICES_SAMPLES=$(ALLJOYN_BUILD_SERVICES_SAMPLES)" \
|
||||
"VARIANT=$(ALLJOYN_BUILD_VARIANT)" \
|
||||
BR=off \
|
||||
BT=off \
|
||||
ICE=off \
|
||||
"TARGET_CC=$$(TARGET_CC)" \
|
||||
"TARGET_CXX=$$(TARGET_CXX)" \
|
||||
"TARGET_CFLAGS=$$(TARGET_CFLAGS)" \
|
||||
"TARGET_CPPFLAGS=$$(TARGET_CPPFLAGS)" \
|
||||
"TARGET_PATH=$$(TARGET_PATH)" \
|
||||
"TARGET_LINKFLAGS=$$(TARGET_LDFLAGS)" \
|
||||
"TARGET_LINK=$$(TARGET_CC)" \
|
||||
"TARGET_AR=$$(TARGET_AR)" \
|
||||
"TARGET_RANLIB=$$(TARGET_RANLIB)" \
|
||||
"STAGING_DIR=$$(STAGING_DIR)"
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include/alljoyn/$(AJ_SERVICE)
|
||||
$(CP) $(PKG_INSTALL_DIR)/inc/alljoyn/$(AJ_SERVICE)/*.h $(1)/usr/include/alljoyn/$(AJ_SERVICE)
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/lib/liballjoyn_$(AJ_SERVICE).a $(1)/usr/lib/
|
||||
$(CP) $(PKG_INSTALL_DIR)/lib/liballjoyn_$(AJ_SERVICE).so $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/lib/liballjoyn_$(AJ_SERVICE).so $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
|
||||
define Package/$(PKG_NAME)-samples/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/bin/* $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)-samples))
|
||||
|
||||
@@ -1,132 +0,0 @@
|
||||
AJ_SERVICE:=notification
|
||||
AJ_SERVICE_NAME:=Notification
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=alljoyn-$(AJ_SERVICE)
|
||||
PKG_BASE_VERSION:=14.12
|
||||
PKG_PATCHLEVEL:=.00
|
||||
PKG_RELEASE:=1
|
||||
PKG_MD5SUM:=389c2623619281e6849da25cee7e1bb7
|
||||
PKG_VERSION:=$(PKG_BASE_VERSION)$(PKG_PATCHLEVEL)
|
||||
PKG_TARBALL_VERSION:=$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/alljoyn-services-$(PKG_TARBALL_VERSION)-src
|
||||
PKG_SOURCE:=alljoyn-services-$(PKG_TARBALL_VERSION)-src.tar.gz
|
||||
PKG_SOURCE_URL:=https://allseenalliance.org/releases/alljoyn/$(PKG_BASE_VERSION)/
|
||||
|
||||
# SCons supports parallel builds but does not support make's jobserver
|
||||
PKG_BUILD_PARALLEL:=$(if $(CONFIG_PKG_BUILD_USE_JOBSERVER),0,1)
|
||||
|
||||
PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_$(PKG_NAME)-samples
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
ifneq ($(CONFIG_CCACHE),)
|
||||
TARGET_CC=$(TARGET_CC_NOCACHE)
|
||||
TARGET_CXX=$(TARGET_CXX_NOCACHE)
|
||||
endif
|
||||
|
||||
ALLJOYN_BINDINGS:=cpp,
|
||||
ALLJOYN_BUILD_SERVICES_SAMPLES:=off
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
TITLE:=AllJoyn $(AJ_SERVICE_NAME) service library
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
DEPENDS:=alljoyn \
|
||||
+alljoyn-about
|
||||
URL:=http://www.allseenalliance.org
|
||||
MAINTAINER:=AllSeen Alliance <allseen-core@lists.allseenalliance.org>
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
AllJoyn $(AJ_SERVICE_NAME) service library.
|
||||
endef
|
||||
|
||||
|
||||
define Package/$(PKG_NAME)-samples
|
||||
$(call Package/$(PKG_NAME))
|
||||
TITLE+=- testing samples
|
||||
DEPENDS:=$(PKG_NAME) \
|
||||
+alljoyn-services_common
|
||||
MENU:=0
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)-samples/description
|
||||
Alljoyn $(AJ_SERVICE_NAME) service library samples. (This is primarily for testing.
|
||||
The contents of this package vary according which other alljoyn packages
|
||||
are selected.)
|
||||
endef
|
||||
|
||||
|
||||
ifeq ($(CONFIG_DEBUG),y)
|
||||
ALLJOYN_BUILD_VARIANT:=debug
|
||||
else
|
||||
ALLJOYN_BUILD_VARIANT:=release
|
||||
endif
|
||||
|
||||
|
||||
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/services/base/$(AJ_SERVICE)/build/openwrt/openwrt/$(ALLJOYN_BUILD_VARIANT)/dist/$(AJ_SERVICE)
|
||||
|
||||
TARGET_CFLAGS+=-fPIC
|
||||
TARGET_CPPFLAGS+=-fPIC
|
||||
|
||||
ifdef CONFIG_PACKAGE_$(PKG_NAME)-samples
|
||||
ifdef CONFIG_PACKAGE_alljoyn-about
|
||||
ALLJOYN_BUILD_SERVICES_SAMPLES:=on
|
||||
endif
|
||||
endif
|
||||
|
||||
define Build/Configure/Default
|
||||
# Override default to do nothing
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
scons -C $(PKG_BUILD_DIR)/services/base/$(AJ_SERVICE) \
|
||||
$(PKG_JOBS) \
|
||||
WS=off \
|
||||
CPU=openwrt \
|
||||
OS=openwrt \
|
||||
"BINDINGS=$(ALLJOYN_BINDINGS)" \
|
||||
"BUILD_SERVICES_SAMPLES=$(ALLJOYN_BUILD_SERVICES_SAMPLES)" \
|
||||
"VARIANT=$(ALLJOYN_BUILD_VARIANT)" \
|
||||
BR=off \
|
||||
BT=off \
|
||||
ICE=off \
|
||||
"TARGET_CC=$$(TARGET_CC)" \
|
||||
"TARGET_CXX=$$(TARGET_CXX)" \
|
||||
"TARGET_CFLAGS=$$(TARGET_CFLAGS)" \
|
||||
"TARGET_CPPFLAGS=$$(TARGET_CPPFLAGS)" \
|
||||
"TARGET_PATH=$$(TARGET_PATH)" \
|
||||
"TARGET_LINKFLAGS=$$(TARGET_LDFLAGS)" \
|
||||
"TARGET_LINK=$$(TARGET_CC)" \
|
||||
"TARGET_AR=$$(TARGET_AR)" \
|
||||
"TARGET_RANLIB=$$(TARGET_RANLIB)" \
|
||||
"STAGING_DIR=$$(STAGING_DIR)"
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include/alljoyn/$(AJ_SERVICE)
|
||||
$(CP) $(PKG_INSTALL_DIR)/inc/alljoyn/$(AJ_SERVICE)/*.h $(1)/usr/include/alljoyn/$(AJ_SERVICE)
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/lib/liballjoyn_$(AJ_SERVICE).a $(1)/usr/lib/
|
||||
$(CP) $(PKG_INSTALL_DIR)/lib/liballjoyn_$(AJ_SERVICE).so $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/lib/liballjoyn_$(AJ_SERVICE).so $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
|
||||
define Package/$(PKG_NAME)-samples/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/bin/* $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)-samples))
|
||||
|
||||
@@ -1,160 +0,0 @@
|
||||
AJ_SERVICE:=onboarding
|
||||
AJ_SERVICE_NAME:=onboarding
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=alljoyn-$(AJ_SERVICE)
|
||||
PKG_BASE_VERSION:=14.12
|
||||
PKG_PATCHLEVEL:=.00
|
||||
PKG_RELEASE:=1
|
||||
PKG_MD5SUM:=389c2623619281e6849da25cee7e1bb7
|
||||
PKG_VERSION:=$(PKG_BASE_VERSION)$(PKG_PATCHLEVEL)
|
||||
PKG_TARBALL_VERSION:=$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/alljoyn-services-$(PKG_TARBALL_VERSION)-src
|
||||
PKG_SOURCE:=alljoyn-services-$(PKG_TARBALL_VERSION)-src.tar.gz
|
||||
PKG_SOURCE_URL:=https://allseenalliance.org/releases/alljoyn/$(PKG_BASE_VERSION)/
|
||||
|
||||
# SCons supports parallel builds but does not support make's jobserver
|
||||
PKG_BUILD_PARALLEL:=$(if $(CONFIG_PKG_BUILD_USE_JOBSERVER),0,1)
|
||||
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
ifneq ($(CONFIG_CCACHE),)
|
||||
TARGET_CC=$(TARGET_CC_NOCACHE)
|
||||
TARGET_CXX=$(TARGET_CXX_NOCACHE)
|
||||
endif
|
||||
|
||||
ALLJOYN_BINDINGS:=cpp,
|
||||
|
||||
# Due to inherited dependencies (onboarding package depends on wpa-cli package and therefore inherits its dependencies)
|
||||
# the onboarding package will not be visible for selection unless the wpa-supplicant package is first selected
|
||||
define Package/$(PKG_NAME)
|
||||
TITLE:=AllJoyn $(AJ_SERVICE_NAME) service library
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
DEPENDS:=alljoyn \
|
||||
wpa-supplicant \
|
||||
+alljoyn-about \
|
||||
+alljoyn-config \
|
||||
+alljoyn-services_common \
|
||||
+hostapd \
|
||||
+wpa-cli
|
||||
URL:=http://www.allseenalliance.org
|
||||
MAINTAINER:=AllSeen Alliance <allseen-core@lists.allseenalliance.org>
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
AllJoyn $(AJ_SERVICE_NAME) service.
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_DEBUG),y)
|
||||
ALLJOYN_BUILD_VARIANT:=debug
|
||||
else
|
||||
ALLJOYN_BUILD_VARIANT:=release
|
||||
endif
|
||||
|
||||
|
||||
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/services/base/$(AJ_SERVICE)/build/openwrt/openwrt/$(ALLJOYN_BUILD_VARIANT)/dist/$(AJ_SERVICE)
|
||||
|
||||
TARGET_CFLAGS+=-fPIC
|
||||
TARGET_CPPFLAGS+=-fPIC
|
||||
TARGET_LDFLAGS+=-lpthread -lrt
|
||||
|
||||
define Build/Configure/Default
|
||||
# Override default to do nothing
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
scons -C $(PKG_BUILD_DIR)/services/base/$(AJ_SERVICE) \
|
||||
$(PKG_JOBS) \
|
||||
WS=off \
|
||||
CPU=openwrt \
|
||||
OS=openwrt \
|
||||
"BINDINGS=$(ALLJOYN_BINDINGS)" \
|
||||
"BUILD_SERVICES_SAMPLES=off" \
|
||||
"VARIANT=$(ALLJOYN_BUILD_VARIANT)" \
|
||||
BR=off \
|
||||
BT=off \
|
||||
ICE=off \
|
||||
"TARGET_CC=$$(TARGET_CC)" \
|
||||
"TARGET_CXX=$$(TARGET_CXX)" \
|
||||
"TARGET_CFLAGS=$$(TARGET_CFLAGS)" \
|
||||
"TARGET_CPPFLAGS=$$(TARGET_CPPFLAGS)" \
|
||||
"TARGET_PATH=$$(TARGET_PATH)" \
|
||||
"TARGET_LINKFLAGS=$$(TARGET_LDFLAGS)" \
|
||||
"TARGET_LINK=$$(TARGET_CC)" \
|
||||
"TARGET_AR=$$(TARGET_AR)" \
|
||||
"TARGET_RANLIB=$$(TARGET_RANLIB)" \
|
||||
"STAGING_DIR=$$(STAGING_DIR)"
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include/alljoyn/$(AJ_SERVICE)
|
||||
$(CP) $(PKG_INSTALL_DIR)/inc/alljoyn/$(AJ_SERVICE)/*.h $(1)/usr/include/alljoyn/$(AJ_SERVICE)
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/lib/liballjoyn_$(AJ_SERVICE).a $(1)/usr/lib/
|
||||
$(CP) $(PKG_INSTALL_DIR)/lib/liballjoyn_$(AJ_SERVICE).so $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/lib/liballjoyn_$(AJ_SERVICE).so $(1)/usr/lib/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/bin/onboarding-daemon $(1)/usr/bin/
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/alljoyn-onboarding.init $(1)/etc/init.d/alljoyn-onboarding
|
||||
$(INSTALL_BIN) ./files/alljoyn-onboarding-reload.init $(1)/etc/init.d/alljoyn-onboarding-reload
|
||||
$(INSTALL_BIN) ./files/wifi_scan.init $(1)/etc/init.d/wifi_scan
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/alljoyn-onboarding.defaults $(1)/etc/uci-defaults/alljoyn-onboarding
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) ./files/alljoyn-onboarding.config $(1)/etc/config/alljoyn-onboarding
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) ./files/wifi_scan $(1)/usr/sbin/wifi_scan
|
||||
$(INSTALL_BIN) ./files/parse_iw_wifi_scan $(1)/usr/sbin/parse_iw_wifi_scan
|
||||
$(INSTALL_BIN) ./files/parse_iwlist_wifi_scan $(1)/usr/sbin/parse_iwlist_wifi_scan
|
||||
$(INSTALL_BIN) ./files/wifi_mgmt $(1)/usr/sbin/wifi_mgmt
|
||||
$(INSTALL_DIR) $(1)/etc/alljoyn-onboarding
|
||||
$(INSTALL_CONF) ./files/alljoyn-onboarding.state $(1)/etc/alljoyn-onboarding/alljoyn-onboarding-state
|
||||
$(CP) $(PKG_BUILD_DIR)/services/base/onboarding/cpp/src/OnboardingDaemon/OnboardingService.conf $(1)/etc/alljoyn-onboarding/
|
||||
$(CP) $(PKG_BUILD_DIR)/services/base/onboarding/cpp/src/OnboardingDaemon/FactoryOnboardingService.conf $(1)/etc/alljoyn-onboarding/
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/postinst
|
||||
#!/bin/sh
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
. /etc/uci-defaults/alljoyn-onboarding
|
||||
rm -f /etc/uci-defaults/alljoyn-onboarding
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/prerm
|
||||
#!/bin/sh
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
/etc/init.d/alljoyn-onboarding stop
|
||||
/etc/init.d/alljoyn-onboarding disable
|
||||
/etc/init.d/wifi_scan disable
|
||||
/etc/init.d/alljoyn-onboarding-reload disable
|
||||
crontab -l 2>/dev/null | sed '/\/etc\/init.d\/alljoyn-onboarding/d' | crontab -
|
||||
crontab -l 2>/dev/null | sed '/\/usr\/sbin\/wifi_scan/d' | crontab -
|
||||
local obswifiIndex=$(uci show /etc/config/firewall | grep obswifi | grep name | cut -d"[" -f2 | cut -c1)
|
||||
uci delete firewall.@zone[$(obswifiIndex)]
|
||||
uci commit firewall
|
||||
uci batch <<EOF
|
||||
del_list ucitrack.@alljoyn[-1].affects=alljoyn-onboarding
|
||||
delete ucitrack.@alljoyn-onboarding[-1]
|
||||
commit ucitrack
|
||||
EOF
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
# Copyright (c) 2013 - 2014, AllSeen Alliance. All rights reserved.
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
#
|
||||
|
||||
START=58
|
||||
|
||||
RADIO_24G=
|
||||
find_2_4_radio() {
|
||||
local cfg=$1
|
||||
|
||||
#list of known wireless protocols
|
||||
local validModes="11b 11g 11a 11ng 11na"
|
||||
|
||||
# get the current hwmode
|
||||
local hwmode
|
||||
config_get hwmode "$cfg" hwmode
|
||||
|
||||
# verify that the hwmode is one of the valid modes
|
||||
local hasMode=`echo "$validModes" | grep $hwmode`
|
||||
if [ -n "$hasMode" ]; then
|
||||
RADIO_24G=$cfg
|
||||
fi
|
||||
}
|
||||
|
||||
APVAP_24G=
|
||||
find_2_4_apvap() {
|
||||
local cfg=$1
|
||||
local radio=$2
|
||||
|
||||
local mode
|
||||
config_get mode "$cfg" mode
|
||||
local device
|
||||
config_get device "$cfg" device
|
||||
|
||||
[ "$mode" = "ap" -a "$device" = "$radio" ] && \
|
||||
APVAP_24G="$cfg"
|
||||
}
|
||||
|
||||
start() {
|
||||
config_load alljoyn-onboarding
|
||||
local state
|
||||
state=$(uci_get alljoyn-onboarding @onboarding[0] state)
|
||||
[ "${state}" = "3" ] && return 0
|
||||
|
||||
local iface=$(cat /proc/net/wireless | grep -m 1 : | sed -e 's/:.*//' | sed -e 's/ //g')
|
||||
local macaddr=$(cat /sys/class/net/$iface/address)
|
||||
|
||||
# save the ssid in case it gets overwritten and we need it again
|
||||
uci_set alljoyn-onboarding @onboarding[0] apssid "AJ_OpenWRT ${macaddr}"
|
||||
uci_commit alljoyn-onboarding
|
||||
|
||||
config_load wireless
|
||||
|
||||
config_foreach find_2_4_radio wifi-device
|
||||
[ -z "${RADIO_24G}" ] && {
|
||||
echo "Error: No 2.4GHz radio found"
|
||||
return 1
|
||||
}
|
||||
|
||||
config_foreach find_2_4_apvap wifi-iface ${RADIO_24G}
|
||||
[ -z "${APVAP_24G}" ] && {
|
||||
echo "Error: No 2.4GHz AP VAP found"
|
||||
return 1
|
||||
}
|
||||
|
||||
# Ok, now we start setting the configuration parameters
|
||||
uci_set wireless ${RADIO_24G} disabled 0
|
||||
uci_set wireless ${RADIO_24G} channel 6
|
||||
uci_set wireless ${APVAP_24G} ssid "AJ_OpenWRT ${macaddr}"
|
||||
uci_commit wireless
|
||||
wifi
|
||||
|
||||
# Add other appropriate tasks when device is not fully configured
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
# Option Values:
|
||||
#
|
||||
# option apssid The access point name as seen by the onboarder application.
|
||||
# Note: In order for Alljoyn to detect the access point the name must start with prefix 'AJ_'
|
||||
# option apencryption The cypher mode
|
||||
# For the full list refer to http://wiki.openwrt.org/doc/uci/wireless#wpa.modes
|
||||
# Example - WPA2 would be: option apencryption 'psk2+tkip+ccmp'
|
||||
# option apkey Cypher key for connecting to the access point
|
||||
# option aphidden Determines whether the softAp will be hidden or broadcast. Default is 0 - not hidden
|
||||
|
||||
config onboarding
|
||||
option apssid 'AJ_OpenWRT'
|
||||
option apencryption 'none'
|
||||
option apkey ''
|
||||
option aphidden '0'
|
||||
@@ -1,33 +0,0 @@
|
||||
#! /bin/sh
|
||||
local hasOnboarding=$(uci get ucitrack.@alljoyn-onboarding[-1] 2> /dev/null)
|
||||
if [ -z "$hasOnboarding" ]; then
|
||||
uci batch <<EOF
|
||||
add ucitrack alljoyn-onboarding
|
||||
set ucitrack.@alljoyn-onboarding[-1].init=alljoyn-onboarding
|
||||
add_list ucitrack.@alljoyn[-1].affects=alljoyn-onboarding
|
||||
commit ucitrack
|
||||
EOF
|
||||
fi
|
||||
uci batch <<EOF
|
||||
set wireless.@wifi-device[-1].disabled=0
|
||||
set wireless.@wifi-iface[-1].disabled=0
|
||||
commit wireless
|
||||
EOF
|
||||
local hasObswifi=$(uci show /etc/config/firewall | grep obswifi)
|
||||
if [ -z "$hasObswifi" ]; then
|
||||
uci batch <<EOF
|
||||
add firewall zone
|
||||
set firewall.@zone[-1].name=obswifi
|
||||
add_list firewall.@zone[-1].network='obswifi'
|
||||
set firewall.@zone[-1].input=ACCEPT
|
||||
set firewall.@zone[-1].output=ACCEPT
|
||||
set firewall.@zone[-1].forward=ACCEPT
|
||||
commit firewall
|
||||
EOF
|
||||
fi
|
||||
/etc/init.d/alljoyn-onboarding enable
|
||||
/etc/init.d/wifi_scan enable
|
||||
/etc/init.d/alljoyn-onboarding-reload enable
|
||||
crontab -l 2>/dev/null | sed '/\/etc\/init.d\/alljoyn-onboarding/d' | echo '*/1 * * * * /etc/init.d/alljoyn-onboarding poll_connection' | crontab -
|
||||
/etc/init.d/cron enable
|
||||
exit 0
|
||||
@@ -1,199 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
# Copyright (c) 2013 - 2014, AllSeen Alliance. All rights reserved.
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
#
|
||||
|
||||
. /usr/sbin/wifi_mgmt
|
||||
|
||||
START=66
|
||||
SERVICE_DAEMONIZE=1
|
||||
SERVICE_WRITE_PID=1
|
||||
CONFIGFILE=/etc/alljoyn-onboarding/OnboardingService.conf
|
||||
FACTORYCONFIGFILE=/etc/alljoyn-onboarding/FactoryOnboardingService.conf
|
||||
|
||||
EXTRA_COMMANDS="state error connect softap offboard configure validate reset retry poll_connection"
|
||||
EXTRA_HELP=<<EOF
|
||||
state Get onboarding state
|
||||
error Get onboarding error
|
||||
connect Connect to AP with provided configuration
|
||||
softap Disconnect from AP and enable soft AP
|
||||
offboard softap + wipe configuration
|
||||
configure Configure device with personal AP credentials
|
||||
validate Validate the provided configuration
|
||||
reset Reset the radio
|
||||
retry Enter SoftAP mode temporarily to allow reconfig
|
||||
poll_connection Poll the status of the connection
|
||||
EOF
|
||||
|
||||
STATE_NOTCONFIGURED=0
|
||||
STATE_CONFIGURED=1
|
||||
STATE_VALIDATING=2
|
||||
STATE_VALIDATED=3
|
||||
STATE_ERROR=4
|
||||
STATE_RETRY=5
|
||||
|
||||
boot() {
|
||||
local obswifi=$(uci get network.obswifi)
|
||||
if [ -z "$obswifi" ]; then
|
||||
uci set network.obswifi=interface
|
||||
uci set network.obswifi.proto=dhcp
|
||||
uci commit network
|
||||
/etc/init.d/network reload
|
||||
fi
|
||||
|
||||
start
|
||||
}
|
||||
|
||||
start() {
|
||||
cache_state
|
||||
cache_error
|
||||
connect
|
||||
service_start /usr/bin/onboarding-daemon --config-file=$CONFIGFILE --factory-config-file=$FACTORYCONFIGFILE
|
||||
}
|
||||
|
||||
stop() {
|
||||
service_stop /usr/bin/onboarding-daemon
|
||||
}
|
||||
|
||||
state() {
|
||||
return $(uci get -c /etc/alljoyn-onboarding alljoyn-onboarding-state.@onboarding[0].state)
|
||||
}
|
||||
|
||||
error() {
|
||||
return $(uci get -c /etc/alljoyn-onboarding alljoyn-onboarding-state.@onboarding[0].lasterrorcode)
|
||||
}
|
||||
|
||||
connect() {
|
||||
local state="$(uci get -c /etc/alljoyn-onboarding alljoyn-onboarding-state.@onboarding[0].state)"
|
||||
|
||||
if [ ${state} -eq $STATE_NOTCONFIGURED ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ${state} -eq $STATE_CONFIGURED ] || [ ${state} -eq $STATE_ERROR ]; then
|
||||
validate
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ${state} -eq $STATE_VALIDATING ]; then
|
||||
retries=2
|
||||
else
|
||||
retries=$(uci get -c /etc/alljoyn-onboarding alljoyn-onboarding-state.@onboarding[0].connect_retry_max)
|
||||
fi
|
||||
|
||||
local status=$ERROR_NONE
|
||||
while [ $retries -gt 0 ]; do
|
||||
wifi_connect
|
||||
sleep 2
|
||||
wifi_connect_status
|
||||
status=$?
|
||||
echo "status: $status"
|
||||
if [ ${status} -eq $ERROR_NONE ]; then
|
||||
set_state $STATE_VALIDATED
|
||||
return $status
|
||||
else
|
||||
retries=$((--retries))
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ${state} -eq $STATE_VALIDATED ] || [ ${state} -eq $STATE_RETRY ]; then
|
||||
if [ $(ps -w | grep "/etc/init.d/alljoyn-onboarding retry" | grep -v "grep" | wc -l) -eq 0 ]; then
|
||||
/etc/init.d/alljoyn-onboarding retry &
|
||||
status=$((status+8)) # set a bit saying we are in retry
|
||||
fi
|
||||
elif [ ${state} -eq ${STATE_VALIDATING} ]; then
|
||||
set_state $STATE_ERROR
|
||||
softap
|
||||
fi
|
||||
|
||||
return $status
|
||||
}
|
||||
|
||||
offboard() {
|
||||
set_state $STATE_NOTCONFIGURED
|
||||
softap
|
||||
uci delete alljoyn-onboarding.@onboarding[0].ssid
|
||||
uci delete alljoyn-onboarding.@onboarding[0].encryption
|
||||
uci delete alljoyn-onboarding.@onboarding[0].key
|
||||
uci commit alljoyn-onboarding
|
||||
set_error $ERROR_NONE "Unconfigured"
|
||||
}
|
||||
|
||||
softap() {
|
||||
wifi_softap
|
||||
}
|
||||
|
||||
reset() {
|
||||
wifi_reset
|
||||
}
|
||||
|
||||
retry() {
|
||||
echo "STATE_RETRY"
|
||||
set_state $STATE_RETRY
|
||||
local retry_duration="$(uci get -c /etc/alljoyn-onboarding alljoyn-onboarding-state.@onboarding[0].config_retry_duration)"
|
||||
softap
|
||||
sleep $retry_duration
|
||||
local state="$(uci get -c /etc/alljoyn-onboarding alljoyn-onboarding-state.@onboarding[0].state)"
|
||||
if [ ${state} -eq $STATE_RETRY ]; then
|
||||
/etc/init.d/alljoyn-onboarding connect &
|
||||
fi
|
||||
}
|
||||
|
||||
configure() {
|
||||
local codeoption="-p"
|
||||
if [ "$2" = "WEP" ]; then
|
||||
codeoption="-k"
|
||||
fi
|
||||
wifi_configure -s "$1" -a "$2" $codeoption "$3"
|
||||
set_state $STATE_CONFIGURED
|
||||
}
|
||||
|
||||
validate() {
|
||||
set_state $STATE_VALIDATING
|
||||
connect
|
||||
}
|
||||
|
||||
set_state() {
|
||||
uci set -c /etc/alljoyn-onboarding alljoyn-onboarding-state.@onboarding[0].state=$1
|
||||
uci commit -c /etc/alljoyn-onboarding alljoyn-onboarding-state
|
||||
cache_state $1
|
||||
}
|
||||
|
||||
cache_state(){
|
||||
local state="$(uci get -c /etc/alljoyn-onboarding alljoyn-onboarding-state.@onboarding[0].state)"
|
||||
printf '%d\n' "$state" > /tmp/state/alljoyn-onboarding
|
||||
}
|
||||
|
||||
cache_error() {
|
||||
local code=$(uci get -c /etc/alljoyn-onboarding alljoyn-onboarding-state.@onboarding[0].lasterrorcode)
|
||||
local msg=$(uci get -c /etc/alljoyn-onboarding alljoyn-onboarding-state.@onboarding[0].lasterrormsg)
|
||||
printf '%s\n%s' "$code" "$msg" > /tmp/state/alljoyn-onboarding-lasterror
|
||||
}
|
||||
|
||||
poll_connection() {
|
||||
local state="$(uci get -c /etc/alljoyn-onboarding alljoyn-onboarding-state.@onboarding[0].state)"
|
||||
if [ ${state} -eq $STATE_VALIDATED ]; then
|
||||
wifi_connect_status
|
||||
local status=$?
|
||||
if [ ${status} -ne $ERROR_NONE ]; then
|
||||
## check state again in case it changed since last get
|
||||
state="$(uci get -c /etc/alljoyn-onboarding alljoyn-onboarding-state.@onboarding[0].state)"
|
||||
if [ ${state} -ne $STATE_VALIDATED ]; then
|
||||
return
|
||||
fi
|
||||
/etc/init.d/alljoyn-onboarding connect &
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
config onboarding
|
||||
option state '0'
|
||||
option lasterrorcode '0'
|
||||
option lasterrormsg 'Unconfigured'
|
||||
option config_retry_duration '180'
|
||||
option connect_retry_max '2'
|
||||
@@ -1,89 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (c) 2014, AllSeen Alliance. All rights reserved.
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
#
|
||||
|
||||
device=`iw dev | grep Interface | cut -f 2 -s -d" "`
|
||||
# Sometimes right after boot, the device is not ready yet
|
||||
if [ -n $device ]; then
|
||||
iw $device scan |
|
||||
grep -e "^BSS" -e "signal:" -e "SSID:" -e "capability:" -e "RSN:" -e "WPA:" -e "Pairwise ciphers" -e "Authentication suites" |
|
||||
{
|
||||
while read -r line; do
|
||||
case "$line" in
|
||||
BSS* )
|
||||
## Handling a new SSID. Print out previously processed SSID only if it is defined.
|
||||
## Note the different syntax based on WPA/WPA2 VS Open or WEP
|
||||
if [ "$enc" == "Open" ] || [ "$enc" == "WEP" ]; then
|
||||
printf "%s\t%s\t%s\n" "$quality" "$enc" "$ssid"
|
||||
elif [ -n "$ssid" ]; then
|
||||
printf "%s\t%s-%s-%s-%s\t%s\n" "$quality" "$enc" "$ccmp" "$tkip" "$psk" "$ssid"
|
||||
fi
|
||||
|
||||
## Initialize the variables
|
||||
ssid=""
|
||||
enc="Open"
|
||||
ccmp=""
|
||||
tkip=""
|
||||
psk=""
|
||||
quality=""
|
||||
;;
|
||||
SSID:* )
|
||||
## Set the ssid variable
|
||||
ssid=$(echo "$line" | sed s/"SSID: "//)
|
||||
;;
|
||||
signal:* )
|
||||
## Set signal quality variable
|
||||
quality=$(echo "$line" | sed s/"signal: "//)
|
||||
;;
|
||||
capability:* )
|
||||
## Encryption is on. We assume it's WEP by default, if we later find out it's WPA or WPA2 we override it
|
||||
if [ $(echo $line | grep "Privacy" | wc -l) -ne 0 ]; then
|
||||
enc="WEP"
|
||||
fi
|
||||
;;
|
||||
RSN:* )
|
||||
## Set Encryption to be WPA2
|
||||
enc="WPA2"
|
||||
;;
|
||||
WPA* )
|
||||
enc="WPA"
|
||||
;;
|
||||
"* Pairwise ciphers:"* )
|
||||
## Set the appropriate cipher variables
|
||||
if [ $(echo $line | grep "CCMP" | wc -l) -ne 0 ]; then
|
||||
ccmp="CCMP"
|
||||
fi
|
||||
if [ $(echo $line | grep "TKIP" | wc -l) -ne 0 ]; then
|
||||
tkip="TKIP"
|
||||
fi
|
||||
;;
|
||||
"* Authentication suites:"* )
|
||||
## Set the appropriate Authentication Suite variable
|
||||
if [ $(echo $line | grep "PSK" | wc -l) -ne 0 ]; then
|
||||
psk="PSK";
|
||||
fi
|
||||
;;
|
||||
* ) ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$enc" == "Open" ] || [ "$enc" == "WEP" ]; then
|
||||
printf "%s\t%s\t%s\n" "$quality" "$enc" "$ssid"
|
||||
elif [ -n "$ssid" ]; then
|
||||
printf "%s\t%s-%s-%s-%s\t%s\n" "$quality" "$enc" "$ccmp" "$tkip" "$psk" "$ssid"
|
||||
fi
|
||||
}
|
||||
fi
|
||||
@@ -1,83 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (c) 2014, AllSeen Alliance. All rights reserved.
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
#
|
||||
|
||||
iwlist scanning 2> /dev/null |
|
||||
grep -e "Quality=" -e "ESSID:" -e "Encryption key:on" -e "IE:" -e "Pairwise Ciphers" -e "Authentication Suites" |
|
||||
{
|
||||
while read -r line; do
|
||||
case "$line" in
|
||||
ESSID:\"* )
|
||||
## Handling a new SSID. Print out previously processed SSID only if it is defined.
|
||||
## Note the different syntax based on WPA/WPA2 VS Open or WEP
|
||||
if [ "$enc" == "Open" ] || [ "$enc" == "WEP" ]; then
|
||||
printf "%s\t%s\t%s\n" "$quality" "$enc" "$ssid"
|
||||
elif [ -n "$ssid" ]; then
|
||||
printf "%s\t%s-%s-%s-%s\t%s\n" "$quality" "$enc" "$ccmp" "$tkip" "$psk" "$ssid"
|
||||
fi
|
||||
|
||||
## Initialize the variables
|
||||
ssid=$(echo "${line%?}" | sed s/ESSID:\"//)
|
||||
enc="Open"
|
||||
ccmp=""
|
||||
tkip=""
|
||||
psk=""
|
||||
quality=""
|
||||
;;
|
||||
Quality=* )
|
||||
## Set signal quality variables
|
||||
quality=$(echo "$line" | sed s/.*"Signal level="// | sed s/" dBm".*/" dBm"/)
|
||||
;;
|
||||
Encryption* )
|
||||
## Encryption is on. We assume it's WEP by default, if we later find out it's WPA or WPA2 we override it
|
||||
enc="WEP"
|
||||
;;
|
||||
IE:* )
|
||||
## Set Encryption to be WPA or WPA2
|
||||
case "$line" in
|
||||
*WPA2* )
|
||||
enc="WPA2"
|
||||
;;
|
||||
*WPA* )
|
||||
enc="WPA"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
Pairwise* )
|
||||
## Set the appropriate cipher variables
|
||||
if [ $(echo $line | grep "CCMP" | wc -l) -ne 0 ]; then
|
||||
ccmp="CCMP"
|
||||
fi
|
||||
if [ $(echo $line | grep "TKIP" | wc -l) -ne 0 ]; then
|
||||
tkip="TKIP"
|
||||
fi
|
||||
;;
|
||||
Authentication* )
|
||||
## Set the appropriate Authentication Suite variable
|
||||
if [ $(echo $line | grep "PSK" | wc -l) -ne 0 ]; then
|
||||
psk="PSK";
|
||||
fi
|
||||
;;
|
||||
* ) ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$enc" == "Open" ] || [ "$enc" == "WEP" ]; then
|
||||
printf "%s\t%s\t%s\n" "$quality" "$enc" "$ssid"
|
||||
elif [ -n "$ssid" ]; then
|
||||
printf "%s\t%s-%s-%s-%s\t%s\n" "$quality" "$enc" "$ccmp" "$tkip" "$psk" "$ssid"
|
||||
fi
|
||||
}
|
||||
@@ -1,337 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (c) 2013 - 2014, AllSeen Alliance. All rights reserved.
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
#
|
||||
|
||||
. /lib/config/uci.sh
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
DEBUG=
|
||||
|
||||
ERROR_NONE=0
|
||||
ERROR_UNREACHABLE=1
|
||||
ERROR_PROTOCOL=2
|
||||
ERROR_UNAUTHORIZED=3
|
||||
ERROR_GENERAL=4
|
||||
|
||||
WPA_CLI() {
|
||||
local iface=$1;shift
|
||||
local opt
|
||||
case ${iface} in
|
||||
global) opt="-g /var/run/wpa_supplicant-${iface}" ;;
|
||||
*) opt="-p /var/run/wpa_supplicant-${iface} -i ${iface}";;
|
||||
esac
|
||||
if [ -n "${DEBUG}" ]; then
|
||||
echo wpa_cli ${opt} "$@" >&2
|
||||
wpa_cli ${opt} "$@" || exit 2
|
||||
return 0
|
||||
fi
|
||||
wpa_cli ${opt} "$@" >/dev/null 2>&1 || exit 2
|
||||
}
|
||||
|
||||
wifi_connect() {
|
||||
local ssid=$(uci get alljoyn-onboarding.@onboarding[0].ssid)
|
||||
local encryption=$(uci get alljoyn-onboarding.@onboarding[0].encryption)
|
||||
local key=$(uci get alljoyn-onboarding.@onboarding[0].key)
|
||||
|
||||
if [ "$encryption" = "wep" ]; then
|
||||
local getwepkey="uci get alljoyn-onboarding.@onboarding[0].key$key"
|
||||
uci set wireless.@wifi-iface[0].key$key="$($getwepkey)"
|
||||
fi
|
||||
|
||||
uci set wireless.@wifi-iface[0].mode=sta
|
||||
uci set wireless.@wifi-iface[0].network=obswifi
|
||||
uci set wireless.@wifi-iface[0].ssid="$ssid"
|
||||
uci set wireless.@wifi-iface[0].key="$key"
|
||||
uci set wireless.@wifi-iface[0].encryption=$encryption
|
||||
uci delete wireless.@wifi-iface[0].hidden
|
||||
uci commit wireless
|
||||
wifi
|
||||
|
||||
# when in station mode, set the scan_wifi cron job to run every hour
|
||||
/etc/init.d/cron stop
|
||||
sed -i '/\/usr\/sbin\/wifi_scan/d' /etc/crontabs/root
|
||||
echo '1 * * * * /usr/sbin/wifi_scan' >> /etc/crontabs/root
|
||||
/etc/init.d/cron start
|
||||
}
|
||||
|
||||
wifi_softap() {
|
||||
local ssid=$(uci get alljoyn-onboarding.@onboarding[0].apssid)
|
||||
local encryption=$(uci get alljoyn-onboarding.@onboarding[0].apencryption)
|
||||
local key=$(uci get alljoyn-onboarding.@onboarding[0].apkey)
|
||||
local hidden=$(uci get alljoyn-onboarding.@onboarding[0].aphidden)
|
||||
uci set wireless.@wifi-iface[0].mode=ap
|
||||
uci set wireless.@wifi-iface[0].network=lan
|
||||
uci set wireless.@wifi-iface[0].ssid="$ssid"
|
||||
uci set wireless.@wifi-iface[0].key="$key"
|
||||
uci set wireless.@wifi-iface[0].encryption=$encryption
|
||||
uci set wireless.@wifi-iface[0].hidden=$hidden
|
||||
uci commit wireless
|
||||
wifi
|
||||
|
||||
# when in soft ap mode, set the scan_wifi cron job to run every 15 minutes
|
||||
/etc/init.d/cron stop
|
||||
sed -i '/\/usr\/sbin\/wifi_scan/d' /etc/crontabs/root
|
||||
echo '*/15 * * * * /usr/sbin/wifi_scan' >> /etc/crontabs/root
|
||||
/etc/init.d/cron start
|
||||
}
|
||||
|
||||
wifi_reset() {
|
||||
wifi
|
||||
}
|
||||
|
||||
wifi_configure_commit() {
|
||||
uci set alljoyn-onboarding.@onboarding[0].ssid="$1"
|
||||
uci set alljoyn-onboarding.@onboarding[0].encryption="$2"
|
||||
if [ "$2" = "wep" ]; then
|
||||
uci set alljoyn-onboarding.@onboarding[0].key="$5"
|
||||
uci set alljoyn-onboarding.@onboarding[0].key$5="$4"
|
||||
else
|
||||
uci set alljoyn-onboarding.@onboarding[0].key="$3"
|
||||
fi
|
||||
uci commit alljoyn-onboarding
|
||||
}
|
||||
|
||||
wifi_connect_status() {
|
||||
ifstatus=$(ifstatus obswifi)
|
||||
json_load "$ifstatus"
|
||||
json_get_var iface device
|
||||
local timeout=4
|
||||
local result=$ERROR_UNREACHABLE
|
||||
local conn_state=0
|
||||
|
||||
if [ -z $iface ]; then
|
||||
echo "Device not defined for obswifi" >&2
|
||||
set_error $ERROR_UNREACHABLE "Unreachable"
|
||||
return $result
|
||||
fi
|
||||
|
||||
while [ ${timeout} -gt 0 ]; do
|
||||
sleep 1
|
||||
ctrl_iface=$(grep ctrl_interface /var/run/wpa_supplicant-${iface}.conf | sed s/ctrl_interface=//)
|
||||
if [ -z "${ctrl_iface}" ]; then
|
||||
conn_state=$(wpa_cli -i ${iface} status 2>/dev/null | grep wpa_state | cut -d= -f2)
|
||||
else
|
||||
conn_state=$(wpa_cli -i ${iface} -p ${ctrl_iface} status 2>/dev/null | grep wpa_state | cut -d= -f2)
|
||||
fi
|
||||
echo ${conn_state} >&2
|
||||
if [ "${conn_state}" = "COMPLETED" ]; then
|
||||
result=$ERROR_NONE
|
||||
set_error $ERROR_NONE "Validated"
|
||||
return $result
|
||||
elif [ "${conn_state}" = "SCANNING" ]; then
|
||||
result=$ERROR_UNREACHABLE
|
||||
set_error $ERROR_UNREACHABLE "Unreachable"
|
||||
elif [ "${conn_state}" = "4WAY_HANDSHAKE" ]; then
|
||||
set_error $ERROR_UNAUTHORIZED "Unauthorized - 4WAY_HANDSHAKE timeout"
|
||||
result=$ERROR_UNAUTHORIZED
|
||||
elif [ "${conn_state}" = "DISCONNECTED" ]; then
|
||||
set_error $ERROR_UNAUTHORIZED "Unauthorized - DISCONNECTED"
|
||||
result=$ERROR_UNAUTHORIZED
|
||||
else
|
||||
result=$ERROR_PROTOCOL
|
||||
set_error $ERROR_PROTOCOL "Unsupported protocol"
|
||||
echo "wpa_cli returned unknown status" >&2
|
||||
fi
|
||||
timeout=$((--timeout))
|
||||
done
|
||||
|
||||
echo "Timeout --> unreachable" >&2
|
||||
return $result
|
||||
}
|
||||
|
||||
showhelp() {
|
||||
cat << EOF
|
||||
$0 -s <ssid> -a <auth>
|
||||
[-p <passphrase>] [-k key] [-i index] [ -t timeout ] [ -d ]
|
||||
|
||||
Mandatory parameters:
|
||||
-s <ssid>: Connect to SSID <ssid>
|
||||
-a <auth>: Use authentication <auth>, where <auth> can be one of:
|
||||
"open": No authentication
|
||||
"wep": WEP authentication
|
||||
"psk": WPA authentication
|
||||
"psk2": WPA2 authentication
|
||||
|
||||
Optional parameters:
|
||||
-p <passphrase>: (WEP or WPA only) Set the WEP (string) or WPA passphrase
|
||||
-k <key>: (WEP only) Set the key (hex key only, either 5 or 13 bytes len)
|
||||
-i <index>: (WEP only) Set the key index (1-4)
|
||||
-t <timeout>: Set the connection timeout (in seconds) - default=4
|
||||
-d : enable debug
|
||||
-h : print this help
|
||||
|
||||
Return value:
|
||||
0: Connection Success
|
||||
1: Connection Failed
|
||||
2: Error
|
||||
EOF
|
||||
}
|
||||
|
||||
check_params() {
|
||||
local ssid=$1
|
||||
local auth=$2
|
||||
local psk=$3
|
||||
local key=$4
|
||||
local index=$5
|
||||
|
||||
if [ -z "${auth}" ] || [ -z "${ssid}" ]; then
|
||||
echo "Error:ssid or authentication not found" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Using passphrase and/or key and/or index in Open mode is inconsistent
|
||||
if [ "${auth}" = "open" ]; then
|
||||
if [ -n "${key}" -o -n "${index}" -o -n "${psk}" ]; then
|
||||
echo "Open mode can't be used with passphrase/key/index" >&2
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# If wep is used, make sure we also got a key & its index
|
||||
if [ "${auth}" = "wep" ]; then
|
||||
if [ -z "${key}" ]; then
|
||||
echo "In WEP, please specify the key and optionally, the index" >&2
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Having a key and/or index with non-WEP encryption is inconsistent
|
||||
if [ "${auth}" != "wep" ]; then
|
||||
if [ -n "${key}" -o -n "${index}" ]; then
|
||||
echo "Index/Key can't be used with non-WEP authentication " >&2
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# If wpa is used, make sure we also got a passphrase
|
||||
case "$auth" in
|
||||
*psk*)
|
||||
if [ -z "${psk}" ]; then
|
||||
echo "In WPA, please specify a passphrase" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ $(expr length "${psk}") -lt 8 ]; then
|
||||
echo "In WPA, please specify a passphrase of size at least 8" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ $(expr length "${psk}") -eq 64 ]; then
|
||||
local i=0
|
||||
while [ $i -lt 64 ]; do
|
||||
char=${psk:$i:1}
|
||||
case "$char" in
|
||||
|
||||
[a-fA-F0-9] );;
|
||||
|
||||
* )
|
||||
echo "In WPA, please specify an ASCII passphrase of size less than 64 or a Hex passphrase of size 64" >&2
|
||||
return 1;;
|
||||
esac
|
||||
i=$((i+1))
|
||||
done
|
||||
elif [ $(expr length "${psk}") -gt 64 ]; then
|
||||
echo "In WPA, please specify an ASCII passphrase of size less than 64 or a Hex passphrase of size 64" >&2
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
esac
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
wifi_configure() {
|
||||
# Process arguments
|
||||
local ssid auth psk key index
|
||||
|
||||
while [ -n "$1" ];do
|
||||
case "$1" in
|
||||
-s) ssid="$2"; shift;;
|
||||
-a) auth="$2"; shift
|
||||
|
||||
if [ "${auth}" = "OPEN" ]; then
|
||||
auth="none"
|
||||
fi
|
||||
|
||||
if [ "${auth}" = "WEP" ]; then
|
||||
auth="wep"
|
||||
fi
|
||||
|
||||
case "$auth" in
|
||||
WPA2*)
|
||||
auth="psk2+tkip+ccmp"
|
||||
;;
|
||||
WPA*)
|
||||
auth="psk+tkip+ccmp"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "${auth}" = "WPS" ]; then
|
||||
auth="psk"
|
||||
fi
|
||||
|
||||
[ ${auth} = "none" ] || [ ${auth} = "wep" ] || [ ${auth} = "psk+tkip+ccmp" ] || [ ${auth} = "psk2+tkip+ccmp" ] || {
|
||||
echo "Invalid authentication \"${auth}\"" >&2
|
||||
echo "Valid authentication values are \"none\", \"wep\", \"psk+tkip+ccmp\", \"psk2+tkip+ccmp\"" >&2
|
||||
showhelp
|
||||
exit 2;
|
||||
};;
|
||||
-p) psk="$2"; shift;;
|
||||
-k) key="$2"; shift;;
|
||||
-i) index="$2"; shift
|
||||
if [ ! ${index} -ge 1 ] && [ ! ${index} -le 4 ]; then
|
||||
echo "Invalid index \"${index}\"" >&2
|
||||
echo "Valid index values are \"1\", \"2\", \"3\", \"4\"" >&2
|
||||
showhelp
|
||||
exit 2
|
||||
fi;;
|
||||
-t) timeout="$2"; shift;;
|
||||
-d) DEBUG=1;;
|
||||
-h) showhelp; exit 2;;
|
||||
*)
|
||||
echo "Invalid option: -${OPTARG}" >&2
|
||||
showhelp
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [ "${auth}" = "wep" ]; then
|
||||
if [ -z "${index}" ]; then
|
||||
index=1
|
||||
echo "Defaulting index to 1" >&2
|
||||
fi
|
||||
fi
|
||||
|
||||
# Perform sanity checks on the script arguments
|
||||
check_params "${ssid}" "${auth}" "${psk}" "${key}" "${index}" || {
|
||||
showhelp
|
||||
exit 2
|
||||
}
|
||||
|
||||
|
||||
|
||||
wifi_configure_commit "${ssid}" "${auth}" "${psk}" "${key}" "${index}"
|
||||
}
|
||||
|
||||
set_error() {
|
||||
uci set -c /etc/alljoyn-onboarding alljoyn-onboarding-state.@onboarding[0].lasterrorcode=$1
|
||||
uci set -c /etc/alljoyn-onboarding alljoyn-onboarding-state.@onboarding[0].lasterrormsg="$2"
|
||||
uci commit -c /etc/alljoyn-onboarding alljoyn-onboarding-state
|
||||
printf '%s\n%s' "$1" "$2" > /tmp/state/alljoyn-onboarding-lasterror
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
# Copyright (c) 2014, AllSeen Alliance. All rights reserved.
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
#
|
||||
|
||||
findPid=$(pgrep /usr/sbin/wifi_scan)
|
||||
|
||||
if [ -z $findPid ]; then
|
||||
|
||||
## Get the scan results based on method available
|
||||
hasIw=$(which iw)
|
||||
hasIwList=$(which iwlist)
|
||||
|
||||
if [ -n "$hasIw" ]; then
|
||||
result=$(/usr/sbin/parse_iw_wifi_scan)
|
||||
elif [ -n "$hasIwList" ]; then
|
||||
result=$(/usr/sbin/parse_iwlist_wifi_scan)
|
||||
fi
|
||||
|
||||
## Sort the results based on signal strength and print it to the file
|
||||
if [ -n "$result" ]; then
|
||||
printf "$result" | sort -n -r | awk '{sep="";for (i=4;i<=NF;i++) {printf "%s%s",sep, $i;sep=" "}; printf "\t"$3"\n"}' | sort | uniq > /tmp/wifi_scan_results
|
||||
fi
|
||||
fi
|
||||
@@ -1,26 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
# Copyright (c) 2013 - 2014, AllSeen Alliance. All rights reserved.
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
#
|
||||
|
||||
START=61
|
||||
|
||||
boot() {
|
||||
# Schedule the script to refresh the results with a cron job
|
||||
/etc/init.d/cron stop
|
||||
sed -i '/\/usr\/sbin\/wifi_scan/d' /etc/crontabs/root
|
||||
echo '*/15 * * * * /usr/sbin/wifi_scan' >> /etc/crontabs/root
|
||||
/etc/init.d/cron start
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
AJ_SERVICE:=sample_apps
|
||||
AJ_SERVICE_NAME:=sample_apps
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=alljoyn-$(AJ_SERVICE)
|
||||
PKG_BASE_VERSION:=14.12
|
||||
PKG_PATCHLEVEL:=.00
|
||||
PKG_RELEASE:=1
|
||||
PKG_MD5SUM:=389c2623619281e6849da25cee7e1bb7
|
||||
PKG_VERSION:=$(PKG_BASE_VERSION)$(PKG_PATCHLEVEL)
|
||||
PKG_TARBALL_VERSION:=$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/alljoyn-services-$(PKG_TARBALL_VERSION)-src
|
||||
PKG_SOURCE:=alljoyn-services-$(PKG_TARBALL_VERSION)-src.tar.gz
|
||||
PKG_SOURCE_URL:=https://allseenalliance.org/releases/alljoyn/$(PKG_BASE_VERSION)/
|
||||
|
||||
# SCons supports parallel builds but does not support make's jobserver
|
||||
PKG_BUILD_PARALLEL:=$(if $(CONFIG_PKG_BUILD_USE_JOBSERVER),0,1)
|
||||
|
||||
PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_$(PKG_NAME)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
ifneq ($(CONFIG_CCACHE),)
|
||||
TARGET_CC=$(TARGET_CC_NOCACHE)
|
||||
TARGET_CXX=$(TARGET_CXX_NOCACHE)
|
||||
endif
|
||||
|
||||
ALLJOYN_BINDINGS:=cpp,
|
||||
ALLJOYN_BUILD_SERVICES_SAMPLES:=on
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
TITLE:=AllJoyn services $(AJ_SERVICE_NAME) - sample applications
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
DEPENDS:=alljoyn \
|
||||
+alljoyn-about \
|
||||
+alljoyn-config \
|
||||
+alljoyn-controlpanel \
|
||||
+alljoyn-notification \
|
||||
+alljoyn-services_common
|
||||
URL:=http://www.allseenalliance.org
|
||||
MAINTAINER:=AllSeen Alliance <allseen-core@lists.allseenalliance.org>
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
AllJoyn services $(AJ_SERVICE_NAME) sample applications - includes ServerSample and ACServerSample.
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_DEBUG),y)
|
||||
ALLJOYN_BUILD_VARIANT:=debug
|
||||
else
|
||||
ALLJOYN_BUILD_VARIANT:=release
|
||||
endif
|
||||
|
||||
|
||||
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/services/base/$(AJ_SERVICE)/build/openwrt/openwrt/$(ALLJOYN_BUILD_VARIANT)/dist/$(AJ_SERVICE)
|
||||
|
||||
TARGET_CFLAGS+=-fPIC
|
||||
TARGET_CPPFLAGS+=-fPIC
|
||||
|
||||
define Build/Configure/Default
|
||||
# Override default to do nothing
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
scons -C $(PKG_BUILD_DIR)/services/base/$(AJ_SERVICE) \
|
||||
$(PKG_JOBS) \
|
||||
WS=off \
|
||||
CPU=openwrt \
|
||||
OS=openwrt \
|
||||
"BINDINGS=$(ALLJOYN_BINDINGS)" \
|
||||
"BUILD_SERVICES_SAMPLES=$(ALLJOYN_BUILD_SERVICES_SAMPLES)" \
|
||||
"VARIANT=$(ALLJOYN_BUILD_VARIANT)" \
|
||||
BR=off \
|
||||
BT=off \
|
||||
ICE=off \
|
||||
"TARGET_CC=$$(TARGET_CC)" \
|
||||
"TARGET_CXX=$$(TARGET_CXX)" \
|
||||
"TARGET_CFLAGS=$$(TARGET_CFLAGS)" \
|
||||
"TARGET_CPPFLAGS=$$(TARGET_CPPFLAGS)" \
|
||||
"TARGET_PATH=$$(TARGET_PATH)" \
|
||||
"TARGET_LINKFLAGS=$$(TARGET_LDFLAGS)" \
|
||||
"TARGET_LINK=$$(TARGET_CC)" \
|
||||
"TARGET_AR=$$(TARGET_AR)" \
|
||||
"TARGET_RANLIB=$$(TARGET_RANLIB)" \
|
||||
"STAGING_DIR=$$(STAGING_DIR)" \
|
||||
"ALL=1"
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/bin/* $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/bin/* $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
AJ_SERVICE:=services_common
|
||||
AJ_SERVICE_NAME:=Services Common
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=alljoyn-$(AJ_SERVICE)
|
||||
PKG_BASE_VERSION:=14.12
|
||||
PKG_PATCHLEVEL:=.00
|
||||
PKG_RELEASE:=1
|
||||
PKG_MD5SUM:=389c2623619281e6849da25cee7e1bb7
|
||||
PKG_VERSION:=$(PKG_BASE_VERSION)$(PKG_PATCHLEVEL)
|
||||
PKG_TARBALL_VERSION:=$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/alljoyn-services-$(PKG_TARBALL_VERSION)-src
|
||||
PKG_SOURCE:=alljoyn-services-$(PKG_TARBALL_VERSION)-src.tar.gz
|
||||
PKG_SOURCE_URL:=https://allseenalliance.org/releases/alljoyn/$(PKG_BASE_VERSION)/
|
||||
|
||||
# SCons supports parallel builds but does not support make's jobserver
|
||||
PKG_BUILD_PARALLEL:=$(if $(CONFIG_PKG_BUILD_USE_JOBSERVER),0,1)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
ifneq ($(CONFIG_CCACHE),)
|
||||
TARGET_CC=$(TARGET_CC_NOCACHE)
|
||||
TARGET_CXX=$(TARGET_CXX_NOCACHE)
|
||||
endif
|
||||
|
||||
ALLJOYN_BINDINGS:=cpp,
|
||||
ALLJOYN_BUILD_SERVICES_SAMPLES:=off
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
TITLE:=AllJoyn $(AJ_SERVICE_NAME) service library
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
DEPENDS:=alljoyn
|
||||
URL:=http://www.allseenalliance.org
|
||||
MAINTAINER:=AllSeen Alliance <allseen-core@lists.allseenalliance.org>
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
AllJoyn $(AJ_SERVICE_NAME) service library.
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_DEBUG),y)
|
||||
ALLJOYN_BUILD_VARIANT:=debug
|
||||
else
|
||||
ALLJOYN_BUILD_VARIANT:=release
|
||||
endif
|
||||
|
||||
|
||||
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/services/base/$(AJ_SERVICE)/build/openwrt/openwrt/$(ALLJOYN_BUILD_VARIANT)/dist/$(AJ_SERVICE)
|
||||
|
||||
TARGET_CFLAGS+=-fPIC
|
||||
TARGET_CPPFLAGS+=-fPIC
|
||||
|
||||
define Build/Configure/Default
|
||||
# Override default to do nothing
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
scons -C $(PKG_BUILD_DIR)/services/base/$(AJ_SERVICE) \
|
||||
$(PKG_JOBS) \
|
||||
WS=off \
|
||||
CPU=openwrt \
|
||||
OS=openwrt \
|
||||
"BINDINGS=$(ALLJOYN_BINDINGS)" \
|
||||
"BUILD_SERVICES_SAMPLES=$(ALLJOYN_BUILD_SERVICES_SAMPLES)" \
|
||||
"VARIANT=$(ALLJOYN_BUILD_VARIANT)" \
|
||||
BR=off \
|
||||
BT=off \
|
||||
ICE=off \
|
||||
"TARGET_CC=$$(TARGET_CC)" \
|
||||
"TARGET_CXX=$$(TARGET_CXX)" \
|
||||
"TARGET_CFLAGS=$$(TARGET_CFLAGS)" \
|
||||
"TARGET_CPPFLAGS=$$(TARGET_CPPFLAGS)" \
|
||||
"TARGET_PATH=$$(TARGET_PATH)" \
|
||||
"TARGET_LINKFLAGS=$$(TARGET_LDFLAGS)" \
|
||||
"TARGET_LINK=$$(TARGET_CC)" \
|
||||
"TARGET_AR=$$(TARGET_AR)" \
|
||||
"TARGET_RANLIB=$$(TARGET_RANLIB)" \
|
||||
"STAGING_DIR=$$(STAGING_DIR)"
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include/alljoyn/$(AJ_SERVICE)
|
||||
$(CP) $(PKG_INSTALL_DIR)/inc/alljoyn/$(AJ_SERVICE)/*.h $(1)/usr/include/alljoyn/$(AJ_SERVICE)
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/lib/liballjoyn_$(AJ_SERVICE).a $(1)/usr/lib/
|
||||
$(CP) $(PKG_INSTALL_DIR)/lib/liballjoyn_$(AJ_SERVICE).so $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/lib/liballjoyn_$(AJ_SERVICE).so $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
@@ -1,301 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=alljoyn
|
||||
PKG_BASE_VERSION:=14.12
|
||||
PKG_PATCHLEVEL:=a
|
||||
PKG_RELEASE:=1
|
||||
PKG_MD5SUM:=1435d8611a26bfde115a771ab7cd3d74
|
||||
PKG_VERSION:=$(PKG_BASE_VERSION)$(PKG_PATCHLEVEL)
|
||||
PKG_TARBALL_VERSION:=$(PKG_BASE_VERSION).00$(PKG_PATCHLEVEL)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_TARBALL_VERSION)-src
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_TARBALL_VERSION)-src.tar.gz
|
||||
PKG_SOURCE_URL:=https://allseenalliance.org/releases/alljoyn/$(PKG_BASE_VERSION)/
|
||||
|
||||
# SCons supports parallel builds but does not support make's jobserver
|
||||
PKG_BUILD_PARALLEL:=$(if $(CONFIG_PKG_BUILD_USE_JOBSERVER),0,1)
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
CONFIG_DEBUG \
|
||||
CONFIG_PACKAGE_alljoyn-c \
|
||||
CONFIG_PACKAGE_alljoyn-about \
|
||||
CONFIG_PACKAGE_alljoyn-samples
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
ifneq ($(CONFIG_CCACHE),)
|
||||
TARGET_CC=$(TARGET_CC_NOCACHE)
|
||||
TARGET_CXX=$(TARGET_CXX_NOCACHE)
|
||||
endif
|
||||
|
||||
define Package/alljoyn/Default
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
DEPENDS:=+libopenssl +libpthread +librt +libstdcpp
|
||||
URL:=http://www.allseenalliance.org
|
||||
MAINTAINER:=AllSeen Alliance <allseen-core@lists.allseenalliance.org>
|
||||
endef
|
||||
|
||||
define Package/alljoyn
|
||||
$(call Package/alljoyn/Default)
|
||||
TITLE:=AllJoyn Peer-to-Peer networking
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define Package/alljoyn/description
|
||||
AllJoyn is a daemon and application framework for developing
|
||||
ad hoc peer-to-peer applications. This includes the run-time
|
||||
daemon and C++ library.
|
||||
endef
|
||||
|
||||
|
||||
define Package/alljoyn-non-gw-config
|
||||
$(call Package/alljoyn/Default)
|
||||
TITLE:=AllJoyn - alternate non-Gateway Config
|
||||
DEPENDS:=alljoyn
|
||||
endef
|
||||
|
||||
define Package/alljoyn-non-gw-config/description
|
||||
Alternate AllJoyn configuration with defaults suitable for
|
||||
non-Gateway devices. Do not install this on devices with a
|
||||
network interface connected to an insecure network such as
|
||||
the Internet.
|
||||
endef
|
||||
|
||||
|
||||
define Package/alljoyn-c
|
||||
$(call Package/alljoyn/Default)
|
||||
TITLE:=AllJoyn - C binding
|
||||
DEPENDS:=alljoyn
|
||||
endef
|
||||
|
||||
define Package/alljoyn-c/description
|
||||
AllJoyn C binding. This provides a C library for building
|
||||
AllJoyn programs in C. This is just a C callable wrapper
|
||||
to the C++ library.
|
||||
endef
|
||||
|
||||
|
||||
define Package/alljoyn-about
|
||||
$(call Package/alljoyn/Default)
|
||||
TITLE:=AllJoyn - About service library (deprecated)
|
||||
DEPENDS:=alljoyn
|
||||
endef
|
||||
|
||||
define Package/alljoyn-about/description
|
||||
AllJoyn About services library. This library is deprecated. The functionality
|
||||
provided by About has been integrated into liballjoyn with a simpler API. This
|
||||
library will continue to be supported into 2015 and will be removed in 2016.
|
||||
endef
|
||||
|
||||
define Package/alljoyn-samples
|
||||
$(call Package/alljoyn/Default)
|
||||
TITLE:=AllJoyn - testing samples
|
||||
DEPENDS:=alljoyn \
|
||||
+PACKAGE_alljoyn-about:alljoyn-about
|
||||
endef
|
||||
|
||||
define Package/alljoyn-samples/description
|
||||
Alljoyn samples. (This is primarily for testing. The contents of this
|
||||
package vary according which other alljoyn packages are selected.)
|
||||
endef
|
||||
|
||||
ALLJOYN_BINDINGS:=cpp,
|
||||
ALLJOYN_SERVICES:=
|
||||
ALLJOYN_BUILD_SERVICES_SAMPLES:=off
|
||||
|
||||
ifdef CONFIG_PACKAGE_alljoyn-c
|
||||
ALLJOYN_BINDINGS+=c,
|
||||
endif
|
||||
|
||||
ifdef CONFIG_PACKAGE_alljoyn-about
|
||||
ALLJOYN_SERVICES+=about,
|
||||
endif
|
||||
|
||||
|
||||
ifeq ($(CONFIG_DEBUG),y)
|
||||
ALLJOYN_BUILD_VARIANT:=debug
|
||||
else
|
||||
ALLJOYN_BUILD_VARIANT:=release
|
||||
endif
|
||||
|
||||
|
||||
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/build/openwrt/openwrt/$(ALLJOYN_BUILD_VARIANT)/dist
|
||||
|
||||
TARGET_CFLAGS+=-fPIC
|
||||
TARGET_CPPFLAGS+=-fPIC
|
||||
|
||||
define Build/Configure
|
||||
# Override default to do nothing
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
scons -C $(PKG_BUILD_DIR) \
|
||||
$(PKG_JOBS) \
|
||||
WS=off \
|
||||
CPU=openwrt \
|
||||
OS=openwrt \
|
||||
"BINDINGS=$(ALLJOYN_BINDINGS)" \
|
||||
"SERVICES=$(ALLJOYN_SERVICES)" \
|
||||
"BUILD_SERVICES_SAMPLES=$(ALLJOYN_BUILD_SERVICES_SAMPLES)" \
|
||||
"VARIANT=$(ALLJOYN_BUILD_VARIANT)" \
|
||||
BR=off \
|
||||
ICE=off \
|
||||
POLICYDB=on \
|
||||
"TARGET_CC=$$(TARGET_CC)" \
|
||||
"TARGET_CXX=$$(TARGET_CXX)" \
|
||||
"TARGET_CFLAGS=$$(TARGET_CFLAGS)" \
|
||||
"TARGET_CPPFLAGS=$$(TARGET_CPPFLAGS)" \
|
||||
"TARGET_PATH=$$(TARGET_PATH)" \
|
||||
"TARGET_LINKFLAGS=$$(TARGET_LDFLAGS)" \
|
||||
"TARGET_LINK=$$(TARGET_CC)" \
|
||||
"TARGET_AR=$$(TARGET_AR)" \
|
||||
"TARGET_RANLIB=$$(TARGET_RANLIB)" \
|
||||
"STAGING_DIR=$$(STAGING_DIR)"
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(INSTALL_DIR) $(1)/usr/include/alljoyn
|
||||
$(INSTALL_DIR) $(1)/usr/include/qcc
|
||||
$(INSTALL_DIR) $(1)/usr/include/qcc/posix
|
||||
$(CP) $(PKG_INSTALL_DIR)/cpp/inc/alljoyn/*.h $(1)/usr/include/alljoyn/
|
||||
$(CP) $(PKG_INSTALL_DIR)/cpp/inc/qcc/*.h $(1)/usr/include/qcc/
|
||||
$(CP) $(PKG_INSTALL_DIR)/cpp/inc/qcc/posix/*.h $(1)/usr/include/qcc/posix/
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/cpp/lib/liballjoyn.a $(1)/usr/lib/
|
||||
$(CP) $(PKG_INSTALL_DIR)/cpp/lib/liballjoyn.so $(1)/usr/lib/
|
||||
ifdef CONFIG_PACKAGE_alljoyn-about
|
||||
$(INSTALL_DIR) $(1)/usr/include/alljoyn/about
|
||||
$(CP) $(PKG_INSTALL_DIR)/cpp/inc/alljoyn/about/*.h $(1)/usr/include/alljoyn/about
|
||||
$(CP) $(PKG_INSTALL_DIR)/cpp/lib/liballjoyn_about.a $(1)/usr/lib/
|
||||
$(CP) $(PKG_INSTALL_DIR)/cpp/lib/liballjoyn_about.so $(1)/usr/lib/
|
||||
endif
|
||||
ifdef CONFIG_PACKAGE_alljoyn-c
|
||||
$(INSTALL_DIR) $(1)/usr/include/alljoyn_c
|
||||
$(CP) $(PKG_INSTALL_DIR)/c/inc/alljoyn_c/*.h $(1)/usr/include/alljoyn_c/
|
||||
$(CP) $(PKG_INSTALL_DIR)/c/lib/liballjoyn_c.a $(1)/usr/lib/
|
||||
$(CP) $(PKG_INSTALL_DIR)/c/lib/liballjoyn_c.so $(1)/usr/lib/
|
||||
endif
|
||||
endef
|
||||
|
||||
define Package/alljoyn/conffiles
|
||||
/etc/alljoyn/alljoyn.conf
|
||||
/etc/config/alljoyn
|
||||
endef
|
||||
|
||||
define Package/alljoyn-non-gw-config/conffiles
|
||||
/etc/config/alljoyn
|
||||
endef
|
||||
|
||||
define Package/alljoyn/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/cpp/bin/alljoyn-daemon $(1)/usr/bin
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/cpp/lib/liballjoyn.so $(1)/usr/lib/
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/alljoyn.init $(1)/etc/init.d/alljoyn
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/alljoyn.defaults $(1)/etc/uci-defaults/alljoyn
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) ./files/alljoyn.config $(1)/etc/config/alljoyn
|
||||
$(INSTALL_DIR) $(1)/etc/alljoyn
|
||||
$(INSTALL_CONF) ./files/alljoyn.conf $(1)/etc/alljoyn/alljoyn.conf
|
||||
endef
|
||||
|
||||
define Package/alljoyn-non-gw-config/install
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) ./files/alljoyn-non-gw.config $(1)/etc/config/alljoyn
|
||||
endef
|
||||
|
||||
define Package/alljoyn-c/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/c/lib/liballjoyn_c.so $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/alljoyn-about/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/cpp/lib/liballjoyn_about.so $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/alljoyn-samples/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/cpp/bin/advtunnel $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/cpp/bin/aes_ccm $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/cpp/bin/bastress $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/cpp/bin/bastress2 $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/cpp/bin/bbclient $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/cpp/bin/bbjitter $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/cpp/bin/bbjoin $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/cpp/bin/bbservice $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/cpp/bin/bbsig $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/cpp/bin/bignum $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/cpp/bin/compression $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/cpp/bin/keystore $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/cpp/bin/marshal $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/cpp/bin/names $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/cpp/bin/ns $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/cpp/bin/rawclient $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/cpp/bin/rawservice $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/cpp/bin/remarshal $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/cpp/bin/rsa $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/cpp/bin/sessions $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/cpp/bin/socktest $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/cpp/bin/srp $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/cpp/bin/unpack $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/cpp/bin/samples/AboutClient $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/cpp/bin/samples/AboutService $(1)/usr/bin/
|
||||
ifdef CONFIG_PACKAGE_alljoyn-about
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/cpp/bin/samples/sample_rule_app $(1)/usr/bin/
|
||||
endif
|
||||
endef
|
||||
|
||||
define Package/alljoyn/postinst
|
||||
#!/bin/sh
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
. /etc/uci-defaults/alljoyn
|
||||
rm -f /etc/uci-defaults/alljoyn
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/alljoyn/prerm
|
||||
#!/bin/sh
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
/etc/init.d/alljoyn stop
|
||||
/etc/init.d/alljoyn disable
|
||||
uci batch <<EOF
|
||||
del_list ucitrack.@network[-1].affects=alljoyn
|
||||
delete ucitrack.@alljoyn[-1]
|
||||
commit ucitrack
|
||||
EOF
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
|
||||
define Package/alljoyn-non-gw-config/preinst
|
||||
#!/bin/sh
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
echo 'Saving original alljoyn config file to alljoyn-orig'
|
||||
mv /etc/config/alljoyn /etc/config/alljoyn-orig
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/alljoyn-non-gw-config/postrm
|
||||
#!/bin/sh
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
if [ -e /etc/config/alljoyn-orig ]; then
|
||||
echo 'Restoring original alljoyn config file from alljoyn-orig'
|
||||
mv /etc/config/alljoyn-orig /etc/config/alljoyn
|
||||
fi
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,alljoyn))
|
||||
$(eval $(call BuildPackage,alljoyn-non-gw-config))
|
||||
$(eval $(call BuildPackage,alljoyn-c))
|
||||
$(eval $(call BuildPackage,alljoyn-about))
|
||||
$(eval $(call BuildPackage,alljoyn-samples))
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
config transport 'unix'
|
||||
option enable '1'
|
||||
option path 'alljoyn'
|
||||
option abstract '1'
|
||||
|
||||
config transport 'ip'
|
||||
option enable '1'
|
||||
option max_incomplete_conn '16'
|
||||
option max_complete_conn '96'
|
||||
option bus_port '9955'
|
||||
option auth_timeout '20000'
|
||||
option advertise_daemon '1'
|
||||
option all_networks '1'
|
||||
list networks
|
||||
|
||||
config transport 'slap'
|
||||
option enable '0'
|
||||
option path '/dev/ttyUSB0'
|
||||
option baud 115200
|
||||
option databits 8
|
||||
option parity 'none'
|
||||
option stopbits 1
|
||||
|
||||
config daemon 'daemon'
|
||||
option user 'nobody'
|
||||
@@ -1,38 +0,0 @@
|
||||
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
||||
|
||||
<!--
|
||||
Copyright (c) 2014, AllSeen Alliance. All rights reserved.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
-->
|
||||
|
||||
<busconfig>
|
||||
<type>alljoyn</type>
|
||||
<fork/>
|
||||
<syslog/>
|
||||
|
||||
<!-- Default limits -->
|
||||
<limit name="auth_timeout">20000</limit>
|
||||
<limit name="max_incomplete_connections">16</limit>
|
||||
<limit name="max_completed_connections">96</limit>
|
||||
<limit name="max_untrusted_clients">96</limit>
|
||||
<flag name="restrict_untrusted_clients">false</flag>
|
||||
|
||||
<!-- Include configuration file generated from /etc/config/alljoyn -->
|
||||
<include>/var/etc/alljoyn.conf</include>
|
||||
|
||||
<!-- Include Gateway Agent policy rules configuration -->
|
||||
<includedir ignore_missing="yes">/etc/alljoyn/gwagent</includeidr>
|
||||
|
||||
</busconfig>
|
||||
@@ -1,25 +0,0 @@
|
||||
config transport 'unix'
|
||||
option enable '1'
|
||||
option path 'alljoyn'
|
||||
option abstract '1'
|
||||
|
||||
config transport 'ip'
|
||||
option enable '1'
|
||||
option max_incomplete_conn '16'
|
||||
option max_complete_conn '96'
|
||||
option bus_port '9955'
|
||||
option auth_timeout '20000'
|
||||
option advertise_daemon '1'
|
||||
option all_networks '0'
|
||||
list networks 'lan'
|
||||
|
||||
config transport 'slap'
|
||||
option enable '0'
|
||||
option path '/dev/ttyUSB0'
|
||||
option baud 115200
|
||||
option databits 8
|
||||
option parity 'none'
|
||||
option stopbits 1
|
||||
|
||||
config daemon 'daemon'
|
||||
option user 'nobody'
|
||||
@@ -1,9 +0,0 @@
|
||||
#! /bin/sh
|
||||
uci batch <<EOF
|
||||
add ucitrack alljoyn
|
||||
set ucitrack.@alljoyn[-1].init=alljoyn
|
||||
add_list ucitrack.@network[-1].affects=alljoyn
|
||||
commit ucitrack
|
||||
EOF
|
||||
/etc/init.d/alljoyn enable
|
||||
exit 0
|
||||
@@ -1,170 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
# Copyright (c) 2013-2015, AllSeen Alliance. All rights reserved.
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
#
|
||||
|
||||
START=65
|
||||
|
||||
SERVICE_PID_FILE=/var/run/alljoyn.pid
|
||||
|
||||
CONFIGFILE="/etc/alljoyn/alljoyn.conf"
|
||||
GENCONFIGFILE="/var/etc/alljoyn.conf"
|
||||
|
||||
|
||||
check() {
|
||||
local flag
|
||||
|
||||
config_get_bool flag "$1" "$2" 0
|
||||
|
||||
test "$flag" == "1"
|
||||
return $?
|
||||
}
|
||||
|
||||
|
||||
process_unix_transport() {
|
||||
if check unix enable; then
|
||||
local path
|
||||
local abstract
|
||||
|
||||
|
||||
config_get path unix path "alljoyn"
|
||||
config_get_bool abstract unix abstract "1"
|
||||
|
||||
if [ -n "$abstract" ]; then
|
||||
path="abstract=$path"
|
||||
else
|
||||
path="path=$path"
|
||||
fi
|
||||
export ${NO_EXPORT:+-n} listen_specs="${listen_specs}
|
||||
<listen>unix:${path}</listen>"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
process_ip_network() {
|
||||
local network="$1"
|
||||
local port="$2"
|
||||
local ifname
|
||||
|
||||
config_get ifname "$network" ifname
|
||||
if [ -n "$ifname" ]; then
|
||||
export ${NO_EXPORT:+-n} listen_specs="${listen_specs}
|
||||
<listen>tcp:iface=${ifname},port=${port}</listen>
|
||||
<listen>udp:iface=${ifname},port=${port}</listen>"
|
||||
fi
|
||||
}
|
||||
|
||||
process_ip_transport() {
|
||||
if check ip enable; then
|
||||
local port
|
||||
|
||||
if check ip advertise_daemon; then
|
||||
export ${NO_EXPORT:+-n} ip_advertise_daemon="<property name=\"router_advertisement_prefix\">org.alljoyn.BusNode.</property>"
|
||||
fi
|
||||
|
||||
config_get port ip bus_port 9955
|
||||
|
||||
if check ip all_networks; then
|
||||
export ${NO_EXPORT:+-n} listen_specs="${listen_specs}
|
||||
<listen>tcp:iface=*,port=${port}</listen>
|
||||
<listen>udp:iface=*,port=${port}</listen>"
|
||||
else
|
||||
config_load network
|
||||
config_load alljoyn # loading the network config clobbers the alljoyn config vars
|
||||
config_list_foreach ip networks process_ip_network "${port}"
|
||||
fi
|
||||
|
||||
config_get ip_max_incomplete_conn ip max_incomplete_conn "$ip_max_incomplete_conn"
|
||||
config_get ip_max_complete_conn ip max_complete_conn "$ip_max_complete_conn"
|
||||
config_get ip_auth_timeout ip auth_timeout "$ip_auth_timeout"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
process_slap_transport() {
|
||||
if check slap enable; then
|
||||
local path
|
||||
local baud
|
||||
|
||||
config_get path slap path "/dev/ttyUSB0"
|
||||
config_get baud slap baud "115200"
|
||||
config_get databits slap databits "8"
|
||||
config_get parity slap parity "none"
|
||||
config_get stopbits slap stopbits "1"
|
||||
|
||||
export ${NO_EXPORT:+-n} listen_specs="${listen_specs}
|
||||
<listen>slap:type=uart;dev=${path};baud=${baud};databits=${databits};parity=${parity};stopbits=${stopbits}</listen>"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
process_switch_user() {
|
||||
local user
|
||||
|
||||
config_get user daemon user "root"
|
||||
|
||||
if [ "$user" != "root" ]; then
|
||||
export ${NO_EXPORT:+-n} switch_user="<user>${user}</user>"
|
||||
fi
|
||||
}
|
||||
|
||||
generate_conf_file() {
|
||||
local listen_specs=""
|
||||
|
||||
local ip_max_incomplete_conn=16
|
||||
local ip_max_complete_conn=64
|
||||
local ip_auth_timeout=20000
|
||||
local ip_networks=""
|
||||
local ip_advertise_daemon=""
|
||||
local switch_user=""
|
||||
|
||||
rm -f $GENCONFIGFILE
|
||||
|
||||
include /lib/network
|
||||
|
||||
config_load alljoyn
|
||||
|
||||
process_unix_transport
|
||||
process_ip_transport
|
||||
process_slap_transport
|
||||
process_switch_user
|
||||
|
||||
mkdir -p $(dirname $GENCONFIGFILE)
|
||||
|
||||
cat > $GENCONFIGFILE <<EOF
|
||||
<busconfig>
|
||||
<pidfile>${SERVICE_PID_FILE}</pidfile>
|
||||
${switch_user}
|
||||
${listen_specs}
|
||||
${ip_advertise_daemon}
|
||||
<limit name="auth_timeout">${ip_auth_timeout}</limit>
|
||||
<limit name="max_incomplete_connections">${ip_max_incomplete_conn}</limit>
|
||||
<limit name="max_completed_connections">${ip_max_complete_conn}</limit>
|
||||
<limit name="max_untrusted_clients">${ip_max_complete_conn}</limit>
|
||||
</busconfig>
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
start() {
|
||||
generate_conf_file
|
||||
if [ -e $CONFIGFILE ]; then
|
||||
service_start /usr/bin/alljoyn-daemon --config-file=$CONFIGFILE
|
||||
fi
|
||||
}
|
||||
|
||||
stop() {
|
||||
service_stop /usr/bin/alljoyn-daemon
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
This repository is designated to serve as a feed for OpenWrt
|
||||
(http://openwrt.org) based systems. As such, the organization, management,
|
||||
and usage of this repository will be different from the other source
|
||||
repositories hosted by the AllSeen Alliance.
|
||||
|
||||
Most notable of these differences is that the master branch only contains this
|
||||
readme file. Package definitions will only exist in branches whos name
|
||||
corresponds to code names for OpenWrt releases. At the time of the initial
|
||||
commit of this readme file, there will be 2 such branches: attitude_adjustment
|
||||
and barrier_breaker. As the OpenWrt project develops and creates new
|
||||
releases, new corresponding branches will be created.
|
||||
|
||||
The reason for tracking package definitions on a per OpenWrt release basis is
|
||||
due to the fact that AllJoyn packages depend on OpenWrt packages which may
|
||||
change from release to release. This also allows us to retire support for
|
||||
obsolete versions of OpenWrt in the future without breaking others who may
|
||||
still be using/building the obsolete versions.
|
||||
|
||||
To use this feed in an OpenWrt build environment, follow these instructions:
|
||||
|
||||
1. Copy feeds.conf.default to feeds.conf (if not already done):
|
||||
|
||||
cp feeds.conf.default feeds.conf
|
||||
|
||||
|
||||
2. Add the following feeds.conf (replace <openwrt_release> with the
|
||||
appropriate branch that corresponds to the OpenWrt release you are building):
|
||||
|
||||
src-git alljoyn git://git.allseenalliance.org/gerrit/core/openwrt_feed;<openwrt_release>
|
||||
|
||||
# For Attitude Adjustment
|
||||
src-git alljoyn git://git.allseenalliance.org/gerrit/core/openwrt_feed;attitude_adjustment
|
||||
|
||||
# For Barrier Breaker
|
||||
src-git alljoyn git://git.allseenalliance.org/gerrit/core/openwrt_feed;barrier_breaker
|
||||
|
||||
|
||||
3. Update the feed information:
|
||||
|
||||
./scripts/feeds update -a
|
||||
|
||||
|
||||
4. Add the the packages from the AllJoyn feed to build system:
|
||||
|
||||
./scripts feeds install -a -p alljoyn
|
||||
|
||||
5. Enable AllJoyn in the build:
|
||||
|
||||
make menuconfig
|
||||
|
||||
Networking --->
|
||||
< > alljoyn --->
|
||||
< > alljoyn-about
|
||||
< > alljoyn-c
|
||||
< > alljoyn-config
|
||||
< > alljoyn-config-samples
|
||||
< > alljoyn-controlpanel
|
||||
< > alljoyn-controlpanel-samples
|
||||
< > alljoyn-notification
|
||||
< > alljoyn-notification-samples
|
||||
< > alljoyn-onboarding
|
||||
< > alljoyn-onboarding-samples
|
||||
< > alljoyn-sample_apps
|
||||
< > alljoyn-samples
|
||||
< > alljoyn-service_common
|
||||
@@ -1,51 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2013 Inteno
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ami
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
#PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||
#STAMP_PREPARED := $(STAMP_PREPARED)_$(call confvar,CONFIG_MTD_REDBOOT_PARTS)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
target=$(firstword $(subst -, ,$(BOARD)))
|
||||
|
||||
TARGET_LDFLAGS+= \
|
||||
-Wl,-rpath-link=$(STAGING_DIR)/usr/lib \
|
||||
-Wl,-rpath-link=$(STAGING_DIR)/lib -luci -lubus -lubox -lpthread
|
||||
|
||||
TARGET_CFLAGS += $(FPIC) -Dtarget_$(target)=1 -Wall
|
||||
MAKE_FLAGS += TARGET="$(target)"
|
||||
|
||||
define Package/ami
|
||||
CATEGORY:=Utilities
|
||||
DEPENDS:= +libuci +libubox +ubus
|
||||
TITLE:=Asterisk management interface listener
|
||||
endef
|
||||
|
||||
define Package/ami/description
|
||||
Application that listen on the asterisk management interface to handle the leds
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
$(CP) ./src/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) \
|
||||
$(TARGET_CONFIGURE_OPTS) LINUX_DIR=$(LINUX_DIR) LDFLAGS="$(TARGET_LDFLAGS)" CFLAGS="$(TARGET_CFLAGS) -I$(LINUX_DIR)/include -I$(STAGING_DIR)/usr/include"
|
||||
endef
|
||||
|
||||
define Package/ami/install
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(CP) ./files/* $(1)/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ami_tool $(1)/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ami))
|
||||
@@ -1,30 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
START=99
|
||||
|
||||
SERVICE_DAEMONIZE=1
|
||||
SERVICE_WRITE_PID=1
|
||||
|
||||
boot() {
|
||||
start
|
||||
}
|
||||
|
||||
|
||||
start() {
|
||||
service_start /sbin/ami_tool
|
||||
}
|
||||
|
||||
|
||||
stop() {
|
||||
service_stop /sbin/ami_tool
|
||||
}
|
||||
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
|
||||
}
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
# Makefile for Asterisk management interface listener application
|
||||
|
||||
CC = gcc
|
||||
MAKEDEPEND = makedepend
|
||||
CDEBUG = -g
|
||||
CFLAGS = ${CDEBUG} ${INCL} -Wall
|
||||
LDFLAGS = ${CDEBUG}
|
||||
LIBDIR =
|
||||
LOCLIBS =
|
||||
LIBS = ${LOCLIBS} ${SYSLIBS}
|
||||
OBJS = ami_tool.o ami_connection.o ucix.o
|
||||
SRCS = ami_tool.c ami_connection.c ucix.c
|
||||
LIBSRCS =
|
||||
ISRCS = ami_tool.h ami_connection.h ucix.h
|
||||
ALLSRCS = ${SRCS} ${ISRCS} ${LIBSRCS}
|
||||
|
||||
all: ami_tool
|
||||
|
||||
ami_tool: ${OBJS}
|
||||
${CC} ${LDFLAGS} -o ami_tool ${OBJS} ${LIBDIR} ${LIBS}
|
||||
|
||||
clean:
|
||||
rm -f ami_tool ${OBJS}
|
||||
|
||||
depend:
|
||||
${MAKEDEPEND} ${INCL} ${SRCS} ${LIBSRCS}
|
||||
@@ -1,832 +0,0 @@
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
#include "ami_connection.h"
|
||||
|
||||
typedef enum ami_message {
|
||||
UNKNOWN_MESSAGE,
|
||||
LOGIN_MESSAGE,
|
||||
EVENT_MESSAGE,
|
||||
RESPONSE_MESSAGE
|
||||
} ami_message;
|
||||
|
||||
/*
|
||||
* message_frame: String defining message border
|
||||
* buffer: Buffer to parse
|
||||
* framed_message: Pointer to framed message (mallocd)
|
||||
* buffer_read: Bytes read from buffer in previous run
|
||||
*/
|
||||
static ami_message parse_buffer(char *message_frame, char *buffer, char **framed_message, int *buffer_read)
|
||||
{
|
||||
//Skip bytes already read
|
||||
buffer = &buffer[*buffer_read];
|
||||
|
||||
if (strlen(buffer) == 0) {
|
||||
return UNKNOWN_MESSAGE;
|
||||
}
|
||||
|
||||
//Locate message frame
|
||||
char *message_end = strstr(buffer, message_frame);
|
||||
if (!message_end) {
|
||||
//Could not find message frame, use left over
|
||||
//data in next call to parse_buffer
|
||||
return UNKNOWN_MESSAGE;
|
||||
}
|
||||
|
||||
//Found a message boundry
|
||||
int message_length = message_end - buffer;
|
||||
|
||||
//printf("Framed message:\n[%s]\n\n", *framed_message);
|
||||
|
||||
//Update byte counter
|
||||
*buffer_read += message_length + strlen(message_frame);
|
||||
|
||||
//Find out what type of message this is
|
||||
ami_message message_type;
|
||||
|
||||
if (!strncmp(buffer, "Asterisk Call Manager", 21)) {
|
||||
//printf("Login prompt detected\n");
|
||||
message_type = LOGIN_MESSAGE;
|
||||
} else if(!strncmp(buffer, "Event", 5)) {
|
||||
//printf("Event detected: ");
|
||||
message_type = EVENT_MESSAGE;
|
||||
} else if(!strncmp(buffer, "Response", 8)) {
|
||||
//printf("Response detected: ");
|
||||
message_type = RESPONSE_MESSAGE;
|
||||
} else {
|
||||
//printf("Unknown event: ");
|
||||
return UNKNOWN_MESSAGE;
|
||||
}
|
||||
|
||||
*framed_message = malloc(message_length +1);
|
||||
strncpy(*framed_message, buffer, message_length);
|
||||
(*framed_message)[message_length] = '\0';
|
||||
|
||||
return message_type;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the type on an event and advance the idx buffer pointer
|
||||
* to the beginning of the event.
|
||||
*/
|
||||
static ami_event_type get_event_type(char* buf, int* idx) {
|
||||
int i = 0;
|
||||
|
||||
if (!memcmp(buf, "RegistryEntry", 13)) {
|
||||
i +=13;
|
||||
while((buf[i] == '\n') || (buf[i] == '\r'))
|
||||
i++;
|
||||
|
||||
*idx = i;
|
||||
return REGISTRY_ENTRY;
|
||||
} else if (!memcmp(buf, "Registry", 8)) {
|
||||
i +=8;
|
||||
while((buf[i] == '\n') || (buf[i] == '\r'))
|
||||
i++;
|
||||
|
||||
*idx = i;
|
||||
return REGISTRY;
|
||||
} else if (!memcmp(buf, "RegistrationsComplete", 4)) {
|
||||
i +=21;
|
||||
while((buf[i] == '\n') || (buf[i] == '\r'))
|
||||
i++;
|
||||
|
||||
*idx = i;
|
||||
return REGISTRATIONS_COMPLETE;
|
||||
} else if (!memcmp(buf, "BRCM", 4)) {
|
||||
i +=8;
|
||||
while((buf[i] == '\n') || (buf[i] == '\r'))
|
||||
i++;
|
||||
|
||||
*idx = i;
|
||||
return BRCM;
|
||||
} else if (!memcmp(buf, "ChannelReload", 13)) {
|
||||
i +=8;
|
||||
while((buf[i] == '\n') || (buf[i] == '\r'))
|
||||
i++;
|
||||
|
||||
*idx = i;
|
||||
return CHANNELRELOAD;
|
||||
} else if (!memcmp(buf, "FullyBooted", 11)) {
|
||||
i +=11;
|
||||
while((buf[i] == '\n') || (buf[i] == '\r'))
|
||||
i++;
|
||||
|
||||
*idx = i;
|
||||
return FULLYBOOTED;
|
||||
} else if (!memcmp(buf, "VarSet", 6)) {
|
||||
i +=6;
|
||||
while((buf[i] == '\n') || (buf[i] == '\r'))
|
||||
i++;
|
||||
|
||||
*idx = i;
|
||||
return VARSET;
|
||||
|
||||
} // else if() handle other events
|
||||
|
||||
while(buf[i] || i > AMI_BUFLEN) {
|
||||
if (buf[i] == '\n') {
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
*idx = i;
|
||||
printf("Unhandled event\n%s\n", buf);
|
||||
return UNKNOWN_EVENT;
|
||||
}
|
||||
|
||||
static char *trim_whitespace(char *str)
|
||||
{
|
||||
char *end;
|
||||
while (isspace(*str)) {
|
||||
str++;
|
||||
}
|
||||
if(*str == 0) {
|
||||
return str;
|
||||
}
|
||||
end = str + strlen(str) - 1;
|
||||
while(end > str && isspace(*end)) {
|
||||
end--;
|
||||
}
|
||||
*(end+1) = 0;
|
||||
return str;
|
||||
}
|
||||
|
||||
ami_event parse_registry_event(char* buf)
|
||||
{
|
||||
ami_event event;
|
||||
event.type = REGISTRY;
|
||||
event.registry_event = malloc(sizeof(registry_event));
|
||||
event.registry_event->status = REGISTRY_UNKNOWN_EVENT;
|
||||
event.registry_event->account_name = NULL;
|
||||
|
||||
char* domain = strstr(buf, "Domain: ");
|
||||
if (domain) {
|
||||
domain += 8; //Increment pointer to start of domain name
|
||||
int len = 0;
|
||||
while (domain[len] && !isspace(domain[len])) {
|
||||
len++;
|
||||
}
|
||||
char* account_name = calloc(len + 1, sizeof(char));
|
||||
strncpy(account_name, domain, len);
|
||||
event.registry_event->account_name = account_name;
|
||||
printf("Found domain: %s of length %d\n", account_name, len);
|
||||
}
|
||||
else {
|
||||
printf("Warning: No domain found in Registry event\n");
|
||||
}
|
||||
|
||||
char* status = NULL;
|
||||
if ((status = strstr(buf, "Status: Request Sent"))) {
|
||||
event.registry_event->status = REGISTRY_REQUEST_SENT_EVENT;
|
||||
}
|
||||
else if ((status = strstr(buf, "Status: Unregistered"))) {
|
||||
event.registry_event->status = REGISTRY_UNREGISTERED_EVENT;
|
||||
}
|
||||
else if ((status = strstr(buf, "Status: Registered"))) {
|
||||
event.registry_event->status = REGISTRY_REGISTERED_EVENT;
|
||||
}
|
||||
else {
|
||||
printf("Warning: No status found in Registry event\n");
|
||||
}
|
||||
|
||||
return event;
|
||||
}
|
||||
|
||||
ami_event parse_registry_entry_event(char* buf)
|
||||
{
|
||||
ami_event event;
|
||||
memset(&event, 0, sizeof(event));
|
||||
|
||||
event.type = REGISTRY_ENTRY;
|
||||
event.registry_entry_event = (registry_entry_event*)malloc(sizeof(registry_entry_event));
|
||||
event.registry_entry_event->host = 0;
|
||||
event.registry_entry_event->port = 0;
|
||||
event.registry_entry_event->username = 0;
|
||||
event.registry_entry_event->domain = 0;
|
||||
event.registry_entry_event->refresh = 0;
|
||||
event.registry_entry_event->state = 0;
|
||||
event.registry_entry_event->registration_time = 0;
|
||||
|
||||
char* host_start = strstr(buf, "Host:");
|
||||
if (host_start) {
|
||||
//Found host
|
||||
host_start += 6; //Advance to start of content
|
||||
char* host_end = strstr(host_start, "\r\n");
|
||||
if (host_end) {
|
||||
//Found end of host
|
||||
int host_len = host_end - host_start;
|
||||
event.registry_entry_event->host = (char*)calloc(host_len + 1, 1);
|
||||
strncpy(event.registry_entry_event->host, host_start, host_len);
|
||||
}
|
||||
}
|
||||
|
||||
char* port_start = strstr(buf, "Port:");
|
||||
if (port_start) {
|
||||
//Found port
|
||||
port_start += 6; //Advance to start of content
|
||||
event.registry_entry_event->port = strtol(port_start, NULL, 10);
|
||||
}
|
||||
|
||||
char* username_start = strstr(buf, "Username:");
|
||||
if (username_start) {
|
||||
//Found username
|
||||
username_start += 10; //Advance to start of content
|
||||
char* username_end = strstr(username_start, "\r\n");
|
||||
if (username_end) {
|
||||
//Found end of username
|
||||
int username_len = username_end - username_start;
|
||||
event.registry_entry_event->username = (char*)calloc(username_len + 1, 1);
|
||||
strncpy(event.registry_entry_event->username, username_start, username_len);
|
||||
}
|
||||
}
|
||||
|
||||
char* domain_start = strstr(buf, "Domain:");
|
||||
if (domain_start) {
|
||||
//Found domain
|
||||
domain_start += 8; //Advance to start of content
|
||||
char* domain_end = strstr(domain_start, "\r\n");
|
||||
if (domain_end) {
|
||||
//Found end of domain
|
||||
int domain_len = domain_end - domain_start;
|
||||
event.registry_entry_event->domain = (char*)calloc(domain_len + 1, 1);
|
||||
strncpy(event.registry_entry_event->domain, domain_start, domain_len);
|
||||
}
|
||||
}
|
||||
|
||||
char* domain_port_start = strstr(buf, "DomainPort:");
|
||||
if (domain_port_start) {
|
||||
//Found port
|
||||
domain_port_start += 12; //Advance to start of content
|
||||
event.registry_entry_event->port = strtol(domain_port_start, NULL, 10);
|
||||
}
|
||||
|
||||
char* refresh_start = strstr(buf, "Refresh:");
|
||||
if (refresh_start) {
|
||||
//Found refresh interval
|
||||
refresh_start += 9; //Advance to start of content
|
||||
event.registry_entry_event->refresh = strtol(refresh_start, NULL, 10);
|
||||
}
|
||||
|
||||
char* state_start = strstr(buf, "State:");
|
||||
if (state_start) {
|
||||
//Found state
|
||||
state_start += 7; //Advance to start of content
|
||||
char* state_end = strstr(state_start, "\r\n");
|
||||
if (state_end) {
|
||||
//Found end of state
|
||||
int state_len = state_end - state_start;
|
||||
event.registry_entry_event->state = (char*)calloc(state_len + 1, 1);
|
||||
strncpy(event.registry_entry_event->state, state_start, state_len);
|
||||
}
|
||||
}
|
||||
|
||||
char* registration_time_start = strstr(buf, "RegistrationTime:");
|
||||
if (registration_time_start) {
|
||||
//Found reg timestamp
|
||||
registration_time_start += 18; //Advance to start of content
|
||||
event.registry_entry_event->registration_time = strtol(registration_time_start, NULL, 10);
|
||||
}
|
||||
|
||||
return event;
|
||||
}
|
||||
|
||||
ami_event parse_brcm_event(char* buf)
|
||||
{
|
||||
ami_event event;
|
||||
memset(&event, 0, sizeof(event));
|
||||
|
||||
event.type = BRCM;
|
||||
event.brcm_event = malloc(sizeof(brcm_event));
|
||||
event.brcm_event->type = BRCM_UNKNOWN_EVENT;
|
||||
|
||||
char* event_type = NULL;
|
||||
char parse_buffer[AMI_BUFLEN];
|
||||
char delimiter = ' ';
|
||||
char *value;
|
||||
|
||||
if ((event_type = strstr(buf, "Status: "))) {
|
||||
event.brcm_event->type = BRCM_STATUS_EVENT;
|
||||
strncpy(parse_buffer, event_type + 8, AMI_BUFLEN);
|
||||
parse_buffer[AMI_BUFLEN -1] = '\0';
|
||||
//strcpy(parse_buffer, event_type + 8);
|
||||
|
||||
value = strtok(parse_buffer, &delimiter);
|
||||
if (value && !strcmp(value, "OFF")) {
|
||||
event.brcm_event->status.off_hook = 1;
|
||||
}
|
||||
else if (value && !strcmp(value, "ON")) {
|
||||
event.brcm_event->status.off_hook = 0;
|
||||
}
|
||||
else {
|
||||
printf("Warning: No/Unknown status in brcm status event\n");
|
||||
}
|
||||
|
||||
value = strtok(NULL, &delimiter);
|
||||
if (value) {
|
||||
event.brcm_event->status.line_id = strtol(value, NULL, 10);
|
||||
}
|
||||
else {
|
||||
printf("Warning: No/Unknown line id in brcm status event\n");
|
||||
event.brcm_event->status.line_id = 0;
|
||||
}
|
||||
}
|
||||
else if ((event_type = strstr(buf, "State: "))) {
|
||||
event.brcm_event->type = BRCM_STATE_EVENT;
|
||||
strncpy(parse_buffer, event_type + 7, AMI_BUFLEN);
|
||||
parse_buffer[AMI_BUFLEN -1] = '\0';
|
||||
//strcpy(parse_buffer, event_type + 7);
|
||||
|
||||
value = strtok(parse_buffer, &delimiter);
|
||||
if (value) {
|
||||
value = trim_whitespace(value);
|
||||
event.brcm_event->state.state = calloc(strlen(value) + 1, sizeof(char));
|
||||
strcpy(event.brcm_event->state.state, value);
|
||||
}
|
||||
else {
|
||||
printf("Warning: No state in brcm state event\n");
|
||||
event.brcm_event->state.state = NULL;
|
||||
}
|
||||
|
||||
value = strtok(NULL, &delimiter);
|
||||
if (value) {
|
||||
event.brcm_event->state.line_id = strtol(value, NULL, 10);
|
||||
}
|
||||
else {
|
||||
printf("Warning: No line_id in brcm state event\n");
|
||||
event.brcm_event->state.line_id = -1;
|
||||
}
|
||||
|
||||
value = strtok(NULL, &delimiter);
|
||||
if (value) {
|
||||
event.brcm_event->state.subchannel_id = strtol(value, NULL, 10);
|
||||
}
|
||||
else {
|
||||
printf("Warning: No subchannel_id in brcm state event\n");
|
||||
event.brcm_event->state.subchannel_id = -1;
|
||||
}
|
||||
}
|
||||
else if ((event_type = strstr(buf, "Module unload"))) {
|
||||
event.brcm_event->type = BRCM_MODULE_EVENT;
|
||||
event.brcm_event->module_loaded = 0;
|
||||
}
|
||||
else if ((event_type = strstr(buf, "Module load"))) {
|
||||
event.brcm_event->type = BRCM_MODULE_EVENT;
|
||||
event.brcm_event->module_loaded = 1;
|
||||
}
|
||||
|
||||
return event;
|
||||
}
|
||||
|
||||
ami_event parse_varset_event(char* buf)
|
||||
{
|
||||
int len;
|
||||
ami_event event;
|
||||
memset(&event, 0, sizeof(event));
|
||||
event.type = VARSET;
|
||||
event.varset_event = malloc(sizeof(varset_event));
|
||||
|
||||
char* channel = strstr(buf, "Channel: ");
|
||||
if (channel) {
|
||||
channel += 9; //Increment pointer to start of channel
|
||||
len = 0;
|
||||
while (channel[len] && !isspace(channel[len])) {
|
||||
len++;
|
||||
}
|
||||
event.varset_event->channel = calloc(len + 1, sizeof(char));
|
||||
strncpy(event.varset_event->channel, channel, len);
|
||||
}
|
||||
else {
|
||||
printf("Warning: No Channel in varset event\n");
|
||||
event.varset_event->channel = NULL;
|
||||
}
|
||||
|
||||
char* variable = strstr(buf, "Variable: ");
|
||||
if (variable) {
|
||||
variable += 10; //Increment pointer to start of variable
|
||||
len = 0;
|
||||
while (variable[len] && !isspace(variable[len])) {
|
||||
len++;
|
||||
}
|
||||
event.varset_event->variable = calloc(len + 1, sizeof(char));
|
||||
strncpy(event.varset_event->variable, variable, len);
|
||||
}
|
||||
else {
|
||||
printf("Warning: No Variable in varset event\n");
|
||||
event.varset_event->variable = NULL;
|
||||
}
|
||||
|
||||
char* value = strstr(buf, "Value: ");
|
||||
if (value) {
|
||||
value += 7; //Increment pointer to start of value
|
||||
len = 0;
|
||||
while (value[len] && !isspace(value[len])) {
|
||||
len++;
|
||||
}
|
||||
event.varset_event->value = calloc(len + 1, sizeof(char));
|
||||
strncpy(event.varset_event->value, value, len);
|
||||
}
|
||||
else {
|
||||
printf("Warning: No Value in varset event\n");
|
||||
event.varset_event->value = NULL;
|
||||
}
|
||||
return event;
|
||||
}
|
||||
|
||||
ami_event parse_channel_reload_event(char* buf) {
|
||||
ami_event event;
|
||||
memset(&event, 0, sizeof(event));
|
||||
event.type = CHANNELRELOAD;
|
||||
event.channel_reload_event = malloc(sizeof(channel_reload_event));
|
||||
|
||||
char* result;
|
||||
if ((result = strstr(buf, "ChannelType: SIP"))) {
|
||||
event.channel_reload_event->channel_type = CHANNELRELOAD_SIP_EVENT;
|
||||
}
|
||||
else {
|
||||
printf("Warning: unknown channel in ChannelReload event\n");
|
||||
event.channel_reload_event->channel_type = CHANNELRELOAD_UNKNOWN_EVENT;
|
||||
}
|
||||
return event;
|
||||
}
|
||||
|
||||
ami_event parse_fully_booted_event(char* buf) {
|
||||
ami_event event;
|
||||
memset(&event, 0, sizeof(event));
|
||||
event.type = FULLYBOOTED;
|
||||
return event;
|
||||
}
|
||||
|
||||
void ami_free_event(ami_event event) {
|
||||
switch (event.type) {
|
||||
case REGISTRY:
|
||||
free(event.registry_event->account_name);
|
||||
free(event.registry_event);
|
||||
break;
|
||||
case BRCM:
|
||||
if (event.brcm_event->type == BRCM_STATE_EVENT) {
|
||||
free(event.brcm_event->state.state);
|
||||
}
|
||||
free(event.brcm_event);
|
||||
break;
|
||||
case CHANNELRELOAD:
|
||||
free(event.channel_reload_event);
|
||||
break;
|
||||
case VARSET:
|
||||
free(event.varset_event->channel);
|
||||
free(event.varset_event->value);
|
||||
free(event.varset_event->variable);
|
||||
free(event.varset_event);
|
||||
break;
|
||||
case REGISTRY_ENTRY:
|
||||
free(event.registry_entry_event->host);
|
||||
free(event.registry_entry_event->domain);
|
||||
free(event.registry_entry_event->state);
|
||||
free(event.registry_entry_event->username);
|
||||
free(event.registry_entry_event);
|
||||
break;
|
||||
case FULLYBOOTED:
|
||||
case LOGIN:
|
||||
case DISCONNECT:
|
||||
case REGISTRATIONS_COMPLETE:
|
||||
/* no event data to free */
|
||||
break;
|
||||
case UNKNOWN_EVENT:
|
||||
break;
|
||||
default:
|
||||
printf("WARNING: Unhandled event type, can't free (may leak)\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void ami_handle_event(ami_connection* con, char* message)
|
||||
{
|
||||
int idx = 0;
|
||||
ami_event_type type = get_event_type(message, &idx);
|
||||
ami_event event;
|
||||
memset(&event, 0, sizeof(event));
|
||||
|
||||
switch(type) {
|
||||
case BRCM:
|
||||
event = parse_brcm_event(&message[idx]);
|
||||
break;
|
||||
case CHANNELRELOAD:
|
||||
event = parse_channel_reload_event(&message[idx]);
|
||||
break;
|
||||
case FULLYBOOTED:
|
||||
event = parse_fully_booted_event(&message[idx]);
|
||||
break;
|
||||
case VARSET:
|
||||
event = parse_varset_event(&message[idx]);
|
||||
break;
|
||||
case REGISTRY:
|
||||
event = parse_registry_event(&message[idx]);
|
||||
break;
|
||||
case REGISTRY_ENTRY:
|
||||
event = parse_registry_entry_event(&message[idx]);
|
||||
break;
|
||||
case REGISTRATIONS_COMPLETE:
|
||||
/*
|
||||
* Probably not needed.
|
||||
* (this happens after all registry entry events have been received)
|
||||
* Event: RegistrationsComplete
|
||||
* EventList: Complete
|
||||
* ListItems: 1
|
||||
*/
|
||||
event.type = REGISTRATIONS_COMPLETE;
|
||||
break;
|
||||
case UNKNOWN_EVENT:
|
||||
default:
|
||||
event.type = UNKNOWN_EVENT;
|
||||
break;
|
||||
}
|
||||
|
||||
//Let client handle the event
|
||||
if (con->event_callback) {
|
||||
con->event_callback(con, event);
|
||||
}
|
||||
|
||||
ami_free_event(event);
|
||||
}
|
||||
|
||||
static void ami_send_action(ami_connection* con, ami_action* action) {
|
||||
if (con->current_action) {
|
||||
printf("ERROR: Attempt to send AMI action, but there is already an action pending\n");
|
||||
return;
|
||||
}
|
||||
con->current_action = action;
|
||||
write(con->sd, action->message, strlen(action->message));
|
||||
}
|
||||
|
||||
static void ami_handle_response(ami_connection* con, char* message)
|
||||
{
|
||||
ami_action* current = con->current_action;
|
||||
assert(current);
|
||||
|
||||
ami_action* next = current->next_action;
|
||||
con->current_action = NULL;
|
||||
|
||||
if (next) {
|
||||
ami_send_action(con, next);
|
||||
}
|
||||
|
||||
if (current->callback) {
|
||||
current->callback(con, message);
|
||||
}
|
||||
|
||||
free(current);
|
||||
}
|
||||
|
||||
static void queue_action(ami_connection* con, ami_action* action)
|
||||
{
|
||||
action->next_action = NULL;
|
||||
if (con->current_action) {
|
||||
ami_action* a = con->current_action;
|
||||
while(a->next_action) {
|
||||
a = a->next_action;
|
||||
}
|
||||
a->next_action = action;
|
||||
}
|
||||
else {
|
||||
ami_send_action(con, action);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* PUBLIC FUNCTION IMPLEMENTATIONS
|
||||
*/
|
||||
|
||||
ami_connection* ami_init(ami_event_cb on_event) {
|
||||
ami_connection* con;
|
||||
con = calloc(1, sizeof(*con));
|
||||
|
||||
con->connected = 0;
|
||||
con->sd = -1;
|
||||
bzero(con->message_frame, sizeof(con->message_frame));
|
||||
memset(con->left_over, 0, AMI_BUFLEN * 2 + 1);
|
||||
con->current_action = NULL;
|
||||
con->event_callback = on_event;
|
||||
|
||||
return con;
|
||||
}
|
||||
|
||||
int ami_connect(ami_connection* con, const char* hostname, const char* portno)
|
||||
{
|
||||
ami_disconnect(con);
|
||||
int result = 0;
|
||||
strncpy(con->message_frame, MESSAGE_FRAME_LOGIN, MESSAGE_FRAME_LEN);
|
||||
|
||||
struct addrinfo *host;
|
||||
int err = getaddrinfo(hostname, portno, NULL, &host);
|
||||
if (err) {
|
||||
fprintf(stderr, "Unable to connect to AMI: %s\n", gai_strerror(err));
|
||||
con->connected = 0;
|
||||
return result;
|
||||
}
|
||||
con->sd = socket(AF_INET, SOCK_STREAM, 0);
|
||||
int res = connect(con->sd, host->ai_addr, host->ai_addrlen);
|
||||
if (res == 0) {
|
||||
//printf("Connected to AMI\n");
|
||||
con->connected = 1;
|
||||
result = 1;
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "Unable to connect to AMI: %s\n", strerror(errno));
|
||||
con->connected = 0;
|
||||
result = 0;
|
||||
}
|
||||
freeaddrinfo(host);
|
||||
return result;
|
||||
}
|
||||
|
||||
void ami_disconnect(ami_connection* con)
|
||||
{
|
||||
if (con->connected) {
|
||||
close(con->sd);
|
||||
con->sd = -1;
|
||||
con->connected = 0;
|
||||
|
||||
//Let client know about disconnect
|
||||
ami_event event;
|
||||
memset(&event, 0, sizeof(event));
|
||||
event.type = DISCONNECT;
|
||||
con->event_callback(con, event);
|
||||
}
|
||||
}
|
||||
|
||||
void ami_free(ami_connection* con) {
|
||||
ami_disconnect(con);
|
||||
free(con);
|
||||
}
|
||||
|
||||
/*
|
||||
* Called by client when ami_connection has new data to process
|
||||
*/
|
||||
void ami_handle_data(ami_connection* con)
|
||||
{
|
||||
//printf("Handling data on AMI connection\n");
|
||||
int idx = 0; //buffer position
|
||||
char* message = NULL;
|
||||
char buf[AMI_BUFLEN * 2 + 1];
|
||||
|
||||
//Read data from ami
|
||||
memset(buf, 0, AMI_BUFLEN * 2 + 1);
|
||||
if (read(con->sd, buf, AMI_BUFLEN-1) <= 0) {
|
||||
ami_disconnect(con); //we have been disconnected
|
||||
return;
|
||||
}
|
||||
|
||||
//Concatenate left over data with newly read
|
||||
if (strlen(con->left_over)) {
|
||||
char tmp[AMI_BUFLEN * 2 + 1];
|
||||
strcpy(tmp, con->left_over);
|
||||
strcat(tmp, buf);
|
||||
strcpy(buf, tmp);
|
||||
con->left_over[0] = '\0';
|
||||
}
|
||||
|
||||
ami_message message_type = UNKNOWN_MESSAGE;
|
||||
ami_event event;
|
||||
memset(&event, 0, sizeof(event));
|
||||
|
||||
while(idx < strlen(buf)) {
|
||||
message_type = parse_buffer(con->message_frame, buf, &message, &idx);
|
||||
if (message_type == UNKNOWN_MESSAGE) {
|
||||
break;
|
||||
}
|
||||
switch (message_type) {
|
||||
case LOGIN_MESSAGE:
|
||||
//Send login event to client (time to log in...)
|
||||
event.type = LOGIN;
|
||||
con->event_callback(con, event);
|
||||
ami_free_event(event);
|
||||
break;
|
||||
case EVENT_MESSAGE:
|
||||
ami_handle_event(con, message + 7);
|
||||
break;
|
||||
case RESPONSE_MESSAGE:
|
||||
ami_handle_response(con, message);
|
||||
break;
|
||||
default:
|
||||
printf("Unknown data from AMI: %s\n", message);
|
||||
break;
|
||||
}
|
||||
free(message);
|
||||
}
|
||||
|
||||
//store remaining buffer until next packet is read
|
||||
if (idx < strlen(buf)) {
|
||||
strcpy(con->left_over, &buf[idx]);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* ACTIONS
|
||||
* Send an Action to AMI. We expect a response to this, so its possible to provide
|
||||
* a callback that will be executed when a response is retrieved. There can only
|
||||
* be one action pending at a time. If one is already pending, any new attempts
|
||||
* will be ignored.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Send command to reload sip channel.
|
||||
* CHANNELRELOAD event will be received when reload is completed.
|
||||
*
|
||||
* Example response:
|
||||
* "Response: Follows
|
||||
* Privilege: Command
|
||||
* --END COMMAND--"
|
||||
*/
|
||||
void ami_send_sip_reload(ami_connection* con, ami_response_cb on_response) {
|
||||
//printf("Queueing Action: ami_send_sip_reload\n");
|
||||
ami_action* action = malloc(sizeof(ami_action));
|
||||
action->callback = on_response;
|
||||
sprintf(action->message,"Action: Command\r\nCommand: sip reload\r\n\r\n");
|
||||
queue_action(con, action);
|
||||
}
|
||||
|
||||
/*
|
||||
* Send username and password to AMI
|
||||
*
|
||||
* Example response:
|
||||
* "Response: Success
|
||||
* Message: Authentication accepted"
|
||||
*/
|
||||
void ami_send_login(ami_connection* con, char* username, char* password, ami_response_cb on_response)
|
||||
{
|
||||
//printf("Queueing Action: ami_send_login\n");
|
||||
strncpy(con->message_frame, MESSAGE_FRAME, MESSAGE_FRAME_LEN); //Login sent, now there's always <CR><LF><CR><LR> after a message
|
||||
ami_action* action = malloc(sizeof(ami_action));
|
||||
action->callback = on_response;
|
||||
sprintf(action->message,"Action: Login\r\nUsername: %s\r\nSecret: %s\r\n\r\n", username, password);
|
||||
queue_action(con, action);
|
||||
}
|
||||
|
||||
/*
|
||||
* Request an indication on if BRCM module is loaded or not
|
||||
*
|
||||
* Example response:
|
||||
* "Response: Follows
|
||||
* Privilege: Command
|
||||
* --END COMMAND--"
|
||||
*/
|
||||
void ami_send_brcm_module_show(ami_connection* con, ami_response_cb on_response) {
|
||||
//printf("Queueing Action: ami_send_brcm_module_show\n");
|
||||
ami_action* action = malloc(sizeof(ami_action));
|
||||
action->callback = on_response;
|
||||
sprintf(action->message, "Action: Command\r\nCommand: module show like chan_brcm\r\n\r\n");
|
||||
queue_action(con, action);
|
||||
}
|
||||
|
||||
/*
|
||||
* Request an indication on the port configuration
|
||||
*
|
||||
* Example response:
|
||||
* "Response: Success
|
||||
* Message:
|
||||
* FXS 2
|
||||
* DECT 4"
|
||||
*/
|
||||
void ami_send_brcm_ports_show(ami_connection* con, ami_response_cb on_response) {
|
||||
//printf("Queueing Action: ami_send_brcm_ports_show\n");
|
||||
ami_action* action = malloc(sizeof(ami_action));
|
||||
action->callback = on_response;
|
||||
sprintf(action->message, "Action: BRCMPortsShow\r\n\r\n");
|
||||
queue_action(con, action);
|
||||
}
|
||||
|
||||
/*
|
||||
* Request SIP Registry information
|
||||
* (response is a simple message, then the registry events
|
||||
* follow separately, one per registered account)
|
||||
* Example response:
|
||||
* Response: Success
|
||||
* EventList: start
|
||||
* Message: Registrations will follow
|
||||
*
|
||||
* Event: RegistryEntry
|
||||
* Host: sip0
|
||||
* Port: 5060
|
||||
* Username: 0510409896
|
||||
* Domain: 62.80.209.10
|
||||
* DomainPort: 5060
|
||||
* Refresh: 5385
|
||||
* State: Registered
|
||||
* RegistrationTime: 1401282865
|
||||
*
|
||||
* Event: RegistrationsComplete
|
||||
* EventList: Complete
|
||||
* ListItems: 1
|
||||
*/
|
||||
void ami_send_sip_show_registry(ami_connection* con, ami_response_cb on_response) {
|
||||
ami_action* action = (ami_action*)malloc(sizeof(ami_action));
|
||||
action->callback = on_response;
|
||||
sprintf(action->message, "Action: SIPshowregistry\r\n\r\n");
|
||||
queue_action(con, action);
|
||||
}
|
||||
@@ -1,131 +0,0 @@
|
||||
/*
|
||||
* ami_connection.h
|
||||
*
|
||||
* Manage connections to AMI.
|
||||
*
|
||||
* Callbacks in client code will be called when events or responses have been received
|
||||
* from AMI. There is no event loop built in, client should call ami_handle_data whenever
|
||||
* new data is available on the connections filedescriptor.
|
||||
*/
|
||||
|
||||
#define MESSAGE_FRAME "\r\n\r\n"
|
||||
#define MESSAGE_FRAME_LOGIN "\r\n"
|
||||
#define MESSAGE_FRAME_LEN 5
|
||||
|
||||
#define AMI_BUFLEN 512
|
||||
|
||||
typedef struct {
|
||||
enum {
|
||||
BRCM_UNKNOWN_EVENT,
|
||||
BRCM_STATUS_EVENT,
|
||||
BRCM_STATE_EVENT,
|
||||
BRCM_MODULE_EVENT
|
||||
} type;
|
||||
struct {
|
||||
int line_id;
|
||||
int off_hook;
|
||||
} status;
|
||||
struct {
|
||||
int line_id;
|
||||
int subchannel_id;
|
||||
char* state;
|
||||
} state;
|
||||
int module_loaded;
|
||||
} brcm_event;
|
||||
|
||||
typedef struct {
|
||||
char* account_name;
|
||||
enum {
|
||||
REGISTRY_UNKNOWN_EVENT,
|
||||
REGISTRY_REQUEST_SENT_EVENT,
|
||||
REGISTRY_UNREGISTERED_EVENT,
|
||||
REGISTRY_REGISTERED_EVENT
|
||||
} status;
|
||||
} registry_event;
|
||||
|
||||
typedef struct {
|
||||
char* host; //Account name (e.g. sip0)
|
||||
int port; //5060
|
||||
char* username; //0510409896
|
||||
char* domain; //62.80.209.10
|
||||
int domain_port; //5060
|
||||
int refresh; //Refresh interval, 285
|
||||
char* state; //Registration state Registered
|
||||
int registration_time; //Registration timestamp, 1401282865
|
||||
} registry_entry_event;
|
||||
|
||||
typedef struct {
|
||||
enum {
|
||||
CHANNELRELOAD_UNKNOWN_EVENT,
|
||||
CHANNELRELOAD_SIP_EVENT
|
||||
} channel_type;
|
||||
} channel_reload_event;
|
||||
|
||||
typedef struct {
|
||||
char* channel;
|
||||
char* variable;
|
||||
char* value;
|
||||
} varset_event;
|
||||
|
||||
typedef enum ami_event_type {
|
||||
LOGIN,
|
||||
REGISTRY,
|
||||
REGISTRY_ENTRY,
|
||||
REGISTRATIONS_COMPLETE,
|
||||
BRCM,
|
||||
CHANNELRELOAD,
|
||||
FULLYBOOTED,
|
||||
VARSET,
|
||||
DISCONNECT,
|
||||
UNKNOWN_EVENT,
|
||||
} ami_event_type;
|
||||
|
||||
typedef struct ami_event {
|
||||
ami_event_type type;
|
||||
brcm_event* brcm_event;
|
||||
registry_event* registry_event;
|
||||
registry_entry_event* registry_entry_event;
|
||||
channel_reload_event* channel_reload_event;
|
||||
varset_event* varset_event;
|
||||
} ami_event;
|
||||
|
||||
typedef struct ami_connection ami_connection;
|
||||
typedef struct ami_action ami_action;
|
||||
typedef void (*ami_event_cb) (ami_connection* con, ami_event event);
|
||||
typedef void (*ami_response_cb) (ami_connection* con, char* buf);
|
||||
/*
|
||||
* Holds data related to an AMI connection
|
||||
*/
|
||||
struct ami_connection {
|
||||
int connected; //ami_connection is connected to asterisk
|
||||
int sd;
|
||||
char message_frame[MESSAGE_FRAME_LEN];
|
||||
char left_over[AMI_BUFLEN * 2 + 1];
|
||||
ami_event_cb event_callback;
|
||||
ami_action* current_action;
|
||||
};
|
||||
|
||||
ami_connection* ami_init(ami_event_cb on_event);
|
||||
int ami_connect(ami_connection* con, const char* hostname, const char* portno);
|
||||
void ami_disconnect(ami_connection* con);
|
||||
void ami_free(ami_connection* con);
|
||||
|
||||
/*
|
||||
* Call when new data is available
|
||||
*/
|
||||
void ami_handle_data(ami_connection* con);
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
struct ami_action {
|
||||
char message[AMI_BUFLEN];
|
||||
ami_response_cb callback;
|
||||
ami_action* next_action;
|
||||
};
|
||||
|
||||
void ami_send_sip_reload(ami_connection* con, ami_response_cb on_response);
|
||||
void ami_send_login(ami_connection* con, char*username, char* password, ami_response_cb on_response);
|
||||
void ami_send_brcm_module_show(ami_connection* con, ami_response_cb on_response);
|
||||
void ami_send_brcm_ports_show(ami_connection* con, ami_response_cb on_response);
|
||||
void ami_send_sip_show_registry(ami_connection* con, ami_response_cb on_response);
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,250 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
//For dynamic firewall support
|
||||
#define IPTABLES_CHAIN "zone_wan_input"
|
||||
#define IPTABLES_BIN "iptables"
|
||||
#define IPTABLES_FILE "/etc/firewall.sip"
|
||||
#ifdef USE_IPV6
|
||||
#define IP6TABLES_BIN "ip6tables"
|
||||
#define IP6TABLES_FILE "/etc/firewall6.sip"
|
||||
#endif
|
||||
#define ECHO_BIN "echo"
|
||||
#define UCI_BIN "uci"
|
||||
#define UCI_VOICE_PACKAGE "voice_client"
|
||||
|
||||
#ifndef NI_MAXHOST
|
||||
#define NI_MAXHOST 65
|
||||
#endif
|
||||
#define MAX_IP_LIST_LENGTH 20
|
||||
#define RTP_RANGE_START_DEFAULT 10000
|
||||
#define RTP_RANGE_END_DEFAULT 20000
|
||||
|
||||
#define BUFLEN 512
|
||||
|
||||
typedef struct IP
|
||||
{
|
||||
int family;
|
||||
char addr[NI_MAXHOST];
|
||||
} IP;
|
||||
|
||||
typedef enum AMI_STATE {
|
||||
DISCONNECTED, //Not connected to AMI
|
||||
CONNECTED, //Connected to AMI
|
||||
LOGGED_IN, //Logged in to AMI
|
||||
READY //Ready to handle all events
|
||||
} AMI_STATE;
|
||||
AMI_STATE state;
|
||||
|
||||
typedef enum LED_STATE
|
||||
{
|
||||
LS_OK,
|
||||
LS_NOTICE,
|
||||
LS_ALERT,
|
||||
LS_ERROR,
|
||||
LS_OFF,
|
||||
LS_UNKNOWN
|
||||
} LED_STATE;
|
||||
|
||||
#define MAX_LED_STATE 10
|
||||
typedef struct LED_STATE_MAP
|
||||
{
|
||||
LED_STATE state;
|
||||
char str[MAX_LED_STATE];
|
||||
} LED_STATE_MAP;
|
||||
|
||||
static const LED_STATE_MAP led_states[] =
|
||||
{
|
||||
{LS_OK, "ok"},
|
||||
{LS_NOTICE, "notice"},
|
||||
{LS_ALERT, "alert"},
|
||||
{LS_ERROR, "error"},
|
||||
{LS_OFF, "off"},
|
||||
{LS_UNKNOWN, "-"},
|
||||
};
|
||||
|
||||
typedef enum LED_NAME
|
||||
{
|
||||
LN_DSL,
|
||||
LN_WIFI,
|
||||
LN_WPS,
|
||||
LN_LAN,
|
||||
LN_STATUS,
|
||||
LN_DECT,
|
||||
LN_TV,
|
||||
LN_USB,
|
||||
LN_WAN,
|
||||
LN_INTERNET,
|
||||
LN_VOICE1,
|
||||
LN_VOICE2,
|
||||
LN_ECO,
|
||||
LN_ALL,
|
||||
LN_UNKNOWN
|
||||
} LED_NAME;
|
||||
|
||||
#define MAX_LED_NAME 13
|
||||
typedef struct LED_NAME_MAP
|
||||
{
|
||||
LED_NAME name;
|
||||
char str[MAX_LED_NAME];
|
||||
} LED_NAME_MAP;
|
||||
|
||||
static const LED_NAME_MAP led_names[] =
|
||||
{
|
||||
{LN_DSL, "led.dsl"},
|
||||
{LN_WIFI, "led.wifi"},
|
||||
{LN_WPS, "led.wps"},
|
||||
{LN_LAN, "led.lan"},
|
||||
{LN_STATUS, "led.status"},
|
||||
{LN_DECT, "led.dect"},
|
||||
{LN_TV, "led.tv"},
|
||||
{LN_USB, "led.usb"},
|
||||
{LN_WAN, "led.wan"},
|
||||
{LN_INTERNET, "led.internet"},
|
||||
{LN_VOICE1, "led.voice1"},
|
||||
{LN_VOICE2, "led.voice2"},
|
||||
{LN_ECO, "led.eco"},
|
||||
{LN_ALL, "All"},
|
||||
{LN_UNKNOWN, "-"}
|
||||
};
|
||||
|
||||
typedef struct LED_CURRENT_STATE_MAP
|
||||
{
|
||||
LED_NAME name;
|
||||
LED_STATE state;
|
||||
} LED_CURRENT_STATE_MAP;
|
||||
|
||||
static LED_CURRENT_STATE_MAP led_current_states[] =
|
||||
{
|
||||
{LN_VOICE1, LS_UNKNOWN},
|
||||
{LN_VOICE2, LS_UNKNOWN},
|
||||
{LN_UNKNOWN, LS_UNKNOWN}
|
||||
};
|
||||
|
||||
//These are used to map SIP peer name to a port
|
||||
//CPE may be configured to share the same SIP-account for several ports or to use individual accounts
|
||||
typedef enum BRCM_PORT
|
||||
{
|
||||
PORT_BRCM0 = 0,
|
||||
PORT_BRCM1,
|
||||
PORT_BRCM2,
|
||||
PORT_BRCM3,
|
||||
PORT_BRCM4,
|
||||
PORT_BRCM5,
|
||||
PORT_ALL,
|
||||
PORT_UNKNOWN
|
||||
} BRCM_PORT;
|
||||
|
||||
typedef struct SUBCHANNEL
|
||||
{
|
||||
char state[80];
|
||||
} SUBCHANNEL;
|
||||
|
||||
#define MAX_PORT_NAME 10
|
||||
typedef struct PORT_MAP
|
||||
{
|
||||
char name[MAX_PORT_NAME];
|
||||
BRCM_PORT port;
|
||||
int off_hook;
|
||||
SUBCHANNEL sub[2]; //TODO define for number of subchannels?
|
||||
struct ubus_object *ubus_object;
|
||||
} PORT_MAP;
|
||||
|
||||
static PORT_MAP brcm_ports[] =
|
||||
{
|
||||
{"brcm0", PORT_BRCM0, 0, { {"ONHOOK"}, {"ONHOOK"} }, NULL },
|
||||
{"brcm1", PORT_BRCM1, 0, { {"ONHOOK"}, {"ONHOOK"} }, NULL },
|
||||
{"brcm2", PORT_BRCM2, 0, { {"ONHOOK"}, {"ONHOOK"} }, NULL },
|
||||
{"brcm3", PORT_BRCM3, 0, { {"ONHOOK"}, {"ONHOOK"} }, NULL },
|
||||
{"brcm4", PORT_BRCM4, 0, { {"ONHOOK"}, {"ONHOOK"} }, NULL },
|
||||
{"brcm5", PORT_BRCM5, 0, { {"ONHOOK"}, {"ONHOOK"} }, NULL },
|
||||
//Add other ports here as needed
|
||||
{"port_all", PORT_ALL, 0, { {"ONHOOK"}, {"ONHOOK"} }, NULL },
|
||||
{"-", PORT_UNKNOWN, 0, { {"ONHOOK"}, {"ONHOOK"} }, NULL },
|
||||
};
|
||||
|
||||
typedef enum SIP_ACCOUNT_ID
|
||||
{
|
||||
SIP_ACCOUNT_0 = 0,
|
||||
SIP_ACCOUNT_1,
|
||||
SIP_ACCOUNT_2,
|
||||
SIP_ACCOUNT_3,
|
||||
SIP_ACCOUNT_4,
|
||||
SIP_ACCOUNT_5,
|
||||
SIP_ACCOUNT_6,
|
||||
SIP_ACCOUNT_7,
|
||||
SIP_ACCOUNT_UNKNOWN
|
||||
} SIP_ACCOUNT_ID;
|
||||
|
||||
#define MAX_ACCOUNT_NAME 10
|
||||
typedef struct SIP_ACCOUNT
|
||||
{
|
||||
SIP_ACCOUNT_ID id;
|
||||
char name[MAX_ACCOUNT_NAME];
|
||||
} SIP_ACCOUNT;
|
||||
|
||||
static const SIP_ACCOUNT sip_accounts[] = {
|
||||
{SIP_ACCOUNT_0, "sip0"},
|
||||
{SIP_ACCOUNT_1, "sip1"},
|
||||
{SIP_ACCOUNT_2, "sip2"},
|
||||
{SIP_ACCOUNT_3, "sip3"},
|
||||
{SIP_ACCOUNT_4, "sip4"},
|
||||
{SIP_ACCOUNT_5, "sip5"},
|
||||
{SIP_ACCOUNT_6, "sip6"},
|
||||
{SIP_ACCOUNT_7, "sip7"},
|
||||
{SIP_ACCOUNT_UNKNOWN, "-"}
|
||||
};
|
||||
|
||||
#define MAX_SIP_PEERS 10
|
||||
#define MAX_SIP_PEER_NAME 10
|
||||
#define MAX_SIP_PEER_USERNAME 128
|
||||
#define MAX_SIP_PEER_DOMAIN 128
|
||||
#define MAX_SIP_PEER_STATE 128
|
||||
typedef struct SIP_PEER
|
||||
{
|
||||
SIP_ACCOUNT account;
|
||||
int sip_registry_request_sent; //Bool indicating if we have sent a registration request
|
||||
int sip_registry_registered; //Bool indicating if we are registered or not
|
||||
time_t sip_registry_time; //The time when we received the registry event
|
||||
IP ip_list[MAX_IP_LIST_LENGTH]; //IP addresses of the sip registrar
|
||||
int ip_list_length; //Number of addresses
|
||||
|
||||
//Info from sip show registry
|
||||
int port; //The port we are connected to
|
||||
char username[MAX_SIP_PEER_USERNAME]; //Our username
|
||||
char domain[MAX_SIP_PEER_DOMAIN]; //The domain we are registered on
|
||||
int domain_port; //The domain port
|
||||
int refresh; //Refresh interval for this registration
|
||||
char state[MAX_SIP_PEER_STATE]; //Registration state e.g. Registered
|
||||
time_t registration_time; //Registration timestamp, 1401282865
|
||||
|
||||
struct ubus_object *ubus_object;
|
||||
} SIP_PEER;
|
||||
|
||||
/*
|
||||
* Struct that stores configuration for a LED
|
||||
*/
|
||||
typedef struct {
|
||||
LED_STATE state;
|
||||
LED_NAME name;
|
||||
int num_ports;
|
||||
PORT_MAP** ports; //Array of pointers to brcm ports that govern this leds state
|
||||
int num_peers;
|
||||
SIP_PEER** peers;//Array of pointers to sip peers that govern this leds state
|
||||
} Led;
|
||||
|
||||
|
||||
void init_sip_peers();
|
||||
void manage_leds();
|
||||
void manage_led(LED_NAME led, LED_STATE state);
|
||||
LED_STATE get_led_state(Led* led);
|
||||
void configure_leds();
|
||||
void free_led_config();
|
||||
|
||||
@@ -1,208 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 2011 Felix Fietkau <nbd@openwrt.org>
|
||||
* Copyright (c) 2010 Isilon Systems, Inc.
|
||||
* Copyright (c) 2010 iX Systems, Inc.
|
||||
* Copyright (c) 2010 Panasas, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice unmodified, this list of conditions, and the following
|
||||
* disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef _LINUX_LIST_H_
|
||||
#define _LINUX_LIST_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define prefetch(x)
|
||||
|
||||
#ifndef container_of
|
||||
#define container_of(ptr, type, member) \
|
||||
({ \
|
||||
const typeof(((type *) NULL)->member) *__mptr = (ptr); \
|
||||
(type *) ((char *) __mptr - offsetof(type, member)); \
|
||||
})
|
||||
#endif
|
||||
|
||||
struct list_head {
|
||||
struct list_head *next;
|
||||
struct list_head *prev;
|
||||
};
|
||||
|
||||
#define LIST_HEAD_INIT(name) { &(name), &(name) }
|
||||
#undef LIST_HEAD
|
||||
#define LIST_HEAD(name) struct list_head name = LIST_HEAD_INIT(name)
|
||||
|
||||
static inline void
|
||||
INIT_LIST_HEAD(struct list_head *list)
|
||||
{
|
||||
list->next = list->prev = list;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
list_empty(const struct list_head *head)
|
||||
{
|
||||
return (head->next == head);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
list_is_first(const struct list_head *list,
|
||||
const struct list_head *head)
|
||||
{
|
||||
return list->prev == head;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
list_is_last(const struct list_head *list,
|
||||
const struct list_head *head)
|
||||
{
|
||||
return list->next == head;
|
||||
}
|
||||
|
||||
static inline void
|
||||
_list_del(struct list_head *entry)
|
||||
{
|
||||
entry->next->prev = entry->prev;
|
||||
entry->prev->next = entry->next;
|
||||
}
|
||||
|
||||
static inline void
|
||||
list_del(struct list_head *entry)
|
||||
{
|
||||
_list_del(entry);
|
||||
entry->next = entry->prev = NULL;
|
||||
}
|
||||
|
||||
static inline void
|
||||
_list_add(struct list_head *_new, struct list_head *prev,
|
||||
struct list_head *next)
|
||||
{
|
||||
|
||||
next->prev = _new;
|
||||
_new->next = next;
|
||||
_new->prev = prev;
|
||||
prev->next = _new;
|
||||
}
|
||||
|
||||
static inline void
|
||||
list_del_init(struct list_head *entry)
|
||||
{
|
||||
_list_del(entry);
|
||||
INIT_LIST_HEAD(entry);
|
||||
}
|
||||
|
||||
#define list_entry(ptr, type, field) container_of(ptr, type, field)
|
||||
#define list_first_entry(ptr, type, field) list_entry((ptr)->next, type, field)
|
||||
#define list_last_entry(ptr, type, field) list_entry((ptr)->prev, type, field)
|
||||
|
||||
#define list_for_each(p, head) \
|
||||
for (p = (head)->next; p != (head); p = p->next)
|
||||
|
||||
#define list_for_each_safe(p, n, head) \
|
||||
for (p = (head)->next, n = p->next; p != (head); p = n, n = p->next)
|
||||
|
||||
#define list_for_each_entry(p, h, field) \
|
||||
for (p = list_first_entry(h, typeof(*p), field); &p->field != (h); \
|
||||
p = list_entry(p->field.next, typeof(*p), field))
|
||||
|
||||
#define list_for_each_entry_safe(p, n, h, field) \
|
||||
for (p = list_first_entry(h, typeof(*p), field), \
|
||||
n = list_entry(p->field.next, typeof(*p), field); &p->field != (h);\
|
||||
p = n, n = list_entry(n->field.next, typeof(*n), field))
|
||||
|
||||
#define list_for_each_entry_reverse(p, h, field) \
|
||||
for (p = list_last_entry(h, typeof(*p), field); &p->field != (h); \
|
||||
p = list_entry(p->field.prev, typeof(*p), field))
|
||||
|
||||
#define list_for_each_prev(p, h) for (p = (h)->prev; p != (h); p = p->prev)
|
||||
#define list_for_each_prev_safe(p, n, h) for (p = (h)->prev, n = p->prev; p != (h); p = n, n = p->prev)
|
||||
|
||||
static inline void
|
||||
list_add(struct list_head *_new, struct list_head *head)
|
||||
{
|
||||
_list_add(_new, head, head->next);
|
||||
}
|
||||
|
||||
static inline void
|
||||
list_add_tail(struct list_head *_new, struct list_head *head)
|
||||
{
|
||||
_list_add(_new, head->prev, head);
|
||||
}
|
||||
|
||||
static inline void
|
||||
list_move(struct list_head *list, struct list_head *head)
|
||||
{
|
||||
_list_del(list);
|
||||
list_add(list, head);
|
||||
}
|
||||
|
||||
static inline void
|
||||
list_move_tail(struct list_head *entry, struct list_head *head)
|
||||
{
|
||||
_list_del(entry);
|
||||
list_add_tail(entry, head);
|
||||
}
|
||||
|
||||
static inline void
|
||||
_list_splice(const struct list_head *list, struct list_head *prev,
|
||||
struct list_head *next)
|
||||
{
|
||||
struct list_head *first;
|
||||
struct list_head *last;
|
||||
|
||||
if (list_empty(list))
|
||||
return;
|
||||
|
||||
first = list->next;
|
||||
last = list->prev;
|
||||
first->prev = prev;
|
||||
prev->next = first;
|
||||
last->next = next;
|
||||
next->prev = last;
|
||||
}
|
||||
|
||||
static inline void
|
||||
list_splice(const struct list_head *list, struct list_head *head)
|
||||
{
|
||||
_list_splice(list, head, head->next);
|
||||
}
|
||||
|
||||
static inline void
|
||||
list_splice_tail(struct list_head *list, struct list_head *head)
|
||||
{
|
||||
_list_splice(list, head->prev, head);
|
||||
}
|
||||
|
||||
static inline void
|
||||
list_splice_init(struct list_head *list, struct list_head *head)
|
||||
{
|
||||
_list_splice(list, head, head->next);
|
||||
INIT_LIST_HEAD(list);
|
||||
}
|
||||
|
||||
static inline void
|
||||
list_splice_tail_init(struct list_head *list, struct list_head *head)
|
||||
{
|
||||
_list_splice(list, head->prev, head);
|
||||
INIT_LIST_HEAD(list);
|
||||
}
|
||||
|
||||
#endif /* _LINUX_LIST_H_ */
|
||||
@@ -1,204 +0,0 @@
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Copyright (C) 2008 John Crispin <blogic@openwrt.org>
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <uci_config.h>
|
||||
#include <uci.h>
|
||||
#include "ucix.h"
|
||||
|
||||
static struct uci_ptr ptr;
|
||||
|
||||
static inline int ucix_get_ptr(struct uci_context *ctx, const char *p, const char *s, const char *o, const char *t)
|
||||
{
|
||||
memset(&ptr, 0, sizeof(ptr));
|
||||
ptr.package = p;
|
||||
ptr.section = s;
|
||||
ptr.option = o;
|
||||
ptr.value = t;
|
||||
return uci_lookup_ptr(ctx, &ptr, NULL, true);
|
||||
}
|
||||
|
||||
struct uci_context* ucix_init(const char *config_file)
|
||||
{
|
||||
struct uci_context *ctx = uci_alloc_context();
|
||||
uci_add_delta_path(ctx, "/var/state");
|
||||
if(uci_load(ctx, config_file, NULL) != UCI_OK)
|
||||
{
|
||||
printf("%s/%s is missing or corrupt\n", ctx->savedir, config_file);
|
||||
return NULL;
|
||||
}
|
||||
return ctx;
|
||||
}
|
||||
|
||||
struct uci_context* ucix_init_path(const char *path, const char *config_file)
|
||||
{
|
||||
struct uci_context *ctx = uci_alloc_context();
|
||||
if(path)
|
||||
uci_set_confdir(ctx, path);
|
||||
if(uci_load(ctx, config_file, NULL) != UCI_OK)
|
||||
{
|
||||
printf("%s/%s is missing or corrupt\n", ctx->savedir, config_file);
|
||||
return NULL;
|
||||
}
|
||||
return ctx;
|
||||
}
|
||||
|
||||
void ucix_cleanup(struct uci_context *ctx)
|
||||
{
|
||||
uci_free_context(ctx);
|
||||
}
|
||||
|
||||
void ucix_save(struct uci_context *ctx)
|
||||
{
|
||||
uci_set_savedir(ctx, "/tmp/.uci/");
|
||||
uci_save(ctx, NULL);
|
||||
}
|
||||
|
||||
void ucix_save_state(struct uci_context *ctx)
|
||||
{
|
||||
uci_set_savedir(ctx, "/var/state/");
|
||||
uci_save(ctx, NULL);
|
||||
}
|
||||
|
||||
int ucix_get_option_list(struct uci_context *ctx, const char *p,
|
||||
const char *s, const char *o, struct list_head *l)
|
||||
{
|
||||
struct uci_element *e = NULL;
|
||||
if(ucix_get_ptr(ctx, p, s, o, NULL))
|
||||
return 1;
|
||||
if (!(ptr.flags & UCI_LOOKUP_COMPLETE))
|
||||
return 1;
|
||||
e = ptr.last;
|
||||
switch (e->type)
|
||||
{
|
||||
case UCI_TYPE_OPTION:
|
||||
switch(ptr.o->type) {
|
||||
case UCI_TYPE_LIST:
|
||||
uci_foreach_element(&ptr.o->v.list, e)
|
||||
{
|
||||
struct ucilist *ul = malloc(sizeof(struct ucilist));
|
||||
ul->val = strdup((e->name)?(e->name):(""));
|
||||
list_add_tail(&ul->list, l);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char* ucix_get_option(struct uci_context *ctx, const char *p, const char *s, const char *o)
|
||||
{
|
||||
struct uci_element *e = NULL;
|
||||
const char *value = NULL;
|
||||
if(ucix_get_ptr(ctx, p, s, o, NULL))
|
||||
return NULL;
|
||||
if (!(ptr.flags & UCI_LOOKUP_COMPLETE))
|
||||
return NULL;
|
||||
e = ptr.last;
|
||||
switch (e->type)
|
||||
{
|
||||
case UCI_TYPE_SECTION:
|
||||
value = uci_to_section(e)->type;
|
||||
break;
|
||||
case UCI_TYPE_OPTION:
|
||||
switch(ptr.o->type) {
|
||||
case UCI_TYPE_STRING:
|
||||
value = ptr.o->v.string;
|
||||
break;
|
||||
default:
|
||||
value = NULL;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
int ucix_get_option_int(struct uci_context *ctx, const char *p, const char *s, const char *o, int def)
|
||||
{
|
||||
const char *tmp = ucix_get_option(ctx, p, s, o);
|
||||
int ret = def;
|
||||
|
||||
if (tmp)
|
||||
ret = atoi(tmp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ucix_add_section(struct uci_context *ctx, const char *p, const char *s, const char *t)
|
||||
{
|
||||
if(ucix_get_ptr(ctx, p, s, NULL, t))
|
||||
return;
|
||||
uci_set(ctx, &ptr);
|
||||
}
|
||||
|
||||
void ucix_add_option(struct uci_context *ctx, const char *p, const char *s, const char *o, const char *t)
|
||||
{
|
||||
if(ucix_get_ptr(ctx, p, s, o, (t)?(t):("")))
|
||||
return;
|
||||
uci_set(ctx, &ptr);
|
||||
}
|
||||
|
||||
void ucix_add_option_int(struct uci_context *ctx, const char *p, const char *s, const char *o, int t)
|
||||
{
|
||||
char tmp[64];
|
||||
snprintf(tmp, 64, "%d", t);
|
||||
ucix_add_option(ctx, p, s, o, tmp);
|
||||
}
|
||||
|
||||
void ucix_del(struct uci_context *ctx, const char *p, const char *s, const char *o)
|
||||
{
|
||||
if(!ucix_get_ptr(ctx, p, s, o, NULL))
|
||||
uci_delete(ctx, &ptr);
|
||||
}
|
||||
|
||||
void ucix_revert(struct uci_context *ctx, const char *p, const char *s, const char *o)
|
||||
{
|
||||
if(!ucix_get_ptr(ctx, p, s, o, NULL))
|
||||
uci_revert(ctx, &ptr);
|
||||
}
|
||||
|
||||
void ucix_for_each_section_type(struct uci_context *ctx,
|
||||
const char *p, const char *t,
|
||||
void (*cb)(const char*, void*), void *priv)
|
||||
{
|
||||
struct uci_element *e;
|
||||
if(ucix_get_ptr(ctx, p, NULL, NULL, NULL))
|
||||
return;
|
||||
uci_foreach_element(&ptr.p->sections, e)
|
||||
if (!strcmp(t, uci_to_section(e)->type))
|
||||
cb(e->name, priv);
|
||||
}
|
||||
|
||||
int ucix_commit(struct uci_context *ctx, const char *p)
|
||||
{
|
||||
if(ucix_get_ptr(ctx, p, NULL, NULL, NULL))
|
||||
return 1;
|
||||
return uci_commit(ctx, &ptr.p, false);
|
||||
}
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Copyright (C) 2008 John Crispin <blogic@openwrt.org>
|
||||
*/
|
||||
|
||||
#ifndef _UCI_H__
|
||||
#define _UCI_H__
|
||||
|
||||
#include "list.h"
|
||||
|
||||
struct ucilist {
|
||||
struct list_head list;
|
||||
char *val;
|
||||
};
|
||||
|
||||
struct uci_context* ucix_init(const char *config_file);
|
||||
struct uci_context* ucix_init_path(const char *path, const char *config_file);
|
||||
void ucix_cleanup(struct uci_context *ctx);
|
||||
void ucix_save(struct uci_context *ctx);
|
||||
void ucix_save_state(struct uci_context *ctx);
|
||||
const char* ucix_get_option(struct uci_context *ctx,
|
||||
const char *p, const char *s, const char *o);
|
||||
int ucix_get_option_list(struct uci_context *ctx, const char *p,
|
||||
const char *s, const char *o, struct list_head *l);
|
||||
int ucix_get_option_int(struct uci_context *ctx,
|
||||
const char *p, const char *s, const char *o, int def);
|
||||
void ucix_add_section(struct uci_context *ctx,
|
||||
const char *p, const char *s, const char *t);
|
||||
void ucix_add_option(struct uci_context *ctx,
|
||||
const char *p, const char *s, const char *o, const char *t);
|
||||
void ucix_add_option_int(struct uci_context *ctx,
|
||||
const char *p, const char *s, const char *o, int t);
|
||||
int ucix_commit(struct uci_context *ctx, const char *p);
|
||||
void ucix_revert(struct uci_context *ctx,
|
||||
const char *p, const char *s, const char *o);
|
||||
void ucix_del(struct uci_context *ctx, const char *p,
|
||||
const char *s, const char *o);
|
||||
void ucix_for_each_section_type(struct uci_context *ctx,
|
||||
const char *p, const char *t,
|
||||
void (*cb)(const char*, void*), void *priv);
|
||||
#endif
|
||||
@@ -1,7 +0,0 @@
|
||||
config ANYFI_CONTROLLER
|
||||
string "Controller IP or FQDN"
|
||||
depends PACKAGE_anyfi
|
||||
help
|
||||
The default IP address or fully qualified domain name (FQDN)
|
||||
of the Controller that should manage the Anyfi.net software.
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
ANYFI_TARGET := $(ARCH)-linux-$(subst C,c,$(LIBC))-$(LIBCV)
|
||||
|
||||
PKG_NAME := anyfi
|
||||
PKG_VERSION := 1.3.9
|
||||
PKG_RELEASE := 1
|
||||
|
||||
PKG_SOURCE := anyfimac-$(PKG_VERSION)-$(ANYFI_TARGET).tar.bz2
|
||||
PKG_SOURCE_URL := http://anyfi.net/download
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/anyfimac-$(PKG_VERSION)-$(ANYFI_TARGET)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION := net
|
||||
CATEGORY := Network
|
||||
TITLE := Anyfi.net - Free SDWN Data Plane for IEEE 802.11
|
||||
URL := http://anyfi.net
|
||||
DEPENDS := +kmod-tun +librt +wl-anyfi
|
||||
MAINTAINER := Anyfi Networks <eng@anyfinetworks.com>
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
Anyfi.net is a free Software-Defined Wirless Networking (SDWN)
|
||||
forwarding data plane implementation for IEEE 802.11.
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
echo "config anyfi controller" > $(PKG_BUILD_DIR)/anyfi.conf
|
||||
echo " option 'hostname' $(CONFIG_ANYFI_CONTROLLER)" >> \
|
||||
$(PKG_BUILD_DIR)/anyfi.conf
|
||||
echo "config anyfi optimizer" >> $(PKG_BUILD_DIR)/anyfi.conf
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
@echo "Nothing to do - Anyfi.net software comes pre-built."
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/conffiles
|
||||
/etc/config/anyfi
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(CP) ./files/* $(1)/
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) $(PKG_BUILD_DIR)/anyfi.conf $(1)/etc/config/anyfi
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/anyfimac $(1)/sbin
|
||||
$(LN) anyfimac $(1)/sbin/anyfid
|
||||
$(LN) anyfimac $(1)/sbin/myfid
|
||||
$(INSTALL_DIR) $(1)/bin
|
||||
$(LN) ../sbin/anyfimac $(1)/bin/anyfidctl
|
||||
$(LN) ../sbin/anyfimac $(1)/bin/myfidctl
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
@@ -1,558 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2013-2014 Anyfi Networks AB.
|
||||
#
|
||||
# Overview of the Integration
|
||||
# ===========================
|
||||
#
|
||||
# Anyfi.net software consists of two user space daemons; the radio daemon
|
||||
# anyfid and the tunnel termination daemon myfid. They communicate with each
|
||||
# other and with a Controller [1] over UDP/IP.
|
||||
#
|
||||
# The radio daemon anyfid provides guests with access to remote Wi-Fi networks.
|
||||
# It needs a Wi-Fi monitor interface to detect when guest devices come within
|
||||
# range and a pool of virtual access points to serve them. The integration is
|
||||
# responsible for creating the monitor interface and the pool of virtual access
|
||||
# points; anyfid handles the rest.
|
||||
#
|
||||
# The tunnel termination daemon myfid provides remote access to the local Wi-Fi
|
||||
# network. It is up to the integration to configure myfid to authenticate remote
|
||||
# devices in the same way that devices are authenticated when connecting
|
||||
# locally.
|
||||
#
|
||||
# Myfid is also responsible for telling the controller the MAC address of
|
||||
# devices that connect locally, so that they can later be offered seamless
|
||||
# remote access whenever they come close to another access point running anyfid.
|
||||
# However, when the user changes the WPA passphrase all such associations
|
||||
# between previously connected devices and the local Wi-Fi network should be
|
||||
# removed. The integration does so by passing myfid the --reset flag.
|
||||
#
|
||||
# Below is the integration logic in pseudo code. If you need to integrate
|
||||
# Anyfi.net software in your own firmware build environment you can find step
|
||||
# by step instructions at http://anyfi.net/integration.
|
||||
#
|
||||
# 1. A Community Edition of the Controller is available for download at
|
||||
# http://www.anyfinetworks.com/download. You can also use the public
|
||||
# demonstration controller at "demo.anyfi.net".
|
||||
#
|
||||
#
|
||||
# Integration Logic in Pseudo Code
|
||||
# ================================
|
||||
#
|
||||
# After enabling a Wi-Fi device:
|
||||
# IF a controller is configured AND Anyfi.net is not disabled
|
||||
# ALLOCATE monitor interface and virtual access point pool for anyfid
|
||||
# START anyfid
|
||||
#
|
||||
# FOREACH Wi-Fi interface of this device
|
||||
# IF a controller is configured AND Anyfi.net is not disabled
|
||||
# GENERATE a config file for myfid
|
||||
#
|
||||
# IF the WPA passphrase has changed
|
||||
# ADD the --reset flag to myfid arguments
|
||||
#
|
||||
# START myfid on the Wi-Fi interface
|
||||
#
|
||||
# After disabling a Wi-Fi device:
|
||||
# STOP anyfid
|
||||
#
|
||||
# FOREACH Wi-Fi interface of this device
|
||||
# STOP myfid on the Wi-Fi interface
|
||||
#
|
||||
# NOTE 1: The integration provides remote access to all Wi-Fi interfaces on the
|
||||
# system that have anyfi_disabled set to 0. Each interface will have
|
||||
# its own myfid daemon. There should however only be one anyfid daemon
|
||||
# per radio.
|
||||
#
|
||||
# NOTE 2: On concurrent dual band routers each radio should have its own anyfid
|
||||
# daemon.
|
||||
#
|
||||
#
|
||||
# Anyfi.net UCI data model
|
||||
# ========================
|
||||
#
|
||||
# Anyfi.net global parameters:
|
||||
#
|
||||
# Name Type Default Description
|
||||
# controller
|
||||
# .hostname IP or FQDN demo.anyfi.net Controller IP or FQDN
|
||||
# .key path - Controller public key PEM file
|
||||
# optimizer
|
||||
# .key path - Optimizer public key PEM file
|
||||
#
|
||||
# Wi-Fi device parameters:
|
||||
#
|
||||
# Name Type Default Description
|
||||
# anyfi_disabled boolean 0 Enable/disable guest access on this radio
|
||||
# anyfi_iface port - Bind anyfid to a WAN interface IP address
|
||||
# anyfi_port number - Bind anyfid to a SDWN UDP port
|
||||
# anyfi_floor percent 5 Min backhaul and spectrum allocation
|
||||
# anyfi_ceiling percent 75 Max backhaul and spectrum allocation
|
||||
# anyfi_uplink integer - WAN uplink capacity in bits per second
|
||||
# anyfi_downlink integer - WAN downlink capacity in bits per second
|
||||
# anyfi_bssids integer - Max number of virtual interfaces to use
|
||||
# anyfi_clients integer - Max number of concurrent guest users
|
||||
#
|
||||
# Wi-Fi interface parameters:
|
||||
#
|
||||
# Name Type Default Description
|
||||
# anyfi_disabled boolean 0 Enable remote access on this network
|
||||
# anyfi_iface string - Bind myfid to a WAN interface IP
|
||||
# address
|
||||
# anyfi_port port - Bind myfid to a SDWN UDP port
|
||||
# anyfi_autz_server IP - RADIUS authorization server IP
|
||||
# anyfi_autz_port port 1812 RADIUS authorization server UDP port
|
||||
# anyfi_autz_secret string - RADIUS authorization server shared
|
||||
# secret
|
||||
# anyfi_acct_server IP - RADIUS extra accounting server IP
|
||||
# anyfi_acct_port port 1813 RADIUS extra accounting server UDP port
|
||||
# anyfi_acct_secret string - RADIUS extra accounting server shared
|
||||
# secret
|
||||
|
||||
append ENABLE_HOOKS anyfi_enable
|
||||
append DISABLE_HOOKS anyfi_disable
|
||||
|
||||
# Daemon run dir for temporary files.
|
||||
RUNDIR=/var/run
|
||||
|
||||
# Config file dir for persistent configuration files.
|
||||
CONFDIR=/etc
|
||||
|
||||
##### Wi-Fi device handling ##################################################
|
||||
|
||||
# Get the channel for Wi-Fi device.
|
||||
# anyfi_dev_get_channel <device>
|
||||
anyfi_dev_get_channel() {
|
||||
local device="$1"
|
||||
local hwmode channel
|
||||
|
||||
config_get hwmode "$device" hwmode
|
||||
config_get channel "$device" channel
|
||||
|
||||
if [ "$channel" = auto -o "$channel" = 0 ]; then
|
||||
case "$hwmode" in
|
||||
auto)
|
||||
channel=auto
|
||||
;;
|
||||
|
||||
*b*|*g*)
|
||||
channel=auto2
|
||||
;;
|
||||
|
||||
*a*)
|
||||
channel=auto5
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
echo "$channel"
|
||||
}
|
||||
|
||||
# Get the WLAN interface list for a WLAN device.
|
||||
# anyfi_get_vifs <device>
|
||||
anyfi_get_vifs() {
|
||||
local device=$1
|
||||
local vifs=""
|
||||
local cfg
|
||||
|
||||
for cfg in $CONFIG_SECTIONS; do
|
||||
local type dev
|
||||
config_get type "$cfg" TYPE
|
||||
config_get dev "$cfg" device
|
||||
|
||||
if [ "$type" = wifi-iface ] && [ "$dev" = "$device" ]; then
|
||||
append vifs "$cfg"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "$vifs"
|
||||
}
|
||||
|
||||
# Start the Anyfi.net radio head daemon anyfid on a device.
|
||||
# anyfi_dev_start <device> <type> <controller> <controller_key>
|
||||
anyfi_dev_start()
|
||||
{
|
||||
local device="$1"
|
||||
local type="$2"
|
||||
local controller="$3"
|
||||
local controller_key="$4"
|
||||
local nvifs bssids monitor iflist
|
||||
|
||||
# Determine how many virtual interfaces we should use
|
||||
config_get bssids "$device" anyfi_bssids
|
||||
nvifs=$(anyfi_get_vifs "$device" | wc -w)
|
||||
|
||||
if [ -n "$bssids" ]; then
|
||||
# Limit the number of virtual interfaces to 32
|
||||
[ "$bssids" -lt 32 ] || bssids=32
|
||||
elif [ $nvifs -lt 4 ]; then
|
||||
# Don't use more that 8 interfaces in total if possible...
|
||||
bssids=$((8 - $nvifs))
|
||||
else
|
||||
# ...but try to allocate at least 4 interfaces for anyfid.
|
||||
bssids=4
|
||||
fi
|
||||
|
||||
# ALLOCATE monitor and pool of virtual access points
|
||||
if monitor=$(anyfi_${type}_alloc_monitor "$device") && \
|
||||
iflist=$(anyfi_${type}_alloc_iflist "$device" $bssids)
|
||||
then
|
||||
local args=""
|
||||
local wanif port floor ceiling uplink downlink clients
|
||||
|
||||
config_get wanif "$device" anyfi_iface
|
||||
config_get port "$device" anyfi_port
|
||||
config_get floor "$device" anyfi_floor
|
||||
config_get ceiling "$device" anyfi_ceiling
|
||||
config_get uplink "$device" anyfi_uplink
|
||||
config_get downlink "$device" anyfi_downlink
|
||||
config_get clients "$device" anyfi_clients
|
||||
|
||||
# If there are no interfaces on this device then
|
||||
# anyfid controls channel
|
||||
if [ "$nvifs" -eq 0 ]; then
|
||||
args="$args --channel=$(anyfi_dev_get_channel $device)"
|
||||
fi
|
||||
|
||||
[ -n "$wanif" ] && args="$args --bind-if=$wanif"
|
||||
[ -n "$port" ] && args="$args --bind-port=$port"
|
||||
[ -n "$floor" ] && args="$args --floor=$floor"
|
||||
[ -n "$ceiling" ] && args="$args --ceiling=$ceiling"
|
||||
[ -n "$uplink" ] && args="$args --uplink=$uplink"
|
||||
[ -n "$downlink" ] && args="$args --downlink=$downlink"
|
||||
[ -n "$clients" ] && args="$args --max-clients=$clients"
|
||||
[ -n "$controller_key" ] && \
|
||||
args="$args --controller-key=$controller_key"
|
||||
|
||||
# START anyfid
|
||||
echo "$device: starting anyfid"
|
||||
/sbin/anyfid --accept-license -C "$controller" -B \
|
||||
-P $RUNDIR/anyfid_$device.pid $args \
|
||||
$monitor $iflist
|
||||
else
|
||||
echo "$device: failed to allocate anyfid interfaces" 1>&2
|
||||
fi
|
||||
}
|
||||
|
||||
##### Wi-Fi interface handling ###############################################
|
||||
|
||||
# Get the printable name of an interface.
|
||||
anyfi_vif_get_name() {
|
||||
local ifname
|
||||
config_get ifname "$1" ifname
|
||||
echo "${ifname:-$1}"
|
||||
}
|
||||
|
||||
# Generate the config file for myfid from UCI variables.
|
||||
# anyfi_vif_gen_config <vif>
|
||||
anyfi_vif_gen_config() {
|
||||
local vif="$1"
|
||||
local name="$(anyfi_vif_get_name $1)"
|
||||
local device net ssid enc key isolate ifname
|
||||
|
||||
config_get device "$vif" device
|
||||
config_get net "$vif" network
|
||||
config_get ssid "$vif" ssid
|
||||
config_get enc "$vif" encryption
|
||||
config_get key "$vif" key
|
||||
config_get isolate "$vif" isolate
|
||||
config_get ifname "$vif" ifname
|
||||
|
||||
# Check basic settings before proceeding
|
||||
[ -n "$net" ] || [ -n "$ssid" ] || return 1
|
||||
|
||||
local auth_proto auth_mode auth_cache group_rekey
|
||||
local ciphers wpa_ciphers rsn_ciphers passphrase
|
||||
local auth_server auth_port auth_secret
|
||||
local autz_server autz_port autz_secret
|
||||
local acct_server acct_port acct_secret
|
||||
local acct2_server acct2_port acct2_secret
|
||||
local radius_nasid
|
||||
|
||||
# Resolve explicit cipher overrides (tkip, ccmp or tkip+ccmp)
|
||||
case "$enc" in
|
||||
*+tkip+ccmp|*+tkip+aes)
|
||||
ciphers=tkip+ccmp
|
||||
;;
|
||||
|
||||
*+ccmp|*+aes)
|
||||
ciphers=ccmp
|
||||
;;
|
||||
|
||||
*+tkip)
|
||||
ciphers=tkip
|
||||
;;
|
||||
esac
|
||||
|
||||
# Resolve authentication protocol (WPA or WPA2)
|
||||
case "$enc" in
|
||||
psk-mixed*|wpa-mixed*|mixed-psk*|mixed-wpa*)
|
||||
auth_proto=wpa+rsn
|
||||
wpa_ciphers=$ciphers
|
||||
rsn_ciphers=$ciphers
|
||||
;;
|
||||
|
||||
psk2*|wpa2*)
|
||||
auth_proto=rsn
|
||||
rsn_ciphers=$ciphers
|
||||
;;
|
||||
|
||||
psk*|wpa*)
|
||||
auth_proto=wpa
|
||||
wpa_ciphers=$ciphers
|
||||
;;
|
||||
|
||||
none)
|
||||
echo "$name: no remote access for security reasons (open network)" 1>&2
|
||||
return 1
|
||||
;;
|
||||
|
||||
wep*)
|
||||
echo "$name: no remote access for security reasons (wep is insecure)" 1>&2
|
||||
return 1
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "$name: unrecognized encryption type $enc" 1>&2
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Resolve authenticator mode (PSK or 802.1X)
|
||||
case "$enc" in
|
||||
psk*)
|
||||
auth_mode=psk
|
||||
passphrase=$key
|
||||
[ -n "$passphrase" ] || return 1
|
||||
;;
|
||||
|
||||
wpa*)
|
||||
auth_mode=eap
|
||||
|
||||
config_get auth_server "$vif" radius_server
|
||||
config_get auth_port "$vif" radius_port
|
||||
config_get auth_secret "$vif" radius_secret
|
||||
|
||||
config_get acct_server "$vif" acct_server
|
||||
config_get acct_port "$vif" acct_port
|
||||
config_get acct_secret "$vif" acct_secret
|
||||
|
||||
config_get auth_cache "$vif" auth_cache
|
||||
config_get group_rekey "$vif" wpa_group_rekey
|
||||
|
||||
[ -n "$auth_server" ] || return 1
|
||||
[ -n "$auth_secret" ] || auth_secret="$key"
|
||||
[ -n "$acct_server" -a -z "$acct_secret" ] && acct_secret="$key"
|
||||
;;
|
||||
|
||||
none)
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "$name: no remote access ('encryption' not configured)" 1>&2
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Optional RADIUS authorization and accounting for Anyfi.net
|
||||
config_get autz_server "$vif" anyfi_autz_server
|
||||
config_get autz_port "$vif" anyfi_autz_port
|
||||
config_get autz_secret "$vif" anyfi_autz_secret
|
||||
|
||||
config_get acct2_server "$vif" anyfi_acct_server
|
||||
config_get acct2_port "$vif" anyfi_acct_port
|
||||
config_get acct2_secret "$vif" anyfi_acct_secret
|
||||
|
||||
config_get radius_nasid "$vif" radius_nasid
|
||||
|
||||
# Generate common config file options
|
||||
cat <<EOF
|
||||
ssid = '$ssid'
|
||||
bridge = br-$net
|
||||
auth_proto = $auth_proto
|
||||
EOF
|
||||
|
||||
# Generate dependent config file options
|
||||
[ "$isolate" = 1 ] && echo "isolation = 1"
|
||||
[ -n "$ifname" ] && echo "local_ap = $ifname"
|
||||
[ -n "$auth_mode" ] && echo "auth_mode = $auth_mode"
|
||||
[ -n "$auth_cache" ] && echo "auth_cache = $auth_cache"
|
||||
[ -n "$rsn_ciphers" ] && echo "rsn_ciphers = $rsn_ciphers"
|
||||
[ -n "$wpa_ciphers" ] && echo "wpa_ciphers = $wpa_ciphers"
|
||||
[ -n "$group_rekey" ] && echo "group_rekey = $group_rekey"
|
||||
[ -n "$passphrase" ] && echo "passphrase = '$passphrase'"
|
||||
[ -n "$radius_nasid" ] && echo "radius_nas_id = $radius_nas_id"
|
||||
if [ -n "$auth_server" ] && [ -n "$auth_secret" ]; then
|
||||
echo "radius_auth_server = $auth_server"
|
||||
echo "radius_auth_port = ${auth_port:-1812}"
|
||||
echo "radius_auth_secret = $auth_secret"
|
||||
fi
|
||||
if [ -n "$acct_server" ] && [ -n "$acct_secret" ]; then
|
||||
echo "radius_acct_server = $acct_server"
|
||||
echo "radius_acct_port = ${acct_port:-1813}"
|
||||
echo "radius_acct_secret = $acct_secret"
|
||||
fi
|
||||
if [ -n "$autz_server" ] && [ -n "$autz_secret" ]; then
|
||||
echo "radius_autz_server = $autz_server"
|
||||
echo "radius_autz_port = ${autz_port:-1812}"
|
||||
echo "radius_autz_secret = $autz_secret"
|
||||
fi
|
||||
if [ -n "$acct2_server" ] && [ -n "$acct2_secret" ]; then
|
||||
echo "radius_acct2_server = $acct2_server"
|
||||
echo "radius_acct2_port = ${acct2_port:-1813}"
|
||||
echo "radius_acct2_secret = $acct2_secret"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
# Get the current value from a myfid configuration file.
|
||||
# anyfi_vif_get_config <file> <config>
|
||||
anyfi_vif_get_config() {
|
||||
local file="$1"
|
||||
local key="$2"
|
||||
|
||||
[ -e "$file" ] || return 1
|
||||
|
||||
# Assume the format is exactly "key = value",
|
||||
# where value may or may not be in ''
|
||||
grep "$key = " $file | cut -d '=' -f2- | cut -b2- | \
|
||||
sed -e "/^'.*'$/s/^'\\(.*\\)'$/\\1/"
|
||||
}
|
||||
|
||||
# Start the Anyfi.net tunnel-termination daemon myfid on an interface.
|
||||
# anyfi_vif_start <vif> <controller> <controller_key> <optimizer_key>
|
||||
anyfi_vif_start()
|
||||
{
|
||||
local vif="$1"
|
||||
local controller="$2"
|
||||
local controller_key="$3"
|
||||
local optimizer_key="$4"
|
||||
|
||||
local name="$(anyfi_vif_get_name $vif)"
|
||||
local pid_file="$RUNDIR/myfid_$name.pid"
|
||||
local conf_file="$CONFDIR/myfid_$name.conf"
|
||||
local new_conf_file="$RUNDIR/myfid_$name.conf"
|
||||
|
||||
# GENERATE a config file for myfid
|
||||
if (anyfi_vif_gen_config $vif) > $new_conf_file; then
|
||||
local controller_key optimizer_key
|
||||
local key old_key wanif port
|
||||
local args=""
|
||||
|
||||
config_get key "$vif" key
|
||||
config_get wanif "$vif" anyfi_iface
|
||||
config_get port "$vif" anyfi_port
|
||||
|
||||
# ADD optional arguments
|
||||
[ -n "$wanif" ] && args="$args --bind-if=$wanif"
|
||||
[ -n "$port" ] && args="$args --bind-port=$port"
|
||||
[ -n "$controller_key" ] && \
|
||||
args="$args --controller-key=$controller_key"
|
||||
[ -n "$optimizer_key" ] && \
|
||||
args="$args --optimizer-key=$optimizer_key"
|
||||
|
||||
# ADD the --reset flag to myfid arguments if the passphrase
|
||||
# has changed or myfid is started for the first time
|
||||
old_key="$(anyfi_vif_get_config $conf_file passphrase)"
|
||||
[ "$key" == "$old_key" ] || args="$args --reset"
|
||||
|
||||
# Update the myfid config file in flash only if needed
|
||||
if ! cmp -s $new_conf_file $conf_file; then
|
||||
mv $new_conf_file $conf_file
|
||||
else
|
||||
rm -f $new_conf_file
|
||||
fi
|
||||
|
||||
# START myfid
|
||||
echo "$name: starting myfid"
|
||||
/sbin/myfid --accept-license -C "$controller" -B -P $pid_file \
|
||||
$args $conf_file
|
||||
fi
|
||||
}
|
||||
|
||||
# Stop an Anyfi.net daemon gracefully
|
||||
# anyfi_stop_daemon <pidfile>
|
||||
anyfi_stop_daemon() {
|
||||
local pidfile="$1"
|
||||
|
||||
kill -TERM $(cat $pidfile)
|
||||
for t in $(seq 0 5); do
|
||||
[ -e $pidfile ] || return 0
|
||||
sleep 1
|
||||
done
|
||||
|
||||
echo "Timeout waiting for daemon assocated with $pidfile to exit" 1>&2
|
||||
kill -KILL $(cat $pidfile)
|
||||
rm -f $pidfile
|
||||
return 1
|
||||
}
|
||||
|
||||
# Enable Anyfi.net for a Wi-Fi device.
|
||||
# Run from ENABLE_HOOKS
|
||||
anyfi_enable()
|
||||
{
|
||||
local device="$1"
|
||||
local controller
|
||||
local type vif vifs
|
||||
|
||||
# A controller IP or FQDN is required
|
||||
controller="$(uci get anyfi.controller.hostname 2>/dev/null)"
|
||||
[ -n "$controller" ] || return 0
|
||||
|
||||
# Optional controller and optimizer public keys
|
||||
controller_key="$(uci get anyfi.controller.key 2>/dev/null)"
|
||||
optimizer_key="$(uci get anyfi.optimizer.key 2>/dev/null)"
|
||||
|
||||
# Reload the wireless config to get the assigned ifnames right
|
||||
config_load wireless
|
||||
config_get type "$device" type
|
||||
vifs=$(anyfi_get_vifs "$device")
|
||||
|
||||
# START anyfid on this device
|
||||
if [ "$(config_get $device anyfi_disabled)" != 1 ] && \
|
||||
/sbin/anyfi-probe "$type"
|
||||
then
|
||||
anyfi_dev_start $device $type "$controller" "$controller_key"
|
||||
fi
|
||||
|
||||
# FOREACH Wi-Fi interface of this device
|
||||
for vif in $vifs; do
|
||||
if [ "$(config_get $vif disabled)" != 1 ] && \
|
||||
[ "$(config_get $vif anyfi_disabled)" != 1 ]
|
||||
then
|
||||
anyfi_vif_start $vif "$controller" \
|
||||
"$controller_key" "$optimizer_key"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Disable Anyfi.net for a Wi-Fi device.
|
||||
# Run from DISABLE_HOOKS
|
||||
anyfi_disable()
|
||||
{
|
||||
local device="$1"
|
||||
local type vif vifs
|
||||
|
||||
# Reload the wireless config to get the assigned ifnames right
|
||||
config_load wireless
|
||||
config_get type "$device" type
|
||||
vifs=$(anyfi_get_vifs "$device")
|
||||
|
||||
# STOP anyfid on this device (if anyfid is running)
|
||||
if [ -e $RUNDIR/anyfid_$device.pid ]; then
|
||||
echo "$device: stopping anyfid"
|
||||
anyfi_stop_daemon $RUNDIR/anyfid_$device.pid
|
||||
anyfi_${type}_release_iflist $device
|
||||
anyfi_${type}_release_monitor $device
|
||||
fi
|
||||
|
||||
# FOREACH Wi-Fi interface of this device (with myfid running)
|
||||
for vif in $vifs; do
|
||||
local name="$(anyfi_vif_get_name $vif)"
|
||||
local pidfile="$RUNDIR/myfid_$name.pid"
|
||||
|
||||
if [ -e $pidfile ]; then
|
||||
echo "$name: stopping myfid"
|
||||
anyfi_stop_daemon $pidfile
|
||||
fi
|
||||
done
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2013-2014 Anyfi Networks AB.
|
||||
# Anyfi.net setup functions for Broadcom wl driver.
|
||||
|
||||
# Get monitor name interface based for a device.
|
||||
# anyfi_dev_monitor_name <device>
|
||||
anyfi_broadcom_name_monitor() {
|
||||
local device="$1"
|
||||
|
||||
# Map wlX => radiotapX
|
||||
echo "$device" | sed 's/^.*\([0-9]\)$/radiotap\1/'
|
||||
}
|
||||
|
||||
# Get BSS index of the last wl interface that is used (=up)
|
||||
# wl0.2 => 2
|
||||
# wl0 => (empty)
|
||||
anyfi_broadcom_get_wlindex() {
|
||||
ifconfig | grep -o "^$1\..." | cut -d'.' -f2 | sort -n | tail -n 1
|
||||
}
|
||||
|
||||
# Allocate virtual Wi-Fi interfaces for anyfid.
|
||||
# anyfi_broadcom_alloc_iflist <device> <bssids>
|
||||
anyfi_broadcom_alloc_iflist() {
|
||||
local device="$1"
|
||||
local bssids="$2"
|
||||
local count=0
|
||||
local wlindex num
|
||||
|
||||
# Enable MBSS mode if not already enabled
|
||||
if [ "$(wlctl -i $device mbss)" = 0 ]; then
|
||||
wlctl -i $device down
|
||||
wlctl -i $device mbss 1
|
||||
wlctl -i $device up
|
||||
fi
|
||||
|
||||
wlindex=$(anyfi_broadcom_get_wlindex $device)
|
||||
|
||||
# Create WLAN interfaces and let the driver assign the BSSIDs
|
||||
for num in $(seq $bssids); do
|
||||
local idx=$(($wlindex + $num))
|
||||
local wlif=$device.$idx
|
||||
|
||||
# Do the 'wlctl' dance to make the driver assign proper BSSIDs
|
||||
wlctl -i $device bss -C $idx up > /dev/null || break
|
||||
wlctl -i $device ssid -C $idx "dummy" > /dev/null
|
||||
wlctl -i $device bss -C $idx up > /dev/null
|
||||
wlctl -i $device bss -C $idx down > /dev/null
|
||||
wlctl -i $device ssid -C $idx "" > /dev/null
|
||||
|
||||
local bssid=$(wlctl -i $wlif cur_etheraddr | cut -d' ' -f2)
|
||||
ifconfig $wlif hw ether $bssid > /dev/null
|
||||
count=$(($count + 1))
|
||||
done
|
||||
|
||||
[ "$count" -gt 0 ] && echo $device.$(($wlindex + 1))/$count
|
||||
}
|
||||
|
||||
# Release virtual Wi-Fi interfaces allocated for anyfid.
|
||||
# anyfi_broadcom_release_iflist <device>
|
||||
anyfi_broadcom_release_iflist() {
|
||||
true
|
||||
}
|
||||
|
||||
# Allocate a monitor interface for anyfid.
|
||||
# anyfi_broadcom_alloc_monitor <device>
|
||||
anyfi_broadcom_alloc_monitor() {
|
||||
local device="$1"
|
||||
local monitor=$(anyfi_broadcom_name_monitor $device)
|
||||
|
||||
wlctl -i $device monitor 0 || return 1
|
||||
wlctl -i $device monitor 3 || return 1
|
||||
ifconfig $monitor down || return 1
|
||||
ifconfig $monitor up || return 1
|
||||
echo $monitor
|
||||
}
|
||||
|
||||
# Release the monitor interface for anyfid.
|
||||
# anyfi_broadcom_release_monitor <device>
|
||||
anyfi_broadcom_release_monitor() {
|
||||
local device="$1"
|
||||
local monitor=$(anyfi_broadcom_name_monitor $device)
|
||||
|
||||
ifconfig $monitor down 2> /dev/null
|
||||
wlctl -i $device monitor 0 2> /dev/null
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
echo "Check if a WLAN driver type is supported by Anyfi.net radio software."
|
||||
echo "Usage: $0 {mac80211|...}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
number() {
|
||||
echo $2 | sed -e 's/[^0-9]/ /g' | cut -d' ' -f $1
|
||||
}
|
||||
|
||||
major() {
|
||||
number 1 $1
|
||||
}
|
||||
|
||||
minor() {
|
||||
number 2 $1
|
||||
}
|
||||
|
||||
case $1 in
|
||||
mac80211)
|
||||
COMPAT_VER=$(opkg list-installed kmod-mac80211 | cut -d'+' -f2)
|
||||
KERNEL_VER=$(uname -r)
|
||||
|
||||
# Future kernels > 3.x are OK
|
||||
[ "$(major $KERNEL_VER)" -gt 3 ] && return 0
|
||||
|
||||
# The required commit 86c228a7627f3f2776893da47592234140fbfba8
|
||||
# for mac80211 support was introduced in kernel 3.12.
|
||||
[ "$(major $KERNEL_VER)" -eq 3 ] && \
|
||||
[ "$(minor $KERNEL_VER)" -ge 12 ] && return 0
|
||||
|
||||
[ "$(major $COMPAT_VER)" -gt 2013 ] && return 0
|
||||
[ "$(major $COMPAT_VER)" -eq 2013 ] && \
|
||||
[ "$(minor $COMPAT_VER)" -ge 11 ] && return 0
|
||||
|
||||
cat <<EOF
|
||||
Support for mac80211 requires Linux kernel >= 3.12 or
|
||||
compat-wireless >= 2013-11-05. Please update your system.
|
||||
EOF
|
||||
;;
|
||||
|
||||
broadcom)
|
||||
return 0
|
||||
;;
|
||||
|
||||
*)
|
||||
cat<<EOF
|
||||
WLAN driver \"$1\" is not supported by the Anyfi.net radio software.
|
||||
Improved drivers with Anyfi.net support are available for Broadcom,
|
||||
Qualcomm Atheros, Ralink and Realtek chipsets. Please contact
|
||||
support@anyfi.net for updated drivers, reference integrations and
|
||||
commercial integration services.
|
||||
EOF
|
||||
;;
|
||||
esac
|
||||
exit 1
|
||||
@@ -10,20 +10,16 @@ include $(TOPDIR)/rules.mk
|
||||
PKG_NAME:=asterisk18-mod
|
||||
PKG_VERSION:=1.8.10.1
|
||||
|
||||
PKG_SOURCE_VERSION:=8d5a855296f61391d0166b66b11e4e6055fd86c6
|
||||
PKG_SOURCE_VERSION:=015d279241d0ac5d8c1321aa6f78b9ae551575d1
|
||||
PKG_SOURCE_PROTO:=git
|
||||
ifeq ($(CONFIG_BCM_OPEN),y)
|
||||
PKG_SOURCE_URL:=http://ihgsp.inteno.se/git/asterisk-aa
|
||||
else
|
||||
PKG_SOURCE_URL:=git@ihgsp.inteno.se:asterisk-aa
|
||||
endif
|
||||
PKG_SOURCE_URL:=http://public.inteno.se:/asterisk-1.8.x
|
||||
|
||||
PKG_RELEASE:=$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION)-$(PKG_RELEASE).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/ltqtapi.mk
|
||||
-include $(INCLUDE_DIR)/ltqtapi.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/asterisk18-mod/Default
|
||||
@@ -123,7 +119,7 @@ endef
|
||||
define Package/asterisk18-mod-cdr
|
||||
$(call Package/asterisk18-mod/Default)
|
||||
TITLE:=CDR support
|
||||
DEPENDS:= asterisk18-mod
|
||||
DEPENDS:= asterisk18-mod +libsqlite3
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-cdr/description
|
||||
@@ -192,17 +188,6 @@ $(call Package/asterisk18-mod/Default/description)
|
||||
support to Asterisk.
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-chan-mobile
|
||||
$(call Package/asterisk18-mod/Default)
|
||||
TITLE:=Mobile channel support
|
||||
DEPENDS:= asterisk18-mod +bluez-libs
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-chan-mobile/description
|
||||
$(call Package/asterisk18-mod/Default/description)
|
||||
This package provides the channel chan_mobile support to Asterisk.
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-res-timing-timerfd
|
||||
$(call Package/asterisk18-mod/Default)
|
||||
TITLE:= Timerfd Timing Interface
|
||||
@@ -345,14 +330,6 @@ else
|
||||
--without-spandsp
|
||||
endif
|
||||
|
||||
ifneq ($(SDK)$(CONFIG_PACKAGE_asterisk18-mod-chan-mobile),)
|
||||
CONFIGURE_ARGS+= \
|
||||
--with-bluetooth="$(STAGING_DIR)/usr"
|
||||
else
|
||||
CONFIGURE_ARGS+= \
|
||||
--without-bluetooth
|
||||
endif
|
||||
|
||||
ifneq ($(SDK)$(CONFIG_PACKAGE_asterisk18-mod-res-srtp),)
|
||||
CONFIGURE_ARGS+= \
|
||||
--with-srtp="$(STAGING_DIR)/usr"
|
||||
@@ -396,6 +373,9 @@ CONFIGURE_ARGS+= \
|
||||
--with-sounds-cache="$(DL_DIR)" \
|
||||
--disable-xmldoc
|
||||
|
||||
# I've had strange errors with -fno-caller-saves
|
||||
# in global CFLAGS so revert it. /Ronny
|
||||
EXTRA_CFLAGS+= -O2 -fcaller-saves
|
||||
EXTRA_CFLAGS+= $(TARGET_CPPFLAGS)
|
||||
EXTRA_LDFLAGS+= $(TARGET_LDFLAGS)
|
||||
|
||||
@@ -572,17 +552,6 @@ define Package/asterisk18-mod-chan-gtalk/install
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_jabber.so $(1)/usr/lib/asterisk/modules/
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-chan-mobile/conffiles
|
||||
/etc/asterisk/chan_mobile.conf
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-chan-mobile/install
|
||||
$(INSTALL_DIR) $(1)/etc/asterisk
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/chan_mobile.conf $(1)/etc/asterisk/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/chan_mobile.so $(1)/usr/lib/asterisk/modules/
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-res-timing-timerfd/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_timing_timerfd.so $(1)/usr/lib/asterisk/modules/
|
||||
@@ -734,7 +703,6 @@ $(eval $(call BuildPackage,asterisk18-mod-cdr))
|
||||
$(eval $(call BuildPackage,asterisk18-mod-res-musiconhold))
|
||||
$(eval $(call BuildPackage,asterisk18-mod-res-voice))
|
||||
$(eval $(call BuildPackage,asterisk18-mod-chan-gtalk))
|
||||
$(eval $(call BuildPackage,asterisk18-mod-chan-mobile))
|
||||
$(eval $(call BuildPackage,asterisk18-mod-res-fax))
|
||||
$(eval $(call BuildPackage,asterisk18-mod-res-fax-spandsp))
|
||||
$(eval $(call BuildPackage,asterisk18-mod-res-timing-timerfd))
|
||||
|
||||
@@ -9,6 +9,12 @@ PROG=/usr/sbin/asterisk
|
||||
DEFAULT=/etc/default/asterisk
|
||||
|
||||
init_asterisk() {
|
||||
# do not start asterisk until the
|
||||
# router receives a default route
|
||||
while ! ip r | grep -q default; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
[ -f $DEFAULT ] && . $DEFAULT
|
||||
[ -d /var/run/asterisk ] || mkdir -p /var/run/asterisk
|
||||
[ -d /var/log/asterisk ] || mkdir -p /var/log/asterisk
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2006-2009 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=bcmhotproxy
|
||||
PKG_RELEASE:=13
|
||||
|
||||
PKG_BUILD_DIR := $(KERNEL_BUILD_DIR)/$(PKG_NAME)
|
||||
STAMP_PREPARED := $(STAMP_PREPARED)_$(call confvar,CONFIG_MTD_REDBOOT_PARTS)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/bcmhotproxy
|
||||
SECTION:=utils
|
||||
CATEGORY:=Base system
|
||||
TITLE:=Daemon That feeds broadcom driver calls to hotplug2
|
||||
endef
|
||||
|
||||
define Package/bcmhotproxy/description
|
||||
This package contains a Daemon that will listen to link events from broadcoms adsl driver and etherent driver and proxy them to hotplug
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
$(CP) ./src/* $(PKG_BUILD_DIR)/
|
||||
$(CP) ./files/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
target=$(firstword $(subst -, ,$(BOARD)))
|
||||
|
||||
MAKE_FLAGS += TARGET="$(target)"
|
||||
TARGET_CFLAGS += -Dtarget_$(target)=1 -Wall
|
||||
|
||||
|
||||
define Package/bcmhotproxy/install
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_DIR) $(1)/etc/
|
||||
$(INSTALL_DIR) $(1)/etc/init.d/
|
||||
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/etc/init.d/* $(1)/etc/init.d/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bcmhotproxy $(1)/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,bcmhotproxy))
|
||||
@@ -1,20 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=15
|
||||
STOP=95
|
||||
|
||||
USE_PROCD=1
|
||||
NAME=bcmhotproxy
|
||||
PROG=/sbin/bcmhotproxy
|
||||
|
||||
start_service() {
|
||||
procd_open_instance
|
||||
procd_set_param command "$PROG"
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
stop() {
|
||||
service_stop /sbin/bcmhotproxy
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
CC = gcc
|
||||
CFLAGS += -Wall
|
||||
|
||||
obj = bcmhotproxy.o brcmdaemon.o
|
||||
|
||||
bcmhotproxy: $(obj) $(obj.$(TARGET))
|
||||
clean:
|
||||
rm -f *.o
|
||||
@@ -1,139 +0,0 @@
|
||||
/*
|
||||
* bcmhotproxy -- a proxy to send messages from broadcom drivers to userspace
|
||||
*
|
||||
* Copyright (C) 2012-2013 Inteno Broadband Technology AB. All rights reserved.
|
||||
*
|
||||
* Author: Strhuan Blomquist
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
#include "bcmhotproxy.h"
|
||||
|
||||
int netlink_init() {
|
||||
int sock_fd;
|
||||
sock_fd=socket(PF_NETLINK, SOCK_RAW, NETLINK_BRCM_MONITOR);
|
||||
if(sock_fd<0)
|
||||
return -1;
|
||||
return sock_fd;
|
||||
}
|
||||
int hotplug_call(struct hotplug_arg arg)
|
||||
{
|
||||
char str[512];
|
||||
int ret;
|
||||
memset(str, '\0', sizeof(512));
|
||||
syslog(LOG_INFO, "ACTION=%s INTERFACE=%s /sbin/hotplug-call %s", arg.action,arg.inteface,arg.subsystem);
|
||||
sprintf(str, "ACTION=%s INTERFACE=%s /sbin/hotplug-call %s",arg.action,arg.inteface,arg.subsystem);
|
||||
ret=system(str);
|
||||
return ret;
|
||||
}
|
||||
hotplug_arg createargumetstruct(char *hotplugmsg)
|
||||
{
|
||||
hotplug_arg arg;
|
||||
char argumets[3][20];
|
||||
char * pch;
|
||||
int x=0;
|
||||
pch = strtok (hotplugmsg," ");
|
||||
while (pch != NULL){
|
||||
strcpy(argumets[x],pch);
|
||||
pch = strtok (NULL, " ");
|
||||
x++;
|
||||
}
|
||||
strncpy(arg.action,argumets[0],sizeof(arg.action));
|
||||
strncpy(arg.inteface,argumets[1],sizeof(arg.action));
|
||||
strncpy(arg.subsystem,argumets[2],sizeof(arg.action));
|
||||
|
||||
return arg;
|
||||
|
||||
}
|
||||
|
||||
int netlink_bind(int sock_fd) {
|
||||
|
||||
struct sockaddr_nl src_addr;
|
||||
memset(&src_addr, 0, sizeof(src_addr));
|
||||
src_addr.nl_family = AF_NETLINK;
|
||||
src_addr.nl_pid = getpid(); /* self pid */
|
||||
src_addr.nl_groups = 1; //multicast Group
|
||||
|
||||
bind(sock_fd, (struct sockaddr*)&src_addr,sizeof(src_addr));
|
||||
|
||||
if (bind(sock_fd, (struct sockaddr*)&src_addr,sizeof(src_addr))) {
|
||||
close(sock_fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return sock_fd;
|
||||
}
|
||||
|
||||
int dispatcher() {
|
||||
struct sockaddr_nl dest_addr;
|
||||
struct nlmsghdr *nlh = NULL;
|
||||
struct iovec iov;
|
||||
struct msghdr msg;
|
||||
hotplug_arg arg;
|
||||
int sock_fd;
|
||||
/* Initlize the netlink socket */
|
||||
sock_fd=netlink_init();
|
||||
if (sock_fd == -1) {
|
||||
fprintf(stderr, "Unable to Intitlize netlink socket.\n");
|
||||
exit(1);
|
||||
}
|
||||
/* Bind the netlink socket */
|
||||
sock_fd=netlink_bind(sock_fd);
|
||||
if (sock_fd == -1) {
|
||||
fprintf(stderr, "Unable to Listen to netlink socket.\n");
|
||||
exit(1);
|
||||
}
|
||||
/* destination address to listen to */
|
||||
nlh = (struct nlmsghdr *)malloc(NLMSG_SPACE(MAX_PAYLOAD));
|
||||
memset(nlh, 0, NLMSG_SPACE(MAX_PAYLOAD));
|
||||
nlh->nlmsg_len = NLMSG_SPACE(MAX_PAYLOAD);
|
||||
nlh->nlmsg_pid = getpid();
|
||||
nlh->nlmsg_flags = 0;
|
||||
|
||||
/* Fill the netlink message header */
|
||||
iov.iov_base = (void *)nlh;
|
||||
iov.iov_len = nlh->nlmsg_len;
|
||||
msg.msg_name = (void *)&dest_addr;
|
||||
msg.msg_namelen = sizeof(dest_addr);
|
||||
msg.msg_iov = &iov;
|
||||
msg.msg_iovlen = 1;
|
||||
|
||||
|
||||
/* Read message from kernel */
|
||||
while(1){
|
||||
recvmsg(sock_fd, &msg, 0);
|
||||
switch (nlh->nlmsg_type)
|
||||
{
|
||||
case MSG_NETLINK_BRCM_WAKEUP_MONITOR_TASK:
|
||||
case MSG_NETLINK_BRCM_LINK_STATUS_CHANGED:
|
||||
/*process the message */
|
||||
fprintf(stderr, "No Handle\n");
|
||||
break;
|
||||
case MSG_NETLINK_BRCM_LINK_HOTPLUG:
|
||||
arg=createargumetstruct((char *)NLMSG_DATA(nlh));
|
||||
if(hotplug_call(arg)){
|
||||
fprintf(stderr, "Unable to call hotplug.\n");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Unknown type\n");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
close(sock_fd);
|
||||
return 0;
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
#ifndef BCMHOTPROXY_H
|
||||
#define BCMHOTPROXY_H 1
|
||||
#include <sys/socket.h>
|
||||
#include <linux/netlink.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <syslog.h>
|
||||
#define MSG_NETLINK_BRCM_WAKEUP_MONITOR_TASK 0X1000
|
||||
|
||||
#define MSG_NETLINK_BRCM_LINK_STATUS_CHANGED 0X2000
|
||||
|
||||
#define MSG_NETLINK_BRCM_LINK_HOTPLUG 0X3000
|
||||
#define MAX_PAYLOAD 1024 /* maximum payload size*/
|
||||
#ifndef NETLINK_BRCM_MONITOR
|
||||
#define NETLINK_BRCM_MONITOR 25
|
||||
#endif
|
||||
typedef struct hotplug_arg hotplug_arg;
|
||||
|
||||
struct hotplug_arg
|
||||
{
|
||||
char action[20];
|
||||
char inteface[20];
|
||||
char subsystem[20];
|
||||
|
||||
};
|
||||
#endif
|
||||
@@ -1,153 +0,0 @@
|
||||
#include "brcmdaemon.h"
|
||||
|
||||
/**************************************************************************
|
||||
Function: Print Usage
|
||||
|
||||
Description:
|
||||
Output the command-line options for this daemon.
|
||||
|
||||
Params:
|
||||
@argc - Standard argument count
|
||||
@argv - Standard argument array
|
||||
|
||||
Returns:
|
||||
returns void always
|
||||
**************************************************************************/
|
||||
void PrintUsage(int argc, char *argv[]) {
|
||||
if (argc >=1) {
|
||||
printf("Usage: %s -h -n\n", argv[0]);
|
||||
printf(" Options: \n");
|
||||
printf(" -ntDon't fork off as a daemon.\n");
|
||||
printf(" -htShow this help screen.\n");
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
Function: signal_handler
|
||||
|
||||
Description:
|
||||
This function handles select signals that the daemon may
|
||||
receive. This gives the daemon a chance to properly shut
|
||||
down in emergency situations. This function is installed
|
||||
as a signal handler in the 'main()' function.
|
||||
|
||||
Params:
|
||||
@sig - The signal received
|
||||
|
||||
Returns:
|
||||
returns void always
|
||||
**************************************************************************/
|
||||
void signal_handler(int sig) {
|
||||
|
||||
switch(sig) {
|
||||
case SIGHUP:
|
||||
syslog(LOG_WARNING, "Received SIGHUP signal.");
|
||||
break;
|
||||
case SIGTERM:
|
||||
syslog(LOG_WARNING, "Received SIGTERM signal.");
|
||||
break;
|
||||
default:
|
||||
syslog(LOG_WARNING, "Unhandled signal (%d) %s", strsignal(sig));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
Function: main
|
||||
|
||||
Description:
|
||||
The c standard 'main' entry point function.
|
||||
|
||||
Params:
|
||||
@argc - count of command line arguments given on command line
|
||||
@argv - array of arguments given on command line
|
||||
|
||||
Returns:
|
||||
returns integer which is passed back to the parent process
|
||||
**************************************************************************/
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
#if defined(DEBUG)
|
||||
int daemonize = 0;
|
||||
#else
|
||||
int daemonize = 0;
|
||||
#endif
|
||||
|
||||
// Setup signal handling before we start
|
||||
signal(SIGHUP, signal_handler);
|
||||
signal(SIGTERM, signal_handler);
|
||||
signal(SIGINT, signal_handler);
|
||||
signal(SIGQUIT, signal_handler);
|
||||
|
||||
int c;
|
||||
while( (c = getopt(argc, argv, "nh|help")) != -1) {
|
||||
switch(c){
|
||||
case 'h':
|
||||
PrintUsage(argc, argv);
|
||||
exit(0);
|
||||
break;
|
||||
case 'n':
|
||||
daemonize = 0;
|
||||
break;
|
||||
default:
|
||||
PrintUsage(argc, argv);
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
syslog(LOG_INFO, "%s daemon starting up", DAEMON_NAME);
|
||||
|
||||
// Setup syslog logging - see SETLOGMASK(3)
|
||||
#if defined(DEBUG)
|
||||
setlogmask(LOG_UPTO(LOG_DEBUG));
|
||||
openlog(DAEMON_NAME, LOG_CONS | LOG_NDELAY | LOG_PERROR | LOG_PID, LOG_USER);
|
||||
#else
|
||||
setlogmask(LOG_UPTO(LOG_INFO));
|
||||
openlog(DAEMON_NAME, LOG_CONS, LOG_USER);
|
||||
#endif
|
||||
|
||||
/* Our process ID and Session ID */
|
||||
pid_t pid, sid;
|
||||
|
||||
if (daemonize) {
|
||||
syslog(LOG_INFO, "starting the daemonizing process");
|
||||
|
||||
/* Fork off the parent process */
|
||||
pid = fork();
|
||||
if (pid < 0) {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
/* If we got a good PID, then
|
||||
we can exit the parent process. */
|
||||
if (pid > 0) {
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
/* Change the file mode mask */
|
||||
umask(0);
|
||||
|
||||
/* Create a new SID for the child process */
|
||||
sid = setsid();
|
||||
if (sid < 0) {
|
||||
/* Log the failure */
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Change the current working directory */
|
||||
if ((chdir("/")) < 0) {
|
||||
/* Log the failure */
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Close out the standard file descriptors */
|
||||
close(STDIN_FILENO);
|
||||
close(STDOUT_FILENO);
|
||||
close(STDERR_FILENO);
|
||||
}
|
||||
|
||||
dispatcher();
|
||||
syslog(LOG_INFO, "%s daemon exiting", DAEMON_NAME);
|
||||
exit(0);
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
#ifndef BRCMDAEMON_H
|
||||
#define BRCMDAEMON_H 1
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <syslog.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <signal.h>
|
||||
|
||||
#define DAEMON_NAME "brcmnetlink"
|
||||
#define PID_FILE "/var/run/brcmnetlink.pid"
|
||||
#endif
|
||||
@@ -1,231 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2006-2008 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
# update this based on the Broadcom SDK version, 4.14L.04 -> 414040
|
||||
BRCM_SDK_VERSION:=414040
|
||||
|
||||
ifeq ($(CONFIG_BCM_OPEN),y)
|
||||
$(error "OPEN SDK compile not tested with this kernel!")
|
||||
endif
|
||||
|
||||
PKG_NAME:=bcmkernel-3.4
|
||||
PKG_VERSION:=$(BRCM_SDK_VERSION)
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_URL:=git@iopsys.inteno.se:bcmkernel-4.14L.04
|
||||
PKG_SOURCE_PROTO:=git
|
||||
|
||||
PKG_SOURCE_VERSION:=8216815ced065e527681a079ad0e17fbb007baec
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(BRCM_SDK_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(BRCM_SDK_VERSION)
|
||||
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/image.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
export CONFIG_BCM_CHIP_ID
|
||||
export CONFIG_BCM_KERNEL_PROFILE
|
||||
export CONFIG_SECURE_BOOT_CFE
|
||||
|
||||
|
||||
BCM_BS_PROFILE = $(shell echo $(CONFIG_BCM_KERNEL_PROFILE) | sed s/\"//g)
|
||||
|
||||
BCM_KERNEL_VERSION:=3.4.11-rt19
|
||||
BCM_SDK_VERSION:=bcm963xx
|
||||
RSTRIP:=true
|
||||
|
||||
|
||||
define Package/bcmkernel/removevoice
|
||||
touch $(1)/lib/modules/$(BCM_KERNEL_VERSION)/extra/endpointdd.ko
|
||||
rm $(1)/lib/modules/$(BCM_KERNEL_VERSION)/extra/endpointdd.ko
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_BCM_ENDPOINT_MODULE),y)
|
||||
define Package/bcmkernel/removevoice
|
||||
echo not removing $(1)/lib/modules/$(BCM_KERNEL_VERSION)/extra/endpointdd.ko
|
||||
endef
|
||||
endif
|
||||
|
||||
|
||||
define Package/bcmkernel/removei2c
|
||||
rm $(1)/lib/modules/$(BCM_KERNEL_VERSION)/i2c*
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_BCM_I2C),y)
|
||||
define Package/bcmkernel/removei2c
|
||||
echo not removing $(1)/lib/modules/$(BCM_KERNEL_VERSION)/i2c*
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/bcmkernel/install
|
||||
$(INSTALL_DIR) $(1)/lib/bcm
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/etc/adsl
|
||||
$(INSTALL_DIR) $(1)/etc/wlan
|
||||
$(INSTALL_DIR) $(1)/etc/cms_entity_info.d
|
||||
|
||||
# Install header files
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/broadcom/include/bcm963xx
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/endpt/inc
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/codec
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/casCtl/inc
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/LinuxUser
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_drivers/inc
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/shared/opensource/include/bcm963xx
|
||||
|
||||
|
||||
$(CP) -r $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/shared/opensource/include/bcm963xx/* $(STAGING_DIR)/usr/include/bcm963xx/shared/opensource/include/bcm963xx
|
||||
|
||||
$(CP) -r $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/bcmdrivers/opensource/include/bcm963xx/* $(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx/
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/inc/vrgTypes.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc/vrgTypes.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/inc/vrgCountryCfg.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc/vrgCountryCfg.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/inc/vrgCountryCfgCustom.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc/vrgCountryCfgCustom.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/inc/vrgLogCfgCustom.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc/vrgLogCfgCustom.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/inc/vrgLog.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc/vrgLog.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/inc/countryArchive.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc/countryArchive.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/inc/vrgCountry.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc/vrgCountry.h
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/casCtl/inc/casCtl.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/casCtl/inc/casCtl.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/codec/codec.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/codec/codec.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/endpt/inc/endpt.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/endpt/inc/endpt.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/endpt/inc/vrgEndpt.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/endpt/inc/vrgEndpt.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/LinuxUser/bosTypesLinuxUser.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/LinuxUser/bosTypesLinuxUser.h
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosMutex.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosMutex.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosSpinlock.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosSpinlock.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosMsgQ.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosMsgQ.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosCritSect.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosCritSect.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosTypes.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosTypes.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosTime.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosTime.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosSem.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosSem.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosCfgCustom.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosCfgCustom.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosIpAddr.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosIpAddr.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosTimer.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosTimer.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosError.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosError.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosLog.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosLog.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosSleep.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosSleep.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosMisc.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosMisc.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosCfg.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosCfg.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosEvent.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosEvent.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosTask.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosTask.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosUtil.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosUtil.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosInit.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosInit.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosSocket.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosSocket.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosFile.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosFile.h
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_drivers/inc/xdrvSlic.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_drivers/inc/xdrvSlic.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_drivers/inc/xdrvApm.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_drivers/inc/xdrvApm.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_drivers/inc/xdrvCas.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_drivers/inc/xdrvCas.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_drivers/inc/xdrvTypes.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_drivers/inc/xdrvTypes.h
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/bcmdrivers/broadcom/include/bcm963xx/endptvoicestats.h $(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/broadcom/include/bcm963xx/endptvoicestats.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/bcmdrivers/broadcom/include/bcm963xx/endpointdrv.h $(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/broadcom/include/bcm963xx/endpointdrv.h
|
||||
echo "#define BCM_SDK_VERSION $(BRCM_SDK_VERSION)" > $(STAGING_DIR)/usr/include/bcm_sdk_version.h
|
||||
|
||||
# create symlink to kernel build directory
|
||||
rm -f $(BUILD_DIR)/bcmkernel
|
||||
ln -sfn $(PKG_SOURCE_SUBDIR) $(BUILD_DIR)/bcmkernel
|
||||
|
||||
# Install binaries
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/bin/* $(1)/usr/sbin/
|
||||
|
||||
rm -f $(1)/usr/sbin/dhcp6c
|
||||
rm -f $(1)/usr/sbin/dhcp6s
|
||||
rm -f $(1)/usr/sbin/dhcpc
|
||||
rm -f $(1)/usr/sbin/dhcpd
|
||||
rm -f $(1)/usr/sbin/dnsproxy
|
||||
rm -f $(1)/usr/sbin/httpd
|
||||
rm -f $(1)/usr/sbin/openssl
|
||||
rm -f $(1)/usr/sbin/racoon
|
||||
rm -f $(1)/usr/sbin/ripd
|
||||
rm -f $(1)/usr/sbin/send_cms_msg
|
||||
rm -f $(1)/usr/sbin/sshd
|
||||
rm -f $(1)/usr/sbin/ssk
|
||||
rm -f $(1)/usr/sbin/telnetd
|
||||
rm -f $(1)/usr/sbin/tr64c
|
||||
rm -f $(1)/usr/sbin/tr69c
|
||||
rm -f $(1)/usr/sbin/ubi*
|
||||
rm -f $(1)/usr/sbin/udhcpd
|
||||
rm -f $(1)/usr/sbin/upnp
|
||||
rm -f $(1)/usr/sbin/upnpd
|
||||
rm -f $(1)/usr/sbin/vodsl
|
||||
rm -f $(1)/usr/sbin/wlmngr
|
||||
rm -f $(1)/usr/sbin/zebra
|
||||
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/etc/cms_entity_info.d/eid_bcm_kthreads.txt $(1)/etc/cms_entity_info.d/
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/etc/cms_entity_info.d/symbol_table.txt $(1)/etc/cms_entity_info.d/
|
||||
|
||||
# Install libraries
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/lib/* $(1)/usr/lib/
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/lib/gpl/* $(1)/usr/lib/
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/lib/private/* $(1)/usr/lib/
|
||||
|
||||
mv $(1)/usr/lib/ld-uClibc.so.0 $(1)/lib/bcm/
|
||||
mv $(1)/usr/lib/libc.so.0 $(1)/lib/bcm/
|
||||
mv $(1)/usr/lib/libdl.so.0 $(1)/lib/bcm/
|
||||
mv $(1)/usr/lib/libgcc_s.so.1 $(1)/lib/bcm/
|
||||
mv $(1)/usr/lib/libpthread.so.0 $(1)/lib/bcm/
|
||||
|
||||
rm -f $(1)/usr/lib/libcrypt.so.0
|
||||
rm -f $(1)/usr/lib/libm.so.0
|
||||
rm -f $(1)/usr/lib/libutil.so.0
|
||||
rm -f $(1)/usr/lib/libcms_boardctl.so
|
||||
rm -f $(1)/usr/lib/libcms_msg.so
|
||||
rm -f $(1)/usr/lib/libcms_util.so
|
||||
rm -f $(1)/usr/lib/libcrypto.so.0.9.7
|
||||
rm -f $(1)/usr/lib/libssl.so.0.9.7
|
||||
rm -f $(1)/usr/lib/libnvram.so
|
||||
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/lib/public/* $(1)/usr/lib/
|
||||
|
||||
rm -rf $(1)/usr/lib/modules
|
||||
rm -rf $(1)/usr/lib/private
|
||||
rm -rf $(1)/usr/lib/public
|
||||
rm -rf $(1)/usr/lib/gpl
|
||||
|
||||
# Install kernel modules
|
||||
rm -rf $(1)/lib/modules/$(BCM_KERNEL_VERSION)/*
|
||||
mkdir -p $(1)/lib/
|
||||
mkdir -p $(1)/lib/modules/
|
||||
mkdir -p $(1)/lib/modules/$(BCM_KERNEL_VERSION)/
|
||||
mkdir -p $(1)/lib/modules/$(BCM_KERNEL_VERSION)/extra
|
||||
|
||||
cp -R $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/lib/modules/$(BCM_KERNEL_VERSION)/extra/* $(1)/lib/modules/$(BCM_KERNEL_VERSION)/extra/
|
||||
find $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/lib/modules/$(BCM_KERNEL_VERSION)/kernel/ -name *.ko -exec cp {} $(1)/lib/modules/$(BCM_KERNEL_VERSION)/ \;
|
||||
|
||||
cp -R $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/etc/wlan/*_map.bin $(1)/etc/wlan
|
||||
cp -R $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/etc/telephonyProfiles.d $(1)/etc/
|
||||
|
||||
# rm -rf $(1)/lib/modules/$(BCM_KERNEL_VERSION)/bcm_usb.ko
|
||||
|
||||
cp -R $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/kernel/linux-3.4rt/vmlinux $(KDIR)/vmlinux.bcm.elf
|
||||
$(KERNEL_CROSS)strip --remove-section=.note --remove-section=.comment $(KDIR)/vmlinux.bcm.elf
|
||||
$(KERNEL_CROSS)objcopy $(OBJCOPY_STRIP) -O binary $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/kernel/linux-3.4rt/vmlinux $(KDIR)/vmlinux.bcm
|
||||
|
||||
# bootloader nor
|
||||
# cp -R $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/cfe/build/broadcom/bcm63xx_rom/bcm9$(CONFIG_BCM_CHIP_ID)_cfe.w $(KDIR)/bcm_bootloader_cfe.w
|
||||
|
||||
# ram part of the bootloader for nand boot
|
||||
cp -R $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/cfe/build/broadcom/bcm63xx_ram/cfe$(CONFIG_BCM_CHIP_ID).bin $(KDIR)/cferam.001
|
||||
cp -R $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/cfe/build/broadcom/bcm63xx_rom/cfe$(CONFIG_BCM_CHIP_ID)_nand.v $(KDIR)/cfe$(CONFIG_BCM_CHIP_ID)_nand.v
|
||||
cp -R $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/cfe/ $(KDIR)/cfe
|
||||
# dd if=$(KDIR)/vmlinux.bcm.elf of=$(KDIR)/vmlinux.bcm bs=4096 count=1
|
||||
# $(KERNEL_CROSS)objcopy $(OBJCOPY_STRIP) -S $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux.elf
|
||||
|
||||
$(call Package/bcmkernel/removevoice,$(1))
|
||||
$(call Package/bcmkernel/removei2c,$(1))
|
||||
endef
|
||||
|
||||
@@ -1,266 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2006-2008 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
# update this based on the Broadcom SDK version, 4.16L.02 -> 416020
|
||||
# 4.16L.02A -> 416021
|
||||
BRCM_SDK_VERSION:=416021
|
||||
|
||||
ifeq ($(CONFIG_BCM_OPEN),y)
|
||||
$(error "OPEN SDK compile not tested with this kernel!")
|
||||
endif
|
||||
|
||||
PKG_NAME:=bcmkernel-3.4
|
||||
PKG_VERSION:=$(BRCM_SDK_VERSION)
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_URL:=git@iopsys.inteno.se:bcmkernel-4.16L.02A
|
||||
PKG_SOURCE_PROTO:=git
|
||||
|
||||
PKG_SOURCE_VERSION:=00e673bd751d19059cb3ed5fd2dbf3831a7e0401
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(BRCM_SDK_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(BRCM_SDK_VERSION)
|
||||
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/image.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
export CONFIG_BCM_CHIP_ID
|
||||
export CONFIG_BCM_KERNEL_PROFILE
|
||||
export CONFIG_SECURE_BOOT_CFE
|
||||
|
||||
|
||||
BCM_BS_PROFILE = $(shell echo $(CONFIG_BCM_KERNEL_PROFILE) | sed s/\"//g)
|
||||
|
||||
BCM_KERNEL_VERSION:=3.4.11-rt19
|
||||
BCM_SDK_VERSION:=bcm963xx
|
||||
RSTRIP:=true
|
||||
|
||||
|
||||
define Package/bcmkernel/removevoice
|
||||
touch $(1)/lib/modules/$(BCM_KERNEL_VERSION)/extra/endpointdd.ko
|
||||
rm $(1)/lib/modules/$(BCM_KERNEL_VERSION)/extra/endpointdd.ko
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_BCM_ENDPOINT_MODULE),y)
|
||||
define Package/bcmkernel/removevoice
|
||||
echo not removing $(1)/lib/modules/$(BCM_KERNEL_VERSION)/extra/endpointdd.ko
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/bcmkernel/removesound
|
||||
touch $(1)/lib/modules/$(BCM_KERNEL_VERSION)/snd
|
||||
touch $(1)/lib/modules/$(BCM_KERNEL_VERSION)/soundcore.ko
|
||||
rm $(1)/lib/modules/$(BCM_KERNEL_VERSION)/snd*
|
||||
rm $(1)/lib/modules/$(BCM_KERNEL_VERSION)/soundcore.ko
|
||||
endef
|
||||
|
||||
ifeq ($(BCM_USBSOUND_MODULES),y)
|
||||
define Package/bcmkernel/removesound
|
||||
echo not removing $(1)/lib/modules/$(BCM_KERNEL_VERSION)/snd*
|
||||
endef
|
||||
endif
|
||||
|
||||
|
||||
define Package/bcmkernel/removei2c
|
||||
rm $(1)/lib/modules/$(BCM_KERNEL_VERSION)/i2c*
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_BCM_I2C),y)
|
||||
define Package/bcmkernel/removei2c
|
||||
echo not removing $(1)/lib/modules/$(BCM_KERNEL_VERSION)/i2c*
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/bcmkernel/removebluetooth
|
||||
rm $(1)/lib/modules/$(BCM_KERNEL_VERSION)/bluetooth.ko
|
||||
rm $(1)/lib/modules/$(BCM_KERNEL_VERSION)/bnep.ko
|
||||
rm $(1)/lib/modules/$(BCM_KERNEL_VERSION)/btusb.ko
|
||||
rm $(1)/lib/modules/$(BCM_KERNEL_VERSION)/rfcomm.ko
|
||||
rm $(1)/lib/modules/$(BCM_KERNEL_VERSION)/hci_uart.ko
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_BCM_BLUETOOTH),y)
|
||||
define Package/bcmkernel/removebluetooth
|
||||
echo not removing $(1)/lib/modules/$(BCM_KERNEL_VERSION)/bluetooth.ko etc...
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/bcmkernel/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/etc/adsl
|
||||
$(INSTALL_DIR) $(1)/etc/wlan
|
||||
$(INSTALL_DIR) $(1)/etc/cms_entity_info.d
|
||||
|
||||
# Install header files
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/broadcom/include/bcm963xx
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/endpt/inc
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/codec
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/casCtl/inc
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/LinuxUser
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_drivers/inc
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/shared/opensource/include/bcm963xx
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/userspace/private/apps/vodsl/voip/inc
|
||||
|
||||
|
||||
$(CP) -r $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/shared/opensource/include/bcm963xx/* $(STAGING_DIR)/usr/include/bcm963xx/shared/opensource/include/bcm963xx
|
||||
|
||||
$(CP) -r $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/bcmdrivers/opensource/include/bcm963xx/* $(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx/
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/inc/vrgTypes.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc/vrgTypes.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/inc/vrgCountryCfg.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc/vrgCountryCfg.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/inc/vrgCountryCfgCustom.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc/vrgCountryCfgCustom.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/inc/vrgLogCfgCustom.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc/vrgLogCfgCustom.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/inc/vrgLog.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc/vrgLog.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/inc/countryArchive.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc/countryArchive.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/inc/vrgCountry.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc/vrgCountry.h
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/casCtl/inc/casCtl.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/casCtl/inc/casCtl.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/codec/codec.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/codec/codec.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/endpt/inc/endpt.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/endpt/inc/endpt.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/endpt/inc/vrgEndpt.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/endpt/inc/vrgEndpt.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/LinuxUser/bosTypesLinuxUser.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/LinuxUser/bosTypesLinuxUser.h
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosMutex.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosMutex.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosSpinlock.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosSpinlock.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosMsgQ.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosMsgQ.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosCritSect.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosCritSect.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosTypes.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosTypes.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosTime.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosTime.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosSem.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosSem.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosCfgCustom.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosCfgCustom.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosIpAddr.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosIpAddr.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosTimer.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosTimer.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosError.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosError.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosLog.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosLog.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosSleep.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosSleep.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosMisc.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosMisc.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosCfg.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosCfg.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosEvent.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosEvent.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosTask.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosTask.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosUtil.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosUtil.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosInit.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosInit.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosSocket.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosSocket.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosFile.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosFile.h
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_drivers/inc/xdrvSlic.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_drivers/inc/xdrvSlic.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_drivers/inc/xdrvApm.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_drivers/inc/xdrvApm.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_drivers/inc/xdrvCas.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_drivers/inc/xdrvCas.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_drivers/inc/xdrvTypes.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_drivers/inc/xdrvTypes.h
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/bcmdrivers/broadcom/include/bcm963xx/endptvoicestats.h $(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/broadcom/include/bcm963xx/endptvoicestats.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/bcmdrivers/broadcom/include/bcm963xx/endpointdrv.h $(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/broadcom/include/bcm963xx/endpointdrv.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/userspace/private/apps/vodsl/voip/inc/tpProfiles.h $(STAGING_DIR)/usr/include/bcm963xx/userspace/private/apps/vodsl/voip/inc
|
||||
echo "#define BCM_SDK_VERSION $(BRCM_SDK_VERSION)" > $(STAGING_DIR)/usr/include/bcm_sdk_version.h
|
||||
|
||||
# create symlink to kernel build directory
|
||||
rm -f $(BUILD_DIR)/bcmkernel
|
||||
ln -sfn $(PKG_SOURCE_SUBDIR) $(BUILD_DIR)/bcmkernel
|
||||
|
||||
# Install binaries
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/bin/* $(1)/usr/sbin/
|
||||
|
||||
rm -f $(1)/usr/sbin/dhcp6c
|
||||
rm -f $(1)/usr/sbin/dhcp6s
|
||||
rm -f $(1)/usr/sbin/dhcpc
|
||||
rm -f $(1)/usr/sbin/dhcpd
|
||||
rm -f $(1)/usr/sbin/dnsproxy
|
||||
rm -f $(1)/usr/sbin/httpd
|
||||
rm -f $(1)/usr/sbin/openssl
|
||||
rm -f $(1)/usr/sbin/racoon
|
||||
rm -f $(1)/usr/sbin/ripd
|
||||
rm -f $(1)/usr/sbin/send_cms_msg
|
||||
rm -f $(1)/usr/sbin/sshd
|
||||
rm -f $(1)/usr/sbin/ssk
|
||||
rm -f $(1)/usr/sbin/telnetd
|
||||
rm -f $(1)/usr/sbin/tr64c
|
||||
rm -f $(1)/usr/sbin/tr69c
|
||||
rm -f $(1)/usr/sbin/ubi*
|
||||
rm -f $(1)/usr/sbin/udhcpd
|
||||
rm -f $(1)/usr/sbin/upnp
|
||||
rm -f $(1)/usr/sbin/upnpd
|
||||
rm -f $(1)/usr/sbin/vodsl
|
||||
rm -f $(1)/usr/sbin/wlmngr
|
||||
rm -f $(1)/usr/sbin/zebra
|
||||
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/etc/cms_entity_info.d/eid_bcm_kthreads.txt $(1)/etc/cms_entity_info.d/
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/etc/cms_entity_info.d/symbol_table.txt $(1)/etc/cms_entity_info.d/
|
||||
|
||||
# Install libraries
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/lib/* $(1)/usr/lib/
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/lib/gpl/* $(1)/usr/lib/
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/lib/private/* $(1)/usr/lib/
|
||||
|
||||
rm -f $(1)/usr/lib/ld-uClibc.so.0
|
||||
rm -f $(1)/usr/lib/libc.so.0
|
||||
rm -f $(1)/usr/lib/libdl.so.0
|
||||
rm -f $(1)/usr/lib/libgcc_s.so.1
|
||||
rm -f $(1)/usr/lib/libpthread.so.0
|
||||
rm -f $(1)/usr/lib/libm.so.0
|
||||
rm -f $(1)/usr/lib/libutil.so.0
|
||||
rm -f $(1)/usr/lib/libcms_boardctl.so
|
||||
rm -f $(1)/usr/lib/libcms_msg.so
|
||||
rm -f $(1)/usr/lib/libcms_util.so
|
||||
rm -f $(1)/usr/lib/libnvram.so
|
||||
rm -f $(1)/usr/lib/libcrypt.so.0
|
||||
|
||||
rm -f $(1)/usr/lib/libcrypto.so
|
||||
ln -s /usr/lib/libcrypto.so.1.0.0 $(1)/usr/lib/libcrypto.so
|
||||
rm -f $(1)/usr/lib/libcrypto.so.0.9.7
|
||||
ln -s /usr/lib/libcrypto.so.1.0.0 $(1)/usr/lib/libcrypto.so.0.9.7
|
||||
rm -f $(1)/usr/lib/libssl.so
|
||||
ln -s /usr/lib/libssl.so.1.0.0 $(1)/usr/lib/libssl.so
|
||||
rm -f $(1)/usr/lib/libssl.so.0.9.7
|
||||
ln -s /usr/lib/libssl.so.1.0.0 $(1)/usr/lib/libssl.so.0.9.7
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/lib/public/* $(1)/usr/lib/
|
||||
|
||||
rm -rf $(1)/usr/lib/modules
|
||||
rm -rf $(1)/usr/lib/private
|
||||
rm -rf $(1)/usr/lib/public
|
||||
rm -rf $(1)/usr/lib/gpl
|
||||
|
||||
# Install kernel modules
|
||||
rm -rf $(1)/lib/modules/$(BCM_KERNEL_VERSION)/*
|
||||
mkdir -p $(1)/lib/
|
||||
mkdir -p $(1)/lib/modules/
|
||||
mkdir -p $(1)/lib/modules/$(BCM_KERNEL_VERSION)/
|
||||
mkdir -p $(1)/lib/modules/$(BCM_KERNEL_VERSION)/extra
|
||||
|
||||
cp -R $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/lib/modules/$(BCM_KERNEL_VERSION)/extra/* $(1)/lib/modules/$(BCM_KERNEL_VERSION)/extra/
|
||||
find $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/lib/modules/$(BCM_KERNEL_VERSION)/kernel/ -name *.ko -exec cp {} $(1)/lib/modules/$(BCM_KERNEL_VERSION)/ \;
|
||||
|
||||
cp -R $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/etc/wlan/* $(1)/etc/wlan
|
||||
cp -R $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/etc/telephonyProfiles.d $(1)/etc/
|
||||
|
||||
# rm -rf $(1)/lib/modules/$(BCM_KERNEL_VERSION)/bcm_usb.ko
|
||||
|
||||
cp -R $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/kernel/linux-3.4rt/vmlinux $(KDIR)/vmlinux.bcm.elf
|
||||
$(KERNEL_CROSS)strip --remove-section=.note --remove-section=.comment $(KDIR)/vmlinux.bcm.elf
|
||||
$(KERNEL_CROSS)objcopy $(OBJCOPY_STRIP) -O binary $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/kernel/linux-3.4rt/vmlinux $(KDIR)/vmlinux.bcm
|
||||
|
||||
# bootloader nor
|
||||
# cp -R $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/cfe/build/broadcom/bcm63xx_rom/bcm9$(CONFIG_BCM_CHIP_ID)_cfe.w $(KDIR)/bcm_bootloader_cfe.w
|
||||
|
||||
# ram part of the bootloader for nand boot
|
||||
cp -R $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/cfe/build/broadcom/bcm63xx_ram/cfe$(CONFIG_BCM_CHIP_ID).bin $(KDIR)/cferam.001
|
||||
cp -R $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/cfe/build/broadcom/bcm63xx_rom/cfe$(CONFIG_BCM_CHIP_ID)_nand.v $(KDIR)/cfe$(CONFIG_BCM_CHIP_ID)_nand.v
|
||||
cp -R $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/cfe/ $(KDIR)/cfe
|
||||
# dd if=$(KDIR)/vmlinux.bcm.elf of=$(KDIR)/vmlinux.bcm bs=4096 count=1
|
||||
# $(KERNEL_CROSS)objcopy $(OBJCOPY_STRIP) -S $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux.elf
|
||||
|
||||
$(call Package/bcmkernel/removevoice,$(1))
|
||||
$(call Package/bcmkernel/removesound,$(1))
|
||||
# $(call Package/bcmkernel/removei2c,$(1))
|
||||
endef
|
||||
|
||||
@@ -1,278 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2006-2008 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
# update this based on the Broadcom SDK version, 4.16L.03 -> 416030
|
||||
BRCM_SDK_VERSION:=416030
|
||||
|
||||
ifneq ($(CONFIG_BCM_OPEN),y)
|
||||
PKG_NAME:=bcmkernel-3.4
|
||||
PKG_VERSION:=$(BRCM_SDK_VERSION)
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_URL:=git@iopsys.inteno.se:bcmkernel-4.16L.03
|
||||
PKG_SOURCE_PROTO:=git
|
||||
|
||||
PKG_SOURCE_VERSION:=205c1d7bdd24388e0bae8c2883ac83ca0b1e5458
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(BRCM_SDK_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
endif
|
||||
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(BRCM_SDK_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/image.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
export CONFIG_BCM_CHIP_ID
|
||||
export CONFIG_BCM_CFE_PASSWORD
|
||||
export CONFIG_BCM_KERNEL_PROFILE
|
||||
export CONFIG_SECURE_BOOT_CFE
|
||||
|
||||
|
||||
BCM_BS_PROFILE = $(shell echo $(CONFIG_BCM_KERNEL_PROFILE) | sed s/\"//g)
|
||||
|
||||
BCM_KERNEL_VERSION:=3.4.11-rt19
|
||||
BCM_SDK_VERSION:=bcm963xx
|
||||
RSTRIP:=true
|
||||
|
||||
|
||||
define Package/bcmkernel/removevoice
|
||||
touch $(1)/lib/modules/$(BCM_KERNEL_VERSION)/extra/endpointdd.ko
|
||||
rm $(1)/lib/modules/$(BCM_KERNEL_VERSION)/extra/endpointdd.ko
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_BCM_ENDPOINT_MODULE),y)
|
||||
define Package/bcmkernel/removevoice
|
||||
echo not removing $(1)/lib/modules/$(BCM_KERNEL_VERSION)/extra/endpointdd.ko
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/bcmkernel/removesound
|
||||
touch $(1)/lib/modules/$(BCM_KERNEL_VERSION)/snd
|
||||
touch $(1)/lib/modules/$(BCM_KERNEL_VERSION)/soundcore.ko
|
||||
rm $(1)/lib/modules/$(BCM_KERNEL_VERSION)/snd*
|
||||
rm $(1)/lib/modules/$(BCM_KERNEL_VERSION)/soundcore.ko
|
||||
endef
|
||||
|
||||
ifeq ($(BCM_USBSOUND_MODULES),y)
|
||||
define Package/bcmkernel/removesound
|
||||
echo not removing $(1)/lib/modules/$(BCM_KERNEL_VERSION)/snd*
|
||||
endef
|
||||
endif
|
||||
|
||||
|
||||
define Package/bcmkernel/removei2c
|
||||
rm $(1)/lib/modules/$(BCM_KERNEL_VERSION)/i2c*
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_BCM_I2C),y)
|
||||
define Package/bcmkernel/removei2c
|
||||
echo not removing $(1)/lib/modules/$(BCM_KERNEL_VERSION)/i2c*
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/bcmkernel/removebluetooth
|
||||
rm $(1)/lib/modules/$(BCM_KERNEL_VERSION)/bluetooth.ko
|
||||
rm $(1)/lib/modules/$(BCM_KERNEL_VERSION)/bnep.ko
|
||||
rm $(1)/lib/modules/$(BCM_KERNEL_VERSION)/btusb.ko
|
||||
rm $(1)/lib/modules/$(BCM_KERNEL_VERSION)/rfcomm.ko
|
||||
rm $(1)/lib/modules/$(BCM_KERNEL_VERSION)/hci_uart.ko
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_BCM_BLUETOOTH),y)
|
||||
define Package/bcmkernel/removebluetooth
|
||||
echo not removing $(1)/lib/modules/$(BCM_KERNEL_VERSION)/bluetooth.ko etc...
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/bcmkernel/install
|
||||
$(INSTALL_DIR) $(1)/lib
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/etc/adsl
|
||||
$(INSTALL_DIR) $(1)/etc/wlan
|
||||
$(INSTALL_DIR) $(1)/etc/cms_entity_info.d
|
||||
|
||||
# Install header files
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/broadcom/include/bcm963xx
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/endpt/inc
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/codec
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/casCtl/inc
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/LinuxUser
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_drivers/inc
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/shared/opensource/include/bcm963xx
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/userspace/private/apps/vodsl/voip/inc
|
||||
|
||||
|
||||
$(CP) -r $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/shared/opensource/include/bcm963xx/* $(STAGING_DIR)/usr/include/bcm963xx/shared/opensource/include/bcm963xx
|
||||
|
||||
$(CP) -r $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/bcmdrivers/opensource/include/bcm963xx/* $(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx/
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/inc/vrgTypes.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc/vrgTypes.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/inc/vrgCountryCfg.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc/vrgCountryCfg.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/inc/vrgCountryCfgCustom.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc/vrgCountryCfgCustom.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/inc/vrgLogCfgCustom.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc/vrgLogCfgCustom.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/inc/vrgLog.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc/vrgLog.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/inc/countryArchive.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc/countryArchive.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/inc/vrgCountry.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc/vrgCountry.h
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/casCtl/inc/casCtl.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/casCtl/inc/casCtl.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/codec/codec.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/codec/codec.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/endpt/inc/endpt.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/endpt/inc/endpt.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/endpt/inc/vrgEndpt.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/endpt/inc/vrgEndpt.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/LinuxUser/bosTypesLinuxUser.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/LinuxUser/bosTypesLinuxUser.h
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosMutex.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosMutex.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosSpinlock.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosSpinlock.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosMsgQ.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosMsgQ.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosCritSect.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosCritSect.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosTypes.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosTypes.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosTime.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosTime.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosSem.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosSem.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosCfgCustom.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosCfgCustom.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosIpAddr.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosIpAddr.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosTimer.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosTimer.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosError.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosError.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosLog.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosLog.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosSleep.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosSleep.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosMisc.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosMisc.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosCfg.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosCfg.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosEvent.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosEvent.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosTask.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosTask.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosUtil.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosUtil.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosInit.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosInit.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosSocket.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosSocket.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosFile.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosFile.h
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_drivers/inc/xdrvSlic.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_drivers/inc/xdrvSlic.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_drivers/inc/xdrvApm.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_drivers/inc/xdrvApm.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_drivers/inc/xdrvCas.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_drivers/inc/xdrvCas.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_drivers/inc/xdrvTypes.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_drivers/inc/xdrvTypes.h
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/bcmdrivers/broadcom/include/bcm963xx/endptvoicestats.h $(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/broadcom/include/bcm963xx/endptvoicestats.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/bcmdrivers/broadcom/include/bcm963xx/endpointdrv.h $(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/broadcom/include/bcm963xx/endpointdrv.h
|
||||
ifneq ($(CONFIG_BCM_OPEN),y)
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/userspace/private/apps/vodsl/voip/inc/tpProfiles.h $(STAGING_DIR)/usr/include/bcm963xx/userspace/private/apps/vodsl/voip/inc
|
||||
endif
|
||||
echo "#define BCM_SDK_VERSION $(BRCM_SDK_VERSION)" > $(STAGING_DIR)/usr/include/bcm_sdk_version.h
|
||||
|
||||
# create symlink to kernel build directory
|
||||
rm -f $(BUILD_DIR)/bcmkernel
|
||||
ln -sfn $(PKG_SOURCE_SUBDIR) $(BUILD_DIR)/bcmkernel
|
||||
|
||||
# Install binaries
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/bin/* $(1)/usr/sbin/
|
||||
|
||||
rm -f $(1)/usr/sbin/dhcp6c
|
||||
rm -f $(1)/usr/sbin/dhcp6s
|
||||
rm -f $(1)/usr/sbin/dhcpc
|
||||
rm -f $(1)/usr/sbin/dhcpd
|
||||
rm -f $(1)/usr/sbin/dnsproxy
|
||||
rm -f $(1)/usr/sbin/httpd
|
||||
rm -f $(1)/usr/sbin/openssl
|
||||
rm -f $(1)/usr/sbin/racoon
|
||||
rm -f $(1)/usr/sbin/ripd
|
||||
rm -f $(1)/usr/sbin/send_cms_msg
|
||||
rm -f $(1)/usr/sbin/sshd
|
||||
rm -f $(1)/usr/sbin/ssk
|
||||
rm -f $(1)/usr/sbin/telnetd
|
||||
rm -f $(1)/usr/sbin/tr64c
|
||||
rm -f $(1)/usr/sbin/tr69c
|
||||
rm -f $(1)/usr/sbin/ubi*
|
||||
rm -f $(1)/usr/sbin/udhcpd
|
||||
rm -f $(1)/usr/sbin/upnp
|
||||
rm -f $(1)/usr/sbin/upnpd
|
||||
rm -f $(1)/usr/sbin/vodsl
|
||||
rm -f $(1)/usr/sbin/wlmngr
|
||||
rm -f $(1)/usr/sbin/zebra
|
||||
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/etc/cms_entity_info.d/eid_bcm_kthreads.txt $(1)/etc/cms_entity_info.d/
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/etc/cms_entity_info.d/symbol_table.txt $(1)/etc/cms_entity_info.d/
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/etc/init.d/bcm-base-drivers.sh $(1)/lib/
|
||||
if [ -a $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/etc/rdpa_init.sh ]; then $(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/etc/rdpa_init.sh $(1)/etc/; fi;
|
||||
|
||||
|
||||
# Install libraries
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/lib/* $(1)/usr/lib/
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/lib/gpl/* $(1)/usr/lib/
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/lib/private/* $(1)/usr/lib/
|
||||
|
||||
rm -f $(1)/usr/lib/ld-uClibc.so.0
|
||||
rm -f $(1)/usr/lib/libc.so.0
|
||||
rm -f $(1)/usr/lib/libdl.so.0
|
||||
rm -f $(1)/usr/lib/libgcc_s.so.1
|
||||
rm -f $(1)/usr/lib/libpthread.so.0
|
||||
rm -f $(1)/usr/lib/libm.so.0
|
||||
rm -f $(1)/usr/lib/libutil.so.0
|
||||
rm -f $(1)/usr/lib/libcms_boardctl.so
|
||||
rm -f $(1)/usr/lib/libcms_msg.so
|
||||
rm -f $(1)/usr/lib/libcms_util.so
|
||||
rm -f $(1)/usr/lib/libnvram.so
|
||||
rm -f $(1)/usr/lib/libcrypt.so.0
|
||||
rm -f $(1)/usr/lib/libbcm_crc.so
|
||||
rm -f $(1)/usr/lib/libbcm_flashutil.so
|
||||
|
||||
rm -f $(1)/usr/lib/libcrypto.so
|
||||
ln -s /usr/lib/libcrypto.so.1.0.0 $(1)/usr/lib/libcrypto.so
|
||||
rm -f $(1)/usr/lib/libcrypto.so.0.9.7
|
||||
ln -s /usr/lib/libcrypto.so.1.0.0 $(1)/usr/lib/libcrypto.so.0.9.7
|
||||
rm -f $(1)/usr/lib/libssl.so
|
||||
ln -s /usr/lib/libssl.so.1.0.0 $(1)/usr/lib/libssl.so
|
||||
rm -f $(1)/usr/lib/libssl.so.0.9.7
|
||||
ln -s /usr/lib/libssl.so.1.0.0 $(1)/usr/lib/libssl.so.0.9.7
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/lib/public/* $(1)/usr/lib/
|
||||
$(CP) --remove-destination $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/lib/public/* $(1)/usr/lib/
|
||||
|
||||
rm -rf $(1)/usr/lib/modules
|
||||
rm -rf $(1)/usr/lib/private
|
||||
rm -rf $(1)/usr/lib/public
|
||||
rm -rf $(1)/usr/lib/gpl
|
||||
|
||||
# Install kernel modules
|
||||
rm -rf $(1)/lib/modules/$(BCM_KERNEL_VERSION)/*
|
||||
mkdir -p $(1)/lib/modules/
|
||||
mkdir -p $(1)/lib/modules/$(BCM_KERNEL_VERSION)/
|
||||
mkdir -p $(1)/lib/modules/$(BCM_KERNEL_VERSION)/extra
|
||||
|
||||
cp -R $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/lib/modules/$(BCM_KERNEL_VERSION)/extra/* $(1)/lib/modules/$(BCM_KERNEL_VERSION)/extra/
|
||||
#cp -r $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/lib/modules/$(BCM_KERNEL_VERSION)/kernel/ $(1)/lib/modules/$(BCM_KERNEL_VERSION)/
|
||||
find $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/lib/modules/$(BCM_KERNEL_VERSION)/kernel/ -name *.ko -exec cp {} $(1)/lib/modules/$(BCM_KERNEL_VERSION)/ \;
|
||||
|
||||
cp -R $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/etc/wlan/* $(1)/etc/wlan
|
||||
cp -R $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/etc/telephonyProfiles.d $(1)/etc/
|
||||
|
||||
# rm -rf $(1)/lib/modules/$(BCM_KERNEL_VERSION)/bcm_usb.ko
|
||||
|
||||
# Alternative DECT modules taken from the Natalie package and if that is not selected, no DECT modules should be loaded
|
||||
rm -f $(1)/lib/modules/$(BCM_KERNEL_VERSION)/extra/dect.ko
|
||||
|
||||
|
||||
cp -R $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/kernel/linux-3.4rt/vmlinux $(KDIR)/vmlinux.bcm.elf
|
||||
$(KERNEL_CROSS)strip --remove-section=.note --remove-section=.comment $(KDIR)/vmlinux.bcm.elf
|
||||
$(KERNEL_CROSS)objcopy $(OBJCOPY_STRIP) -O binary $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/kernel/linux-3.4rt/vmlinux $(KDIR)/vmlinux.bcm
|
||||
|
||||
# bootloader nor
|
||||
# cp -R $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/cfe/build/broadcom/bcm63xx_rom/bcm9$(CONFIG_BCM_CHIP_ID)_cfe.w $(KDIR)/bcm_bootloader_cfe.w
|
||||
|
||||
# ram part of the bootloader for nand boot
|
||||
if [ -a $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/cfe/build/broadcom/bcm63xx_ram/cfe$(CONFIG_BCM_CHIP_ID).bin ]; then cp -R $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/cfe/build/broadcom/bcm63xx_ram/cfe$(CONFIG_BCM_CHIP_ID).bin $(KDIR)/cferam.001; fi;
|
||||
if [ -a $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/cfe/build/broadcom/bcm63xx_ram/cfe$(CONFIG_BCM_CHIP_ID)ram.bin ]; then cp -R $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/cfe/build/broadcom/bcm63xx_ram/cfe$(CONFIG_BCM_CHIP_ID)ram.bin $(KDIR)/cferam.001; fi;
|
||||
cp -R $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/cfe/build/broadcom/bcm63xx_rom/cfe$(CONFIG_BCM_CHIP_ID)_nand.v $(KDIR)/cfe$(CONFIG_BCM_CHIP_ID)_nand.v
|
||||
cp -R $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/cfe/ $(KDIR)/cfe
|
||||
# dd if=$(KDIR)/vmlinux.bcm.elf of=$(KDIR)/vmlinux.bcm bs=4096 count=1
|
||||
# $(KERNEL_CROSS)objcopy $(OBJCOPY_STRIP) -S $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux.elf
|
||||
|
||||
$(call Package/bcmkernel/removevoice,$(1))
|
||||
$(call Package/bcmkernel/removesound,$(1))
|
||||
# $(call Package/bcmkernel/removei2c,$(1))
|
||||
endef
|
||||
|
||||
@@ -1,268 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2006-2008 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
# update this based on the Broadcom SDK version, 4.16L.04 -> 416040
|
||||
BRCM_SDK_VERSION:=416040
|
||||
|
||||
ifneq ($(CONFIG_BCM_OPEN),y)
|
||||
PKG_NAME:=bcmkernel-3.4
|
||||
PKG_VERSION:=$(BRCM_SDK_VERSION)
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_URL:=git@iopsys.inteno.se:bcmkernel
|
||||
PKG_SOURCE_PROTO:=git
|
||||
|
||||
PKG_SOURCE_VERSION:=963801c26cf4c86c53952a28e806cc233e5b62be
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(BRCM_SDK_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
endif
|
||||
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(BRCM_SDK_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/image.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
export CONFIG_BCM_CHIP_ID
|
||||
export CONFIG_BCM_CFE_PASSWORD
|
||||
export CONFIG_BCM_KERNEL_PROFILE
|
||||
export CONFIG_SECURE_BOOT_CFE
|
||||
|
||||
|
||||
BCM_BS_PROFILE = $(shell echo $(CONFIG_BCM_KERNEL_PROFILE) | sed s/\"//g)
|
||||
|
||||
BCM_KERNEL_VERSION:=3.4.11-rt19
|
||||
BCM_SDK_VERSION:=bcm963xx
|
||||
RSTRIP:=true
|
||||
|
||||
|
||||
define Package/bcmkernel/removevoice
|
||||
touch $(1)/lib/modules/$(BCM_KERNEL_VERSION)/extra/endpointdd.ko
|
||||
rm $(1)/lib/modules/$(BCM_KERNEL_VERSION)/extra/endpointdd.ko
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_BCM_ENDPOINT_MODULE),y)
|
||||
define Package/bcmkernel/removevoice
|
||||
echo not removing $(1)/lib/modules/$(BCM_KERNEL_VERSION)/extra/endpointdd.ko
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/bcmkernel/removesound
|
||||
touch $(1)/lib/modules/$(BCM_KERNEL_VERSION)/snd
|
||||
touch $(1)/lib/modules/$(BCM_KERNEL_VERSION)/soundcore.ko
|
||||
rm $(1)/lib/modules/$(BCM_KERNEL_VERSION)/snd*
|
||||
rm $(1)/lib/modules/$(BCM_KERNEL_VERSION)/soundcore.ko
|
||||
endef
|
||||
|
||||
ifeq ($(BCM_USBSOUND_MODULES),y)
|
||||
define Package/bcmkernel/removesound
|
||||
echo not removing $(1)/lib/modules/$(BCM_KERNEL_VERSION)/snd*
|
||||
endef
|
||||
endif
|
||||
|
||||
|
||||
define Package/bcmkernel/removei2c
|
||||
rm $(1)/lib/modules/$(BCM_KERNEL_VERSION)/i2c*
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_BCM_I2C),y)
|
||||
define Package/bcmkernel/removei2c
|
||||
echo not removing $(1)/lib/modules/$(BCM_KERNEL_VERSION)/i2c*
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/bcmkernel/removebluetooth
|
||||
rm $(1)/lib/modules/$(BCM_KERNEL_VERSION)/bluetooth.ko
|
||||
rm $(1)/lib/modules/$(BCM_KERNEL_VERSION)/bnep.ko
|
||||
rm $(1)/lib/modules/$(BCM_KERNEL_VERSION)/btusb.ko
|
||||
rm $(1)/lib/modules/$(BCM_KERNEL_VERSION)/rfcomm.ko
|
||||
rm $(1)/lib/modules/$(BCM_KERNEL_VERSION)/hci_uart.ko
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_BCM_BLUETOOTH),y)
|
||||
define Package/bcmkernel/removebluetooth
|
||||
echo not removing $(1)/lib/modules/$(BCM_KERNEL_VERSION)/bluetooth.ko etc...
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/bcmkernel/install
|
||||
$(INSTALL_DIR) $(1)/lib
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/etc/adsl
|
||||
$(INSTALL_DIR) $(1)/etc/wlan
|
||||
$(INSTALL_DIR) $(1)/etc/cms_entity_info.d
|
||||
|
||||
# Install header files
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/broadcom/include/bcm963xx
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/endpt/inc
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/codec
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/casCtl/inc
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/LinuxUser
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_drivers/inc
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/shared/opensource/include/bcm963xx
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx/userspace/private/apps/vodsl/voip/inc
|
||||
|
||||
|
||||
$(CP) -r $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/shared/opensource/include/bcm963xx/* $(STAGING_DIR)/usr/include/bcm963xx/shared/opensource/include/bcm963xx
|
||||
|
||||
$(CP) -r $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/bcmdrivers/opensource/include/bcm963xx/* $(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx/
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/inc/vrgTypes.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc/vrgTypes.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/inc/vrgCountryCfg.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc/vrgCountryCfg.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/inc/vrgCountryCfgCustom.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc/vrgCountryCfgCustom.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/inc/vrgLogCfgCustom.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc/vrgLogCfgCustom.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/inc/vrgLog.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc/vrgLog.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/inc/countryArchive.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc/countryArchive.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/inc/vrgCountry.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc/vrgCountry.h
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/casCtl/inc/casCtl.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/casCtl/inc/casCtl.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/codec/codec.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/codec/codec.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/endpt/inc/endpt.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/endpt/inc/endpt.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/voice_res_gw/endpt/inc/vrgEndpt.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/endpt/inc/vrgEndpt.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/LinuxUser/bosTypesLinuxUser.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/LinuxUser/bosTypesLinuxUser.h
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosMutex.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosMutex.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosSpinlock.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosSpinlock.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosMsgQ.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosMsgQ.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosCritSect.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosCritSect.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosTypes.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosTypes.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosTime.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosTime.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosSem.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosSem.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosCfgCustom.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosCfgCustom.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosIpAddr.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosIpAddr.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosTimer.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosTimer.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosError.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosError.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosLog.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosLog.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosSleep.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosSleep.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosMisc.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosMisc.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosCfg.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosCfg.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosEvent.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosEvent.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosTask.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosTask.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosUtil.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosUtil.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosInit.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosInit.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosSocket.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosSocket.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_common/bos/publicInc/bosFile.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/bosFile.h
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_drivers/inc/xdrvSlic.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_drivers/inc/xdrvSlic.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_drivers/inc/xdrvApm.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_drivers/inc/xdrvApm.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_drivers/inc/xdrvCas.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_drivers/inc/xdrvCas.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/xChange/dslx_common/xchg_drivers/inc/xdrvTypes.h $(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_drivers/inc/xdrvTypes.h
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/bcmdrivers/broadcom/include/bcm963xx/endptvoicestats.h $(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/broadcom/include/bcm963xx/endptvoicestats.h
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/bcmdrivers/broadcom/include/bcm963xx/endpointdrv.h $(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/broadcom/include/bcm963xx/endpointdrv.h
|
||||
ifneq ($(CONFIG_BCM_OPEN),y)
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/userspace/private/apps/vodsl/voip/inc/tpProfiles.h $(STAGING_DIR)/usr/include/bcm963xx/userspace/private/apps/vodsl/voip/inc
|
||||
endif
|
||||
echo "#define BCM_SDK_VERSION $(BRCM_SDK_VERSION)" > $(STAGING_DIR)/usr/include/bcm_sdk_version.h
|
||||
|
||||
# create symlink to kernel build directory
|
||||
rm -f $(BUILD_DIR)/bcmkernel
|
||||
ln -sfn $(PKG_SOURCE_SUBDIR) $(BUILD_DIR)/bcmkernel
|
||||
|
||||
# Install binaries
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/bin/* $(1)/usr/sbin/
|
||||
|
||||
rm -f $(1)/usr/sbin/dhcp6c
|
||||
rm -f $(1)/usr/sbin/dhcp6s
|
||||
rm -f $(1)/usr/sbin/dhcpc
|
||||
rm -f $(1)/usr/sbin/dhcpd
|
||||
rm -f $(1)/usr/sbin/dnsproxy
|
||||
rm -f $(1)/usr/sbin/httpd
|
||||
rm -f $(1)/usr/sbin/openssl
|
||||
rm -f $(1)/usr/sbin/racoon
|
||||
rm -f $(1)/usr/sbin/ripd
|
||||
rm -f $(1)/usr/sbin/send_cms_msg
|
||||
rm -f $(1)/usr/sbin/sshd
|
||||
rm -f $(1)/usr/sbin/ssk
|
||||
rm -f $(1)/usr/sbin/telnetd
|
||||
rm -f $(1)/usr/sbin/tr64c
|
||||
rm -f $(1)/usr/sbin/tr69c
|
||||
rm -f $(1)/usr/sbin/ubi*
|
||||
rm -f $(1)/usr/sbin/udhcpd
|
||||
rm -f $(1)/usr/sbin/upnp
|
||||
rm -f $(1)/usr/sbin/upnpd
|
||||
rm -f $(1)/usr/sbin/vodsl
|
||||
rm -f $(1)/usr/sbin/wlmngr
|
||||
rm -f $(1)/usr/sbin/zebra
|
||||
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/etc/cms_entity_info.d/eid_bcm_kthreads.txt $(1)/etc/cms_entity_info.d/
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/etc/cms_entity_info.d/symbol_table.txt $(1)/etc/cms_entity_info.d/
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/etc/init.d/bcm-base-drivers.sh $(1)/lib/
|
||||
sed -i '/bcm_usb\.ko/d' $(1)/lib/bcm-base-drivers.sh
|
||||
sed -i 's|/kernel/.*/|/|' $(1)/lib/bcm-base-drivers.sh
|
||||
|
||||
if [ -a $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/etc/rdpa_init.sh ]; then $(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/etc/rdpa_init.sh $(1)/etc/; fi;
|
||||
|
||||
|
||||
# Install libraries
|
||||
$(CP) $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/lib/* $(1)/usr/lib/
|
||||
|
||||
rm -f $(1)/usr/lib/ld-uClibc.so.0
|
||||
rm -f $(1)/usr/lib/libc.so.0
|
||||
rm -f $(1)/usr/lib/libdl.so.0
|
||||
rm -f $(1)/usr/lib/libgcc_s.so.1
|
||||
rm -f $(1)/usr/lib/libpthread.so.0
|
||||
rm -f $(1)/usr/lib/libm.so.0
|
||||
rm -f $(1)/usr/lib/libutil.so.0
|
||||
rm -f $(1)/usr/lib/libcrypt.so.0
|
||||
|
||||
rm -f $(1)/usr/lib/libcrypto.so
|
||||
ln -s /usr/lib/libcrypto.so.1.0.0 $(1)/usr/lib/libcrypto.so
|
||||
rm -f $(1)/usr/lib/libcrypto.so.0.9.7
|
||||
ln -s /usr/lib/libcrypto.so.1.0.0 $(1)/usr/lib/libcrypto.so.0.9.7
|
||||
rm -f $(1)/usr/lib/libssl.so
|
||||
ln -s /usr/lib/libssl.so.1.0.0 $(1)/usr/lib/libssl.so
|
||||
rm -f $(1)/usr/lib/libssl.so.0.9.7
|
||||
ln -s /usr/lib/libssl.so.1.0.0 $(1)/usr/lib/libssl.so.0.9.7
|
||||
|
||||
rm -rf $(1)/usr/lib/modules
|
||||
rm -rf $(1)/usr/lib/private
|
||||
rm -rf $(1)/usr/lib/public
|
||||
rm -rf $(1)/usr/lib/gpl
|
||||
|
||||
# Install kernel modules
|
||||
rm -rf $(1)/lib/modules/$(BCM_KERNEL_VERSION)/*
|
||||
mkdir -p $(1)/lib/modules/$(BCM_KERNEL_VERSION)/
|
||||
cp -R $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/lib/modules/$(BCM_KERNEL_VERSION)/extra $(1)/lib/modules/$(BCM_KERNEL_VERSION)/
|
||||
#cp -r $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/lib/modules/$(BCM_KERNEL_VERSION)/kernel $(1)/lib/modules/$(BCM_KERNEL_VERSION)/
|
||||
find $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/lib/modules/$(BCM_KERNEL_VERSION)/kernel/ -name *.ko -exec cp {} $(1)/lib/modules/$(BCM_KERNEL_VERSION)/ \;
|
||||
|
||||
|
||||
cp -R $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/etc/wlan/* $(1)/etc/wlan
|
||||
cp -R $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/$(BCM_BS_PROFILE)/fs/etc/telephonyProfiles.d $(1)/etc/
|
||||
|
||||
# rm -rf $(1)/lib/modules/$(BCM_KERNEL_VERSION)/bcm_usb.ko
|
||||
|
||||
# Alternative DECT modules taken from the Natalie package and if that is not selected, no DECT modules should be loaded
|
||||
rm -f $(1)/lib/modules/$(BCM_KERNEL_VERSION)/extra/dect.ko
|
||||
|
||||
|
||||
cp -R $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/kernel/linux-3.4rt/vmlinux $(KDIR)/vmlinux.bcm.elf
|
||||
$(KERNEL_CROSS)strip --remove-section=.note --remove-section=.comment $(KDIR)/vmlinux.bcm.elf
|
||||
$(KERNEL_CROSS)objcopy $(OBJCOPY_STRIP) -O binary $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/kernel/linux-3.4rt/vmlinux $(KDIR)/vmlinux.bcm
|
||||
|
||||
# bootloader nor
|
||||
# cp -R $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/cfe/build/broadcom/bcm63xx_rom/bcm9$(CONFIG_BCM_CHIP_ID)_cfe.w $(KDIR)/bcm_bootloader_cfe.w
|
||||
|
||||
# ram part of the bootloader for nand boot
|
||||
if [ -a $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/cfe/build/broadcom/bcm63xx_ram/cfe$(CONFIG_BCM_CHIP_ID).bin ]; then cp -R $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/cfe/build/broadcom/bcm63xx_ram/cfe$(CONFIG_BCM_CHIP_ID).bin $(KDIR)/cferam.001; fi;
|
||||
if [ -a $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/cfe/build/broadcom/bcm63xx_ram/cfe$(CONFIG_BCM_CHIP_ID)ram.bin ]; then cp -R $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/cfe/build/broadcom/bcm63xx_ram/cfe$(CONFIG_BCM_CHIP_ID)ram.bin $(KDIR)/cferam.001; fi;
|
||||
cp -R $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/cfe/build/broadcom/bcm63xx_rom/cfe$(CONFIG_BCM_CHIP_ID)_nand.v $(KDIR)/cfe$(CONFIG_BCM_CHIP_ID)_nand.v
|
||||
cp -R $(PKG_BUILD_DIR)/$(BCM_SDK_VERSION)/targets/cfe/ $(KDIR)/cfe
|
||||
# dd if=$(KDIR)/vmlinux.bcm.elf of=$(KDIR)/vmlinux.bcm bs=4096 count=1
|
||||
# $(KERNEL_CROSS)objcopy $(OBJCOPY_STRIP) -S $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux.elf
|
||||
|
||||
$(call Package/bcmkernel/removevoice,$(1))
|
||||
$(call Package/bcmkernel/removesound,$(1))
|
||||
# $(call Package/bcmkernel/removei2c,$(1))
|
||||
endef
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
menu "Profile and CFE"
|
||||
depends on PACKAGE_bcmkernel
|
||||
|
||||
config BCM_OPEN
|
||||
bool
|
||||
prompt "Build package for Public SDK"
|
||||
default n
|
||||
help
|
||||
Set this to build an package using a release tarball with the proprietary components removed.
|
||||
|
||||
choice
|
||||
prompt "Broadcom SDK version"
|
||||
default BRCM_SDK_VER_416030
|
||||
help
|
||||
Version of the Broadcom SDK to use.
|
||||
|
||||
config BRCM_SDK_VER_414040
|
||||
bool
|
||||
prompt "bcmkernel-4.14L.04"
|
||||
|
||||
config BRCM_SDK_VER_416021
|
||||
bool
|
||||
prompt "bcmkernel-4.16L.02A"
|
||||
|
||||
config BRCM_SDK_VER_416030
|
||||
bool
|
||||
prompt "bcmkernel-4.16L.03"
|
||||
|
||||
config BRCM_SDK_VER_416040
|
||||
bool
|
||||
prompt "bcmkernel-4.16L.04"
|
||||
|
||||
endchoice
|
||||
|
||||
config BCM_KERNEL_PROFILE
|
||||
string
|
||||
prompt "Broadcom kernel profile"
|
||||
default "96368GWV"
|
||||
help
|
||||
Profile to build the broadcom software with, 96368GWV, 963268GWV, 96362GWV, 96816GWV, 96816OV
|
||||
|
||||
config BCM_CFE_PASSWORD
|
||||
string
|
||||
prompt "Broadcom cfe password"
|
||||
default ""
|
||||
|
||||
config BCM_CHIP_ID
|
||||
string
|
||||
prompt "Broadcom chip id"
|
||||
default "6368"
|
||||
help
|
||||
Chip id to build the cfe with, 6328|6362|6368|6816|63268
|
||||
|
||||
config BCM_BLNAND
|
||||
string
|
||||
prompt "Broadcom boot loader nand"
|
||||
default "0"
|
||||
help
|
||||
Set this to 1 to build a boot loader for nand flash
|
||||
|
||||
config BCM_ENDPOINT_MODULE
|
||||
bool
|
||||
prompt "Broadcom endpoint voice FXS support"
|
||||
default y
|
||||
help
|
||||
Set this to include the endpoint module in image
|
||||
|
||||
config BCM_USBSOUND_MODULES
|
||||
bool
|
||||
prompt "Broadcom USB audio support"
|
||||
default n
|
||||
help
|
||||
Set this to include sound support modules in image
|
||||
|
||||
|
||||
config BCM_I2C
|
||||
bool
|
||||
prompt "Broadcom I2C support"
|
||||
default n
|
||||
help
|
||||
Set this to include the i2c modules in image
|
||||
|
||||
config BCM_BLUETOOTH
|
||||
bool
|
||||
prompt "Broadcom Bluetooth support"
|
||||
default n
|
||||
help
|
||||
Set this to include the Bluetooth modules in image
|
||||
|
||||
|
||||
config SECURE_BOOT_CFE
|
||||
prompt "Secure boot CFE"
|
||||
bool
|
||||
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
#
|
||||
# Primary/common bcmkernel makefile for all versions of Broadcom SDKs
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
define Package/bcmkernel
|
||||
SECTION:=net
|
||||
CATEGORY:=Base system
|
||||
TITLE:=Broadcom sdk 3.4 kernel
|
||||
URL:=
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define Package/bcmkernel/description
|
||||
Broadcom kernel and userspace, compiled with the broadcom supplied tool-chain.
|
||||
endef
|
||||
|
||||
define Package/bcmkernel/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
# Include SDK version specific makefile based on config selection
|
||||
ifeq ($(CONFIG_ARCH),)
|
||||
include $(TOPDIR)/.config
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BCM_OPEN),y)
|
||||
PKG_NAME:=bcmopen
|
||||
PKG_VERSION:=consumer
|
||||
PKG_RELEASE:=1
|
||||
|
||||
TARGET_VERSION=$(shell echo $(CONFIG_TARGET_VERSION) | sed s/\"//g)
|
||||
TARGET_IBOARDID=$(shell echo $(CONFIG_TARGET_IBOARDID) | sed s/\"//g)
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).$(TARGET_VERSION).$(TARGET_IBOARDID).tar.gz
|
||||
PKG_SOURCE_URL:=http://ihgsp.inteno.se/ihgsp/consumer/
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BRCM_SDK_VER_414040),y)
|
||||
include ./414040.mk
|
||||
|
||||
else ifeq ($(CONFIG_BRCM_SDK_VER_416021),y)
|
||||
include ./416021.mk
|
||||
|
||||
else ifeq ($(CONFIG_BRCM_SDK_VER_416030),y)
|
||||
include ./416030.mk
|
||||
|
||||
else ifeq ($(CONFIG_BRCM_SDK_VER_416040),y)
|
||||
include ./416040.mk
|
||||
|
||||
else
|
||||
# Make 'make menuconfig' work even though no SDK version specified
|
||||
PKG_VERSION:=none
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
endif
|
||||
|
||||
# hack to be able to compile just the userspace part.
|
||||
# TOPDIR=$PWD make -C package/bcmkernel userspace
|
||||
userspace:
|
||||
$(call Build/Compile/Default, userspace)
|
||||
|
||||
$(eval $(call BuildPackage,bcmkernel))
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
config EXTROOT_SETTLETIME
|
||||
int
|
||||
prompt "Settle time for root block device (s)" if PACKAGE_block-mount
|
||||
default 20
|
||||
help
|
||||
This is the amount of time, in seconds, to wait for the block device
|
||||
the root filesystem is on to become available, after the kernel that
|
||||
modules for the rootfs and device are loaded.
|
||||
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2006-2012 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=block-mount-old
|
||||
PKG_VERSION:=0.2.0
|
||||
PKG_RELEASE:=9
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/block-mount-old/Default
|
||||
SECTION:=base
|
||||
CATEGORY:=Base system
|
||||
endef
|
||||
|
||||
define Package/block-mount-old
|
||||
$(call Package/block-mount-old/Default)
|
||||
TITLE:=Block device mounting and checking
|
||||
DEPENDS:= +blkid +swap-utils
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define Package/block-mount-old/description
|
||||
Scripts used to mount and check block devices (filesystems and swap), as well
|
||||
as hotplug scripts to automount and check block devices when hotplug event (e.g.
|
||||
from plugging in a device) occurs.
|
||||
Also includes preinit scripts for mounting a block device as the root filesystem.
|
||||
This allows one to have the root filesystem on devices other than the built in flash
|
||||
device.
|
||||
endef
|
||||
|
||||
define Package/block-mount-old/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/block-mount-old/conffiles
|
||||
/etc/config/fstab
|
||||
endef
|
||||
|
||||
define Package/block-mount-old/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/fstab.init $(1)/etc/init.d/fstab
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DATA) ./files/fstab.config $(1)/etc/config/fstab
|
||||
$(INSTALL_DIR) $(1)/lib/functions/fsck
|
||||
$(INSTALL_DATA) ./files/mount.sh $(1)/lib/functions/
|
||||
$(INSTALL_DATA) ./files/fsck.sh $(1)/lib/functions/
|
||||
$(INSTALL_DATA) ./files/block.sh $(1)/lib/functions/
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/block
|
||||
$(INSTALL_DATA) ./files/10-swap $(1)/etc/hotplug.d/block/
|
||||
$(INSTALL_DATA) ./files/20-fsck $(1)/etc/hotplug.d/block/
|
||||
$(INSTALL_DATA) ./files/40-mount $(1)/etc/hotplug.d/block/
|
||||
$(INSTALL_DATA) ./files/extmount.sh $(1)/lib/functions/
|
||||
$(INSTALL_DIR) $(1)/lib/preinit
|
||||
$(INSTALL_DATA) ./files/50_determine_usb_root $(1)/lib/preinit/
|
||||
#$(INSTALL_DATA) ./files/55_determine_extroot_sysupgrade $(1)/lib/preinit/
|
||||
#$(INSTALL_DATA) ./files/60_pivot_usb_root $(1)/lib/preinit/
|
||||
echo "extroot_settle_time=\"$(CONFIG_EXTROOT_SETTLETIME)\"" >$(1)/lib/preinit/00_extroot.conf
|
||||
$(INSTALL_DIR) $(1)/overlay
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,block-mount-old))
|
||||
@@ -1,78 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2009-2010 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
. /lib/functions/block.sh
|
||||
|
||||
blkdev=`dirname $DEVPATH`
|
||||
|
||||
if [ `basename $blkdev` != "block" ]; then
|
||||
|
||||
device=`basename $DEVPATH`
|
||||
|
||||
|
||||
case "$ACTION" in
|
||||
add)
|
||||
local autoswap_from_fstab
|
||||
local automount_from_fstab
|
||||
local from_fstab
|
||||
local anon_mount
|
||||
local anon_swap
|
||||
local anon_fsck
|
||||
local mds_mount_device
|
||||
local sds_swap_device
|
||||
local sds_swap_enabled
|
||||
local use_device
|
||||
local do_swap=0
|
||||
|
||||
mount_dev_section_cb() {
|
||||
mds_mount_device="$3"
|
||||
}
|
||||
|
||||
swap_dev_section_cb() {
|
||||
sds_swap_device="$2"
|
||||
sds_swap_enabled="$3"
|
||||
return 0
|
||||
}
|
||||
|
||||
config_get_automount
|
||||
automount_from_fstab="$from_fstab"
|
||||
|
||||
[ "$automount_from_fstab" -eq 1 ] && {
|
||||
config_get_mount_section_by_device "/dev/$device"
|
||||
}
|
||||
|
||||
# skip trying swap if this device is defined as a mount point
|
||||
[ -z "$mds_mount_device" ] && {
|
||||
config_get_autoswap
|
||||
autoswap_from_fstab="$from_fstab"
|
||||
|
||||
[ "$autoswap_from_fstab" -eq 1 ] && {
|
||||
config_get_swap_section_by_device "/dev/$device"
|
||||
use_device="$sds_swap_device"
|
||||
do_swap="$sds_swap_enabled"
|
||||
}
|
||||
|
||||
[ -z "$use_device" ] && [ "$anon_swap" -eq 1 ] && {
|
||||
use_device="/dev/$device" && do_swap=1
|
||||
}
|
||||
}
|
||||
|
||||
[ -n "$use_device" ] && [ "$do_swap" -eq 1 ] && {
|
||||
grep -q "$use_device" /proc/swaps || grep -q "$use_device" /proc/mounts || {
|
||||
swapon "$use_device"
|
||||
}
|
||||
}
|
||||
reset_dev_section_cb
|
||||
;;
|
||||
remove)
|
||||
grep -q "/dev/$device" /proc/swaps && {
|
||||
swapoff "/dev/$device"
|
||||
}
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2009-2010 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
. /lib/functions/block.sh
|
||||
. /lib/functions/fsck.sh
|
||||
|
||||
blkdev=`dirname $DEVPATH`
|
||||
|
||||
if [ `basename $blkdev` != "block" ]; then
|
||||
|
||||
device=`basename $DEVPATH`
|
||||
|
||||
case "$ACTION" in
|
||||
add)
|
||||
local from_fstab
|
||||
local anon_mount
|
||||
local anon_swap
|
||||
local anon_fsck
|
||||
local mds_mount_target
|
||||
local mds_mount_device
|
||||
local mds_mount_fstype
|
||||
local mds_mount_enabled_fsck
|
||||
local sds_swap_device
|
||||
local use_device
|
||||
local do_fsck=0
|
||||
local fsck_type
|
||||
|
||||
local autoswap_from_fstab
|
||||
local automount_from_fstab
|
||||
local hotplug_blkid_fstype_match
|
||||
|
||||
mount_dev_section_cb() {
|
||||
mds_mount_device="$3"
|
||||
mds_mount_fstype="$4"
|
||||
mds_mount_enabled_fsck="$7"
|
||||
}
|
||||
|
||||
swap_dev_section_cb() {
|
||||
sds_swap_device="$2"
|
||||
return 0
|
||||
}
|
||||
|
||||
config_get_automount
|
||||
automount_from_fstab="$from_fstab"
|
||||
|
||||
[ "$automount_from_fstab" -eq 1 ] && {
|
||||
config_get_mount_section_by_device "/dev/$device"
|
||||
use_device="$mds_mount_device"
|
||||
[ "$mds_mount_enabled_fsck" -eq 1 ] && {
|
||||
do_fsck=1
|
||||
fsck_type="$mds_mount_fstype"
|
||||
}
|
||||
}
|
||||
|
||||
[ -z "$use_device" ] && {
|
||||
config_get_autoswap
|
||||
autoswap_from_fstab="$from_fstab"
|
||||
|
||||
[ "$autoswap_from_fstab" -eq 1 ] && {
|
||||
config_get_swap_section_by_device "/dev/$device"
|
||||
use_device="$sds_swap_device" && do_fsck=0
|
||||
}
|
||||
}
|
||||
|
||||
grep -q "/dev/$device" /proc/swaps || grep -q "/dev/$device" /proc/mounts || {
|
||||
[ "$anon_fsck" -eq 1 ] && [ -z "$use_device" ] && {
|
||||
use_device="/dev/$device" && do_fsck=1 && mds_mount_fstype="" && hotplug_blkid_fstype_match=0
|
||||
}
|
||||
}
|
||||
|
||||
[ "$do_fsck" -eq 1 ] && {
|
||||
libmount_fsck "$use_device" "$fsck_type" "$do_fsck"
|
||||
}
|
||||
|
||||
reset_dev_section_cb
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2009-2012 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
. /lib/functions/block.sh
|
||||
|
||||
blkdev=`dirname $DEVPATH`
|
||||
if [ `basename $blkdev` != "block" ]; then
|
||||
|
||||
device=`basename $DEVPATH`
|
||||
mountpoint=`sed -ne "s|^[^ ]*/$device ||; T; s/ .*//p" /proc/self/mounts`
|
||||
|
||||
# Determine mount path
|
||||
usbno=$(echo $DEVPATH | awk -F'/' '{print$7}')
|
||||
case "$usbno" in
|
||||
*:*) usbno=$(echo $DEVPATH | awk -F'/' '{print$6}') ;;
|
||||
esac
|
||||
mnfct="$(cat /sys/bus/usb/devices/$usbno/manufacturer | sed 's/ //g')"
|
||||
prdct="$(cat /sys/bus/usb/devices/$usbno/product | sed 's/ //g')"
|
||||
mnthd="${mnfct:-$prdct}"
|
||||
serial="$(cat /sys/bus/usb/devices/$usbno/serial | sed 's/ //g')"
|
||||
|
||||
case "$ACTION" in
|
||||
add)
|
||||
|
||||
local from_fstab
|
||||
local anon_mount
|
||||
local anon_swap
|
||||
local anon_fsck
|
||||
local mds_mount_target
|
||||
local mds_mount_device
|
||||
local mds_mount_fstype
|
||||
local sds_swap_device
|
||||
local use_device
|
||||
local do_fsck=0
|
||||
local fsck_type
|
||||
|
||||
local autoswap_from_fstab
|
||||
local automount_from_fstab
|
||||
|
||||
mount_dev_section_cb() {
|
||||
mds_mount_target="$2"
|
||||
mds_mount_device="$3"
|
||||
mds_mount_fstype="$4"
|
||||
mds_mount_enabled="$6"
|
||||
}
|
||||
|
||||
swap_dev_section_cb() {
|
||||
sds_swap_device="$2"
|
||||
return 0
|
||||
}
|
||||
|
||||
config_get_automount
|
||||
automount_from_fstab="$from_fstab"
|
||||
[ "$automount_from_fstab" -eq 1 ] && {
|
||||
config_get_mount_section_by_device "/dev/$device"
|
||||
use_device="$mds_mount_device"
|
||||
[ "$mds_mount_enabled" -eq 1 ] && {
|
||||
if [ -n "$mds_mount_target" ]; then
|
||||
grep -q "/dev/$device" /proc/swaps || grep -q "/dev/$device" /proc/mounts || {
|
||||
( mkdir -p "$mds_mount_target" && mount "$mds_mount_target" ) 2>&1 | tee /proc/self/fd/2 | logger -t 'fstab'
|
||||
}
|
||||
else
|
||||
logger -t 'fstab' "Mount enabled for $mds_mount_device but it doesn't have a defined mountpoint (target)"
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
[ -z "$use_device" ] && {
|
||||
config_get_autoswap
|
||||
autoswap_from_fstab="$from_fstab"
|
||||
|
||||
[ "$autoswap_from_fstab" -eq 1 ] && {
|
||||
config_get_swap_section_by_device "/dev/$device"
|
||||
use_device="$sds_swap_device"
|
||||
}
|
||||
}
|
||||
|
||||
grep -q "/dev/$device" /proc/swaps || grep -q "/dev/$device" /proc/mounts || {
|
||||
[ "$anon_mount" -eq 1 -a -z "$use_device" ] && {
|
||||
case "$device" in
|
||||
mtdblock*) ;;
|
||||
*)
|
||||
mntdir="$mnthd$serial"
|
||||
( mkdir -p /mnt/$mntdir && mount /dev/$device /mnt/$mntdir -o umask=0 || ntfs-3g /dev/$device /mnt/$mntdir ) 2>&1 | tee /proc/self/fd/2 | logger -t 'fstab'
|
||||
echo "/dev/$device /mnt/$mntdir" >> /var/usbmounts
|
||||
[ -n "$mntdir" ] && ubus send usb 2>/dev/null
|
||||
;;
|
||||
esac
|
||||
}
|
||||
}
|
||||
reset_dev_section_cb
|
||||
;;
|
||||
remove)
|
||||
umount /dev/$device
|
||||
umount $mountpoint
|
||||
rm -rf $mountpoint
|
||||
sed -i "/$device/ d" /var/usbmounts
|
||||
[ -n "$device" ] && ubus send usb 2>/dev/null
|
||||
;;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
|
||||
|
||||
determine_external_root() {
|
||||
. /lib/functions/extmount.sh
|
||||
. /lib/functions/mount.sh
|
||||
|
||||
local OLD_UCI_CONFIG_DIR="$UCI_CONFIG_DIR"
|
||||
local OLD_PATH="$PATH"
|
||||
local OLD_LD_LIBRARY_PATH="$LD_LIBRARY_PATH"
|
||||
set_jffs_mp
|
||||
determine_root_device
|
||||
|
||||
# extroot requires extroot and fstab config files, therefore
|
||||
# we assume configuration is incomplete and not to be used if either of them
|
||||
# is missing (for jffs versions of these files on squashfs image)
|
||||
if [ "$jffs" = "/tmp/overlay" ] && [ -r "/tmp/overlay/etc/config/fstab" ]; then
|
||||
UCI_CONFIG_DIR="/tmp/overlay/etc/config"
|
||||
ER_IS_SQUASHFS=true
|
||||
ER_OVERLAY_PREFIX="/tmp/overlay"
|
||||
PATH=$ER_OVERLAY_PREFIX/sbin:$PATH
|
||||
LD_LIBRARY_PATH=$ER_OVERLAY_PREFIX/usr/lib:$LD_LIBRARY_PATH
|
||||
export PATH LD_LIBRARY_PATH
|
||||
fi
|
||||
|
||||
# For squashfs on firstboot root_device will be tmpfs for the ramoverlay,
|
||||
# unless there is a saved config, in which case it will be /dev/root,
|
||||
# however in the case of a saved config, it won't be restored until after
|
||||
# this script, so there won't be a config on the first boot after
|
||||
# flashing a squashfs-based filesystem
|
||||
# For ext2, ramdisk, or jffs2 root filesystems root_device is /dev/root
|
||||
# For squashfs after firstboot, root filesystem is /dev/root
|
||||
# We only use the config from the root or jffs if the root_device is
|
||||
# /dev/root
|
||||
[ "$root_device" = "/dev/root" ] && {
|
||||
er_load_modules
|
||||
[ -n "$extroot_settle_time" ] && [ "$extroot_settle_time" -gt 0 ] && {
|
||||
sleep $extroot_settle_time
|
||||
}
|
||||
config_load fstab
|
||||
config_foreach config_mount_by_section mount 1
|
||||
ER_OVERLAY_ROM="/no-extroot"
|
||||
|
||||
[ "$rootfs_found" = "1" ] && grep -q ' /overlay ' /proc/mounts && {
|
||||
pi_extroot_mount_success=true
|
||||
pi_mount_skip_next=false
|
||||
ER_OVERLAY_ROM="/overlay"
|
||||
}
|
||||
[ "$rootfs_found" = "1" ] && grep -q ' /rom ' /proc/mounts && {
|
||||
pi_extroot_mount_success=true
|
||||
pi_mount_skip_next=false
|
||||
ER_OVERLAY_ROM="/rom"
|
||||
}
|
||||
}
|
||||
UCI_CONFIG_DIR="$OLD_UCI_CONFIG_DIR"
|
||||
PATH="$OLD_PATH"
|
||||
LD_LIBRARY_PATH="$OLD_LD_LIBRARY_PATH"
|
||||
export PATH LD_LIBRARY_PATH
|
||||
}
|
||||
|
||||
boot_hook_add preinit_mount_root determine_external_root
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2010 Daniel Dickinson
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
|
||||
|
||||
check_set_md5sum() {
|
||||
local er_md5sum_file
|
||||
er_md5sum_file="${ER_OVERLAY_PREFIX}/.extroot.md5sum"
|
||||
local er_disabled
|
||||
if [ "${ER_OVERLAY_ROM}" = "/rom" ]; then
|
||||
er_disabled=/tmp/whole_root-disabled
|
||||
else
|
||||
er_disabled=/tmp${ER_OVERLAY_ROM}-disabled
|
||||
fi
|
||||
|
||||
local er_extroot_md5sum
|
||||
if [ -f $md5sum_file ]; then
|
||||
er_extroot_md5sum="$(cat $er_md5sum_file)"
|
||||
fi
|
||||
|
||||
local er_overlay_file="${ER_OVERLAY_ROM}/etc/extroot.md5sum"
|
||||
|
||||
local er_extroot_overlay_md5sum
|
||||
if [ -f "$er_overlay_file" ]; then
|
||||
er_extroot_overlay_md5sum="$(cat $er_overlay_file)"
|
||||
fi
|
||||
|
||||
if [ -z "$er_extroot_overlay_md5sum" ]; then
|
||||
cat $er_md5sum_file >$er_overlay_file
|
||||
elif [ "$er_extroot_overlay_md5sum" != "$er_extroot_md5sum" ]; then
|
||||
pi_extroot_mount_success="false"
|
||||
mkdir -p $er_disabled
|
||||
mount --move ${ER_OVERLAY_ROM} $er_disabled
|
||||
fi
|
||||
}
|
||||
|
||||
set_jffs_md5sum() {
|
||||
# We do this anytime block-extroot exists, even on the first boot with
|
||||
# no extroot defined.
|
||||
|
||||
local er_md5sum_file
|
||||
er_md5sum_file="${ER_OVERLAY_PREFIX}/.extroot.md5sum"
|
||||
|
||||
local er_extroot_md5sum
|
||||
if [ -f $er_md5sum_file ]; then
|
||||
er_extroot_md5sum="$(cat $er_md5sum_file)"
|
||||
fi
|
||||
if [ -z "$er_extroot_md5sum" ]; then
|
||||
dd if=/dev/urandom count=32 bs=1k 2>/dev/null | md5sum | cut -f1 -d\ >$er_md5sum_file
|
||||
fi
|
||||
}
|
||||
|
||||
determine_extroot_sysupgrade() {
|
||||
check_skip || set_jffs_md5sum
|
||||
|
||||
check_skip || [ "$pi_extroot_mount_success" != "true" ] || {
|
||||
check_set_md5sum
|
||||
}
|
||||
}
|
||||
|
||||
boot_hook_add preinit_mount_root determine_extroot_sysupgrade
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
|
||||
# Determine if we are requested to mount external root
|
||||
|
||||
external_root_pivot() {
|
||||
check_skip || [ "$pi_extroot_mount_success" != "true" ] || {
|
||||
echo "switching to external rootfs"
|
||||
if [ "$ER_OVERLAY_ROM" = "/overlay" ]; then
|
||||
if [ "$ER_IS_SQUASHFS" = "true" ]; then
|
||||
umount /tmp/overlay
|
||||
fi
|
||||
mount -o remount,ro / && fopivot /overlay /rom && pi_mount_skip_next=true
|
||||
elif [ "$ER_OVERLAY_ROM" = "/rom" ]; then
|
||||
if [ "$ER_IS_SQUASHFS" = "true" ]; then
|
||||
umount /tmp/overlay
|
||||
fi
|
||||
mount -o remount,ro / && pivot_rom /rom /rom && pi_mount_skip_next=true
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
boot_hook_add preinit_mount_root external_root_pivot
|
||||
|
||||
@@ -1,264 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Copyright 2010 Vertical Communications
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
reset_block_cb() {
|
||||
mount_cb() {
|
||||
dmc_mount_cfg="$1"
|
||||
shift # skip optional param
|
||||
dmc_target="$2"
|
||||
dmc_mount_device="$3"
|
||||
dmc_fstype="$4"
|
||||
dmc_options="$5"
|
||||
dmc_enabled="$6"
|
||||
dmc_enabled_fsck="$7"
|
||||
dmc_uuid="$8"
|
||||
dmc_label="$9"
|
||||
shift
|
||||
dmc_is_rootfs="$9"
|
||||
return 0
|
||||
}
|
||||
swap_cb() {
|
||||
dsc_swap_cfg="$1"
|
||||
shift # skip optional param
|
||||
dsc_swap_device="$2"
|
||||
dsc_enabled="$3"
|
||||
dsc_uuid="$4"
|
||||
dsc_label="$5"
|
||||
return 0
|
||||
}
|
||||
}
|
||||
reset_block_cb
|
||||
|
||||
reset_dev_section_cb() {
|
||||
mount_dev_section_cb() {
|
||||
dmds_mount_cfg="$1"
|
||||
dmds_mount_target="$2"
|
||||
dmds_mount_device="$3"
|
||||
dmds_mount_fstype="$4"
|
||||
dmds_mount_options="$5"
|
||||
dmds_mount_enabled="$6"
|
||||
dmds_mount_enabled_fsck="$7"
|
||||
dmds_mount_uuid="$8"
|
||||
dmds_mount_label="$9"
|
||||
shift
|
||||
dmds_is_rootfs="$9"
|
||||
return 0
|
||||
}
|
||||
swap_dev_section_cb() {
|
||||
dsds_swap_cfg="$1"
|
||||
dsds_swap_device="$2"
|
||||
dsds_swap_enabled="$3"
|
||||
dsds_swap_uuid="$4"
|
||||
dsds_swap_label="$5"
|
||||
return 0
|
||||
}
|
||||
}
|
||||
reset_dev_section_cb
|
||||
|
||||
config_get_mount() {
|
||||
local gm_cfg="$1"
|
||||
local gm_param="$2"
|
||||
local gm_target
|
||||
local gm_device
|
||||
local gm_fstype
|
||||
local gm_options
|
||||
local gm_enabled
|
||||
local gm_enabled_fsck
|
||||
local gm_uuid
|
||||
local gm_label
|
||||
local gm_is_rootfs
|
||||
config_get gm_target "$1" target
|
||||
config_get gm_device "$1" device
|
||||
config_get gm_fstype "$1" fstype 'auto'
|
||||
config_get gm_options "$1" options 'rw'
|
||||
config_get_bool gm_enabled "$1" enabled 1
|
||||
config_get_bool gm_enabled_fsck "$1" enabled_fsck 0
|
||||
config_get gm_uuid "$1" uuid
|
||||
config_get gm_label "$1" label
|
||||
config_get_bool gm_is_rootfs "$1" is_rootfs 0
|
||||
mount_cb "$gm_cfg" "$gm_param" "$gm_target" "$gm_device" "$gm_fstype" "$gm_options" "$gm_enabled" "$gm_enabled_fsck" "$gm_uuid" "$gm_label" "$gm_is_rootfs"
|
||||
}
|
||||
|
||||
config_get_swap() {
|
||||
local gs_cfg="$1"
|
||||
local gs_param="$2"
|
||||
local gs_device
|
||||
local gs_enabled
|
||||
local gs_uuid
|
||||
local gs_label
|
||||
config_get gs_device "$1" device
|
||||
config_get_bool gs_enabled "$1" enabled 1
|
||||
config_get gs_uuid "$1" uuid
|
||||
config_get gs_label "$1" label
|
||||
|
||||
swap_cb "$gs_cfg" "$gs_param" "$gs_device" "$gs_enabled" "$gs_uuid" "$gs_label"
|
||||
}
|
||||
|
||||
config_get_automount() {
|
||||
config_load fstab
|
||||
config_get_bool from_fstab "automount" from_fstab 1
|
||||
config_get_bool anon_mount "automount" anon_mount 1
|
||||
config_get_bool anon_fsck "automount" anon_fsck 0
|
||||
}
|
||||
|
||||
config_get_autoswap() {
|
||||
config_load fstab
|
||||
config_get_bool from_fstab "autoswap" from_fstab 1
|
||||
config_get_bool anon_swap "autoswap" anon_swap 0
|
||||
}
|
||||
|
||||
config_create_swap_fstab_entry() {
|
||||
local device="$1"
|
||||
local enabled="$2"
|
||||
|
||||
[ -n "$device" ] || return 0
|
||||
|
||||
local fstabnew
|
||||
|
||||
mkdir -p /var/lock
|
||||
lock /var/lock/fstab.lck
|
||||
fstabnew="$(mktemp -t '.fstab.XXXXXXXX')"
|
||||
cat /tmp/fstab | grep -E -v "^$device[[:blank:]]" >>"$fstabnew"
|
||||
[ "$enabled" -eq 1 ] && echo "$device none swap sw 0 0" >> "$fstabnew"
|
||||
cat "$fstabnew" >/tmp/fstab
|
||||
rm -f $fstabnew
|
||||
lock -u /var/lock/fstab.lck
|
||||
}
|
||||
|
||||
config_create_mount_fstab_entry() {
|
||||
local device="$1"
|
||||
local target="$2"
|
||||
local fstype="$3"
|
||||
local options="$4"
|
||||
local enabled="$5"
|
||||
options="${options:-rw}"
|
||||
[ "$enabled" -eq 0 ] && options="noauto,$options"
|
||||
[ -n "$target" ] || return 0
|
||||
[ -n "$device" ] || return 0
|
||||
|
||||
local fstabnew
|
||||
|
||||
mkdir -p /var/lock
|
||||
lock /var/lock/fstab.lck
|
||||
fstabnew="$(mktemp -t '.fstab.XXXXXXXX')"
|
||||
cat /tmp/fstab | grep -E -v "^$device[[:blank:]]" | grep -v "$target" >>"$fstabnew"
|
||||
echo "$device $target $fstype $options 0 0" >>"$fstabnew"
|
||||
cat "$fstabnew" >/tmp/fstab
|
||||
rm -f $fstabnew
|
||||
lock -u /var/lock/fstab.lck
|
||||
}
|
||||
|
||||
libmount_find_token() {
|
||||
local token="$1"
|
||||
local value="$2"
|
||||
local device
|
||||
device="$(blkid -w /dev/null -c /dev/null | grep "$token=\"$value\"" | cut -f1 -d:)"
|
||||
echo "$device"
|
||||
}
|
||||
|
||||
libmount_find_device_by_id() {
|
||||
local uuid="$1"
|
||||
local label="$2"
|
||||
local device="$3"
|
||||
local cfg_device="$4"
|
||||
local found_device
|
||||
|
||||
if [ -n "$uuid" ]; then
|
||||
found_device="$(libmount_find_token "UUID" "$uuid")"
|
||||
elif [ -n "$label" ]; then
|
||||
found_device="$(libmount_find_token "LABEL" "$label")"
|
||||
elif [ "$device" = "$cfg_device" ]; then
|
||||
found_device="$device"
|
||||
elif [ -z "$device" ] && [ -e "$cfg_device" ]; then
|
||||
found_device="$cfg_device"
|
||||
fi
|
||||
[ -n "$device" ] && [ "$device" != "$found_device" ] && {
|
||||
found_device=""
|
||||
}
|
||||
echo "$found_device"
|
||||
}
|
||||
|
||||
config_get_mount_section_by_device() {
|
||||
local msbd_device="$1"
|
||||
local msbd_mount_cfg=
|
||||
local msbd_target=
|
||||
local msbd_mount_device=
|
||||
local msbd_fstype=
|
||||
local msbd_options=
|
||||
local msbd_enabled=
|
||||
local msbd_enabled_fsck=
|
||||
local msbd_uuid=
|
||||
local msbd_label=
|
||||
local msbd_is_rootfs
|
||||
local msbd_blkid_fstype_match=
|
||||
mount_cb() {
|
||||
local mc_cfg="$1"
|
||||
local mc_device="$2"
|
||||
shift
|
||||
local mc_target="$2"
|
||||
local mc_cfgdevice="$3"
|
||||
local mc_fstype="$4"
|
||||
local mc_uuid="$8"
|
||||
local mc_label="$9"
|
||||
shift
|
||||
local mc_is_rootfs="$9"
|
||||
local mc_found_device=""
|
||||
|
||||
mc_found_device="$(libmount_find_device_by_id "$mc_uuid" "$mc_label" "$mc_device" "$mc_cfgdevice")"
|
||||
if [ -n "$mc_found_device" ]; then
|
||||
msbd_mount_cfg="$mc_cfg"
|
||||
msbd_target="$mc_target"
|
||||
msbd_mount_device="$mc_found_device"
|
||||
msbd_fstype="$mc_fstype"
|
||||
msbd_options="$4"
|
||||
msbd_enabled="$5"
|
||||
msbd_enabled_fsck="$6"
|
||||
msbd_uuid="$7"
|
||||
msbd_label="$8"
|
||||
msbd_is_rootfs="$9"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
config_foreach config_get_mount mount "$msbd_device"
|
||||
[ -n "$msbd_mount_device" ] && config_create_mount_fstab_entry "$msbd_mount_device" "$msbd_target" "$msbd_fstype" "$msbd_options" "$msbd_enabled"
|
||||
mount_dev_section_cb "$msbd_mount_cfg" "$msbd_target" "$msbd_mount_device" "$msbd_fstype" "$msbd_options" "$msbd_enabled" "$msbd_enabled_fsck" "$msbd_uuid" "$msbd_label" "$msbd_is_rootfs"
|
||||
reset_block_cb
|
||||
}
|
||||
|
||||
config_get_swap_section_by_device() {
|
||||
local ssbd_device="$1"
|
||||
local ssbd_swap_cfg=
|
||||
local ssbd_swap_device=
|
||||
local ssbd_enabled=
|
||||
local ssbd_uuid=
|
||||
local ssbd_label=
|
||||
swap_cb() {
|
||||
local sc_cfg="$1"
|
||||
local sc_device="$2"
|
||||
local sc_uuid="$5"
|
||||
local sc_label="$6"
|
||||
local sc_cfgdevice="$3"
|
||||
local sc_found_device
|
||||
|
||||
sc_found_device="$(libmount_find_device_by_id "$sc_uuid" "$sc_label" "$sc_device" "$sc_cfgdevice")"
|
||||
if [ -n "$sc_found_device" ]; then
|
||||
ssbd_swap_cfg="$sc_cfg"
|
||||
ssbd_swap_device="$sc_found_device"
|
||||
ssbd_enabled="$4"
|
||||
ssbd_uuid="$5"
|
||||
ssbd_label="$6"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
config_foreach config_get_swap swap "$ssbd_device"
|
||||
[ -n "$ssbd_swap_device" ] && config_create_swap_fstab_entry "$ssbd_swap_device" "$ssbd_enabled"
|
||||
swap_dev_section_cb "$ssbd_swap_cfg" "$ssbd_swap_device" "$ssbd_enabled" "$ssbd_uuid" "$ssbd_label"
|
||||
reset_block_cb
|
||||
}
|
||||
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2006-2011 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
|
||||
determine_root_device() {
|
||||
root_device="$(mount | grep ' / ' | cut -f1 -d\ | grep -v rootfs )"
|
||||
}
|
||||
|
||||
set_jffs_mp() {
|
||||
jffs="$(awk '/jffs2/ {print $2}' /proc/mounts)"
|
||||
}
|
||||
|
||||
er_load_modules() {
|
||||
mkdir -p /tmp/extroot_modules/modules.d
|
||||
mkdir -p /tmp/extroot_modules/modules
|
||||
cp -L /etc/modules-boot.d/* /tmp/overlay/etc/modules-boot.d/* /tmp/extroot_modules/modules.d
|
||||
ln -sf /lib/modules/*/* /tmp/overlay/lib/modules/*/* /tmp/extroot_modules/modules
|
||||
local modules="$(cat /tmp/extroot_modules/modules.d/* 2>/dev/null)"
|
||||
cd /tmp/extroot_modules/modules && [ -n "$modules" ] && {
|
||||
echo "$modules" | sed -e 's/^\([^#].*\)/insmod \.\/\1.ko/'| sh 2>&- || :
|
||||
}
|
||||
rm -rf /tmp/extroot_modules
|
||||
}
|
||||
|
||||
pivot_rom() { # <new_root> <old_root>
|
||||
mount -o move /proc $1/proc && \
|
||||
pivot_root $1 $1$2 && {
|
||||
mount -o move $2/dev /dev
|
||||
mount -o move $2/tmp /tmp
|
||||
mount -o move $2/sys /sys 2>&-
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Copyright 2010 Vertical Communications
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
libmount_fsck() {
|
||||
local device="$1"
|
||||
local fsck_fstype="$2"
|
||||
local fsck_enabled="$3"
|
||||
local known_type
|
||||
local found_fsck=0
|
||||
|
||||
|
||||
grep -q "$device" /proc/swaps || grep -q "$device" /proc/mounts || {
|
||||
[ -e "$device" ] && [ "$fsck_enabled" -eq 1 ] && {
|
||||
for known_type in $libmount_known_fsck; do
|
||||
if [ "$known_type" = "$fsck_fstype" ]; then
|
||||
fsck_${known_type} "$device"
|
||||
found_fsck=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ "$found_fsck" -ne 1 ]; then
|
||||
logger -t 'fstab' "Unable to check/repair $device; no known fsck for filesystem type $fstype"
|
||||
fi
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
libmount_known_fsck=""
|
||||
|
||||
include /lib/functions/fsck
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
config global automount
|
||||
option from_fstab 0
|
||||
option anon_mount 1
|
||||
|
||||
config global autoswap
|
||||
option from_fstab 0
|
||||
option anon_swap 0
|
||||
|
||||
config mount
|
||||
option target /mnt
|
||||
option device /dev/sda1
|
||||
option fstype ext4
|
||||
option options rw,sync
|
||||
option enabled 0
|
||||
option enabled_fsck 0
|
||||
|
||||
config swap
|
||||
option device /dev/sda2
|
||||
option enabled 0
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2007 OpenWrt.org
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
|
||||
START=20
|
||||
|
||||
EXTRA_COMMANDS="overlay_enable whole_root_enable"
|
||||
EXTRA_HELP=" overlay_enable Reenable overlay rootfs. (After you fix it).
|
||||
whole_root_enable Reenable whole-disk rootfs. (After you fix it)."
|
||||
|
||||
rootfs_enable() {
|
||||
local extroot_type="$1"
|
||||
|
||||
if [ ! -d /tmp/${extroot_type}-disabled ]; then
|
||||
echo "No disabled ${extroot_type} present (/tmp/${extroot_type}-disabled). Can't renable."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -f /tmp/${extroot_type}-disabled/.extroot.md5sum
|
||||
rm -f /tmp/${extroot_type}-disabled/etc/extroot.md5sum
|
||||
echo "Please reboot router to complete re-enabling external rootfs."
|
||||
}
|
||||
|
||||
overlay_enable() {
|
||||
rootfs_enable overlay
|
||||
}
|
||||
|
||||
whole_root_enable() {
|
||||
rootfs_enable whole_root
|
||||
}
|
||||
|
||||
do_mount() {
|
||||
local cfg="$1"
|
||||
config_mount_by_section "$cfg"
|
||||
}
|
||||
|
||||
do_swapon() {
|
||||
local cfg="$1"
|
||||
config_swapon_by_section "$cfg"
|
||||
}
|
||||
|
||||
do_unmount() {
|
||||
local cfg="$1"
|
||||
|
||||
config_get target "$cfg" target
|
||||
config_get_bool enabled "$cfg" "enabled" '1'
|
||||
[ -n "$target" -a "$enabled" -gt 0 ] || return 0
|
||||
umount $target
|
||||
}
|
||||
|
||||
do_swapoff() {
|
||||
local cfg="$1"
|
||||
|
||||
config_get device "$cfg" device
|
||||
config_get_bool enabled "$cfg" "enabled" '1'
|
||||
[ -n "$device" -a "$enabled" -gt 0 ] && type swapoff >/dev/null || return 0
|
||||
swapoff $device
|
||||
}
|
||||
|
||||
start() {
|
||||
. /lib/functions/mount.sh
|
||||
|
||||
config_load fstab
|
||||
mkdir -p /var/lock
|
||||
lock /var/lock/fstab.lck
|
||||
[ -e /tmp/fstab ] || {
|
||||
echo '# WARNING: this is an auto generated file, please use uci to set defined filesystems' > /tmp/fstab
|
||||
}
|
||||
lock -u /var/lock/fstab.lck
|
||||
config_foreach do_swapon swap
|
||||
config_foreach do_mount mount
|
||||
config_foreach do_swapon swap # do swap a second time so that swap on filesystems is enabled
|
||||
}
|
||||
|
||||
stop() {
|
||||
. /lib/functions/mount.sh
|
||||
|
||||
config_load fstab
|
||||
config_foreach do_unmount mount
|
||||
config_foreach do_swapoff swap
|
||||
swapoff -a
|
||||
}
|
||||
|
||||
|
||||
@@ -1,103 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Copyright 2010 Vertical Communications
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
|
||||
. /lib/functions/block.sh
|
||||
. /lib/functions/fsck.sh
|
||||
|
||||
config_mount_by_section() {
|
||||
local cfg="$1"
|
||||
local find_rootfs="$2"
|
||||
|
||||
mount_cb() {
|
||||
local cfg="$1"
|
||||
local device="$2"
|
||||
shift
|
||||
local target="$2"
|
||||
local cfgdevice="$3"
|
||||
local fstype="$4"
|
||||
local options="$5"
|
||||
local enabled="$6"
|
||||
local enabled_fsck="$7"
|
||||
local uuid="$8"
|
||||
local label="$9"
|
||||
shift
|
||||
local is_rootfs="$9"
|
||||
shift
|
||||
local found_device=""
|
||||
|
||||
found_device="$(libmount_find_device_by_id "$uuid" "$label" "$device" "$cfgdevice")"
|
||||
if [ -n "$found_device" ]; then
|
||||
if [ "$find_rootfs" != "1" ] || ( [ "$is_rootfs" -eq 1 ] || [ "$target" = "/" ] || [ "$target" = "/overlay" ] ); then
|
||||
[ "$enabled_fsck" -eq 1 ] && {
|
||||
grep -q "$found_device" /proc/swaps || grep -q "$found_device" /proc/mounts || {
|
||||
libmount_fsck "$found_device" "$fstype" "$enabled_fsck"
|
||||
}
|
||||
}
|
||||
|
||||
if [ "$find_rootfs" = "1" ]; then
|
||||
if [ "$is_rootfs" -eq 1 ]; then
|
||||
target=/overlay
|
||||
elif [ "$target" = "/" ]; then
|
||||
target=/rom
|
||||
fi
|
||||
else
|
||||
if [ "$is_rootfs" -eq 1 ] || [ "$target" = "/overlay" ]; then
|
||||
target=/tmp/overlay-disabled
|
||||
elif [ "$target" = "/" ] || [ "$target" = "/rom" ]; then
|
||||
target="/tmp/whole_root-disabled"
|
||||
fi
|
||||
fi
|
||||
|
||||
config_create_mount_fstab_entry "$found_device" "$target" "$fstype" "$options" "$enabled"
|
||||
grep -q "$found_device" /proc/swaps || grep -q "$found_device" /proc/mounts || {
|
||||
[ "$enabled" -eq 1 ] && mkdir -p "$target" && mount "$target" 2>&1 | tee /proc/self/fd/2 | logger -t 'fstab'
|
||||
}
|
||||
|
||||
fi
|
||||
fi
|
||||
[ "$find_rootfs" = "1" ] && {
|
||||
[ "$target" = "/overlay" ] && {
|
||||
rootfs_found=1
|
||||
}
|
||||
[ "$target" = "/rom" ] && {
|
||||
rootfs_found=1
|
||||
}
|
||||
}
|
||||
return 0
|
||||
}
|
||||
config_get_mount "$cfg"
|
||||
reset_block_cb
|
||||
}
|
||||
|
||||
config_swapon_by_section() {
|
||||
local cfg="$1"
|
||||
|
||||
swap_cb() {
|
||||
local cfg="$1"
|
||||
local device="$2"
|
||||
local cfgdevice="$3"
|
||||
local enabled="$4"
|
||||
local uuid="$5"
|
||||
local label="$6"
|
||||
local uuid
|
||||
local label
|
||||
|
||||
local found_device=""
|
||||
|
||||
found_device="$(libmount_find_device_by_id "$uuid" "$label" "$device" "$cfgdevice")"
|
||||
|
||||
if [ -n "$found_device" ]; then
|
||||
config_create_swap_fstab_entry "$found_device" "$enabled"
|
||||
grep -q "$found_device" /proc/swaps || grep -q "$found_device" /proc/mounts || {
|
||||
[ "$enabled" -eq 1 ] && swapon "$found_device" | tee /proc/self/fd/2 | logger -t 'fstab'
|
||||
}
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
config_get_swap "$cfg"
|
||||
reset_block_cb
|
||||
}
|
||||
43
bootchart2/Makefile
Normal file
43
bootchart2/Makefile
Normal file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
# Copyright (C) 2007-2011 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bootchart2
|
||||
PKG_VERSION:=0.14.7
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/mmeeks/bootchart.git
|
||||
PKG_SOURCE_VERSION:=3ab81137cafe25c2ca4bc3a5f322a63646f9ce8d
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/bootchart2
|
||||
SECTION:=base
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Bootchart2
|
||||
URL:=https://github.com/mmeeks/bootchart
|
||||
endef
|
||||
|
||||
define Package/bootchart2/description
|
||||
Bootchart is a tool for performance analysis and visualization of the GNU/Linux boot process.
|
||||
endef
|
||||
|
||||
define Package/bootchart2/install
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bootchart-collector $(1)/sbin
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
|
||||
|
||||
|
||||
$(eval $(call BuildPackage,bootchart2))
|
||||
10
bootchart2/files/lib/preinit/11_bootchart
Normal file
10
bootchart2/files/lib/preinit/11_bootchart
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
do_bootchart()
|
||||
{
|
||||
[ -f /dev/null ] || mknod /dev/null c 1 3
|
||||
mkdir -p /lib/bootchart/tmpfs
|
||||
echo "starting bootchart"
|
||||
/sbin/bootchart_run_preinit boot &
|
||||
}
|
||||
|
||||
boot_hook_add preinit_essential do_bootchart
|
||||
7
bootchart2/files/lib/preinit/72_bootchart
Normal file
7
bootchart2/files/lib/preinit/72_bootchart
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
bootchart_rootfs_pivot()
|
||||
{
|
||||
mount -o move /rom/lib/bootchart/tmpfs /lib/bootchart/tmpfs
|
||||
}
|
||||
|
||||
boot_hook_add preinit_mount_root bootchart_rootfs_pivot
|
||||
59
bootchart2/files/sbin/bootchart_run_preinit
Executable file
59
bootchart2/files/sbin/bootchart_run_preinit
Executable file
@@ -0,0 +1,59 @@
|
||||
#! /bin/sh
|
||||
# this is intended to be started in preinit.
|
||||
# 11_bootchart, starts it
|
||||
# 72_bootchart, fixup mount point after pivot
|
||||
#
|
||||
# program can be killed early with
|
||||
# bootchart_run_preinit stop
|
||||
|
||||
trap "stop; exit 0;" SIGINT SIGTERM
|
||||
|
||||
STOP_AFTER=250
|
||||
HZ=50
|
||||
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo "you need to specify start or stop"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
start()
|
||||
{
|
||||
/sbin/bootchart-collector $HZ &
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
echo "bootchart DUMP"
|
||||
|
||||
mkdir /tmp/bootchart
|
||||
/sbin/bootchart-collector --dump /tmp/bootchart
|
||||
cd /tmp/bootchart
|
||||
tar -zcf /tmp/bootchart.tgz header *.log
|
||||
cd /
|
||||
rm -rf /tmp/bootchart
|
||||
}
|
||||
|
||||
case $1 in
|
||||
boot) # secret option for preinit
|
||||
start
|
||||
sleep $STOP_AFTER
|
||||
# test to see if someone has manually killed us
|
||||
if [ -f /tmp/bootchart.tgz ]
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
stop
|
||||
;;
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
*)
|
||||
echo "you need to specify start or stop, not $1"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
40
bootchart2/patches/0001-add_spu_sys_time.patch
Normal file
40
bootchart2/patches/0001-add_spu_sys_time.patch
Normal file
@@ -0,0 +1,40 @@
|
||||
diff --git a/pybootchartgui/draw.py b/pybootchartgui/draw.py
|
||||
index 7c3f60c..5c9f046 100644
|
||||
--- a/pybootchartgui/draw.py
|
||||
+++ b/pybootchartgui/draw.py
|
||||
@@ -63,6 +63,7 @@ AXIS_FONT_SIZE = 11
|
||||
LEGEND_FONT_SIZE = 12
|
||||
|
||||
# CPU load chart color.
|
||||
+CPU_SYS_COLOR = (0.65, 0.13, 0.36, 1.0)
|
||||
CPU_COLOR = (0.40, 0.55, 0.70, 1.0)
|
||||
# IO wait chart color.
|
||||
IO_COLOR = (0.76, 0.48, 0.48, 0.5)
|
||||
@@ -300,21 +301,19 @@ def render_charts(ctx, options, clip, trace, curr_y, w, h, sec_w):
|
||||
# render bar legend
|
||||
ctx.set_font_size(LEGEND_FONT_SIZE)
|
||||
|
||||
- draw_legend_box(ctx, "CPU (user+sys)", CPU_COLOR, off_x, curr_y+20, leg_s)
|
||||
- draw_legend_box(ctx, "I/O (wait)", IO_COLOR, off_x + 120, curr_y+20, leg_s)
|
||||
+ draw_legend_box(ctx, "CPU (user)", CPU_COLOR, off_x, curr_y+20, leg_s)
|
||||
+ draw_legend_box(ctx, "CPU (sys)", CPU_SYS_COLOR, off_x + 120, curr_y+20, leg_s)
|
||||
+ draw_legend_box(ctx, "I/O (wait)", IO_COLOR, off_x + 120 + 120 , curr_y+20, leg_s)
|
||||
|
||||
# render I/O wait
|
||||
chart_rect = (off_x, curr_y+30, w, bar_h)
|
||||
if clip_visible (clip, chart_rect):
|
||||
draw_box_ticks (ctx, chart_rect, sec_w)
|
||||
draw_annotations (ctx, proc_tree, trace.times, chart_rect)
|
||||
- draw_chart (ctx, IO_COLOR, True, chart_rect, \
|
||||
- [(sample.time, sample.user + sample.sys + sample.io) for sample in trace.cpu_stats], \
|
||||
- proc_tree, None)
|
||||
+ draw_chart (ctx, IO_COLOR, True, chart_rect, [(sample.time, sample.user + sample.sys + sample.io) for sample in trace.cpu_stats], proc_tree, None)
|
||||
# render CPU load
|
||||
- draw_chart (ctx, CPU_COLOR, True, chart_rect, \
|
||||
- [(sample.time, sample.user + sample.sys) for sample in trace.cpu_stats], \
|
||||
- proc_tree, None)
|
||||
+ draw_chart (ctx, CPU_SYS_COLOR, True, chart_rect, [(sample.time, sample.user + sample.sys) for sample in trace.cpu_stats], proc_tree, None)
|
||||
+ draw_chart (ctx, CPU_COLOR, True, chart_rect, [(sample.time, sample.user ) for sample in trace.cpu_stats], proc_tree, None)
|
||||
|
||||
curr_y = curr_y + 30 + bar_h
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2006-2008 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=brcm-h
|
||||
PKG_VERSION:=1
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=git@iopsys.inteno.se:brcm-h
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=HEAD
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/image.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
|
||||
|
||||
define Package/brcm-h
|
||||
SECTION:=net
|
||||
CATEGORY:=Base system
|
||||
TITLE:=Broadcom header files
|
||||
URL:=
|
||||
endef
|
||||
|
||||
define Package/brcm-h/description
|
||||
Broadcom header files
|
||||
endef
|
||||
|
||||
|
||||
define Package/brcm--h/install
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/brcm
|
||||
$(CP) -r $(PACKAGE_BUILD_DIR)/bcm963xx/bcmdrivers/broadcom/include/bcm963xx/* $(STAGING_DIR)/usr/include/brcm \
|
||||
$(CP) -r $(PACKAGE_BUILD_DIR)/bcm963xx/bcmdrivers/opensource/include/bcm963xx/* $(STAGING_DIR)/usr/include/brcm \
|
||||
$(CP) -r $(PACKAGE_BUILD_DIR)/bcm963xx/xChange/dslx_common/voice_res_gw/endpt/inc/* $(STAGING_DIR)/usr/include/brcm \
|
||||
$(CP) -r $(PACKAGE_BUILD_DIR)/bcm963xx/xChange/dslx_common/voice_res_gw/inc/* $(STAGING_DIR)/usr/include/brcm \
|
||||
$(CP) -r $(PACKAGE_BUILD_DIR)/bcm963xx/xChange/dslx_common/voice_res_gw/codec/* $(STAGING_DIR)/usr/include/brcm \
|
||||
$(CP) -r $(PACKAGE_BUILD_DIR)/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/* $(STAGING_DIR)/usr/include/brcm \
|
||||
$(CP) -r $(PACKAGE_BUILD_DIR)/bcm963xx/xChange/dslx_common/voice_res_gw/casCtl/inc/* $(STAGING_DIR)/usr/include/brcm \
|
||||
$(CP) -r $(PACKAGE_BUILD_DIR)/bcm963xx/xChange/dslx_common/xchg_drivers/inc/* $(STAGING_DIR)/usr/include/brcm \
|
||||
|
||||
endef
|
||||
|
||||
|
||||
|
||||
|
||||
$(eval $(call BuildPackage,brcm-h))
|
||||
@@ -1,53 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2006-2009 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
export BUILD_DIR
|
||||
|
||||
PKG_NAME:=brcm_fw_tool
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_BUILD_DIR := $(KERNEL_BUILD_DIR)/$(PKG_NAME)
|
||||
STAMP_PREPARED := $(STAMP_PREPARED)_$(call confvar,CONFIG_MTD_REDBOOT_PARTS)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/brcm_fw_tool
|
||||
SECTION:=utils
|
||||
CATEGORY:=Base system
|
||||
TITLE:=Update utility for Broadcom nand firmware images
|
||||
DEPENDS:=bcmkernel
|
||||
endef
|
||||
|
||||
define Package/brcm_fw_tool/description
|
||||
This package contains an utility useful to upgrade from other firmware or
|
||||
older OpenWrt releases.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
$(CP) ./src/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
target=$(firstword $(subst -, ,$(BOARD)))
|
||||
|
||||
MAKE_FLAGS += TARGET="$(target)"
|
||||
TARGET_CFLAGS += -Dtarget_$(target)=1 -Wall
|
||||
|
||||
ifdef CONFIG_MTD_REDBOOT_PARTS
|
||||
MAKE_FLAGS += FIS_SUPPORT=1
|
||||
TARGET_CFLAGS += -DFIS_SUPPORT=1
|
||||
endif
|
||||
|
||||
define Package/brcm_fw_tool/install
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/brcm_fw_tool $(1)/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,brcm_fw_tool))
|
||||
@@ -1,16 +0,0 @@
|
||||
CC = gcc
|
||||
CFLAGS += -Wall
|
||||
|
||||
CFLAGS += -I$(STAGING_DIR)/usr/include/bcm963xx/shared/opensource/include/bcm963xx/
|
||||
CFLAGS += -I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx/
|
||||
|
||||
|
||||
%.o: %.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
obj = brcm_fw_tool.o jffs2.o crc32.o
|
||||
obj.brcm47xx = $(obj.brcm)
|
||||
|
||||
brcm_fw_tool: $(obj) $(obj.$(TARGET))
|
||||
clean:
|
||||
rm -f *.o jffs2
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,11 +0,0 @@
|
||||
#ifndef __mtd_h
|
||||
#define __mtd_h
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#define JFFS2_EOF "\xde\xad\xc0\xde"
|
||||
|
||||
extern int quiet;
|
||||
extern int mtd_replace_jffs2(const char *mtd, int fd, int ofs, const char *filename, int nand_erasesize);
|
||||
|
||||
#endif /* __mtd_h */
|
||||
@@ -1,95 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or
|
||||
* code or tables extracted from it, as desired without restriction.
|
||||
*
|
||||
* First, the polynomial itself and its table of feedback terms. The
|
||||
* polynomial is
|
||||
* X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0
|
||||
*
|
||||
* Note that we take it "backwards" and put the highest-order term in
|
||||
* the lowest-order bit. The X^32 term is "implied"; the LSB is the
|
||||
* X^31 term, etc. The X^0 term (usually shown as "+1") results in
|
||||
* the MSB being 1
|
||||
*
|
||||
* Note that the usual hardware shift register implementation, which
|
||||
* is what we're using (we're merely optimizing it by doing eight-bit
|
||||
* chunks at a time) shifts bits into the lowest-order term. In our
|
||||
* implementation, that means shifting towards the right. Why do we
|
||||
* do it this way? Because the calculated CRC must be transmitted in
|
||||
* order from highest-order term to lowest-order term. UARTs transmit
|
||||
* characters in order from LSB to MSB. By storing the CRC this way
|
||||
* we hand it to the UART in the order low-byte to high-byte; the UART
|
||||
* sends each low-bit to hight-bit; and the result is transmission bit
|
||||
* by bit from highest- to lowest-order term without requiring any bit
|
||||
* shuffling on our part. Reception works similarly
|
||||
*
|
||||
* The feedback terms table consists of 256, 32-bit entries. Notes
|
||||
*
|
||||
* The table can be generated at runtime if desired; code to do so
|
||||
* is shown later. It might not be obvious, but the feedback
|
||||
* terms simply represent the results of eight shift/xor opera
|
||||
* tions for all combinations of data and CRC register values
|
||||
*
|
||||
* The values must be right-shifted by eight bits by the "updcrc
|
||||
* logic; the shift must be unsigned (bring in zeroes). On some
|
||||
* hardware you could probably optimize the shift in assembler by
|
||||
* using byte-swap instructions
|
||||
* polynomial $edb88320
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
const uint32_t crc32_table[256] = {
|
||||
0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
|
||||
0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
|
||||
0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
|
||||
0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
|
||||
0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
|
||||
0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
|
||||
0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
|
||||
0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
|
||||
0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
|
||||
0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
|
||||
0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
|
||||
0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
|
||||
0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
|
||||
0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
|
||||
0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
|
||||
0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
|
||||
0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
|
||||
0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
|
||||
0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
|
||||
0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
|
||||
0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
|
||||
0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
|
||||
0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
|
||||
0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
|
||||
0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
|
||||
0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
|
||||
0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
|
||||
0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
|
||||
0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
|
||||
0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
|
||||
0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
|
||||
0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
|
||||
0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
|
||||
0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
|
||||
0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
|
||||
0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
|
||||
0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
|
||||
0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
|
||||
0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
|
||||
0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
|
||||
0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
|
||||
0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
|
||||
0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
|
||||
0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
|
||||
0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
|
||||
0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
|
||||
0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
|
||||
0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
|
||||
0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
|
||||
0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
|
||||
0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
|
||||
0x2d02ef8dL
|
||||
};
|
||||
@@ -1,26 +0,0 @@
|
||||
#ifndef CRC32_H
|
||||
#define CRC32_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
extern const uint32_t crc32_table[256];
|
||||
|
||||
/* Return a 32-bit CRC of the contents of the buffer. */
|
||||
|
||||
static inline uint32_t
|
||||
crc32(uint32_t val, const void *ss, int len)
|
||||
{
|
||||
const unsigned char *s = ss;
|
||||
while (--len >= 0)
|
||||
val = crc32_table[(val ^ *s++) & 0xff] ^ (val >> 8);
|
||||
return val;
|
||||
}
|
||||
|
||||
static inline unsigned int crc32buf(char *buf, size_t len)
|
||||
{
|
||||
return crc32(0xFFFFFFFF, buf, len);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,350 +0,0 @@
|
||||
/*
|
||||
* jffs2 on-disk structure generator for mtd
|
||||
*
|
||||
* Copyright (C) 2008 Felix Fietkau <nbd@openwrt.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* Based on:
|
||||
* JFFS2 -- Journalling Flash File System, Version 2.
|
||||
* Copyright © 2001-2007 Red Hat, Inc.
|
||||
* Created by David Woodhouse <dwmw2@infradead.org>
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
#include <endian.h>
|
||||
#include "jffs2.h"
|
||||
#include "crc32.h"
|
||||
#include "brcm_fw_tool.h"
|
||||
|
||||
#define PAD(x) (((x)+3)&~3)
|
||||
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
# define CLEANMARKER "\x19\x85\x20\x03\x00\x00\x00\x0c\xf0\x60\xdc\x98"
|
||||
#else
|
||||
# define CLEANMARKER "\x85\x19\x03\x20\x0c\x00\x00\x00\xb1\xb0\x1e\xe4"
|
||||
#endif
|
||||
|
||||
static int last_ino = 0;
|
||||
static int last_version = 0;
|
||||
static char *buf = NULL;
|
||||
static int ofs = 0;
|
||||
static int outfd = -1;
|
||||
static int mtdofs = 0;
|
||||
static int target_ino = 0;
|
||||
static int erasesize = 128*1024;
|
||||
|
||||
static void prep_eraseblock(void);
|
||||
|
||||
static void pad(int size)
|
||||
{
|
||||
if ((ofs % size == 0) && (ofs < erasesize))
|
||||
return;
|
||||
|
||||
if (ofs < erasesize) {
|
||||
memset(buf + ofs, 0xff, (size - (ofs % size)));
|
||||
ofs += (size - (ofs % size));
|
||||
}
|
||||
ofs = ofs % erasesize;
|
||||
if (ofs == 0) {
|
||||
write(outfd, buf, erasesize);
|
||||
mtdofs += erasesize;
|
||||
}
|
||||
}
|
||||
|
||||
static inline int rbytes(void)
|
||||
{
|
||||
return erasesize - (ofs % erasesize);
|
||||
}
|
||||
|
||||
static inline void add_data(char *ptr, int len)
|
||||
{
|
||||
if (ofs + len > erasesize) {
|
||||
pad(erasesize);
|
||||
prep_eraseblock();
|
||||
}
|
||||
memcpy(buf + ofs, ptr, len);
|
||||
ofs += len;
|
||||
}
|
||||
|
||||
static void prep_eraseblock(void)
|
||||
{
|
||||
if (ofs > 0)
|
||||
return;
|
||||
|
||||
add_data(CLEANMARKER, sizeof(CLEANMARKER) - 1);
|
||||
}
|
||||
|
||||
static int add_dirent(const char *name, const char type, int parent)
|
||||
{
|
||||
struct jffs2_raw_dirent *de;
|
||||
|
||||
if (ofs - erasesize < sizeof(struct jffs2_raw_dirent) + strlen(name))
|
||||
pad(erasesize);
|
||||
|
||||
prep_eraseblock();
|
||||
last_ino++;
|
||||
memset(buf + ofs, 0, sizeof(struct jffs2_raw_dirent));
|
||||
de = (struct jffs2_raw_dirent *) (buf + ofs);
|
||||
|
||||
de->magic = JFFS2_MAGIC_BITMASK;
|
||||
de->nodetype = JFFS2_NODETYPE_DIRENT;
|
||||
de->type = type;
|
||||
de->name_crc = crc32(0, name, strlen(name));
|
||||
de->ino = last_ino++;
|
||||
de->pino = parent;
|
||||
de->totlen = sizeof(*de) + strlen(name);
|
||||
de->hdr_crc = crc32(0, (void *) de, sizeof(struct jffs2_unknown_node) - 4);
|
||||
de->version = last_version++;
|
||||
de->mctime = 0;
|
||||
de->nsize = strlen(name);
|
||||
de->node_crc = crc32(0, (void *) de, sizeof(*de) - 8);
|
||||
memcpy(de->name, name, strlen(name));
|
||||
|
||||
ofs += sizeof(struct jffs2_raw_dirent) + de->nsize;
|
||||
pad(4);
|
||||
|
||||
return de->ino;
|
||||
}
|
||||
|
||||
static int add_dir(const char *name, int parent)
|
||||
{
|
||||
struct jffs2_raw_inode ri;
|
||||
int inode;
|
||||
|
||||
inode = add_dirent(name, IFTODT(S_IFDIR), parent);
|
||||
|
||||
if (rbytes() < sizeof(ri))
|
||||
pad(erasesize);
|
||||
prep_eraseblock();
|
||||
|
||||
memset(&ri, 0, sizeof(ri));
|
||||
ri.magic = JFFS2_MAGIC_BITMASK;
|
||||
ri.nodetype = JFFS2_NODETYPE_INODE;
|
||||
ri.totlen = sizeof(ri);
|
||||
ri.hdr_crc = crc32(0, &ri, sizeof(struct jffs2_unknown_node) - 4);
|
||||
|
||||
ri.ino = inode;
|
||||
ri.mode = S_IFDIR | 0755;
|
||||
ri.uid = ri.gid = 0;
|
||||
ri.atime = ri.ctime = ri.mtime = 0;
|
||||
ri.isize = ri.csize = ri.dsize = 0;
|
||||
ri.version = 1;
|
||||
ri.node_crc = crc32(0, &ri, sizeof(ri) - 8);
|
||||
ri.data_crc = 0;
|
||||
|
||||
add_data((char *) &ri, sizeof(ri));
|
||||
pad(4);
|
||||
return inode;
|
||||
}
|
||||
|
||||
static void add_file(const char *name, int parent)
|
||||
{
|
||||
int inode, f_offset = 0, fd;
|
||||
struct jffs2_raw_inode ri;
|
||||
struct stat st;
|
||||
char wbuf[4096];
|
||||
const char *fname;
|
||||
|
||||
if (stat(name, &st)) {
|
||||
fprintf(stderr, "File %s does not exist\n", name);
|
||||
return;
|
||||
}
|
||||
|
||||
fname = strrchr(name, '/');
|
||||
if (fname)
|
||||
fname++;
|
||||
else
|
||||
fname = name;
|
||||
|
||||
inode = add_dirent(fname, IFTODT(S_IFREG), parent);
|
||||
memset(&ri, 0, sizeof(ri));
|
||||
ri.magic = JFFS2_MAGIC_BITMASK;
|
||||
ri.nodetype = JFFS2_NODETYPE_INODE;
|
||||
|
||||
ri.ino = inode;
|
||||
ri.mode = st.st_mode;
|
||||
ri.uid = ri.gid = 0;
|
||||
ri.atime = st.st_atime;
|
||||
ri.ctime = st.st_ctime;
|
||||
ri.mtime = st.st_mtime;
|
||||
ri.isize = st.st_size;
|
||||
ri.compr = 0;
|
||||
ri.usercompr = 0;
|
||||
|
||||
fd = open(name, 0);
|
||||
if (fd < 0) {
|
||||
fprintf(stderr, "File %s does not exist\n", name);
|
||||
return;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
int len = 0;
|
||||
|
||||
for (;;) {
|
||||
len = rbytes() - sizeof(ri);
|
||||
if (len > 128)
|
||||
break;
|
||||
|
||||
pad(erasesize);
|
||||
prep_eraseblock();
|
||||
}
|
||||
|
||||
if (len > sizeof(wbuf))
|
||||
len = sizeof(wbuf);
|
||||
|
||||
len = read(fd, wbuf, len);
|
||||
if (len <= 0)
|
||||
break;
|
||||
|
||||
ri.totlen = sizeof(ri) + len;
|
||||
ri.hdr_crc = crc32(0, &ri, sizeof(struct jffs2_unknown_node) - 4);
|
||||
ri.version = ++last_version;
|
||||
ri.offset = f_offset;
|
||||
ri.csize = ri.dsize = len;
|
||||
ri.node_crc = crc32(0, &ri, sizeof(ri) - 8);
|
||||
ri.data_crc = crc32(0, wbuf, len);
|
||||
f_offset += len;
|
||||
add_data((char *) &ri, sizeof(ri));
|
||||
add_data(wbuf, len);
|
||||
pad(4);
|
||||
prep_eraseblock();
|
||||
}
|
||||
|
||||
close(fd);
|
||||
}
|
||||
|
||||
int mtd_replace_jffs2(const char *mtd, int fd, int ofs, const char *filename, int nand_erasesize)
|
||||
{
|
||||
outfd = fd;
|
||||
mtdofs = ofs;
|
||||
erasesize = nand_erasesize;
|
||||
|
||||
buf = malloc(erasesize);
|
||||
target_ino = 1;
|
||||
if (!last_ino)
|
||||
last_ino = 1;
|
||||
add_file(filename, target_ino);
|
||||
pad(erasesize);
|
||||
|
||||
/* add eof marker, pad to eraseblock size and write the data */
|
||||
add_data(JFFS2_EOF, sizeof(JFFS2_EOF) - 1);
|
||||
pad(erasesize);
|
||||
free(buf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mtd_parse_jffs2data(const char *buf, const char *dir)
|
||||
{
|
||||
struct jffs2_unknown_node *node = (struct jffs2_unknown_node *) buf;
|
||||
unsigned int ofs = 0;
|
||||
|
||||
while (ofs < erasesize) {
|
||||
node = (struct jffs2_unknown_node *) (buf + ofs);
|
||||
if (node->magic != 0x1985)
|
||||
break;
|
||||
|
||||
ofs += PAD(node->totlen);
|
||||
if (node->nodetype == JFFS2_NODETYPE_DIRENT) {
|
||||
struct jffs2_raw_dirent *de = (struct jffs2_raw_dirent *) node;
|
||||
|
||||
/* is this the right directory name and is it a subdirectory of / */
|
||||
if (*dir && (de->pino == 1) && !strncmp((char *) de->name, dir, de->nsize))
|
||||
target_ino = de->ino;
|
||||
|
||||
/* store the last inode and version numbers for adding extra files */
|
||||
if (last_ino < de->ino)
|
||||
last_ino = de->ino;
|
||||
if (last_version < de->version)
|
||||
last_version = de->version;
|
||||
}
|
||||
}
|
||||
}
|
||||
int quiet = 0;
|
||||
int mtd_write_jffs2(const char *mtd, const char *filename, const char *dir)
|
||||
{
|
||||
int err = -1, fdeof = 0;
|
||||
|
||||
if (quiet < 2)
|
||||
fprintf(stderr, "Appending %s to jffs2 partition %s\n", filename, mtd);
|
||||
|
||||
buf = malloc(erasesize);
|
||||
if (!buf) {
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (!*dir)
|
||||
target_ino = 1;
|
||||
|
||||
/* parse the structure of the jffs2 first
|
||||
* locate the directory that the file is going to be placed in */
|
||||
for(;;) {
|
||||
struct jffs2_unknown_node *node = (struct jffs2_unknown_node *) buf;
|
||||
|
||||
if (read(outfd, buf, erasesize) != erasesize) {
|
||||
fdeof = 1;
|
||||
break;
|
||||
}
|
||||
mtdofs += erasesize;
|
||||
|
||||
if (node->magic == 0x8519) {
|
||||
fprintf(stderr, "Error: wrong endianness filesystem\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* assume no magic == end of filesystem
|
||||
* the filesystem will probably end with be32(0xdeadc0de) */
|
||||
if (node->magic != 0x1985)
|
||||
break;
|
||||
|
||||
mtd_parse_jffs2data(buf, dir);
|
||||
}
|
||||
|
||||
if (fdeof) {
|
||||
fprintf(stderr, "Error: No room for additional data\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* jump back one eraseblock */
|
||||
mtdofs -= erasesize;
|
||||
lseek(outfd, mtdofs, SEEK_SET);
|
||||
|
||||
ofs = 0;
|
||||
|
||||
if (!last_ino)
|
||||
last_ino = 1;
|
||||
|
||||
if (!target_ino)
|
||||
target_ino = add_dir(dir, 1);
|
||||
|
||||
add_file(filename, target_ino);
|
||||
pad(erasesize);
|
||||
|
||||
/* add eof marker, pad to eraseblock size and write the data */
|
||||
add_data(JFFS2_EOF, sizeof(JFFS2_EOF) - 1);
|
||||
pad(erasesize);
|
||||
|
||||
err = 0;
|
||||
|
||||
done:
|
||||
close(outfd);
|
||||
if (buf)
|
||||
free(buf);
|
||||
|
||||
return err;
|
||||
}
|
||||
@@ -1,216 +0,0 @@
|
||||
/*
|
||||
* JFFS2 -- Journalling Flash File System, Version 2.
|
||||
*
|
||||
* Copyright (C) 2001-2003 Red Hat, Inc.
|
||||
*
|
||||
* Created by David Woodhouse <dwmw2@infradead.org>
|
||||
*
|
||||
* For licensing information, see the file 'LICENCE' in the
|
||||
* jffs2 directory.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_JFFS2_H__
|
||||
#define __LINUX_JFFS2_H__
|
||||
|
||||
#define JFFS2_SUPER_MAGIC 0x72b6
|
||||
|
||||
/* You must include something which defines the C99 uintXX_t types.
|
||||
We don't do it from here because this file is used in too many
|
||||
different environments. */
|
||||
|
||||
/* Values we may expect to find in the 'magic' field */
|
||||
#define JFFS2_OLD_MAGIC_BITMASK 0x1984
|
||||
#define JFFS2_MAGIC_BITMASK 0x1985
|
||||
#define KSAMTIB_CIGAM_2SFFJ 0x8519 /* For detecting wrong-endian fs */
|
||||
#define JFFS2_EMPTY_BITMASK 0xffff
|
||||
#define JFFS2_DIRTY_BITMASK 0x0000
|
||||
|
||||
/* Summary node MAGIC marker */
|
||||
#define JFFS2_SUM_MAGIC 0x02851885
|
||||
|
||||
/* We only allow a single char for length, and 0xFF is empty flash so
|
||||
we don't want it confused with a real length. Hence max 254.
|
||||
*/
|
||||
#define JFFS2_MAX_NAME_LEN 254
|
||||
|
||||
/* How small can we sensibly write nodes? */
|
||||
#define JFFS2_MIN_DATA_LEN 128
|
||||
|
||||
#define JFFS2_COMPR_NONE 0x00
|
||||
#define JFFS2_COMPR_ZERO 0x01
|
||||
#define JFFS2_COMPR_RTIME 0x02
|
||||
#define JFFS2_COMPR_RUBINMIPS 0x03
|
||||
#define JFFS2_COMPR_COPY 0x04
|
||||
#define JFFS2_COMPR_DYNRUBIN 0x05
|
||||
#define JFFS2_COMPR_ZLIB 0x06
|
||||
/* Compatibility flags. */
|
||||
#define JFFS2_COMPAT_MASK 0xc000 /* What do to if an unknown nodetype is found */
|
||||
#define JFFS2_NODE_ACCURATE 0x2000
|
||||
/* INCOMPAT: Fail to mount the filesystem */
|
||||
#define JFFS2_FEATURE_INCOMPAT 0xc000
|
||||
/* ROCOMPAT: Mount read-only */
|
||||
#define JFFS2_FEATURE_ROCOMPAT 0x8000
|
||||
/* RWCOMPAT_COPY: Mount read/write, and copy the node when it's GC'd */
|
||||
#define JFFS2_FEATURE_RWCOMPAT_COPY 0x4000
|
||||
/* RWCOMPAT_DELETE: Mount read/write, and delete the node when it's GC'd */
|
||||
#define JFFS2_FEATURE_RWCOMPAT_DELETE 0x0000
|
||||
|
||||
#define JFFS2_NODETYPE_DIRENT (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 1)
|
||||
#define JFFS2_NODETYPE_INODE (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 2)
|
||||
#define JFFS2_NODETYPE_CLEANMARKER (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 3)
|
||||
#define JFFS2_NODETYPE_PADDING (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 4)
|
||||
|
||||
#define JFFS2_NODETYPE_SUMMARY (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 6)
|
||||
|
||||
#define JFFS2_NODETYPE_XATTR (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 8)
|
||||
#define JFFS2_NODETYPE_XREF (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 9)
|
||||
|
||||
/* XATTR Related */
|
||||
#define JFFS2_XPREFIX_USER 1 /* for "user." */
|
||||
#define JFFS2_XPREFIX_SECURITY 2 /* for "security." */
|
||||
#define JFFS2_XPREFIX_ACL_ACCESS 3 /* for "system.posix_acl_access" */
|
||||
#define JFFS2_XPREFIX_ACL_DEFAULT 4 /* for "system.posix_acl_default" */
|
||||
#define JFFS2_XPREFIX_TRUSTED 5 /* for "trusted.*" */
|
||||
|
||||
#define JFFS2_ACL_VERSION 0x0001
|
||||
|
||||
// Maybe later...
|
||||
//#define JFFS2_NODETYPE_CHECKPOINT (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 3)
|
||||
//#define JFFS2_NODETYPE_OPTIONS (JFFS2_FEATURE_RWCOMPAT_COPY | JFFS2_NODE_ACCURATE | 4)
|
||||
|
||||
|
||||
#define JFFS2_INO_FLAG_PREREAD 1 /* Do read_inode() for this one at
|
||||
mount time, don't wait for it to
|
||||
happen later */
|
||||
#define JFFS2_INO_FLAG_USERCOMPR 2 /* User has requested a specific
|
||||
compression type */
|
||||
|
||||
|
||||
/* These can go once we've made sure we've caught all uses without
|
||||
byteswapping */
|
||||
|
||||
typedef uint32_t jint32_t;
|
||||
|
||||
typedef uint32_t jmode_t;
|
||||
|
||||
typedef uint16_t jint16_t;
|
||||
|
||||
struct jffs2_unknown_node
|
||||
{
|
||||
/* All start like this */
|
||||
jint16_t magic;
|
||||
jint16_t nodetype;
|
||||
jint32_t totlen; /* So we can skip over nodes we don't grok */
|
||||
jint32_t hdr_crc;
|
||||
};
|
||||
|
||||
struct jffs2_raw_dirent
|
||||
{
|
||||
jint16_t magic;
|
||||
jint16_t nodetype; /* == JFFS2_NODETYPE_DIRENT */
|
||||
jint32_t totlen;
|
||||
jint32_t hdr_crc;
|
||||
jint32_t pino;
|
||||
jint32_t version;
|
||||
jint32_t ino; /* == zero for unlink */
|
||||
jint32_t mctime;
|
||||
uint8_t nsize;
|
||||
uint8_t type;
|
||||
uint8_t unused[2];
|
||||
jint32_t node_crc;
|
||||
jint32_t name_crc;
|
||||
uint8_t name[0];
|
||||
};
|
||||
|
||||
/* The JFFS2 raw inode structure: Used for storage on physical media. */
|
||||
/* The uid, gid, atime, mtime and ctime members could be longer, but
|
||||
are left like this for space efficiency. If and when people decide
|
||||
they really need them extended, it's simple enough to add support for
|
||||
a new type of raw node.
|
||||
*/
|
||||
struct jffs2_raw_inode
|
||||
{
|
||||
jint16_t magic; /* A constant magic number. */
|
||||
jint16_t nodetype; /* == JFFS2_NODETYPE_INODE */
|
||||
jint32_t totlen; /* Total length of this node (inc data, etc.) */
|
||||
jint32_t hdr_crc;
|
||||
jint32_t ino; /* Inode number. */
|
||||
jint32_t version; /* Version number. */
|
||||
jmode_t mode; /* The file's type or mode. */
|
||||
jint16_t uid; /* The file's owner. */
|
||||
jint16_t gid; /* The file's group. */
|
||||
jint32_t isize; /* Total resultant size of this inode (used for truncations) */
|
||||
jint32_t atime; /* Last access time. */
|
||||
jint32_t mtime; /* Last modification time. */
|
||||
jint32_t ctime; /* Change time. */
|
||||
jint32_t offset; /* Where to begin to write. */
|
||||
jint32_t csize; /* (Compressed) data size */
|
||||
jint32_t dsize; /* Size of the node's data. (after decompression) */
|
||||
uint8_t compr; /* Compression algorithm used */
|
||||
uint8_t usercompr; /* Compression algorithm requested by the user */
|
||||
jint16_t flags; /* See JFFS2_INO_FLAG_* */
|
||||
jint32_t data_crc; /* CRC for the (compressed) data. */
|
||||
jint32_t node_crc; /* CRC for the raw inode (excluding data) */
|
||||
uint8_t data[0];
|
||||
};
|
||||
|
||||
struct jffs2_raw_xattr {
|
||||
jint16_t magic;
|
||||
jint16_t nodetype; /* = JFFS2_NODETYPE_XATTR */
|
||||
jint32_t totlen;
|
||||
jint32_t hdr_crc;
|
||||
jint32_t xid; /* XATTR identifier number */
|
||||
jint32_t version;
|
||||
uint8_t xprefix;
|
||||
uint8_t name_len;
|
||||
jint16_t value_len;
|
||||
jint32_t data_crc;
|
||||
jint32_t node_crc;
|
||||
uint8_t data[0];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct jffs2_raw_xref
|
||||
{
|
||||
jint16_t magic;
|
||||
jint16_t nodetype; /* = JFFS2_NODETYPE_XREF */
|
||||
jint32_t totlen;
|
||||
jint32_t hdr_crc;
|
||||
jint32_t ino; /* inode number */
|
||||
jint32_t xid; /* XATTR identifier number */
|
||||
jint32_t xseqno; /* xref sequencial number */
|
||||
jint32_t node_crc;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct jffs2_raw_summary
|
||||
{
|
||||
jint16_t magic;
|
||||
jint16_t nodetype; /* = JFFS2_NODETYPE_SUMMARY */
|
||||
jint32_t totlen;
|
||||
jint32_t hdr_crc;
|
||||
jint32_t sum_num; /* number of sum entries*/
|
||||
jint32_t cln_mkr; /* clean marker size, 0 = no cleanmarker */
|
||||
jint32_t padded; /* sum of the size of padding nodes */
|
||||
jint32_t sum_crc; /* summary information crc */
|
||||
jint32_t node_crc; /* node crc */
|
||||
jint32_t sum[0]; /* inode summary info */
|
||||
};
|
||||
|
||||
union jffs2_node_union
|
||||
{
|
||||
struct jffs2_raw_inode i;
|
||||
struct jffs2_raw_dirent d;
|
||||
struct jffs2_raw_xattr x;
|
||||
struct jffs2_raw_xref r;
|
||||
struct jffs2_raw_summary s;
|
||||
struct jffs2_unknown_node u;
|
||||
};
|
||||
|
||||
/* Data payload for device nodes. */
|
||||
union jffs2_device_node {
|
||||
jint16_t old;
|
||||
jint32_t new;
|
||||
};
|
||||
|
||||
#endif /* __LINUX_JFFS2_H__ */
|
||||
@@ -1,58 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=brcminfo
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||
STAMP_PREPARED := $(STAMP_PREPARED)_$(call confvar,CONFIG_MTD_REDBOOT_PARTS)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/brcminfo
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Broadcom voice driver info utility
|
||||
URL:=
|
||||
DEPENDS:= bcmkernel
|
||||
endef
|
||||
|
||||
define Package/brcminfo/description
|
||||
Utility that prints information regarding voice configuration
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
$(CP) ./src/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
target=$(firstword $(subst -, ,$(BOARD)))
|
||||
|
||||
MAKE_FLAGS += TARGET="$(target)"
|
||||
|
||||
|
||||
EXTRA_CFLAGS += -DBOS_OS_LINUXUSER
|
||||
|
||||
EXTRA_CFLAGS += -I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/broadcom/include/bcm963xx/
|
||||
EXTRA_CFLAGS += -I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx/
|
||||
EXTRA_CFLAGS += -I$(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/endpt/inc/
|
||||
EXTRA_CFLAGS += -I$(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc
|
||||
EXTRA_CFLAGS += -I$(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/codec
|
||||
EXTRA_CFLAGS += -I$(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc/
|
||||
EXTRA_CFLAGS += -I$(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/casCtl/inc/
|
||||
EXTRA_CFLAGS += -I$(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_drivers/inc
|
||||
|
||||
TARGET_CFLAGS += -D$(CONFIG_TARGET_IBOARDID) -Dtarget_$(target)=1 -Wall
|
||||
|
||||
define Package/brcminfo/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
cp $(PKG_BUILD_DIR)/brcminfo $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,brcminfo))
|
||||
@@ -1,15 +0,0 @@
|
||||
# Makefile for brcminfo utility
|
||||
|
||||
%.o: %.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
OBJS = brcminfo.o
|
||||
all: main
|
||||
|
||||
dynamic: all
|
||||
|
||||
main: brcminfo.o
|
||||
$(CC) $(LDFLAGS) $(EXTRA_CFLAGS) -o brcminfo brcminfo.o -lm
|
||||
|
||||
clean:
|
||||
rm -f brcminfo ${OBJS}
|
||||
@@ -1,92 +0,0 @@
|
||||
/*
|
||||
* brcminfo.c
|
||||
* Minor utility that will attempt to read the number of available
|
||||
* endpoints from the brcm voice driver
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include <endpointdrv.h>
|
||||
|
||||
static int endpoint_fd = -1;
|
||||
static int num_fxs_endpoints = -1;
|
||||
static int num_fxo_endpoints = -1;
|
||||
static int num_dect_endpoints = -1;
|
||||
static int num_endpoints = -1;
|
||||
|
||||
int vrgEndptDriverOpen(void)
|
||||
{
|
||||
endpoint_fd = open("/dev/bcmendpoint0", O_RDWR);
|
||||
if (endpoint_fd == -1) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int vrgEndptDriverClose(void)
|
||||
{
|
||||
int result = close(endpoint_fd);
|
||||
endpoint_fd = -1;
|
||||
return result;
|
||||
}
|
||||
|
||||
static int brcm_get_endpoints_count(void)
|
||||
{
|
||||
ENDPOINTDRV_ENDPOINTCOUNT_PARM endpointCount;
|
||||
endpointCount.size = sizeof(ENDPOINTDRV_ENDPOINTCOUNT_PARM);
|
||||
|
||||
if ( ioctl( endpoint_fd, ENDPOINTIOCTL_FXSENDPOINTCOUNT, &endpointCount ) != IOCTL_STATUS_SUCCESS ) {
|
||||
return -1;
|
||||
} else {
|
||||
num_fxs_endpoints = endpointCount.endpointNum;
|
||||
}
|
||||
|
||||
if ( ioctl( endpoint_fd, ENDPOINTIOCTL_FXOENDPOINTCOUNT, &endpointCount ) != IOCTL_STATUS_SUCCESS ) {
|
||||
return -1;
|
||||
} else {
|
||||
num_fxo_endpoints = endpointCount.endpointNum;
|
||||
}
|
||||
|
||||
if ( ioctl( endpoint_fd, ENDPOINTIOCTL_DECTENDPOINTCOUNT, &endpointCount ) != IOCTL_STATUS_SUCCESS ) {
|
||||
return -1;
|
||||
} else {
|
||||
num_dect_endpoints = endpointCount.endpointNum;
|
||||
}
|
||||
|
||||
num_endpoints = num_fxs_endpoints + num_fxo_endpoints + num_dect_endpoints;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int result;
|
||||
|
||||
result = vrgEndptDriverOpen();
|
||||
if (result != 0) {
|
||||
printf("Could not open endpoint driver\n");
|
||||
return result;
|
||||
}
|
||||
|
||||
result = brcm_get_endpoints_count();
|
||||
if (result == 0) {
|
||||
printf("DECT Endpoints:\t%d\n", num_dect_endpoints);
|
||||
printf("FXS Endpoints:\t%d\n", num_fxs_endpoints);
|
||||
printf("FXO Endpoints:\t%d\n", num_fxo_endpoints);
|
||||
printf("All Endpoints:\t%d\n", num_endpoints);
|
||||
}
|
||||
else {
|
||||
printf("Endpoint counting failed, maybe driver is not initialized?\n");
|
||||
}
|
||||
|
||||
result = vrgEndptDriverClose();
|
||||
if (result != 0) {
|
||||
printf("Could not close endpoint driver\n");
|
||||
return result;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2006-2012 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=bridge-utils
|
||||
PKG_RELEASE:=1
|
||||
PKG_SOURCE_URL:=@SF/bridge
|
||||
PKG_VERSION:=1.5
|
||||
PKG_MD5SUM:=ec7b381160b340648dede58c31bb2238
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/bridge
|
||||
SECTION:=net
|
||||
CATEGORY:=Base system
|
||||
TITLE:=Ethernet bridging configuration utility
|
||||
URL:=http://bridge.sourceforge.net/
|
||||
endef
|
||||
|
||||
define Package/bridge/description
|
||||
Manage ethernet bridging: a way to connect networks together to
|
||||
form a larger network.
|
||||
endef
|
||||
|
||||
CONFIGURE_ARGS += \
|
||||
--with-linux-headers="$(LINUX_DIR)" \
|
||||
|
||||
define Build/Prepare
|
||||
$(call Build/Prepare/Default)
|
||||
( cd $(PKG_BUILD_DIR) ; \
|
||||
[ -f ./configure ] || { \
|
||||
ln -sf configure.in configure.ac ; \
|
||||
autoconf ; \
|
||||
} \
|
||||
)
|
||||
endef
|
||||
|
||||
define Package/bridge/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/brctl/brctl $(1)/usr/sbin
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,bridge))
|
||||
@@ -1,11 +0,0 @@
|
||||
--- a/libbridge/Makefile.in
|
||||
+++ b/libbridge/Makefile.in
|
||||
@@ -5,7 +5,7 @@ AR=ar
|
||||
RANLIB=@RANLIB@
|
||||
|
||||
CC=@CC@
|
||||
-CFLAGS = -Wall -g $(KERNEL_HEADERS)
|
||||
+CFLAGS = -Wall -g @CFLAGS@ $(KERNEL_HEADERS)
|
||||
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
@@ -1,37 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=broadcom-diag
|
||||
PKG_RELEASE:=10
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define KernelPackage/diag
|
||||
SUBMENU:=Other modules
|
||||
DEPENDS:=@TARGET_brcm47xx
|
||||
TITLE:=Driver for router LEDs and Buttons
|
||||
FILES:=$(PKG_BUILD_DIR)/diag.ko
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
$(CP) ./src/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C "$(LINUX_DIR)" \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||
ARCH="$(LINUX_KARCH)" \
|
||||
SUBDIRS="$(PKG_BUILD_DIR)" \
|
||||
EXTRA_CFLAGS="$(BUILDFLAGS)" \
|
||||
modules
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,diag))
|
||||
@@ -1,17 +0,0 @@
|
||||
#
|
||||
# Makefile for diag driver
|
||||
#
|
||||
# Copyright (C) 2005 Felix Fietkau <nbd@openwrt.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version
|
||||
# 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
|
||||
obj-m := diag.o
|
||||
|
||||
ifeq ($(MAKING_MODULES),1)
|
||||
|
||||
-include $(TOPDIR)/Rules.make
|
||||
endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,134 +0,0 @@
|
||||
/*
|
||||
* diag.h - GPIO interface driver for Broadcom boards
|
||||
*
|
||||
* Copyright (C) 2006 Mike Baker <mbm@openwrt.org>,
|
||||
* Felix Fietkau <nbd@openwrt.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/irq.h>
|
||||
#define MODULE_NAME "diag"
|
||||
|
||||
#define MAX_GPIO 16
|
||||
#define FLASH_TIME HZ/6
|
||||
|
||||
enum polarity_t {
|
||||
REVERSE = 0,
|
||||
NORMAL = 1,
|
||||
INPUT = 2,
|
||||
};
|
||||
|
||||
enum {
|
||||
PROC_BUTTON,
|
||||
PROC_LED,
|
||||
PROC_MODEL,
|
||||
PROC_GPIOMASK
|
||||
};
|
||||
|
||||
struct prochandler_t {
|
||||
int type;
|
||||
void *ptr;
|
||||
};
|
||||
|
||||
struct button_t {
|
||||
struct prochandler_t proc;
|
||||
char *name;
|
||||
u32 gpio;
|
||||
unsigned long seen;
|
||||
u8 pressed;
|
||||
};
|
||||
|
||||
struct led_t {
|
||||
struct prochandler_t proc;
|
||||
char *name;
|
||||
u32 gpio;
|
||||
u8 polarity;
|
||||
u8 flash;
|
||||
u8 state;
|
||||
};
|
||||
|
||||
struct platform_t {
|
||||
char *name;
|
||||
|
||||
struct button_t buttons[MAX_GPIO];
|
||||
u32 button_mask;
|
||||
u32 button_polarity;
|
||||
void (*platform_init)(void);
|
||||
|
||||
struct led_t leds[MAX_GPIO];
|
||||
};
|
||||
|
||||
struct event_t {
|
||||
struct work_struct wq;
|
||||
unsigned long seen;
|
||||
char *name, *action;
|
||||
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
|
||||
struct sk_buff *skb;
|
||||
#else
|
||||
char *scratch;
|
||||
char *argv[4];
|
||||
char *envp[7];
|
||||
u8 enr, anr;
|
||||
#endif
|
||||
};
|
||||
|
||||
extern char *nvram_get(char *str);
|
||||
|
||||
static struct platform_t platform;
|
||||
|
||||
/* buttons */
|
||||
|
||||
static void register_buttons(struct button_t *b);
|
||||
static void unregister_buttons(struct button_t *b);
|
||||
|
||||
static void hotplug_button(struct work_struct *work);
|
||||
static irqreturn_t button_handler(int irq, void *dev_id);
|
||||
|
||||
/* leds */
|
||||
|
||||
static void register_leds(struct led_t *l);
|
||||
static void unregister_leds(struct led_t *l);
|
||||
|
||||
static void set_led_extif(struct led_t *led);
|
||||
static void led_flash(unsigned long dummy);
|
||||
|
||||
/* 2.4 compatibility */
|
||||
#ifndef TIMER_INITIALIZER
|
||||
#define TIMER_INITIALIZER(_function, _expires, _data) \
|
||||
{ \
|
||||
/* _expires and _data currently unused */ \
|
||||
function: _function \
|
||||
}
|
||||
#endif
|
||||
|
||||
static struct timer_list led_timer = TIMER_INITIALIZER(&led_flash, 0, 0);
|
||||
|
||||
/* proc */
|
||||
|
||||
static struct proc_dir_entry *diag, *leds;
|
||||
|
||||
static ssize_t diag_proc_read(struct file *file, char *buf, size_t count, loff_t *ppos);
|
||||
static ssize_t diag_proc_write(struct file *file, const char *buf, size_t count, loff_t *ppos);
|
||||
|
||||
static struct file_operations diag_proc_fops = {
|
||||
read: diag_proc_read,
|
||||
write: diag_proc_write
|
||||
};
|
||||
|
||||
static struct prochandler_t proc_model = { .type = PROC_MODEL };
|
||||
static struct prochandler_t proc_gpiomask = { .type = PROC_GPIOMASK };
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
#ifndef __DIAG_GPIO_H
|
||||
#define __DIAG_GPIO_H
|
||||
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/ssb/ssb_embedded.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <bcm47xx.h>
|
||||
|
||||
#define EXTIF_ADDR 0x1f000000
|
||||
#define EXTIF_UART (EXTIF_ADDR + 0x00800000)
|
||||
|
||||
#define GPIO_TYPE_NORMAL (0x0 << 24)
|
||||
#define GPIO_TYPE_EXTIF (0x1 << 24)
|
||||
#define GPIO_TYPE_MASK (0xf << 24)
|
||||
|
||||
#endif /* __DIAG_GPIO_H */
|
||||
@@ -1,54 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=broadcom-nvram
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_BUILD_DIR := $(KERNEL_BUILD_DIR)/$(PKG_NAME)
|
||||
STAMP_PREPARED := $(STAMP_PREPARED)_$(call confvar,CONFIG_MTD_REDBOOT_PARTS)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
LDFLAGS+= \
|
||||
-Wl,-rpath-link=$(STAGING_DIR)/usr/lib \
|
||||
-Wl,-rpath-link=$(STAGING_DIR)/lib
|
||||
|
||||
RSTRIP:=true
|
||||
|
||||
define Package/bcmnvram
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=Broadcom nvram emulator library
|
||||
URL:=
|
||||
DEPENDS:=PACKAGE_libuci:libuci
|
||||
endef
|
||||
|
||||
define Package/bcmnvram/description
|
||||
Broadcom nvram to uci wrapper
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
$(CP) ./src/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
target=$(firstword $(subst -, ,$(BOARD)))
|
||||
|
||||
MAKE_FLAGS += TARGET="$(target)"
|
||||
TARGET_CFLAGS += -Dtarget_$(target)=1 -Wall
|
||||
|
||||
define Package/bcmnvram/install
|
||||
$(CP) ./files/* $(1)/
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
cp $(PKG_BUILD_DIR)/libnvram.so $(1)/usr/lib/
|
||||
cp $(PKG_BUILD_DIR)/uci_test $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,bcmnvram))
|
||||
@@ -1,3 +0,0 @@
|
||||
config 'broadcom' 'nvram'
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
# Makefile for broadcom nvram to uci wrapper
|
||||
|
||||
|
||||
%.o: %.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
OBJS = nvram_emu_lib.o ucix.o main.o
|
||||
|
||||
all: libnvram main
|
||||
|
||||
dynamic: all
|
||||
|
||||
libnvram: nvram_emu_lib.o
|
||||
$(CC) -c $(CFLAGS) $(LDFLAGS) -fPIC -o ucix_shared.o ucix.c -luci
|
||||
$(CC) -c $(CFLAGS) $(LDFLAGS) -fPIC -o nvram_emu_lib.o nvram_emu_lib.c -luci
|
||||
$(CC) $(LDFLAGS) -shared -Wl,-soname,libnvram.so -o libnvram.so nvram_emu_lib.o ucix_shared.o -luci
|
||||
|
||||
main: main.o ucix.o
|
||||
$(CC) $(LDFLAGS) -o uci_test main.o ucix.o -luci
|
||||
|
||||
clean:
|
||||
rm -f libnvram.so ucix_shared.o uci_test ${OBJS}
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
// uci test program Copyright Benjamin Larsson 2012 <benjamin@southpole.se>
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <uci.h>
|
||||
#include "ucix.h"
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct uci_context *ctx;
|
||||
const char *ucitmp;
|
||||
|
||||
ctx = ucix_init("broadcom");
|
||||
if(!ctx)
|
||||
printf("Failed to load config file");
|
||||
|
||||
ucitmp = ucix_get_option(ctx, "broadcom", "nvram", "test");
|
||||
printf("test = %s\n",ucitmp);
|
||||
ucix_add_section(ctx, "broadcom", "nvram", "broadcom");
|
||||
ucix_add_option(ctx, "broadcom", "nvram", "test", "tomte");
|
||||
ucix_add_option(ctx, "broadcom", "nvram", "test2", "tomte2");
|
||||
printf("Hello world\n");
|
||||
ucix_commit(ctx, "broadcom");
|
||||
ucitmp = ucix_get_option(ctx, "broadcom", "nvram", "test");
|
||||
printf("test = %s\n",ucitmp);
|
||||
ucix_cleanup(ctx);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user