mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-21 09:33:50 +08:00
Compare commits
52 Commits
sysmngr_me
...
kernel-cc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc743ec3a7 | ||
|
|
2cd8e830b4 | ||
|
|
0c8fe5219e | ||
|
|
7149ff400b | ||
|
|
cb51d61097 | ||
|
|
4b603feaf7 | ||
|
|
28a699ace1 | ||
|
|
ecb30c14a7 | ||
|
|
4df1883bc0 | ||
|
|
ad7561290b | ||
|
|
72c80e7255 | ||
|
|
eeae7ce03a | ||
|
|
e660f7eb4e | ||
|
|
e25330b763 | ||
|
|
db18c12c03 | ||
|
|
3c3534e5e6 | ||
|
|
7493d71ea8 | ||
|
|
847f109800 | ||
|
|
3113657a5f | ||
|
|
1e14f810b0 | ||
|
|
d8788edffa | ||
|
|
ec152f8f9f | ||
|
|
ca278a1871 | ||
|
|
209ea5b025 | ||
|
|
dd375f2a18 | ||
|
|
cd49a9c30f | ||
|
|
66706c7995 | ||
|
|
551f885344 | ||
|
|
527a104ef5 | ||
|
|
840130ec14 | ||
|
|
c466667e3d | ||
|
|
b83cb84ff9 | ||
|
|
0bef3a9e5a | ||
|
|
6ee6b3675f | ||
|
|
e8f90b0d41 | ||
|
|
46eb21a677 | ||
|
|
3161fbde1c | ||
|
|
43ea4d028a | ||
|
|
c908ea3e7c | ||
|
|
75299f0ea2 | ||
|
|
dc6ef2b53e | ||
|
|
6badb49fd9 | ||
|
|
4a670745ca | ||
|
|
eda680f4cf | ||
|
|
8bb1b8e147 | ||
|
|
9cdc86c8e8 | ||
|
|
ba02924ce5 | ||
|
|
ee679f8258 | ||
|
|
13b7f7e363 | ||
|
|
293b0835b1 | ||
|
|
54395dd359 | ||
|
|
bbc05c7c79 |
@@ -1,31 +0,0 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
|
||||||
|
|
||||||
PKG_NAME:=4g-support
|
|
||||||
PKG_VERSION:=1.0.0
|
|
||||||
PKG_RELEASE:=1
|
|
||||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
|
||||||
|
|
||||||
define Package/4g-support
|
|
||||||
CATEGORY:=Network
|
|
||||||
TITLE:=4G Network Setup Tools
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/4g-support/description
|
|
||||||
4g-support contains necessary tools to setup 4G WAN connection
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Build/Prepare
|
|
||||||
mkdir -p $(PKG_BUILD_DIR)
|
|
||||||
$(CP) ./files/* $(PKG_BUILD_DIR)/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Build/Compile
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/4g-support/install
|
|
||||||
$(CP) ./files/* $(1)/
|
|
||||||
endef
|
|
||||||
|
|
||||||
$(eval $(call BuildPackage,4g-support))
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
opengt
|
|
||||||
set com 115200n81
|
|
||||||
set comecho off
|
|
||||||
set senddelay 0.05
|
|
||||||
waitquiet 1 0.2
|
|
||||||
|
|
||||||
:start
|
|
||||||
if $env("USE_DISCONNECT")="1" goto disconnect
|
|
||||||
send "AT^^NDISDUP=1,1,\""
|
|
||||||
send $env("USE_APN")
|
|
||||||
|
|
||||||
if $env("USE_AUTHTYPE")="-1" goto noauth
|
|
||||||
else goto auth
|
|
||||||
|
|
||||||
:noauth
|
|
||||||
send "\"^m"
|
|
||||||
goto result
|
|
||||||
|
|
||||||
:auth
|
|
||||||
send "\",\""
|
|
||||||
send $env("USE_USERID")
|
|
||||||
send "\",\""
|
|
||||||
send $env("USE_PASSWORD")
|
|
||||||
send "\","
|
|
||||||
send $env("USE_AUTHTYPE")
|
|
||||||
send "^m"
|
|
||||||
goto result
|
|
||||||
|
|
||||||
:result
|
|
||||||
waitfor 5 "OK","ERR","ERROR"
|
|
||||||
if % = 0 goto connok
|
|
||||||
if % = 1 goto connerr
|
|
||||||
if % = 2 goto connerr
|
|
||||||
|
|
||||||
:connok
|
|
||||||
print "WWAN connection established.\r\n"
|
|
||||||
goto done
|
|
||||||
|
|
||||||
:connerr
|
|
||||||
print "WWAN error. Connection failed.\r\n"
|
|
||||||
exit 1
|
|
||||||
|
|
||||||
:disconnect
|
|
||||||
send "AT^^NDISDUP=1,0,\""
|
|
||||||
send $env("USE_APN")
|
|
||||||
send "\"^m"
|
|
||||||
|
|
||||||
waitfor 5 "OK","ERR","ERROR"
|
|
||||||
if % = 0 goto disconnok
|
|
||||||
if % = 1 goto disconnerr
|
|
||||||
if % = 2 goto disconnerr
|
|
||||||
|
|
||||||
:disconnok
|
|
||||||
print "WWAN connection disconnected.\r\n"
|
|
||||||
goto done
|
|
||||||
|
|
||||||
:disconnerr
|
|
||||||
print "WWAN disconnection error.\r\n"
|
|
||||||
exit 1
|
|
||||||
|
|
||||||
:done
|
|
||||||
exit 0
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
. /lib/network/config.sh
|
|
||||||
. /usr/share/libubox/jshn.sh
|
|
||||||
|
|
||||||
iface_status() {
|
|
||||||
local iface=$1
|
|
||||||
local up
|
|
||||||
json_load "$(ifstatus $iface)"
|
|
||||||
json_get_var up up
|
|
||||||
json_close_object
|
|
||||||
return $up
|
|
||||||
}
|
|
||||||
|
|
||||||
case "$ACTION" in
|
|
||||||
add|register)
|
|
||||||
if [ "${INTERFACE:0:4}" == "wwan" ]; then
|
|
||||||
netname=$(get_network_of "$INTERFACE")
|
|
||||||
for net in $netname; do
|
|
||||||
local service=$(uci -q get network.$net.service)
|
|
||||||
local cnt=0
|
|
||||||
while $(iface_status $net); do
|
|
||||||
ifup $net
|
|
||||||
if [ "$service" == "qmi" ]; then
|
|
||||||
cnt=$(($cnt+1))
|
|
||||||
# quit trying if still not online after three times
|
|
||||||
[ $cnt -eq 3 ] && break
|
|
||||||
sleep 5
|
|
||||||
else
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
local usb_dir uVid uPid uMa uPr uSe bConf bNumConfs vendor product mdmtyp netdev comdev cdcdev ttydev usbno usbbr
|
|
||||||
|
|
||||||
sanitize() {
|
|
||||||
sed -e 's/[[:space:]]\+$//; s/[[:space:]]\+/_/g' "$@"
|
|
||||||
}
|
|
||||||
|
|
||||||
find_usb_attrs() {
|
|
||||||
usb_dir="/sys/$DEVPATH"
|
|
||||||
[ -f "$usb_dir/idVendor" ] || usb_dir="${usb_dir%/*}"
|
|
||||||
|
|
||||||
uVid=$(cat "$usb_dir/idVendor")
|
|
||||||
uPid=$(cat "$usb_dir/idProduct")
|
|
||||||
uMa=$(sanitize "$usb_dir/manufacturer")
|
|
||||||
uPr=$(sanitize "$usb_dir/product")
|
|
||||||
uSe=$(sanitize "$usb_dir/serial")
|
|
||||||
bNumConfs=$(cat "$usb_dir/bNumConfigurations")
|
|
||||||
bConf=$(cat "$usb_dir/bConfigurationValue")
|
|
||||||
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)
|
|
||||||
if [ -n "$cdcdev" ]; then
|
|
||||||
comdev=$cdcdev
|
|
||||||
mdmtyp=$(grep $uVid:$uPid /etc/modemdb | grep 'qmi\|mbim' | awk '{print$2}' | head -1)
|
|
||||||
vendor=$(grep $uVid:$uPid /etc/modemdb | grep 'qmi\|mbim' | awk '{print$3}' | head -1)
|
|
||||||
product=$(grep $uVid:$uPid /etc/modemdb | grep 'qmi\|mbim' | awk '{print$4}' | head -1)
|
|
||||||
else
|
|
||||||
comdev=$ttydev
|
|
||||||
mdmtyp=$(grep $uVid:$uPid /etc/modemdb | grep 'ncm' | awk '{print$2}' | head -1)
|
|
||||||
vendor=$(grep $uVid:$uPid /etc/modemdb | grep 'ncm' | awk '{print$3}' | head -1)
|
|
||||||
product=$(grep $uVid:$uPid /etc/modemdb | grep 'ncm' | awk '{print$4}' | head -1)
|
|
||||||
fi
|
|
||||||
[ -n "$mdmtyp" ] || mdmtyp=$(grep $uVid:$uPid /etc/modemdb | awk '{print$2}' | head -1)
|
|
||||||
[ -n "$vendor" ] || vendor=$(grep $uVid:$uPid /etc/modemdb | awk '{print$3}' | head -1)
|
|
||||||
[ -n "$product" ] || product=$(grep $uVid:$uPid /etc/modemdb | awk '{print$4}' | head -1)
|
|
||||||
}
|
|
||||||
|
|
||||||
convert_to_mbim() {
|
|
||||||
if [ "$mdmtyp" == "mbim" ] && [ "$bNumConfs" == "2" ]; then
|
|
||||||
[ "$bConf" == "2" ] || echo 2 > $usb_dir/bConfigurationValue
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
usbno=$(echo $DEVPATH | cut -d'/' -f5)
|
|
||||||
usbbr=$(echo $DEVPATH | cut -d'/' -f7)
|
|
||||||
case "$usbbr" in
|
|
||||||
*:*) usbbr=$(echo $DEVPATH | cut -d'/' -f6) ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
find_usb_attrs
|
|
||||||
if [ "$ACTION" = add ]; then
|
|
||||||
convert_to_mbim "$uVid:$uPid"
|
|
||||||
if [ -n "$uVid" ] && [ -n "$uPid" ] && [ -n "$mdmtyp" ] && [ -n "$netdev" ] && [ -n "$comdev" ]; 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
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$ACTION" = remove ]; then
|
|
||||||
if [ -n "$usbno" ] && [ -n "$usbbr" ]; then
|
|
||||||
sed -i "/$usbno:$usbbr/ d" /var/usbnets
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
@@ -1,100 +0,0 @@
|
|||||||
1bbb:011e qmi
|
|
||||||
1a8d:1001 ecm
|
|
||||||
1a8d:100c ecm
|
|
||||||
1a8d:100d ecm
|
|
||||||
16d8:6280 qmi
|
|
||||||
16d8:6803 qmi
|
|
||||||
16d8:6804 qmi
|
|
||||||
16d8:7003 qmi
|
|
||||||
16d8:700a qmi
|
|
||||||
2001:7d01 mbim
|
|
||||||
2001:7d02 mbim
|
|
||||||
2001:7d03 mbim
|
|
||||||
12d1:14ac qmi
|
|
||||||
12d1:140c qmi
|
|
||||||
12d1:1506 qmi Huawei E367/392/398
|
|
||||||
12d1:1506 ncm Huawei E3276
|
|
||||||
12d1:14d2 qmi
|
|
||||||
12d1:1c07 ncm
|
|
||||||
12d1:1436 ecm
|
|
||||||
12d1:14c9 qmi
|
|
||||||
12d1:14db ecm
|
|
||||||
12d1:151d mbim
|
|
||||||
12d1:151e qmi Huawei E353
|
|
||||||
12d1:1c1e ncm
|
|
||||||
12d1:150c qmi
|
|
||||||
12d1:150f qmi
|
|
||||||
12d1:151b qmi
|
|
||||||
12d1:142d ecm
|
|
||||||
12d1:1432 ecm
|
|
||||||
12d1:1c1f ncm
|
|
||||||
12d1:1433 qmi
|
|
||||||
12d1:1465 ecm
|
|
||||||
12d1:14ca qmi
|
|
||||||
12d1:14cf ncm
|
|
||||||
12d1:14bc ecm
|
|
||||||
12d1:14ae ecm
|
|
||||||
12d1:1576 mbim
|
|
||||||
12d1:1577 mbim
|
|
||||||
12d1:1400 mbim
|
|
||||||
12d1:14f7 mbim
|
|
||||||
12d1:1464 qmi
|
|
||||||
12d1:14cb qmi
|
|
||||||
12d1:14cc qmi
|
|
||||||
12d1:14c6 qmi
|
|
||||||
12d1:14fa mbim
|
|
||||||
12d1:1578 mbim
|
|
||||||
12d1:14c8 qmi
|
|
||||||
12d1:14f8 mbim
|
|
||||||
12d1:1575 mbim
|
|
||||||
12d1:1579 mbim
|
|
||||||
12d1:157a mbim
|
|
||||||
12d1:157b mbim
|
|
||||||
12d1:157f mbim
|
|
||||||
12d1:1f16 mbim Vodafone K5150
|
|
||||||
12d1:1404 qmi
|
|
||||||
19f2:1700 ecm
|
|
||||||
1410:b001 qmi
|
|
||||||
1527:1000 ecm
|
|
||||||
0b3c:c005 qmi
|
|
||||||
0f3d:68a2 qmi
|
|
||||||
1199:68a2 qmi SierraWireless M7710
|
|
||||||
1199:68c0 qmi SierraWireless M7304
|
|
||||||
1349:1100 qmi
|
|
||||||
1349:1200 qmi
|
|
||||||
1199:683c qmi
|
|
||||||
2360:2100 qmi
|
|
||||||
2360:2200 qmi
|
|
||||||
2360:2300 qmi
|
|
||||||
2507:0000 qmi
|
|
||||||
19d2:0055 qmi
|
|
||||||
19d2:0052 qmi
|
|
||||||
19d2:0063 qmi
|
|
||||||
19d2:1008 qmi
|
|
||||||
19d2:1010 qmi
|
|
||||||
19d2:2002 qmi
|
|
||||||
19d2:1176 qmi
|
|
||||||
19d2:1023 mbim
|
|
||||||
19d2:0104 qmi
|
|
||||||
19d2:1018 qmi
|
|
||||||
19d2:1032 mbim
|
|
||||||
19d2:1402 qmi
|
|
||||||
19d2:1405 ecm
|
|
||||||
19d2:1426 qmi
|
|
||||||
19d2:0031 qmi
|
|
||||||
19d2:0124 qmi
|
|
||||||
19d2:1254 qmi
|
|
||||||
19d2:0017 qmi
|
|
||||||
19d2:0002 qmi
|
|
||||||
19d2:0121 qmi
|
|
||||||
19d2:1252 qmi
|
|
||||||
19d2:0157 qmi
|
|
||||||
19d2:0167 qmi
|
|
||||||
19d2:0199 qmi
|
|
||||||
19d2:0257 qmi
|
|
||||||
19d2:0326 qmi
|
|
||||||
19d2:0349 ecm
|
|
||||||
19d2:1408 ecm
|
|
||||||
19d2:0284 qmi
|
|
||||||
19d2:0019 qmi
|
|
||||||
19d2:0265 qmi
|
|
||||||
@@ -1,159 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
INCLUDE_ONLY=1
|
|
||||||
|
|
||||||
. /lib/functions.sh
|
|
||||||
. ../netifd-proto.sh
|
|
||||||
init_proto "$@"
|
|
||||||
|
|
||||||
proto_4g_init_config() {
|
|
||||||
proto_config_add_string "modem"
|
|
||||||
proto_config_add_string "service"
|
|
||||||
proto_config_add_string "comdev"
|
|
||||||
proto_config_add_string "ipaddr"
|
|
||||||
proto_config_add_string "netmask"
|
|
||||||
proto_config_add_string "hostname"
|
|
||||||
proto_config_add_string "clientid"
|
|
||||||
proto_config_add_string "vendorid"
|
|
||||||
proto_config_add_boolean "broadcast"
|
|
||||||
proto_config_add_string "reqopts"
|
|
||||||
proto_config_add_string "apn"
|
|
||||||
proto_config_add_string "username"
|
|
||||||
proto_config_add_string "password"
|
|
||||||
proto_config_add_boolean "lte_apn_use"
|
|
||||||
proto_config_add_string "lte_apn"
|
|
||||||
proto_config_add_string "lte_username"
|
|
||||||
proto_config_add_string "lte_password"
|
|
||||||
proto_config_add_string "pincode"
|
|
||||||
proto_config_add_string "technology"
|
|
||||||
proto_config_add_string "auto"
|
|
||||||
}
|
|
||||||
|
|
||||||
proto_4g_setup() {
|
|
||||||
local config="$1"
|
|
||||||
local iface="$2"
|
|
||||||
|
|
||||||
local ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd zone
|
|
||||||
json_get_vars ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd zone
|
|
||||||
|
|
||||||
local opt dhcpopts
|
|
||||||
for opt in $reqopts; do
|
|
||||||
append dhcpopts "-O $opt"
|
|
||||||
done
|
|
||||||
|
|
||||||
for opt in $sendopts; do
|
|
||||||
append dhcpopts "-x $opt"
|
|
||||||
done
|
|
||||||
|
|
||||||
[ "$broadcast" = 1 ] && broadcast="-B" || broadcast=
|
|
||||||
[ -n "$clientid" ] && clientid="-x 0x3d:${clientid//:/}" || clientid="-C"
|
|
||||||
[ -n "$iface6rd" ] && proto_export "IFACE6RD=$iface6rd"
|
|
||||||
[ "$iface6rd" != 0 -a -f /lib/netifd/proto/6rd.sh ] && append dhcpopts "-O 212"
|
|
||||||
[ -n "$zone6rd" ] && proto_export "ZONE6RD=$zone6rd"
|
|
||||||
[ -n "$zone" ] && proto_export "ZONE=$zone"
|
|
||||||
[ "$delegate" = "0" ] && proto_export "IFACE6RD_DELEGATE=0"
|
|
||||||
|
|
||||||
json_get_var comdev comdev
|
|
||||||
json_get_var apn apn
|
|
||||||
json_get_var service service
|
|
||||||
json_get_var pincode pincode
|
|
||||||
|
|
||||||
|
|
||||||
# if [ -n "$modem" ]; then
|
|
||||||
# service=$(echo $modem | cut -d':' -f1)
|
|
||||||
# comdev=$(echo $modem | cut -d':' -f2)
|
|
||||||
# iface=$(echo $modem | cut -d':' -f3)
|
|
||||||
# fi
|
|
||||||
|
|
||||||
case "$service" in
|
|
||||||
ecm)
|
|
||||||
;;
|
|
||||||
eem)
|
|
||||||
;;
|
|
||||||
mbim)
|
|
||||||
local mbimdev=/dev/$(basename $(ls /sys/class/net/${iface}/device/usb/cdc-wdm* -d))
|
|
||||||
local comdev="${comdev:-$mbimdev}"
|
|
||||||
[ -n "$pincode" ] && {
|
|
||||||
if ! mbimcli -d $comdev --query-pin-state 2>&1 | grep -q "unlocked"; then
|
|
||||||
set -o pipefail
|
|
||||||
if ! mbimcli -d $comdev --enter-pin="${pincode}" 2>&1; then
|
|
||||||
mbimcli -d $comdev --query-pin-state
|
|
||||||
proto_notify_error "$config" PIN_FAILED
|
|
||||||
proto_block_restart "$interface"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
APN="$apn" mbim-network $comdev start
|
|
||||||
;;
|
|
||||||
ncm)
|
|
||||||
[ -n "$pincode" ] && echo $pincode | gcom -d $comdev
|
|
||||||
USE_APN="$apn" gcom -d $comdev -s /etc/gcom/ncmconnection.gcom
|
|
||||||
;;
|
|
||||||
qmi)
|
|
||||||
local qmidev=/dev/$(basename $(ls /sys/class/net/${iface}/device/usb/cdc-wdm* -d))
|
|
||||||
local comdev="${comdev:-$qmidev}"
|
|
||||||
[ -n "$pincode" ] && {
|
|
||||||
if ! qmicli -d $comdev --dms-uim-get-pin-status 2>&1 | grep -q "enabled-verified\|disabled" >/dev/null; then
|
|
||||||
set -o pipefail
|
|
||||||
if ! qmicli -d $comdev --dms-uim-verify-pin="PIN,${pincode}" 2>&1; then
|
|
||||||
qmicli -d $comdev --dms-uim-get-pin-status
|
|
||||||
proto_notify_error "$config" PIN_FAILED
|
|
||||||
proto_block_restart "$interface"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
APN="$apn" qmi-network $comdev start
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
proto_export "INTERFACE=$config"
|
|
||||||
proto_run_command "$config" udhcpc -R \
|
|
||||||
-p /var/run/udhcpc-$iface.pid \
|
|
||||||
-s /lib/netifd/dhcp.script \
|
|
||||||
-f -t 0 -i "$iface" \
|
|
||||||
${ipaddr:+-r $ipaddr} \
|
|
||||||
${hostname:+-H $hostname} \
|
|
||||||
${vendorid:+-V $vendorid} \
|
|
||||||
$clientid $broadcast $dhcpopts
|
|
||||||
}
|
|
||||||
|
|
||||||
proto_4g_teardown() {
|
|
||||||
local interface="$1"
|
|
||||||
local iface="$2"
|
|
||||||
local modem service comdev
|
|
||||||
|
|
||||||
config_load network
|
|
||||||
config_get service $interface service
|
|
||||||
config_get comdev $interface comdev
|
|
||||||
|
|
||||||
# config_get modem $interface modem
|
|
||||||
# if [ -n "$modem" ]; then
|
|
||||||
# service=$(echo $modem | cut -d':' -f1)
|
|
||||||
# comdev=$(echo $modem | cut -d':' -f2)
|
|
||||||
# iface=$(echo $modem | cut -d':' -f3)
|
|
||||||
# fi
|
|
||||||
|
|
||||||
case "$service" in
|
|
||||||
ecm)
|
|
||||||
;;
|
|
||||||
eem)
|
|
||||||
;;
|
|
||||||
mbim)
|
|
||||||
local mbimdev=/dev/$(basename $(ls /sys/class/net/${iface}/device/usb/cdc-wdm* -d))
|
|
||||||
local comdev="${comdev:-$mbimdev}"
|
|
||||||
mbim-network $comdev stop
|
|
||||||
;;
|
|
||||||
ncm)
|
|
||||||
USE_DISCONNECT=1 gcom -d $comdev -s /etc/gcom/ncmconnection.gcom
|
|
||||||
;;
|
|
||||||
qmi)
|
|
||||||
local qmidev=/dev/$(basename $(ls /sys/class/net/${iface}/device/usb/cdc-wdm* -d))
|
|
||||||
local comdev="${comdev:-$qmidev}"
|
|
||||||
qmi-network $comdev stop
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
proto_kill_command "$interface"
|
|
||||||
}
|
|
||||||
|
|
||||||
add_protocol 4g
|
|
||||||
@@ -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,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,6 +1,6 @@
|
|||||||
config ANYFI_CONTROLLER
|
config ANYFI_CONTROLLER
|
||||||
string "Controller IP or FQDN"
|
string "Controller IP or FQDN"
|
||||||
depends PACKAGE_anyfi
|
depends on PACKAGE_anyfi
|
||||||
help
|
help
|
||||||
The default IP address or fully qualified domain name (FQDN)
|
The default IP address or fully qualified domain name (FQDN)
|
||||||
of the Controller that should manage the Anyfi.net software.
|
of the Controller that should manage the Anyfi.net software.
|
||||||
|
|||||||
@@ -1,803 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (C) 2008-2012 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:=asterisk18-mod
|
|
||||||
PKG_VERSION:=1.8.10.1
|
|
||||||
|
|
||||||
PKG_SOURCE_VERSION:=8d5a855296f61391d0166b66b11e4e6055fd86c6
|
|
||||||
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_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)/package.mk
|
|
||||||
|
|
||||||
define Package/asterisk18-mod/Default
|
|
||||||
SUBMENU:=Telephony
|
|
||||||
SECTION:=net
|
|
||||||
CATEGORY:=Network
|
|
||||||
URL:=http://www.asterisk.org/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod/Default/description
|
|
||||||
Asterisk is a complete PBX in software. It provides all of the features
|
|
||||||
you would expect from a PBX and more. Asterisk does voice over IP in three
|
|
||||||
protocols, and can interoperate with almost all standards-based telephony
|
|
||||||
equipment using relatively inexpensive hardware.
|
|
||||||
endef
|
|
||||||
|
|
||||||
|
|
||||||
define Package/asterisk18-mod
|
|
||||||
$(call Package/asterisk18-mod/Default)
|
|
||||||
TITLE:=Complete open source PBX, v1.8x
|
|
||||||
MENU:=1
|
|
||||||
DEPENDS:= +natalie-dect-h +PACKAGE_bcmkernel:bcmkernel +PACKAGE_bcmopen:bcmopen +libopenssl +libncurses +libpopt +libpthread +uci +ubus +zlib @!TARGET_avr32
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod/description
|
|
||||||
$(call Package/asterisk18-mod/Default/description)
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-sounds
|
|
||||||
$(call Package/asterisk18-mod/Default)
|
|
||||||
TITLE:=Sound files
|
|
||||||
DEPENDS:= asterisk18-mod
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-sounds/description
|
|
||||||
$(call Package/asterisk18-mod/Default/description)
|
|
||||||
This package contains sound files for Asterisk.
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-voicemail
|
|
||||||
$(call Package/asterisk18-mod/Default)
|
|
||||||
TITLE:=Voicemail support
|
|
||||||
DEPENDS:= asterisk18-mod
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-voicemail/description
|
|
||||||
$(call Package/asterisk18-mod/Default/description)
|
|
||||||
This package contains voicemail related modules for Asterisk.
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-app-transfer
|
|
||||||
$(call Package/asterisk18-mod/Default)
|
|
||||||
TITLE:=Call transfer support
|
|
||||||
DEPENDS:= asterisk18-mod
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-app-transfer/description
|
|
||||||
$(call Package/asterisk18-mod/Default/description)
|
|
||||||
This package contains the call transfer support module for Asterisk.
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-app-softhangup
|
|
||||||
$(call Package/asterisk18-mod/Default)
|
|
||||||
TITLE:=SoftHangup application
|
|
||||||
DEPENDS:= asterisk18-mod
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-app-softhangup/description
|
|
||||||
$(call Package/asterisk18-mod/Default/description)
|
|
||||||
This package contains the SoftHangup support module for Asterisk.
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-app-meetme
|
|
||||||
$(call Package/asterisk18-mod/Default)
|
|
||||||
TITLE:=conferencing support
|
|
||||||
DEPENDS:= asterisk18-mod +dahdi-tools-libtonezone +dahdi
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-app-meetme/description
|
|
||||||
$(call Package/asterisk18-mod/Default/description)
|
|
||||||
This package provides the MeetMe application driver Conferencing support to
|
|
||||||
Asterisk.
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-chan-iax2
|
|
||||||
$(call Package/asterisk18-mod/Default)
|
|
||||||
TITLE:=IAX support
|
|
||||||
DEPENDS:= asterisk18-mod +asterisk18-res-crypto
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-chan-iax2/description
|
|
||||||
$(call Package/asterisk18-mod/Default/description)
|
|
||||||
This package provides IAX support to
|
|
||||||
Asterisk.
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-cdr
|
|
||||||
$(call Package/asterisk18-mod/Default)
|
|
||||||
TITLE:=CDR support
|
|
||||||
DEPENDS:= asterisk18-mod
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-cdr/description
|
|
||||||
$(call Package/asterisk18-mod/Default/description)
|
|
||||||
This package provides Call Detail Record support to
|
|
||||||
Asterisk.
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-res-musiconhold
|
|
||||||
$(call Package/asterisk18-mod/Default)
|
|
||||||
TITLE:=MOH support
|
|
||||||
DEPENDS:= asterisk18-mod
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-res-musiconhold/description
|
|
||||||
$(call Package/asterisk18-mod/Default/description)
|
|
||||||
This package provides Music On Hold support to
|
|
||||||
Asterisk.
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-res-voice
|
|
||||||
$(call Package/asterisk18-mod/Default)
|
|
||||||
TITLE:=Voice client/pbx support
|
|
||||||
DEPENDS:= asterisk18-mod
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-res-voice/description
|
|
||||||
$(call Package/asterisk18-mod/Default/description)
|
|
||||||
This package provides Voice Client/pbx support to
|
|
||||||
Asterisk.
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-res-srtp
|
|
||||||
$(call Package/asterisk18-mod/Default)
|
|
||||||
TITLE:=SRTP support
|
|
||||||
DEPENDS:= asterisk18-mod libsrtp +asterisk18-mod-res-crypto
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-res-srtp/description
|
|
||||||
$(call Package/asterisk18-mod/Default/description)
|
|
||||||
This package provides SRTP support to
|
|
||||||
Asterisk.
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-res-stun
|
|
||||||
$(call Package/asterisk18-mod/Default)
|
|
||||||
TITLE:=STUN support
|
|
||||||
DEPENDS:= asterisk18-mod
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-app-queue
|
|
||||||
$(call Package/asterisk18-mod/Default)
|
|
||||||
TITLE:=Queue support
|
|
||||||
DEPENDS:= asterisk18-mod
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-chan-gtalk
|
|
||||||
$(call Package/asterisk18-mod/Default)
|
|
||||||
TITLE:=GTalk support
|
|
||||||
DEPENDS:= asterisk18-mod +libiksemel
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-chan-gtalk/description
|
|
||||||
$(call Package/asterisk18-mod/Default/description)
|
|
||||||
This package provides the channel chan_gtalk and res_jabber for GTalk
|
|
||||||
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
|
|
||||||
DEPENDS:= asterisk18-mod
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-res-timing-pthread
|
|
||||||
$(call Package/asterisk18-mod/Default)
|
|
||||||
TITLE:= pthread Timing Interface
|
|
||||||
DEPENDS:= asterisk18-mod
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-res-fax
|
|
||||||
$(call Package/asterisk18-mod/Default)
|
|
||||||
TITLE:=Generic FAX Resource for FAX technology resource modules
|
|
||||||
DEPENDS:= asterisk18-mod +asterisk18-mod-res-timing-pthread
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-res-fax-spandsp
|
|
||||||
$(call Package/asterisk18-mod/Default)
|
|
||||||
TITLE:=Spandsp T.38 and G.711 FAX Resource
|
|
||||||
DEPENDS:= asterisk18-mod +asterisk18-mod-res-fax +libspandsp
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-chan-mgcp
|
|
||||||
$(call Package/asterisk18-mod/Default)
|
|
||||||
TITLE:=MGCP channel support
|
|
||||||
DEPENDS:= asterisk18-mod
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-chan-mgcp/description
|
|
||||||
$(call Package/asterisk18-mod/Default/description)
|
|
||||||
This package provides the channel chan_mgcp support to Asterisk.
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-chan-skinny
|
|
||||||
$(call Package/asterisk18-mod/Default)
|
|
||||||
TITLE:=Skinny channel support
|
|
||||||
DEPENDS:= asterisk18-mod
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-chan-skinny/description
|
|
||||||
$(call Package/asterisk18-mod/Default/description)
|
|
||||||
This package provides the channel chan_skinny support to Asterisk.
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-chan-brcm
|
|
||||||
$(call Package/asterisk18-mod/Default)
|
|
||||||
TITLE:=Broadcom channel support
|
|
||||||
DEPENDS:= asterisk18-mod
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-chan-brcm/description
|
|
||||||
$(call Package/asterisk18-mod/Default/description)
|
|
||||||
This package provides the channel chan_brcm support to Asterisk.
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-curl
|
|
||||||
$(call Package/asterisk18-mod/Default)
|
|
||||||
TITLE:=CURL support
|
|
||||||
DEPENDS:= asterisk18-mod +libcurl
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-curl/description
|
|
||||||
$(call Package/asterisk18-mod/Default/description)
|
|
||||||
This package provides CURL
|
|
||||||
support to Asterisk.
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-mysql
|
|
||||||
$(call Package/asterisk18-mod/Default)
|
|
||||||
TITLE:=MySQL support
|
|
||||||
DEPENDS:= asterisk18-mod +PACKAGE_asterisk18-mysql:libmysqlclient
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-mysql/description
|
|
||||||
$(call Package/asterisk18-mod/Default/description)
|
|
||||||
This package provides MySQL
|
|
||||||
support to Asterisk.
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-chan-lantiq
|
|
||||||
$(call Package/asterisk18-mod/Default)
|
|
||||||
TITLE:=Lantiq TAPI support
|
|
||||||
DEPENDS:= asterisk18-mod $(LTQ_TAPI_DEPENDS)
|
|
||||||
URL:=http://git.nanl.de/?p=asterisk_channel_lantiq.git
|
|
||||||
MAINTAINER:=Mirko Vogt <mirko@openwrt.org>
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-chan-lantiq/description
|
|
||||||
$(call Package/asterisk18-mod/Default/description)
|
|
||||||
This package provides the channel chan_lantiq support to Asterisk.
|
|
||||||
endef
|
|
||||||
|
|
||||||
CONFIGURE_ARGS+= \
|
|
||||||
--without-inotify
|
|
||||||
|
|
||||||
ifneq ($(SDK)$(CONFIG_PACKAGE_asterisk18-mod-app-meetme),)
|
|
||||||
CONFIGURE_ARGS+= \
|
|
||||||
--with-dahdi="$(STAGING_DIR)/usr"
|
|
||||||
else
|
|
||||||
CONFIGURE_ARGS+= \
|
|
||||||
--without-dahdi
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq ($(SDK)$(CONFIG_PACKAGE_asterisk18-mod-chan-gtalk),)
|
|
||||||
CONFIGURE_ARGS+= \
|
|
||||||
--with-gnutls="$(STAGING_DIR)/usr" \
|
|
||||||
--with-iksemel="$(STAGING_DIR)/usr"
|
|
||||||
SITE_VARS+= \
|
|
||||||
ac_cv_lib_iksemel_iks_start_sasl=yes \
|
|
||||||
ac_cv_lib_gnutls_gnutls_bye=yes
|
|
||||||
else
|
|
||||||
CONFIGURE_ARGS+= \
|
|
||||||
--without-gnutls \
|
|
||||||
--without-iksemel
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq ($(SDK)$(CONFIG_PACKAGE_asterisk18-mod-curl),)
|
|
||||||
CONFIGURE_ARGS+= \
|
|
||||||
--with-curl="$(STAGING_DIR)/usr"
|
|
||||||
else
|
|
||||||
CONFIGURE_ARGS+= \
|
|
||||||
--without-curl
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq ($(SDK)$(CONFIG_PACKAGE_asterisk18-mod-mysql),)
|
|
||||||
CONFIGURE_ARGS+= \
|
|
||||||
--with-mysqlclient="$(STAGING_DIR)/usr/bin"
|
|
||||||
else
|
|
||||||
CONFIGURE_ARGS+= \
|
|
||||||
--without-mysqlclient
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq ($(SDK)$(CONFIG_PACKAGE_asterisk18-mod-res-fax-spandsp),)
|
|
||||||
CONFIGURE_ARGS+= \
|
|
||||||
--with-spandsp="$(STAGING_DIR)/usr"
|
|
||||||
else
|
|
||||||
CONFIGURE_ARGS+= \
|
|
||||||
--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"
|
|
||||||
else
|
|
||||||
CONFIGURE_ARGS+= \
|
|
||||||
--without-srtp
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_TARGET_IBOARDID),"D301")
|
|
||||||
EXTRA_CFLAGS += -DNTR_SUPPORT
|
|
||||||
endif
|
|
||||||
|
|
||||||
CONFIGURE_ARGS+= \
|
|
||||||
--without-curses \
|
|
||||||
--with-gsm=internal \
|
|
||||||
--without-cap \
|
|
||||||
--without-gtk \
|
|
||||||
--without-gtk2 \
|
|
||||||
--without-isdnnet \
|
|
||||||
--without-kde \
|
|
||||||
--without-misdn \
|
|
||||||
--without-nbs \
|
|
||||||
--with-ncurses="$(STAGING_DIR)/usr" \
|
|
||||||
--without-netsnmp \
|
|
||||||
--without-newt \
|
|
||||||
--without-odbc \
|
|
||||||
--without-ogg \
|
|
||||||
--without-osptk \
|
|
||||||
--with-popt="$(STAGING_DIR)/usr" \
|
|
||||||
--without-pri \
|
|
||||||
--without-qt \
|
|
||||||
--without-radius \
|
|
||||||
--without-sdl \
|
|
||||||
--without-suppserv \
|
|
||||||
--without-tds \
|
|
||||||
--without-termcap \
|
|
||||||
--without-tinfo \
|
|
||||||
--without-vorbis \
|
|
||||||
--without-vpb \
|
|
||||||
--with-z="$(STAGING_DIR)/usr" \
|
|
||||||
--with-sounds-cache="$(DL_DIR)" \
|
|
||||||
--disable-xmldoc
|
|
||||||
|
|
||||||
EXTRA_CFLAGS+= $(TARGET_CPPFLAGS)
|
|
||||||
EXTRA_LDFLAGS+= $(TARGET_LDFLAGS)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
define Build/Prepare
|
|
||||||
$(call Build/Prepare/Default)
|
|
||||||
ifneq ($(CONFIG_TARGET_lantiq),)
|
|
||||||
$(CP) ./src-lantiq/* $(PKG_BUILD_DIR)/
|
|
||||||
endif
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Build/Configure
|
|
||||||
-rm $(PKG_BUILD_DIR)/menuselect.makeopts
|
|
||||||
$(call Build/Configure/Default,,$(SITE_VARS))
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Build/Compile
|
|
||||||
$(MAKE) -C "$(PKG_BUILD_DIR)" \
|
|
||||||
include/asterisk/version.h \
|
|
||||||
include/asterisk/buildopts.h defaults.h \
|
|
||||||
makeopts.embed_rules
|
|
||||||
ASTCFLAGS="$(EXTRA_CFLAGS) -DLOW_MEMORY" \
|
|
||||||
ASTLDFLAGS="$(EXTRA_LDFLAGS)" \
|
|
||||||
$(MAKE) -C "$(PKG_BUILD_DIR)" \
|
|
||||||
ASTVARLIBDIR="/usr/lib/asterisk" \
|
|
||||||
ASTDATADIR="/usr/lib/asterisk" \
|
|
||||||
ASTKEYDIR="/usr/lib/asterisk" \
|
|
||||||
ASTDBDIR="/usr/lib/asterisk" \
|
|
||||||
NOISY_BUILD="1" \
|
|
||||||
DEBUG="" \
|
|
||||||
OPTIMIZE="" \
|
|
||||||
DESTDIR="$(PKG_INSTALL_DIR)" \
|
|
||||||
all install samples
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Build/InstallDev
|
|
||||||
$(INSTALL_DIR) $(1)/usr/include/asterisk-1.8/include/asterisk/
|
|
||||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/asterisk/*.h $(1)/usr/include/asterisk-1.8/include/asterisk/
|
|
||||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/asterisk.h $(1)/usr/include/asterisk-1.8/include/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod/conffiles
|
|
||||||
/etc/asterisk/asterisk.conf
|
|
||||||
/etc/asterisk/modules.conf
|
|
||||||
/etc/asterisk/extensions.conf
|
|
||||||
/etc/asterisk/sip.conf
|
|
||||||
/etc/asterisk/sip_notify.conf
|
|
||||||
/etc/asterisk/features.conf
|
|
||||||
/etc/asterisk/indications.conf
|
|
||||||
/etc/asterisk/logger.conf
|
|
||||||
/etc/asterisk/manager.conf
|
|
||||||
/etc/asterisk/rtp.conf
|
|
||||||
/etc/default/asterisk
|
|
||||||
/etc/init.d/asterisk
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod/install
|
|
||||||
$(INSTALL_DIR) $(1)/etc/asterisk/ssl
|
|
||||||
for f in asterisk extensions features \
|
|
||||||
indications logger manager modules \
|
|
||||||
sip sip_notify rtp; do \
|
|
||||||
$(CP) $(PKG_INSTALL_DIR)/etc/asterisk/$$$$f.conf $(1)/etc/asterisk/ ; \
|
|
||||||
done
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
|
||||||
for f in app_dial app_echo app_playback app_macro \
|
|
||||||
chan_sip res_rtp_asterisk res_rtp_multicast \
|
|
||||||
codec_ulaw codec_gsm \
|
|
||||||
format_gsm format_pcm format_wav format_wav_gsm \
|
|
||||||
pbx_config \
|
|
||||||
func_strings func_timeout func_callerid func_logic; do \
|
|
||||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/$$$$f.so $(1)/usr/lib/asterisk/modules/ ; \
|
|
||||||
done
|
|
||||||
$(INSTALL_DIR) $(1)/usr/sbin
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/asterisk $(1)/usr/sbin/
|
|
||||||
$(INSTALL_DIR) $(1)/etc/default
|
|
||||||
$(INSTALL_DATA) ./files/asterisk.default $(1)/etc/default/asterisk
|
|
||||||
$(INSTALL_DIR) $(1)/etc/init.d
|
|
||||||
$(INSTALL_BIN) ./files/asterisk.init $(1)/etc/init.d/asterisk
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-sounds/install
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/sounds/
|
|
||||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/asterisk/sounds/en/* $(1)/usr/lib/asterisk/sounds/
|
|
||||||
rm -f $(1)/usr/lib/asterisk/sounds/vm-*
|
|
||||||
rm -f $(1)/usr/lib/asterisk/sounds/conf-*
|
|
||||||
endef
|
|
||||||
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-voicemail/conffiles
|
|
||||||
/etc/asterisk/voicemail.conf
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-voicemail/install
|
|
||||||
$(INSTALL_DIR) $(1)/etc/asterisk
|
|
||||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/voicemail.conf $(1)/etc/asterisk/
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/*voicemail.so $(1)/usr/lib/asterisk/modules/
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_adsi.so $(1)/usr/lib/asterisk/modules/
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_smdi.so $(1)/usr/lib/asterisk/modules/
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/sounds/
|
|
||||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/asterisk/sounds/en/vm-*.gsm $(1)/usr/lib/asterisk/sounds/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-app-meetme/conffiles
|
|
||||||
/etc/asterisk/meetme.conf
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-app-meetme/install
|
|
||||||
$(INSTALL_DIR) $(1)/etc/asterisk
|
|
||||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/meetme.conf $(1)/etc/asterisk/
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/app_meetme.so $(1)/usr/lib/asterisk/modules/
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/sounds/
|
|
||||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/asterisk/sounds/en/conf-*.gsm $(1)/usr/lib/asterisk/sounds/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-chan-iax2/conffiles
|
|
||||||
/etc/asterisk/iax.conf
|
|
||||||
/etc/asterisk/iaxprov.conf
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-cdr/conffiles
|
|
||||||
/etc/asterisk/cdr.conf
|
|
||||||
/etc/asterisk/cdr_custom.conf
|
|
||||||
/etc/asterisk/cdr_manager.conf
|
|
||||||
/etc/asterisk/cdr_odbc.conf
|
|
||||||
/etc/asterisk/cdr_pgsql.conf
|
|
||||||
/etc/asterisk/cdr_tds.conf
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-res-musiconhold/conffiles
|
|
||||||
/etc/asterisk/musiconhold.conf
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-chan-iax2/install
|
|
||||||
$(INSTALL_DIR) $(1)/etc/asterisk
|
|
||||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/iax.conf $(1)/etc/asterisk/
|
|
||||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/iaxprov.conf $(1)/etc/asterisk/
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/chan_iax2.so $(1)/usr/lib/asterisk/modules/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-cdr/install
|
|
||||||
$(INSTALL_DIR) $(1)/etc/asterisk
|
|
||||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/cdr*.conf $(1)/etc/asterisk/
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/*cdr*.so $(1)/usr/lib/asterisk/modules/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-res-musiconhold/install
|
|
||||||
$(INSTALL_DIR) $(1)/etc/asterisk
|
|
||||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/musiconhold.conf $(1)/etc/asterisk/
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_musiconhold.so $(1)/usr/lib/asterisk/modules/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-res-voice/install
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_voice.so $(1)/usr/lib/asterisk/modules/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-chan-gtalk/conffiles
|
|
||||||
/etc/asterisk/gtalk.conf
|
|
||||||
/etc/asterisk/jabber.conf
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-chan-gtalk/install
|
|
||||||
$(INSTALL_DIR) $(1)/etc/asterisk
|
|
||||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/gtalk.conf $(1)/etc/asterisk/
|
|
||||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/jabber.conf $(1)/etc/asterisk/
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/chan_gtalk.so $(1)/usr/lib/asterisk/modules/
|
|
||||||
$(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/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-res-timing-pthread/install
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_timing_pthread.so $(1)/usr/lib/asterisk/modules/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-res-fax/conffiles
|
|
||||||
/etc/asterisk/res_fax.conf
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-res-fax/install
|
|
||||||
$(INSTALL_DIR) $(1)/etc/asterisk
|
|
||||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/res_fax.conf $(1)/etc/asterisk/
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_fax.so $(1)/usr/lib/asterisk/modules/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-res-fax-spandsp/install
|
|
||||||
$(INSTALL_DIR) $(1)/etc/asterisk
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_fax_spandsp.so $(1)/usr/lib/asterisk/modules/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-chan-mgcp/conffiles
|
|
||||||
/etc/asterisk/mgcp.conf
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-chan-mgcp/install
|
|
||||||
$(INSTALL_DIR) $(1)/etc/asterisk
|
|
||||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/mgcp.conf $(1)/etc/asterisk/
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/chan_mgcp.so $(1)/usr/lib/asterisk/modules/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-chan-skinny/conffiles
|
|
||||||
/etc/asterisk/skinny.conf
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-chan-skinny/install
|
|
||||||
$(INSTALL_DIR) $(1)/etc/asterisk
|
|
||||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/skinny.conf $(1)/etc/asterisk/
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/chan_skinny.so $(1)/usr/lib/asterisk/modules/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-chan-brcm/conffiles
|
|
||||||
/etc/asterisk/brcm.conf
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-chan-brcm/install
|
|
||||||
$(INSTALL_DIR) $(1)/etc/asterisk
|
|
||||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/brcm.conf $(1)/etc/asterisk/
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/chan_brcm.so $(1)/usr/lib/asterisk/modules/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-curl/install
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/func_curl.so $(1)/usr/lib/asterisk/modules/
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_curl.so $(1)/usr/lib/asterisk/modules/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-app-transfer/install
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/app_transfer.so $(1)/usr/lib/asterisk/modules/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-app-softhangup/install
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/app_softhangup.so $(1)/usr/lib/asterisk/modules/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-mysql/conffiles
|
|
||||||
/etc/asterisk/app_mysql.conf
|
|
||||||
/etc/asterisk/res_config_mysql.conf
|
|
||||||
/etc/asterisk/cdr_mysql.conf
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-mysql/install
|
|
||||||
$(INSTALL_DIR) $(1)/etc/asterisk
|
|
||||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/app_mysql.conf $(1)/etc/asterisk/
|
|
||||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/res_config_mysql.conf $(1)/etc/asterisk/
|
|
||||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/cdr_mysql.conf $(1)/etc/asterisk/
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/app_mysql.so $(1)/usr/lib/asterisk/modules/
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/cdr_mysql.so $(1)/usr/lib/asterisk/modules/
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_config_mysql.so $(1)/usr/lib/asterisk/modules/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-chan-lantiq/conffiles
|
|
||||||
/etc/asterisk/lantiq.conf
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-chan-lantiq/install
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
|
||||||
$(INSTALL_DIR) $(1)/etc/asterisk
|
|
||||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/lantiq.conf $(1)/etc/asterisk/
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/chan_lantiq.so $(1)/usr/lib/asterisk/modules/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-res-srtp/install
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_srtp.so $(1)/usr/lib/asterisk/modules/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-res-stun/install
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_stun_monitor.so $(1)/usr/lib/asterisk/modules/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-app-queue/install
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/app_queue.so $(1)/usr/lib/asterisk/modules/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Buildasterisk18-modModuleTemplate
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-$(subst _,-,$(1))
|
|
||||||
$$(call Package/asterisk18-mod/Default)
|
|
||||||
TITLE:=$(2) support
|
|
||||||
DEPENDS:= asterisk18-mod $(4)
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-$(subst _,-,$(1))/description
|
|
||||||
$$(call Package/asterisk18-mod/Default/description)
|
|
||||||
This package provides support $(3) in Asterisk.
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/asterisk18-mod-$(subst _,-,$(1))/install
|
|
||||||
$(INSTALL_DIR) $$(1)/usr/lib/asterisk/modules
|
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/$(1).so $$(1)/usr/lib/asterisk/modules/
|
|
||||||
endef
|
|
||||||
|
|
||||||
$$(eval $$(call BuildPackage,asterisk18-mod-$(subst _,-,$(1))))
|
|
||||||
endef
|
|
||||||
|
|
||||||
$(eval $(call BuildPackage,asterisk18-mod))
|
|
||||||
$(eval $(call BuildPackage,asterisk18-mod-voicemail))
|
|
||||||
$(eval $(call BuildPackage,asterisk18-mod-sounds))
|
|
||||||
$(eval $(call BuildPackage,asterisk18-mod-app-meetme))
|
|
||||||
$(eval $(call BuildPackage,asterisk18-mod-app-transfer))
|
|
||||||
$(eval $(call BuildPackage,asterisk18-mod-app-softhangup))
|
|
||||||
$(eval $(call BuildPackage,asterisk18-mod-chan-iax2))
|
|
||||||
$(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))
|
|
||||||
$(eval $(call BuildPackage,asterisk18-mod-res-timing-pthread))
|
|
||||||
$(eval $(call BuildPackage,asterisk18-mod-chan-mgcp))
|
|
||||||
$(eval $(call BuildPackage,asterisk18-mod-chan-skinny))
|
|
||||||
$(eval $(call BuildPackage,asterisk18-mod-chan-brcm))
|
|
||||||
$(eval $(call BuildPackage,asterisk18-mod-curl))
|
|
||||||
$(eval $(call BuildPackage,asterisk18-mod-mysql))
|
|
||||||
$(eval $(call BuildPackage,asterisk18-mod-chan-lantiq))
|
|
||||||
$(eval $(call BuildPackage,asterisk18-mod-res-srtp))
|
|
||||||
$(eval $(call BuildPackage,asterisk18-mod-res-stun))
|
|
||||||
$(eval $(call BuildPackage,asterisk18-mod-app-queue))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_authenticate,Authenticate,support for executing arbitrary authenticate commands))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_chanisavail,Channel availability check,support for checking if a channel is available))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_chanspy,Channel listen in,support for listening in on any channel))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_directed_pickup,Directed call pickup,support for directed call pickup))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_exec,Exec application,support for application execution))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_minivm,Minimal voicemail system,a voicemail system in small building blocks working together based on the Comedian Mail voicemail system))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_readexten,Extension to variable,a trivial application to read an extension into a variable))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_read,Variable read,a trivial application to read a variable))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_sayunixtime,Say Unix time,an application to say Unix time))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_sms,SMS,SMS support (ETSI ES 201 912 protocol 1)))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_stack,Stack applications, stack applications Gosub Return etc., +asterisk18-res-agi))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_system,System exec,support for executing system commands))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_talkdetect,File playback with audio detect,for file playback with audio detect))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_waituntil,Sleep,support sleeping until the given epoch))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_while,While loop,a while loop implementation))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,chan_agent,Agents proxy channel, an implementation of agents proxy channel))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,chan_local,Local proxy channel, an implementation of local proxy channel))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,codec_alaw,Signed linear to alaw translation,translation between signed linear and alaw codecs))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,codec_ulaw,Signed linear to ulaw translation,translation between signed linear and ulaw codecs))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,codec_a_mu,Alaw to ulaw translation,translation between alaw and ulaw codecs))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,codec_g722,G.722,a high bit rate 48/56/64Kbps ITU standard codec))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,codec_g726,Signed linear to G.726 translation,translation between signed linear and ITU G.726-32kbps codecs))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,codec_ilbc,iLBC,internet Low Bitrate Codec))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,codec_gsm,GSM,GSM codec))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,format_g726,G.726,support for headerless G.726 16/24/32/40kbps data format))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,format_g729,G.729,support for raw headerless G729 data))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,format_sln,Raw slinear format,support for raw slinear format))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,format_sln16,Raw slinear 16 format,support for Raw slinear 16 format))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,func_db,Database interaction,functions for interaction with the database))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,func_devstate,Blinky lights control,functions for manually controlled blinky lights))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,func_vmcount,vmcount dialplan,a vmcount dialplan function))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,func_extstate,Hinted extension state,retrieving the state of a hinted extension for dialplan control))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,func_global,Global variable,global variable dialplan functions))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,func_shell,Shell,support for shell execution))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,pbx_ael,Asterisk Extension Logic,support for symbolic Asterisk Extension Logic))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,res_ael_share,Shareable AEL code,support for shareable AEL code mainly between internal and external modules))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,pbx_spool,Call Spool,outgoing call spool support))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,res_agi,Asterisk Gateway Interface,support for the Asterisk Gateway Interface extension))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,res_crypto,Provide Crypto,Cryptographic Signature capability))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_alarmreceiver,Alarm receiver,Central Station Alarm receiver for Ademco Contact ID))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_setcallerid,Set callerid,support for setting callerid))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_verbose,Verbose logging,Verbose logging application))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,func_channel,Channel info,Channel info dialplan function))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,func_blacklist,Blacklist on callerid,looking up the callerid number and see if it is blacklisted))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_originate,Originate a call,originating an outbound call and connecting it to a specified extension or application))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,func_uri,URI encoding and decoding,Encodes and decodes URI-safe strings))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_disa,Direct Inward System Access,Direct Inward System Access))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_senddtmf,Send DTMF digits,Sends arbitrary DTMF digits))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,func_cut,CUT function,CUT function))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,res_clioriginate,Calls via CLI,Originate calls via the CLI))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_mixmonitor,Record a call and mix the audio,record a call and mix the audio during the recording))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_playtones,Playtones application,play a tone list))
|
|
||||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_record,Record sound file,to record a sound file))
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
## startup options for /etc/init.d/asterisk
|
|
||||||
|
|
||||||
ENABLE_ASTERISK="yes"
|
|
||||||
OPTIONS=""
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
#!/bin/sh /etc/rc.common
|
|
||||||
|
|
||||||
START=98
|
|
||||||
STOP=10
|
|
||||||
|
|
||||||
USE_PROCD=1
|
|
||||||
NAME=asterisk
|
|
||||||
PROG=/usr/sbin/asterisk
|
|
||||||
DEFAULT=/etc/default/asterisk
|
|
||||||
|
|
||||||
init_asterisk() {
|
|
||||||
[ -f $DEFAULT ] && . $DEFAULT
|
|
||||||
[ -d /var/run/asterisk ] || mkdir -p /var/run/asterisk
|
|
||||||
[ -d /var/log/asterisk ] || mkdir -p /var/log/asterisk
|
|
||||||
[ -d /var/spool/asterisk ] || mkdir -p /var/spool/asterisk
|
|
||||||
|
|
||||||
# does the board have a fxs relay?
|
|
||||||
local fxsRelayGpio=$(db -q get hw.board.fxsRelayGpio)
|
|
||||||
if [ "$fxsRelayGpio" != "" ]; then
|
|
||||||
/sbin/brcm_fw_tool set -x $fxsRelayGpio -p 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
service_triggers() {
|
|
||||||
procd_add_reload_trigger voice_client
|
|
||||||
}
|
|
||||||
|
|
||||||
start_service() {
|
|
||||||
init_asterisk
|
|
||||||
|
|
||||||
procd_open_instance
|
|
||||||
procd_set_param command "$PROG" -f
|
|
||||||
procd_set_param respawn
|
|
||||||
procd_close_instance
|
|
||||||
# service_start /usr/sbin/asterisk
|
|
||||||
}
|
|
||||||
|
|
||||||
reload_service() {
|
|
||||||
asterisk -rx "core reload"
|
|
||||||
asterisk -rx "dialplan reload"
|
|
||||||
asterisk -rx "brcm reload"
|
|
||||||
}
|
|
||||||
|
|
||||||
restart() {
|
|
||||||
reload
|
|
||||||
}
|
|
||||||
|
|
||||||
stop_service() {
|
|
||||||
service_stop /usr/sbin/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
|
|
||||||
}
|
|
||||||
@@ -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);
|
|
||||||
}
|
|
||||||
@@ -1,173 +0,0 @@
|
|||||||
/** Broadcom libnvram.so compatible wrapper
|
|
||||||
*
|
|
||||||
* Copyright 2012 Benjamin Larsson <benjamin@southpole.se>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "uci.h"
|
|
||||||
|
|
||||||
|
|
||||||
struct uci_context *ctx = NULL;
|
|
||||||
struct uci_ptr ptr;
|
|
||||||
int nvram_inited = 0;
|
|
||||||
int nvram_debug = 0;
|
|
||||||
|
|
||||||
/** Function prototypes are taken from bcmnvram.h Copyright Broadcom Corporation.
|
|
||||||
* Only some of the nvram_* functions exposed from libnvram.so are implemented.
|
|
||||||
* get, getall, unset, set, commit
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/* uci does not support . in the key part, replace it with _ */
|
|
||||||
|
|
||||||
static const char * filter_dots_in_string(char *key) {
|
|
||||||
int length = 0;
|
|
||||||
int i;
|
|
||||||
length = strlen(key);
|
|
||||||
for (i=0 ; i<length ; i++) {
|
|
||||||
if (key[i] == '.')
|
|
||||||
key[i] = '_';
|
|
||||||
}
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void nvram_display_section(struct uci_section *s)
|
|
||||||
{
|
|
||||||
struct uci_element *e;
|
|
||||||
struct uci_option *o;
|
|
||||||
|
|
||||||
printf("%s.%s=%s\n", s->package->e.name, s->e.name, s->type);
|
|
||||||
uci_foreach_element(&s->options, e) {
|
|
||||||
o = uci_to_option(e);
|
|
||||||
printf("%s.%s.%s=%s\n", o->section->package->e.name, o->section->e.name, o->e.name, o->v.string);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void nvram_init() {
|
|
||||||
if (!nvram_inited) {
|
|
||||||
ctx = ucix_init("broadcom");
|
|
||||||
if(!ctx) {
|
|
||||||
printf("Failed to load config file \"broadcom\"\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ucix_add_section(ctx, "broadcom", "nvram", "broadcom");
|
|
||||||
ucix_add_option(ctx, "broadcom", "nvram", "init", "1");
|
|
||||||
ucix_commit(ctx, "broadcom");
|
|
||||||
nvram_debug = ucix_get_option_int(ctx, "broadcom", "nvram", "debug");
|
|
||||||
nvram_inited = 1;
|
|
||||||
if (nvram_debug)
|
|
||||||
printf("nvram_init()\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get the value of an NVRAM variable. The pointer returned may be
|
|
||||||
* invalid after a set.
|
|
||||||
* @param name name of variable to get
|
|
||||||
* @return value of variable or NULL if undefined
|
|
||||||
*/
|
|
||||||
const char * nvram_get(const char *name) {
|
|
||||||
const char *ucitmp;
|
|
||||||
nvram_init();
|
|
||||||
ucitmp = ucix_get_option(ctx, "broadcom", "nvram", filter_dots_in_string(name));
|
|
||||||
if (nvram_debug)
|
|
||||||
printf("%s=nvram_get(%s)\n", ucitmp, name);
|
|
||||||
|
|
||||||
return ucitmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Set the value of an NVRAM variable. The name and value strings are
|
|
||||||
* copied into private storage. Pointers to previously set values
|
|
||||||
* may become invalid. The new value may be immediately
|
|
||||||
* retrieved but will not be permanently stored until a commit.
|
|
||||||
* @param name name of variable to set
|
|
||||||
* @param value value of variable
|
|
||||||
* @return 0 on success and errno on failure
|
|
||||||
*/
|
|
||||||
int nvram_set(const char *name, const char *value) {
|
|
||||||
nvram_init();
|
|
||||||
ucix_add_option(ctx, "broadcom", "nvram", filter_dots_in_string(name), value);
|
|
||||||
ucix_commit(ctx, "broadcom");
|
|
||||||
if (nvram_debug)
|
|
||||||
printf("nvram_set(%s, %s)\n", filter_dots_in_string(name), value);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Unset an NVRAM variable. Pointers to previously set values
|
|
||||||
* remain valid until a set.
|
|
||||||
* @param name name of variable to unset
|
|
||||||
* @return 0 on success and errno on failure
|
|
||||||
* NOTE: use nvram_commit to commit this change to flash.
|
|
||||||
*/
|
|
||||||
int nvram_unset(const char *name){
|
|
||||||
nvram_init();
|
|
||||||
ucix_del(ctx, "broadcom", "nvram", filter_dots_in_string(name));
|
|
||||||
ucix_commit(ctx, "broadcom");
|
|
||||||
if (nvram_debug)
|
|
||||||
printf("nvram_unset(%s)\n", filter_dots_in_string(name));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Commit NVRAM variables to permanent storage. All pointers to values
|
|
||||||
* may be invalid after a commit.
|
|
||||||
* NVRAM values are undefined after a commit.
|
|
||||||
* @return 0 on success and errno on failure
|
|
||||||
*/
|
|
||||||
int nvram_commit(void){
|
|
||||||
nvram_init();
|
|
||||||
ucix_commit(ctx, "broadcom");
|
|
||||||
if (nvram_debug)
|
|
||||||
printf("nvram_commit()\n");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get all NVRAM variables (format name=value\0 ... \0\0).
|
|
||||||
* @param buf buffer to store variables
|
|
||||||
* @param count size of buffer in bytes
|
|
||||||
* @return 0 on success and errno on failure
|
|
||||||
*/
|
|
||||||
int nvram_getall(char *nvram_buf, int count) {
|
|
||||||
nvram_init();
|
|
||||||
|
|
||||||
ptr.package = "broadcom";
|
|
||||||
ptr.section = "nvram";
|
|
||||||
|
|
||||||
if (uci_lookup_ptr(ctx, &ptr, NULL, true) != UCI_OK)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
if (!(ptr.flags & UCI_LOOKUP_COMPLETE))
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
nvram_display_section(ptr.s);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,172 +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);
|
|
||||||
}
|
|
||||||
|
|
||||||
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,41 +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__
|
|
||||||
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_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);
|
|
||||||
#endif
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
menu "Configuration"
|
|
||||||
depends on PACKAGE_compcache
|
|
||||||
|
|
||||||
config COMPCACHE_ENABLE
|
|
||||||
bool "enabled on boot"
|
|
||||||
default n
|
|
||||||
help
|
|
||||||
Enables compressed ram swap devices.
|
|
||||||
|
|
||||||
config COMPCACHE_RAM_REPORTED
|
|
||||||
string "swap space reported to kernel in kb"
|
|
||||||
default "2048"
|
|
||||||
help
|
|
||||||
This is the amount of memory that will be reported
|
|
||||||
to the kernel as swap. The real ram in use will differ,
|
|
||||||
because of lzo compression.
|
|
||||||
Example:
|
|
||||||
16 MB = 2048 KB
|
|
||||||
32 MB = 4098 KB
|
|
||||||
|
|
||||||
config COMPCACHE_BACKUP_DEV
|
|
||||||
string "Backup device for compcache"
|
|
||||||
default ""
|
|
||||||
help
|
|
||||||
Compcache will use this as a backup device for swap.
|
|
||||||
Example:
|
|
||||||
/dev/sda5
|
|
||||||
|
|
||||||
endmenu
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user