Compare commits

..

46 Commits

Author SHA1 Message Date
Anjan Chanda
69fbaebca5 easy-soc-libs: libeasy-1.0.1 2019-12-13 15:37:11 +01:00
Amin Ben Ramdhane
56d540050f tr098: 1.0-2019-12-11 2019-12-11 17:07:41 +01:00
Amin Ben Ramdhane
81f449d288 icwmp: 4.0-2019-12-11 2019-12-11 17:05:46 +01:00
Amin Ben Ramdhane
167cdf8053 icwmp: compile icwmp-tr098d binary only if CONFIG_PACKAGE_icwmp-tr098 is selected 2019-12-11 17:00:59 +01:00
Sukru Senli
da53a2ef34 bbf: correct license 2019-12-10 16:15:25 +01:00
Sukru Senli
d86322a1a7 icwmp: correct license 2019-12-10 16:15:12 +01:00
Strhuan Blomquist
be83b9b677 Delete cve-check.sh 2019-12-10 15:40:52 +01:00
Amin Ben Ramdhane
e247f50a38 bbf: 1.0-2019-12-10 2019-12-10 10:36:13 +01:00
Amin Ben Ramdhane
b71d08d543 libbfdm: add tr157 files to include repo 2019-12-10 10:09:28 +01:00
Amin Ben Ramdhane
550c0aa4b5 tr098: 1.0-2019-12-09 2019-12-09 18:11:49 +01:00
Amin Ben Ramdhane
5c7962b353 icwmp: 4.0-2019-12-07 2019-12-09 11:49:10 +01:00
Amin Ben Ramdhane
67a4246293 bbf: 1.0-2019-12-07 2019-12-09 11:46:45 +01:00
Amin Ben Ramdhane
3fbd6315a4 opkgd: add new package 2019-12-09 11:43:52 +01:00
vdutta
4143aeb032 ieee1905: 1905 meshcomms stack integration 2019-12-09 12:58:53 +05:30
Sukru Senli
f965eb801e icwmp:4.0-2019-12-02 2019-12-05 09:16:21 +01:00
Sukru Senli
5bfe6638e5 bbf: license is changed to LGPLv2.1 2019-12-04 09:55:07 +01:00
Jakob Olsson
21c21bf609 netmode: on revert write backup cfgs prior to commiting and restart network 2019-12-03 11:41:16 +01:00
Sukru Senli
abd2e29a85 icwmp-4.0-2019-12-02 2019-12-03 11:36:31 +01:00
Jakob Olsson
c0931baab2 owsd: include fix for memory leak on too many requests 2019-12-02 14:42:23 +01:00
Amin Ben Ramdhane
d515462ba9 icwmp: create a subpackage icwmp-tr098 for TR098 data model 2019-11-29 15:33:41 +01:00
Amin Ben Ramdhane
2573d76b4e icwmp: 4.0-2019-11-28 2019-11-28 23:10:53 +01:00
Amin Ben Ramdhane
e15f018362 bbf: 1.0-2019-11-11 2019-11-28 23:08:07 +01:00
Amin Ben Ramdhane
927bad6225 tr098: 1.0-2019-11-28 2019-11-28 23:06:19 +01:00
Anjan Chanda
bdcc74dca4 Update feed [ iopsys ] package [ easy-soc-libs ]
-------------------------------------------------------------------------------
* 0accbd7 libwifi: intel: show chan utilization instead of load
-------------------------------------------------------------------------------
commit 0accbd7266b2742ad8921edd5dab974fc384a49a
Author: Anjan Chanda <anjan.chanda@iopsys.eu>
Date: 2019-11-27 10:19:28 +0100

    libwifi: intel: show chan utilization instead of load

Base directory -> /
 libwifi/modules/intel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
-------------------------------------------------------------------------------
2019-11-27 10:21:45 +01:00
Anjan Chanda
d984398317 Update feed [ iopsys ] package [ easy-soc-libs ]
-------------------------------------------------------------------------------
* 429988c libwifi: mtk: implement radio info api
* 8e66b90 libwifi: add radio diagnostic struct
-------------------------------------------------------------------------------
commit 429988cbd11edab826355f01b09f0588893b550a
Author: Anjan Chanda <anjan.chanda@iopsys.eu>
Date: 2019-11-24 19:47:59 +0100

    libwifi: mtk: implement radio info api

Base directory -> /
 libwifi/modules/mtk.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++
 libwifi/modules/mtk.h | 57 ++++++++++++++++++++++++++++++++++--
 libwifi/wifi.h        | 35 ++++++++--------------
 3 files changed, 148 insertions(+), 25 deletions(-)
-------------------------------------------------------------------------------
commit 8e66b90aeadf95dd69dfc7e067e06073039e87c0
Author: Anjan Chanda <anjan.chanda@iopsys.eu>
Date: 2019-11-22 16:45:41 +0100

    libwifi: add radio diagnostic struct

Base directory -> /
 libwifi/modules/mtk.c |  9 +++++++++
 libwifi/modules/mtk.h | 14 ++++++++++++++
 libwifi/wifi.h        | 18 +++++++++++-------
 3 files changed, 34 insertions(+), 7 deletions(-)
-------------------------------------------------------------------------------
2019-11-26 10:25:41 +01:00
Anjan Chanda
b78bb9d152 Update feed [ iopsys ] package [ wifimngr ]
-------------------------------------------------------------------------------
* 4b876cc show basic and supported rates in radio status
* aad1a26 add radio info details including diagnostics
-------------------------------------------------------------------------------
commit 4b876ccabc1df73202bfb165b35fd6464ed019aa
Author: Anjan Chanda <anjan.chanda@iopsys.eu>
Date: 2019-11-25 16:54:49 +0100

    show basic and supported rates in radio status

Base directory -> /
 wifimngr.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
-------------------------------------------------------------------------------
commit aad1a26637b7a1429022d172af43847b2d28ae1c
Author: Anjan Chanda <anjan.chanda@iopsys.eu>
Date: 2019-11-24 19:54:31 +0100

    add radio info details including diagnostics

Base directory -> /
 wifimngr.c | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 74 insertions(+), 16 deletions(-)
-------------------------------------------------------------------------------
2019-11-26 10:25:19 +01:00
Yalu Zhang
a652b67d04 Change line/channel names from tapi/1 and tapi/2 to tapi/0 and tapi1
Unsupported lines/channes like TAPI/[2-6], BRCM/6 are also removed.

This change has the following benefits.
- To simplify the line/channel name handling in /etc/init.d/voice_client
- To have the consistent implementation both on Intel and on Broadcom platforms

(cherry picked from commit 40c426ca09)
2019-11-25 16:17:18 +01:00
vdutta
0f85c77d41 meshcomms: Optimize meshcomms library 2019-11-15 17:44:19 +05:30
vdutta
2a2d942329 meshcomms: Remove compile time Endianness dependency 2019-11-15 13:26:32 +05:30
Anjan Chanda
db2cbd0db2 Update feed [ iopsys ] package [ easy-soc-libs ]
-------------------------------------------------------------------------------
* edaace5 libwifi: intel: fix bss utilization and sta count
-------------------------------------------------------------------------------
commit edaace5a36b0dcac66a0371b40a2bc7ed99b4119
Author: Anjan Chanda <anjan.chanda@iopsys.eu>
Date: 2019-11-14 12:24:35 +0100

    libwifi: intel: fix bss utilization and sta count

Base directory -> /
 libwifi/modules/intel.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
-------------------------------------------------------------------------------
2019-11-14 12:32:13 +01:00
vdutta
210bbb570b meshcomms: Add dynamic meshcomms library 2019-11-12 13:47:12 +05:30
Anjan Chanda
b4f129d582 Update feed [ iopsys ] package [ wifixd ]
-------------------------------------------------------------------------------
* cd63143 supported hwmode does not depend on current hwmode
-------------------------------------------------------------------------------
commit cd63143c262e079d4a782ccfa60111f342e42e3e
Author: Anjan Chanda <anjan.chanda@iopsys.eu>
Date: 2019-11-11 12:56:13 +0100

    supported hwmode does not depend on current hwmode

Base directory -> /
 wifimngr.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
-------------------------------------------------------------------------------
2019-11-11 12:59:20 +01:00
Anjan Chanda
34548bd901 Update feed [ iopsys ] package [ easy-soc-libs ]
-------------------------------------------------------------------------------
* d4e760c libwifi: intel: get maxassoc and hidden info in wifi_ap_info
* 703ce26 libwifi: bcm: get maxassoc and hidden info in wifi_ap_info
-------------------------------------------------------------------------------
commit d4e760c73a600749325b2cc6d5554696a6c956f8
Author: Anjan Chanda <anjan.chanda@iopsys.eu>
Date: 2019-11-11 12:25:32 +0100

    libwifi: intel: get maxassoc and hidden info in wifi_ap_info

Base directory -> /
 libwifi/modules/intel.c | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)
-------------------------------------------------------------------------------
commit 703ce26a3e884937ea520c624ee27b88d0991367
Author: Anjan Chanda <anjan.chanda@iopsys.eu>
Date: 2019-11-11 11:34:53 +0100

    libwifi: bcm: get maxassoc and hidden info in wifi_ap_info

Base directory -> /
 libwifi/modules/bcm.c | 30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)
-------------------------------------------------------------------------------
2019-11-11 12:32:24 +01:00
Jakob Olsson
fe47b9a923 questd: print port speed when link is down #571 2019-11-08 14:24:42 +01:00
Ronny Nilsson
0edeb78d60 endptmngr: support parallell build. 2019-11-07 16:48:34 +01:00
Ronny Nilsson
05b8383f62 voice: modified dependencies again. Turns out we need both the old ones AND the new ones
Due to there are TWO dependency systems(!?). One for Kconfig and one for Make. And they
don't cooperate as good as one expects.
2019-11-07 16:48:00 +01:00
Strhuan Blomquist
3a6d301cfe added RTX to licenses info 2019-11-07 16:20:13 +01:00
Strhuan Blomquist
44bf5a6c33 added more info to PROPRIETARY tag 2019-11-07 16:18:10 +01:00
Kenneth Johansson
0f744a5cda genconfig: mirror var is CONFIG_LOCALMIRROR.
To get the use of the mirror to work.
2019-11-07 15:40:52 +01:00
Jakob Olsson
a8c7c8989f questd: relocate locks and move dump client invokes 2019-11-07 15:25:45 +01:00
Anjan Chanda
f14dc75e71 Update feed [ iopsys ] package [ wifimngr ]
-------------------------------------------------------------------------------
* 939b0ae rename 11xx_ caps to dot11xx_
* 381cd70 wifi_sta_disconnect() accepts macaddress in bytes
-------------------------------------------------------------------------------
commit 939b0ae989979a1ad1942373791fe230bc3e41ca
Author: Anjan Chanda <anjan.chanda@iopsys.eu>
Date: 2019-10-29 16:47:55 +0100

    rename 11xx_ caps to dot11xx_

Base directory -> /
 wifimngr.c | 144 ++++++++++++++++++-------------------------------------------
 1 file changed, 41 insertions(+), 103 deletions(-)
-------------------------------------------------------------------------------
commit 381cd70238230aa7fc56b85369f265272698165f
Author: Anjan Chanda <anjan.chanda@iopsys.eu>
Date: 2019-09-23 09:26:41 +0200

    wifi_sta_disconnect() accepts macaddress in bytes

Base directory -> /
 wifimngr.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
-------------------------------------------------------------------------------
2019-11-07 13:35:04 +01:00
Anjan Chanda
a218fa0130 libwifix: mtk: fix encryption type 2019-11-07 13:23:59 +01:00
Anjan Chanda
d21057904b Update feed [ iopsys ] package [ easy-soc-libs ]
-------------------------------------------------------------------------------
* 3ddc5af libwifi: mtk: fix cipher type in get_security
-------------------------------------------------------------------------------
commit 3ddc5af4c29e98c14424fd5d7ef15f72d31b53dc
Author: Anjan Chanda <anjan.chanda@iopsys.eu>
Date: 2019-11-07 12:01:54 +0100

    libwifi: mtk: fix cipher type in get_security

Base directory -> /
 libwifi/modules/mtk.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
-------------------------------------------------------------------------------
2019-11-07 13:14:13 +01:00
Sukru Senli
69aaece76b bbf: bump version to 1.0-2019-11-05 2019-11-07 12:51:50 +01:00
vdutta
167bfd2e49 easy_qos: Mark packets with iptables and classcfg 2019-11-06 15:21:45 +05:30
Sukru Senli
5ac828fc16 easy-qos: use prerouting chain instead of output 2019-11-06 08:28:26 +01:00
423 changed files with 20147 additions and 16588 deletions

View File

@@ -24,7 +24,6 @@ PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/mediatek/ated.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)

View File

@@ -1,31 +1,27 @@
config BBF_VENDOR_EXTENSION
bool "Enable Vendor Extension"
if PACKAGE_libbbfdm
config LIBBBFDM_VENDOR_PREFIX
string "Vendor Prefix"
default "X_IOPSYS_EU_"
config BBF_TR181
bool "Compile with tr181 device features"
default y
config BBF_VENDOR_LIST
string "Vendor List"
default "iopsys"
config BBF_VENDOR_PREFIX
string "Vendor Prefix"
default "X_IOPSYS_EU_"
config BBF_TR104
bool "Enable TR-104 Data Model Support"
bool "Compile with tr104 voice features"
default y
config BBF_TR143
bool "Enable TR-143 Data Model Support"
bool "Compile with tr143 diagnostics features"
default y
config BBFDM_ENABLE_JSON_PLUGIN
bool "Enable json plugin to extend datamodel"
config BBF_TR157
bool "Compile with tr157 bulkdata collector features"
default y
config BBF_TR064
bool "Compile with tr064 features"
default n
config BBFDM_ENABLE_DOTSO_PLUGIN
bool "Enable shared library plugin to extend datamodel"
default y
config BBF_MAX_OBJECT_INSTANCES
int "Maximum number of instances per object"
default 255
endif

View File

@@ -1,181 +1,89 @@
#
# Copyright (C) 2022 IOPSYS
# Copyright (C) 2019 IOPSYS
#
include $(TOPDIR)/rules.mk
PKG_NAME:=libbbfdm
PKG_VERSION:=6.8.9.37
PKG_VERSION:=1.0-2019-12-10
PKG_FIXUP:=autoreconf
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/bbf.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/bbfdm.git
PKG_SOURCE_VERSION:=925a6ee278d827edf6a57715463263394eddac21
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
PKG_SOURCE_VERSION:=0ea0b2c89a51ad56ca76d171b7fd5dcf38e102cd
PKG_RELEASE=$(PKG_SOURCE_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_LICENSE:=LGPL-2.1
PKG_LICENSE_FILES:=LICENSE
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
define Package/libbbf_api
SECTION:=utils
CATEGORY:=Utilities
SUBMENU:=TRx69
TITLE:=Library for libbbfdm API
endef
define Package/libbbfdm/default
SECTION:=utils
CATEGORY:=Utilities
SUBMENU:=TRx69
TITLE:=Library for broadband forum data model support
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libtrace +libcurl
endef
define Package/libbbfdm
$(Package/libbbfdm/default)
TITLE += (internal)
VARIANT:=internal
endef
define Package/libbbfdm-mbedtls
$(Package/libbbfdm/default)
TITLE += (mbedtls)
DEPENDS += +PACKAGE_libbbfdm-mbedtls:libmbedtls
VARIANT:=mbedtls
DEFAULT_VARIANT:=1
endef
define Package/libbbfdm-openssl
$(Package/libbbfdm/default)
TITLE += (openssl)
DEPENDS += +PACKAGE_libbbfdm-openssl:libopenssl
CONFLICTS := libbbfdm-mbedtls
VARIANT:=openssl
endef
define Package/libbbfdm-wolfssl
$(Package/libbbfdm/default)
TITLE += (wolfssl)
DEPENDS += +PACKAGE_libbbfdm-wolfssl:libwolfssl
CONFLICTS := libbbfdm-mbedtls libbbfdm-openssl
VARIANT:=wolfssl
SECTION:=libs
CATEGORY:=Libraries
TITLE:=Library for broadband-forum data model
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libtrace
endef
define Package/libbbfdm/config
source "$(SOURCE)/Config_bbfdm.in"
endef
define Package/libbbf_api/description
Library contains the API(UCI, UBUS, JSON, CLI and Browse) of libbbfdm
endef
define Package/libbbfdm/description
Library contains the data model tree. It includes TR181, TR104 and TR143 data models
Test description will update later.
endef
USE_LOCAL=$(shell ls ./src/ 2>/dev/null >/dev/null && echo 1)
ifneq ($(USE_LOCAL),)
define Build/Prepare
$(CP) ./src/* $(PKG_BUILD_DIR)/
endef
TARGET_CFLAGS += -DCUSTOM_PREFIX=\\\"$(CONFIG_LIBBBFDM_VENDOR_PREFIX)\\\"
TARGET_CFLAGS += \
-D_GNU_SOURCE -D_AADJ
ifeq ($(CONFIG_BBF_TR181),y)
CONFIGURE_ARGS += \
--enable-tr181
endif
CMAKE_OPTIONS += \
-DBBF_TR181=ON
ifeq ($(CONFIG_BBF_TR104),y)
CMAKE_OPTIONS += \
-DBBF_TR104=ON
CONFIGURE_ARGS += \
--enable-tr104
endif
ifeq ($(CONFIG_BBF_TR143),y)
CMAKE_OPTIONS += \
-DBBF_TR143=ON
CONFIGURE_ARGS += \
--enable-tr143
endif
ifeq ($(CONFIG_BBF_VENDOR_EXTENSION),y)
CMAKE_OPTIONS += \
-DBBF_VENDOR_EXTENSION=ON
CMAKE_OPTIONS += \
-DBBF_VENDOR_LIST:String="$(CONFIG_BBF_VENDOR_LIST)" \
-DBBF_VENDOR_PREFIX:String="$(CONFIG_BBF_VENDOR_PREFIX)" \
-DBBF_MAX_OBJECT_INSTANCES:Integer=$(CONFIG_BBF_MAX_OBJECT_INSTANCES)
endif ##CONFIG_BBF_VENDOR_EXTENSION
ifeq ($(CONFIG_BBFDM_ENABLE_JSON_PLUGIN),y)
CMAKE_OPTIONS += \
-DBBF_JSON_PLUGIN=ON
ifeq ($(CONFIG_BBF_TR157),y)
CONFIGURE_ARGS += \
--enable-tr157
endif
ifeq ($(CONFIG_BBFDM_ENABLE_DOTSO_PLUGIN),y)
CMAKE_OPTIONS += \
-DBBF_DOTSO_PLUGIN=ON
ifeq ($(CONFIG_BBF_TR064),y)
CONFIGURE_ARGS += \
--enable-tr064
endif
ifeq ($(BUILD_VARIANT),openssl)
CMAKE_OPTIONS += -DWITH_OPENSSL=ON
endif
ifeq ($(BUILD_VARIANT),wolfssl)
CMAKE_OPTIONS += -DWITH_WOLFSSL=ON
endif
ifeq ($(BUILD_VARIANT),mbedtls)
CMAKE_OPTIONS += -DWITH_MBEDTLS=ON
endif
define Package/libbbf_api/install
define Package/libbbfdm/install
$(INSTALL_DIR) $(1)/lib
endef
define Package/libbbfdm/default/install
$(INSTALL_DIR) $(1)/lib
$(INSTALL_DIR) $(1)/usr/share/bbfdm
$(CP) $(PKG_BUILD_DIR)/bin/.libs/libbbfdm.so* $(1)/lib/
$(INSTALL_DIR) $(1)/etc/bbfdm
$(INSTALL_DIR) $(1)/etc/bbfdm/dmmap
$(INSTALL_DIR) $(1)/etc/bbfdm/json
$(INSTALL_DIR) $(1)/usr/lib/bbfdm
$(INSTALL_DIR) $(1)/usr/libexec/rpcd
$(CP) $(PKG_BUILD_DIR)/libbbfdm.so $(1)/lib/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/* $(1)/usr/share/bbfdm
$(LN) /usr/share/bbfdm/bbf.diag $(1)/usr/libexec/rpcd/bbf.diag
$(INSTALL_CONF) $(PKG_BUILD_DIR)/config/dmmap $(1)/etc/bbfdm
$(INSTALL_DIR) $(1)/usr/share/bbfdm
$(CP) $(PKG_BUILD_DIR)/scripts/functions $(1)/usr/share/bbfdm
endef
define Package/libbbfdm/default/prerm
#!/bin/sh
rm -rf /etc/bbfdm/dmmap/*
exit 0
endef
Package/libbbfdm-openssl/prerm = $(Package/libbbfdm/default/prerm)
Package/libbbfdm-wolfssl/prerm = $(Package/libbbfdm/default/prerm)
Package/libbbfdm-mbedtls/prerm = $(Package/libbbfdm/default/prerm)
Package/libbbfdm-openssl/install = $(Package/libbbfdm/default/install)
Package/libbbfdm-wolfssl/install = $(Package/libbbfdm/default/install)
Package/libbbfdm-mbedtls/install = $(Package/libbbfdm/default/install)
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DIR) $(1)/usr/include
$(INSTALL_DIR) $(1)/usr/include/libbbfdm
$(INSTALL_DIR) $(1)/usr/include/libbbf_api
$(INSTALL_DATA) $(PKG_BUILD_DIR)/include/*.h $(1)/usr/include/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/*.h $(1)/usr/include/libbbfdm/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libbbf_api/*.h $(1)/usr/include/libbbf_api/
$(CP) $(PKG_BUILD_DIR)/libbbfdm.so $(1)/usr/lib/
touch $(1)/usr/lib/libbbf_api.so
$(CP) $(PKG_BUILD_DIR)/*.h $(1)/usr/include/libbbfdm/
$(CP) $(PKG_BUILD_DIR)/dmtree/tr181/*.h $(1)/usr/include/libbbfdm/
$(CP) $(PKG_BUILD_DIR)/dmtree/tr157/*.h $(1)/usr/include/libbbfdm/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/bin/.libs/libbbfdm.{a,so*} $(1)/usr/lib/
endef
$(eval $(call BuildPackage,libbbf_api))
$(eval $(call BuildPackage,libbbfdm))
$(eval $(call BuildPackage,libbbfdm-openssl))
$(eval $(call BuildPackage,libbbfdm-wolfssl))
$(eval $(call BuildPackage,libbbfdm-mbedtls))

View File

@@ -1,58 +0,0 @@
#
# Copyright (C) 2022 iopsys Software Solutions AB
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=bulkdata
PKG_VERSION:=2.0.3.1
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/bulkdata.git
PKG_SOURCE_VERSION:=33a6648de9ee0af33c44518656b56b0a30b6c1ab
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_LICENSE:=GPL-2.0-only
PKG_LICENSE_FILES:=LICENSE
PKG_BUILD_DEPENDS:=bbf
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)
SECTION:=utils
CATEGORY:=Utilities
SUBMENU:=TRx69
TITLE:=BBF BulkData Collection
DEPENDS:=+libubus +libuci +libubox +libjson-c +libcurl +libblobmsg-json
endef
TARGET_CFLAGS += \
-D_GNU_SOURCE \
-Wall -Werror
ifeq ($(LOCAL_DEV),1)
define Build/Prepare
$(CP) -rf ~/git/bulkdata/* $(PKG_BUILD_DIR)/
endef
endif
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bulkdatad $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/usr/lib/bbfdm
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bbf_plugin/*.so $(1)/usr/lib/bbfdm
$(CP) ./files/* $(1)/
endef
$(eval $(call BuildPackage,$(PKG_NAME)))

View File

@@ -1,6 +0,0 @@
config bulkdata 'bulkdata'
option enable '0'
#Log levels: Error=1, Warning=2, Info=3, Debug=4
option log_level '3'

View File

@@ -1,34 +0,0 @@
#!/bin/sh /etc/rc.common
START=99
STOP=10
USE_PROCD=1
PROG="/usr/sbin/bulkdatad"
start_service() {
local enable=$(uci -q get bulkdata.bulkdata.enable)
[ "$enable" != "1" ] && {
return 0
}
procd_open_instance
procd_set_param command "$PROG"
procd_set_param respawn "3" "7" "0"
procd_close_instance
}
boot() {
start
}
reload_service() {
stop
start
}
service_triggers()
{
procd_add_reload_trigger bulkdata
}

View File

@@ -1,75 +0,0 @@
#!/bin/sh
. /lib/functions.sh
PROFILE_COUNT=1
get_next_count()
{
local config="$1"
local default_name="${2}"
local count=${3}
local found=0
if [ -z "$count" ]; then
count=1
fi
while [ "${found}" -ne 1 ]; do
uci -q get ${config}.${default_name}_${count} >/dev/null
if [ $? -eq 0 ]; then
count=$((count + 1))
else
found=1;
fi
done
echo "${default_name}_${count}"
}
translate_profile_id_to_profile_name() {
local section="${1}"
local profile_id="${2}"
local profile_name="${3}"
local curr_profile_id
config_get curr_profile_id "${section}" profile_id
[ -n "${curr_profile_id}" ] || return
[ "${curr_profile_id}" != "${profile_id}" ] && return
uci -q set bulkdata.${section}.profile_name="${profile_name}"
uci -q set bulkdata.${section}.profile_id=""
}
update_profile_sections() {
local section="${1}"
local default="${2}"
local profile_name
config_get profile_id "${section}" profile_id
[ -n "${profile_id}" ] || return
case "${section}" in
"cfg"*)
profile_name="$(get_next_count bulkdata ${default} ${PROFILE_COUNT})"
uci_rename bulkdata "${section}" "${profile_name}"
;;
esac
PROFILE_COUNT=$((PROFILE_COUNT + 1))
[ -n "$profile_name" ] && section="${profile_name}"
uci -q set bulkdata.${section}.profile_id=""
config_foreach translate_profile_id_to_profile_name profile_parameter "${profile_id}" "${profile_name}"
config_foreach translate_profile_id_to_profile_name profile_http_request_uri_parameter "${profile_id}" "${profile_name}"
}
config_load bulkdata
config_foreach update_profile_sections profile profile
uci commit bulkdata
exit 0

View File

@@ -1,38 +0,0 @@
#
# Copyright (C) 2019 IOPSYS
#
include $(TOPDIR)/rules.mk
PKG_NAME:=bulut
PKG_VERSION:=0.2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/bulut/bulut-gw-client.git
PKG_SOURCE_VERSION:=227700c44817afa2c392fa08bf4cf70fa6177f01
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
define Package/bulut
CATEGORY:=Utilities
DEPENDS:=
TITLE:=bulut
endef
TARGET_CFLAGS += \
-I$(STAGING_DIR)/usr/include
define Package/bulut/description
obuspa keys
endef
define Package/bulut/install
$(CP) $(PKG_BUILD_DIR)/files/* $(1)/
endef
$(eval $(call BuildPackage,bulut))

View File

@@ -1,4 +1,7 @@
#!/bin/sh /etc/rc.common
#
# Copyright (C) 2015 inteno.org
#
START=71
USE_PROCD=1

40
crashlog/Makefile Normal file
View File

@@ -0,0 +1,40 @@
#
# Copyright (C) 2019 iopsys Software Solutions AB
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=crashlog
PKG_VERSION:=1.0.0
PKG_RELEASE:=1
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
PKG_LICENSE:=GPLv2
PKG_LICENSE_FILES:=none
include $(INCLUDE_DIR)/package.mk
define Package/crashlog
CATEGORY:=Utilities
TITLE:=Handling kernel crash logs
endef
define Package/crashlog/description
Handling kernel crash logs.
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) ./files/* $(PKG_BUILD_DIR)/
endef
define Build/Compile
endef
define Package/crashlog/install
$(CP) ./files/* $(1)/
endef
$(eval $(call BuildPackage,crashlog))

Binary file not shown.

View File

@@ -0,0 +1,11 @@
#!/bin/sh /etc/rc.common
START=01
start()
{
if [ -e /proc/sys/kernel/core_pattern ]
then
echo "|/sbin/logcore %e %s" > /proc/sys/kernel/core_pattern
fi
}

View File

@@ -0,0 +1,56 @@
#!/bin/sh /etc/rc.common
START=99
send_log()
{
nr=$(db get hw.board.serialNumber)
hw=$(db get hw.board.hardware)
hwv=$(db get hw.board.hardwareVersion)
bid=$(db get hw.board.boardId)
sw=$(db get hw.board.iopVersion)
server=$(/sbin/uci get system.crashlog.server)
while true
do
scp -S /usr/sbin/logssh /proc/last_kmsg log@${server}:log/${bid}_${hwv}_${hw}_${sw}_${nr}
if [ $? == 0 ]
then
break;
fi
# wait for another minute then try again
sleep 60
done
}
fill_in_default()
{
/sbin/uci add system log
/sbin/uci rename system.@log[-1]=crashlog
/sbin/uci set system.crashlog.enable=no
/sbin/uci set system.crashlog.server="crash.inteno.se"
/sbin/uci commit
}
boot()
{
# is crashlog enabled ?
enable=$(/sbin/uci get system.crashlog.enable)
case $enable in
0|no|NO|false|FALSE)
exit 0
;;
"")
fill_in_default
exit 0
;;
esac
# is this boot a result from a crash ?
reason=$(cat /etc/boot_reason)
case $reason in
HW|WD)
send_log&
;;
esac
}

61
crashlog/files/sbin/logcore Executable file
View File

@@ -0,0 +1,61 @@
#! /bin/sh
TMP_CORE=/tmp/new_core
# first test if we can contact the log server.
# if not abort directly the core file takes up memory
alive()
{
ping -c1 $server
if [ $? != 0 ]
then
# drain core file from kernel
cat >/dev/null
exit 0
fi
}
fill_in_default()
{
/sbin/uci add system log
/sbin/uci rename system.@log[-1]=corelog
/sbin/uci set system.corelog.enable=no
/sbin/uci set system.corelog.server="crash.inteno.se"
/sbin/uci commit
}
# is corelog enabled ?
enable=$(/sbin/uci get system.corelog.enable)
case $enable in
0|no|NO|false|FALSE)
# drain core file from kernel
cat >/dev/null
exit 0
;;
"")
fill_in_default
exit 0
;;
esac
server=$(/sbin/uci get system.corelog.server)
alive
# dump out the core to disk we need this as scp needs a size before we send data
# and this is the only way to know how much data there is
cat >$TMP_CORE
# in case filesystem/memory is full at least kill the core in the kernel memory should give us some
# more memory to work with. normally this would do nothing.
cat >/dev/null
nr=$(db get hw.board.serialNumber)
hw=$(db get hw.board.hardware)
hwv=$(db get hw.board.hardwareVersion)
bid=$(db get hw.board.boardId)
sw=$(db get hw.board.iopVersion)
scp -S /usr/sbin/logssh $TMP_CORE log@${server}:log/core_${1}_${2}_${bid}_${hwv}_${hw}_${sw}_${nr}
rm $TMP_CORE

6
crashlog/files/usr/sbin/logssh Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/sh
# we need to have the -y option to dropbear to not halt the scp when
# transfering the log file to a new server for the first time.
# since we already need this also put in the keyfile
ssh -y -i /etc/dropbear/logid $@

42
crashlog/readme Normal file
View File

@@ -0,0 +1,42 @@
Install scp server.
Create a user account on a server and make sure it's possible to login to it
using ssh.
For now the user has to be called "log"
USER is the user name of the account
HOME is the user home directory.
Both should be changed to the correct value in all following example commands.
create HOME/bin
Put scp_upload in HOME/bin
make it executable "chmod a+x HOME/bin/scp_upload"
create home/.ssh (observer the dot .shh)
create an empty file HOME/.ssh/authorized_keys
-------------------------------
Now everyhting is setup for use but we have not added any clients.
What we need is the public key for the clients.
For dropbear "dropbearkey -y -f files/etc/dropbear/logid" will generate the public key.
----------
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCwn9RaDAzxW1dTmIhXgFBnpi1lhj8xhYpCVQiPxxdk9IEmH8zjo4y9j3sPkqKOlRnkwjpZIpLEKBnpQTwVIMCU/AG7nDJX3OH9RfS9mLJQLfFL8HyGCyqDezFWldbyovhJZvdUeK4tAXJWv2W3OVHiz2L8IlncBgP/E9DJElsyhhQHsM96UE6tBkXsvXkoDbMSYXFcLbgiUwBKfmM2BF/aPDL45iznGur7/2j9v95PwJ0gtMu9jjNRq+pXCXhTh3bsnczm0MpZC1aiRc9nJAeGIMmhrf15E4jBKgTnrstzJxGVAdajKeR954KcNsS33cS2Wmui2YjmPbBXjqf1frzJ log@inteno
----------
The public key should be just one line. Add that line to the
HOME/.ssh/authorized_keys file on the scp server. Then add the follwoing as
the first text on the same line. that is insert before the key data.
command="HOME/bin/scp_upload",no-port-forwarding,no-agent-forwarding,no-X11-forwarding
Do not forget to change HOME to the correct value for the server and there
should be one space separating the key data and the above text.
---------------------------------
Now test to make sure that you can upload new files, not download files
and not overwrite files from the client.

53
crashlog/scp_upload Normal file
View File

@@ -0,0 +1,53 @@
#! /bin/bash
# authorized_keys command="/home/boxi/my_scp",no-port-forwarding,no-agent-forwarding,no-X11-forwarding
val=`expr match "$SSH_ORIGINAL_COMMAND" "scp"`
if [ $val != 3 ]
then
echo "only scp is allowed for this rsa key"
exit 1
fi
#strip out "scp" as getopts barf on anything not an option
args=${SSH_ORIGINAL_COMMAND:3}
# we must set args to positional paramters otherwise it's next to impossible
# to get to the rest of the line that is not arguments.
set -- $args
while getopts "rftdvpq" Option
do
case $Option in
r ) echo "recursive not allowed";exit 1;;
f ) echo "reading files not allowed";exit 1;;
t ) ;;
d ) ;;
v ) ;;
p ) ;;
q ) ;;
* ) ;; # Default.
esac
done
shift $(($OPTIND - 1))
file="$*"
dir=$(dirname "$file")
if [ "$dir" != "log" ]
then
echo "only allowed to write to log/"
exit 1
fi
# try to create uniq files
EXTRA=$((0))
while [ -e "${file}_${EXTRA}" ]
do
EXTRA=$((EXTRA +1))
done
logger -t scp_upload "${SSH_ORIGINAL_COMMAND}_${EXTRA}"
exec ${SSH_ORIGINAL_COMMAND}_${EXTRA}

View File

@@ -1,11 +0,0 @@
if PACKAGE_dectmngr
menu "Configuration"
config ENABLE_LINE_SETTINGS_EXTENSION
bool "Enable Line Settings List extension "
default y
endmenu
endif

View File

@@ -1,74 +0,0 @@
#
# Copyright (C) 2021 IOPSYS Software Solutions AB
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=dectmngr
PKG_RELEASE:=3
PKG_VERSION:=3.5.9
LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/dectmngr.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=eecab9a6d52bba25dd9dfab8616b6d30e0346e18
PKG_MIRROR_HASH:=skip
endif
PKG_LICENSE:=PROPRIETARY
PKG_LICENSE_FILES:=LICENSE
RSTRIP:=true
export BUILD_DIR
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)
CATEGORY:=Utilities
TITLE:=DECT Manager
DEPENDS:= +libubox +ubus +uci +libxml2 +libjson-c
endef
define Package/$(PKG_NAME)/description
DECT manager is a daemon that provides UBUS RPC objects and sends UBUS events for communication with the DECT chip.
endef
define Package/$(PKG_NAME)/config
source "$(SOURCE)/Config.in"
endef
ifeq ($(LOCAL_DEV),1)
define Build/Prepare
rsync -av --exclude=.* ~/git/voip/dectmngr/* $(PKG_BUILD_DIR)/
endef
endif
TARGET_CFLAGS += \
-Wall \
-Werror \
-I$(STAGING_DIR)/usr/include/libxml2
ifeq ($(CONFIG_ENABLE_LINE_SETTINGS_EXTENSION),y)
TARGET_CFLAGS += -DENABLE_LINE_SETTINGS_EXTENSION
endif
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_DIR) $(1)/etc
$(INSTALL_DIR) $(1)/lib/upgrade/keep.d
$(INSTALL_BIN) $(PKG_BUILD_DIR)/app/dectmngr $(1)/usr/sbin/
$(STRIP) $(1)/usr/sbin/dectmngr
$(CP) ./files/etc/* $(1)/etc/
$(INSTALL_DATA) ./files/lib/upgrade/keep.d/dect $(1)/lib/upgrade/keep.d/dect
endef
$(eval $(call BuildPackage,$(PKG_NAME)))

View File

@@ -1,3 +0,0 @@
config dect 'global'
option log_dect_cmbs 'syslog'
option log_level 'realtime,warning,error'

Binary file not shown.

View File

@@ -1,100 +0,0 @@
#!/bin/sh /etc/rc.common
source /lib/functions/uci-defaults.sh
START=70
STOP=12
USE_PROCD=1
NAME=dectmngr
PROG=/usr/sbin/dectmngr
LOG_PATH=/var/log/dectmngr
DB_PATH=/etc/dect
DECT_GPIO=$(db -q get hw.board.dect_gpio)
# Ask dectmngr to exit nicely and wait for it to clean up, which is a slow process.
stop_and_wait_dectmngr() {
pidof $NAME && killall -q $NAME
pidof $NAME && sleep 2 # wait for the process to stop gracefully
while pidof $NAME; do
killall -q -9 $NAME
sleep 1
done
}
start_service() {
local opt_ext=
local rfpi=
local model_id=
local rxtun=
test $(db get hw.board.hasDect) = "0" && return
[ -n "$DECT_GPIO" ] && echo 1 > /sys/class/gpio/gpio${DECT_GPIO}/value
rfpi=$(db -q get hw.board.dect_rfpi)
[ -n "$rfpi" -a ${#rfpi} -eq 14 ] && opt_ext="$opt_ext -rfpi $rfpi"
model_id=$(db -q get hw.board.dect_model_id)
[ -n "$model_id" -a ${#model_id} -eq 8 ] || {
echo "Invalid hw.board.dect_model_id:$model_id. Set to 30.3B.06"
model_id="30.3B.06"
}
opt_ext="$opt_ext -model $model_id"
rxtun=$(db -q get hw.board.dect_rxtun)
[ -n "$rxtun" -a ${#rxtun} -eq 2 ] && opt_ext="$opt_ext -rxtun $rxtun"
config_load dect
config_get log_dect_cmbs global log_dect_cmbs syslog
procd_open_instance
if [ "$log_dect_cmbs" = "none" ]; then
echo "Starting dectmngr with cmbs logging disabled"
procd_set_param command $PROG -comname ttyH0 $opt_ext
rm -f $LOG_PATH/*
elif [ "$log_dect_cmbs" = "file" ]; then
echo "Starting dectmngr with cmbs logging enabled to file"
procd_set_param command $PROG -comname ttyH0 -log $LOG_PATH/dect-cmbs.log $opt_ext
else
echo "Starting dectmngr with cmbs logging enabled to syslog"
procd_set_param command $PROG -comname ttyH0 -syslog $opt_ext
rm -f $LOG_PATH/*
fi
procd_set_param respawn 6 2 3
procd_set_param term_timeout 20
procd_set_param triggers asterisk
procd_close_instance
}
stop_service() {
test $(db get hw.board.hasDect) = "0" && return
[ -n "$DECT_GPIO" ] && echo 0 > /sys/class/gpio/gpio${DECT_GPIO}/value
stop_and_wait_dectmngr
}
reload_service() {
ubus call dect reload
}
service_triggers()
{
procd_add_config_trigger "config.change" "asterisk" /etc/init.d/dectmngr restart
procd_add_config_trigger "config.change" "dect" /etc/init.d/dectmngr reload
}
boot() {
[ -n "$DECT_GPIO" ] && {
echo ${DECT_GPIO} > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio${DECT_GPIO}/direction
}
[ ! -d $LOG_PATH ] && mkdir -p $LOG_PATH
[ ! -d $DB_PATH ] && mkdir -p $DB_PATH
start
}

View File

@@ -1 +0,0 @@
/etc/dect/LA_DB

57
dectmngr2/Makefile Normal file
View File

@@ -0,0 +1,57 @@
#
# Copyright (C) 2019 iopsys Software Solutions AB
#
# 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.3.0
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/dectmngr.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=2c8990fd5275d469e8ab6c7a99e17fe0a56052ea
PKG_NAME:=dectmngr2
PKG_LICENSE:=GPLv2
PKG_LICENSE_FILES:=LICENSE
RSTRIP:=true
export BUILD_DIR
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk
define Package/dectmngr2
CATEGORY:=Utilities
TITLE:=Dectmngr2
URL:=
DEPENDS:= +natalie-dect-h +PACKAGE_bcmkernel:bcmkernel +PACKAGE_bcmopen:bcmopen @(PACKAGE_bcmkernel||PACKAGE_bcmopen) +libubox +ubus +libpicoevent endptmngr
endef
define Package/dectmngr2/description
Dectmngr2
endef
define Package/dectmngr2/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_DIR) $(1)/etc/dect/
$(INSTALL_DIR) $(1)/etc/config/
$(INSTALL_DIR) $(1)/etc/init.d/
$(INSTALL_DIR) $(1)/etc/uci-defaults/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/dectmngr2 $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/target.bin $(1)/etc/dect/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/nvs_default $(1)/etc/dect/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/dect $(1)/etc/init.d/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/dectmngr-wrapper.sh $(1)/usr/sbin/
$(CP) ./files/dect.config $(1)/etc/config/dect
$(CP) ./files/etc/uci-defaults/* $(1)/etc/uci-defaults/
endef
$(eval $(call BuildPackage,dectmngr2))

View File

@@ -0,0 +1,4 @@
config dect 'dect'
option radio 'auto'

View File

@@ -0,0 +1,23 @@
#!/bin/sh
# Workaround for product DG400 which has an
# incorrect value in nvram from factory.
if [ -e "/proc/nvram/BoardId" ]; then
boardid=$(cat /proc/nvram/BoardId)
ulBoardStuffOption=$(cat /proc/nvram/ulBoardStuffOption)
if [ "$boardid" = "DG400R0" -a "$ulBoardStuffOption" = "0xffffffff" ]; then
echo "0xfffffff2" >/proc/nvram/ulBoardStuffOption
db -q batch <<-EOT
set hw.board.hasDect=1
commit hw.board
EOT
fi
fi
exit 0

View File

@@ -8,15 +8,14 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=dslmngr
PKG_VERSION:=1.1.2
PKG_VERSION:=1.0.0
LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=bb754ae620a9fc66fd6fc0745f0fead0708c7a17
PKG_SOURCE_VERSION:=7522faab4142fe2c0ac8cbf71bb0cc5bd49f0750
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/dslmngr.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
@@ -26,8 +25,16 @@ PKG_LICENSE_FILES:=LICENSE
include $(INCLUDE_DIR)/package.mk
ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),y)
ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_mips),y)
TARGET_PLATFORM=BROADCOM
else ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),y)
TARGET_PLATFORM=BROADCOM
else ifeq ($(CONFIG_TARGET_iopsys_ramips),y)
TARGET_PLATFORM=MEDIATEK
else ifeq ($(CONFIG_TARGET_iopsys_linksys),y)
TARGET_PLATFORM=MARVELL
else ifeq ($(CONFIG_TARGET_intel_mips),y)
TARGET_PLATFORM=INTEL
else
$(info Unexpected CONFIG_TARGET)
endif
@@ -38,7 +45,7 @@ define Package/dslmngr
SECTION:=utils
CATEGORY:=Utilities
TITLE:=XDSL status and configration utility
DEPENDS:=+libdsl +libuci +libubox +ubus +libpthread +libnl-genl +libeasy
DEPENDS:=+libdsl +libuci +libubox +ubus +libpthread +libnl-genl +easy-soc-libs
endef
define Package/dslmngr/description
@@ -49,7 +56,6 @@ endef
TARGET_CFLAGS += \
-I$(STAGING_DIR)/usr/include \
-I$(STAGING_DIR)/usr/include/libnl3 \
-I$(STAGING_DIR)/usr/include/xdsl \
-D_GNU_SOURCE
MAKE_FLAGS += \

View File

@@ -19,7 +19,7 @@ define Package/easy-qos
SECTION:=net
CATEGORY:=Network
TITLE:=Easy QoS
DEPENDS:=@TARGET_iopsys_brcm63xx_arm
DEPENDS:=@(TARGET_intel_mips||TARGET_iopsys_brcm63xx_arm||TARGET_iopsys_brcm63xx_mips)
endef
define Package/easy-qos/description
@@ -39,7 +39,11 @@ define Package/easy-qos/install
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(CP) ./files/etc/config/easy_qos $(1)/etc/config/
ifeq ($(CONFIG_TARGET_intel_mips),y)
$(CP) ./files/etc/init.d/easy_qos.classcfg $(1)/etc/init.d/easy_qos
else
$(CP) ./files/etc/init.d/easy_qos.iptables $(1)/etc/init.d/easy_qos
endif
$(CP) ./files/etc/uci-defaults/* $(1)/etc/uci-defaults/
$(CP) ./files/etc/firewall.easyqos $(1)/etc/firewall.easyqos
endef

View File

@@ -0,0 +1,301 @@
#!/bin/sh /etc/rc.common
START=99
USE_PROCD=1
RULE_LIST="/tmp/easy_qos_rule.list"
CLIENT_LIST="/tmp/easy_qos_class_client.list"
BRIDGE_INTF=""
[ -f /etc/profile.d/intel.sh ] && {
. /etc/profile.d/intel.sh
sh /etc/profile.d/intel.sh
}
log() {
echo "${@}"|logger -t easy_qos_class -p debug
}
exec_log() {
${@}
if [ "${?}" -ne 0 ]; then
log "Failed to create ${@}";
fi
}
exec_class_log() {
${@} |grep -i successful
if [ "${?}" -ne 0 ]; then
log "Failed to create ${@}";
return 1
fi
return 0
}
get_priority() {
local prio=$(echo $1|tr [A-Z] [a-z]);
case "${prio}" in
"lowest")
echo 8;;
"low")
echo 7;;
"besteffort")
echo 6;;
"normal")
echo 5;;
"video")
echo 4;;
"medium")
echo 3;;
"high")
echo 2;;
"highest")
echo 1;;
esac
}
get_mark() {
local prio=$(echo $1|tr [A-Z] [a-z]);
case "${prio}" in
"lowest")
echo "0x41/0x3df";;
"low")
echo "0x82/0x3df";;
"besteffort")
echo "0xc3/0x3df";;
"normal")
echo "0x104/0x3df";;
"video")
echo "0x145/0x3df";;
"medium")
echo "0x186/0x3df";;
"high")
echo "0x1c7/0x3df";;
"highest")
echo "0x208/0x3df";;
esac
}
clean_client_entries() {
[ -f ${CLIENT_LIST} ] && rm ${CLIENT_LIST}
}
map_client_entries() {
local clients ip mac host
json_load "$(ubus call router.network 'clients')"
json_get_keys keys
for key in ${keys};
do
json_select ${key}
json_get_vars ipaddr macaddr hostname
clients="${macaddr} ${ipaddr} ${hostname};${clients}"
json_select ..
done
json_init
IFS=";"
for client in ${clients};
do
macaddr=$(echo ${client} | cut -d" " -f1)
json_add_object "${macaddr//:/_}"
json_add_string "ip" "$(echo ${client} | cut -d" " -f2)"
json_add_string "macaddr" "$(echo ${client} | cut -d" " -f1)"
json_add_string "host" "$(echo ${client} | cut -d" " -f3)"
json_close_object
done
IFS=' '
echo `json_dump` > ${CLIENT_LIST}
json_cleanup
}
# Find the IP of a corresponding mac from arp table
get_ipaddress() {
local clients ip mac host
json_load "$(cat ${CLIENT_LIST})"
json_get_keys keys
# jshn seems a bit iffy on having : in key, replace by _
json_select "${1//:/_}" 2 > /dev/null
json_get_var ip ip
echo "$ip"
}
check_and_create() {
iptables -t mangle -C PREROUTING ${@} 2>/dev/null
# Create rule if not exists
if [ ${?} -ne 0 ]; then
exec_log iptables -t mangle -A PREROUTING ${@}
else
log "Rule exists for ${@}"
fi
}
create_ip_rule() {
local proto=$1; shift
local src_ip=$1; shift
local mark=$1; shift
local ports=$1;
local cmd="";
cmd="-j EXTMARK --set-mark ${mark}";
if [ "${proto}" != "icmp" ]; then
if [ -n "${ports}" ]; then
cmd="--match multiport --dports ${ports} ${cmd}";
fi
fi
if [ "${proto}" == "icmp" ]; then
cmd="-p icmp -m icmp --icmp-type 8 $cmd"
elif [ "${proto}" == "all" ]; then
cmd="-p all $cmd"
else
cmd="-p ${proto} -m ${proto} $cmd"
fi
cmd="-s ${src_ip} $cmd"
check_and_create ${cmd}
}
is_lan_bridge() {
local _section=$1
local _type
local _is_lan
config_get _type "$section" "type"
config_get _is_lan "$section" "is_lan"
if [ "${_type}" == "bridge" -a "${_is_lan}" == "1" ]; then
BRIDGE_INTF="br-${_section}"
fi
}
get_bridge_interface() {
config_load network
config_foreach is_lan_bridge interface
}
validate_rule_section()
{
uci_validate_section easy_qos rule "${1}" \
'priority:string' \
'macaddr:string' \
'proto:string:none' \
'port:list(uinteger)' \
'comment:string:none'
}
# Clear existing rules before applying new rules
clear_existing_rules() {
# execute the delete rules written onto a file then delete the file
[ -f ${RULE_LIST} ] || return 0
while read line
do
log "Deleting old classification rules"
exec_class_log classcfg -D ${line} -i ${BRIDGE_INTF}
done <${RULE_LIST}
local rule=$(iptables -t mangle -S PREROUTING|grep -m 1 EXTMARK |sed 's/-A/-D/1')
while [ -n "${rule}" ]; do
exec_log iptables -t mangle ${rule}
rule=$(iptables -t mangle -S PREROUTING|grep -m 1 EXTMARK |sed 's/-A/-D/1')
done
sync
[ -f ${RULE_LIST} ] && rm ${RULE_LIST}
}
# classcfg -M local_dhcp -i lo -p udp --dport 67:67 --dport 68:68 -j mark --mark 1
create_rule() {
local proto=$1; shift
local mac_addr=$1; shift
local mark=$1; shift
local ports=$1;
local cmd="";
# Rule name is uniqe, so we take hash of all the input as rule_name
local rule_name="$(echo ${mac_addr}${proto}${mark}${ports} |md5sum |head -c 30)"
cmd="-j mark --mark ${mark}";
if [ "${mac_addr}" != "none" ]; then
cmd="--smac ${mac_addr} ${cmd}";
fi
if [ "${proto}" != "icmp" ]; then
if [ "${ports}" != "none" ]; then
IFS=","
for port in ${ports};
do
cmd="--dport ${port}:${port} ${cmd}";
done
IFS=' '
fi
fi
if [ "${proto}" != "none" ]; then
cmd="-p ${proto} $cmd"
fi
cmd="-i ${BRIDGE_INTF} $cmd"
cmd="-A ${rule_name} $cmd"
# Store the rule_names for cleanup on reload
exec_class_log classcfg ${cmd}
[ $? -eq 0 ] && \
echo ${rule_name} >> ${RULE_LIST}
}
manage_rule() {
local cfg="$1"
local priority macaddr proto port comment prio_num port_list ip ipmark
validate_rule_section "${1}" || {
log "Validation of section failed"
return 1;
}
prio_num=$(get_priority ${priority})
port_list=$(echo ${port}|sed 's/ /,/g')
ipmark=$(get_mark ${priority})
ip=$(get_ipaddress ${macaddr})
if [ -n "${prio_num}" ]; then
if [ "${proto}" == "none" -o "${proto}" == "tcpudp" ]; then
create_rule tcp ${macaddr} ${prio_num} ${port_list}
create_rule udp ${macaddr} ${prio_num} ${port_list}
if [ -n "${ip}" ]; then
create_ip_rule tcp ${ip} ${ipmark} ${port_list}
create_ip_rule udp ${ip} ${ipmark} ${port_list}
fi
else
create_rule ${proto} ${macaddr} ${prio_num} ${port_list}
if [ -n "${ip}" ]; then
create_ip_rule ${proto} ${ip} ${ipmark} ${port_list}
fi
fi
fi
}
reload_service() {
get_bridge_interface
map_client_entries
clear_existing_rules
config_load easy_qos
config_foreach manage_rule rule
clean_client_entries
}
start_service() {
[ -x /opt/intel/usr/sbin/classcfg ] || exit 0
reload_service
log "Easy QoS class installed"
}
service_triggers() {
procd_add_reload_trigger "easy_qos" "network"
}

View File

@@ -15,7 +15,7 @@ exec_log() {
}
get_priority() {
local prio=$(echo $1|tr 'A-Z' 'a-z');
local prio=$(echo $1|tr [A-Z] [a-z]);
case "${prio}" in
"lowest")
echo 0;;
@@ -98,7 +98,7 @@ manage_rule() {
return 1;
}
protocol=$(echo ${proto}|tr 'A-Z' 'a-z')
protocol=$(echo ${proto}|tr [A-Z] [a-z])
prio_num=$(get_priority ${priority})
if [ -n "${macaddr}" -a -n "${prio_num}" ]; then
for p in ${port}; do

View File

@@ -19,7 +19,7 @@ exec_log() {
}
get_priority() {
local prio=$(echo $1|tr 'A-Z' 'a-z');
local prio=$(echo $1|tr [A-Z] [a-z]);
case "${prio}" in
"lowest")
echo 0;;

View File

@@ -4,5 +4,7 @@ uci -q batch <<-EOT
set firewall.easyqos=include
set firewall.easyqos.path=/etc/firewall.easyqos
set firewall.easyqos.reload=1
uci del_list firewall.easyqos._access_w="root"
uci add_list firewall.easyqos._access_w="root"
commit firewall
EOT

View File

@@ -1,110 +0,0 @@
# All rights reserved.
# See LICENSE for more information.
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=easy-soc-events
PKG_VERSION:=1.1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=git@dev.iopsys.eu:iopsys/easy-soc-events.git
PKG_SOURCE_VERSION:=5c582b0165b574dc94e4865f82e0bb91fa561754
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_MIRROR_HASH:=skip
PKG_BUILD_DIR:=$(BUILD_DIR)/easy-soc-events-$(PKG_VERSION)
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
include $(INCLUDE_DIR)/package.mk
-include $(TOPDIR)/.config
ifneq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),)
LINUX_DIR=$(BUILD_DIR)/bcmkernel/bcm963xx/kernel/linux-4.1
LINUX_VERSION := 4.1.52
LINUXINCLUDE=-Iarch/$(LINUX_KARCH)/mach-bcm963xx/include
BCM_BS_PROFILE := $(patsubst "%",%,$(CONFIG_BCM_KERNEL_PROFILE))
FS_DIR := $(BUILD_DIR)/bcmkernel/bcm963xx/targets/$(BCM_BS_PROFILE)/fs
MODULES_SUBDIR:=lib/modules/$(LINUX_VERSION)/extra
TARGET_MODULES_DIR:=/$(MODULES_SUBDIR)
endif
define KernelPackage/easy-soc-events/default
SUBMENU:=Other modules
endef
define KernelPackage/easy-soc-events
$(KernelPackage/easy-soc-events/default)
TITLE:=Helper module for netlink event notification
FILES:=$(PKG_BUILD_DIR)/easyevent.ko
AUTOLOAD:=$(call AutoLoad,11,easyevent)
endef
define KernelPackage/easy-soc-events-test
$(KernelPackage/easy-soc-events/default)
TITLE:=Test module for event notification through easyevent
DEPENDS+=+kmod-easy-soc-events
FILES+=$(PKG_BUILD_DIR)/test/testevent.ko
endef
define KernelPackage/easy-soc-events/description
This is a helper module to generate and pass netlink events from
kernel to user applications.
endef
#NOSTDINC_FLAGS :=
ifdef CONFIG_PACKAGE_kmod-easy-soc-events
PKG_MAKE_FLAGS += CONFIG_EASYEVENT=y
endif
LINUXINCLUDE += \
-I$(LINUX_DIR)/include -I$(LINUX_DIR)/include/$(LINUX_UAPI_DIR) \
-Iarch/$(LINUX_KARCH)/include \
-Iarch/$(LINUX_KARCH)/include/generated \
-Iarch/$(LINUX_KARCH)/include/generated/$(LINUX_UAPI_DIR) \
-I$(LINUX_DIR)/include/generated/uapi \
-Iarch/$(LINUX_KARCH)/include/$(LINUX_UAPI_DIR) \
-include ./include/linux/kconfig.h
define Build/Prepare
$(call Build/Prepare/Default)
endef
define Build/Compile
$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \
$(KERNEL_MAKE_FLAGS) V=1 \
$(PKG_MAKE_FLAGS) \
NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
LINUXINCLUDE="$(LINUXINCLUDE)" \
SUBDIRS="$(PKG_BUILD_DIR)" \
modules
endef
ifneq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),)
define KernelPackage/easy-soc-events/install-extra
cp $(PKG_BUILD_DIR)/easyevent.ko $(FS_DIR)/lib/modules/$(LINUX_VERSION)/extra
endef
endif
define KernelPackage/easy-soc-events/install
$(call KernelPackage/easy-soc-events/install-extra)
endef
define Build/InstallDev
$(INSTALL_DIR) $(STAGING_DIR)/usr/include
#$(INSTALL_DIR) $(STAGING_DIR)/usr/include/linux
#$(CP) $(PKG_BUILD_DIR)/easysoc-event.h $(STAGING_DIR)/usr/include/linux/
#$(CP) $(PKG_BUILD_DIR)/easysoc-event.h $(LINUX_DIR)/include/linux/
$(CP) $(PKG_BUILD_DIR)/easyevent.h $(STAGING_DIR)/usr/include/
$(CP) $(PKG_BUILD_DIR)/wifievent.h $(STAGING_DIR)/usr/include/
$(CP) $(PKG_BUILD_DIR)/easyevent.h $(LINUX_DIR)/include/generated/uapi
$(CP) $(PKG_BUILD_DIR)/wifievent.h $(LINUX_DIR)/include/generated/uapi
endef
$(eval $(call KernelPackage,easy-soc-events-test))
$(eval $(call KernelPackage,easy-soc-events))

View File

@@ -0,0 +1,10 @@
if (PACKAGE_libwifix)
menu "configurations"
config LIBWIFIX_DEBUG
depends on PACKAGE_libwifix
bool "Enable wifi debugging"
default n
endmenu
endif

View File

@@ -0,0 +1,108 @@
#
# Copyright (C) 2019 iopsys Software Solutions AB
#
# This is free software, licensed under the GNU General Public License v2.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=easy-soc-libs.deprecated
PKG_VERSION:=1.0.1
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=cec7ae3a5c8348ea2d81a2abac0599a098752e3a
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/easy-soc-libs.git
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_LICENSE:=GPLv2
PKG_LICENSE_FILES:=LICENSE
include $(INCLUDE_DIR)/package.mk
define Package/easy-soc-libs.deprecated
SECTION:=libs
CATEGORY:=Libraries
TITLE:=IOPSYS easy SoC libraries (deprecated)
SUBMENU:=IOPSYS easy SoC libraries (deprecated)
DEPENDS:=+libopenssl
MENU:=1
endef
define Package/libwifix/config
source "$(SOURCE)/Config.in"
endef
define Package/libwifix
$(call Package/easy-soc-libs.deprecated)
TITLE:= WiFi library for wifix (deprecated)
DEPENDS+=+libnl +libnl-route
endef
ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_mips),y)
TARGET_PLATFORM=BROADCOM
TARGET_CFLAGS +=-DIOPSYS_BROADCOM -DCONFIG_BCM963138 \
-I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx
KERNEL_DIR:=$(BUILD_DIR)/bcmkernel/bcm963xx
else ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),y)
TARGET_PLATFORM=BROADCOM
TARGET_CFLAGS +=-DIOPSYS_BROADCOM -DCONFIG_BCM963138 \
-I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx
else ifeq ($(CONFIG_TARGET_iopsys_ramips),y)
TARGET_PLATFORM=MEDIATEK
TARGET_CFLAGS +=-DIOPSYS_MEDIATEK
else ifeq ($(CONFIG_TARGET_iopsys_linksys),y)
TARGET_PLATFORM=MARVELL
TARGET_CFLAGS +=-DIOPSYS_MARVELL
else ifeq ($(CONFIG_TARGET_intel_mips),y)
TARGET_PLATFORM=INTEL
TARGET_CFLAGS +=-DIOPSYS_INTEL
else
$(info Unexpected CONFIG_TARGET)
endif
export TARGET_PLATFORM
ifdef CONFIG_LIBWIFIX_DEBUG
TARGET_CFLAGS += -DIOP_LLA_LIBS_DEBUG
endif
subdirs := \
$(if $(CONFIG_PACKAGE_libwifix),libwifix)
TARGET_CFLAGS += \
-I$(STAGING_DIR)/usr/include \
-I$(STAGING_DIR)/usr/include/openssl \
-I$(STAGING_DIR)/usr/include/libnl3
MAKE_FLAGS += \
CFLAGS="$(TARGET_CFLAGS) -Wall -I./" \
LDFLAGS="$(TARGET_LDFLAGS)" \
FPIC="$(FPIC)" \
PLATFORM="$(TARGET_PLATFORM)" \
subdirs="$(subdirs)"
define Build/InstallDev/libwifix
$(INSTALL_DIR) $(1)/usr/include
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/libwifix/wifi.h $(1)/usr/include/wifix.h
$(CP) $(PKG_BUILD_DIR)/libwifix/libwifi*.so* $(1)/usr/lib/
endef
define Build/Compile
$(call Build/Compile/Default)
endef
define Build/InstallDev
$(foreach dir,$(subdirs),$(call Build/InstallDev/$(dir),$(1),$(2));)
endef
define Package/libwifix/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/libwifix/libwifi*.so* $(1)/usr/lib/
endef
$(eval $(call BuildPackage,libwifix))

View File

@@ -1,5 +1,23 @@
# libeasy configuration
if (PACKAGE_libwifi || PACKAGE_libdsl || PACKAGE_libethernet)
menu "configurations"
config LIBWIFI_USE_CTRL_IFACE
bool "Use UNIX sockets"
config IOP_LLA_LIBS_DEBUG
bool "Enable debugging support"
default n
config LIBWIFI_DEBUG
depends on PACKAGE_libwifi
bool "Enable wifi debugging"
default n
config LIBDSL_DEBUG
depends on PACKAGE_libdsl
bool "Enable xdsl debugging"
default n
config LIBDSL_TEST
depends on PACKAGE_libdsl
bool "Libdsl test program"
default n
endmenu
endif

View File

@@ -1,23 +1,22 @@
#
# Copyright (C) 2020 iopsys Software Solutions AB
# Copyright (C) 2019 iopsys Software Solutions AB
#
# This is free software, licensed under the GNU General Public License v2.
#
#
include $(TOPDIR)/rules.mk
PKG_NAME:=easy-soc-libs
PKG_VERSION:=6.5.60
PKG_VERSION:=2.4.1
PKG_RELEASE:=1
LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=ec2e8d0341e246ff371481ae20418d8301dfcf12
PKG_SOURCE_VERSION:=0accbd7266b2742ad8921edd5dab974fc384a49a
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/easy-soc-libs.git
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
PKG_MIRROR_HASH:=skip
endif
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
@@ -30,52 +29,73 @@ include $(INCLUDE_DIR)/package.mk
define Package/easy-soc-libs
SECTION:=libs
CATEGORY:=Libraries
TITLE:=IOPSYS Easy SoC libraries
SUBMENU:=IOPSYS Easy SoC libraries
TITLE:=IOPSYS easy SoC libraries
SUBMENU:=IOPSYS easy SoC libraries
DEPENDS:=+libopenssl
MENU:=1
endef
ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),y)
define Package/libwifi/config
source "$(SOURCE)/Config.in"
endef
define Package/libeasy
$(call Package/easy-soc-libs)
TITLE:= Helper and utility functions library (libeasy)
DEPENDS+=+libnl +libnl-route
endef
define Package/libwifi
$(call Package/easy-soc-libs)
TITLE:= WiFi library (libwifi)
DEPENDS+=+libnl +libnl-route
endef
define Package/libethernet
$(call Package/easy-soc-libs)
TITLE:= Ethernet library (libethernet)
DEPENDS+=+TARGET_iopsys_ramips:swconfig
endef
ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_mips),y)
TARGET_PLATFORM=BROADCOM
CHIP_ID=$(patsubst "%",%,$(CONFIG_BCM_CHIP_ID))
TARGET_CFLAGS +=-DIOPSYS_BROADCOM -DCHIP_$(CHIP_ID) -DCONFIG_BCM9$(CHIP_ID) \
-I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx \
-I$(STAGING_DIR)/usr/include/bcm963xx/userspace/public/include
TARGET_CFLAGS +=-DIOPSYS_BROADCOM -DCONFIG_BCM963138 \
-I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx
KERNEL_DIR:=$(BUILD_DIR)/bcmkernel/bcm963xx
else ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),y)
TARGET_PLATFORM=BROADCOM
TARGET_CFLAGS +=-DIOPSYS_BROADCOM -DCONFIG_BCM963138 \
-I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx
else ifeq ($(CONFIG_TARGET_iopsys_ramips),y)
TARGET_PLATFORM=MEDIATEK
TARGET_CFLAGS +=-DIOPSYS_MEDIATEK
else ifeq ($(CONFIG_TARGET_iopsys_x86),y)
TARGET_PLATFORM=TEST
TARGET_CFLAGS +=-DIOPSYS_TEST
else ifeq ($(CONFIG_TARGET_iopsys_armvirt),y)
TARGET_PLATFORM=TEST
TARGET_CFLAGS +=-DIOPSYS_TEST
else ifeq ($(CONFIG_TARGET_iopsys_linksys),y)
TARGET_PLATFORM=MARVELL
TARGET_CFLAGS +=-DIOPSYS_MARVELL
else ifeq ($(CONFIG_TARGET_intel_mips),y)
TARGET_PLATFORM=INTEL
TARGET_CFLAGS +=-DIOPSYS_INTEL
else
$(info Unexpected CONFIG_TARGET, use default MAC80211)
TARGET_PLATFORM=MAC80211
TARGET_CFLAGS +=-DIOPSYS_MAC80211
$(info Unexpected CONFIG_TARGET)
endif
export TARGET_PLATFORM
ifdef CONFIG_IOP_LLA_LIBS_DEBUG
TARGET_CFLAGS += -DIOP_LLA_LIBS_DEBUG
endif
define Package/libdsl
$(call Package/easy-soc-libs)
TITLE:= XDSL library (libdsl)
DEPENDS+=+TARGET_intel_mips:dsl-cpe-api-vrx +TARGET_intel_mips:dsl-cpe-fapi +TARGET_intel_mips:kmod-ppa-drv
endef
subdirs := \
$(if $(CONFIG_PACKAGE_libeasy),libeasy) \
$(if $(CONFIG_PACKAGE_libwifi),libwifi) \
$(if $(CONFIG_PACKAGE_libdsl),libdsl) \
$(if $(CONFIG_PACKAGE_libethernet),libethernet) \
$(if $(CONFIG_PACKAGE_libqos),libqos)
EASY_SOC_LIBS := \
libeasy \
libwifi \
libdsl \
libethernet \
libqos
ifeq ($(CONFIG_LIBWIFI_USE_CTRL_IFACE),y)
TARGET_CFLAGS +=-DLIBWIFI_USE_CTRL_IFACE
endif
$(if $(CONFIG_PACKAGE_libeasy),libeasy)
TARGET_CFLAGS += \
-I$(STAGING_DIR)/usr/include \
@@ -95,36 +115,70 @@ define Build/Prepare
endef
endif
include easy.mk
include wifi.mk
include dsl.mk
include ethernet.mk
include qos.mk
ifneq ($(wildcard $(PKG_BUILD_DIR)/.config_*),\
$(PKG_BUILD_DIR)/.config_$(patsubst "%",%,$(CONFIG_TARGET_PROFILE)))
define Build/Compile/rebuild
$(FIND) $(PKG_BUILD_DIR) -name \*.o -or -name \*.so\* | $(XARGS) rm -f;
$(if $(wildcard $(PKG_BUILD_DIR)/config_*), \
rm -f $(PKG_BUILD_DIR)/.config_*)
define Build/InstallDev/libeasy
$(INSTALL_DIR) $(1)/usr/include
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/libeasy/easy.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/libeasy/libeasy.so* $(1)/usr/lib/
endef
endif
STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell echo $(TARGET_CFLAGS) | mkhash md5)
define Build/InstallDev/libwifi
$(INSTALL_DIR) $(1)/usr/include
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/libwifi/wifi.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/libwifi/libwifi*.so* $(1)/usr/lib/
endef
define Build/InstallDev/libdsl
$(INSTALL_DIR) $(1)/usr/include
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/libdsl/xdsl.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/libdsl/libdsl.so* $(1)/usr/lib/
endef
define Build/InstallDev/libethernet
$(INSTALL_DIR) $(1)/usr/include
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/libethernet/ethernet.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/libethernet/libethernet.so $(1)/usr/lib/
endef
define Build/Compile
$(Build/Compile/rebuild)
touch $(PKG_BUILD_DIR)/.config_$(CONFIG_TARGET_PROFILE)
$(call Build/Compile/Default)
$(foreach dir,$(subdirs),$(call Build/Compile/$(dir)))
ifeq ($(CONFIG_LIBDSL_TEST),y)
$(MAKE) -C "$(PKG_BUILD_DIR)/libdsl/test" $(MAKE_FLAGS)
endif
endef
define Build/InstallDev
$(foreach dir,$(subdirs),$(call Build/InstallDev/$(dir),$(1),$(2));)
endef
define Package/easy-soc-libs/install
:
define Package/libeasy/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/libeasy/libeasy.so* $(1)/usr/lib/
endef
$(eval $(foreach e,$(EASY_SOC_LIBS),$(call BuildPackage,$(e))))
define Package/libwifi/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/libwifi/libwifi*.so* $(1)/usr/lib/
endef
define Package/libethernet/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/libethernet/libethernet.so* $(1)/usr/lib/
endef
define Package/libdsl/install
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DIR) $(1)/usr/bin
$(CP) $(PKG_BUILD_DIR)/libdsl/libdsl.so* $(1)/usr/lib/
ifeq ($(CONFIG_LIBDSL_TEST),y)
$(CP) $(PKG_BUILD_DIR)/libdsl/test/libdsl_test $(1)/usr/bin/
endif
endef
$(eval $(call BuildPackage,libwifi))
$(eval $(call BuildPackage,libdsl))
$(eval $(call BuildPackage,libethernet))
$(eval $(call BuildPackage,libeasy))

View File

@@ -1,44 +0,0 @@
define Package/libdsl
$(call Package/easy-soc-libs)
TITLE:= xDSL library (libdsl)
endef
define Package/libdsl/config
if PACKAGE_libdsl
config LIBDSL_DEBUG
depends on PACKAGE_libdsl
bool "Enable dsl debugging"
default n
config LIBDSL_TEST
depends on PACKAGE_libdsl
bool "Enable dsl test program"
default n
endif
endef
define Build/InstallDev/libdsl
$(INSTALL_DIR) $(1)/usr/include/xdsl
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/libdsl/xdsl.h $(1)/usr/include/xdsl
$(CP) $(PKG_BUILD_DIR)/libdsl/xtm.h $(1)/usr/include/xdsl
$(CP) $(PKG_BUILD_DIR)/libdsl/common.h $(1)/usr/include/xdsl
$(CP) $(PKG_BUILD_DIR)/libdsl/libdsl.so* $(1)/usr/lib/
endef
ifeq ($(CONFIG_LIBDSL_TEST),y)
define Build/Compile/libdsl
$(MAKE) -C "$(PKG_BUILD_DIR)/libdsl/test" $(MAKE_FLAGS)
endef
endif
define Package/libdsl/install
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DIR) $(1)/usr/bin
$(CP) $(PKG_BUILD_DIR)/libdsl/libdsl.so* $(1)/usr/lib/
ifeq ($(CONFIG_LIBDSL_TEST),y)
$(CP) $(PKG_BUILD_DIR)/libdsl/test/libdsl_test $(1)/usr/bin/
endif
endef

View File

@@ -1,29 +0,0 @@
define Package/libeasy
$(call Package/easy-soc-libs)
TITLE:= Common helper functions library (libeasy)
DEPENDS+=+libnl +libnl-route
endef
define Package/libeasy/config
source "$(SOURCE)/Config.in"
endef
define Build/InstallDev/libeasy
$(INSTALL_DIR) $(1)/usr/include/easy
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/libeasy/easy.h $(1)/usr/include/easy/
$(CP) $(PKG_BUILD_DIR)/libeasy/event.h $(1)/usr/include/easy/
$(CP) $(PKG_BUILD_DIR)/libeasy/utils.h $(1)/usr/include/easy/
$(CP) $(PKG_BUILD_DIR)/libeasy/if_utils.h $(1)/usr/include/easy/
$(CP) $(PKG_BUILD_DIR)/libeasy/debug.h $(1)/usr/include/easy/
$(CP) $(PKG_BUILD_DIR)/libeasy/hlist.h $(1)/usr/include/easy/
$(CP) $(PKG_BUILD_DIR)/libeasy/libeasy*.so* $(1)/usr/lib/
endef
define Package/libeasy/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/libeasy/libeasy*.so* $(1)/usr/lib/
endef

View File

@@ -1,27 +0,0 @@
define Package/libethernet
$(call Package/easy-soc-libs)
TITLE:= Ethernet library (libethernet)
DEPENDS+=+libnl +libnl-route +libeasy +TARGET_iopsys_ramips:swconfig
endef
define Package/libethernet/config
config LIBETHERNET_DEBUG
depends on PACKAGE_libethernet
bool "Enable ethernet debugging"
default n
endef
define Build/InstallDev/libethernet
$(INSTALL_DIR) $(1)/usr/include
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/libethernet/ethernet.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/libethernet/libethernet.so $(1)/usr/lib/
endef
define Package/libethernet/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/libethernet/libethernet.so* $(1)/usr/lib/
endef

View File

@@ -1,27 +0,0 @@
define Package/libqos
$(call Package/easy-soc-libs)
TITLE:= QoS library (libqos)
DEPENDS+=+libnl +libnl-route +libeasy
endef
define Package/libqos/config
config LIBQOS_DEBUG
depends on PACKAGE_libqos
bool "Enable qos debugging"
default n
endef
define Build/InstallDev/libqos
$(INSTALL_DIR) $(1)/usr/include
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/libqos/include/qos.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/libqos/libqos.so $(1)/usr/lib/
endef
define Package/libqos/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/libqos/libqos*.so* $(1)/usr/lib/
endef

View File

@@ -1,29 +0,0 @@
define Package/libwifi
$(call Package/easy-soc-libs)
TITLE:= WiFi library (libwifi)
DEPENDS+=+libnl +libnl-route +libeasy +TARGET_iopsys_brcm63xx_arm:bcmkernel
endef
define Package/libwifi/config
if PACKAGE_libdsl
config LIBWIFI_DEBUG
depends on PACKAGE_libwifi
bool "Enable wifi debugging"
default n
endif
endef
define Build/InstallDev/libwifi
$(INSTALL_DIR) $(1)/usr/include
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/libwifi/wifi.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/libwifi/libwifi*.so* $(1)/usr/lib/
endef
define Package/libwifi/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/libwifi/libwifi*.so* $(1)/usr/lib/
endef

View File

@@ -6,32 +6,32 @@
#
include $(TOPDIR)/rules.mk
PKG_NAME:=endptmngr
PKG_VERSION:=0.7
LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/endptmngr.git
PKG_SOURCE_VERSION:=e5fb705f3a1b6065606e0cba82a54fb6eee10ae9
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif
PKG_LICENSE:=PROPRIETARY
PKG_RELEASE:=1
PKG_VERSION:=0.2
PKG_SOURCE_VERSION:=ef49d57c3824df4dfb4921d39461e2bd14f918a7
PKG_LICENSE:=GPLv2
PKG_LICENSE_FILES:=LICENSE
ifeq ($(CONFIG_ENDPT_OPEN),y)
BRCM_KERNEL_PROFILE=$(shell echo $(CONFIG_BCM_KERNEL_PROFILE) | sed s/\"//g)
PKG_SOURCE:=endptmngr-$(BRCM_KERNEL_PROFILE)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_SOURCE_URL:=http://download.iopsys.eu/iopsys/opensdk/
PKG_NAME:=endptmngr-open
PATCH_DIR:=
else
PKG_SOURCE_URL:=git@dev.iopsys.eu:iopsys/endptmngr
PKG_SOURCE_PROTO:=git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_NAME:=endptmngr
endif
RSTRIP:=true
export BUILD_DIR
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_BUILD_PARALLEL:=1
# All config variable that are passed to the make invocation, directly or
# indirectly. This ensures that the package is rebuilt on config-changes.
PKG_CONFIG_DEPENDS:=CONFIG_TARGET_BOARD
export CONFIG_BRCM_SDK_VER_504021
export CONFIG_BCM_CHIP_ID
include $(INCLUDE_DIR)/package.mk
@@ -41,28 +41,27 @@ endef
define Package/endptmngr
CATEGORY:=Utilities
TITLE:=Broadcom Voice Endpoint Manager
TITLE:=Brcmslic
URL:=
DEPENDS:= +libubox +ubus +libpicoevent +uci +bcmkernel @TARGET_HAS_VOICE @BCM_VOICE
DEPENDS:= +libubox +ubus +libpicoevent +PACKAGE_bcmkernel:bcmkernel +PACKAGE_bcmopen:bcmopen @(PACKAGE_bcmkernel||PACKAGE_bcmopen) @TARGET_HAS_VOICE
endef
define Package/endptmngr/description
endptmngr
endef
ifeq ($(LOCAL_DEV),1)
define Build/Prepare
rsync -av --exclude=.* ~/git/endptmngr/* $(PKG_BUILD_DIR)/
ifeq ($(CONFIG_ENDPT_OPEN),y)
define Build/Compile
endef
endif
TARGET_CFLAGS += \
-Wall \
-Werror
define Package/endptmngr/install
$(CP) ./files/* $(1)/
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_DIR) $(1)/etc/init.d/
cp $(PKG_BUILD_DIR)/files/etc/init.d/* $(1)/etc/init.d/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/endptmngr $(1)/usr/sbin/
endef

View File

@@ -1,27 +0,0 @@
#!/bin/sh /etc/rc.common
START=68
STOP=12
USE_PROCD=1
NAME=endptmngr
start_service() {
[ "$(db -q get hw.board.hasVoice)" = "1" ] || return
procd_open_instance
procd_set_param env hw_board_hasDect=$(db get hw.board.hasDect)
procd_set_param command $NAME
procd_set_param respawn "5" "0" "3"
procd_set_param nice -12
procd_close_instance
}
reload_service() {
stop
start
}
service_triggers() {
procd_add_reload_trigger asterisk
}

View File

@@ -1,46 +0,0 @@
#
# Copyright (C) 2020 Iopsys
#
include $(TOPDIR)/rules.mk
PKG_NAME:=ethmngr
PKG_VERSION:=2.0.1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=5a0ff3bc7c49dcb05129f423ef8e0c4929f6aa03
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/ethmngr.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
PKG_MIRROR_HASH:=skip
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_LICENSE:=GPL-2.0-only
PKG_LICENSE_FILES:=LICENSE
include $(INCLUDE_DIR)/package.mk
define Package/ethmngr
SECTION:=utils
CATEGORY:=Utilities
TITLE:=Ethernet status and configration utility
DEPENDS:=+libethernet +libuci +libubox +ubus +libpthread +libnl-genl
endef
define Package/ethmngr/description
This package can be used to configure and provide status about
the ethernet interfaces and ports through UBUS.
It uses APIs from the libethernet.so library.
endef
TARGET_CFLAGS += \
-I$(STAGING_DIR)/usr/include \
-I$(STAGING_DIR)/usr/include/libnl3 \
-D_GNU_SOURCE
define Package/ethmngr/install
$(INSTALL_DIR) $(1)/etc/init.d $(1)/usr/sbin
$(INSTALL_BIN) ./files/ethmngr.init $(1)/etc/init.d/ethmngr
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ethmngr $(1)/usr/sbin/
endef
$(eval $(call BuildPackage,ethmngr))

View File

@@ -1,48 +0,0 @@
#
# Copyright (C) 2021 IOPSYS Software Solutions AB
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=fdtextract
PKG_RELEASE:=1
PKG_VERSION:=1.0
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/fdtextract.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=0ebaf1e7d1f09318ae75d0f475a25280742b790e
PKG_MIRROR_HASH:=skip
PKG_LICENSE:=GPLv2
PKG_LICENSE_FILES:=LICENSE
RSTRIP:=true
export BUILD_DIR
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)
CATEGORY:=Utilities
TITLE:=fdtextract
DEPENDS:= +libfdt
endef
define Package/$(PKG_NAME)/description
Command to extract sub images from FIT images.
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/fdtextract $(1)/usr/sbin/
$(STRIP) $(1)/usr/sbin/fdtextract
endef
$(eval $(call BuildPackage,$(PKG_NAME)))

54
fping/Makefile Normal file
View File

@@ -0,0 +1,54 @@
#
# Copyright (C) 2016 Nikil Mehta <nikil.mehta@gmail.com>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=fping
PKG_VERSION:=4.0
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://fping.org/dist/
PKG_HASH:=67eb4152b98ad34f99d2eec4e1098a0bb52caf13c0c89cd147349d08190fe8ce
PKG_MAINTAINER:=Nikil Mehta <nikil.mehta@gmail.com>
PKG_LICENSE:=BSD-4-Clause
PKG_LICENSE_FILES:=COPYING
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/fping
SECTION:=net
CATEGORY:=Network
TITLE:=sends ICMP ECHO_REQUEST packets to network hosts
URL:=http://fping.org/
endef
define Package/fping/description
fping is a ping like program which uses the Internet Control Message Protocol
(ICMP) echo request to determine if a target host is responding. fping
differs from ping in that you can specify any number of targets on the command
line, or specify a file containing the lists of targets to ping. Instead of
sending to one target until it times out or replies, fping will send out a
ping packet and move on to the next target in a round-robin fashion.
endef
CONFIGURE_ARGS+= \
--enable-ipv4 \
--enable-ipv6
TARGET_CFLAGS += -std=gnu99
define Package/fping/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/fping $(1)/usr/bin/
endef
$(eval $(call BuildPackage,fping))

View File

@@ -28,7 +28,6 @@ define KernelPackage/$(PKG_NAME)
FILES:=$(PKG_BUILD_DIR)/$(PKG_NAME).$(LINUX_KMOD_SUFFIX)
KCONFIG:=CONFIG_PACKAGE_kmod-gryphon-led-kernel-module=y
AUTOLOAD:=$(call AutoLoad,60,$(PKG_NAME))
DEPENDS:= +(TARGET_iopsys_brcm63xx_arm):bcmkernel
PKG_LICENSE:=GPLv2
PKG_LICENSE_URL:=
endef
@@ -41,21 +40,6 @@ EXTRA_KCONFIG:= CONFIG_RGB_LED=m
MODULE_INCLUDE=-I$(PKG_BUILD_DIR)
ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),y)
LINUX_DIR:=$(BUILD_DIR)/bcmkernel/bcm963xx/kernel/linux-4.19
MODULES_SUBDIR:=lib/modules/4.19.183
TARGET_CROSS:=$(CONFIG_BRCM_ALT_TOOLCHAIN_BASE)/$(CONFIG_BRCM_ALT_ARM_TOOLCHAIN_TOPDIR)/bin/$(CONFIG_BRCM_ALT_ARM_TOOLCHAIN_PREFIX)-
ifeq ($(CONFIG_BCM_CHIP_ID),$(filter $(CONFIG_BCM_CHIP_ID),"63158" "6856" "6858"))
# These targets use a 64-bit kernel
LINUX_KARCH:=arm64
TARGET_CROSS:=$(CONFIG_BRCM_ALT_TOOLCHAIN_BASE)/$(CONFIG_BRCM_ALT_AARCH64_TOOLCHAIN_TOPDIR)/bin/$(CONFIG_BRCM_ALT_AARCH64_TOOLCHAIN_PREFIX)-
endif
# For some reason, Broadcom's kernel does not set the include paths correctly when compiling out-of-tree modules
EXTRA_KCPPFLAGS:="-I $(LINUX_DIR)/../bcmkernel/include -I $(LINUX_DIR)/arch/arm/mach-bcm963xx/include"
endif
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)/kdevlinks/
$(CP) -s `pwd`/src/* $(PKG_BUILD_DIR)/kdevlinks/

View File

@@ -43,18 +43,12 @@
static ssize_t get_led_color(struct device *dev,
struct device_attribute *attr, char *buf)
{
/* [ln] todo: dummy implementation */
int len;
struct sk9822_leds *sk9822 = dev_get_drvdata(dev);
if (IS_ERR(sk9822)) {
printk(KERN_ERR "Platform get drvdata returned NULL\n");
return -EIO;
}
len = scnprintf(buf, PAGE_SIZE, "%02x%02x%02x\n", sk9822->led_colors[0].r, sk9822->led_colors[0].g, sk9822->led_colors[0].b);
len = sprintf(buf, "%d\n", 123);
if (len <= 0) {
dev_err(dev, "sk9822: Invalid sprintf len: %d\n", len);
return -EIO;
}
return len;
@@ -105,69 +99,8 @@ static ssize_t set_led_color(struct device *dev,
}
static DEVICE_ATTR(led_color, S_IRUGO | S_IWUSR, get_led_color, set_led_color);
static ssize_t get_led_brightness(struct device *dev,
struct device_attribute *attr, char *buf)
{
int len;
struct sk9822_leds *sk9822 = dev_get_drvdata(dev);
if (IS_ERR(sk9822)) {
printk(KERN_ERR "Platform get drvdata returned NULL\n");
return -EIO;
}
len = scnprintf(buf, PAGE_SIZE, "%x\n", sk9822->led_brightness);
if (len <= 0) {
dev_err(dev, "sk9822: Invalid sprintf len: %d\n", len);
return -EIO;
}
return len;
}
/**
* @brief Set LED brightness
* @retval count number of bytes written
* @retval -EINVAL if the message is not a valid hexadecimal number
* @retval -EIO for all other errors (e.g. leds cannot be configured)
*/
static ssize_t set_led_brightness(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
int ret = 0;
struct sk9822_leds *sk9822 = dev_get_drvdata(dev);
unsigned long val = SK9822_DEFAULT_BRIGHTNESS;
if (IS_ERR(sk9822)) {
printk(KERN_ERR "Platform get drvdata returned NULL\n");
return -EIO;
}
if (kstrtoul(buf, 16, &val)) {
return -EINVAL;
}
if(val > SK9822_DEFAULT_BRIGHTNESS) {
val = SK9822_DEFAULT_BRIGHTNESS;
}
sk9822->led_brightness = (uint8_t)val;
// Now push to the HW
ret = sk9822_update(sk9822);
if (ret != 0) {
printk(KERN_ERR "Failed to update led\n");
return -EIO;
}
return count;
}
static DEVICE_ATTR(led_brightness, S_IRUGO | S_IWUSR, get_led_brightness, set_led_brightness);
static struct attribute *sk9822_dev_attrs[] = {
&dev_attr_led_color.attr,
&dev_attr_led_brightness.attr,
NULL
};
@@ -196,8 +129,6 @@ static int canyon_led_probe(struct platform_device *pdev)
if (ret < 0) {
dev_warn(&pdev->dev, "Could not read led-count property\n");
leds->led_count = SK9822_DEFAULT_NUM_LEDS;
} else {
printk(KERN_INFO "Got led count: %u\n", leds->led_count);
}
leds->led_colors = devm_kzalloc(&pdev->dev,
@@ -209,7 +140,7 @@ static int canyon_led_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, leds);
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
#if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 16, 0)
leds->clock_gpio = gpiod_get_index(&pdev->dev, "led", 0);
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0)
leds->clock_gpio = gpiod_get_index(&pdev->dev, "led", 0, GPIOD_OUT_HIGH);
@@ -217,12 +148,6 @@ static int canyon_led_probe(struct platform_device *pdev)
dev_warn(&pdev->dev, "Kernel version Not supported\n");
exit(1);
#endif
if (IS_ERR(leds->clock_gpio)) {
dev_err(&pdev->dev, "Failed to acquire clock GPIO %ld\n",
PTR_ERR(leds->clock_gpio));
leds->clock_gpio = NULL;
return PTR_ERR(leds->clock_gpio);
}
gpiod_direction_output(leds->clock_gpio, 1);
if (IS_ERR(leds->clock_gpio)) {
@@ -235,7 +160,7 @@ static int canyon_led_probe(struct platform_device *pdev)
gpiod_set_value(leds->clock_gpio, 0);
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
#if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 16, 0)
leds->data_gpio = gpiod_get_index(&pdev->dev, "led", 1);
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0)
leds->data_gpio = gpiod_get_index(&pdev->dev, "led", 1, GPIOD_OUT_HIGH);
@@ -243,12 +168,6 @@ static int canyon_led_probe(struct platform_device *pdev)
dev_warn(&pdev->dev, "Kernel version Not supported\n");
exit(1);
#endif
if (IS_ERR(leds->data_gpio)) {
dev_err(&pdev->dev, "Failed to acquire data GPIO %ld\n",
PTR_ERR(leds->data_gpio));
leds->data_gpio = NULL;
return PTR_ERR(leds->data_gpio);
}
gpiod_direction_output(leds->data_gpio, 1);
if (IS_ERR(leds->data_gpio)) {

46
icgroupd/Makefile Normal file
View File

@@ -0,0 +1,46 @@
#
# Copyright (C) 2019 iopsys Software Solutions AB
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=icgroupd
PKG_VERSION:=1.0
PKG_RELEASE:=0
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=
PKG_MAINTAINER:=Inteno Broadband AB
include $(INCLUDE_DIR)/package.mk
define Package/icgroupd
SECTION:=base
CATEGORY:=Base system
TITLE:=Inteno cgroup daemon
DEPENDS:=+uci +busybox
endef
define Package/icgroupd/description
This package contains Intenos cgroup daemon and associated
configuration and startup scripts.
endef
define Build/Compile
true
endef
define Package/icgroupd/install
$(INSTALL_DIR) $(1)/sbin $(1)/etc/init.d $(1)/etc/config
$(INSTALL_CONF) ./files/cgroups.config $(1)/etc/config/cgroups
$(INSTALL_BIN) ./files/cgroups.init $(1)/etc/init.d/cgroups
$(INSTALL_BIN) ./files/cgroupd $(1)/sbin/
endef
$(eval $(call BuildPackage,icgroupd))

76
icgroupd/files/cgroupd Executable file
View File

@@ -0,0 +1,76 @@
#!/bin/sh
CGBASEDIR=$1
CGCONFIG=$2
[ -n "$CGBASEDIR" -a -n "$CGCONFIG" ] || exit 1
[ -r /lib/functions.sh ] || exit 1
. /lib/functions.sh
CGPROCMAP=/tmp/cgprocmap
CGPERIOD=3s
DBGLOG=/tmp/cgroupd.log
DEBUG=0
add_to_procmap () {
local name_grp=$1
local name grp
name=$(echo $name_grp |awk -F= '{print $1}')
grp=$(echo $name_grp |awk -F= '{print $2}')
echo "($name) $grp" >> $CGPROCMAP
}
# Read configuration file and create process:group look-up table
# in /tmp file
read_config () {
local enab
config_load $CGCONFIG
config_get enab cgroups enabled "1"
[ $enab -eq 0 ] && exit 1
config_get CGDEFGROUP cgroups defgroup "_undef_"
[ "$CGDEFGROUP" == "_undef_" ] && exit 1
[ "$DEBUG" == "1" ] && echo "default $CGDEFGROUP" >> $DBGLOG
echo -n '' > $CGPROCMAP
config_list_foreach procmap procmap add_to_procmap
[ "$DEBUG" == "1" ] && cat $CGPROCMAP >> $DBGLOG
}
# Move all process except init from cgroup root to cgroups according
# to /tmp look-up table
move_wild_procs () {
local wild_procs=$(cat $CGBASEDIR/cgroup.procs)
local pid name grp
for pid in $wild_procs; do
[ $pid -eq 1 ] && continue
if [ -d /proc/$pid ]; then
name=$(awk '{print $2}' /proc/$pid/stat)
grp=$(awk "\$1==\"$name\" {print \$2}" $CGPROCMAP)
[ "$grp" == "." ] && continue
[ -n "$grp" ] || grp=$CGDEFGROUP
[ "$DEBUG" == "1" ] && \
echo "Moving proc $pid $name to $grp" >> $DBGLOG
echo $pid > $CGBASEDIR/$grp/cgroup.procs
fi
done
}
[ "$DEBUG" == "1" ] && echo "$0 started $(date)" >> $DBGLOG
read_config
while true; do
move_wild_procs
sleep $CGPERIOD
done

View File

@@ -0,0 +1,48 @@
config cgroups cgroups
option enabled 1
option defgroup iopsys/normal
config cgroup _root_
# list option cpu.rt_runtime_us=50000
list option memory.move_charge_at_immigrate=1
config cgroup iopsys
list option cpu.shares=4096
# list option cpu.rt_runtime_us=40000
list option memory.limit_in_bytes=-1
list option memory.move_charge_at_immigrate=1
config cgroup iopsys_normal
list option cpu.shares=1024
# list option cpu.rt_runtime_us=10000
list option memory.limit_in_bytes=-1
list option memory.move_charge_at_immigrate=1
config cgroup iopsys_high
list option cpu.shares=4096
# list option cpu.rt_runtime_us=30000
list option memory.limit_in_bytes=-1
list option memory.move_charge_at_immigrate=1
config cgroup 3prt
list option cpu.shares=1024
# list option cpu.rt_runtime_us=10000
list option memory.limit_in_bytes=75M
list option memory.move_charge_at_immigrate=1
config cgroup 3prt_normal
list option cpu.shares=1024
# list option cpu.rt_runtime_us=2500
list option memory.limit_in_bytes=75M
list option memory.move_charge_at_immigrate=1
config cgroup 3prt_high
list option cpu.shares=4096
# list option cpu.rt_runtime_us=7500
list option memory.limit_in_bytes=75M
list option memory.move_charge_at_immigrate=1
config procmap procmap
list procmap kthreadd=.
list procmap minidlna=3prt/normal

93
icgroupd/files/cgroups.init Executable file
View File

@@ -0,0 +1,93 @@
#!/bin/sh /etc/rc.common
START=01
USE_PROCD=1
PROCD_DEBUG=1
NAME=cgroupd
CGBASEDIR=/sys/fs/cgroup
CGCONFIG="cgroups"
DBGLOG=/tmp/cginit.log
DEBUG=0
cgroupinit_set_knob_value () {
local knob_val=$1
local dir=$2
local knob val
knob=$(echo $knob_val |awk -F= '{print $1}')
val=$(echo $knob_val |awk -F= '{print $2}')
/bin/echo $val > $CGBASEDIR/$dir/$knob
[ "$DEBUG" == "1" ] && \
echo "/bin/echo $val > $CGBASEDIR/$dir/$knob (ret=$?)" >> $DBGLOG
}
cgroupinit_create_group () {
local cgrp=$1
local dir
[ "$DEBUG" == "1" ] && echo "Create group $cgrp:" >> $DBGLOG
if [ "$cgrp" == "_root_" ]; then
dir=.
else
dir=$(echo $cgrp |tr '_' '/')
if [ ! -d $CGBASEDIR/$dir ]; then
mkdir $CGBASEDIR/$dir
[ "$DEBUG" == "1" ] && \
echo "mkdir $CGBASEDIR/$dir (ret=$?)" >> $DBGLOG
fi
fi
config_list_foreach $cgrp option cgroupinit_set_knob_value $dir
}
cgroupinit_configure_cgroups () {
local enab defgrp
[ "$DEBUG" == "1" ] && echo "$0 started $(date)" >> $DBGLOG
config_load $CGCONFIG
config_get enab cgroups enabled "1"
[ $enab -eq 0 ] && return 1
config_get defgrp cgroups defgroup "_undef_"
[ "$defgrp" == "_undef_" ] && return 1
if ! grep -q " $CGBASEDIR cgroup " /proc/mounts; then
mount -t cgroup -o nodev,noexec,nosuid cgroup $CGBASEDIR
[ $? -eq 0 ] || return 1
fi
config_foreach cgroupinit_create_group cgroup
return 0
}
start_service () {
cgroupinit_configure_cgroups
[ $? -eq 0 ] || return
procd_open_instance
procd_set_param command /sbin/cgroupd $CGBASEDIR $CGCONFIG
procd_set_param respawn
procd_close_instance
}
stop_service () {
local cgdir procs prc
for cgdir in $(find $CGBASEDIR -type d -mindepth 1 -depth); do
procs=$(cat $cgdir/cgroup.procs)
for prc in $procs; do
echo $prc > $CGBASEDIR/cgroup.procs
done
rmdir $cgdir
done
}
service_triggers() {
procd_add_reload_trigger $CGCONFIG
}

View File

@@ -1,14 +1,27 @@
if PACKAGE_icwmp-curl || PACKAGE_icwmp-zstream
config CWMP_SCRIPTS_FULL
bool "Install all icwmp scripts"
default y
choice
prompt "Select ACS sever"
default CWMP_ACS_MULTI
depends on PACKAGE_icwmp || \
PACKAGE_icwmp-openssl || \
PACKAGE_icwmp-wolfssl || \
PACKAGE_icwmp-mbedtls
prompt "Select ACS sever"
default CWMP_ACS_MULTI
config CWMP_ACS_MULTI
bool "No specific ACS, follow standard"
config CWMP_ACS_HDM
bool "Select HDM as ACS server"
bool "HDM"
endchoice
config CWMP_DEBUG
bool "Compile with debug options"
default y
config CWMP_DEVEL_DEBUG
bool "Compile with development debug options"
default n
endif

View File

@@ -1,5 +1,5 @@
#
# Copyright (C) 2020-2022 IOPSYS Software Solutions AB
# Copyright (C) 2019 iopsys Software Solutions AB
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
@@ -8,70 +8,100 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=icwmp
PKG_VERSION:=8.4.26.10
PKG_SOURCE_PROTO:=git
PKG_VERSION:=4.0-2019-12-11
PKG_FIXUP:=autoreconf
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/icwmp.git
PKG_SOURCE_VERSION:=ac7410a726a7269dcaef4c80061cab7a4447f6d1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=3fdaca7e3463d46a52f31496b0f84deb6b21eaf8
PKG_RELEASE=$(PKG_SOURCE_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_LICENSE:=GPLv2
PKG_LICENSE_FILES:=LICENSE
PKG_LICENSE_FILES:=COPYING
PKG_FIXUP:=autoreconf
PKG_CONFIG_DEPENDS:= \
CONFIG_CWMP_ACS_MULTI \
CONFIG_CWMP_ACS_HDM \
CONFIG_CWMP_DEBUG \
CONFIG_CWMP_DEVEL_DEBUG
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
CWMP_REVISION=$(shell svnversion ./src/ -n|cut -f2 -d:)
include $(INCLUDE_DIR)/package.mk
define Package/icwmp/default
define Package/icwmp_stun
SECTION:=utils
CATEGORY:=Utilities
SUBMENU:=TRx69
TITLE:=TR069 CWMP client
DEPENDS:=+libuci +libubox +libblobmsg-json +libubus +libjson-c +libcurl +mxml
TITLE:=TR-069 stun Client
DEPENDS:=+libubus +libuci +libubox +libjson-c +libopenssl +libblobmsg-json
endef
TARGET_CFLAGS += \
-D_GNU_SOURCE -g \
"-DCWMP_REVISION=\\\"$(PKG_SOURCE_VERSION)\\\""
define Package/icwmp-openssl
$(Package/icwmp/default)
TITLE += (openssl)
DEPENDS += +PACKAGE_icwmp-openssl:libopenssl
VARIANT:=openssl
define Package/icwmp_xmpp
SECTION:=utils
CATEGORY:=Utilities
TITLE:=TR-069 xmpp feature
DEPENDS:=+libuci +libubox +libexpat +libstrophe
endef
define Package/icwmp-wolfssl
$(Package/icwmp/default)
TITLE += (wolfssl)
DEPENDS += +PACKAGE_icwmp-wolfssl:libwolfssl
CONFLICTS := icwmp-openssl
VARIANT:=wolfssl
define Package/icwmp_twamp
SECTION:=utils
CATEGORY:=Utilities
TITLE:=TR-069 twamp feature
DEPENDS:=+libuci
endef
define Package/icwmp-mbedtls
$(Package/icwmp/default)
TITLE += (mbedtls)
DEPENDS += +PACKAGE_icwmp-mbedtls:libmbedtls
CONFLICTS := icwmp-openssl icwmp-wolfssl
VARIANT:=mbedtls
DEFAULT_VARIANT:=1
define Package/icwmp_udpechoserver
SECTION:=utils
CATEGORY:=Utilities
TITLE:=TR-069 udpechoserver feature
DEPENDS:=+libuci
endef
ifeq ($(BUILD_VARIANT),openssl)
CONFIGURE_ARGS += --enable-libopenssl
endif
define Package/icwmp_bulkdata
SECTION:=utils
CATEGORY:=Utilities
TITLE:=TR-069 BulkData Collection
DEPENDS:=+libubus +libuci +libubox +libjson-c +libcurl +curl +libblobmsg-json +libbbfdm
endef
ifeq ($(BUILD_VARIANT),wolfssl)
CONFIGURE_ARGS += --enable-libwolfssl
endif
define Package/icwmp-tr098
SECTION:=utils
CATEGORY:=Utilities
TITLE:=CWMP client for TR-098 Data Model
DEPENDS:=+libuci +libmicroxml +libubox +jshn +libubus +libblobmsg-json +libpthread +ubusd +shflags +getopt +zlib +libjson-c +libopenssl +curl +libcurl +libtr098
endef
ifeq ($(BUILD_VARIANT),mbedtls)
CONFIGURE_ARGS += --enable-libmbedtls
endif
define Package/icwmp/Default
SECTION:=utils
CATEGORY:=Utilities
TITLE:=CWMP client
DEPENDS:=+libuci +libmicroxml +libubox +jshn +libubus +libblobmsg-json +libpthread +ubusd +shflags +getopt +zlib +libjson-c +libopenssl +curl +libbbfdm
endef
define Package/icwmp/description
A free client implementation of CWMP (TR-069) protocol
endef
define Package/icwmp-curl
$(call Package/icwmp/Default)
TITLE+= (using libcurl)
DEPENDS+= +libcurl
VARIANT:=curl
endef
define Package/icwmp-zstream
$(call Package/icwmp/Default)
TITLE+= (using libzstream)
DEPENDS+= +libzstream
VARIANT:=zstream
endef
define Package/icwmp-zstream/config
source "$(SOURCE)/Config_cwmp.in"
endef
USE_LOCAL=$(shell ls ./src/ 2>/dev/null >/dev/null && echo 1)
ifneq ($(USE_LOCAL),)
@@ -80,32 +110,158 @@ define Build/Prepare
endef
endif
define Package/icwmp/default/install
TARGET_CFLAGS += \
-D_GNU_SOURCE -D_AADJ
ifeq ($(CONFIG_PACKAGE_icwmp-tr098),y)
CONFIGURE_ARGS += \
--enable-icwmp_tr098
endif
ifneq ($(CWMP_REVISION)_,_)
ifneq ($(CWMP_REVISION),exported)
ifneq ($(CWMP_REVISION),Unversioned directory)
TARGET_CFLAGS += "-DCWMP_REVISION=\\\"$(CWMP_REVISION)\\\""
TARGET_LDFLAGS += "-DCWMP_REVISION=\\\"$(CWMP_REVISION)\\\""
endif
endif
endif
TARGET_LDFLAGS += \
-Wl,-rpath-link=$(STAGING_DIR)/usr/lib
CONFIGURE_ARGS += \
--with-uci-include-path=$(STAGING_DIR)/usr/include \
--with-libubox-include-path=$(STAGING_DIR)/usr/include \
--with-libubus-include-path=$(STAGING_DIR)/usr/include
ifeq ($(BUILD_VARIANT),zstream)
CONFIGURE_ARGS += \
--enable-http=zstream \
--with-zstream-include-path=$(STAGING_DIR)/usr/include
endif
ifeq ($(BUILD_VARIANT),curl)
CONFIGURE_ARGS += \
--enable-http=curl
endif
ifeq ($(CONFIG_CWMP_ACS_MULTI),y)
CONFIGURE_ARGS += \
--enable-acs=multi
endif
ifeq ($(CONFIG_CWMP_ACS_HDM),y)
CONFIGURE_ARGS += \
--enable-acs=hdm
endif
ifeq ($(CONFIG_CWMP_DEBUG),y)
CONFIGURE_ARGS += \
--enable-debug
endif
ifeq ($(CONFIG_CWMP_DEVEL_DEBUG),y)
CONFIGURE_ARGS += \
--enable-devel
endif
define Package/icwmp-$(BUILD_VARIANT)/install
$(INSTALL_DIR) $(1)/etc/icwmpd
$(INSTALL_DIR) $(1)/usr/sbin
$(CP) $(PKG_BUILD_DIR)/bin/icwmpd $(1)/usr/sbin
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) $(PKG_BUILD_DIR)/config/cwmp $(1)/etc/config
$(INSTALL_CONF) $(PKG_BUILD_DIR)/config/firewall.cwmp $(1)/etc/firewall.cwmp
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_DIR) $(1)/lib/upgrade/keep.d
$(INSTALL_DIR) $(1)/etc/bbfdm/json/
$(INSTALL_DIR) $(1)/etc/udhcpc.user.d
$(INSTALL_BIN) $(PKG_BUILD_DIR)/icwmpd $(1)/usr/sbin/icwmpd
$(INSTALL_DATA) ./files/etc/config/cwmp $(1)/etc/config/cwmp
$(INSTALL_BIN) ./files/etc/firewall.cwmp $(1)/etc/firewall.cwmp
$(INSTALL_BIN) ./files/etc/init.d/icwmpd $(1)/etc/init.d/icwmpd
$(INSTALL_BIN) ./files/etc/uci-defaults/85-cwmp-set-userid $(1)/etc/uci-defaults/
$(INSTALL_BIN) ./files/etc/uci-defaults/90-cwmpfirewall $(1)/etc/uci-defaults/
$(INSTALL_DATA) ./files/lib/upgrade/keep.d/icwmp $(1)/lib/upgrade/keep.d/icwmp
$(INSTALL_BIN) ./files/etc/icwmpd/update.sh $(1)/etc/icwmpd/update.sh
$(INSTALL_DATA) ./files/etc/bbfdm/json/CWMPManagementServer.json $(1)/etc/bbfdm/json/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/etc/udhcpc.user.d/udhcpc_icwmp_opt125.user $(1)/etc/udhcpc.user.d/udhcpc_icwmp_opt125.user
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/etc/udhcpc.user.d/udhcpc_icwmp_opt43.user $(1)/etc/udhcpc.user.d/udhcpc_icwmp_opt43.user
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init/icwmpd.init $(1)/etc/init.d/icwmpd
$(INSTALL_BIN) $(PKG_BUILD_DIR)/uci-defaults/90-cwmpfirewall $(1)/etc/uci-defaults/90-cwmpfirewall
ifeq ($(CONFIG_CWMP_SCRIPTS_FULL),y)
$(INSTALL_DIR) $(1)/usr/share/icwmp
$(CP) $(PKG_BUILD_DIR)/scripts/defaults $(1)/usr/share/icwmp
$(CP) $(PKG_BUILD_DIR)/scripts/functions $(1)/usr/share/icwmp
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/icwmp.sh $(1)/usr/sbin/icwmp
endif
$(CP) ./files/* $(1)/
endef
Package/icwmp-openssl/install = $(Package/icwmp/default/install)
Package/icwmp-wolfssl/install = $(Package/icwmp/default/install)
Package/icwmp-mbedtls/install = $(Package/icwmp/default/install)
define Package/icwmp-tr098/install
$(INSTALL_DIR) $(1)/usr/sbin
$(CP) $(PKG_BUILD_DIR)/bin/icwmp_tr098d $(1)/usr/sbin
endef
$(eval $(call BuildPackage,icwmp-openssl))
$(eval $(call BuildPackage,icwmp-wolfssl))
$(eval $(call BuildPackage,icwmp-mbedtls))
define Package/icwmp_stun/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/icwmp_stund $(1)/usr/sbin/icwmp_stund
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init/icwmp_stund $(1)/etc/init.d/icwmp_stund
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) $(PKG_BUILD_DIR)/config/cwmp_stun $(1)/etc/config
endef
define Package/icwmp_xmpp/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/icwmp_xmppd $(1)/usr/sbin/icwmp_xmppd
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init/icwmp_xmppd $(1)/etc/init.d/icwmp_xmppd
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) $(PKG_BUILD_DIR)/config/cwmp_xmpp $(1)/etc/config
$(CP) ./xmpp-files/* $(1)/
endef
define Package/icwmp_udpechoserver/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/icwmp_udpechoserverd $(1)/usr/sbin/icwmp_udpechoserverd
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init/icwmp_udpechoserverd $(1)/etc/init.d/icwmp_udpechoserverd
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) $(PKG_BUILD_DIR)/config/cwmp_udpechoserver $(1)/etc/config
endef
define Package/icwmp_twamp/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/icwmp_twampd $(1)/usr/sbin/icwmp_twampd
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init/icwmp_twampd $(1)/etc/init.d/icwmp_twampd
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) $(PKG_BUILD_DIR)/config/cwmp_twamp $(1)/etc/config
endef
define Package/icwmp_bulkdata/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/icwmp_bulkdatad $(1)/usr/sbin/icwmp_bulkdatad
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init/icwmp_bulkdatad $(1)/etc/init.d/icwmp_bulkdatad
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) $(PKG_BUILD_DIR)/config/cwmp_bulkdata $(1)/etc/config
endef
define Package/icwmp-$(BUILD_VARIANT)/postinst
#!/bin/sh
echo "$(CWMP_BKP_FILE)" >> $${IPKG_INSTROOT}/etc/sysupgrade.conf
if [ -z "$${IPKG_INSTROOT}" ]; then
echo "Enabling rc.d symlink for icwmpd"
/etc/init.d/icwmpd enable
fi
exit 0
endef
define Package/icwmp-$(BUILD_VARIANT)/prerm
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
echo "Disabling rc.d symlink for icwmpd"
/etc/init.d/icwmpd disable
fi
exit 0
endef
$(eval $(call BuildPackage,icwmp-curl))
$(eval $(call BuildPackage,icwmp_stun))
$(eval $(call BuildPackage,icwmp_xmpp))
$(eval $(call BuildPackage,icwmp_udpechoserver))
$(eval $(call BuildPackage,icwmp_twamp))
$(eval $(call BuildPackage,icwmp_bulkdata))
$(eval $(call BuildPackage,icwmp-tr098))
$(eval $(call BuildPackage,icwmp-zstream))

136
icwmp/README Normal file
View File

@@ -0,0 +1,136 @@
1)Build
Requirements<74>:
librairies:
- libuci.so
- libexpat.so
- libcurl.so
- libpthread.so
- libopenssl.so
- libz.so
- libcrypto.so
the librairies should be present in the "staging_dir/target-i386_uClibc-0.9.30.1/usr/lib/" or "staging_dir/toolchain-mips_gcc-4.3.3+cs_uClibc-0.9.30.1/usr/lib"
header files and folders:
- expat.h
- expat_external.h
- uci.h
- uci_config.h
- zlib.h
- curl folder
- openssl folder
the header files and folders should be present in the staging_dir/target-i386_uClibc-0.9.30.1/usr/include/ or staging_dir/toolchain-i386_gcc-4.1.2_uClibc-0.9.30.1/usr/include/
if a librairie doesn't exist:
a- run make menuconfig and select the librarie
b- build the librarie package
2) Build
this software is composed of 3 packages:
- icwmp package: contains icwmpd daemon
- cwmp lib package: contains cwmplib and contains cwmp_value_change binary. They could be used by other user space applications in order to notify the icwmp daemon when paramter changes
- cwmp kernel package: contains cwmp kernel module. This module could be used by other kernel modules to notify the icwmpd daemon when kernel parameter changes
The three packages should be selected in the make menu config in order to get the three packages compiled.
To compile the three packages: $ make package/cwmpd/compile
3) OpenWRT settings
in the OpenWRT, Add the following lines in the /usr/share/udhcpc/default.script file:
uci_set_state provisioning iup tr069url "$url"
uci_set_state provisioning iup provisioningcode "$provisioningcode"
4) Run
Requirements:
- libuci package should be installed
- libexpat package should be installed
- libcurl package should be installed
- libpthread package should be installed
- libopenssl package should be installed
- libz package should be installed
- libcrypto package should be installed
Configure the acs url in the /etc/config/icwmp
and then start the cwmpd service: /etc/init.d/icwmpd start
for the help: /etc/init.d/icwmpd
5) Value Change
5.1) value change for user space applications (using the libcwmp)
Before using the libcwmp, we should check that the libcwmp package is selected in "make menu config". and we should check that the package is compiled.
The libcwmp should be installed uin the OpenWRT firmware
example of using libcwmp
in myapplication.c
#...
#include <cwmp_lib.h>
#...
int anyfunction ()
{
.....
/* parameter change here */
/* so we inform the icwmp: */
lib_api_cwmp_value_change_call (3, "InternetGatewayDevice.LANDevice.{i}.LANHostConfigManagement.IPInterface.{i}.IPInterfaceIPAddress","lan2","3");
.....
/*
Description of lib_api_cwmp_value_change_call input parameters
parameter 1 : is the number of input string in the function lib_api_cwmp_value_change_call
parameter 2 : is the parameter path
parameter 3 : is the first correspondence related to the first indice
parameter 4 : is the second correspondence related to the second indice
.
.
.
parameter n : is the (n-2) correspondence related to the (n-2) indice
*/
}
5.2) value change for user space applications (using the cwmp_value_change CLI)
Before using the libcwmp, we should check that the libcwmp package is selected in "make menu config". and we should check that the package is compiled.
The libcwmp should be installed uin the OpenWRT firmware
in OpenWRT:
root@OpenWrt:~# cwmp_value_change InternetGatewayDevice.LANDevice.{i}.LANHostConfigManagement.IPInterface.{i}.IPInterfaceIPAddress "lan2" "3"
in this case the command will force cwmp client to send a notification to the ACS (if and only if the parameter path as configured as active or as passive parameter using the setAttributeParameter method)
5.3) value change for kernel space modules
Before using the cwmp kernel module for value change, we should check that the kernel module package is selected in "make menu config". and we should check that the package is compiled.
The kernel module should be installed uin the OpenWRT firmware and should be insert before all other kernel modules
example of using cwmp kernel module
in mykernelmodule.c
#...
#include <linux/cwmp_kernel.h>
#...
int anykernelfunction ()
{
.....
/* parameter change here */
/* so we inform the cwmp: */
kernel_api_cwmp_value_change_call (3, "InternetGatewayDevice.LANDevice.{i}.LANHostConfigManagement.IPInterface.{i}.IPInterfaceIPAddress","lan2","3");
.....
/*
Description of lib_api_cwmp_value_change_call input parameters
parameter 1 : is the number of input string in the function lib_api_cwmp_value_change_call
parameter 2 : is the parameter path
parameter 3 : is the first correspondence related to the first indice
parameter 4 : is the second correspondence related to the second indice
.
.
.
parameter n : is the (n-2) correspondence related to the (n-2) indice
*/
}

View File

@@ -1,36 +0,0 @@
{
"json_plugin_version": 1,
"Device.CWMPManagementServer.": {
"type": "object",
"version": "2.15",
"protocols": [
"usp"
],
"access": false,
"array": false,
"dependency": "file:/etc/config/cwmp",
"EnableCWMP": {
"type": "boolean",
"version": "2.15",
"read": true,
"write": true,
"protocols": [
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "cwmp",
"section": {
"name": "cpe"
},
"option": {
"name": "enable"
}
}
}
]
}
}
}

View File

@@ -1,45 +0,0 @@
config acs 'acs'
option userid '' #$OUI-$SER
option passwd 'iopsys'
option periodic_inform_enable 'true'
option periodic_inform_interval '1800'
option periodic_inform_time '0001-01-01T00:00:00Z'
option dhcp_discovery 'enable'
# compression possible configs: GZIP, Deflate, Disabled
option compression 'Disabled'
#­ possible configs interval :[1:65535]
option retry_min_wait_interval '5'
#­ possible configs interval :[1000:65535]
option retry_interval_multiplier '2000'
option ipv6_enable '0'
option ip_version '4'
config cpe 'cpe'
option enable '1'
option default_wan_interface 'wan'
option default_lan_interface 'lan'
option log_to_console 'disable'
option log_to_file 'disable'
# log_severity: INFO (Default)
# log_severity possible configs: EMERG, ALERT, CRITIC ,ERROR, WARNING, NOTICE, INFO, DEBUG
option log_severity 'INFO'
option log_file_name '/var/log/icwmpd.log'
option log_max_size '102400'
option userid '' #$OUI-$SER
option passwd 'iopsys'
option port '7547'
option provisioning_code ''
option amd_version '5'
# compression possible configs: InstanceNumber, InstanceAlias
option instance_mode 'InstanceNumber'
option session_timeout '60'
option notification '1'
option exec_download '0'
option periodic_notify_enable '1'
option periodic_notify_interval '10'
option incoming_rule 'Port_Only'
config lwn 'lwn'
option enable '1'
option hostname ''
option port '0'

View File

@@ -1,80 +0,0 @@
#!/bin/sh
#created by the icwmp package
log() {
echo "${@}"|logger -t firewall.cwmp -p info
}
if [ ! -f "/var/state/cwmp" ]; then
exit 0;
fi
zone_name=$(uci -c /var/state -q get cwmp.acs.zonename)
port=$(uci -q get cwmp.cpe.port)
ipaddr=$(uci -c /var/state -q get cwmp.acs.ip)
ip6addr=$(uci -c /var/state -q get cwmp.acs.ip6)
incoming_rule=$(uci -q get cwmp.cpe.incoming_rule|tr 'A-Z' 'a-z')
if [ -z "${zone_name}" ]; then
log "empty firewall zone name"
exit 0
elif [ "$zone_name" = "icwmp" ]; then
iptables -nL zone_icwmp_input 2> /dev/null
if [ $? != 0 ]; then
iptables -w 1 -N zone_icwmp_input
iptables -w 1 -t filter -A INPUT -j zone_icwmp_input
iptables -w 1 -I zone_icwmp_input -p tcp --dport $port -j REJECT
else
iptables -w 1 -F zone_icwmp_input
iptables -w 1 -I zone_icwmp_input -p tcp --dport $port -j REJECT
fi
else
iptables -w 1 -F zone_icwmp_input 2> /dev/null
iptables -w 1 -t filter -D INPUT -j zone_icwmp_input 2> /dev/null
iptables -w 1 -X zone_icwmp_input 2> /dev/null
fi
cmd="iptables -w 1 -I zone_${zone_name}_input -p tcp"
cmd6="ip6tables -w 1 -I zone_${zone_name}_input -p tcp"
# default incoming rule is Port only
if [ -z "${incoming_rule}" ]; then
incoming_rule="port_only"
fi
if [ "${incoming_rule}" = "ip_only" ]; then
if [ -n "${ipaddr}" ]; then
cmd="${cmd} -s ${ipaddr}"
cmd6="${cmd6} -s ${ip6addr}"
fi
elif [ "${incoming_rule}" = "port_only" ]; then
if [ -n "${port}" ]; then
cmd="${cmd} --dport ${port}"
cmd6="${cmd6} --dport ${port}"
fi
else
if [ -n "${ipaddr}" ]; then
cmd="${cmd} -s ${ipaddr}"
cmd6="${cmd6} -s ${ip6addr}"
fi
if [ -n "${port}" ]; then
cmd="${cmd} --dport ${port}"
cmd6="${cmd6} --dport ${port}"
fi
fi
echo ${cmd}|grep -q "\-\-dport \|\-s "
if [ "$?" -eq 0 ]; then
cmd="${cmd} -j ACCEPT -m comment --comment=Open_ACS_port"
${cmd}
fi
echo ${cmd6}|grep -q "\-\-dport \|\-s "
if [ "$?" -eq 0 ]; then
cmd6="${cmd6} -j ACCEPT -m comment --comment=Open_ACS_port"
${cmd6}
fi
uci -c /var/state -q set cwmp.cpe.firewall_restart="init"
uci -c /var/state -q commit cwmp

View File

@@ -0,0 +1,87 @@
#!/bin/sh
. /lib/functions/network.sh
[ "$ACTION" == "ifup" ] || exit 0
[ -f /etc/config/cwmp ] || exit 0
handle_icwmp_restart() {
[ -f /tmp/switching_mode ] && exit 0
[ -f /tmp/wificontrol.txt -a -f /tmp/netmode-conf.pid ] && exit 0
[ "$INTERFACE" == "loopback" ] && exit 0
local defwan=$(uci -q get cwmp.cpe.default_wan_interface)
[ -n "$defwan" -a "$(uci -q get network.$defwan)" == "interface" -a "$defwan" != "$INTERFACE" ] && exit 0
local islan="$(uci -q get network.$INTERFACE.is_lan)"
[ "$islan" == "1" ] && exit 0
local proto="$(uci -q get network.$INTERFACE.proto)"
[ "$proto" == "none" ] && exit 0
local ifname="$(uci -q get network.$INTERFACE.ifname)"
[ "${ifname:0:1}" == "@" ] && exit 0
mkdir -p /tmp/ipv4
network_flush_cache
local previpaddr=""
local curipaddr=""
local ipaddrfile=/tmp/ipv4/$INTERFACE-ipaddr
previpaddr=$(cat $ipaddrfile 2>/dev/null)
network_get_ipaddr curipaddr $INTERFACE
[ -n "$curipaddr" ] && echo $curipaddr > $ipaddrfile || rm -f $ipaddrfile
local prevgateway=""
local curgateway=""
local gatewayfile=/tmp/ipv4/$INTERFACE-gateway
prevgateway=$(cat $gatewayfile 2>/dev/null)
network_get_gateway curgateway $INTERFACE
[ -n "$curgateway" ] && echo $curgateway > $gatewayfile || rm -f $gatewayfile
local prevsubnets=""
local cursubnets=""
local subnetsfile=/tmp/ipv4/$INTERFACE-subnets
prevsubnets=$(cat $subnetsfile 2>/dev/null)
network_get_subnets cursubnets $INTERFACE
[ -n "$cursubnets" ] && echo $cursubnets > $subnetsfile || rm -f $subnetsfile
local prevdnsservers=""
local curdnsservers=""
local dnsserverfile=/tmp/ipv4/$INTERFACE-dnsservers
prevdnsservers=$(cat $dnsserverfile 2>/dev/null)
network_get_dnsserver curdnsservers $INTERFACE
[ -n "$curdnsservers" ] && echo $curdnsservers > $dnsserverfile || rm -f $dnsserverfile
local prevdev=""
local curdev=""
local devfile=/tmp/ipv4/$INTERFACE-dev
prevdev=$(cat $devfile 2>/dev/null)
network_get_device curdev $INTERFACE
[ -n "$curdev" ] && echo $curdev > $devfile || rm -f $devfile
local prevopt43url=""
local curopt43url=""
local opt43urlfile=/tmp/ipv4/$INTERFACE-opt43url
prevopt43url=$(cat $opt43urlfile 2>/dev/null)
curopt43url="$(uci -P /var/state -q get cwmp.acs.dhcp_url)"
[ -n "$curopt43url" ] && echo $curopt43url > $opt43urlfile || rm -f $opt43urlfile
[ \
"$prevdev" == "$curdev" -a \
"$previpaddr" = "$curipaddr" -a \
"$prevgateway" = "$curgateway" -a \
"$prevsubnets" = "$cursubnets" -a \
"$prevdnsservers" = "$curdnsservers" \
] && {
[ "$prevopt43url" = "$curopt43url" ] && exit 0
[ -z "$prevopt43url" ] && exit 0
}
/etc/init.d/icwmpd reload &
}
handle_icwmp_restart

View File

@@ -1,29 +0,0 @@
#!/bin/sh
. /lib/functions.sh
log() {
echo "$@" |logger -t cwmp.update -p info
}
handle_icwmp_update() {
local cwmp_enable
config_load cwmp
config_get_bool cwmp_enable cpe enable 1
if [ "$cwmp_enable" = "0" ]; then
return 0
fi
status="$(ubus call tr069 status |jsonfilter -qe '@.last_session.status')"
if [ "$status" != "running" ]; then
log "Trigger out of bound inform, since last inform status was failure"
ubus -t 10 call tr069 inform >/dev/null 2>&1
# Handle timeout or tr069 object not found
if [ "$?" -eq 7 ] || [ "$?" -eq 4 ]; then
log "Restarting icwmp tr069 object"
/etc/init.d/icwmpd restart
fi
fi
}
handle_icwmp_update $@

View File

@@ -1,502 +0,0 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2015-2019 iopsys Software Solutions AB
START=99
STOP=00
USE_PROCD=1
PROG="/usr/sbin/icwmpd"
. /lib/functions.sh
. /usr/share/libubox/jshn.sh
include /lib/network
log() {
echo "${@}"|logger -t cwmp.init -p info
}
regenerate_ssl_link()
{
local cert_dir all_file rehash
cert_dir="${1}"
[ ! -d "${cert_dir}" ] && return 0;
### Generate all ssl link for pem certicates ###
all_file=$(ls $cert_dir/*.pem 2>/dev/null)
if [ -n "${all_file}" ]; then
for cfile in $all_file; do
rehash="$(openssl x509 -hash -noout -in $cfile)"
[ -f ${cert_dir}/${rehash}.0 ] || \
ln -s $cfile $cert_dir/${rehash}.0
done
fi
### Generate all ssl link for crt certicates ###
all_file=$(ls $cert_dir/*.crt 2>/dev/null)
if [ -n "${all_file}" ]; then
for cfile in $all_file; do
rehash="$(openssl x509 -hash -noout -in $cfile)"
[ -f ${cert_dir}/${rehash}.0 ] || \
ln -s $cfile $cert_dir/${rehash}.0
done
fi
}
enable_dhcp_option43() {
local wan="${1}"
### Ask for DHCP Option 43 only if CWMP is enabled ###
local reqopts="$(uci -q get network.$wan.reqopts)"
local proto="$(uci -q get network.$wan.proto)"
local newreqopts=""
local option43_present=0
for ropt in $reqopts; do
case $ropt in
43) option43_present=1 ;;
*) ;;
esac
done
if [ ${option43_present} -eq 1 ]; then
return;
fi
newreqopts="$reqopts 43"
if [ "${proto}" = "dhcp" ]; then
uci -q set network.$wan.reqopts="$newreqopts"
uci commit network
ubus call network reload
fi
}
convert_to_hex() {
local val=""
local optval="${1}"
OPTIND=1
while getopts ":" opt "-$optval"
do
temp=$(printf "%02X" "'${OPTARG:-:}")
val="${val}:${temp}"
done
echo "${val}"
}
configure_send_op125() {
local sendopt="${1}"
local intf="${2}"
local uci="${3}"
local hex_oui=""
local hex_serial=""
local hex_class=""
local oui_len=0
local serial_len=0
local class_len=0
if [ "${uci}" = "network" ]; then
local opt125="125:00:00:0D:E9"
else
local opt125="125,00:00:0D:E9"
fi
config_get oui cpe manufacturer_oui ""
if [ -z "${oui}" ]; then
oui=$(db -q get device.deviceinfo.ManufacturerOUI)
fi
oui=$(echo "${oui}" | tr 'a-f' 'A-F')
config_get serial cpe serial_number ""
if [ -z "${serial}" ]; then
serial=$(db -q get device.deviceinfo.SerialNumber)
fi
config_get class cpe product_class ""
if [ -z "${class}" ]; then
class=$(db -q get device.deviceinfo.ProductClass)
fi
oui_len=$(echo -n "${oui}" | wc -m)
serial_len=$(echo -n "${serial}" | wc -m)
class_len=$(echo -n "${class}" | wc -m)
if [ ${oui_len} -eq 0 ] || [ ${serial_len} -eq 0 ]; then
return 0
fi
opt125_len=$((oui_len + serial_len + class_len))
if [ ${class_len} -gt 0 ]; then
opt125_len=$((opt125_len + 6))
else
opt125_len=$((opt125_len + 4))
fi
hex_opt125_len=$(printf "%02X" "${opt125_len}")
opt125="${opt125}:${hex_opt125_len}"
hex_oui=$(convert_to_hex "${oui}")
if [ -z "${hex_oui}" ]; then
return 0
fi
hex_oui_len=$(printf "%02X" "${oui_len}")
if [ "${uci}" = "network" ]; then
opt125="${opt125}:01:${hex_oui_len}${hex_oui}"
else
opt125="${opt125}:04:${hex_oui_len}${hex_oui}"
fi
hex_serial=$(convert_to_hex "${serial}")
if [ -z "${hex_serial}" ]; then
return 0
fi
hex_serial_len=$(printf "%02X" "${serial_len}")
if [ "${uci}" = "network" ]; then
opt125="${opt125}:02:${hex_serial_len}${hex_serial}"
else
opt125="${opt125}:05:${hex_serial_len}${hex_serial}"
fi
if [ ${class_len} -gt 0 ]; then
hex_class=$(convert_to_hex "${class}")
if [ -z "${hex_class}" ]; then
return 0
fi
hex_class_len=$(printf "%02X" "${class_len}")
if [ "${uci}" = "network" ]; then
opt125="${opt125}:03:${hex_class_len}${hex_class}"
else
opt125="${opt125}:06:${hex_class_len}${hex_class}"
fi
fi
if [ "${uci}" = "network" ]; then
new_send_opt="$sendopt $opt125"
uci -q set network.$intf.sendopts="$new_send_opt"
else
uci -q add_list dhcp.$intf.dhcp_option="$opt125"
fi
}
enable_dnsmasq_option125() {
local lan="${1}"
local send125_present=0
local opt125="125,"
local proto="$(uci -q get dhcp.$lan.dhcpv4)"
if [ "${proto}" = "server" ]; then
opt_list="$(uci -q get dhcp.$lan.dhcp_option)"
for sopt in $opt_list; do
if [[ "$sopt" == "$opt125"* ]]; then
send125_present=1
break
fi
done
if [ ${send125_present} -eq 0 ]; then
configure_send_op125 "" "${lan}" "dhcp"
ubus call uci commit '{"config":"dhcp"}'
fi
fi
}
enable_dhcp_option125() {
local wan="${1}"
local reqopts="$(uci -q get network.$wan.reqopts)"
local sendopts="$(uci -q get network.$wan.sendopts)"
local proto="$(uci -q get network.$wan.proto)"
local newreqopts=""
local newsendopts=""
local req125_present=0
local send125_present=0
local network_uci_update=0
local opt125="125:"
for ropt in $reqopts; do
case $ropt in
125) req125_present=1 ;;
*) ;;
esac
done
for sopt in $sendopts; do
if [[ "$sopt" == "$opt125"* ]]; then
send125_present=1
break
fi
done
if [ "${proto}" = "dhcp" ]; then
if [ ${req125_present} -eq 0 ]; then
newreqopts="$reqopts 125"
uci -q set network."${wan}".reqopts="$newreqopts"
network_uci_update=1
fi
if [ ${send125_present} -eq 0 ]; then
configure_send_op125 "${sendopts}" "${wan}" "network"
network_uci_update=1
fi
fi
if [ ${network_uci_update} -eq 1 ]; then
uci commit network
ubus call network reload
fi
}
wait_for_resolvfile() {
local time=$1
local tm=1
local resolvfile="$(uci -q get dhcp.@dnsmasq[0].resolvfile)"
[ -n "$resolvfile" ] || return
while [ ! -f "$resolvfile" ]; do
sleep 1
[ "$tm" -ge "$time" ] && break
tm=$((tm+1))
done
}
copy_cwmp_etc_files_to_varstate() {
mkdir -p /var/run/icwmpd
if [ -f /etc/icwmpd/icwmpd_backup_session.xml ]; then
cp -f /etc/icwmpd/icwmpd_backup_session.xml /var/run/icwmpd/ 2>/dev/null
fi
if [ -f /etc/icwmpd/dm_enabled_notify.xml ]; then
cp -f /etc/icwmpd/dm_enabled_notify /var/run/icwmpd/ 2>/dev/null
fi
touch /var/run/icwmpd/cwmp
}
copy_cwmp_varstate_files_to_etc() {
if [ -f /var/run/icwmpd/icwmpd_backup_session.xml ]; then
cp -f /var/run/icwmpd/icwmpd_backup_session.xml /etc/icwmpd/ 2>/dev/null
fi
if [ -f /var/run/icwmpd/dm_enabled_notify.xml ]; then
cp -f /var/run/icwmpd/dm_enabled_notify /etc/icwmpd/ 2>/dev/null
fi
# move the successful custom notify import marker to persistent storage
if [ -f /var/run/icwmpd/icwmpd_notify_import_marker ]; then
cp -f /var/run/icwmpd/icwmpd_notify_import_marker /etc/icwmpd/
fi
}
validate_acs_section()
{
uci_validate_section cwmp acs "acs" \
'passwd:string' \
'periodic_inform_enable:bool' \
'periodic_inform_interval:uinteger' \
'periodic_inform_time:string' \
'url:string' \
'dhcp_discovery:string' \
'dhcp_url:string' \
'compression:or("GZIP","Deflate","Disabled")' \
'retry_min_wait_interval:range(1, 65535)' \
'retry_interval_multiplier:range(1000, 65535)' \
'ipv6_enable:bool' \
'ssl_capath:string'
}
validate_cpe_section()
{
uci_validate_section cwmp cpe "cpe" \
'interface:string' \
'default_wan_interface:string' \
'log_to_console:or("enable","disable")' \
'log_to_file:or("enable","disable")' \
'log_severity:or("EMERG", "ALERT", "CRITIC" ,"ERROR", "WARNING", "NOTICE", "INFO", "DEBUG")' \
'log_file_name:string' \
'log_max_size:uinteger' \
'userid:string' \
'passwd:string' \
'port:uinteger' \
'provisioning_code:string:""' \
'amd_version:range(1, 6)' \
'instance_mode:or("InstanceNumber","InstanceAlias")' \
'session_timeout:uinteger' \
'notification:bool' \
'exec_download:bool' \
'periodic_notify_enable:bool' \
'enable:bool' \
'periodic_notify_interval:uinteger'
}
validate_defaults() {
local ssl_capath
config_load cwmp
validate_acs_section || {
log "Validation of acs section failed"
return 1;
}
ssl_capath="${ssl_capath%/}"
# Put the cert pem file in keep list
if [ -d "${ssl_capath}" ]; then
if ! grep "*.pem\|*.crt" /lib/upgrade/keep.d/icwmp; then
echo "${ssl_capath}"'/*.pem' >> /lib/upgrade/keep.d/icwmp
echo "${ssl_capath}"'/*.crt' >> /lib/upgrade/keep.d/icwmp
echo "${ssl_capath}"'/*.0' >> /lib/upgrade/keep.d/icwmp
fi
fi
validate_cpe_section || {
log "Validation of cpe section failed"
return 1;
}
return 0;
}
set_vendor_id() {
local wan="${1}"
local proto="$(uci -q get network.$wan.proto)"
if [ "${proto}" == "dhcp" ]; then
vendorid="$(uci -q get network.$wan.vendorid)"
if [ -z "${vendorid}" ]; then
uci -q set network.$wan.vendorid="dslforum.org"
ubus call uci commit '{"config":"network"}'
elif [[ $vendorid != *"dslforum.org"* ]]; then
uci -q set network.$wan.vendorid="${vendorid},dslforum.org"
ubus call uci commit '{"config":"network"}'
fi
fi
}
boot() {
local enable_cwmp="0"
local dhcp_discovery="0"
config_load cwmp
config_get_bool enable_cwmp cpe enable 1
if [ "$enable_cwmp" = "0" ]; then
return 0
fi
config_get dhcp_discovery acs dhcp_discovery "0"
config_get wan_interface cpe default_wan_interface "wan"
if [ "${dhcp_discovery}" == "enable" ] || [ "${dhcp_discovery}" == "1" ]; then
# Set dhcp option 43 if not already configured
enable_dhcp_option43 "${wan_interface}"
# Set dhcp option 60
set_vendor_id "${wan_interface}"
fi
config_get lan_interface cpe default_lan_interface ""
if [ -n "${lan_interface}" ]; then
# Set dhcp_option 125 if not already configured
enable_dhcp_option125 "${wan_interface}"
enable_dnsmasq_option125 "${lan_interface}"
fi
config_get ssl_capath acs ssl_capath
if [ -n "${ssl_capath}" ]; then
regenerate_ssl_link "${ssl_capath}"
fi
# Copy backup data so that if it restart latter on it gets the info
copy_cwmp_etc_files_to_varstate
touch /etc/icwmpd/cwmp_notifications
start
}
start_service() {
local enable_cwmp
config_load cwmp
config_get_bool enable_cwmp cpe enable 1
if [ "$enable_cwmp" = "0" ]; then
return 0
fi
[ -f /sbin/netifd ] && log "Waiting for Network to be started ..." && ubus -t 5 wait_for network.interface
[ -f /usr/sbin/dnsmasq ] && log "Waiting for DNS Proxy to be started ..." && ubus -t 5 wait_for dnsmasq
[ -f /etc/config/dhcp ] && log "Waiting for DNS Server(s) ..." && wait_for_resolvfile 20
validate_defaults || {
log "Validation of defaults failed"
return 1;
}
procd_open_instance icwmp
procd_set_param command "$PROG"
procd_append_param command -b
procd_set_param respawn \
"${respawn_threshold:-5}" \
"${respawn_timeout:-10}" "${respawn_retry:-3}"
procd_set_param watch network.interface
procd_close_instance
}
stop_service()
{
copy_cwmp_varstate_files_to_etc
}
reload_service() {
local ret
config_load cwmp
config_get_bool enable_cwmp cpe enable 1
ret="0"
if [ "$enable_cwmp" = "0" ]; then
stop
start
return 0
fi
status="$(ubus -t 1 call tr069 status |jsonfilter -qe '@.cwmp.status')"
ret="$?"
if [ "$status" = "up" ]; then
ubus -t 1 call tr069 command '{"command":"reload"}'
ret="$?"
fi
if [ "$status" = "init" ] || [ "$ret" -ne "0" ]; then
log "Restarting CWMP client"
stop
start
fi
}
service_triggers() {
procd_add_reload_trigger "cwmp"
procd_open_trigger
json_add_array
json_add_string "" "interface.update"
json_add_array
json_add_array
json_add_string "" "run_script"
json_add_string "" "/etc/icwmpd/update.sh"
json_close_array
json_close_array
json_add_int "" "2000"
json_close_array
procd_close_trigger
}

View File

@@ -1,41 +0,0 @@
#!/bin/sh
. /lib/functions.sh
# Copy defaults by the factory to the cwmp UCI user section.
config_load cwmp
# Get Manufacturer OUI.
config_get oui cpe manufacturer_oui ""
if [ -z "${oui}" ]; then
oui=$(db -q get device.deviceinfo.ManufacturerOUI)
fi
oui=$(echo "${oui}" | tr 'a-f' 'A-F')
# Get system serial number.
config_get serial cpe serial_number ""
if [ -z "${serial}" ]; then
serial=$(db -q get device.deviceinfo.SerialNumber)
fi
# Get userid values
config_get acs_userid acs userid ""
config_get cpe_userid cpe userid ""
# Only set if they are empty
if [ -z "${acs_userid}" ]; then
uci -q set cwmp.acs.userid="${oui}-${serial}"
fi
if [ -z "${cpe_userid}" ]; then
uci -q set cwmp.cpe.userid="${oui}-${serial}"
fi
# Fix the cwmp.cpe.enable parameter
# set default to 1 if not defined
config_get enable_cwmp cpe enable ""
if [ -z "${enable_cwmp}" ]; then
uci -q set cwmp.cpe.enable="1"
fi
# No need for commit here, it is done by uci_apply_defaults().

View File

@@ -1,12 +0,0 @@
#!/bin/sh
uci -q batch <<-EOT
delete firewall.cwmp
set firewall.cwmp=include
set firewall.cwmp.path=/etc/firewall.cwmp
set firewall.cwmp.reload=1
commit firewall
EOT
exit 0

View File

@@ -0,0 +1,54 @@
#!/bin/sh
. /lib/functions.sh
set_cwmp_reqopts() {
### Ask for DHCP Option 43 only if CWMP is enabled ###
local wan=$(uci -q get cwmp.cpe.default_wan_interface)
local dhcp_discovery=$(uci -q get cwmp.acs.dhcp_discovery)
local discovery=0
case $dhcp_discovery in
enable|1) discovery=1 ;;
esac
local newreqopts=
local baseopts=
local reqopts="$(uci -q get network.$wan.reqopts)"
local proto="$(uci -q get network.$wan.proto)"
local tropts="43"
local oldreqopts="$reqopts"
local ropt iopt
for ropt in $reqopts; do
case $ropt in
43) ;;
*) baseopts="$baseopts $ropt" ;;
esac
done
ropt=""
reqopts="$baseopts $tropts"
for ropt in $reqopts; do
case $ropt in
43) [ $discovery -eq 1 ] && newreqopts="$newreqopts $ropt" ;;
*) newreqopts="$newreqopts $ropt" ;;
esac
done
if [ "$proto" == "dhcp" ]; then
newreqopts="$(echo $newreqopts | tr ' ' '\n' | sort -n | tr '\n' ' ' | sed 's/^[ \t]*//;s/[ \t]*$//')"
oldreqopts="$(echo $oldreqopts | tr ' ' '\n' | sort -n | tr '\n' ' ' | sed 's/^[ \t]*//;s/[ \t]*$//')"
[ "$newreqopts" == "$oldreqopts" ] && return
uci -q set network.$wan.reqopts="$newreqopts"
uci commit network
fi
}
regenerate_ssl_link(){
local cert_dir="/etc/ssl/certs"
local all_file=$(ls $cert_dir/*.pem)
for cfile in $all_file
do
ln -s $cfile $cert_dir/$(openssl x509 -hash -noout -in $cfile).0
done
}
set_cwmp_reqopts
regenerate_ssl_link

View File

@@ -1,2 +0,0 @@
/var/run/icwmpd/icwmpd_backup_session.xml
/etc/icwmpd/cwmp_notifications

View File

@@ -1,6 +1,6 @@
#!/bin/sh
[ -f /etc/config/xmpp ] || exit 0
[ -f /etc/config/cwmp_xmpp ] || exit 0
[ "$ACTION" == "ifup" ] || exit 0
[ "$INTERFACE" == "loopback" ] && exit 0
@@ -17,5 +17,5 @@ local proto="$(uci -q get network.$INTERFACE.proto)"
local ifname="$(uci -q get network.$INTERFACE.ifname)"
[ "${ifname:0:1}" == "@" ] && exit 0
/etc/init.d/xmppc reload &
/etc/init.d/icwmp_xmppd reload &

View File

@@ -1,14 +0,0 @@
if (PACKAGE_ieee1905)
menu "Configurations"
config IEEE1905_EXTENSION_ALLOWED
bool "Allow plugins to extend 1905 CMDUs and/or TLVs"
default y
config IEEE1905_PLATFORM_HAS_WIFI
bool "Platform has WiFi"
default y if PACKAGE_libwifi
endmenu
endif

View File

@@ -1,14 +0,0 @@
if (PACKAGE_map-plugin)
menu "Configurations"
config MULTIAP_DYNAMIC_CNTLR_SYNC_CONFIG
bool "Sync configuration between dynamic controllers in the network"
default n
config MULTIAP_FUZZ_1905_CMDUS
bool "Include support to fuzz 1905 CMDUs for testing purpose"
default n
endmenu
endif

View File

@@ -1,150 +1,57 @@
#
# Copyright (C) 2021-2022 IOPSYS
# Copyright (C) 2019 Iopsys
#
include $(TOPDIR)/rules.mk
PKG_NAME:=ieee1905
PKG_VERSION:=4.10.40
PKG_VERSION:=1.1.0
LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=4533751a58cfb0fcf4ee878785f6c0872949c68d
PKG_SOURCE_VERSION:=3008fe46ee9247f0203b3a125fddebadbdd7dcdc
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/ieee1905.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
PKG_MIRROR_HASH:=skip
endif
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
define Package/ieee1905/Default
define Package/ieee1905
SECTION:=utils
CATEGORY:=Utilities
SUBMENU:=IEEE-1905.1 stack
endef
define Package/ieee1905/config
source "$(SOURCE)/Config.in"
endef
define Package/libieee1905
$(call Package/ieee1905/Default,$(1))
TITLE+= (library for CMDU and TLV handling)
DEPENDS= +libubox +libuci +libubus +libeasy +libnl-genl \
+libjson-c +libblobmsg-json
endef
define Package/ieee1905
$(call Package/ieee1905/Default,$(1))
TITLE+= ieee1905d (daemon implementing 1905.1 and provides cli)
DEPENDS= +libubox +libuci +libubus +libeasy +libnl-genl \
+libjson-c +libblobmsg-json +ubus +libpthread \
+libieee1905 +IEEE1905_PLATFORM_HAS_WIFI:libwifi
endef
define Package/map-plugin
$(call Package/ieee1905/Default,$(1))
TITLE:=Multi-AP (Easymesh) plugin
DEPENDS= +libubox +libuci +libubus +libeasy +libnl-genl \
+libjson-c +libblobmsg-json +ieee1905 +libieee1905
endef
define Package/map-plugin/config
source "$(SOURCE)/Config.map-plugin.in"
TITLE:=IEEE1905 handler
DEPENDS:= +libwifi +ubox +libpicoevent +libpcap +libopenssl +libuci +libjson-c
endef
define Package/ieee1905/description
This package provides IEEE Std 1905.1 stack.
endef
define Package/libieee1905/description
This package provides library functions for IEEE Std 1905.1 stack.
IEEE1905 stack with extended functionalities.
endef
TARGET_CFLAGS += \
-I$(STAGING_DIR)/usr/include \
-I$(STAGING_DIR)/usr/include/libnl3 \
-D_GNU_SOURCE
ifeq ($(CONFIG_IEEE1905_PLATFORM_HAS_WIFI),y)
TARGET_CFLAGS += -DHAS_WIFI
endif
ifeq ($(CONFIG_MULTIAP_DYNAMIC_CNTLR_SYNC_CONFIG),y)
TARGET_CFLAGS += -DDYNAMIC_CNTLR_SYNC_CONFIG
endif
MAKE_PATH:=src
-D_GNU_SOURCE \
-DSEND_EMPTY_TLVS \
-DFIX_BROKEN_TLVS \
-DSPEED_UP_DISCOVERY \
-DREGISTER_EXTENSION_BBF
#-DDO_NOT_ACCEPT_UNAUTHENTICATED_COMMANDS \
#define Build/Prepare
# $(CP) -rf ./ieee1905/* $(PKG_BUILD_DIR)/
#endef
define Package/ieee1905/install
$(CP) ./files/* $(1)/
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DIR) $(1)/usr/lib/ieee1905
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DIR) $(1)/etc/hotplug.d
$(INSTALL_DIR) $(1)/etc/hotplug.d/button
$(INSTALL_BIN) ./files/etc/init.d/ieee1905 $(1)/etc/init.d/ieee1905
$(INSTALL_BIN) ./files/etc/hotplug.d/button/11-ieee1905 $(1)/etc/hotplug.d/button/11-ieee1905
$(INSTALL_DATA) ./files/etc/config/ieee1905 $(1)/etc/config/ieee1905
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ieee1905d $(1)/usr/sbin/
endef
define Package/libieee1905/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/src/libieee1905.so $(1)/usr/lib/
$(CP) $(PKG_BUILD_DIR)/src/libmidgen.so $(1)/usr/lib/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ieee1905d $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/libs/*.so $(1)/usr/lib/
endef
define Package/map-plugin/install
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DIR) $(1)/usr/lib/ieee1905
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/libmaputil.so $(1)/usr/lib/libmaputil.so
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/map.so $(1)/usr/lib/ieee1905/map.so
endef
define Build/InstallDev/map-plugin
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DIR) $(1)/usr/include
$(INSTALL_DIR) $(1)/usr/lib/ieee1905
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/map2.h $(1)/usr/include/map2.h
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/map_module.h $(1)/usr/include/map_module.h
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/cntlrsync.h $(1)/usr/include/cntlrsync.h
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/map.so $(1)/usr/lib/ieee1905/map.so
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/libmaputil.so $(1)/usr/lib/libmaputil.so
endef
define Build/InstallDev/libieee1905
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DIR) $(1)/usr/include
$(INSTALL_DIR) $(1)/usr/lib/ieee1905
$(CP) $(PKG_BUILD_DIR)/src/cmdu.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/src/cmdu_ackq.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/src/1905_tlvs.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/src/i1905_wsc.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/src/bufutil.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/src/timer_impl.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/src/i1905_extension.h $(1)/usr/include/
$(CP) $(PKG_BUILD_DIR)/src/libmidgen.so $(1)/usr/lib/
$(CP) $(PKG_BUILD_DIR)/src/libieee1905.so $(1)/usr/lib/
endef
define Build/InstallDev
$(call Build/InstallDev/libieee1905,$(1),$(2))
$(call Build/InstallDev/map-plugin,$(1),$(2))
endef
ifeq ($(LOCAL_DEV),1)
define Build/Prepare
rsync -r --exclude=.* ~/git/ieee1905/ $(PKG_BUILD_DIR)/
endef
endif
$(eval $(call BuildPackage,ieee1905))
$(eval $(call BuildPackage,libieee1905))
$(eval $(call BuildPackage,map-plugin))

57
ieee1905/files/etc/config/ieee1905 Executable file → Normal file
View File

@@ -1,26 +1,39 @@
config ieee1905 'ieee1905'
option enabled '1'
option extension '1'
list extmodule 'map'
option registrar '2 5'
# option macaddress '0a:1b:2c:3d:4e:50'
config ieee1905
option enabled '1'
option debug true
config al-iface
option enabled '1'
option ifname 'br-lan'
option type 'bridge'
config meshcomms 'global'
option enabled '1'
option basemacint 'wan'
option mapall true
# option registrar 'rai0'
option debug_level 2
option port 8888
option cmdu_event false
# ap sections are auto-generated/overwritten during onboarding
#
config ap
option band '2'
option ssid 'IOWRT-2.4GHz'
option encryption 'sae-mixed'
option key '1234567890'
#config al-iface
# option enabled '1'
# option ifname 'br-lan'
# option media 'bridge'
# option manufacturer_name 'Broadcom'
# option model_name 'Eth EG400'
# option model_number '00002'
# option device_name 'EG400R1'
config ap
option band '5'
option ssid 'IOWRT-5GHz'
option encryption 'sae-mixed'
option key '1234567890'
#config al-iface
# option enabled '1'
# option ifname 'wl0'
# option media 'ap'
# option manufacturer_name 'Mediatek'
# option model_name 'WIFI EX400'
# option model_number '00001'
# option device_name 'EX400R0'
#config al-iface
# option enabled '1'
# option ifname 'wl1'
# option media 'ap'
# option manufacturer_name 'Mediatek'
# option model_name 'WIFI EX400'
# option model_number '00001'
# option device_name 'EX400R0'

View File

@@ -0,0 +1,36 @@
#!/bin/sh
TOPOLOGY_FILE="/tmp/topology_change"
WPS_FILE="/tmp/virtual_push_button"
handle_topology_change() {
[ -f ${TOPOLOGY_FILE} ] && \
touch ${TOPOLOGY_FILE}
}
handle_wps() {
[ -f ${WPS_FILE} ] && \
touch ${WPS_FILE}
}
case "$ACTION" in
add|register)
[ "wifibutton" == "$INTERFACE" -o "ecobutton" == "$INTERFACE" ] && {
handle_wps
}
[ "wifi_2g" == "$INTERFACE" ] && {
handle_wps
}
[ "wifi_5g" == "$INTERFACE" ] && {
handle_wps
}
[ "wpsbutton" == "$INTERFACE" ] && {
handle_wps
}
[ "wpscbutton" == "$INTERFACE" ] && {
handle_topology_change
}
;;
remove|unregister)
;;
esac

248
ieee1905/files/etc/init.d/ieee1905 Executable file → Normal file
View File

@@ -1,101 +1,197 @@
#!/bin/sh /etc/rc.common
START=96
STOP=21
START=99
STOP=10
USE_PROCD=1
PROG=/usr/sbin/ieee1905d
MESH_CONF=/tmp/meshcomms.config
INTERFACE=""
IS_CFG_VALID=1
validate_ieee1905_section() {
uci_validate_section ieee1905 ieee1905 "ieee1905" \
'enabled:bool:true' \
'macaddress:or("auto",macaddr)' \
'registrar:string' \
'extension:bool:false' \
'extmodule:list(string)' \
[ "$?" -ne 0 ] && {
logger -s -t "ieee1905" "Validation of ieee1905 section failed"
IS_CFG_VALID=0
return 1
}
return 0
validate_global_section()
{
uci_validate_section ieee1905 meshcomms "${1}" \
'enabled:bool:false' \
'basemacint:string:wan' \
'almac:string' \
'registrar:string' \
'mapall:bool:true' \
'debug_level:uinteger:5' \
'port:port:8888' \
'cmdu_event:bool:true'
}
validate_ali_section() {
local section="$1"
uci_validate_section ieee1905 $section "${1}" \
'ifname:string' \
'type:or("bridge",string)'
[ "$?" -ne 0 ] && {
logger -s -t "ieee1905" "Validation of al-iface section $section failed"
IS_CFG_VALID=0
return 1
}
return 0
validate_ieee1905_section()
{
uci_validate_section ieee1905 ieee1905 "${1}" \
'debug:bool:true' \
'enabled:bool:true'
}
validate_ap_section() {
local section="$1"
uci_validate_section ieee1905 $section "${1}" \
'band:or("2", "5", "60")' \
'ssid:string' \
'encryption:or("psk2", "sae-mixed", "sae",
"psk", "psk-mixed", "none", string)' \
'key:string' \
'uuid:string' \
'manufacturer:string' \
'model_name:string' \
'device_name:string' \
'model_number:string' \
'serial_number:string' \
'device_type:string' \
'os_version:uinteger'
[ "$?" -ne 0 ] && {
logger -s -t "ieee1905" "Validation of ap section $section failed"
IS_CFG_VALID=0
return 1
}
return 0
get_device_name() {
local device
# Get wan L3 interface
ubus list |grep -iq network.interface.${1}
if [ "$?" -eq 0 ]; then
json_load "$(ubus -t 2 call network.interface.${1} status)"
json_get_var device device
echo ${device}
fi
}
validate_ieee1905_config() {
IS_CFG_VALID=1
get_interface_mac() {
local l3 basemac
l3=$(get_device_name ${1})
if [ -n ${l3} ]; then
json_load "$(ubus -t 2 call network.device status "{\"name\":\"${l3}\"}")"
json_get_var basemac macaddr
fi
local first=0x$(echo $basemac |cut -d : -f 1)
local rest=$(echo $basemac |cut -d : -f 2-)
# Set local bit
first=$((first|2))
first=$(printf "%x" $first)
basemac="${first}:${rest}"
echo ${basemac}
}
validate_ieee1905_section &&
config_foreach validate_ali_section "al-iface" &&
config_foreach validate_ap_section ap
validate_al_section()
{
uci_validate_section ieee1905 al-iface "${1}" \
'enabled:bool:false' \
'ifname:string' \
'media:string:eth' \
'manufacturer_name:string:iopsys' \
'model_name:string' \
'model_number:string' \
'device_name:string'
}
[ "$IS_CFG_VALID" -ne 1 ] && {
logger -s -t "ieee1905" "Validation of ieee1905 UCI file failed"
return 1
configure_interface()
{
local ifname media enabled manufacturer_name model_name model_number device_name
validate_al_section ${1} || {
echo "Validation of global section failed"
return 1;
}
return 0
if [ ${enabled} -eq 0 ]; then
return;
fi
if [ -z ${INTERFACE} ]; then
INTERFACE=${ifname}
else
INTERFACE="${INTERFACE},${ifname}"
fi
json_add_object
json_add_string ifname ${ifname}
json_add_string media ${media}
json_add_string manufacturer_name ${manufacturer_name}
json_add_string model_name ${model_name}
json_add_string model_number ${model_number}
json_add_string device_name ${device_name}
json_close_object
}
configure_meshcomms()
{
local enabled almac basemacint mapall debug_level port l3device basemac intf registrar cmdu_event
validate_global_section global || {
echo "Validation of global section failed"
return 1;
}
if [ -z ${almac} ]; then
basemac=$(get_interface_mac ${basemacint})
else
basemac=${almac}
fi
local fname cname model cUrl
fname=$(db get hw.board.boardId)
cname=$(db get hw.board.iopVerCustomer)
model=$(db get hw.board.routerModel)
cUrl="http://192.168.1.1"
json_init
# fill the al-iface info
json_add_array al-iface
config_foreach configure_interface al-iface
json_close_array
json_add_object deviceInfo
json_add_string friendly_name ${fname}
json_add_string manufacturer_name ${cname}
json_add_string model ${model}
json_add_string control_url ${cUrl}
json_close_object
json_add_object meshcomms
json_add_int enabled ${enabled}
json_add_string mac ${basemac}
json_add_string interfaces ${INTERFACE}
json_add_int map ${mapall}
json_add_string registrar ${registrar}
json_add_int debug_level ${debug_level}
json_add_int port ${port}
json_add_int cmdu_event ${cmdu_event}
json_close_object
json_dump >${MESH_CONF}
}
configure_ieee1905()
{
local enabled debug
validate_ieee1905_section ${1} || {
echo "Validation of ieee1905 section failed"
exit 1;
}
if [ ${debug} -eq 1 ]; then
# Forward stdout of the command to logd
procd_set_param stdout 1
# Same for stderr
procd_set_param stderr 1
fi
if [ ${enabled} -ne 1 ]; then
exit 0;
fi
}
configure_network() {
[ -f ${MESH_CONF} ] && rm ${MESH_CONF}
ebtables -L FORWARD|grep -iqE "1:80:C2:(0)+:(0)+:13.*-j.*DROP"
if [ "$?" -ne 0 ]; then
echo "Applying drop rule to drop pkts forwared by kernel to 1905.1 multicast mac"
ebtables -A FORWARD -d 01:80:c2:00:00:13 -j DROP
fi
config_load ieee1905
config_foreach configure_ieee1905 ieee1905
config_foreach configure_meshcomms meshcomms
}
start_service() {
config_load "ieee1905"
validate_ieee1905_config || return 1;
procd_open_instance
procd_set_param command "/usr/sbin/ieee1905d"
procd_open_instance ieee1905
procd_set_param command ${PROG}
configure_network
procd_set_param respawn
# procd_set_param stdout 1
# procd_set_param stderr 1
procd_close_instance
}
service_triggers()
{
procd_add_reload_trigger "ieee1905"
}
reload_service() {
stop
start
}
service_triggers() {
procd_add_reload_trigger "network"
procd_add_reload_trigger "netmode"
}

View File

@@ -1,22 +0,0 @@
#!/bin/sh
BMAC=$(db -q get hw.board.basemac)
BMAC=${BMAC//:/}
BMAC=${BMAC// /}
BMAC=$(printf "%12.12X" $((0x$BMAC)))
[ "$BMAC" == "" ] && exit 1
LMAC=$((0x$BMAC & 0xfeffffffffff))
LMAC=$(($LMAC | 0x020000000000))
LMAC=$(printf "%12.12X" $LMAC)
LMAC=$(echo $LMAC | sed -e 's/[0-9A-F]\{2\}/&:/g' -e 's/:$//')
mac=$(uci -q get ieee1905.ieee1905.macaddress)
[ "$mac" != "" ] && exit 0
uci set ieee1905.ieee1905.macaddress="$LMAC"
uci commit ieee1905

View File

@@ -1,17 +0,0 @@
#!/bin/sh
. /lib/functions.sh
config_load ieee1905
list_to_ifname() {
local section=$1
config_get ifname $section ifname # get list as space separated values
uci del ieee1905.${section}.ifname # delete entry
uci set ieee1905.${section}.ifname="$ifname" # writeback entry as option
}
config_foreach list_to_ifname al-iface

55
ifbt/Makefile Normal file
View File

@@ -0,0 +1,55 @@
#
# Copyright (C) 2018 iopsys Software Solutions AB
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=ifbt
PKG_VERSION:=0.2
PKG_SOURCE_VERSION:=6a279efa5046ace0681a1d0e79592a120f80e171
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/ifbt.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=README
include $(INCLUDE_DIR)/package.mk
ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_mips),y)
TARGET_PLATFORM:=-DIOPSYS_BROADCOM
else ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),y)
TARGET_PLATFORM:=-DIOPSYS_BROADCOM
else ifeq ($(CONFIG_TARGET_iopsys_linksys),y)
TARGET_PLATFORM:=-DIOPSYS_MARVELL
else ifeq ($(CONFIG_TARGET_intel_mips),y)
TARGET_PLATFORM:=-DIOPSYS_INTEL
else ifeq ($(CONFIG_TARGET_iopsys_ramips),y)
TARGET_PLATFORM:=-DIOPSYS_MEDIATEK
else
$(info (UNEXPECTED CONFIG TARGET))
endif
export TARGET_PLATFORM
define Package/ifbt
CATEGORY:=Utilities
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libwifi +libjson-c
TITLE:=Fast BSS Transition
endef
define Package/ifbt/description
ifbt is Iopsys application for fast BSS transition
endef
define Package/ifbt/install
$(INSTALL_DIR) $(1)/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ifbt $(1)/sbin/
endef
$(eval $(call BuildPackage,ifbt))

View File

@@ -5,16 +5,15 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=imonitor
PKG_VERSION:=1.0.1
PKG_VERSION:=1.0.0
PKG_RELEASE:=1
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
PKG_SOURCE_PROTO=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/imonitor.git
PKG_SOURCE_VERSION:=4beb1d5d6925507f1850a84c0b83aaf12a082f7f
PKG_SOURCE_VERSION:=532f4900862bcb45d8cd4bf37555fabda81750b6
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
PKG_SOURCE_SUBDIR:=${PKG_NAME}-${PKG_VERSION}
PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1

View File

@@ -9,14 +9,14 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=inbd
PKG_VERSION:=1.2.3
PKG_VERSION:=1.0.0
PKG_RELEASE:=1
PKG_SOURCE_VERSION:=d4e910a31039e0c0b7a539311eafcd716c36be77
PKG_SOURCE_VERSION:=53ca7f58edb87976b5897ccaf487bb0cbbf39d07
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/inbd
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)

60
inotify-tools/Makefile Normal file
View File

@@ -0,0 +1,60 @@
#
# 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:=inotify-tools
PKG_VERSION:=3.14
PKG_RELEASE:=1
PKG_SOURCE_VERSION:=1df9af4d6cd0f4af4b1b19254bcf056aed4ae395
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/rvoicilas/inotify-tools.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_LICENSE:=GPLv2
PKG_LICENSE_FILES:=COPYING
# support parallel build
PKG_BUILD_PARALLEL:=1
#re create configure scripts if not present.
PKG_FIXUP:=autoreconf
# run install target when cross compiling. basically, make install DESTDIR=$(PKG_INSTALL_DIR)
# this way we don't need to pick out the resulting files from the build dir.
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/inotify-tools
CATEGORY:=Utilities
TITLE:=Tools to trace filesystem events.
URL:=
endef
define Package/inotify-tools/description
Tools to trace filesystem events.
endef
define Package/inotify-tools/install
$(INSTALL_DIR) $(1)/usr
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_DIR) $(1)/usr/lib/
$(CP) ./files/* $(1)/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libinotifytools.so.0.4.1 $(1)/usr/lib/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libinotifytools.so.0 $(1)/usr/lib/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libinotifytools.so $(1)/usr/lib/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/inotifywait $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/inotifywatch $(1)/usr/bin/
endef
$(eval $(call BuildPackage,inotify-tools))

View File

@@ -0,0 +1,13 @@
#! /bin/sh
# is the real root mounted ?
if [ ! -f /tmp/inotify_real_root/etc/preinit ]
then
ubivol=$( cat /proc/cmdline | sed -e "s/.*root=\(ubi:rootfs_.\).*/\1/" )
mkdir /tmp/inotify_real_root
mount -t ubifs $ubivol /tmp/inotify_real_root
fi
inotifywait -r -m -e modify -e create -e attrib -e delete -e move /tmp/inotify_real_root

View File

@@ -1,7 +0,0 @@
config TARGET_VERSION
string
prompt "Software Version"
config TARGET_CUSTOMER
string
prompt "Customer ID"

View File

@@ -24,10 +24,6 @@ define Package/iop/description
This package contains iopsysWrt SDK utilities
endef
define Package/iop/config
source "$(SOURCE)/Config.in"
endef
define Build/Compile
true
endef

View File

@@ -1,139 +1,28 @@
############
# Generic #
##########
# Build #
CONFIG_BUILD_LOG=y
CONFIG_BUILD_NLS=y
CONFIG_BUSYBOX_CUSTOM=y
CONFIG_CCACHE=y
CONFIG_DEBUG=y
CONFIG_DEVEL=y
# CONFIG_USE_SSTRIP is not set
CONFIG_USE_STRIP=y
# CONFIG_SIGNED_PACKAGES is not set
# Image #
CONFIG_TARGET_CUSTOMER="IOPSYS"
CONFIG_TARGET_ROOTFS_TARGZ=y
# /etc/banner and /etc/device_info #
CONFIG_IMAGEOPT=y
CONFIG_VERSIONOPT=y
CONFIG_VERSION_MANUFACTURER="iopsysWrt"
CONFIG_VERSION_MANUFACTURER_URL="https://iopsys.eu/"
# /lib/preinit #
CONFIG_PREINITOPT=y
# CONFIG_TARGET_PREINIT_SUPPRESS_STDERR is not set
CONFIG_TARGET_PREINIT_DISABLE_FAILSAFE=y
CONFIG_TARGET_PREINIT_TIMEOUT=1
# CONFIG_TARGET_PREINIT_SHOW_NETMSG is not set
# CONFIG_TARGET_PREINIT_SUPPRESS_FAILSAFE_NETMSG is not set
CONFIG_TARGET_PREINIT_IFNAME=""
CONFIG_TARGET_PREINIT_IP=""
CONFIG_TARGET_PREINIT_NETMASK=""
CONFIG_TARGET_PREINIT_BROADCAST=""
# Mirror #
CONFIG_LOCALMIRROR="https://download.iopsys.eu/iopsys/mirror/"
##################
# IOWRT Add-ons #
################
# EasySoC HAL #
CONFIG_PACKAGE_inbd=y
CONFIG_PACKAGE_libwifi=y
CONFIG_PACKAGE_peripheral_manager=y
CONFIG_PACKAGE_port-management=y
CONFIG_PACKAGE_wifimngr=y
# Multi-AP #
CONFIG_PACKAGE_ieee1905=y
CONFIG_PACKAGE_map-topology=y
CONFIG_PACKAGE_wfadatad-collector=y
# Network #
CONFIG_PACKAGE_netmode=y
CONFIG_PACKAGE_owsd=m
CONFIG_PACKAGE_urlfilter=y
# System #
CONFIG_PACKAGE_imonitor=m
CONFIG_PACKAGE_questd=y
CONFIG_PACKAGE_rulengd=y
# TR-x69 #
CONFIG_PACKAGE_uspd-mbedtls=y
CONFIG_PACKAGE_icwmp-mbedtls=y
CONFIG_PACKAGE_obuspa=y
CONFIG_PACKAGE_bulkdata=y
CONFIG_PACKAGE_periodicstats=y
CONFIG_PACKAGE_stunc-mbedtls=m
CONFIG_PACKAGE_swmodd=m
CONFIG_PACKAGE_twamp=m
CONFIG_PACKAGE_udpecho-client=m
CONFIG_PACKAGE_udpecho-server=m
CONFIG_PACKAGE_xmppc=m
# WebGUI #
CONFIG_PACKAGE_sulu=y
############
# Network #
##########
# Protocols #
CONFIG_PACKAGE_6in4=y
CONFIG_PACKAGE_6rd=y
CONFIG_PACKAGE_6to4=y
CONFIG_PACKAGE_alsa-lib=y
CONFIG_PACKAGE_chat=y
CONFIG_PACKAGE_comgt=y
CONFIG_PACKAGE_comgt-directip=y
CONFIG_PACKAGE_comgt-ncm=y
CONFIG_PACKAGE_ds-lite=y
CONFIG_PACKAGE_gre=y
CONFIG_PACKAGE_map=y
CONFIG_PACKAGE_ntfs-3g=y
CONFIG_PACKAGE_ntpd=y
CONFIG_PACKAGE_odhcp6c=y
CONFIG_PACKAGE_odhcpd=y
CONFIG_PACKAGE_ppp-mod-pppoa=y
CONFIG_PACKAGE_ppp-mod-pppoe=y
CONFIG_PACKAGE_ppp-mod-pppol2tp=y
CONFIG_PACKAGE_ppp-mod-pptp=y
CONFIG_PACKAGE_ppp-multilink=y
# CONFIG_PACKAGE_ppp is not set
CONFIG_PACKAGE_relayd=y
CONFIG_PACKAGE_umbim=y
CONFIG_PACKAGE_uqmi=y
CONFIG_PACKAGE_wwan=y
CONFIG_PACKAGE_xl2tpd=y
# Services #
CONFIG_PACKAGE_atftp=m
CONFIG_PACKAGE_atftpd=m
CONFIG_PACKAGE_crashlog=y
CONFIG_PACKAGE_ddns-scripts=y
CONFIG_PACKAGE_miniupnpd=y
CONFIG_PACKAGE_mosquitto-client-ssl=y
CONFIG_PACKAGE_mosquitto-ssl=y
CONFIG_PACKAGE_nginx=y
CONFIG_PACKAGE_openvpn-easy-rsa=y
CONFIG_PACKAGE_openvpn-openssl=y
CONFIG_OPENVPN_openssl_ENABLE_IPROUTE2=y
# CONFIG_PACKAGE_qos-scripts is not set
CONFIG_PACKAGE_rdnssd=y
CONFIG_PACKAGE_vsftpd-tls=m
# Tools and Utilities #
CONFIG_PACKAGE_curl=y
CONFIG_PACKAGE_libcurl=y
CONFIG_LIBCURL_CRYPTO_AUTH=y
# CONFIG_LIBCURL_MBEDTLS is not set
CONFIG_LIBCURL_OPENSSL=y
CONFIG_PACKAGE_ethtool=y
CONFIG_PACKAGE_ip-bridge=y
CONFIG_PACKAGE_ds-lite=y
CONFIG_PACKAGE_easy-qos=y
CONFIG_PACKAGE_gdb=m
CONFIG_PACKAGE_getopt=y
CONFIG_PACKAGE_glib2=y
CONFIG_PACKAGE_icwmp-curl=y
CONFIG_PACKAGE_ifbt=y
CONFIG_PACKAGE_imonitor=y
CONFIG_PACKAGE_inbd=y
CONFIG_PACKAGE_iopupgrade=y
CONFIG_PACKAGE_ip-full=y
CONFIG_PACKAGE_iperf3=y
CONFIG_PACKAGE_ipset=y
@@ -141,77 +30,118 @@ CONFIG_PACKAGE_iptables=y
CONFIG_PACKAGE_iptables-mod-conntrack-extra=y
CONFIG_PACKAGE_iptables-mod-filter=y
CONFIG_PACKAGE_iptables-mod-ipopt=y
CONFIG_PACKAGE_ndisc6=y
CONFIG_PACKAGE_rdisc6=y
CONFIG_PACKAGE_resolveip=y
CONFIG_PACKAGE_tcpdump=y
CONFIG_PACKAGE_traceroute6=y
############
# System #
##########
CONFIG_PACKAGE_at=y
CONFIG_PACKAGE_getopt=y
# CONFIG_PACKAGE_iwatchdog is not set
CONFIG_PACKAGE_jq=y
CONFIG_PACKAGE_libustream-openssl=y
# CONFIG_PACKAGE_libustream-wolfssl is not set
CONFIG_PACKAGE_lscpu=y
CONFIG_PACKAGE_juci=y
CONFIG_PACKAGE_juci-config-backup=y
CONFIG_PACKAGE_juci-ddns=y
CONFIG_PACKAGE_juci-diagnostics=y
CONFIG_PACKAGE_juci-dnsmasq-dhcp=y
CONFIG_PACKAGE_juci-dropbear=y
CONFIG_PACKAGE_juci-easyqos=y
CONFIG_PACKAGE_juci-event=y
CONFIG_PACKAGE_juci-firewall-fw3=y
CONFIG_PACKAGE_juci-icwmp=y
CONFIG_PACKAGE_juci-igmpinfo=y
CONFIG_PACKAGE_juci-minidlna=y
CONFIG_PACKAGE_juci-mod-status=y
CONFIG_PACKAGE_juci-mod-system=y
CONFIG_PACKAGE_juci-mwan3=y
CONFIG_PACKAGE_juci-netmode=y
CONFIG_PACKAGE_juci-network-device=y
CONFIG_PACKAGE_juci-network-dsl=y
CONFIG_PACKAGE_juci-network-netifd=y
CONFIG_PACKAGE_juci-network-port=y
CONFIG_PACKAGE_juci-openvpn=y
CONFIG_PACKAGE_juci-owsd=y
CONFIG_PACKAGE_juci-realtime-graphs=y
CONFIG_PACKAGE_juci-samba=y
CONFIG_PACKAGE_juci-snmpd=y
CONFIG_PACKAGE_juci-sysupgrade=y
CONFIG_PACKAGE_juci-upnp=y
CONFIG_PACKAGE_juci-usb=y
CONFIG_PACKAGE_juci-voice-client=y
CONFIG_PACKAGE_juci-wifilife=y
CONFIG_PACKAGE_juci-wireless=y
CONFIG_PACKAGE_juci-theme-iopsys=y
CONFIG_PACKAGE_kmod-siit=y
CONFIG_PACKAGE_libcgroup-daemon=y
CONFIG_PACKAGE_libcgroup=y
# CONFIG_PACKAGE_libcgroup-utils is not set
CONFIG_PACKAGE_libdaemon=y
CONFIG_PACKAGE_libffmpeg-mini=y
CONFIG_PACKAGE_libgmp=y
CONFIG_PACKAGE_libreadline=y
CONFIG_PACKAGE_loop-detector=m
CONFIG_PACKAGE_minidlna=y
CONFIG_PACKAGE_miniupnpd=y
CONFIG_PACKAGE_mwan3=y
CONFIG_PACKAGE_nand-utils=y
CONFIG_PACKAGE_ndisc6=y
CONFIG_PACKAGE_netmode=y
CONFIG_PACKAGE_ntfs-3g=y
CONFIG_PACKAGE_ntpd=y
CONFIG_PACKAGE_obuspa=y
CONFIG_PACKAGE_odhcp6c=y
CONFIG_PACKAGE_odhcpd=y
CONFIG_PACKAGE_openssl-util=y
CONFIG_OPENSSL_WITH_COMPRESSION=y
CONFIG_PACKAGE_openvpn-easy-rsa=y
CONFIG_PACKAGE_openvpn-openssl=y
CONFIG_PACKAGE_peripheral_manager=y
CONFIG_PACKAGE_port-management=y
CONFIG_PACKAGE_power-management=y
CONFIG_PACKAGE_ppp-mod-pppoa=y
CONFIG_PACKAGE_ppp-mod-pppoe=y
CONFIG_PACKAGE_ppp-mod-pppol2tp=y
CONFIG_PACKAGE_ppp-mod-pptp=y
CONFIG_PACKAGE_ppp-multilink=y
# CONFIG_PACKAGE_ppp is not set
# CONFIG_PACKAGE_qos-scripts is not set
CONFIG_PACKAGE_questd=y
CONFIG_PACKAGE_rdisc6=y
CONFIG_PACKAGE_rdnssd=y
CONFIG_PACKAGE_relayd=y
CONFIG_PACKAGE_resolveip=y
CONFIG_PACKAGE_rpcd=y
CONFIG_PACKAGE_rpcd-mod-rpcsys=y
CONFIG_PACKAGE_rpcd-mod-rrdns=y
CONFIG_PACKAGE_rulengd=y
CONFIG_PACKAGE_samba3=y
CONFIG_PACKAGE_samba3-nmbd=y
CONFIG_PACKAGE_snmpd=y
CONFIG_PACKAGE_strace=y
CONFIG_PACKAGE_tc=y
CONFIG_PACKAGE_tcpdump=y
CONFIG_PACKAGE_terminfo=y
CONFIG_PACKAGE_uledd=y
# The urandom-seed package is very strange. It seeds urandom with urandom...
# Disable it. Most SoCs nowadays has HW random generators anyway.
# CONFIG_PACKAGE_urandom-seed is not set
# CONFIG_PACKAGE_urngd is not set
CONFIG_PACKAGE_tptest=y
CONFIG_PACKAGE_traceroute6=y
CONFIG_PACKAGE_umbim=y
CONFIG_PACKAGE_uqmi=y
CONFIG_PACKAGE_usb-modeswitch=y
CONFIG_PACKAGE_uuidgen=y
CONFIG_PACKAGE_usbreset=y
CONFIG_PACKAGE_uspd=y
CONFIG_PACKAGE_wget=y
CONFIG_PACKAGE_wwan=y
CONFIG_PACKAGE_libwifi=y
CONFIG_PACKAGE_wifilife=y
CONFIG_PACKAGE_wifimngr=y
CONFIG_PACKAGE_libwifix=y
CONFIG_PACKAGE_wifixd=y
CONFIG_PACKAGE_xl2tpd=y
CONFIG_PACKAGE_zoneinfo-core=y
CONFIG_PACKAGE_zoneinfo-europe=y
################
# LuCI WebGUI #
##############
# BEGIN: luci-nginx metapackage with some changes
# We do not want libiwinfo-lua on non-WiFi targets, but it is already
# depended on by other luci-packages, so no need to take it in explicitly
CONFIG_PACKAGE_luci-mod-admin-full=y
CONFIG_PACKAGE_luci-app-firewall=y
CONFIG_PACKAGE_luci-app-opkg=y
CONFIG_PACKAGE_luci-proto-ppp=y
CONFIG_PACKAGE_luci-proto-ipv6=y
# CONFIG_LUCI_JSMIN is not set
# CONFIG_LUCI_CSSTIDY is not set
CONFIG_PACKAGE_luci-mod-dashboard=y
CONFIG_PACKAGE_luci-theme-openwrt-2020=y
CONFIG_PACKAGE_nginx-mod-luci=y
############
# BusyBox #
##########
CONFIG_BUSYBOX_CUSTOM=y
CONFIG_TARGET_CUSTOMER="IOPSYS"
CONFIG_TARGET_ROOTFS_TARGZ=y
# CONFIG_USE_SSTRIP is not set
CONFIG_USE_STRIP=y
CONFIG_BUILD_LOG=y
CONFIG_BUSYBOX_CONFIG_ADDUSER=y
CONFIG_BUSYBOX_CONFIG_ARPING=y
CONFIG_BUSYBOX_CONFIG_ASH_IDLE_TIMEOUT=y
CONFIG_BUSYBOX_CONFIG_ASH_RANDOM_SUPPORT=y
CONFIG_BUSYBOX_CONFIG_CTTYHACK=y
CONFIG_BUSYBOX_CONFIG_DELUSER=y
# CONFIG_BUSYBOX_CONFIG_DEVMEM is not set
CONFIG_BUSYBOX_CONFIG_FEATURE_UDHCP_8021Q=y
CONFIG_BUSYBOX_CONFIG_FIRST_SYSTEM_ID=100
# CONFIG_BUSYBOX_CONFIG_HTTPD is not set
CONFIG_BUSYBOX_CONFIG_HTTPD=y
# CONFIG_BUSYBOX_CONFIG_INSMOD is not set
# CONFIG_BUSYBOX_CONFIG_MODINFO is not set
# CONFIG_BUSYBOX_CONFIG_MODPROBE is not set
@@ -221,7 +151,6 @@ CONFIG_BUSYBOX_CONFIG_FEATURE_MODUTILS_ALIAS=y
CONFIG_BUSYBOX_CONFIG_FEATURE_MODUTILS_SYMBOLS=y
CONFIG_BUSYBOX_CONFIG_DEFAULT_MODULES_DIR="/lib/modules"
CONFIG_BUSYBOX_CONFIG_DEFAULT_DEPMOD_FILE="modules.dep"
# CONFIG_BUSYBOX_CONFIG_IP is not set
CONFIG_BUSYBOX_CONFIG_LAST_SYSTEM_ID=999
CONFIG_BUSYBOX_CONFIG_LOGIN=y
# CONFIG_BUSYBOX_CONFIG_LSMOD is not set
@@ -256,32 +185,14 @@ CONFIG_BUSYBOX_CONFIG_FEATURE_TFTP_PUT=y
# CONFIG_BUSYBOX_CONFIG_PAM is not set
# CONFIG_BUSYBOX_CONFIG_TFTP_DEBUG is not set
# CONFIG_BUSYBOX_CONFIG_NTPD is not set
CONFIG_BUSYBOX_CONFIG_MOUNTPOINT=y
CONFIG_BUSYBOX_CONFIG_RUN_PARTS=y
CONFIG_BUSYBOX_CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS=y
CONFIG_BUSYBOX_CONFIG_FEATURE_RUN_PARTS_FANCY=y
CONFIG_BUSYBOX_CONFIG_FEATURE_GZIP_LEVELS=y
CONFIG_BUSYBOX_CONFIG_GZIP_FAST=2
CONFIG_BUSYBOX_CONFIG_FEATURE_FANCY_SLEEP=y
CONFIG_BUSYBOX_CONFIG_FEATURE_FLOAT_SLEEP=y
CONFIG_BUSYBOX_CONFIG_FLOAT_DURATION=y
CONFIG_BUSYBOX_CONFIG_USLEEP=y
CONFIG_BUSYBOX_CONFIG_REALPATH=y
CONFIG_BUSYBOX_CONFIG_TTY=y
CONFIG_BUSYBOX_CONFIG_BLOCKDEV=y
CONFIG_BUSYBOX_CONFIG_PARTPROBE=y
CONFIG_BUSYBOX_CONFIG_LFS=y
CONFIG_BUSYBOX_CONFIG_FDISK=y
CONFIG_BUSYBOX_CONFIG_FDISK_SUPPORT_LARGE_DISKS=y
CONFIG_BUSYBOX_CONFIG_FEATURE_FDISK_WRITABLE=y
CONFIG_BUSYBOX_CONFIG_FEATURE_GPT_LABEL=y
CONFIG_BUSYBOX_CONFIG_FEATURE_FDISK_ADVANCED=y
CONFIG_BUSYBOX_CONFIG_IONICE=y
CONFIG_BUSYBOX_CONFIG_RENICE=y
CONFIG_BUSYBOX_CONFIG_FEATURE_VOLUMEID_BTRFS=y
CONFIG_BUSYBOX_CONFIG_FEATURE_VOLUMEID_F2FS=y
CONFIG_BUSYBOX_CONFIG_FEATURE_VOLUMEID_LINUXSWAP=y
CONFIG_BUSYBOX_CONFIG_FEATURE_VOLUMEID_SQUASHFS=y
CONFIG_BUSYBOX_CONFIG_FEATURE_VOLUMEID_UBIFS=y
CONFIG_BUSYBOX_CONFIG_TIMEOUT=y
CONFIG_BUSYBOX_CONFIG_NOHUP=y
CONFIG_LIBCURL_CRYPTO_AUTH=y
# CONFIG_LIBCURL_MBEDTLS is not set
CONFIG_LIBCURL_OPENSSL=y
CONFIG_OPENVPN_openssl_ENABLE_IPROUTE2=y
# CONFIG_SAMBA3_CONFIG_NO_PRINTING is not set
# CONFIG_SIGNED_PACKAGES is not set
CONFIG_KERNEL_DEVTMPFS=y
CONFIG_KERNEL_DEVTMPFS_MOUNT=y
# CONFIG_BUSYBOX_CONFIG_IP is not set
CONFIG_LOCALMIRROR="http://download.iopsys.eu/iopsys/mirror/"

View File

@@ -35,7 +35,7 @@ _iop()
iopcmds="bootstrap cfe_upgrade cfe_upgrade_latest extract_core \
feeds_update genconfig generate_tarballs install_key \
scp_changes setup_host ssh_install_key status \
update_package update_feed_branches ssh_upgrade smoketest"
update_package update_feed_branches ssh_upgrade"
if [ $COMP_CWORD -eq 1 ] ; then

View File

@@ -6,9 +6,13 @@ function extract_core {
topdir=$(pwd)
# Paths to packages that should be exported.
paths+='package/network/services/dnsmasq '
paths+='package/network/config/firewall '
paths+='package/network/config/netifd '
paths+='package/network/config/qos-scripts '
paths+='package/utils/busybox '
paths+='package/base-files '
paths+='package/system/procd '
paths+='package/system/rpcd '
paths+='package/network/services/openvpn '
@@ -20,13 +24,7 @@ function extract_core {
echo ""
echo "Example: $0 extract_core"
echo " -p package/utils/busybox"
echo " -r feeds/openwrt_core"
echo " -b devel"
echo ""
echo "Extract all default packages:"
echo "$0 extract_core"
echo " -p default"
echo " -r feeds/openwrt_core"
echo " -r feeds/lede_core"
echo " -b devel"
}

View File

@@ -14,7 +14,7 @@ function feeds_update {
done
git remote -v | grep -qE '(git@|ssh://)' && developer=1
git remote -v | grep -q http || developer=1
cp .config .genconfig_config_bak
@@ -28,11 +28,12 @@ function feeds_update {
# replace core packages with iopsys versions
if [ $override == 1 ]; then
./scripts/feeds install -f -p openwrt_core -a
./scripts/feeds install -f -p lede_core -a
fi
# targets need to be installed explicitly
for target in $(ls ./feeds/targets)
targets="iopsys-brcm63xx-mips iopsys-brcm63xx-arm iopsys-ramips intel_mips"
for target in $targets
do
rm -f target/linux/$target
./scripts/feeds install -p targets $target
@@ -56,3 +57,6 @@ function feeds_update {
register_command "feeds_update" "Update feeds to point to commit hashes from feeds.conf"

View File

@@ -5,6 +5,7 @@ function genconfig {
export IMPORT=1
export SRCTREEOVERR=0
export FILEDIR="files/"
export THEMEDIR="themes"
CURRENT_CONFIG_FILE=".current_config_file"
export CONFIGPATH="package/feeds/iopsys/iop"
CUSTPATH="customerconfigs"
@@ -12,12 +13,11 @@ function genconfig {
export VERBOSE=0
export DEVELOPER=0
target="bogus"
target_config_path=""
config_path=""
brcm63xx_mips="target/linux/iopsys-brcm63xx-mips"
brcm63xx_arm="target/linux/iopsys-brcm63xx-arm"
ramips="target/linux/iopsys-ramips"
econet="target/linux/iopsys-econet"
x86="target/linux/iopsys-x86"
armvirt="target/linux/iopsys-armvirt"
intel_mips="target/linux/intel_mips"
Red='\033[0;31m' # Red
Color_Off='\033[0m' # Text Reset
@@ -79,47 +79,20 @@ function genconfig {
# Takes a board name and returns the target name in global var $target
set_target() {
local profile=$1
local profile=$1
[ -n "$profile" ] || return
if [ -n "$TARGET" -a -d "./target/linux/$TARGET" ]; then
local targetpath="./target/linux/$TARGET"
local profiles=
local pfound=0
if [ -e "$targetpath/genconfig" ]; then
profiles=$(cd $targetpath; ./genconfig)
for p in $profiles; do
if [ $p == $profile ]; then
pfound=1
break
fi
done
fi
if [ $pfound -eq 1 ]; then
target="$(echo $TARGET | tr '-' '_')"
target_config_path="$targetpath/config"
fi
return
fi
[ -e $brcm63xx_mips/genconfig ] &&
iopsys_brcm63xx_mips=$(cd $brcm63xx_mips; ./genconfig)
[ -e $brcm63xx_arm/genconfig ] &&
iopsys_brcm63xx_arm=$(cd $brcm63xx_arm; ./genconfig)
[ -e $ramips/genconfig ] &&
iopsys_ramips=$(cd $ramips; ./genconfig)
[ -e $econet/genconfig ] &&
iopsys_econet=$(cd $econet; ./genconfig)
[ -e $x86/genconfig ] &&
iopsys_x86=$(cd $x86; ./genconfig)
[ -e $armvirt/genconfig ] &&
iopsys_armvirt=$(cd $armvirt; ./genconfig)
[ -e $intel_mips/genconfig ] &&
iopsys_intel_mips=$(cd $intel_mips; ./genconfig)
if [ "$profile" == "LIST" ]; then
for list in iopsys_brcm63xx_arm iopsys_ramips iopsys_econet iopsys_x86 iopsys_armvirt; do
for list in iopsys_brcm63xx_mips iopsys_brcm63xx_arm iopsys_ramips iopsys_intel_mips; do
echo "$list based boards:"
for b in ${!list}; do
echo -e "\t$b"
@@ -128,10 +101,18 @@ function genconfig {
return
fi
for p in $iopsys_brcm63xx_mips; do
if [ $p == $profile ]; then
target="iopsys_brcm63xx_mips"
config_path="$brcm63xx_mips/config"
return
fi
done
for p in $iopsys_brcm63xx_arm; do
if [ $p == $profile ]; then
target="iopsys_brcm63xx_arm"
target_config_path="$brcm63xx_arm/config"
config_path="$brcm63xx_arm/config"
return
fi
done
@@ -139,38 +120,35 @@ function genconfig {
for p in $iopsys_ramips; do
if [ $p == $profile ]; then
target="iopsys_ramips"
target_config_path="$ramips/config"
config_path="$ramips/config"
return
fi
done
for p in $iopsys_econet; do
for p in $iopsys_intel_mips; do
if [ $p == $profile ]; then
target="iopsys_econet"
target_config_path="$econet/config"
target="intel_mips"
config_path="$intel_mips/config"
return
fi
done
for p in $iopsys_x86; do
if [ $p == $profile ]; then
target="iopsys_x86"
target_config_path="$x86/config"
return
fi
done
for p in $iopsys_armvirt; do
if [ $p == $profile ]; then
target="iopsys_armvirt"
target_config_path="$armvirt/config"
return
fi
done
}
git remote -v | grep -qE '(git@|ssh://)' && {
git remote -v | grep -q http || {
DEVELOPER=1
bcmAllowed=0
endptAllowed=0
natalieAllowed=0
mediatekAllowed=0
wifilifeAllowed=0
git ls-remote git@dev.iopsys.eu:broadcom/bcmcreator.git -q 2>/dev/null && bcmAllowed=1
git ls-remote git@dev.iopsys.eu:mediatek/linux.git -q 2>/dev/null && mediatekAllowed=1
git ls-remote git@dev.iopsys.eu:dialog/natalie-dect-12.26.git -q 2>/dev/null && natalieAllowed=1
git ls-remote git@dev.iopsys.eu:iopsys/endptmngr.git -q 2>/dev/null && endptAllowed=1
git ls-remote git@dev.iopsys.eu:iopsys/wifilife.git -q 2>/dev/null && wifilifeAllowed=1
}
v() {
@@ -184,7 +162,6 @@ function genconfig {
echo -e " -c|--clean\t\tRemove all files under ./files and import from config "
echo -e " -v|--verbose\t\tVerbose"
echo -e " -n|--no-update\tDo NOT! Update customer config before applying"
echo -e " -t|--target\t\tExplicitly specify the linux target to build the board profile from"
echo -e " -s|--override\t\tEnable 'Package source tree override'"
echo -e " -S|--brcmsingle\tForce build of bcmkernel to use only one thread"
echo -e " -h|--help\t\tShow this message"
@@ -192,7 +169,7 @@ function genconfig {
echo -e " -a|--list-all\t\tList all Customers and their board types"
echo -e " -b|--boards\t\tList all board types"
echo
echo "Example ./iop genconfig eg400 OPERATORX"
echo "Example ./iop genconfig dg200 TELIA"
echo "(if no customerconfig is chosen, iopsys config will be used)"
echo
exit 0
@@ -203,7 +180,7 @@ function genconfig {
local ALL="$1"
local CUSTOMER="$2"
if [ "$CUSTOMER" -a -d "$CUSTCONF/$CUSTOMER" ]; then
local boards="$(ls -1 "$CUSTCONF/$CUSTOMER" | grep -v common)"
local boards="$(ls -1 "$CUSTCONF/$CUSTOMER" | grep -v common | grep -v juci-theme)"
if [ "$boards" ]; then
echo "$CUSTOMER has following boards:"
for board in $boards; do
@@ -220,7 +197,7 @@ function genconfig {
if [ "$customers" -a "$ALL" == 1 ]; then
for customer in $customers; do
echo $customer
local boards="$(ls -1 $CUSTCONF/$customer | grep -v common)"
local boards="$(ls -1 $CUSTCONF/$customer | grep -v common | grep -v juci-theme)"
if [ "$boards" ]; then
for board in $boards; do
echo -e "\t$board"
@@ -243,41 +220,28 @@ function genconfig {
generate_config()
{
DIFFFILE="$1"
MASTERFILE="$2"
while read p; do
v "$p"
sed -r -i "$p" $MASTERFILE
done < $DIFFFILE
DIFFFILE="$1"
MASTERFILE="$2"
while read p; do
v "$p"
sed -r -i "$p" $MASTERFILE
done < $DIFFFILE
}
setup_dirs()
{
git remote -v | grep -q http || {
CUSTBRANCH="$(git rev-parse --abbrev-ref HEAD)"
if git ls-remote $CUSTREPO -q 2>/dev/null; then
if [ ! -d "$CUSTPATH" ]; then
echo "Cloning $CUSTBRANCH branch of $CUSTREPO"
git clone -b "$CUSTBRANCH" "$CUSTREPO" "$CUSTPATH" 2>/dev/null || {
DEFBRANCH="$(git remote show $CUSTREPO | grep 'HEAD branch' | cut -d' ' -f5)"
echo "$CUSTBRANCH branch is not found, cloning $DEFBRANCH branch of $CUSTREPO"
git clone "$CUSTREPO" "$CUSTPATH"
}
elif [ $IMPORT -eq 1 ]; then
cd $CUSTPATH
echo "Checking out $CUSTBRANCH branch in $CUSTPATH"
git checkout "$CUSTBRANCH" 2>/dev/null || {
DEFBRANCH="$(git symbolic-ref refs/remotes/origin/HEAD | cut -d '/' -f4)"
echo "Checking out $CUSTBRANCH branch has failed, using $DEFBRANCH branch in $CUSTPATH"
}
v "git pull"
git pull
cd - >/dev/null #go back
fi
else
echo "You do not have access to $CUSTREPO"
if git ls-remote $CUSTREPO -q 2>/dev/null; then
if [ ! -d "$CUSTPATH" ]; then
git clone "$CUSTREPO" "$CUSTPATH"
elif [ $IMPORT -eq 1 ]; then
cd $CUSTPATH
v "git pull"
git pull
cd - >/dev/null #go back
fi
}
else
echo "You do not have access to $CUSTREPO"
fi
if [ ! -d "$FILEDIR" ]; then
mkdir -p $FILEDIR
@@ -285,6 +249,13 @@ function genconfig {
v "rm -rf $FILEDIR*"
rm -rf $FILEDIR*
fi
if [ ! -d "$THEMEDIR" ]; then
mkdir -p $THEMEDIR
elif [ -d "$THEMEDIR" -a $CLEAN -eq 1 ]; then
v "rm -rf $THEMEDIR/*"
rm -rf $THEMEDIR/*
fi
}
create_and_copy_files()
@@ -320,25 +291,22 @@ function genconfig {
v "cp $CONFIGPATH/config .config"
cp $CONFIGPATH/config .config
if [ -f $target_config_path/config ]; then
cat $target_config_path/config >> .config
echo "" >> .config
if [ -f $config_path/config ]; then
cat $config_path/config >> .config
fi
if [ -f $target_config_path/$BOARDTYPE/config ]; then
cat $target_config_path/$BOARDTYPE/config >> .config
echo "" >> .config
if [ -f $config_path/$BOARDTYPE/config ]; then
cat $config_path/$BOARDTYPE/config >> .config
fi
# Special handling for targets which use TARGET_DEVICES
if [ "$target" = "iopsys_ramips" ]; then
subtarget="mt7621"
echo "CONFIG_TARGET_${target}=y" >> .config
echo "CONFIG_TARGET_${target}_${subtarget}=y" >> .config
echo "CONFIG_TARGET_DEVICE_${target}_${subtarget}_DEVICE_${BOARDTYPE}=y" >> .config
elif [ "$target" = "iopsys_econet" ]; then
subtarget="en7562"
#special handling for intel_mips which use TARGET_DEVICES
if [ "$target" = "intel_mips" ]; then
subtarget="xrx500"
echo "CONFIG_TARGET_${target}=y" >> .config
echo "CONFIG_TARGET_${target}_${subtarget}=y" >> .config
echo "CONFIG_TARGET_MULTI_PROFILE=y" >> .config
echo "CONFIG_TARGET_PER_DEVICE_ROOTFS=y" >> .config
device=$(echo $BOARDTYPE | tr a-z A-Z)
echo "CONFIG_TARGET_DEVICE_${target}_${subtarget}_DEVICE_${device}=y" >> .config
else
echo "CONFIG_TARGET_${target}=y" >> .config
echo "CONFIG_TARGET_${target}_${BOARDTYPE}=y" >> .config
@@ -357,29 +325,27 @@ function genconfig {
v "cp -ar $CUSTCONF/$CUSTOMER/$BOARDTYPE/fs/* $FILEDIR"
cp -ar $CUSTCONF/$CUSTOMER/$BOARDTYPE/fs/* $FILEDIR
fi
if [ -d "$CUSTCONF/$CUSTOMER/juci-theme" ]; then
customer="$(echo $CUSTOMER | tr 'A-Z' 'a-z')"
v "cp -ar $CUSTCONF/$CUSTOMER/juci-theme $THEMEDIR/juci-theme-$customer"
cp -ar $CUSTCONF/$CUSTOMER/juci-theme $THEMEDIR/juci-theme-$customer
fi
if [ -e "$CUSTCONF/$CUSTOMER/common/common.diff" ]; then
v "Apply $CUSTCONF/$CUSTOMER/common/common.diff"
cat $CUSTCONF/$CUSTOMER/common/common.diff >> .config
echo "" >> .config
fi
if [ -e "$CUSTCONF/$CUSTOMER/$BOARDTYPE/$BOARDTYPE.diff" ]; then
v "Apply $CUSTCONF/$CUSTOMER/$BOARDTYPE/$BOARDTYPE.diff"
cat $CUSTCONF/$CUSTOMER/$BOARDTYPE/$BOARDTYPE.diff >> .config
echo "" >> .config
fi
done
fi
# Set target version
local GIT_TAG=$(git describe --abbrev=0 --tags)
local GIT_REV=$(git rev-parse --short HEAD)
local GIT_VER="$GIT_TAG"
git describe --contains $GIT_REV >/dev/null 2>&1 || GIT_VER="${GIT_TAG}_${GIT_REV}"
echo "CONFIG_TARGET_VERSION=\"${GIT_VER}\"" >> .config
echo "CONFIG_VERSION_CODE=\"${GIT_VER}\"" >> .config
echo "CONFIG_VERSION_PRODUCT=\"$BOARDTYPE"\" >> .config
echo "CONFIG_TARGET_VERSION=\"${GIT_TAG}\"" >> .config
# Enable Package source tree override if selected
# Enable Pckage source tree override if selected
[ $SRCTREEOVERR -eq 1 ] && echo CONFIG_SRC_TREE_OVERRIDE=y >> .config
# developer mode selected ?
@@ -387,8 +353,18 @@ function genconfig {
if [ $DEVELOPER -eq 1 ]; then
# rewrite url to clone with ssh instead of http
echo "CONFIG_GITMIRROR_REWRITE=y" >>.config
[ $bcmAllowed -eq 0 ] && echo "CONFIG_BCM_OPEN=y" >> .config
[ $endptAllowed -eq 0 ] && echo "CONFIG_ENDPT_OPEN=y" >> .config
[ $natalieAllowed -eq 0 ] && echo "CONFIG_NATALIE_OPEN=y" >> .config
[ $mediatekAllowed -eq 0 ] && echo "CONFIG_MEDIATEK_OPEN=y" >> .config
[ $wifilifeAllowed -eq 0 ] && echo "CONFIG_WIFILIFE_OPEN=y" >> .config
else
echo "# CONFIG_GITMIRROR_REWRITE is not set" >>.config
echo "CONFIG_BCM_OPEN=y" >> .config
echo "CONFIG_ENDPT_OPEN=y" >> .config
echo "CONFIG_NATALIE_OPEN=y" >> .config
echo "CONFIG_MEDIATEK_OPEN=y" >> .config
echo "CONFIG_WIFILIFE_OPEN=y" >> .config
fi
if [ -n "$BRCM_MAX_JOBS" ]
@@ -396,12 +372,15 @@ function genconfig {
echo "CONFIG_BRCM_MAX_JOBS=\"1\"" >>.config
fi
# Force regeneration of themes
touch package/feeds/juci/juci/Makefile
# Force regeneration of kernel Makefile
# Needed to disable kmods for iopsys-brcm targets
touch package/kernel/linux/Makefile
# we need to signal to bradcom SDK that we have changed the board id
# currently boardparms.c and boardparms_voice.c is the only place that is depending on boardid name
# currently boardparms.c and boardparms_voice.c is the only place that is depending on inteno boardid name
# so just touch that file.
[ -d ./build_dir ] && find build_dir/ -name "boardparms*c" -print0 2>/dev/null | xargs -0 touch 2>/dev/null
@@ -438,7 +417,6 @@ function genconfig {
-c|--clean) export CLEAN=1;;
-n|--no-update) export IMPORT=0;;
-v|--verbose) export VERBOSE="$(($VERBOSE + 1))";;
-t|--target) export TARGET="$2"; shift;;
-p|--profile) export PROFILE="$2"; shift;;
-r|--repo) export CUSTREPO="$2"; shift;;
-s|--override) export SRCTREEOVERR=1;;

View File

@@ -1,435 +0,0 @@
#!/bin/bash
function genconfig_min {
export CLEAN=0
export SRCTREEOVERR=0
export FILEDIR="files/"
CURRENT_CONFIG_FILE=".current_config_file"
export CONFIGPATH="package/feeds/iopsys/iop"
CUSTPATH="customerconfigs"
export CUSTCONF="customerconfigs/customers"
export VERBOSE=0
export DEVELOPER=0
target="bogus"
target_config_path=""
brcm63xx_arm="target/linux/iopsys-brcm63xx-arm"
ramips="target/linux/iopsys-ramips"
econet="target/linux/iopsys-econet"
x86="target/linux/iopsys-x86"
armvirt="target/linux/iopsys-armvirt"
Red='\033[0;31m' # Red
Color_Off='\033[0m' # Text Reset
Yellow='\033[0;33m' # Yellow
function find_last {
egrep "^[ #]*${1}[ =]" $2 | tail -n1
}
function is_new {
for opt in $conf_warned
do
if [ "$opt" == "$1" ]
then
return 1
fi
done
# option not found return true
return 0
}
function verify_config {
IFS=$'\n'
org=$(<.genconfig.config)
unset IFS
local num
local conf_opt
local conf_org
local conf_new
#echo "lines to check $tot_lines"
num=0
for line in $org
do
conf_opt=$(echo $line | grep CONFIG_ | sed 's|.*\(CONFIG_[^ =]*\)[ =].*|\1|')
if [ -n "${conf_opt}" ]
then
conf_org=$(find_last ${conf_opt} .genconfig.config)
conf_new=$(find_last ${conf_opt} .config)
if [ "$conf_org" != "$conf_new" ]
then
if is_new $conf_opt
then
echo -e "config option [${Red}$conf_opt${Color_Off}] is not set correctly in .config"
echo -e "got value [${Yellow}$conf_new${Color_Off}] but wanted [${Yellow}$conf_org${Color_Off}]"
echo "This is a real problem somebody needs to investigate"
echo ""
conf_warned="$conf_warned $conf_opt"
fi
else
true
# for debug to see all options
#echo -e "wanted [$conf_org] got [$conf_new]"
fi
fi
num=$((num+1))
done
}
# Takes a board name and returns the target name in global var $target
set_target() {
local profile=$1
[ -n "$profile" ] || return
if [ -n "$TARGET" -a -d "./target/linux/$TARGET" ]; then
local targetpath="./target/linux/$TARGET"
local profiles=
local pfound=0
if [ -e "$targetpath/genconfig" ]; then
profiles=$(cd $targetpath; ./genconfig)
for p in $profiles; do
if [ $p == $profile ]; then
pfound=1
break
fi
done
fi
if [ $pfound -eq 1 ]; then
target="$(echo $TARGET | tr '-' '_')"
target_config_path="$targetpath/config"
fi
return
fi
[ -e $brcm63xx_arm/genconfig ] &&
iopsys_brcm63xx_arm=$(cd $brcm63xx_arm; ./genconfig)
[ -e $ramips/genconfig ] &&
iopsys_ramips=$(cd $ramips; ./genconfig)
[ -e $econet/genconfig ] &&
iopsys_econet=$(cd $econet; ./genconfig)
[ -e $x86/genconfig ] &&
iopsys_x86=$(cd $x86; ./genconfig)
[ -e $armvirt/genconfig ] &&
iopsys_armvirt=$(cd $armvirt; ./genconfig)
if [ "$profile" == "LIST" ]; then
for list in iopsys_brcm63xx_arm iopsys_ramips iopsys_econet iopsys_x86 iopsys_armvirt; do
echo "$list based boards:"
for b in ${!list}; do
echo -e "\t$b"
done
done
return
fi
for p in $iopsys_brcm63xx_arm; do
if [ $p == $profile ]; then
target="iopsys_brcm63xx_arm"
target_config_path="$brcm63xx_arm/config"
return
fi
done
for p in $iopsys_ramips; do
if [ $p == $profile ]; then
target="iopsys_ramips"
target_config_path="$ramips/config"
return
fi
done
for p in $iopsys_econet; do
if [ $p == $profile ]; then
target="iopsys_econet"
target_config_path="$econet/config"
return
fi
done
for p in $iopsys_x86; do
if [ $p == $profile ]; then
target="iopsys_x86"
target_config_path="$x86/config"
return
fi
done
for p in $iopsys_armvirt; do
if [ $p == $profile ]; then
target="iopsys_armvirt"
target_config_path="$armvirt/config"
return
fi
done
}
git remote -v | grep -qE '(git@|ssh://)' && {
DEVELOPER=1
}
v() {
[ "$VERBOSE" -ge 1 ] && echo "$@"
}
usage() {
echo
echo 1>&2 "Usage: $0 [ OPTIONS ] < Board_Type > [ Customer [customer2 ]...]"
echo
echo -e " -c|--clean\t\tRemove all files under ./files and import from config "
echo -e " -v|--verbose\t\tVerbose"
echo -e " -n|--no-update\tDo NOT! Update customer config before applying"
echo -e " -t|--target\t\tExplicitly specify the linux target to build the board profile from"
echo -e " -s|--override\t\tEnable 'Package source tree override'"
echo -e " -S|--brcmsingle\tForce build of bcmkernel to use only one thread"
echo -e " -h|--help\t\tShow this message"
echo -e " -l|--list [customer]\tList all Customers or all boards for one customer"
echo -e " -a|--list-all\t\tList all Customers and their board types"
echo -e " -b|--boards\t\tList all board types"
echo
echo "Example ./iop genconfig eg400 OPERATORX"
echo "(if no customerconfig is chosen, iopsys config will be used)"
echo
exit 0
}
list_customers()
{
local ALL="$1"
local CUSTOMER="$2"
if [ "$CUSTOMER" -a -d "$CUSTCONF/$CUSTOMER" ]; then
local boards="$(ls -1 "$CUSTCONF/$CUSTOMER" | grep -v common )"
if [ "$boards" ]; then
echo "$CUSTOMER has following boards:"
for board in $boards; do
echo -e "\t$board"
done
else
echo "No boards found for $CUSTOMER"
fi
elif [ "$CUSTOMER" ]; then
echo "No customer called $CUSTOMER"
exit 1
elif [ -d $CUSTCONF ]; then
local customers="$(ls -1 $CUSTCONF)"
if [ "$customers" -a "$ALL" == 1 ]; then
for customer in $customers; do
echo $customer
local boards="$(ls -1 $CUSTCONF/$customer | grep -v common )"
if [ "$boards" ]; then
for board in $boards; do
echo -e "\t$board"
done
else
echo "has no boards"
fi
done
elif [ "$customers" ]; then
echo -e "$customers"
else
echo "no customers found"
fi
else
echo "No $CUSTCONF folder found"
fi
exit 0
}
generate_config()
{
DIFFFILE="$1"
MASTERFILE="$2"
while read p; do
v "$p"
sed -r -i "$p" $MASTERFILE
done < $DIFFFILE
}
setup_dirs()
{
if [ ! -d "$FILEDIR" ]; then
mkdir -p $FILEDIR
elif [ -d "$FILEDIR" -a $CLEAN -eq 1 ]; then
v "rm -rf $FILEDIR*"
rm -rf $FILEDIR*
fi
}
create_and_copy_files()
{
local BOARDTYPE=$1
shift
local CUSTOMERS=$@
# Validate seleced board and customers
set_target $BOARDTYPE
if [ $target == "bogus" ]; then
echo "Hardware profile does not exist"
exit 1
elif [ -n "$CUSTOMERS" ]; then
for CUSTOMER in $CUSTOMERS; do
if [ ! -d "$CUSTCONF/$CUSTOMER/" ]; then
echo "Customer profile for '$CUSTOMER' does not exist"
exit 1
elif [ ! -d "$CUSTCONF/$CUSTOMER/$BOARDTYPE/" ]; then
echo "'$BOARDTYPE' board profile does not exist for customer '$CUSTOMER'"
if [ -f "$CUSTCONF/$CUSTOMER/common/common.diff" ]; then
echo "Common profile configuration will be used"
else
exit 1
fi
fi
done
fi
# Generate base config
rm -f .config
v "Config $BOARDTYPE selected"
v "cp $CONFIGPATH/config .config"
cp $CONFIGPATH/config .config
if [ -f $target_config_path/config ]; then
cat $target_config_path/config >> .config
echo "" >> .config
fi
if [ -f $target_config_path/$BOARDTYPE/config ]; then
cat $target_config_path/$BOARDTYPE/config >> .config
echo "" >> .config
fi
# Special handling for targets which use TARGET_DEVICES
if [ "$target" = "iopsys_ramips" ]; then
subtarget="mt7621"
echo "CONFIG_TARGET_${target}=y" >> .config
echo "CONFIG_TARGET_${target}_${subtarget}=y" >> .config
echo "CONFIG_TARGET_DEVICE_${target}_${subtarget}_DEVICE_${BOARDTYPE}=y" >> .config
elif [ "$target" = "iopsys_econet" ]; then
subtarget="en7562"
echo "CONFIG_TARGET_${target}=y" >> .config
echo "CONFIG_TARGET_${target}_${subtarget}=y" >> .config
else
echo "CONFIG_TARGET_${target}=y" >> .config
echo "CONFIG_TARGET_${target}_${BOARDTYPE}=y" >> .config
fi
echo "$CUSTOMERS $BOARDTYPE" > $CURRENT_CONFIG_FILE
# Add customerconfig diff if a customer is selected
if [ -n "$CUSTOMERS" ]; then
for CUSTOMER in $CUSTOMERS; do
if [ -d "$CUSTCONF/$CUSTOMER/common/fs" ]; then
v "cp -ar $CUSTCONF/$CUSTOMER/common/fs/* $FILEDIR"
cp -ar $CUSTCONF/$CUSTOMER/common/fs/* $FILEDIR
fi
if [ -d "$CUSTCONF/$CUSTOMER/$BOARDTYPE/fs" ]; then
v "cp -ar $CUSTCONF/$CUSTOMER/$BOARDTYPE/fs/* $FILEDIR"
cp -ar $CUSTCONF/$CUSTOMER/$BOARDTYPE/fs/* $FILEDIR
fi
if [ -e "$CUSTCONF/$CUSTOMER/common/common.diff" ]; then
v "Apply $CUSTCONF/$CUSTOMER/common/common.diff"
cat $CUSTCONF/$CUSTOMER/common/common.diff >> .config
echo "" >> .config
fi
if [ -e "$CUSTCONF/$CUSTOMER/$BOARDTYPE/$BOARDTYPE.diff" ]; then
v "Apply $CUSTCONF/$CUSTOMER/$BOARDTYPE/$BOARDTYPE.diff"
cat $CUSTCONF/$CUSTOMER/$BOARDTYPE/$BOARDTYPE.diff >> .config
echo "" >> .config
fi
done
fi
# Set target version
local GIT_TAG=$(git describe --abbrev=0 --tags)
local GIT_REV=$(git rev-parse --short HEAD)
local GIT_VER="$GIT_TAG"
git describe --contains $GIT_REV >/dev/null 2>&1 || GIT_VER="${GIT_TAG}_${GIT_REV}"
echo "CONFIG_TARGET_VERSION=\"${GIT_VER}\"" >> .config
echo "CONFIG_VERSION_CODE=\"${GIT_VER}\"" >> .config
echo "CONFIG_VERSION_PRODUCT=\"$BOARDTYPE"\" >> .config
# Enable Package source tree override if selected
[ $SRCTREEOVERR -eq 1 ] && echo CONFIG_SRC_TREE_OVERRIDE=y >> .config
# developer mode selected ?
echo "CONFIG_DEVEL=y" >>.config
if [ -n "$BRCM_MAX_JOBS" ]
then
echo "CONFIG_BRCM_MAX_JOBS=\"1\"" >>.config
fi
# Force regeneration of kernel Makefile
# Needed to disable kmods for iopsys-brcm targets
touch package/kernel/linux/Makefile
# we need to signal to bradcom SDK that we have changed the board id
# currently boardparms.c and boardparms_voice.c is the only place that is depending on boardid name
# so just touch that file.
[ -d ./build_dir ] && find build_dir/ -name "boardparms*c" -print0 2>/dev/null | xargs -0 touch 2>/dev/null
# Store generated config
cp .config .genconfig.config
# Set default values based on selected parameters
v "$(make defconfig 2>&1)"
echo Set version to $(grep -w CONFIG_TARGET_VERSION .config | cut -d'=' -f2 | tr -d '"')
# Clean base-file package to force rebuild when changing profile
v "$(make package/base-files/clean 2>&1)"
verify_config
}
####### main #####
if [ ! -e tmp/.iop_bootstrap ]; then
echo "You have not installed feeds. Running genconfig in this state would create a non functional configuration."
echo "Run: iop feeds_update"
exit 0
fi
if [ $# -eq 0 ]; then
echo Current profile:
cat $CURRENT_CONFIG_FILE
echo "Try ./iop genconfig -h' to get instructions if you want to change current config"
exit 0
else
while [ -n "$1" ]; do
case "$1" in
-c|--clean) export CLEAN=1;;
-n|--no-update) export IMPORT=0;;
-v|--verbose) export VERBOSE="$(($VERBOSE + 1))";;
-t|--target) export TARGET="$2"; shift;;
-p|--profile) export PROFILE="$2"; shift;;
-r|--repo) export CUSTREPO="$2"; shift;;
-s|--override) export SRCTREEOVERR=1;;
-S|--brcmsingel) export BRCM_MAX_JOBS=1;;
-h|--help) usage;;
-l|--list) list_customers 0 $2;;
-a|--list-all)list_customers 1;;
-b|--boards)set_target LIST;exit 0;;
-*)
echo "Invalid option: $1 "
echo "Try -h or --help for more information."
exit 1
;;
*) break;;
esac
shift;
done
CUSTREPO="${CUSTREPO:-git@dev.iopsys.eu:consumer/iopsys.git}"
setup_dirs
create_and_copy_files "$@"
fi
}
register_command "genconfig_min" "Generate configuration for customer with manual board configuration"

View File

@@ -1,32 +1,40 @@
#!/bin/bash
# shellcheck disable=SC2029
build_bcmkernel_consumer() {
local tarfile bcmkernelcommith sdkversion serverpath serverlink
sdkversion="$(grep "CONFIG_BRCM_SDK_VER.*=y" .config | awk -F'[_,=]' '{print$5}')"
sdkversion="${sdkversion:0:4}${sdkversion:(-1)}"
bcmkernelcommith="$(grep -w "PKG_SOURCE_VERSION:" "$curdir/feeds/broadcom/bcmkernel/${sdkversion:0:5}"*".mk" | cut -d'=' -f2)"
[ -n "$board" ] && [ -n "$bcmkernelcommith" ] || return
serverpath="$FPATH/bcmopen-$board-$bcmkernelcommith.tar.gz"
serverlink="$FPATH/bcmopen-$board-$majver.$minver-latest"
local tarfile bcmkernelcommith sdkversion
sdkversion=$(grep "CONFIG_BRCM_SDK_VER.*=y" .config | awk -F'[_,=]' '{print$5}')
sdkversion=${sdkversion:0:4}${sdkversion:(-1)}
bcmkernelcommith=$(grep -w "PKG_SOURCE_VERSION:" $curdir/feeds/broadcom/bcmkernel/${sdkversion:0:5}*.mk | cut -d'=' -f2)
# do not build bcmopen sdk if it was already built before
# if it was, check if there's a symlink in place and create it if missing
ssh "$SERVER" "test -f '$serverpath' && { test -L '$serverlink' || ln -sf '$serverpath' '$serverlink'; }" && return
cd "./build_dir/target-"*"/bcmkernel-"*"-${sdkversion:0:4}"*"/bcm963xx/release"
bash do_consumer_release -p "$profile" -y -F
[ -n "$board" -a -n "$bcmkernelcommith" ] || return
ssh $SERVER "test -f $FPATH/bcmopen-$board-$bcmkernelcommith.tar.gz" && return
cd ./build_dir/target-*/bcmkernel-*-${sdkversion:0:4}*/bcm963xx/release
bash do_consumer_release -p $profile -y -F
tarfile='out/bcm963xx_*_consumer.tar.gz'
[ $(ls -1 $tarfile | wc -l) -ne 1 ] && echo "Too many tar files: '$tarfile'" && return
scp -pv $tarfile "$SERVER":"$serverpath"
ssh "$SERVER" "test -f '$serverpath' && ln -sf '$serverpath' '$serverlink'"
[ $(ls -1 $tarfile |wc -l) -ne 1 ] && echo "Too many tar files: '$tarfile'" && return
scp -pv $tarfile $SERVER:$FPATH/bcmopen-$board-$bcmkernelcommith.tar.gz
ssh $SERVER "[ -f $FPATH/bcmopen-$board-$bcmkernelcommith.tar.gz ] && ln -sf $FPATH/bcmopen-$board-$bcmkernelcommith.tar.gz $FPATH/bcmopen-$board-$majver.$minver-latest"
rm -f $tarfile
cd "$curdir"
}
build_natalie_consumer() {
# create natalie-dect open version tar file
local natalieversion nataliecommith
grep -q "CONFIG_TARGET_NO_DECT=y" .config && return
natalieversion=$(grep -w "PKG_VERSION:" ./feeds/iopsys/natalie-dect/Makefile | cut -d'=' -f2)
nataliecommith=$(grep -w "PKG_SOURCE_VERSION:" ./feeds/iopsys/natalie-dect/Makefile | cut -d'=' -f2)
[ -n "$profile" -a -n "$natalieversion" -a -n "$nataliecommith" ] || return
ssh $SERVER "test -f $FPATH/natalie-dect-$profile-$natalieversion-$nataliecommith.tar.gz" && return
cd ./build_dir/target-*/natalie-dect-$natalieversion/
mkdir natalie-dect-open-$natalieversion
cp -f ipkg-*/natalie-dect/lib/modules/*/extra/dect.ko natalie-dect-open-$natalieversion/dect.ko
tar -czv natalie-dect-open-$natalieversion/ -f natalie-dect-$profile-$natalieversion-$nataliecommith.tar.gz
scp -pv natalie-dect-$profile-$natalieversion-$nataliecommith.tar.gz $SERVER:$FPATH/
cp natalie-dect-$profile-$natalieversion-$nataliecommith.tar.gz $curdir/
rm -rf natalie-dect-open-$natalieversion
rm -f natalie-dect-$profile-$natalieversion-$nataliecommith.tar.gz
cd "$curdir"
}
@@ -36,7 +44,7 @@ build_endptmngr_consumer() {
grep -q "CONFIG_TARGET_NO_VOICE=y" .config && return
endptversion=$(grep -w "PKG_VERSION:" ./feeds/iopsys/endptmngr/Makefile | cut -d'=' -f2)
endptcommith=$(grep -w "PKG_SOURCE_VERSION:" ./feeds/iopsys/endptmngr/Makefile | cut -d'=' -f2)
[ -n "$profile" ] && [ -n "$endptversion" ] && [ -n "$endptcommith" ] || return
[ -n "$profile" -a -n "$endptversion" -a -n "$endptcommith" ] || return
ssh $SERVER "test -f $FPATH/endptmngr-$profile-$endptversion-$endptcommith.tar.gz" && return
cd ./build_dir/target-*/endptmngr-$endptversion/
mkdir endptmngr-open-$endptversion
@@ -51,6 +59,52 @@ build_endptmngr_consumer() {
cd "$curdir"
}
build_wifilife_consumer() {
local ver commit
ver=$(grep -w "PKG_VERSION:" ./feeds/iopsys/wifilife/Makefile | cut -d'=' -f2)
commit=$(grep -w "PKG_SOURCE_VERSION:" ./feeds/iopsys/wifilife/Makefile | cut -d'=' -f2)
[ -n "$ver" -a -n "$commit" ] || return
ssh $SERVER "test -f $FPATH/wifilife-$target-${ver}_${commit}.tar.xz" && return
cd ./build_dir/target-*/wifilife-$ver/ipkg-* || cd ./build_dir/target-mips*musl-*/wifilife-$ver/ipkg-*
mkdir -p wifilife-$ver/src
cp -rf wifilife/usr/sbin/* wifilife-$ver/src/
tar Jcf wifilife-${target}-${ver}_${commit}.tar.xz wifilife-$ver
scp -pv wifilife-$target-${ver}_${commit}.tar.xz $SERVER:$FPATH/
cp wifilife-${target}-${ver}_${commit}.tar.xz $curdir/
rm -rf wifilife-$ver
rm -f wifilife-${target}-${ver}_${commit}.tar.xz
cd "$curdir"
}
build_mediatek_kernel() {
local mediatek_commit kernel_version kernel
mediatek_commit=$(grep CONFIG_KERNEL_GIT_COMMIT .config | cut -d '=' -f2 | tr -d '"')
kernel_version=$(grep KERNEL_PATCHVER target/linux/iopsys-ramips/Makefile | cut -d '=' -f2)
kernel=linux-${kernel_version}.*
[ -n "$mediatek_commit" ] || return
ssh $SERVER "test -f $FPATH/mediatek-kernel-open-$mediatek_commit.tar.gz" && return
echo "Building mediatek kernel tarball from kernel commit:"
echo $mediatek_commit
cd build_dir/target-mipsel_1004kc*/linux-iopsys-ramips*/$kernel
# Save Kconfig files to recreate the same kernel config,
# delete everyting else.
find drivers/net/wireless/mt_wifi -type f ! -name Kconfig | xargs rm
find drivers/net/wireless/rlt_wifi -type f ! -name Kconfig | xargs rm
# remove git repo
rm -rf .git
# patch kernel for openstk
ls consumer_release | while read line; do patch -p1 < consumer_release/$line; done
cd ..
tar -czv $kernel -f mediatek-kernel-open-$mediatek_commit.tar.gz
scp -pv mediatek-kernel-open-$mediatek_commit.tar.gz $SERVER:$FPATH/
cd "$curdir"
}
function print_usage {
echo "Usage: $0 generate_tarballs"
echo " -t <target>"
@@ -64,7 +118,8 @@ function generate_tarballs {
set -e
git remote -v | grep -q http && return # do not continue if this is an open SDK environment
board=$(grep CONFIG_TARGET_FAMILY .config | cut -d'=' -f2 | tr -d '"')
target=$(grep CONFIG_TARGET_BOARD .config | cut -d'=' -f2 | tr -d '"')
board=$(grep CONFIG_TARGET_IBOARDID .config | cut -d'=' -f2 | tr -d '"')
profile=$(grep CONFIG_BCM_KERNEL_PROFILE .config | cut -d'=' -f2 | tr -d '"')
majver=$(grep CONFIG_TARGET_VERSION .config | cut -d'=' -f2 | tr -d '"' | cut -f1 -d .)
minver=$(grep CONFIG_TARGET_VERSION .config | cut -d'=' -f2 | tr -d '"' | cut -f2 -d .)
@@ -88,14 +143,19 @@ function generate_tarballs {
esac
done
if [ -z "$stk_target" ]; then
if [ ! -n "$stk_target" ]; then
print_usage
exit 1
fi
if [ "$stk_target" == "broadcom" ]; then
build_bcmkernel_consumer
build_natalie_consumer
build_endptmngr_consumer
build_wifilife_consumer
elif [ "$stk_target" == "mediatek" ]; then
build_mediatek_kernel
build_wifilife_consumer
else
echo "Invalid target: $stk_target"
print_usage

View File

@@ -1,55 +1,18 @@
# this is a developer helper script to install the public ssh key in the created image
DROPBEAR_AUTHORIZED_KEYS_FILE=/etc/dropbear/authorized_keys
function get_ssh_public_keys {
(
shopt -s nullglob
# home directory, not all of those are supported by dropbear,
# but let's include them now already to decrease future maintenance
cat /dev/null ~/.ssh/{id_rsa,id_dsa,id_ecdsa,id_ecdsa_sk,id_ed25519,id_ed25519_sk,id_xmss}.pub 2> /dev/null
# keys added manually or automatically to the build dir
cat "files${DROPBEAR_AUTHORIZED_KEYS_FILE}" 2>/dev/null
# keys in the agent (useful when using SSH agent forwarding)
ssh-add -L 2> /dev/null
) | sort | uniq
}
function install_key {
local build_dir_dropbear_authorized_keys_file="files${DROPBEAR_AUTHORIZED_KEYS_FILE}"
mkdir -p "$(dirname "$build_dir_dropbear_authorized_keys_file")"
get_ssh_public_keys > "$build_dir_dropbear_authorized_keys_file"
chmod 0644 "$build_dir_dropbear_authorized_keys_file"
echo "Keys in "$build_dir_dropbear_authorized_keys_file" are now:"
cat "$build_dir_dropbear_authorized_keys_file"
echo
echo "Disabling login on serial console..."
mkdir -p files/etc/dropbear
test -e ~/.ssh/id_dsa.pub && cat ~/.ssh/id_dsa.pub >>files/etc/dropbear/authorized_keys
test -e ~/.ssh/id_rsa.pub && cat ~/.ssh/id_rsa.pub >>files/etc/dropbear/authorized_keys
chmod 0644 files/etc/dropbear/authorized_keys
echo "::sysinit:/etc/init.d/rcS S boot" >files/etc/inittab
echo "::shutdown:/etc/init.d/rcS K shutdown" >>files/etc/inittab
echo "console::askconsolelate:/bin/cttyhack /bin/ash --login" >>files/etc/inittab
echo "tty/0::askfirst:/bin/ash --login" >>files/etc/inittab
echo "console::askfirst:/bin/cttyhack /bin/ash --login" >>files/etc/inittab
echo Done
}
function ssh_install_key_help() {
echo Usage: $0 ssh_install_key HOSTNAME
echo
echo "Installs SSH public keys to a device's authorized_keys file"
}
# this is a developer helper script to install the public ssh key on host running dropbear
function ssh_install_key {
if [ $# -ne 1 ] || [ "$1" == '--help' ]; then
ssh_install_key_help
[ $# -eq 1 ]; return
fi
host="$1"
local keys="$(get_ssh_public_keys)"
echo "Adding the following keys to $DROPBEAR_AUTHORIZED_KEYS_FILE on $host:"
echo "$keys"
ssh root@$host "echo '$keys' >> '$DROPBEAR_AUTHORIZED_KEYS_FILE'" && echo ok
}
register_command "ssh_install_key" "Install the users public ssh key on host running dropbear"
register_command "install_key" "Install the user's public ssh key in the created image"

View File

@@ -230,7 +230,7 @@ function ssh_upgrade {
upd_fw_base=""
upd_fw=""
upd_host="192.168.1.1"
upd_sysupgrade=1
upd_sysupgrade=0
do_dialog=0
while getopts "f:hnxt:iscb" opt; do
@@ -280,14 +280,6 @@ function ssh_upgrade {
set_config_string CONFIG_TARGET_BOARD
firmwares=$(cd bin/targets/$CONFIG_TARGET_BOARD/generic/; ls -t *[0-9].y[3])
# if target uses pkgtb
if [ -z "$firmwares"]
then
# pkgtb files can not be streamed so copy over the file witch scp
use_scp=1
firmwares=$(cd bin/targets/$CONFIG_TARGET_BOARD/generic/; ls -t last.pkgtb)
fi
for upd_fw_base in $firmwares
do
#echo "firmware $upd_fw"
@@ -321,20 +313,10 @@ function ssh_upgrade {
[ $upd_forceboot -eq 1 ] && extra_args="$extra_args -b"
file_size_kb=`du -k "$upd_fw" | cut -f1`
if [ "$use_scp" == "1" ]
then
scp $upd_fw root@$upd_host:/tmp/ &&
ssh -o ConnectTimeout=60 root@$upd_host "iopu $extra_arg -f /tmp/$upd_fw_base"
else
cat $upd_fw | pv -s ${file_size_kb}k | ssh root@$upd_host "iopu $extra_args"
fi
cat $upd_fw | pv -s ${file_size_kb}k | ssh root@$upd_host "iopu $extra_args"
else
extra_args=""
[ $upd_noreboot -eq 1 ] && extra_args="$extra_args -d"
[ $upd_keepconf -eq 0 ] && extra_args="$extra_args -n"
scp $upd_fw root@$upd_host:/tmp/ &&
ssh -o ConnectTimeout=60 root@$upd_host "sysupgrade -v $extra_args /tmp/$upd_fw_base" &&
ssh -o ConnectTimeout=60 root@$upd_host "sysupgrade -v $3 /tmp/$upd_fw_base" &&
echo "sysupgrade done!"
fi
}

View File

@@ -0,0 +1,70 @@
# this is a developer helper script to SCP changed files to remote host
ROOT=build_dir/target-mips_uClibc-0.9.33.2/root-iopsys-brcm63xx-mips/
ROOT_OLD=tmp/root_old/
ROOT_TMP=tmp/root_tmp/
function scp_changes_reset {
{ cd `dirname $0`
rm -rf "$ROOT_OLD"
mkdir -p "$ROOT_OLD"
cp -a "$ROOT"* "$ROOT_OLD"
}
}
function scp_changes {
if [ -z "$1" ] ; then
echo "usage: $0 scp_changes <host/-r(eset)/-p(retend)>"
echo "Error: host required"
exit 1
fi
{ cd `dirname $0`
if [ ! -d $ROOT ]; then
echo "$ROOT does not exist"
echo "please build the project first"
exit 1;
fi
if [ "$1" = "-r" ]; then
echo "reset changes"
scp_changes_reset
exit 0
fi
if [ ! -d $ROOT_OLD ]; then
echo "$ROOT_OLD does not exist"
echo "you didn't store state of previous buildroot"
#echo "please run ./scp_changes_reset.sh"
echo "doing it now"
scp_changes_reset
exit 1;
fi
FILES=`diff -rq "$ROOT" "$ROOT_OLD" 2>&1 | sed -ne "s?^Files .* and $ROOT_OLD\\(.*\\) differ?\\1?p" -ne "s?^Only in $ROOT\\(.*\\): \\(.*\\)?\\1/\\2?p"`
if [ "$1" = "-p" ]; then
echo "files that would be copied:"
echo $FILES
exit 0
fi
for f in $FILES
do
mkdir -p "$ROOT_TMP`dirname $f`"
cp -af "$ROOT$f" "$ROOT_TMP$f"
done
if [ -d "$ROOT_TMP" ]; then
echo "scp changed files to $1"
pushd "$ROOT_TMP" 2>&1 >/dev/null
scp -r * root@$1:/
RETVAL=$?
popd 2>&1 >/dev/null
rm -rf "$ROOT_TMP"
if [ "$RETVAL" -eq 0 ]; then
scp_changes_reset
else
echo "scp error"
exit $RETVAL
fi
else
echo "no change"
fi
}
}
register_command "scp_changes" "<host/-r(eset)/-p(retend)> SCP only changed files to device"

17
iop/scripts/ssh_install_key.sh Executable file
View File

@@ -0,0 +1,17 @@
# this is a developer helper script to install the public ssh key on host running dropbear
function ssh_install_key {
if [ -e ~/.ssh/id_rsa.pub ]; then
echo "Adding public RSA key to $1"
KEY=`cat ~/.ssh/id_rsa.pub`
elif [ -e ~/.ssh/id_dsa.pub ]; then
echo "Adding public DSA key to $1"
KEY=`cat ~/.ssh/id_dsa.pub`
else
echo "No public key found"
exit 1
fi
ssh root@$1 "echo '$KEY' >> /etc/dropbear/authorized_keys" && echo ok
}
register_command "ssh_install_key" "Install the users public ssh key on host running dropbear"

View File

@@ -1,89 +0,0 @@
# Shorthand command for doing a HIL runtime smoketest on the
# latest built image. Does the image boot up correctly?
# More info here:
# https://dev.iopsys.eu/iopsys/iopsys-taas
#--------------------------------------------------------------
function taas-init() {
local f
# Path to TaaS binarys. Try some likely ones.
if ! which taas-smoketest >/dev/null; then
PATH="${PATH}:${PWD}/../iopsys-taas/bin"
PATH="${PATH}:${PWD}/../taas/bin"
PATH="${PATH}:${HOME}/iopsys-taas/bin"
PATH="${PATH}:${HOME}/taas/bin"
PATH="${PATH}:${HOME}/bin"
PATH="${PATH}:/opt/iopsys-taas/bin"
PATH="${PATH}:/opt/taas/bin"
fi
if ! which taas-smoketest >/dev/null; then
echo "Error; TaaS is missing! Install it with:"
echo "git clone git@dev.iopsys.eu:iopsys/iopsys-taas.git ../iopsys-taas"
exit 1
fi
# Create a list of all images which might be of use.
for f in ${PWD}/bin/targets/iopsys-*/generic/last.*; do
[[ -s "$f" ]] && images+=("$f")
done
# Convert Iopsys target name to the TaaS product name format
# according to what is available in the remote lab for HIL.
# Also find a suitable image.
product=$(grep CONFIG_TARGET_PROFILE .config | \
tr -s "=\"" " " | cut -d " " -f 2) || exit
case "$product" in
smarthub3)
export product="SmartHub3a"
;;
dg400prime|eg400|ex600)
export product=$(echo -n "$product" | tr [[:lower:]] [[:upper:]])
;;
*)
echo "Unsupported target; skipping!"
exit 0
;;
esac
if [[ ${#images[@]} -eq 0 ]]; then
echo "No image found"
exit 1
fi
}
#--------------------------------------------------------------
function taas-smoketest {
declare -a images
taas-init || return
echo "Testing a $product with ${images[@]}..."
command taas-smoketest "${images[@]}" "$product" "$@"
}
#--------------------------------------------------------------
function taas-bootstrap {
declare -a images
if [[ -n "$1" ]]; then
taas-init || return
echo "Flashing $1..."
command taas-bootstrap "${images[@]}" "$@"
else
echo "Usage: ./iop taas-bootstrap dutX"
exit 1
fi
}
register_command "taas-bootstrap" "Write image to a remote lab device."
register_command "taas-smoketest" "Write image to a remote lab device and test it."

View File

@@ -492,8 +492,7 @@ check_feeds()
echo "Now checking if any changes have been done to the feeds."
echo -e "${Green}_______________________________________________________________________________${Color_Off}"
feeds="$1"
[ -n "$feeds" ] || feeds=$(grep -v "^#" feeds.conf| awk '{print $2}')
feeds=$(grep -v "^#" feeds.conf| awk '{print $2}')
for feed in `echo $feeds`
do
feed_hash=$(feeds_hash $feed)
@@ -553,7 +552,7 @@ check_feeds()
done
}
is_local_and_remote_same()
feeds_at_top()
{
git remote update 2>/dev/null 1>/dev/null
LOCAL=$(git rev-parse @)
@@ -582,7 +581,7 @@ is_local_and_remote_same()
usage(){
echo -e "$0 [flags]"
echo -e "flags:"
echo -e " -f\tFeed to update"
echo -e " -v\tVerbose mode"
echo -e " -h\tShow this help"
echo -e " -u\tUpdate package version\n"
}
@@ -590,7 +589,7 @@ usage(){
# Exported interface
function update_package {
UPDATE=0
UPDATE=0
Color_Off='\033[0m' # Text Reset
@@ -604,18 +603,18 @@ function update_package {
Cyan='\033[0;36m' # Cyan
White='\033[0;37m' # White
while getopts "f:hu" opt; do
while getopts "v:hu" opt; do
case $opt in
f)
feed=$OPTARG
v)
verbose=$OPTARG
;;
h)
usage
exit 1
;;
u)
UPDATE=1
;;
usage
exit 1
;;
u)
UPDATE=1
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
@@ -638,9 +637,9 @@ function update_package {
set -E
trap '[ "$?" -ne 99 ] || exit 99' ERR
is_local_and_remote_same
[ -n "$feed" ] || check_packages
check_feeds $feed
feeds_at_top
check_packages
check_feeds
}
register_command "update_package" "Publish changes to packages and feeds"

58
iopupgrade/Makefile Normal file
View File

@@ -0,0 +1,58 @@
#
# Copyright (C) 2019 iopsys
#
# 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:=iopupgrade
PKG_VERSION:=1.0.0
PKG_RELEASE:=1
PKG_SOURCE_VERSION:=01f2afd6c831d6f9eb2940c7e7af16f7e4d439c2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/iopupgrade
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_LICENSE:=GPLv2
PKG_LICENSE_FILES:=LICENSE
# support parallel build
PKG_BUILD_PARALLEL:=1
#re create configure scripts if not present.
PKG_FIXUP:=autoreconf
# run install target when cross compiling. basically, make install DESTDIR=$(PKG_INSTALL_DIR)
# this way we don't need to pick out the resulting files from the build dir.
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/iopupgrade
CATEGORY:=Utilities
TITLE:=Iopsys system upgrade utility
URL:=
# DEPENDS:=
endef
define Package/iopupgrade/description
Application handling peripheral
endef
define Package/iopupgrade/install
$(CP) ./files/* $(1)/
$(INSTALL_DIR) $(1)/etc/
$(INSTALL_DIR) $(1)/etc/init.d/
$(INSTALL_DIR) $(1)/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/iopupgrade $(1)/sbin/
endef
$(eval $(call BuildPackage,iopupgrade))

278
iopupgrade/files/sbin/iopu Executable file
View File

@@ -0,0 +1,278 @@
#!/bin/sh
###############################################################################
# Global variables. can be used directly in any function called.
cur_vol="" # num,[0/1] Number used for ubifs root filesystem volume name.
# eg: rootfs_0 or rootfs_1, currently used
upd_vol="" # num,[0/1] Number used for ubifs root filesystem volume name.
# eg: rootfs_0 or rootfs_1, the one we want to update
cmdline="" # command line settings.
cmdline_match="" # Headers to match to the image
###############################################################################
# file local variables. should not be used in imported functions. Can be used
# by functions declared in this script
chroot_cmdline="" # command line for the iop_chroot command.
board="" # string, Board name that is going to be matched
# against header of firmware image
upd_ubi_id="" # num, UBI volume number for the volume name
# "rootfs_$upd_vol", use to know what volume to run
# ubiupdatevol on.
run_cleanup=0 # if set the cleanup should be run otherwise we skip it.
run_mount_cleanup=0 # set if we should run umount in cleanup
upd_kernel=0 # set to 1 if system has the kernel in own mtd partition
log_stdout=1 # set to 0 to prevent the log to also print to stdout
upd_noreboot=0 # set to 1 if we should not reboot after programming
upd_forceimage=0 # set this to force upgrade even if image is for wrong board.
upd_forceboot=0 # set this to force upgrade of boot loader
###############################################################################
# import external functions
source /lib/upgrade/iopsys.sh
[ -f /lib/upgrade/iopupgrade ] && source /lib/upgrade/iopupgrade
# only call function if it exists
function_call() {
if type "$1" 2>/dev/null >/dev/null
then
$1 $@
fi
}
###############################################################################
# Cleanup and error handling functions.
function log {
TIME=$(date)
[ $log_stdout -eq 1 ] && echo "$@"
echo "[$TIME] $@" >>/tmp/upd_log
}
# we need to handle ctrl-c, segmentation fault, sigpipe and other abnormal
# terminations. no printing to stdout/stderr allowed in this function or
# anyhting it calls as stdout/stderr might no longer exist
function finish {
if [ "$run_cleanup" == "1" ]
then
function_call upd_cleanup
log ""
fi
if [ "$run_mount_cleanup" == "1" ]
then
log "Cleaning up after mount"
umount_newroot
fi
# always kill the timeout process, will leave the sleep but that is harmless
# as long as the kill will nerver be run.
kill $TIMEOUT_PID 2>/dev/null
lock -u /tmp/iopu.lock
}
function sig_pipe {
log_stdout=0 # stdin,stdout,stderr do not exist anymore
log "Got sigpipe. Turning of log printing to stdout"
}
# if a timout happens terminate
function timeout {
finish
exit 1
}
# Not much that can be done if the mount fails but to try again.
# if after 10 seconds there still is errors abort program.
# UBIFS has some wierd time intervall after ubiupdatevol where
# a mount of the newly written data results in a busy error.
function mount_retry {
local tries=0
while [ $tries -lt 10 ]
do
if mount $@ 2>/dev/null
then
return
fi
tries=$((tries + 1))
sleep 1
done
log "mount failed for command [mount $@] so upgrade failed."
exit 1
}
function mount_newroot {
run_mount_cleanup=1
mkdir -p /tmp/newroot
mkdir -p /tmp/newroot_overlay
mount_retry -t ubifs ubi0:rootfs_$upd_vol /tmp/newroot
mount_retry -o noatime,lowerdir=/tmp/newroot,upperdir=/tmp/newroot/overlay,workdir=/tmp/newroot/lib/overlay.tmp -t overlay "overlayfs:/tmp/newroot/overlay" /tmp/newroot_overlay
mount_retry --bind /tmp/newroot/ /tmp/newroot_overlay/rom
mount_retry --bind /dev /tmp/newroot_overlay/dev
mount_retry --bind /proc /tmp/newroot_overlay/proc
mount_retry --bind /sys /tmp/newroot_overlay/sys
mount_retry -t tmpfs -o noatime,mode=0755 root /tmp/newroot_overlay/tmp
mkdir -p /tmp/newroot_overlay/tmp/oldroot
mount_retry --bind / /tmp/newroot_overlay/tmp/oldroot
mount_retry --bind /tmp /tmp/newroot_overlay/tmp/oldroot/tmp
}
function umount_newroot {
umount /tmp/newroot_overlay/tmp/oldroot/tmp
umount /tmp/newroot_overlay/tmp/oldroot
umount /tmp/newroot_overlay/tmp
umount /tmp/newroot_overlay/sys
umount /tmp/newroot_overlay/proc
umount /tmp/newroot_overlay/dev
umount /tmp/newroot_overlay/rom
umount /tmp/newroot_overlay
umount /tmp/newroot
run_mount_cleanup=0
}
function usage {
echo "usage: $0 iopu [opts] "
echo ""
echo "opts:"
echo ""
echo " -n Do not do the final reboot of the target board"
echo " -c Keep configuration"
echo " -x Force install even if firmware is not for this board"
echo " -b Force install of bootloader regardless of version installed"
echo " -r Jump into chroot env of other system"
}
###############################################################################
# just one instance
# this check has to be done before we install handler to avoid removing the
# lock even if it was not available.
if ! lock -n /tmp/iopu.lock
then
echo "Another instance of iopu already running"
echo "If you are sure this is wrong remove file /tmp/iopu.lock"
exit 1
fi
trap finish EXIT
trap timeout SIGALRM
trap sig_pipe SIGPIPE
while getopts "nrxbh" opt; do
case $opt in
n)
upd_noreboot=1
;;
x)
upd_forceimage=1
;;
b)
upd_forceboot=1
;;
r)
upd_vol=$(get_flashbank_next)
mount_newroot
(ENV=/sbin/iopu_chroot_env chroot /tmp/newroot_overlay /bin/sh)
echo ""
umount_newroot
exit 0
;;
h)
usage
exit 1
;;
esac
done
# put a timeout on this if it takes longer than 120 seconds we should abort
# and clean up
(
sleep 120 # if 2 minutes pass
kill -ALRM $$ 2>/dev/null # send it a SIGALRM signal
)&
TIMEOUT_PID=$!
log "Firmware upgrade started"
# Should board name be checked
if [ $upd_forceimage -eq 0 ]
then
board=$(db get hw.board.iopVerBoard)
cmdline_match="board=$board"
fi
# find out what rootfs volume is active.
cur_vol=$(get_flashbank_current)
upd_vol=$(get_flashbank_next)
# convert volume name "rootfs_$upd_vol" into ubifs volume id
upd_ubi_id=$(ubinfo -d 0 -N rootfs_$upd_vol | awk "/Volume ID:/ {print \$3}")
log "installing Root Fileystem into UBI volume rootfs_$upd_vol"
# prepare to match dsl.
function_call upd_conf_dsl
# prepare to update CFE if it exists
function_call upd_conf_cfe
# prepare to update kernel if it is stored in MTD/JFFS2
function_call upd_conf_kernel
log "now starting writing data to flash with [ iopupgrade $cmdline -M "$cmdline_match" -u ubi0_$upd_ubi_id ]"
run_cleanup=1 # When we start to actually write data there might be some
# things that need cleanup if we get an error/crash
iopupgrade $cmdline -M "$cmdline_match" -u ubi0_$upd_ubi_id
# in case of any error we abort
if [ $? -ne 0 ]; then
log "iopupgrade program Failed"
exit 1
fi
log "Firmware programmed to flash."
log "Transfering configuration to new system."
# Force upgrade of boot loader
[ $upd_forceboot -eq 1 ] && chroot_cmdline="$chroot_cmdline -b"
mount_newroot
chroot /tmp/newroot_overlay /sbin/iopu_chroot $chroot_cmdline
umount_newroot
log "Update fully installed."
run_cleanup=0
# Now make sure that we actually boot the new system on the next reboot
upd_finnish
# spawn the reboot to a subshell to allow the main program to quit before reset
# to avoid any hanged network connection like ssh
if [ $upd_noreboot -eq 0 ]
then
(
log_stdout=0 # stdin,stdout,stderr do not exist anymore, we are in a
# subshell and then the trap is no longer working.
sleep 1
log "Rebooting NOW!!!"
log ""
reboot
)&
log "Reboot initiated"
else
log "Skipping reboot"
fi

View File

@@ -0,0 +1,61 @@
#!/bin/sh
#
# This program is intended to be run in a chroot environment where the old system
# is mounted in /tmp/oldroot
#
###############################################################################
# Global variables. can be used directly in any function called.
###############################################################################
# file local variables. should not be used in imported functions. Can be used
# by functions declared in this script
upd_forceboot=0
log_stdout=1 # set to 0 to prevent the log to also print to stdout
###############################################################################
# import external functions
source /lib/upgrade/iopsys.sh
[ -f /lib/upgrade/iopupgrade ] && source /lib/upgrade/iopupgrade
# only call function if it exists
function_call() {
if type "$1" 2>/dev/null >/dev/null
then
$1 $@
fi
}
# Cleanup and error handling functions.
function log {
TIME=$(date)
[ $log_stdout -eq 1 ] && echo "$@"
echo "[$TIME] $@" >>/root/upd_log
}
while getopts "hb" opt; do
case $opt in
h)
upd_usage
exit 1
;;
b)
upd_forceboot=1
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
esac
done
# copy old install log over
cp /tmp/oldroot/tmp/upd_log /root/upd_log
# Upgrade boot loader if needed.
function_call upd_program_boot

View File

@@ -0,0 +1,18 @@
#!/bin/sh
# this is run when "iopr -r" is executed.
# intended to just show what environment is actually started.
cat /etc/banner
echo "/tmp/oldroot:"
echo " Contains the running root filesystem. It is live so files are in use"
echo " Anything copying/reading files from there needs to make sure it is done safely."
echo ""
Color_Off='\033[0m' # Text Reset
Red='\033[0;31m' # Red
PS1="${Red}chroot_new${Color_Off}:\w\#"
export PS1
export Red
export Color_Off

36
iup/Makefile Normal file
View File

@@ -0,0 +1,36 @@
#
# Copyright (C) 2006-2011 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=iup
PKG_VERSION:=0.0.1
PKG_RELEASE:=0
include $(INCLUDE_DIR)/package.mk
define Package/iup
SECTION:=net
CATEGORY:=Network
TITLE:=iup client
DEPENDS:=+libuci +uci +busybox
endef
define Package/iup/description
This package contains Inteno's IUP Client
endef
define Build/Compile
true
endef
define Package/iup/install
$(INSTALL_DIR) $(1)/sbin
cp -r ./files/* $(1)/
endef
$(eval $(call BuildPackage,iup))

Some files were not shown because too many files have changed in this diff Show More