diff --git a/config-rutx b/config-rutx index b2907bc2..b881ed1e 100644 --- a/config-rutx +++ b/config-rutx @@ -15,4 +15,3 @@ CONFIG_TARGET_SQUASHFS_BLOCK_SIZE=64 CONFIG_KERNEL_SWAP=y CONFIG_PREINITOPT=y CONFIG_PACKAGE_kmod-r2ec=y -CONFIG_PACKAGE_mnfinfo=y diff --git a/root/package/utils/mnfinfo/Makefile b/root/package/utils/mnfinfo/Makefile deleted file mode 100644 index e5e300d3..00000000 --- a/root/package/utils/mnfinfo/Makefile +++ /dev/null @@ -1,58 +0,0 @@ -# -# Copyright (C) 2020 Teltonika -# - -include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/download.mk - -PKG_NAME:=mnfinfo -PKG_VERSION:=1 - -PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) - -include $(INCLUDE_DIR)/package.mk - -define Package/mnfinfo - SECTION:=net - CATEGORY:=Network - TITLE:=Device mnf-info command line interface - DEPENDS:=+libpthread +libmnfinfo -endef - -define Package/libmnfinfo - SECTION:=libs - CATEGORY:=Libraries - TITLE:=Device mnf-info API library -endef - -define Package/rpcd-mod-mnfinfo - SECTION:=libs - CATEGORY:=Libraries - TITLE:=mnfinfo rpcd module - DEPENDS:=+rpcd +libmnfinfo -endef - -define Build/InstallDev - $(INSTALL_DIR) $(STAGING_DIR)/usr/lib $(STAGING_DIR)/usr/include/libmnfinfo - $(CP) $(PKG_BUILD_DIR)/*.so $(STAGING_DIR)/usr/lib/ - $(CP) $(PKG_BUILD_DIR)/src/include/*.h $(STAGING_DIR)/usr/include/libmnfinfo/ -endef - -define Package/mnfinfo/install - $(INSTALL_DIR) $(1)/sbin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/mnf_info $(1)/sbin/mnf_info -endef - -define Package/libmnfinfo/install - $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_BUILD_DIR)/libmnfinfo.so $(1)/usr/lib/ -endef - -define Package/rpcd-mod-mnfinfo/install - $(INSTALL_DIR) $(1)/usr/lib/rpcd - $(INSTALL_BIN) $(PKG_BUILD_DIR)/mnfinfo.so $(1)/usr/lib/rpcd/ -endef - -$(eval $(call BuildPackage,mnfinfo)) -$(eval $(call BuildPackage,libmnfinfo)) -$(eval $(call BuildPackage,rpcd-mod-mnfinfo)) diff --git a/root/package/utils/mnfinfo/src/Makefile b/root/package/utils/mnfinfo/src/Makefile deleted file mode 100644 index ec79416d..00000000 --- a/root/package/utils/mnfinfo/src/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -MNF_SOURCES = src/mnf_info.c -MNF_OBJS = $(MNF_SOURCES:.c=.o) -MNF_TARGET = mnf_info - -MNF_RPC_SOURCES = src/mnf_rpc.c -MNF_RPC_OBJS = $(MNF_RPC_SOURCES:.c=.o) -MNF_RPC_TARGET = mnfinfo.so - -LIB_SOURCES = src/libmnfinfo.c -LIB_OBJS = $(LIB_SOURCES:.c=.o) -LIB_TARGET = libmnfinfo.so - -CFLAGS += -Wall -Wextra -Wpedantic -Werror -Wno-missing-braces -Wno-unused-function -Wno-unused-parameter -fPIC -I src/include -LDFLAGS += -L. - -MNF_LDFLAGS = -MNF_RPC_LDFLAGS = -lmnfinfo - -RM = rm -f - -all: $(LIB_TARGET) $(MNF_RPC_TARGET) $(MNF_TARGET) - -$(LIB_TARGET): $(LIB_OBJS) - $(CC) $(LDFLAGS) -shared -o $@ $^ - -$(MNF_RPC_TARGET): $(MNF_RPC_OBJS) $(LIB_TARGET) - $(CC) $(LDFLAGS) $(MNF_RPC_LDFLAGS) -shared -o $@ $^ - -$(MNF_TARGET): $(MNF_OBJS) $(LIB_OBJS) - $(CC) $(LDFLAGS) $(MNF_LDFLAGS) -o $@ $^ - -clean: - $(RM) $(LIB_OBJS) $(LIB_TARGET) - $(RM) $(MNF_RPC_OBJS) $(MNF_RPC_TARGET) - $(RM) $(MNF_OBJS) $(MNF_TARGET) diff --git a/root/package/utils/mnfinfo/src/README.md b/root/package/utils/mnfinfo/src/README.md deleted file mode 100644 index af13c115..00000000 --- a/root/package/utils/mnfinfo/src/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# libmnfinfo - -How it works: depending on the platform, selected in the menuconfig, a different platform flag is defined during compilation. Depending on that flag, a header file with platform-specific MTD field defines is included. Here are all the defines, (currently) used for these headers: - -* `MAX_SIM_ID` - maximum allowed SIM index on the platform. -* `MTD_CONFIG_RO` - absolute path of a read-only MTD partition. Used for most field reads. -* `MTD_CONFIG_RW` - absolute path of a read/write MTD partition. Used for SIM PIN value reads/writes. -* `MAC_OFFSET` - MAC field offset in the `MTD_CONFIG_RO` partition. -* `MAC_LENGTH` - MAC field length in the `MTD_CONFIG_RO` partition. -* `NAME_OFFSET` - product name field offset in the `MTD_CONFIG_RO` partition. -* `NAME_LENGTH` - product name field length in the `MTD_CONFIG_RO` partition. -* `WPS_OFFSET` - WPS field offset in the `MTD_CONFIG_RO` partition. -* `WPS_LENGTH` - WPS field length in the `MTD_CONFIG_RO` partition. -* `SERIAL_OFFSET` - product serial code field offset in the `MTD_CONFIG_RO` partition. -* `SERIAL_LENGTH` - product serial code field length in the `MTD_CONFIG_RO` partition. -* `BATCH_OFFSET` - batch index field offset in the `MTD_CONFIG_RO` partition. -* `BATCH_LENGTH` - batch index field length in the `MTD_CONFIG_RO` partition. -* `HWVER_OFFSET` - hardware version index field offset in the `MTD_CONFIG_RO` partition. -* `HWVER_LENGTH` - hardware version index field length in the `MTD_CONFIG_RO` partition. -* `SIMPIN_OFFSET` - SIM card PIN code field offset in the `MTD_CONFIG_RW` partition. -* `SIMPIN_LENGTH` - SIM card PIN code field length in the `MTD_CONFIG_RW` partition. -* `WIFI_OFFSET` - Wi-Fi password field offset in the `MTD_CONFIG_RO` partition. -* `WIFI_LENGTH` - Wi-Fi password field length in the `MTD_CONFIG_RO` partition. - -Only defines with actual values should be written. All other defines should be removed from the platform-specific header file. diff --git a/root/package/utils/mnfinfo/src/libmnfinfo.so b/root/package/utils/mnfinfo/src/libmnfinfo.so deleted file mode 100755 index 8e7ab9af..00000000 Binary files a/root/package/utils/mnfinfo/src/libmnfinfo.so and /dev/null differ diff --git a/root/package/utils/mnfinfo/src/mnf_info b/root/package/utils/mnfinfo/src/mnf_info deleted file mode 100755 index 2daa9cf5..00000000 Binary files a/root/package/utils/mnfinfo/src/mnf_info and /dev/null differ diff --git a/root/package/utils/mnfinfo/src/mnfinfo.so b/root/package/utils/mnfinfo/src/mnfinfo.so deleted file mode 100755 index 176d5fe8..00000000 Binary files a/root/package/utils/mnfinfo/src/mnfinfo.so and /dev/null differ diff --git a/root/package/utils/mnfinfo/src/src/include/mnfinfo.h b/root/package/utils/mnfinfo/src/src/include/mnfinfo.h deleted file mode 100644 index ad2700bd..00000000 --- a/root/package/utils/mnfinfo/src/src/include/mnfinfo.h +++ /dev/null @@ -1,115 +0,0 @@ -#include -#include - -#define STRING_NA(a) do { (a)[0] = 'N'; (a)[1] = '/'; (a)[2] = 'A'; (a)[3] = 0; } while(0) -#define STRING_NA_LENGTH 3 - -#define PARTITION_SIZE 0xA0 -#define SECTION_SIZE 0x10 - -#if defined(RUTX_PLATFORM) -#include "rutx.h" -#elif defined(TRB1_PLATFORM) -#include "trb1.h" -#elif defined(TRB2_PLATFORM) -#include "trb2.h" -#elif defined(RUT2_PLATFORM) -#include "rut2.h" -#elif defined(RUT300_PLATFORM) || defined(RUT360_PLATFORM) -#include "rut3.h" -#else -#error Platform not recognized! -#endif - -#if !(defined(MAC_OFFSET) && defined(MAC_LENGTH)) -#undef MAC_OFFSET -#undef MAC_LENGTH -#define MAC_OFFSET 0 -#define MAC_LENGTH STRING_NA_LENGTH -#else -#define MAC_ENABLED -#endif - -#if !(defined(NAME_OFFSET) && defined(NAME_LENGTH)) -#undef NAME_OFFSET -#undef NAME_LENGTH -#define NAME_OFFSET 0 -#define NAME_LENGTH STRING_NA_LENGTH -#else -#define NAME_ENABLED -#endif - -#if !(defined(WPS_OFFSET) && defined(WPS_LENGTH)) -#undef WPS_OFFSET -#undef WPS_LENGTH -#define WPS_OFFSET 0 -#define WPS_LENGTH STRING_NA_LENGTH -#else -#define WPS_ENABLED -#endif - -#if !(defined(SERIAL_OFFSET) && defined(SERIAL_LENGTH)) -#undef SERIAL_OFFSET -#undef SERIAL_LENGTH -#define SERIAL_OFFSET 0 -#define SERIAL_LENGTH STRING_NA_LENGTH -#else -#define SERIAL_ENABLED -#endif - -#if !(defined(BATCH_OFFSET) && defined(BATCH_LENGTH)) -#undef BATCH_OFFSET -#undef BATCH_LENGTH -#define BATCH_OFFSET 0 -#define BATCH_LENGTH STRING_NA_LENGTH -#else -#define BATCH_ENABLED -#endif - -#if !(defined(HWVER_OFFSET) && defined(HWVER_LENGTH)) -#undef HWVER_OFFSET -#undef HWVER_LENGTH -#define HWVER_OFFSET 0 -#define HWVER_LENGTH STRING_NA_LENGTH -#else -#define HWVER_ENABLED -#endif - -#if !(defined(SIMPIN_OFFSET) && defined(SIMPIN_LENGTH)) -#undef SIMPIN_OFFSET -#undef SIMPIN_LENGTH -#define SIMPIN_OFFSET 0 -#define SIMPIN_LENGTH STRING_NA_LENGTH -#else -#define SIMPIN_ENABLED -#endif - -#if !(defined(WIFI_OFFSET) && defined(WIFI_LENGTH)) -#undef WIFI_OFFSET -#undef WIFI_LENGTH -#define WIFI_OFFSET 0 -#define WIFI_LENGTH STRING_NA_LENGTH -#else -#define WIFI_ENABLED -#endif - -/* - * mnfinfo_get_*() functions return ptr to static memory, which is not to be free()d! - * the returned memory ptr is safely accessible throughout the using program's runtime - * bad: free(mnfinfo_get_mac()); - * - * returns NULL on /dev/mtdX reading failure, "N/A" if the particular device - * doesn't support the field, or a dummy string if the mtdblock space contains garbage -*/ -char* mnfinfo_get_mac(void); -char* mnfinfo_get_name(void); -char* mnfinfo_get_maceth(void); -char* mnfinfo_get_sn(void); -char* mnfinfo_get_hwver(void); -char* mnfinfo_get_batch(void); -char* mnfinfo_get_wps(void); -char* mnfinfo_get_wifi_pw(void); -char* mnfinfo_get_sim_pin(uint8_t sim_id); - -// returns true on success -bool mnfinfo_set_sim_pin(uint8_t sim_id, const char *pin); diff --git a/root/package/utils/mnfinfo/src/src/include/rut2.h b/root/package/utils/mnfinfo/src/src/include/rut2.h deleted file mode 100644 index b4a12414..00000000 --- a/root/package/utils/mnfinfo/src/src/include/rut2.h +++ /dev/null @@ -1,21 +0,0 @@ -#define MAX_SIM_ID 1 - -#define MTD_CONFIG_RO "/dev/mtd1" -#define MTD_CONFIG_RW "/dev/mtd1" - -#define MAC_OFFSET 0x00 -#define MAC_LENGTH 6 -#define NAME_OFFSET 0x10 -#define NAME_LENGTH 12 -#define WPS_OFFSET 0x20 -#define WPS_LENGTH 8 -#define SERIAL_OFFSET 0x30 -#define SERIAL_LENGTH 10 -#define BATCH_OFFSET 0x40 -#define BATCH_LENGTH 4 -#define HWVER_OFFSET 0x50 -#define HWVER_LENGTH 4 -#define SIMPIN_OFFSET 0x70 -#define SIMPIN_LENGTH 4 -#define WIFI_OFFSET 0x90 -#define WIFI_LENGTH 16 diff --git a/root/package/utils/mnfinfo/src/src/include/rut3.h b/root/package/utils/mnfinfo/src/src/include/rut3.h deleted file mode 100644 index b4a12414..00000000 --- a/root/package/utils/mnfinfo/src/src/include/rut3.h +++ /dev/null @@ -1,21 +0,0 @@ -#define MAX_SIM_ID 1 - -#define MTD_CONFIG_RO "/dev/mtd1" -#define MTD_CONFIG_RW "/dev/mtd1" - -#define MAC_OFFSET 0x00 -#define MAC_LENGTH 6 -#define NAME_OFFSET 0x10 -#define NAME_LENGTH 12 -#define WPS_OFFSET 0x20 -#define WPS_LENGTH 8 -#define SERIAL_OFFSET 0x30 -#define SERIAL_LENGTH 10 -#define BATCH_OFFSET 0x40 -#define BATCH_LENGTH 4 -#define HWVER_OFFSET 0x50 -#define HWVER_LENGTH 4 -#define SIMPIN_OFFSET 0x70 -#define SIMPIN_LENGTH 4 -#define WIFI_OFFSET 0x90 -#define WIFI_LENGTH 16 diff --git a/root/package/utils/mnfinfo/src/src/include/rutx.h b/root/package/utils/mnfinfo/src/src/include/rutx.h deleted file mode 100644 index 4976a3b6..00000000 --- a/root/package/utils/mnfinfo/src/src/include/rutx.h +++ /dev/null @@ -1,21 +0,0 @@ -#define MAX_SIM_ID 4 - -#define MTD_CONFIG_RO "/dev/mtd13" -#define MTD_CONFIG_RW "/dev/mtd14" - -#define MAC_OFFSET 0x00 -#define MAC_LENGTH 6 -#define NAME_OFFSET 0x10 -#define NAME_LENGTH 12 -#define WPS_OFFSET 0x20 -#define WPS_LENGTH 8 -#define SERIAL_OFFSET 0x30 -#define SERIAL_LENGTH 10 -#define BATCH_OFFSET 0x40 -#define BATCH_LENGTH 4 -#define HWVER_OFFSET 0x50 -#define HWVER_LENGTH 4 -#define SIMPIN_OFFSET 0x00 -#define SIMPIN_LENGTH 4 -#define WIFI_OFFSET 0x90 -#define WIFI_LENGTH 16 diff --git a/root/package/utils/mnfinfo/src/src/include/trb1.h b/root/package/utils/mnfinfo/src/src/include/trb1.h deleted file mode 100644 index 6003e6bb..00000000 --- a/root/package/utils/mnfinfo/src/src/include/trb1.h +++ /dev/null @@ -1,17 +0,0 @@ -#define MAX_SIM_ID 1 - -#define MTD_CONFIG_RO "/dev/mtd7" -#define MTD_CONFIG_RW "/dev/mtd7" - -#define MAC_OFFSET 0x50 -#define MAC_LENGTH 12 -#define NAME_OFFSET 0x20 -#define NAME_LENGTH 12 -#define SERIAL_OFFSET 0x10 -#define SERIAL_LENGTH 10 -#define BATCH_OFFSET 0x40 -#define BATCH_LENGTH 3 -#define HWVER_OFFSET 0x30 -#define HWVER_LENGTH 4 -#define SIMPIN_LENGTH 4 -#define SIMPIN_OFFSET 0x70 diff --git a/root/package/utils/mnfinfo/src/src/include/trb2.h b/root/package/utils/mnfinfo/src/src/include/trb2.h deleted file mode 100644 index bbb281f9..00000000 --- a/root/package/utils/mnfinfo/src/src/include/trb2.h +++ /dev/null @@ -1,21 +0,0 @@ -#define MAX_SIM_ID 2 - -#define MTD_CONFIG_RO "/dev/mtd1" -#define MTD_CONFIG_RW "/dev/mtd1" - -#define MAC_OFFSET 0x00 -#define MAC_LENGTH 6 -#define NAME_OFFSET 0x10 -#define NAME_LENGTH 12 -#define WPS_OFFSET 0x20 -#define WPS_LENGTH 8 -#define SERIAL_OFFSET 0x30 -#define SERIAL_LENGTH 10 -#define BATCH_OFFSET 0x40 -#define BATCH_LENGTH 4 -#define HWVER_OFFSET 0x50 -#define HWVER_LENGTH 4 -#define SIMPIN_OFFSET 0x70 -#define SIMPIN_LENGTH 4 -#define WIFI_OFFSET 0x90 -#define WIFI_LENGTH 16 diff --git a/root/package/utils/mnfinfo/src/src/libmnfinfo.o b/root/package/utils/mnfinfo/src/src/libmnfinfo.o deleted file mode 100644 index 7ead455f..00000000 Binary files a/root/package/utils/mnfinfo/src/src/libmnfinfo.o and /dev/null differ diff --git a/root/package/utils/mnfinfo/src/src/mnf_info.o b/root/package/utils/mnfinfo/src/src/mnf_info.o deleted file mode 100644 index c782f073..00000000 Binary files a/root/package/utils/mnfinfo/src/src/mnf_info.o and /dev/null differ diff --git a/root/package/utils/mnfinfo/src/src/mnf_rpc.o b/root/package/utils/mnfinfo/src/src/mnf_rpc.o deleted file mode 100644 index b57d1001..00000000 Binary files a/root/package/utils/mnfinfo/src/src/mnf_rpc.o and /dev/null differ diff --git a/root/target/linux/ipq40xx/base-files/bin/board_track b/root/target/linux/ipq40xx/base-files/bin/board_track deleted file mode 100755 index 3f620e73..00000000 --- a/root/target/linux/ipq40xx/base-files/bin/board_track +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh - -. /lib/functions/uci-defaults.sh - -CFG=/etc/board.json -SLP=30 - -check_modem() { - json_select "$2" - json_get_vars id - - [ -z "$id" ] && { - json_select .. - return 0 - } - - ttys=$(ls -d /sys/bus/usb/devices/$id/${id}*/tty?*) - - [ -n "$ttys" ] || { #FAILED TO FIND MODEM - mctl -s - sleep 1 - mctl -p - json_select .. - return 1 - } - - #MODEM UP - json_select .. -} - -board_config_update -while true; do - json_for_each_item check_modem modems - sleep $SLP - [ $SLP -lt 300 ] && SLP=$((SLP+30)) -done diff --git a/root/target/linux/ipq40xx/base-files/bin/config_generate b/root/target/linux/ipq40xx/base-files/bin/config_generate index 09801874..b2542b14 100755 --- a/root/target/linux/ipq40xx/base-files/bin/config_generate +++ b/root/target/linux/ipq40xx/base-files/bin/config_generate @@ -135,15 +135,15 @@ generate_network() { uci set network.$1.proto='dhcp' uci set network.$1.metric='1' - [ -e /proc/sys/net/ipv6 ] && { - uci -q batch <<-EOF - delete network.${1}6 - set network.${1}6='interface' - set network.${1}6.ifname='$ifname' - set network.${1}6.proto='dhcpv6' - set network.${1}6.metric='1' - EOF - } + #[ -e /proc/sys/net/ipv6 ] && { + # uci -q batch <<-EOF + # delete network.${1}6 + # set network.${1}6='interface' + # set network.${1}6.device='$ifname' + # set network.${1}6.proto='dhcpv6' + # set network.${1}6.metric='1' + # EOF + #} ;; pppoe) diff --git a/root/target/linux/ipq40xx/base-files/bin/ipk-sig.sh b/root/target/linux/ipq40xx/base-files/bin/ipk-sig.sh deleted file mode 100755 index 016f5f56..00000000 --- a/root/target/linux/ipq40xx/base-files/bin/ipk-sig.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -sig="/tmp/.$(cat /proc/sys/kernel/random/uuid).sig" - -check() { - local ipk="$1" - [ -z "$ipk" ] && return 1 - - tar -xzOf "$ipk" ./control+data.sig > $sig || return 2 - - tar -xzOf "$ipk" ./control.tar.gz ./data.tar.gz | usign -V -m - -P /etc/opkg/keys -x $sig || return 3 -} - -check $1 -status=$? -rm -f $sig -return $status diff --git a/root/target/linux/ipq40xx/base-files/etc/board.d/1-board_json b/root/target/linux/ipq40xx/base-files/etc/board.d/1-board_json index 6d26ba42..619e0062 100755 --- a/root/target/linux/ipq40xx/base-files/etc/board.d/1-board_json +++ b/root/target/linux/ipq40xx/base-files/etc/board.d/1-board_json @@ -193,9 +193,7 @@ setup_json() { } #~ Get model name for RUTX products -if ! model="$(mnf_info --name)" 2>/dev/null; then - model="$(mnf_info --prod-code)" 2>/dev/null -fi +model="$(mnf_info --name)" 2>/dev/null platform="$(cat /proc/device-tree/platform)" 2>/dev/null diff --git a/root/target/linux/ipq40xx/base-files/etc/init.d/modem_tracker b/root/target/linux/ipq40xx/base-files/etc/init.d/modem_tracker deleted file mode 100755 index 3a3d06bc..00000000 --- a/root/target/linux/ipq40xx/base-files/etc/init.d/modem_tracker +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh /etc/rc.common -# Copyright (C) 2021 Teltonika Networks - -START=96 - -USE_PROCD=1 - -PROG=/bin/board_track -NAME=board_track -PIDCOUNT=1 - -start_service() { - config_load system - - config_get modem_track system modem_track 1 - - [ "$modem_track" != 0 ] || return - - local pid_file="/var/run/${NAME}.${PIDCOUNT}.pid" - - procd_open_instance - procd_set_param command "$PROG" - procd_set_param file /etc/config/system - - procd_set_param respawn - - procd_set_param stdout 1 - procd_set_param pidfile $pid_file - procd_close_instance -} - -reload_service() { - stop - start -} - -service_triggers() { - procd_add_reload_trigger "system" -} diff --git a/root/target/linux/ipq40xx/base-files/etc/uci-defaults/02_simcard b/root/target/linux/ipq40xx/base-files/etc/uci-defaults/02_simcard deleted file mode 100644 index 7e8dbc6a..00000000 --- a/root/target/linux/ipq40xx/base-files/etc/uci-defaults/02_simcard +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -. /lib/functions.sh -. /lib/functions/board.sh - - -set_pin() { - local sim="$1" - local modem position num builtin - - config_get modem "$sim" modem - builtin=$(is_builtin_modem "$modem") - [ "$builtin" = "0" ] && return - - config_get position "$sim" position - #If modem builtin and primary then position num 3 or 4 else 1 or 2 - [ "$builtin" = "2" ] && num=$((position + 2)) || num=$position - - pin=`/sbin/mnf_info --simpin $num` - [ -z "$pin" ] && return - - uci -q set "simcard"."$sim"."pincode"="$pin" -} - -config_load simcard -config_foreach set_pin sim -uci commit simcard - -exit 0 diff --git a/root/target/linux/ipq40xx/base-files/etc/uci-defaults/03_side-widget b/root/target/linux/ipq40xx/base-files/etc/uci-defaults/03_side-widget deleted file mode 100644 index 36c60051..00000000 --- a/root/target/linux/ipq40xx/base-files/etc/uci-defaults/03_side-widget +++ /dev/null @@ -1,119 +0,0 @@ -#!/bin/sh -. /lib/functions.sh - -CONFIG="widget" -MOBILE_CONFIG="/etc/config/simcard" -RMS_CONFIG="/etc/config/rms_connect_mqtt" -WIFI_CONFIG="/etc/config/wireless" -ETHERNET=$(uci -q get network.@switch[0].name) -ethernet_widget_exists=0 -mobile_widget_exists=0 -system_widget_exists=0 -wifi_widget_exists=0 -rms_widget_exists=0 -position=1 -radio0_network=1 -radio1_network=1 - -check_for_widgets() { - local widget="$1" - local type - config_get type "$widget" type - - if [ "$type" = "ethernet" ]; then - ethernet_widget_exists=1 - elif [ "$type" = "mobile" ]; then - mobile_widget_exists=1 - elif [ "$type" = "system" ]; then - system_widget_exists=1 - elif [ "$type" = "wifi" ]; then - wifi_widget_exists=1 - elif [ "$type" = "rms" ]; then - rms_widget_exists=1 - fi -} - -setup_wifi_fields() { - local iface_section="$1" - local device - config_get device "$iface_section" device - - section=$(uci -q add widget widget) - - if [ "$device" == "radio0" ]; then - uci -q set $CONFIG."${section}.id"=$device."network${radio0_network}" - let "radio0_network=radio0_network + 1" - elif [ "$device" == "radio1" ]; then - uci -q set $CONFIG."${section}.id"=$device."network${radio1_network}" - let "radio1_network=radio1_network + 1" - fi - uci -q set $CONFIG."${section}.type=wifi" - uci -q set $CONFIG."${section}.position=${position}" - uci -q set $CONFIG."${section}.enabled=1" - let "position=position + 1" -} - -check_if_config_exists() { - if [ ! -f "/etc/config/${CONFIG}" ]; then - touch "/etc/config/${CONFIG}" - fi -} - -setup_side_widget() { - config_load widget - config_foreach check_for_widgets widget - - if [ $ethernet_widget_exists -eq 0 -a -n "$ETHERNET" ]; then - check_if_config_exists - section=$(uci -q add widget widget) - uci -q set $CONFIG."${section}.id=widget1" - uci -q set $CONFIG."${section}.type=ethernet" - uci -q set $CONFIG."${section}.position=${position}" - uci -q set $CONFIG."${section}.enabled=1" - let "position=position + 1" - fi - - if [ $mobile_widget_exists -eq 0 -a -s "$MOBILE_CONFIG" -a -f "$MOBILE_CONFIG" ]; then - check_if_config_exists - modem_count=$(jsonfilter -q -i /etc/board.json -e '@["modems"][*]' | wc -l) - for i in $(seq $modem_count) - do - section=$(uci -q add widget widget) - uci -q set $CONFIG."${section}.id=mobile-widget$i" - uci -q set $CONFIG."${section}.type=mobile" - uci -q set $CONFIG."${section}.position=${position}" - uci -q set $CONFIG."${section}.enabled=1" - let "position=position + 1" - done - fi - - if [ $system_widget_exists -eq 0 ]; then - check_if_config_exists - section=$(uci -q add widget widget) - uci -q set $CONFIG."${section}.id=widget3" - uci -q set $CONFIG."${section}.type=system" - uci -q set $CONFIG."${section}.position=${position}" - uci -q set $CONFIG."${section}.enabled=1" - let "position=position + 1" - fi - - if [ $wifi_widget_exists -eq 0 -a -f "$WIFI_CONFIG" ]; then - check_if_config_exists - config_load wireless - config_foreach setup_wifi_fields wifi-iface - fi - - if [ $rms_widget_exists -eq 0 -a -f "$RMS_CONFIG" ]; then - check_if_config_exists - section=$(uci -q add widget widget) - uci -q set $CONFIG."${section}.id=widget5" - uci -q set $CONFIG."${section}.type=rms" - uci -q set $CONFIG."${section}.position=${position}" - uci -q set $CONFIG."${section}.enabled=1" - let "position=position + 1" - fi - - uci -q commit $CONFIG -} -setup_side_widget -exit 0 diff --git a/root/target/linux/ipq40xx/base-files/etc/uci-defaults/05_add_mctl_cfg b/root/target/linux/ipq40xx/base-files/etc/uci-defaults/05_add_mctl_cfg deleted file mode 100644 index 431c38ae..00000000 --- a/root/target/linux/ipq40xx/base-files/etc/uci-defaults/05_add_mctl_cfg +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -[ -n "$(uci -q get system.modem.disable)" ] || { - for m in /sys/class/gpio/modem*_power; do - local label="$(basename $m | awk -F_ '{print $1}')" - uci set "system.${label}=mctl" - uci set "system.${label}.disable=0" - - # modem is turned on in preinit but others are not - [ "${label}" != "modem" ] && /sbin/mctl -p -m "${label}" - done - - uci commit system -} - -exit 0 \ No newline at end of file diff --git a/root/target/linux/ipq40xx/base-files/etc/uci-defaults/13_migrate-groups b/root/target/linux/ipq40xx/base-files/etc/uci-defaults/13_migrate-groups deleted file mode 100755 index c4b6e3d1..00000000 --- a/root/target/linux/ipq40xx/base-files/etc/uci-defaults/13_migrate-groups +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -. /lib/functions.sh - -CONFIG="/etc/config/user_groups" - -migrate_tel_list() { - local tel="$1" - local new_section="$2" - - uci -q add_list user_groups."$new_section".tel="$tel" -} - -migrate_group() { - local group="$1" - local name - - config_get name "$group" name "" - local new_section=`uci -q add user_groups phone` - uci -q set user_groups."$new_section".name="$name" - config_list_foreach "$group" tel migrate_tel_list "$new_section" - - uci -q delete sms_utils."$group" -} - -if [ ! -e "$CONFIG" ]; then - touch "$CONFIG" -fi - -config_load sms_utils -config_foreach migrate_group group - -uci -q commit user_groups -uci -q commit sms_utils - -exit 0 diff --git a/root/target/linux/ipq40xx/base-files/etc/uci-defaults/40_strongswan_to_ipsec b/root/target/linux/ipq40xx/base-files/etc/uci-defaults/40_strongswan_to_ipsec deleted file mode 100755 index 88497cbc..00000000 --- a/root/target/linux/ipq40xx/base-files/etc/uci-defaults/40_strongswan_to_ipsec +++ /dev/null @@ -1,140 +0,0 @@ -#!/bin/sh - -[ -e /etc/config/strongswan ] || exit 0 - -. /lib/functions.sh -ENABLED=0 - -move_config() { - - local name=$1 - - #get old config - config_get_bool enabled "$1" "enabled" "0" - config_get keyexchange "$1" "keyexchange" - config_get aggressive "$1" "aggressive" - config_get ipsec_type "$1" "ipsec_type" - config_get my_identifier_type "$1" "my_identifier_type" - config_get my_identifier "$1" "my_identifier" - config_get leftfirewall "$1" "leftfirewall" - config_get forceencaps "$1" "forceencaps" - config_get dpdaction "$1" "dpdaction" "none" - config_get dpddelay "$1" "dpddelay" - config_get dpdtimeout "$1" "dpdtimeout" - config_get psk_key "$1" "psk_key" - config_get right "$1" "right" - config_get rightfirewall "$1" "rightfirewall" - config_get ike_encryption_algorithm "$1" "ike_encryption_algorithm" - config_get ike_authentication_algorithm "$1" "ike_authentication_algorithm" - config_get ike_dh_group "$1" "ike_dh_group" - config_get ikelifetime "$1" "ikelifetime" - config_get esp_encryption_algorithm "$1" "esp_encryption_algorithm" - config_get esp_hash_algorithm "$1" "esp_hash_algorithm" - config_get esp_pfs_group "$1" "esp_pfs_group" - config_get keylife "$1" "keylife" - config_get leftsubnet "$1" "leftsubnet" - config_get rightsubnet "$1" "rightsubnet" - config_get leftprotoport "$1" "leftprotoport" - config_get rightprotoport "$1" "rightprotoport" - - [ "$enabled" = 1 ] && ENABLED=1 - #set new config structure - - config_set - uci_add "ipsec" "proposal" "${name}_ph1" - uci_set "ipsec" $CONFIG_SECTION "encryption_algorithm" "$ike_encryption_algorithm" - uci_set "ipsec" $CONFIG_SECTION "hash_algorithm" "$ike_authentication_algorithm" - uci_set "ipsec" $CONFIG_SECTION "dh_group" "$ike_dh_group" - - uci_add "ipsec" "proposal" "${name}_ph2" - uci_set "ipsec" $CONFIG_SECTION "encryption_algorithm" "$esp_encryption_algorithm" - uci_set "ipsec" $CONFIG_SECTION "hash_algorithm" "$esp_hash_algorithm" - uci_set "ipsec" $CONFIG_SECTION "dh_group" "$esp_pfs_group" - - uci_add "ipsec" "connection" "${name}_c" - uci_set "ipsec" $CONFIG_SECTION "mode" "start" - uci_set "ipsec" $CONFIG_SECTION "type" "$ipsec_type" - uci_set "ipsec" $CONFIG_SECTION "local_subnet" "$leftsubnet" - uci_set "ipsec" $CONFIG_SECTION "remote_subnet" "$rightsubnet" - uci_set "ipsec" $CONFIG_SECTION "remote_firewall" "$rightfirewall" - uci_set "ipsec" $CONFIG_SECTION "keyexchange" "$keyexchange" - uci_set "ipsec" $CONFIG_SECTION "aggressive" "$aggressive" - uci_set "ipsec" $CONFIG_SECTION "ikelifetime" "$ikelifetime" - uci_set "ipsec" $CONFIG_SECTION "lifetime" "$lifetime" - [ -n "$dpdaction" ] && { - uci_set "ipsec" $CONFIG_SECTION "_dpd" "1" - uci_set "ipsec" $CONFIG_SECTION "dpdaction" "$dpdaction" - uci_set "ipsec" $CONFIG_SECTION "dpddelay" "$dpddelay" - } - uci_set "ipsec" $CONFIG_SECTION "crypto_proposal" "${name}_ph2" - uci_set "ipsec" $CONFIG_SECTION "leftprotoport" "$leftprotoport" - uci_set "ipsec" $CONFIG_SECTION "rightprotoport" "$rightprotoport" - uci_set "ipsec" $CONFIG_SECTION "lifetime" "$keylife" - uci_set "ipsec" $CONFIG_SECTION "forceencaps" "$forceencaps" - - uci_add "ipsec" "remote" "${name}" - uci_set "ipsec" $CONFIG_SECTION "enabled" "$enabled" - uci_set "ipsec" $CONFIG_SECTION "gateway" "$right" - uci_set "ipsec" $CONFIG_SECTION "remote_identifier" "%any" - uci_set "ipsec" $CONFIG_SECTION "authentication_method" "psk" - uci_set "ipsec" $CONFIG_SECTION "pre_shared_key" "$psk_key" - uci_set "ipsec" $CONFIG_SECTION "local_identifier" "$my_identifier" - uci_set "ipsec" $CONFIG_SECTION "crypto_proposal" "${name}_ph1" - - [ "$ipsec_type" = "tunnel" ] && uci -q add_list "ipsec"."${CONFIG_SECTION}"."tunnel"="${name}_c" - [ "$ipsec_type" = "transport" ] && uci -q add_list "ipsec"."${CONFIG_SECTION}"."transport"="${name}_c" - - uci_commit "ipsec" -} - -config_load 'strongswan' -config_foreach move_config 'conn' - -[ "$ENABLED" = 1 ] && { - uci_add firewall rule - uci_set firewall "$CONFIG_SECTION" src 'wan' - uci_set firewall "$CONFIG_SECTION" name 'Allow-IPsec-ESP' - uci_set firewall "$CONFIG_SECTION" target 'ACCEPT' - uci_set firewall "$CONFIG_SECTION" vpn_type 'IPsec' - uci_set firewall "$CONFIG_SECTION" proto 'esp' - - uci_add firewall rule - uci_set firewall "$CONFIG_SECTION" dest_port '4500' - uci_set firewall "$CONFIG_SECTION" src 'wan' - uci_set firewall "$CONFIG_SECTION" name 'Allow-IPsec-NAT-T' - uci_set firewall "$CONFIG_SECTION" target 'ACCEPT' - uci_set firewall "$CONFIG_SECTION" vpn_type 'IPsec' - uci_set firewall "$CONFIG_SECTION" proto 'udp' - - uci_add firewall rule - uci_set firewall "$CONFIG_SECTION" dest_port '500' - uci_set firewall "$CONFIG_SECTION" src 'wan' - uci_set firewall "$CONFIG_SECTION" name 'Allow-IPsec-IKE' - uci_set firewall "$CONFIG_SECTION" target 'ACCEPT' - uci_set firewall "$CONFIG_SECTION" vpn_type 'IPsec' - uci_set firewall "$CONFIG_SECTION" proto 'udp' - - uci_add firewall rule - uci_set firewall "$CONFIG_SECTION" src 'wan' - uci_set firewall "$CONFIG_SECTION" name 'Allow-IPsec-Forward' - uci_set firewall "$CONFIG_SECTION" extra '-m policy --dir in --pol ipsec' - uci_set firewall "$CONFIG_SECTION" target 'ACCEPT' - uci_set firewall "$CONFIG_SECTION" vpn_type 'IPsec' - uci_set firewall "$CONFIG_SECTION" dest '*' - uci_set firewall "$CONFIG_SECTION" proto 'all' - - uci_add firewall redirect - uci_set firewall "$CONFIG_SECTION" proto any - uci_set firewall "$CONFIG_SECTION" name Exclude-IPsec-from-NAT - uci_set firewall "$CONFIG_SECTION" extra '-m policy --dir out --pol ipsec' - uci_set firewall "$CONFIG_SECTION" vpn_type IPsec - uci_set firewall "$CONFIG_SECTION" target ACCEPT - uci_set firewall "$CONFIG_SECTION" dest wan - uci_set firewall "$CONFIG_SECTION" enabled 1 - - uci_commit firewall -} - -rm -f /etc/config/strongswan - -exit 0 diff --git a/root/target/linux/ipq40xx/base-files/etc/uci-defaults/50_migrate_pptp_l2tp_sstp b/root/target/linux/ipq40xx/base-files/etc/uci-defaults/50_migrate_pptp_l2tp_sstp deleted file mode 100644 index 2c470f93..00000000 --- a/root/target/linux/ipq40xx/base-files/etc/uci-defaults/50_migrate_pptp_l2tp_sstp +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/sh - -. /lib/functions.sh -#this script move configuration from 1.x firmware -#it should rename some sections and add option disabled to network config - -move_config() { - local section="$1" - local file="$2" - - config_get_bool enabled "$1" "enabled" "0" - config_get _name "$1" "_name" - config_get _type "$1" "_type" - [ -z "$_type" ] && config_get _type "$1" "type" - [ "$enabled" -eq 1 ] && [ "$_type" = "client" ] && { - uci set network."$1".auto=1 - uci_commit "${config}" - } - [ "${_type}_${_name}" = "$section" ] && return - uci_rename "$file" "$section" "${_type:+${_type}_}${_name}" - uci_commit "${config}" -} - -move_network() { - local section="$1" - local net_proto net_name net_type net_enabled - - config_get net_proto "$section" "proto" - - case "$net_proto" in - pptp|\ - l2tp) - config_get net_name "$1" "_name" - config_get_bool net_enabled "$1" "enabled" - [ "client_${net_name}" = "$section" ] && return - [ -n "$net_enabled" ] && { - [ "$net_enabled" = "1" ] && uci_set network "$section" disabled 0 || uci_set network "$section" disabled 1 - uci_remove network "$section" enabled - } - uci_rename network "$section" "${net_type:+${net_type}_}${net_name}" - uci_commit network - - ;; - sstp) - config_get_bool net_enabled "$1" "enabled" - [ -z "$net_enabled" ] && return - [ "$net_enabled" = "1" ] && uci_set network "$section" disabled 0 || uci_set network "$section" disabled 1 - uci_remove network "$section" enabled - uci_commit network - ;; - *) - return - ;; - esac -} - -# removes client configurations, because they reside in network and with vuci became unncessary -remove_network() { - local section="$1" - local current_config="$2" - local sectionType - config_get sectionType "$1" "type" - if [ "$sectionType" = "client" ]; then - uci_remove "$current_config" "$section" - uci_commit "$current_config" - fi -} - -configs="pptpd xl2tpd" - -for config in $configs; do - [ -s /etc/config/${config} ] || continue - config_load "$config" - config_foreach move_config "service" "$config" - config_foreach remove_network "service" "$config" -done - -[ -s /etc/config/network ] || exit 0 -config_load "network" -config_foreach move_network "interface" - -exit 0 diff --git a/root/target/linux/ipq40xx/base-files/lib/preinit/75_stm32_autoflash b/root/target/linux/ipq40xx/base-files/lib/preinit/75_stm32_autoflash deleted file mode 100644 index 5d96b340..00000000 --- a/root/target/linux/ipq40xx/base-files/lib/preinit/75_stm32_autoflash +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -do_stm32_autoflash() { - # launch STM32 flash utility - [ -e "/sys/r2ec/reset" -a -f /usr/bin/autoflash ] && { - /usr/bin/autoflash - } -} - -[ "$INITRAMFS" = "1" ] || boot_hook_add preinit_main do_stm32_autoflash diff --git a/root/target/linux/ipq40xx/base-files/lib/preinit/82_modem_power b/root/target/linux/ipq40xx/base-files/lib/preinit/82_modem_power deleted file mode 100644 index 7db2ecf2..00000000 --- a/root/target/linux/ipq40xx/base-files/lib/preinit/82_modem_power +++ /dev/null @@ -1,20 +0,0 @@ -set_state() { - local label="$1" - local disable - - [ -e "/sys/class/gpio/${label}_power/value" ] || return - - config_get disable ${label} disable - [ "${disable}" -eq 1 ] && \ - /sbin/mctl -s -m "${label}" || \ - /sbin/mctl -p -m "${label}" -} - -do_power_modem() { - [ -z "$(uci -q get system.modem.disable)" ] && /sbin/mctl -p || { - config_load system - config_foreach set_state mctl - } -} - -boot_hook_add preinit_main do_power_modem diff --git a/root/target/linux/ipq40xx/base-files/lib/preinit/82_version_migrate b/root/target/linux/ipq40xx/base-files/lib/preinit/82_version_migrate deleted file mode 100644 index 565ac215..00000000 --- a/root/target/linux/ipq40xx/base-files/lib/preinit/82_version_migrate +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# Copyright (C) 2006 OpenWrt.org -# Copyright (C) 2010 Vertical Communications - -do_check_version() { - version="$(uci -q get system.@system[0].device_fw_version)" - [ -z "$version" ] && { - return 0 - } - - numeric_version="${version##*_}" - client_removed="${numeric_version#*.}" - major="${client_removed%%.*}" - - [ -f /sysupgrade.tgz ] && [ -n "$major" ] && [ "$major" -lt 2 ] && { - echo "- migration work -" - cp /rom/etc/inittab /etc/inittab - } -} - -[ "$INITRAMFS" = "1" ] || boot_hook_add preinit_main do_check_version diff --git a/root/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh b/root/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh index cb8d7658..70dc76ae 100644 --- a/root/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh +++ b/root/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh @@ -184,7 +184,9 @@ platform_do_upgrade() { PART_NAME="inactive" platform_do_upgrade_dualboot_datachk "$1" ;; - teltonika,rutx |\ + teltonika,rutx) + platform_do_upgrade_ipq "$1" + ;; zte,mf286d) CI_UBIPART="rootfs" nand_do_upgrade "$1" diff --git a/root/target/linux/ipq40xx/base-files/sbin/mctl b/root/target/linux/ipq40xx/base-files/sbin/mctl deleted file mode 100755 index f501cc2e..00000000 --- a/root/target/linux/ipq40xx/base-files/sbin/mctl +++ /dev/null @@ -1,120 +0,0 @@ -#!/bin/sh - -. /usr/share/libubox/jshn.sh - -PS_ON=1 -PS_OFF=2 - -MPS=0 -MLBL="modem" - -modem_reset() { - local label="$1" - - [ -e "/sys/class/gpio/${label}_reset/value" ] || return - - echo 1 > "/sys/class/gpio/${label}_reset/value" - sleep 1 - echo 0 > "/sys/class/gpio/${label}_reset/value" -} - -modem_off() { - local label="$1" - - [ -e "/sys/class/gpio/${label}_reset/value" ] || return - - echo 1 > "/sys/class/gpio/${label}_reset/value" -} - -modem_power() { - local label="$1" - - [ -e "/sys/class/gpio/${label}_power/value" ] || return - - # simulate power press - echo 1 > "/sys/class/gpio/${label}_power/value" - sleep 1 - echo 0 > "/sys/class/gpio/${label}_power/value" -} - -modem_list() { - local list="modem" - local label - - [ "$(modem_fetch_primary)" -eq 0 ] && { - echo "${list}" - return - } - - for m in /sys/class/gpio/modem*_power; do - label="$(basename $m | awk -F_ '{print $1}')" - [ "${label}" != "modem" ] && list="${list},${label}" - done - - echo "${list}" -} - -modem_fetch_primary() { - local modem modems primary - - json_init - json_load_file "/etc/board.json" - - json_get_keys modems modems - json_select modems - - for modem in $modems; do - json_select "$modem" - json_get_vars primary - - [ -n "$primary" ] && { - echo 1 - return - } - - json_select .. - done - echo 0 -} - -modem_is_available() { - local label="$1" - [ -e "/sys/class/gpio/${label}_power/value" ] -} - -usage() { - cat < -Control modem power state. - -Options: - -p, --power-on power on modem - -s, --shutdown shutdown modem - -r, --reboot reboot modem - -m, --modem