├── .gitignore ├── .gitmodules ├── README.md ├── build.sh ├── copy_packages.sh ├── create.sh ├── extract.sh ├── files ├── 7z │ ├── 7zsd_LZMA2.sfx │ ├── 7zsd_LZMA2_upx.sfx │ └── was-110.cfg ├── basic │ ├── lib │ │ ├── 8311_backend.sh │ │ └── preinit │ │ │ └── 90_8311_mounts │ ├── usr │ │ ├── bin │ │ │ └── luci-me-dump │ │ └── lib │ │ │ └── lua │ │ │ ├── 8311 │ │ │ └── tools.lua │ │ │ ├── base64.lua │ │ │ ├── luci │ │ │ ├── controller │ │ │ │ └── 8311.lua │ │ │ └── view │ │ │ │ ├── 8311 │ │ │ │ ├── config.htm │ │ │ │ ├── firmware.htm │ │ │ │ ├── pon_me.htm │ │ │ │ ├── pon_status.htm │ │ │ │ ├── support.htm │ │ │ │ └── vlans.htm │ │ │ │ └── themes │ │ │ │ └── bootstrap │ │ │ │ └── footer.htm │ │ │ └── nixio │ │ │ └── bit.lua │ └── www │ │ └── luci-static │ │ └── resources │ │ ├── jquery-3.7.1.min.js │ │ ├── jquery.validate.min.js │ │ ├── logo_8311.png │ │ └── view │ │ ├── 8311.css │ │ ├── 8311.js │ │ └── status │ │ └── include │ │ └── 15_pon.js ├── bfw │ ├── lib │ │ └── 8311_backend.sh │ └── www │ │ └── image │ │ └── logo_8311.png ├── common │ ├── etc │ │ ├── init.d │ │ │ ├── _8311-netinit.sh │ │ │ ├── _8311-poninit.sh │ │ │ ├── _8311-sysinit.sh │ │ │ ├── sfp_eeprom.sh │ │ │ ├── sudo │ │ │ ├── urngd │ │ │ └── zsync.sh │ │ ├── mibs │ │ │ ├── prx300_1U.ini │ │ │ ├── prx300_1U_telus.ini │ │ │ └── prx300_1V_bell.ini │ │ ├── modules.d │ │ │ └── zzz-pon-sfp-i2c │ │ ├── rc.d │ │ │ ├── S18_8311-sysinit.sh │ │ │ ├── S26_8311-netinit.sh │ │ │ └── S79_8311-poninit.sh │ │ └── uci-defaults │ │ │ └── zzz-8311 │ ├── lib │ │ ├── 8311-omci-lib.sh │ │ ├── 8311.sh │ │ ├── functions │ │ │ ├── hexbin.sh │ │ │ └── int.sh │ │ └── preinit │ │ │ ├── 01_urngd │ │ │ └── 07_create_ptconf │ ├── root │ │ └── .profile │ ├── sbin │ │ └── secure_upgrade.sh │ └── usr │ │ ├── bin │ │ └── pcre2grep │ │ └── sbin │ │ ├── 8311-extvlan-decode.sh │ │ ├── 8311-firmware-upgrade.sh │ │ ├── 8311-persist-root-password.sh │ │ ├── 8311-pingd.sh │ │ ├── 8311-rarpd.sh │ │ ├── 8311-rx_los.sh │ │ ├── 8311-support.sh │ │ ├── 8311-tc-filter-dump.sh │ │ ├── 8311-vlansd.sh │ │ ├── alternate_firmware_info │ │ ├── fwenv_get │ │ └── fwenv_set └── reset │ └── etc │ ├── init.d │ └── _8311-reset_fwenvs.sh │ └── rc.d │ └── S17_8311-reset_fwenvs.sh ├── i18n ├── lmo │ └── .gitkeep └── po │ ├── 8311.en.po │ ├── 8311.fr.po │ ├── 8311.ja.po │ ├── 8311.zh-cn.po │ ├── base.fr.po │ ├── base.ja.po │ └── base.zh-cn.po ├── mods ├── basic-i18n.sh ├── basic-mods.sh ├── bfw-mods.sh ├── binary-mods.sh ├── common-mods.sh ├── pre-common-mods.sh └── reset-mods.sh ├── packages ├── .openwrt-config ├── basic │ ├── liblucihttp0_2019-07-05-a34a17d5-1_mips_24kc.ipk │ ├── libmbedtls12_2.16.12-1_mips_24kc.ipk │ ├── libuhttpd-mbedtls_2.2.2-2_mips_24kc.ipk │ ├── libustream-mbedtls20150806_2020-03-13-40b563b1-1_mips_24kc.ipk │ ├── luci-base_git-22.045.73925-36e5c1c-1_mips_24kc.ipk │ ├── luci-lib-ip_git-22.045.73925-36e5c1c-1_mips_24kc.ipk │ ├── luci-lib-nixio_git-22.045.73925-36e5c1c-1_mips_24kc.ipk │ ├── luci-lib-px5g_git-22.045.73925-36e5c1c-1_mips_24kc.ipk │ ├── luci-mod-status_git-22.045.73925-36e5c1c-1_mips_24kc.ipk │ ├── luci-mod-system_git-22.045.73925-36e5c1c-1_all.ipk │ ├── luci-theme-bootstrap_git-22.045.73925-36e5c1c-1_all.ipk │ ├── px5g-mbedtls_9_mips_24kc.ipk │ ├── rpcd-mod-luci_20201107_mips_24kc.ipk │ ├── uhttpd-mod-lua_2020-10-01-3abcc891-1_mips_24kc.ipk │ ├── uhttpd-mod-ubus_2020-10-01-3abcc891-1_mips_24kc.ipk │ └── uhttpd_2020-10-01-3abcc891-1_mips_24kc.ipk ├── common │ ├── busybox_1.36.1-1_mips_24kc.ipk │ ├── dropbear_2022.83-1_mips_24kc.ipk │ ├── fping_4.2-1_mips_24kc.ipk │ ├── htop_3.0.5-1_mips_24kc.ipk │ ├── libc_1.1.24-2_mips_24kc.ipk │ ├── libncurses6_6.1-5_mips_24kc.ipk │ ├── libpcre2_10.36-1_mips_24kc.ipk │ ├── libzstd_1.4.5-2_mips_24kc.ipk │ ├── lrzsz_0.12.20-2_mips_24kc.ipk │ ├── mtr_0.93-1_mips_24kc.ipk │ ├── nand-utils_2.1.1-1_mips_24kc.ipk │ ├── nano_6.1-1_mips_24kc.ipk │ ├── terminfo_6.1-5_mips_24kc.ipk │ ├── zoneinfo-africa_2020c-1_mips_24kc.ipk │ ├── zoneinfo-asia_2020c-1_mips_24kc.ipk │ ├── zoneinfo-atlantic_2020c-1_mips_24kc.ipk │ ├── zoneinfo-core_2020c-1_mips_24kc.ipk │ ├── zoneinfo-europe_2020c-1_mips_24kc.ipk │ ├── zoneinfo-india_2020c-1_mips_24kc.ipk │ ├── zoneinfo-northamerica_2020c-1_mips_24kc.ipk │ ├── zoneinfo-pacific_2020c-1_mips_24kc.ipk │ ├── zoneinfo-poles_2020c-1_mips_24kc.ipk │ ├── zoneinfo-simple_2020c-1_mips_24kc.ipk │ ├── zoneinfo-southamerica_2020c-1_mips_24kc.ipk │ └── zstd_1.4.5-2_mips_24kc.ipk └── remove │ ├── luci-app-advanced-reboot_1.0.1-3-1_all.list │ ├── luci-app-commands_git-22.045.73925-36e5c1c-1_all.list │ ├── luci-app-firewall_git-22.045.73925-36e5c1c-1_all.list │ ├── luci-app-opkg_git-22.045.73925-36e5c1c-1_all.list │ ├── luci-mod-network_git-22.045.73925-36e5c1c-1_all.list │ └── luci-theme-openwrt_git-22.045.73925-36e5c1c-1_all.list ├── system_sw.ini ├── tools ├── bfw-crc.pl ├── endianess_swap.sh └── po2lmo.py ├── wholeImage.sh └── whole_image ├── res.bin ├── uboot-8311.bin ├── uboot-azores-1.0.24.bin ├── uboot-azores.bin ├── uboot-potron-original.bin ├── uboot-potron.bin ├── ubootenv-8311.img ├── ubootenv-azores.img └── ubootenv-potron.img /.gitignore: -------------------------------------------------------------------------------- 1 | out/ 2 | rootfs 3 | rootfs-bfw/ 4 | rootfs-basic/ 5 | stock/ 6 | whole_image/system_sw.img 7 | i18n/lmo/*.lmo 8 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "8311-xgspon-bypass"] 2 | path = 8311-xgspon-bypass 3 | branch = master 4 | url = git@github.com:djGrrr/8311-xgspon-bypass.git 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 8311 WAS-110 Firmware Builder 2 | 3 | ## Custom fwenvs 4 | ``` 5 | 8311_fix_vlans=1 6 | 8311_internet_vlan=0 7 | 8311_services_vlan=36 8 | 9 | 8311_ipaddr=192.168.11.1 10 | 8311_netmask=255.255.255.0 11 | 8311_gateway=192.168.11.254 12 | 8311_ping_ip=192.168.11.2 13 | 14 | 8311_console_en=1 15 | 8311_ethtool_speed=speed 2500 autoneg off duplex full 16 | 8311_failsafe_delay=30 17 | 8311_persist_root=0 18 | 8311_root_pwhash=$1$BghTQV7M$ZhWWiCgQptC1hpUdIfa0e. 19 | 8311_rx_los=0 20 | 21 | 8311_cp_hw_ver_sync=1 22 | 8311_device_sn=DM222XXXXXXXXXX 23 | 8311_equipment_id=5690 24 | 8311_gpon_sn=SMBSXXXXXXXX 25 | 8311_hw_ver=Fast5689EBell 26 | 8311_mib_file=/etc/mibs/prx300_1V.ini 27 | 8311_reg_id_hex=00 28 | 8311_sw_verA=SGC830007C 29 | 8311_sw_verB=SGC830006E 30 | 8311_vendor_id=SMBS 31 | ``` 32 | 33 | 34 | ### ISP Fix fwenvs 35 | `8311_fix_vlans` - **Fix VLANs** 36 | Set to `0` to disable the automatic fixes that are applied to VLANs. 37 | 38 | `8311_internet_vlan` - **Internet VLAN** 39 | Set the local VLAN ID to use for the Internet or `0` to make the Internet untagged (and also remove VLAN 0) (0 to 4095). Defaults to `0` (untagged). 40 | 41 | `8311_services_vlan` - **Services VLAN** 42 | Set the local VLAN ID to use for Services (ie TV/Home Phone) (1 to 4095). This fixes multi-service on Bell. 43 | 44 | 45 | ### Management fwenvs 46 | `8311_ipaddr` - **IP Address** 47 | Set the management IP address. Defaults to `192.168.11.1` 48 | 49 | `8311_netmask` - **Subnet Mask** 50 | Set the management subnet mask. Defaults to `255.255.255.0` 51 | 52 | `8311_gateway` - **Gateway** 53 | Set the management gateway. Defaults to the IP address (ie. no default gateway) 54 | 55 | `8311_ping_ip` - **Ping IP** 56 | Sets an IP address to ping every 5 seconds, this can helps with reaching the stick. Defaults to the 2nd ip address in the configured management network (ie. 192.168.11.2). 57 | 58 | 59 | ### Device fwenvs 60 | `8311_console_en` - **Serial console** 61 | Set to `1` to enable the serial console, this will cause TX_FAULT to be asserted as it shares the same SFP pin. 62 | 63 | `8311_ethtool_speed` - **Ethtool Speed Settings** 64 | Set ethtool speed settings on the eth0_0 interface (ethtool -s). 65 | 66 | `8311_factory_mode` - **Factory Mode** 67 | Set to 1 to enable factory mode, otherwise factory mode will be automatically disabled on boot. 68 | 69 | `8311_failsafe_delay` - **Failsafe Delay** 70 | Sets the number of seconds that we will delay the startup of omcid for at bootup (30 to 300). Defaults to 30 seconds. 71 | 72 | `8311_lct_mac` - **LCT MAC Address** 73 | Set the MAC address on the LCT management interface. 74 | 75 | `8311_persist_root` - **Persist RootFS** 76 | Set to `1` to allow the root file system to stay persistent (would also require that you modify the bootcmd fwenv). This is not recommended and should only be used for debug/testing purposes. 77 | 78 | `8311_root_pwhash` - **Root password hash** 79 | Allows you to set a custom root password by setting the hash. 80 | 81 | `8311_rx_los` - **RX_LOS Workaround** 82 | Set to `0` to monitor the status of the RX_LOS pin to disable it any time it gets enabled. This will allow the stick to be accessible in devices which disable access to the port if RX_LOS is being asserted. 83 | 84 | 85 | ### PON fwenvs 86 | `8311_cp_hw_ver_sync` - **Sync Circuit Pack Version** 87 | When set to `1` and `8311_hw_ver` is also set, will modify the configured mib file to set the Version field of any Circuit Pack MEs to match the Hardware version. 88 | 89 | `8311_device_sn` - **Device Serial Number** 90 | Sets the physical device S/N, this is more or less display only. 91 | 92 | `8311_equipment_id` - **Equipment ID** 93 | Sets the PON Equipment ID field in the ONU2-G ME (257). 94 | 95 | `8311_gpon_sn` - **GPON Serial Number / ONT ID** 96 | Sets the GPON Serial Number sent to the OLT in various MEs (4 letters, followed by 8 hex digits). 97 | 98 | `8311_hw_ver` - **Hardware Version** 99 | Set the Hardware version string sent to the OLT in various MEs (up to 14 characters). 100 | 101 | `8311_iphost_domain` - **IP Host Domain Name** 102 | Set the domain name sent to the OLT in ME 134 (up to 25 characters). 103 | 104 | `8311_iphost_hostname` - **IP Host Hostname** 105 | Set the hostname sent to the OLT in ME 134 (up to 25 characters). 106 | 107 | `8311_iphost_mac` - **IP Host MAC Address** 108 | Set the MAC address sent to the OLT in ME 134. 109 | 110 | `8311_loid` - **Logical ONU ID** 111 | Sets the Logical ONU ID presented to the OLT in ME 256 (up to 24 characters). 112 | 113 | `8311_lpwd` - **Logical Password** 114 | Sets the Logical Password prsented to the OLT in ME 256 (up to 12 characters). 115 | 116 | `8311_mib_file` - **MIB File** 117 | Sets the MIB file used by omcid. Defaults to `/etc/mibs/prx300_1U.ini` 118 | 119 | `8311_pon_slot` - **PON Slot** 120 | Sets the slot number that the UNI port is presented on, needed on some ISPs. 121 | 122 | `8311_reg_id_hex` - **Registration ID** 123 | Sets the Registration ID (up to 36 characters [72 hex]) sent to the OLT in hex format. This is where you would set a ploam password (which is contained in the last 12 characters). 124 | 125 | `8311_sw_verA` / `8311_sw_verB` - **Software Versions** 126 | Sets the image specific software versions sent in the Software image MEs (7). 127 | 128 | `8311_vendor_id` - **Vendor ID** 129 | Sets the PON Vendor ID sent to the OLT, automatically derived from the GPON Serial Number if not set (4 letters). 130 | 131 | 132 | 133 | ## Authentication 134 | SSH host keys (all of `/etc/dropbear`) and authorized_keys (all of `/root/.ssh`) are now stored persistently. 135 | Previous UCI settings will be automatically migrated. 136 | 137 | The current root password (change with `passwd`) can be persisted using the `8311-persist-root-password.sh` command 138 | 139 | 140 | 141 | ## Scripts 142 | 143 | ### build.sh 144 | Tool for building new modded WAS-110 firmware images 145 | ``` 146 | Usage: ./build.sh [options] 147 | 148 | Options: 149 | -i --image Specify stock local upgrade image file. 150 | -I --image-dir Specify stock image directory (must contain bootcore.bin, kernel.bin, and rootfs.img). 151 | -o --image-out Specify local upgrade image to output. 152 | -h --help This help text 153 | ``` 154 | 155 | ### create.sh 156 | Tool for creating new WAS-110 local upgrade images 157 | ``` 158 | Usage: ./create.sh [options] 159 | 160 | Options: 161 | -i --image Specify local upgrade image file to create (required). 162 | -H --header Specify filename of image header to base image off of (default: header.bin). 163 | -b --bootcore Specify filename of bootcore image to place in created image (default: bootcore.bin). 164 | -k --kernel Specify filename of kernel image to place in created image (default: kernel.bin). 165 | -r --rootfs Specify filename of rootfs image to place in created image (default: rootfs.img). 166 | -V --image-version Specify version string to set on created image (14 characters max). 167 | -h --help This help text 168 | ``` 169 | 170 | 171 | ### extract.sh 172 | Tool for extracting stock WAS-110 local upgrade images 173 | ``` 174 | Usage: ./extract.sh [options] 175 | 176 | Options: 177 | -i --image Specify local upgrade image file to extract (required). 178 | -H --header Specify filename to extract image header to (default: header.bin). 179 | -b --bootcore Specify filename to extract bootcore image to (default: bootcore.bin). 180 | -k --kernel Specify filename to extract kernel image to (default: kernel.bin). 181 | -r --rootfs Specify filename to extract rootfs image to (default: rootfs.img). 182 | -h --help This help text 183 | ``` 184 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | _help() { 3 | printf -- 'Tool for building new modded WAS-110 firmware images\n\n' 4 | printf -- 'Usage: %s [options]\n\n' "$0" 5 | printf -- 'Options:\n' 6 | printf -- '-i --image \t\tSpecify stock local upgrade image file of BFW firmware.\n' 7 | printf -- '-I --image-dir \t\tSpecify stock image directory of the basic firmware (must contain bootcore.bin, kernel.bin, and rootfs.img).\n' 8 | printf -- '-o --image-out \tSpecify local upgrade image file to output.\n' 9 | printf -- '-O --tar-out \t\tSpecify local upgrade tar file to output.\n' 10 | printf -- '-V --image-version \tSpecify custom image version string.\n' 11 | printf -- '-r --image-revision \tSpecify custom image revision string.\n' 12 | printf -- '-w --basic\t\t\tBuild a basic variant image.\n' 13 | printf -- '-W --bfw\t\t\tBuild a bfw variant image.\n' 14 | printf -- '-k --basic-kernel\t\tBuild image using the basic kernel.\n' 15 | printf -- '-K --bfw-kernel\t\t\tBuild image using the bfw kernel.\n' 16 | printf -- '-b --basic-bootcore\t\tBuild image using the basic bootcore.\n' 17 | printf -- '-B --bfw-bootcore\t\tBuild image using the bfw bootcore.\n' 18 | printf -- '-R --release\t\tCreate release archive files.\n' 19 | 20 | printf -- '-h --help\t\t\tThis help text\n' 21 | } 22 | 23 | IMGFILE= 24 | IMGDIR= 25 | BASE_DIR=$(dirname "$(realpath "${BASH_SOURCE[0]}")") 26 | TOOLS_DIR="$BASE_DIR/tools" 27 | OUT_DIR="$BASE_DIR/out" 28 | LIB_DIR="$BASE_DIR/lib" 29 | IMG_OUT="" 30 | TAR_OUT="" 31 | FW_VARIANT="basic" 32 | BOOTCORE_VARIANT="" 33 | FW_VER="" 34 | KERNEL_VARIANT="" 35 | RELEASE=false 36 | 37 | while [ $# -gt 0 ]; do 38 | case "$1" in 39 | -i|--bfw-image-file) 40 | IMGFILE="$2" 41 | shift 42 | ;; 43 | -I|--basic-image-dir) 44 | IMGDIR="$2" 45 | shift 46 | ;; 47 | -o|--image-out) 48 | IMG_OUT="$2" 49 | shift 50 | ;; 51 | -o|--tar-out) 52 | TAR_OUT="$2" 53 | shift 54 | ;; 55 | -V|--image-version) 56 | FW_VER="$2" 57 | shift 58 | ;; 59 | -r|--image-revision) 60 | FW_REV="$2" 61 | shift 62 | ;; 63 | -w|--basic) 64 | FW_VARIANT="basic" 65 | ;; 66 | -W|--bfw) 67 | FW_VARIANT="bfw" 68 | ;; 69 | -k|--basic-kernel) 70 | KERNEL_VARIANT="basic" 71 | ;; 72 | -K|--bfw-kernel) 73 | KERNEL_VARIANT="bfw" 74 | ;; 75 | -b|--basic-bootcore) 76 | BOOTCORE_VARIANT="basic" 77 | ;; 78 | -B|--bfw-bootcore) 79 | BOOTCORE_VARIANT="bfw" 80 | ;; 81 | -R|--release) 82 | RELEASE=true 83 | ;; 84 | -h|--help) 85 | _help 86 | exit 0 87 | ;; 88 | *) 89 | _help 90 | exit 1 91 | ;; 92 | esac 93 | shift 94 | done 95 | 96 | _err() { 97 | echo "$1" >&2 98 | exit ${2:-1} 99 | } 100 | 101 | sha256() { 102 | { [ -n "$1" ] && sha256sum "$1" || sha256sum; } | awk '{print $1}' 103 | } 104 | 105 | 106 | check_file() { 107 | [ -f "$1" ] && [ "$(sha256 "$1")" = "$2" ] 108 | } 109 | 110 | expected_hash() { 111 | EXPECTED_HASH="$2" 112 | FINAL_HASH=$(sha256 "$1") 113 | if ! [ "$FINAL_HASH" = "$EXPECTED_HASH" ]; then 114 | _err "Final '$1' SHA256 hash '$FINAL_HASH' != '$EXPECTED_HASH'" >&2 115 | fi 116 | } 117 | 118 | 119 | GIT_HASH=$(git rev-parse --short HEAD) 120 | GIT_DIFF="$(git diff HEAD)" 121 | GIT_TAG=$(git tag --points-at HEAD | grep -P '^v\d+\.\d+\.\d+' | tr '-' '~' | sort -V -r | tr '~' '-' | head -n1) 122 | GIT_EPOCH=$(git log -1 --format="%at") 123 | GIT_EPOCH=${GIT_EPOCH:-$(date '+%s')} 124 | 125 | FW_FW_SUFFIX="" 126 | FW_VER="${FW_VER:-${GIT_TAG:-""}}" 127 | [ -n "$GIT_DIFF" ] && FW_SUFFIX="~$(echo "$GIT_DIFF" | sha256 | head -c 7)" 128 | [ -n "$FW_VER" ] && FW_VERSION="${FW_VER}${FW_SUFFIX}" || { FW_VER="dev"; FW_VERSION="dev"; } 129 | 130 | FW_REV="${FW_REV:-$GIT_HASH}" 131 | FW_REVISION="$FW_REV$FW_SUFFIX" 132 | 133 | set -e 134 | 135 | if [ -n "$IMGFILE" ]; then 136 | IMG_FILE=$(realpath "$IMGFILE") 137 | [ -f "$IMG_FILE" ] || _err "Image file '$IMG_FILE' does not exist." 138 | 139 | HEADER="$OUT_DIR/header.bin" 140 | else 141 | _err "Must specify --bfw-image-file" 142 | fi 143 | 144 | if [ -n "$IMGDIR" ] && [ -d "$IMGDIR" ]; then 145 | IMG_DIR=$(realpath "$IMGDIR") 146 | [ -d "$IMG_DIR" ] || _err "Image directory '$IMG_DIR' does not exist." 147 | else 148 | _err "Muat specify --basic-image-dir" 149 | fi 150 | 151 | rm -rfv "$OUT_DIR" 152 | mkdir -pv "$OUT_DIR" 153 | 154 | KERNEL_BFW="$OUT_DIR/kernel-bfw.bin" 155 | KERNEL_BASIC="$IMG_DIR/kernel.bin" 156 | 157 | BOOTCORE_BFW="$OUT_DIR/bootcore-bfw.bin" 158 | BOOTCORE_BASIC="$IMG_DIR/bootcore.bin" 159 | 160 | ROOTFS_BFW="$OUT_DIR/rootfs-bfw.img" 161 | ROOTFS_BASIC="$IMG_DIR/rootfs.img" 162 | 163 | KERNEL_VARIANT="${KERNEL_VARIANT:-$FW_VARIANT}" 164 | BOOTCORE_VARIANT="${BOOTCORE_VARIANT:-$FW_VARIANT}" 165 | 166 | [ "$KERNEL_VARIANT" = "bfw" ] && KERNEL="$KERNEL_BFW" || KERNEL="$KERNEL_BASIC" 167 | [ "$BOOTCORE_VARIANT" = "bfw" ] && BOOTCORE="$BOOTCORE_BFW" || BOOTCORE="$BOOTCORE_BASIC" 168 | 169 | ./extract.sh -i "$IMGFILE" -H "$HEADER" -b "$BOOTCORE_BFW" -k "$KERNEL_BFW" -r "$ROOTFS_BFW" || _err "Error extracting image '$IMG_FILE'" 170 | 171 | 172 | echo 173 | 174 | ROOTFS="$OUT_DIR/rootfs.img" 175 | ROOTFS_RESET="$OUT_DIR/rootfs-reset.img" 176 | 177 | [ -f "$HEADER" ] || _err "Header file '$HEADER' does not exist." 178 | [ -f "$BOOTCORE" ] || _err "Bootcore file '$BOOTCORE' does not exist." 179 | [ -f "$KERNEL" ] || _err "Kernel file '$KERNEL' does not exist." 180 | [ -f "$ROOTFS_BFW" ] || _err "RootFS file '$ROOTFS_BFW' does not exist." 181 | [ -f "$ROOTFS_BASIC" ] || _err "RootFS file '$ROOTFS_BASIC' does not exist." 182 | 183 | ROOT_BASE=$(realpath -s "./rootfs") 184 | ROOT_BFW="${ROOT_BASE}-bfw" 185 | ROOT_BASIC="${ROOT_BASE}-basic" 186 | 187 | ROOT_DIR="${ROOT_BASE}-${FW_VARIANT}" 188 | 189 | rm -rfv "$ROOT_BASE" "$ROOT_BFW" "$ROOT_BASIC" 190 | 191 | sudo unsquashfs -d "$ROOT_BFW" "$ROOTFS_BFW" || _err "Error unsquashifying bfw RootFS image '$ORIG_ROOTFS'" 192 | sudo unsquashfs -d "$ROOT_BASIC" "$ROOTFS_BASIC" || _err "Error unsquashifying basic RootFS image '$ORIG_ROOTFS'" 193 | 194 | ln -s "rootfs-${FW_VARIANT}" "$ROOT_BASE" 195 | 196 | [ -d "$ROOT_BFW/ptrom" ] || _err "/ptrom not found in bfw rootfs" 197 | [ -d "$ROOT_BASIC/ptrom" ] && _err "/ptrom found in basic rootfs" 198 | 199 | USER=$(id -un) 200 | GROUP=$(id -gn) 201 | 202 | sudo chown -R "$USER:$GROUP" "$ROOT_BASIC" "$ROOT_BFW" 203 | 204 | FW_LONG_VERSION="${FW_VER}_${FW_VARIANT}_${FW_REV}${FW_SUFFIX}" 205 | 206 | . mods/binary-mods.sh 207 | 208 | . mods/pre-common-mods.sh 209 | 210 | . "mods/${FW_VARIANT}-mods.sh" 211 | [ "$FW_VARIANT" = "basic" ] && . mods/basic-i18n.sh 212 | 213 | . mods/common-mods.sh 214 | 215 | VERSION_FILE="$ROOT_DIR/etc/8311_version" 216 | cat > "$VERSION_FILE" <<8311_VER 217 | FW_VER=$FW_VER 218 | FW_VERSION=$FW_VERSION 219 | FW_LONG_VERSION=$FW_LONG_VERSION 220 | FW_REV=$FW_REV 221 | FW_REVISION=$FW_REVISION 222 | FW_VARIANT=$FW_VARIANT 223 | FW_SUFFIX=$FW_SUFFIX 224 | 8311_VER 225 | 226 | 227 | REAL_OUT=$(realpath "$OUT_DIR") 228 | 229 | OUT_BOOTCORE="$REAL_OUT/bootcore.bin" 230 | [ "$BOOTCORE" = "$OUT_BOOTCORE" ] || cp -fv "$BOOTCORE" "$OUT_BOOTCORE" 231 | OUT_KERNEL="$REAL_OUT/kernel.bin" 232 | [ "$KERNEL" = "$OUT_KERNEL" ] || cp -fv "$KERNEL" "$OUT_KERNEL" 233 | 234 | IMG_OUT="${IMG_OUT:-"$REAL_OUT/local-upgrade.img"}" 235 | TAR_OUT="${TAR_OUT:-"$REAL_OUT/local-upgrade.tar"}" 236 | 237 | mksquashfs "$ROOT_DIR" "$ROOTFS" -all-root -noappend -no-xattrs -comp xz -b 256K -all-time "$GIT_EPOCH" -mkfs-time "$GIT_EPOCH" || _err "Error creating new rootfs image" 238 | 239 | . mods/reset-mods.sh 240 | 241 | mksquashfs "$ROOT_DIR" "$ROOTFS_RESET" -all-root -noappend -no-xattrs -comp xz -b 256K -all-time "$GIT_EPOCH" -mkfs-time "$GIT_EPOCH" || _err "Error creating new factory reset rootfs image" 242 | 243 | touch -d "@$GIT_EPOCH" "$ROOTFS" "$ROOTFS_RESET" 244 | OUT_UROOTFS="$REAL_OUT/urootfs.img" 245 | OUT_UROOTFS_RESET="$REAL_OUT/urootfs-reset.img" 246 | SOURCE_DATE_EPOCH="$GIT_EPOCH" mkimage -A MIPS -O Linux -T filesystem -C none -n "$FW_LONG_VERSION" -d "$ROOTFS" "$OUT_UROOTFS" 247 | SOURCE_DATE_EPOCH="$GIT_EPOCH" mkimage -A MIPS -O Linux -T filesystem -C none -n "MC Factory Reset $FW_VER" -d "$ROOTFS_RESET" "$OUT_UROOTFS_RESET" 248 | 249 | #OUT_UMULTI="$REAL_OUT/uMulti.img" 250 | #mkimage -A MIPS -O Linux -T multi -C none -n "MC $FW_LONG_VERSION" -d "$OUT_KERNEL:$OUT_BOOTCORE:$OUT_UROOTFS" "$OUT_UMULTI" 251 | 252 | OUT_MCUPG="$REAL_OUT/multicast_upgrade.img" 253 | cat "$OUT_KERNEL" "$OUT_BOOTCORE" "$OUT_UROOTFS" > "$OUT_MCUPG" 254 | 255 | OUT_MCRESET="$REAL_OUT/multicast_reset.img" 256 | cat "$OUT_KERNEL" "$OUT_BOOTCORE" "$OUT_UROOTFS_RESET" > "$OUT_MCRESET" 257 | 258 | touch -d "@$GIT_EPOCH" "$OUT_MCUPG" "$OUT_MCRESET" 259 | 260 | CREATE=("-b" "$OUT_BOOTCORE" "-k" "$OUT_KERNEL" "-r" "$ROOTFS" -D "@$GIT_EPOCH") 261 | ./create.sh --basic -i "$TAR_OUT" -F "$VERSION_FILE" "${CREATE[@]}" 262 | ./create.sh --bfw -i "$IMG_OUT" -V "$FW_VER" -L "$FW_LONG_VERSION" -H "$HEADER" "${CREATE[@]}" 263 | 264 | rm -fv "$HEADER" "$KERNEL_BFW" "$BOOTCORE_BFW" "$ROOTFS_BFW" "$OUT_UROOTFS" "$OUT_UROOTFS_RESET" "$ROOTFS_RESET" 265 | 266 | ./wholeImage.sh "$GIT_EPOCH" 267 | 268 | if $RELEASE; then 269 | cd "$REAL_OUT" 270 | REL_NAME="WAS-110_8311_firmware_mod_${FW_VERSION}_${FW_VARIANT}" 271 | 7z a -md=128m -mx=9 -ms=on -mmt=on -mmtf=on -m0=LZMA2 "$REL_NAME.7z" -- "local-upgrade.tar" "local-upgrade.img" "multicast_upgrade.img" "multicast_reset.img" "bootcore.bin" "kernel.bin" "rootfs.img" "whole-image.img" 272 | cd "$BASE_DIR" 273 | cat "files/7z/7zsd_LZMA2_upx.sfx" "files/7z/was-110.cfg" "$REAL_OUT/$REL_NAME.7z" > "$REAL_OUT/$REL_NAME.exe" 274 | fi 275 | 276 | echo "Firmware build $FW_LONG_VERSION complete." 277 | -------------------------------------------------------------------------------- /copy_packages.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | COMMON_PACKAGES=( 3 | "busybox" 4 | "dropbear" 5 | "fping" 6 | "htop" 7 | "libc" 8 | "libncurses6" 9 | "libpcre2" 10 | "libzstd" 11 | "lrzsz" 12 | "mtr" 13 | "nand-utils" 14 | "nano" 15 | "terminfo" 16 | "zoneinfo-[a-z]+" 17 | "zstd" 18 | ) 19 | 20 | BASIC_PACKAGES=( 21 | "liblucihttp" 22 | "liblucihttp0" 23 | "libmbedtls12" 24 | "libuhttpd-mbedtls" 25 | "libustream-mbedtls[0-9]+" 26 | "luci-base" 27 | "luci-lib-ip" 28 | "luci-lib-nixio" 29 | "luci-lib-px5g" 30 | "luci-mod-status" 31 | "luci-mod-system" 32 | "luci-theme-bootstrap" 33 | # "luci-theme-material" 34 | # "luci-theme-openwrt" 35 | "px5g-mbedtls" 36 | "rpcd-mod-luci" 37 | "uhttpd-mod-lua" 38 | "uhttpd-mod-ubus" 39 | "uhttpd" 40 | ) 41 | 42 | BFW_PACKAGES=( 43 | ) 44 | 45 | REMOVE_PACKAGES=( 46 | "luci-app-advanced-reboot" 47 | "luci-app-commands" 48 | "luci-app-firewall" 49 | "luci-app-opkg" 50 | "luci-mod-network" 51 | "luci-theme-openwrt" 52 | ) 53 | 54 | 55 | IPKS=$(find openwrt/bin/ | grep '\.ipk$' | sort -V) 56 | 57 | find_ipks() { 58 | pcregrep "/($1)_[A-Za-z0-9._+-]+\.ipk" <<< "$IPKS" 59 | } 60 | 61 | mkdir -p packages/common packages/basic packages/bfw packages/remove 62 | rm -fv packages/common/*.ipk packages/basic/*.ipk packages/bfw/*.ipk packages/remove/*.list 63 | 64 | for PACKAGE in "${COMMON_PACKAGES[@]}"; do 65 | IPK=$(find_ipks "$PACKAGE") 66 | [ -n "$IPK" ] && cp -fv $IPK packages/common/ 67 | done 68 | 69 | for PACKAGE in "${BASIC_PACKAGES[@]}"; do 70 | IPK=$(find_ipks "$PACKAGE") 71 | [ -n "$IPK" ] && cp -fv $IPK packages/basic/ 72 | done 73 | 74 | for PACKAGE in "${BFW_PACKAGES[@]}"; do 75 | IPK=$(find_ipks "$PACKAGE") 76 | [ -n "$IPK" ] && cp -fv $IPK packages/bfw/ 77 | done 78 | 79 | for PACKAGE in "${REMOVE_PACKAGES[@]}"; do 80 | for IPK in $(find_ipks "$PACKAGE"); do 81 | LIST="packages/remove/$(basename "$IPK" ".ipk").list" 82 | echo "Creating file list '$LIST' from '$(basename "$IPK")'" 83 | tar xfz "$IPK" -O -- "./data.tar.gz" | tar tz | sed -r 's#^\./##g' > "$LIST" 84 | done 85 | done 86 | -------------------------------------------------------------------------------- /create.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | _help() { 3 | printf -- 'Tool for creating new WAS-110 local upgrade images\n\n' 4 | printf -- 'Usage: %s [options]\n\n' "$0" 5 | printf -- 'Options:\n' 6 | printf -- '-i --image \t\t\tSpecify local upgrade (img or tar) file to create (required).\n' 7 | printf -- '-w --basic\t\t\t\tBuild a basic local upgrade tar file.\n' 8 | printf -- '-W --bfw\t\t\t\tBuild a bfw local upgrade image file.\n' 9 | printf -- '-H --header \t\t\tSpecify filename of image header to base image off of (default: header.bin).\n' 10 | printf -- '-b --bootcore \t\tSpecify filename of bootcore image to place in created (bfw) image (default: bootcore.bin).\n' 11 | printf -- '-k --kernel \t\t\tSpecify filename of kernel image to place in created image (default: kernel.bin).\n' 12 | printf -- '-r --rootfs \t\t\tSpecify filename of rootfs image to place in created image (default: rootfs.img).\n' 13 | printf -- '-F --version-file \t\tSpecify 8311 version file of basic firmeware image.\n' 14 | printf -- '-V --image-version \t\tSpecify version string to set on created image (15 characters max).\n' 15 | printf -- '-L --image-long-version \tSpecify detailed version string to set on created bfw image (31 characters max).\n' 16 | printf -- '-D --date \t\tSpecify date to use on all files. Helps with reproducability.\n' 17 | printf -- '-h --help\t\t\t\tThis help text\n' 18 | } 19 | 20 | OUT= 21 | HEADER="header.bin" 22 | BOOTCORE="bootcore.bin" 23 | KERNEL="kernel.bin" 24 | ROOTFS="rootfs.img" 25 | UPGRADE_SCRIPT="files/common/usr/sbin/8311-firmware-upgrade.sh" 26 | VERSION= 27 | LONGVERSION= 28 | VARIANT="bfw" 29 | VERSION_FILE= 30 | DATE="@$(date '+%s')" 31 | 32 | while [ $# -gt 0 ]; do 33 | case "$1" in 34 | -i|--image) 35 | OUT="$2" 36 | shift 37 | ;; 38 | -w|--basic) 39 | VARIANT="basic" 40 | ;; 41 | -W|--bfw) 42 | VARIANT="bfw" 43 | ;; 44 | -H|--header) 45 | HEADER="$2" 46 | shift 47 | ;; 48 | -b|--bootcore) 49 | BOOTCORE="$2" 50 | shift 51 | ;; 52 | -k|--kernel) 53 | KERNEL="$2" 54 | shift 55 | ;; 56 | -r|--rootfs) 57 | ROOTFS="$2" 58 | shift 59 | ;; 60 | -F|--version-file) 61 | VERSION_FILE="$2" 62 | shift 63 | ;; 64 | -V|--image-version) 65 | VERSION="$2" 66 | shift 67 | ;; 68 | -L|--image-long-version) 69 | LONGVERSION="$2" 70 | shift 71 | ;; 72 | -D|--date) 73 | DATE="$2" 74 | shift 75 | ;; 76 | --help|-h) 77 | _help 78 | exit 0 79 | ;; 80 | *) 81 | _help 82 | exit 1 83 | ;; 84 | esac 85 | shift 86 | done 87 | 88 | _err() { 89 | echo "$1" >&2 90 | exit ${2:-1} 91 | } 92 | 93 | sha256() { 94 | sha256sum "$@" | awk '{print $1}' 95 | } 96 | 97 | file_size() { 98 | stat -c '%s' "$1" 99 | } 100 | 101 | sed_escape() { 102 | sed 's#\\#\\\\#g' | sed 's/#/\\#/g' 103 | } 104 | 105 | tar_trans() { 106 | local INPUT="$(echo "$1" | sed_escape)" 107 | local NAME="$(echo "$2" | sed_escape)" 108 | echo "s#$INPUT#$NAME#" 109 | } 110 | 111 | bfw_add_image() { 112 | IMAGE="$1" 113 | FILE="${2:-$1}" 114 | 115 | NAME_OFFSET=$((FILE_OFFSET + NUM * 48)) 116 | SIZE_OFFSET=$((NAME_OFFSET + 32)) 117 | if [ ! -f "$FILE" ]; then 118 | echo "File '$FILE' for image '$IMAGE' does not exist" >&2 119 | exit 1 120 | fi 121 | 122 | FILES+=("$FILE") 123 | 124 | SIZE=$(stat -c "%s" "$FILE") 125 | 126 | echo "Adding image #$NUM ($IMAGE) from '$FILE' ($SIZE bytes)" 127 | { echo -n "$IMAGE"; cat /dev/zero; } | dd of="$OUT" seek="$NAME_OFFSET" bs=1 count=32 conv=notrunc 2>/dev/null 128 | { echo -n "$SIZE"; cat /dev/zero; } | dd of="$OUT" seek="$SIZE_OFFSET" bs=1 count=16 conv=notrunc 2>/dev/null 129 | 130 | cat "$FILE" >> "$OUT" 131 | 132 | DATA_OFFSET=$((DATA_OFFSET + SIZE)) 133 | NUM=$((NUM + 1)) 134 | } 135 | 136 | set -e 137 | 138 | [ -n "$OUT" ] || _err "Error: Image file to create must be specified." 139 | [ -n "$BOOTCORE" ] || _err "Error: bootcore file must be specified." 140 | [ -f "$BOOTCORE" ] || _err "Error: bootcore file '$BOOTCORE' not found." 141 | [ -n "$KERNEL" ] || _err "Error: kernel file must be specified." 142 | [ -f "$KERNEL" ] || _err "Error: kernel file '$KERNEL' not found." 143 | [ -n "$ROOTFS" ] || _err "Error: rootfs file must be specified." 144 | [ -f "$ROOTFS" ] || _err "Error: rootfs file '$ROOTFS' not found." 145 | 146 | touch -d "$DATE" "$BOOTCORE" "$KERNEL" "$ROOTFS" 147 | 148 | if [ "$VARIANT" = "basic" ]; then 149 | [ -n "$VERSION_FILE" ] || _err "Error: version file must be specified." 150 | [ -f "$VERSION_FILE" ] || _err "Error: version file '$VERSION_FILE' not found." 151 | 152 | SHA256_KERNEL=$(sha256 "$KERNEL") 153 | SHA256_BOOTCORE=$(sha256 "$BOOTCORE") 154 | SHA256_ROOTFS=$(sha256 "$ROOTFS") 155 | 156 | SIZE_KERNEL=$(file_size "$KERNEL") 157 | SIZE_BOOTCORE=$(file_size "$BOOTCORE") 158 | SIZE_ROOTFS=$(file_size "$ROOTFS") 159 | 160 | VER_8311=$(cat "$VERSION_FILE") 161 | 162 | CONTROL="$(mktemp)" 163 | cat > "$CONTROL" < "$OUT" 206 | 207 | if [ -n "$VERSION" ]; then 208 | echo "Setting image version string to '$VERSION'" 209 | { echo -n "$VERSION" | head -c 15; cat /dev/zero; } | dd of="$OUT" seek="$VERSION_OFFSET" bs=1 count=16 conv=notrunc 2>/dev/null 210 | fi 211 | 212 | if [ -n "$LONGVERSION" ]; then 213 | echo "Setting long image version string to '$LONGVERSION'" 214 | { echo -n "$LONGVERSION" | head -c 31; cat /dev/zero; } | dd of="$OUT" seek="$LONGVERSION_OFFSET" bs=1 count=32 conv=notrunc 2>/dev/null 215 | fi 216 | 217 | bfw_add_image "bootcore.bin" "$BOOTCORE" 218 | bfw_add_image "kernel.bin" "$KERNEL" 219 | bfw_add_image "rootfs.img" "$ROOTFS" 220 | 221 | CONTENT_CRC_OFFSET=$((0x66)) 222 | HEADER_CRC_OFFSET=$((0x6A)) 223 | 224 | echo "Updating CRCs" 225 | { cat "${FILES[@]}" | tools/bfw-crc.pl; cat /dev/zero; } | dd of="$OUT" seek="$CONTENT_CRC_OFFSET" bs=1 count=8 conv=notrunc 2>/dev/null 226 | head -c "$LEN_HDR" "$OUT" | tools/bfw-crc.pl | dd of="$OUT" seek="$HEADER_CRC_OFFSET" bs=1 count=4 conv=notrunc 2>/dev/null 227 | 228 | touch -d "$DATE" "$OUT" 229 | echo "Local upgrade image file '$OUT' created successfully." 230 | fi 231 | -------------------------------------------------------------------------------- /extract.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | _help() { 3 | printf -- 'Tool for extracting stock WAS-110 local upgrade images\n\n' 4 | printf -- 'Usage: %s [options]\n\n' "$0" 5 | printf -- 'Options:\n' 6 | printf -- '-i --image \t\tSpecify local upgrade image file to extract (required).\n' 7 | printf -- '-H --header \t\tSpecify filename to extract image header to (default: header.bin).\n' 8 | printf -- '-b --bootcore \tSpecify filename to extract bootcore image to (default: bootcore.bin).\n' 9 | printf -- '-k --kernel \t\tSpecify filename to extract kernel image to (default: kernel.bin).\n' 10 | printf -- '-r --rootfs \t\tSpecify filename to extract rootfs image to (default: rootfs.img).\n' 11 | printf -- '-h --help\t\t\tThis help text\n' 12 | } 13 | 14 | LOCAL= 15 | HEADER="header.bin" 16 | BOOTCORE="bootcore.bin" 17 | KERNEL="kernel.bin" 18 | ROOTFS="rootfs.img" 19 | 20 | while [ $# -gt 0 ]; do 21 | case "$1" in 22 | -i|--image) 23 | LOCAL="$2" 24 | shift 25 | ;; 26 | -H|--header) 27 | HEADER="$2" 28 | shift 29 | ;; 30 | -b|--bootcore) 31 | BOOTCORE="$2" 32 | shift 33 | ;; 34 | -k|--kernel) 35 | KERNEL="$2" 36 | shift 37 | ;; 38 | -r|--rootfs) 39 | ROOTFS="$2" 40 | shift 41 | ;; 42 | --help|-h) 43 | _help 44 | exit 0 45 | ;; 46 | *) 47 | _help 48 | exit 1 49 | ;; 50 | esac 51 | shift 52 | done 53 | 54 | _err() { 55 | echo "$1" >&2 56 | exit ${2:-1} 57 | } 58 | 59 | set -e 60 | 61 | [ -n "$LOCAL" ] || _err "Error: Image file to extract must be specified." 62 | [ -f "$LOCAL" ] || _err "Error: Image file '$LOCAL' does not exist." 63 | [ -n "$HEADER" ] || _err "Error: Invalid header file specified." 64 | [ -n "$BOOTCORE" ] || _err "Error: Invalid bootcore file specified." 65 | [ -n "$KERNEL" ] || _err "Error: Invalid kernel file specified." 66 | [ -n "$ROOTFS" ] || _err "Error: Invalid rootfs file specified." 67 | 68 | [ "$(head -c 16 "$LOCAL")" = '~@$^*)+ATOS!#%&(' ] || _err "Invalid magic string" 69 | 70 | LEN_HDR=$((0xD00)) 71 | 72 | echo "Extracting image header to '$HEADER' ($LEN_HDR bytes)" 73 | head -c "$LEN_HDR" "$LOCAL" > "$HEADER" 74 | 75 | POS=$LEN_HDR 76 | NUM=0 77 | FILE_OFFSET=$((0x100)) 78 | 79 | extract_image() { 80 | IMAGE="$1" 81 | OUT="${2:-$1}" 82 | 83 | DETAIL_OFFSET=$((FILE_OFFSET + (NUM + 1) * 48)) 84 | FILE=$(head -c $((DETAIL_OFFSET - 16)) "$HEADER" | tail -c 32 | awk -F'\0+' '{print $1}') 85 | if ! [ "$FILE" = "$IMAGE" ]; then 86 | echo "Image '$IMAGE' expected as image #$NUM" >&2 87 | exit 1 88 | fi 89 | 90 | LEN=$((0 + $(head -c $DETAIL_OFFSET "$HEADER" | tail -c 16 | awk -F'\0+' '{print $1}'))) 91 | POS=$((POS + LEN)) 92 | 93 | echo "Extracting image #$NUM ($IMAGE) to '$OUT' ($LEN bytes)" 94 | head -c "$POS" "$LOCAL" | tail -c "$LEN" > "$OUT" 95 | SIZE=$(stat -c "%s" "$OUT") 96 | if [ "$SIZE" -ne "$LEN" ]; then 97 | echo "Extracted Image '$OUT' is not the expected size (expected: $LEN, actual: $SIZE)" >&2 98 | exit 1 99 | fi 100 | 101 | NUM=$((NUM + 1)) 102 | } 103 | 104 | 105 | extract_image "bootcore.bin" "$BOOTCORE" 106 | extract_image "kernel.bin" "$KERNEL" 107 | extract_image "rootfs.img" "$ROOTFS" 108 | 109 | 110 | -------------------------------------------------------------------------------- /files/7z/7zsd_LZMA2.sfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/files/7z/7zsd_LZMA2.sfx -------------------------------------------------------------------------------- /files/7z/7zsd_LZMA2_upx.sfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/files/7z/7zsd_LZMA2_upx.sfx -------------------------------------------------------------------------------- /files/7z/was-110.cfg: -------------------------------------------------------------------------------- 1 | ;!@Install@!UTF-8! 2 | InstallPath="%Temp%\\8311" 3 | Title="8311 WAS-110 Community Firmware" 4 | BeginPrompt="Extract to %%T? 5 | 6 | After extraction is completed, a command prompt will open at this location to facility easier shell firmware upgrade." 7 | ExtractDialogText="Extracting to %%T" 8 | RunProgram="\"explorer.exe\" \"%%T\"" 9 | RunProgram="\"cmd.exe\" /K \"cd %%T\"" 10 | ;!@InstallEnd@! 11 | -------------------------------------------------------------------------------- /files/basic/lib/8311_backend.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | _lib_8311 2>/dev/null || . /lib/8311.sh 4 | _lib_hexbin 2>/dev/null || . /lib/functions/hexbin.sh 5 | 6 | _set_8311_gpon_sn() { 7 | uci set gpon.ploam.nSerial="$1" 8 | uci commit gpon 9 | } 10 | 11 | _set_8311_device_sn() { 12 | # not implemented 13 | return 0 14 | } 15 | 16 | _set_8311_vendor_id() { 17 | # handled in base function 18 | return 0 19 | } 20 | 21 | _set_8311_reg_id_hex() { 22 | local hex=$({ echo "$1" | hex2str; cat /dev/zero 2>/dev/null; } | head -c 36 | str2hex | sed -r 's#([0-9A-F]{2})# 0x\1#gI') 23 | uci set gpon.ploam.regID="$hex" 24 | uci commit gpon 25 | } 26 | 27 | _set_8311_sw_ver() { 28 | # handled in uboot_img_vars.sh 29 | return 0 30 | } 31 | 32 | _set_8311_override_active() { 33 | # handled in uboot_img_vars.sh 34 | return 0 35 | } 36 | 37 | _set_8311_hw_ver() { 38 | # handled in base function 39 | return 0 40 | } 41 | 42 | _set_8311_equipment_id() { 43 | # handled in base function 44 | return 0 45 | } 46 | 47 | _set_8311_ipaddr() { 48 | # handled by uci-defaults 49 | return 0 50 | } 51 | 52 | _set_8311_netmask() { 53 | # handled by uci-defaults 54 | return 0 55 | } 56 | 57 | _set_8311_gateway() { 58 | # handled by uci-defaults 59 | return 0 60 | } 61 | 62 | _set_8311_lct_mac() { 63 | # handled by uci-defaults 64 | return 0 65 | } 66 | 67 | _set_8311_iphost_mac() { 68 | # handled by uci-defaults 69 | return 0 70 | } 71 | -------------------------------------------------------------------------------- /files/basic/lib/preinit/90_8311_mounts: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | _lib_8311 2>/dev/null || . /lib/8311.sh 4 | 5 | _8311_mounts() { 6 | ubinfo /dev/ubi0 -N ptconf &>/dev/null && { 7 | echo "Mounting /ptconf partition" | to_console 8 | mount -o sync -t ubifs ubi0:ptconf /ptconf 9 | } 10 | } 11 | 12 | [ "$INITRAMFS" = "1" ] || boot_hook_add preinit_main _8311_mounts 13 | -------------------------------------------------------------------------------- /files/basic/usr/bin/luci-me-dump: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | omci_pipe.sh md | sed -r 's#^(\|\s+(\d+)\s+\|\s+(\d+)\s+.+)$#\1#g' 3 | -------------------------------------------------------------------------------- /files/basic/usr/lib/lua/8311/tools.lua: -------------------------------------------------------------------------------- 1 | 2 | local require = require 3 | local string = string 4 | local setmetatable = setmetatable 5 | 6 | module "8311.tools" 7 | 8 | local util = require "luci.util" 9 | 10 | function html_escape(text) 11 | if text == nil then text = "" end 12 | text = "" .. text 13 | 14 | return text:gsub("%S+", { 15 | ["&"] = "&", 16 | ["<"] = "<", 17 | [">"] = ">", 18 | ['"'] = """, 19 | ["'"] = "'" 20 | }) 21 | end 22 | 23 | function nl2br(text) 24 | if text == nil then text = "" end 25 | return string.gsub("" .. text, "\n", "
\n") 26 | end 27 | 28 | function fw_getenv(t) 29 | setmetatable(t, {__index={key=nil, default=nil, base64=false}}) 30 | 31 | return fwenv_get( 32 | t[1] or t.key, 33 | t[2] or t.default, 34 | false, 35 | t[3] or t.base64 36 | ) 37 | end 38 | 39 | function fw_getenv_8311(t) 40 | setmetatable(t, {__index={key=nil, default=nil, base64=false}}) 41 | 42 | return fwenv_get( 43 | t[1] or t.key, 44 | t[2] or t.default, 45 | true, 46 | t[3] or t.base64 47 | ) 48 | end 49 | 50 | function fwenv_get(key, default, _8311, base64) 51 | if not key then return false end 52 | 53 | local _8311_arg, base64_arg, default_arg = "", "", "" 54 | if _8311 then _8311_arg = "--8311 " end 55 | if base64 then base64_arg = "--base64 " end 56 | if default then default_arg = " " .. util.shellquote(default) end 57 | 58 | return string.gsub(util.exec("fwenv_get " .. _8311_arg .. base64_arg .. util.shellquote(key) .. default_arg), '[\r\n]+$', "") 59 | end 60 | 61 | function fw_getenvs_8311() 62 | local fwenvs = {} 63 | for k, v in string.gmatch(util.exec('echo ; fw_printenv | grep "^8311_"'), '\n8311_([^\n=]+)=([^\r\n]+)') do 64 | fwenvs[k] = v 65 | end 66 | 67 | return fwenvs 68 | end 69 | 70 | function fw_setenv(t) 71 | setmetatable(t, {__index={key=nil, value=nil, base64=false}}) 72 | 73 | return fwenv_set( 74 | t[1] or t.key, 75 | t[2] or t.value, 76 | false, 77 | t[3] or t.base64 78 | ) 79 | end 80 | 81 | function fw_setenv_8311(t) 82 | setmetatable(t, {__index={key=nil, value=nil, base64=false}}) 83 | 84 | return fwenv_set( 85 | t[1] or t.key, 86 | t[2] or t.value, 87 | true, 88 | t[3] or t.base64 89 | ) 90 | end 91 | 92 | function fwenv_set(key, value, _8311, base64) 93 | if not key then return false end 94 | 95 | local _8311_arg, base64_arg = "", "" 96 | if _8311 then _8311_arg = "--8311 " end 97 | if base64 then base64_arg = "--base64 " end 98 | 99 | util.exec("fwenv_set " .. _8311_arg .. base64_arg .. util.shellquote(key) .. " " .. util.shellquote(value)) 100 | end 101 | -------------------------------------------------------------------------------- /files/basic/usr/lib/lua/base64.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env lua 2 | -- Lua 5.1+ base64 v3.0 (c) 2009 by Alex Kloss 3 | -- licensed under the terms of the LGPL2 4 | 5 | -- character table string 6 | local b='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' 7 | 8 | -- encoding 9 | function enc(data) 10 | return ((data:gsub('.', function(x) 11 | local r,b='',x:byte() 12 | for i=8,1,-1 do r=r..(b%2^i-b%2^(i-1)>0 and '1' or '0') end 13 | return r; 14 | end)..'0000'):gsub('%d%d%d?%d?%d?%d?', function(x) 15 | if (#x < 6) then return '' end 16 | local c=0 17 | for i=1,6 do c=c+(x:sub(i,i)=='1' and 2^(6-i) or 0) end 18 | return b:sub(c+1,c+1) 19 | end)..({ '', '==', '=' })[#data%3+1]) 20 | end 21 | 22 | -- decoding 23 | function dec(data) 24 | data = string.gsub(data, '[^'..b..'=]', '') 25 | return (data:gsub('.', function(x) 26 | if (x == '=') then return '' end 27 | local r,f='',(b:find(x)-1) 28 | for i=6,1,-1 do r=r..(f%2^i-f%2^(i-1)>0 and '1' or '0') end 29 | return r; 30 | end):gsub('%d%d%d?%d?%d?%d?%d?%d?', function(x) 31 | if (#x ~= 8) then return '' end 32 | local c=0 33 | for i=1,8 do c=c+(x:sub(i,i)=='1' and 2^(8-i) or 0) end 34 | return string.char(c) 35 | end)) 36 | end 37 | 38 | -- command line if not called as library 39 | if (arg ~= nil) then 40 | local func = 'enc' 41 | for n,v in ipairs(arg) do 42 | if (n > 0) then 43 | if (v == "-h") then print "base64.lua [-e] [-d] text/data" break 44 | elseif (v == "-e") then func = 'enc' 45 | elseif (v == "-d") then func = 'dec' 46 | else print(_G[func](v)) end 47 | end 48 | end 49 | else 50 | module('base64',package.seeall) 51 | end 52 | -------------------------------------------------------------------------------- /files/basic/usr/lib/lua/luci/view/8311/config.htm: -------------------------------------------------------------------------------- 1 | <%- 2 | local tools = require "8311.tools" 3 | local esc = tools.html_escape 4 | local nl2br = tools.nl2br 5 | local hook_script_placeholder = "#!/bin/sh\n# /ptconf/8311/vlan_fixes_hook.sh\n\nadd your script here.." 6 | -%> 7 | 8 | <%+header%> 9 | 10 | 11 | 12 | 13 |

<%:8311 Configuration%>

14 |
15 | 16 | 21 | 22 | 28 | 29 |
30 |
31 | <%- for catid, cat in pairs(fwenvs) do -%> 32 |
data-tab-active="true"<% end %>> 33 | <%- for itemid, item in pairs(cat.items) do %> 34 | <%- 35 | local show_item = true 36 | if item.id == 'internet_vlan' or item.id == 'services_vlan' then 37 | show_item = false 38 | end 39 | %> 40 |
41 | 42 |
43 |
44 | <%- 45 | local value = nil 46 | local placeholder = nil 47 | local checked = "" 48 | local minv = "" 49 | local maxv = "" 50 | local maxlength = "" 51 | local class_attr = 'cbi-input-' .. item.type 52 | 53 | if item.type == "checkbox" or item.type == "checkbox_onoff" then 54 | item.type = "checkbox" 55 | value = "1" 56 | if item.value == '1' or item.value == "on" or (item.default and item.value ~= '0' and item.value ~= 'off') then 57 | checked=' checked="checked"' 58 | end 59 | else 60 | value = item.value 61 | if item.default and (item.type == 'text' or item.type == 'password' or item.type == 'number') then 62 | placeholder = item.default 63 | end 64 | 65 | if item.maxlength then 66 | maxlength = ' maxlength="' .. esc(item.maxlength) .. '"' 67 | end 68 | 69 | if item.type == 'number' then 70 | if item.min then 71 | minv = ' min="' .. esc(item.min) .. '"' 72 | end 73 | if item.max then 74 | maxv = ' max="' .. esc(item.max) .. '"' 75 | end 76 | end 77 | end 78 | 79 | 80 | if item.type == "select" then %> 81 | 90 | <%- elseif item.type == "select_named" then %> 91 | 99 | <%- else %> 100 | required="required"<% end %> 102 | <%= maxlength %><%= checked %><%= minv %><%= maxv %> 103 | <% if placeholder then %> placeholder="<%= esc(placeholder) %>"<% end %> data-cat-id="<%= cat.id %>" 104 | <% if item.type == 'text' and item.pattern then %> pattern="<%= esc(item.pattern) %>"<% end %> /> 105 | <% end %> 106 | 107 |
108 | <% if item.description then %> 109 |
<%= nl2br(esc(item.description)) %>
110 | <% end %> 111 |
112 |
113 | <% if item.id == 'fix_vlans' then %> 114 |
115 | 116 |
117 | 118 | <%:Note: The hook script works unless Fix VLANs is set to Disabled.%> 119 |
120 |
121 | <% end %> 122 | <% end %> 123 |
124 | <% end %> 125 |
126 | 127 |
128 | 129 | 140 | 141 | <%+footer%> 142 | -------------------------------------------------------------------------------- /files/basic/usr/lib/lua/luci/view/8311/firmware.htm: -------------------------------------------------------------------------------- 1 | <% 2 | local tools = require "8311.tools" 3 | local esc = tools.html_escape 4 | 5 | local action = "validate" 6 | local upload_enable = true 7 | local install_enable = false 8 | local cancel_enable = false 9 | local reboot_enable = false 10 | local i18n = require "luci.i18n" 11 | local translate = i18n.translate 12 | -%> 13 | 14 | <%+header%> 15 | 16 | 17 | 18 | 19 | 20 |

<%:Firmware%>

21 |
22 | 23 |
24 |

<%:Active Firmware%> (<%= esc(version.bank) %>)

25 |
26 |
27 |
28 |
<%:Version%>
29 |
<%= esc(version.version) %>
30 |
31 |
32 |
<%:Revision%>
33 |
<%= esc(version.revision) %>
34 |
35 |
36 |
<%:Variant%>
37 |
<%= esc(version.variant) %>
38 |
39 |
40 |
41 |
42 | 43 |
44 |

<%:Inactive Firmware%> (<%= esc(altversion.bank) %>)

45 |
46 |
47 |
48 |
<%:Version%>
49 |
<%= esc(altversion.version) %>
50 |
51 |
52 |
<%:Revision%>
53 |
<%= esc(altversion.revision) %>
54 |
55 |
56 |
<%:Variant%>
57 |
<%= esc(altversion.variant) %>
58 |
59 |
60 |
61 | <% if not install_enable and not firmware_file_exists and firmware_action ~="switch_reboot" then %> 62 |
63 |
64 | 65 |
66 | 71 |
72 | <% end %> 73 |
74 | <% if firmware_action ~="switch_reboot" then %> 75 |
76 |

<%:Firmware Upgrade%>

77 | 78 |
79 |
80 |
81 | <% if not firmware_file_exists then %> 82 |
83 | 84 | 85 |
86 | <%:Upload firmware file here, typically named local-upgrade.tar%> 87 |
88 |
89 | <% end %> 90 | <% if firmware_file_exists then 91 | cancel_enable = true 92 | upload_enable = false 93 | 94 | if firmware_exec and firmware_exec.code ~= 0 then 95 | action = "cancel" 96 | else 97 | if firmware_action == "validate" then 98 | install_enable = true 99 | elseif firmware_action == "install" then 100 | reboot_enable = true 101 | elseif firmware_action == "install_reboot" then 102 | cancel_enable = false 103 | elseif firmware_action == "reboot" then 104 | cancel_enable = false 105 | firmware_output = translate("Rebooting…") 106 | end 107 | end 108 | %> 109 | <% end %> 110 |
111 |
112 | <% if upload_enable then %> 113 | 114 | <% end %> 115 | <% if install_enable then %> 116 | 117 | 118 | <% end %> 119 | <% if cancel_enable then %> 120 | 121 | <% end %> 122 | <% if reboot_enable then %> 123 | 124 | <% end %> 125 | 126 |
127 | <% end %> 128 | <% if firmware_output and firmware_output ~="" then %> 129 |
<%= esc(firmware_output) %>
130 | <% end %> 131 |
132 | 133 | <%+footer%> 134 | -------------------------------------------------------------------------------- /files/basic/usr/lib/lua/luci/view/8311/pon_me.htm: -------------------------------------------------------------------------------- 1 | <%+header%> 2 | 3 | 4 | 5 |

<%:PON ME Explorer%>

6 |
7 | 8 |
 9 | <%= omci %>
10 | 
11 | 12 | 13 | 16 | 17 | <%+footer%> 18 | -------------------------------------------------------------------------------- /files/basic/usr/lib/lua/luci/view/8311/pon_status.htm: -------------------------------------------------------------------------------- 1 | <% 2 | 3 | local tools = require "8311.tools" 4 | local esc = tools.html_escape 5 | -%> 6 | 7 | <%+header%> 8 | 9 | 10 | 11 |

<%:PON Status%>

12 |
13 | 14 |
    15 | <% for pageid, page in pairs(pages) do %> 16 |
  • style="display: none"<% end %>> 18 | <%= esc(page.label) %>
  • 19 | <% end %> 20 |
21 |
22 | 24 |
25 | 26 | 31 | 32 | <%+footer%> 33 | -------------------------------------------------------------------------------- /files/basic/usr/lib/lua/luci/view/8311/support.htm: -------------------------------------------------------------------------------- 1 | <% 2 | local tools = require "8311.tools" 3 | local esc = tools.html_escape 4 | 5 | local action = "validate" 6 | local upload_enable = true 7 | local install_enable = false 8 | local cancel_enable = false 9 | local reboot_enable = false 10 | local i18n = require "luci.i18n" 11 | local translate = i18n.translate 12 | -%> 13 | 14 | <%+header%> 15 | 16 | 17 | 18 | 19 |

<%:Support%>

20 |
21 | 22 |
23 |

<%:Support Archive%>

24 | 25 |

<%:A support archive contains diagnostic information used to help identify any underlying issues when attempting to bypass.%>

26 |

<%:Connect the fiber for at least 30 seconds before generating a support archive.%>

27 |

<%:WARNING: A support archive contains potentially sensitive information. Do not share it publically.%>

28 | 29 |
30 |
31 |
32 | <% if support_output ~= '' then %> 33 |
<%= esc(support_output) %>
34 | <% end %> 35 |
36 |
37 | 38 | <% if support_file_exists then %> 39 | 40 | 41 | <% end %> 42 | 43 | 44 |
45 |
46 | 47 | <%+footer%> 48 | -------------------------------------------------------------------------------- /files/basic/usr/lib/lua/luci/view/8311/vlans.htm: -------------------------------------------------------------------------------- 1 | <%+header%> 2 | 3 | 4 | 5 |

<%:VLAN Tables%>

6 |
7 | 8 |
9 | 11 |
12 | 13 | 18 | 19 | <%+footer%> 20 | -------------------------------------------------------------------------------- /files/basic/usr/lib/lua/luci/view/themes/bootstrap/footer.htm: -------------------------------------------------------------------------------- 1 | <%# 2 | Copyright 2008 Steven Barth 3 | Copyright 2008 Jo-Philipp Wich 4 | Copyright 2012 David Menting 5 | Licensed to the public under the Apache License 2.0. 6 | -%> 7 | 8 | <% local ver = require "luci.version" %> 9 | <% local ver8311 = require "8311.version" %> 10 | <% local lang = luci.i18n.context.lang %> 11 | 12 | 27 | 28 | <% if luci.dispatcher.context.authsession then %> 29 | 30 | <% end %> 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /files/basic/usr/lib/lua/nixio/bit.lua: -------------------------------------------------------------------------------- 1 | module "nixio.bit" 2 | -------------------------------------------------------------------------------- /files/basic/www/luci-static/resources/logo_8311.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/files/basic/www/luci-static/resources/logo_8311.png -------------------------------------------------------------------------------- /files/basic/www/luci-static/resources/view/8311.css: -------------------------------------------------------------------------------- 1 | select.error, input.error { 2 | border-color: red !important; 3 | background-color: lightpink !important; 4 | } 5 | 6 | label.error { 7 | color: red !important; 8 | } 9 | 10 | input#firmware-file::file-selector-button { 11 | display: none; 12 | } 13 | 14 | #hook-script-modal { 15 | position: fixed; 16 | top: 0; 17 | left: 0; 18 | width: 100%; 19 | height: 100%; 20 | display: none; 21 | z-index: 1000; 22 | } 23 | 24 | #hook-script-overlay { 25 | position: absolute; 26 | top: 0; 27 | left: 0; 28 | width: 100%; 29 | height: 100%; 30 | background-color: black; 31 | opacity: 0.5; 32 | } 33 | 34 | #hook-script-box { 35 | position: absolute; 36 | background-color: white; 37 | max-width: 80%; 38 | width: 55%; 39 | padding: 10px; 40 | box-sizing: border-box; 41 | top: 50%; 42 | left: 50%; 43 | transform: translate(-50%, -50%); 44 | overflow: hidden; 45 | } 46 | 47 | #hook-script-message { 48 | margin-bottom: 5px; 49 | } 50 | 51 | #hook-script-textarea { 52 | width: 100%; 53 | min-height: 30vh; 54 | height: auto; 55 | max-height: 85vh; 56 | resize: none; 57 | } 58 | 59 | #hook-script-buttons { 60 | margin-top: 10px; 61 | text-align: right; 62 | } 63 | 64 | #hook-script-save-btn, 65 | #hook-script-cancel-btn { 66 | margin-left: 5px; 67 | } -------------------------------------------------------------------------------- /files/basic/www/luci-static/resources/view/8311.js: -------------------------------------------------------------------------------- 1 | function switchTab(tab) { 2 | activeTab = $('li.cbi-tab'); 3 | activeTab.addClass('cbi-tab-disabled'); 4 | activeTab.removeClass('cbi-tab'); 5 | 6 | var selectTab = $('li[data-tab=' + tab + ']'); 7 | selectTab.addClass('cbi-tab'); 8 | selectTab.removeClass('cbi-tab-disabled'); 9 | 10 | activeContainer = $('div[data-tab-active=true]'); 11 | if (activeContainer) 12 | activeContainer.removeAttr('data-tab-active'); 13 | 14 | selectContainer = $('div[data-tab=' + tab + ']'); 15 | if (selectContainer) 16 | selectContainer.attr('data-tab-active', 'true'); 17 | } 18 | 19 | function saveConfig(form) { 20 | const field = Array.from(form.elements); 21 | var saveb = $('#save-btn'); 22 | var valid = true; 23 | 24 | var activeTab = $('li.cbi-tab[data-tab]').attr('data-tab'); 25 | if (activeTab) { 26 | localStorage.setItem('activeConfigTab', activeTab); 27 | } 28 | 29 | field.forEach(i => { 30 | var element = $(i); 31 | var element_id = element.attr('id'); 32 | var error_label = $('label.error[for="' + element_id + '"]'); 33 | 34 | if (!i.checkValidity()) { 35 | valid = false; 36 | error_label.text(i.validationMessage); 37 | error_label.show(); 38 | 39 | element.addClass("error"); 40 | 41 | switchTab(element.data("cat-id")); 42 | element.focus(); 43 | } 44 | else { 45 | element.removeClass("error"); 46 | error_label.text(""); 47 | error_label.hide(); 48 | } 49 | }); 50 | 51 | if (valid) { 52 | saveb.attr('disabled', 'disabled'); 53 | saveb.addClass('spinning'); 54 | } 55 | 56 | return valid; 57 | } 58 | 59 | function vlanTables() { 60 | vlans = $('#syslog'); 61 | 62 | vlans.text("Loading..."); 63 | $.ajax({ 64 | url: 'vlans/extvlans', 65 | dataType: 'text' 66 | }).done(function(data) { 67 | vlans.text(data); 68 | }); 69 | } 70 | 71 | function switchTabPonStatus(tab) { 72 | switchTab(tab); 73 | 74 | pontop = $('#syslog'); 75 | 76 | pontop.text("Loading..."); 77 | $.ajax({ 78 | url: 'pontop/' + tab, 79 | dataType: 'text' 80 | }).done(function(data) { 81 | pontop.text(data); 82 | }); 83 | } 84 | 85 | function showPonMe(meId, instanceId) { 86 | meLabel = $('#me_label'); 87 | meLabel.hide(); 88 | meDump = $('#me_dump'); 89 | meDump.hide(); 90 | 91 | $.ajax({ 92 | url: 'pon_dump/' + meId + '/' + instanceId, 93 | dataType: 'text' 94 | }).done(function(data) { 95 | meLabel.text("ME " + meId + " Instance " + instanceId); 96 | meLabel.show(); 97 | meDump.text(data); 98 | meDump.show(); 99 | meLabel.get(0).scrollIntoView({behavior: 'smooth'}); 100 | }); 101 | } 102 | 103 | function submitSupportForm(input, action) { 104 | $('button.support-button').attr('disabled', 'disabled'); 105 | $('#support-action').attr('value', action); 106 | var btn = $(input); 107 | if (btn) 108 | btn.addClass('spinning'); 109 | 110 | $('#support-form').submit(); 111 | } 112 | 113 | function submitFirmwareForm(input) { 114 | var btn = $(input); 115 | $('.firmware-button').attr('disabled', 'disabled'); 116 | $('#firmware-file').attr('onclick', 'return false'); 117 | if (btn) 118 | btn.addClass('spinning'); 119 | 120 | $('#firmware-form').submit(); 121 | return true; 122 | } 123 | 124 | function uploadFirmware(input) { 125 | if (!$('#firmware-form').valid()) 126 | return false; 127 | $('#switch-reboot-section').hide(); 128 | return submitFirmwareForm(input); 129 | } 130 | 131 | function cancelFirmware(input) { 132 | $('#firmware-action').attr('value', 'cancel'); 133 | return submitFirmwareForm(input); 134 | } 135 | 136 | function rebootFirmware(input) { 137 | $('#firmware-action').attr('value', 'reboot'); 138 | return submitFirmwareForm(input); 139 | } 140 | 141 | function installFirmware(input, reboot) { 142 | action = 'install'; 143 | if (reboot) 144 | action = 'install_reboot'; 145 | 146 | $('#firmware-action').attr('value', action); 147 | return submitFirmwareForm(input); 148 | } 149 | 150 | function showSwitchRebootConfirmation() { 151 | $('#switch-reboot-original').hide(); 152 | $('#switch-reboot-confirmation').show(); 153 | } 154 | 155 | function confirmSwitchReboot(confirm, input) { 156 | if (confirm) { 157 | $('#firmware-file').removeAttr('required'); 158 | $('#firmware-action').val('switch_reboot'); 159 | return submitFirmwareForm(input); 160 | } 161 | else { 162 | $('#switch-reboot-confirmation').hide(); 163 | $('#switch-reboot-original').show(); 164 | } 165 | } 166 | 167 | $(document).ready(function () { 168 | var savedTab = localStorage.getItem('activeConfigTab'); 169 | if (savedTab) { 170 | switchTab(savedTab); 171 | localStorage.removeItem('activeConfigTab'); 172 | } 173 | 174 | var fixVlansSelect = $('#widget\\.cbid\\.system\\.poncfg\\.fix_vlans'); 175 | if (fixVlansSelect.length === 0) { 176 | return; 177 | } 178 | 179 | var editHookScriptBtn = $('#edit-hook-script-btn'); 180 | var hookScriptModal = $('#hook-script-modal'); 181 | var hookScriptMessage = $('#hook-script-message'); 182 | var hookScriptTextarea = $('#hook-script-textarea'); 183 | var vlanFields = $('.vlan-field'); 184 | 185 | function toggleVlanFields() { 186 | var fixVlansValue = fixVlansSelect.val(); 187 | if (fixVlansValue == '1') { 188 | vlanFields.show(); 189 | } else { 190 | vlanFields.hide(); 191 | } 192 | } 193 | 194 | fixVlansSelect.change(toggleVlanFields); 195 | toggleVlanFields(); 196 | editHookScriptBtn.click(function (e) { 197 | e.preventDefault(); 198 | 199 | hookScriptMessage.hide(); 200 | hookScriptMessage.text(''); 201 | 202 | $.get('get_hook_script', function (data) { 203 | if (data.trim() === '') { 204 | hookScriptTextarea.val(''); 205 | } else { 206 | hookScriptTextarea.val(data); 207 | } 208 | hookScriptModal.show(); 209 | adjustTextareaHeight(); 210 | }); 211 | }); 212 | 213 | $('#hook-script-save-btn').click(function () { 214 | var content = hookScriptTextarea.val(); 215 | $.post('save_hook_script', { content: content }, function (response) { 216 | hookScriptMessage.text(translations.hookScriptSaved); 217 | hookScriptMessage.css('color', 'green'); 218 | hookScriptMessage.show(); 219 | setTimeout(function () { 220 | hookScriptMessage.hide(); 221 | hookScriptModal.hide(); 222 | }, 1000); // hide window in 1s 223 | }).fail(function () { 224 | hookScriptMessage.text(translations.hookScriptSaveFailed); 225 | hookScriptMessage.css('color', 'red'); 226 | hookScriptMessage.show(); 227 | }); 228 | }); 229 | $('#hook-script-cancel-btn').click(function () { 230 | hookScriptModal.hide(); 231 | }); 232 | function adjustTextareaHeight() { 233 | hookScriptTextarea.height(0); 234 | var height = hookScriptTextarea[0].scrollHeight; 235 | hookScriptTextarea.height(height); 236 | } 237 | hookScriptTextarea.on('input', adjustTextareaHeight); 238 | }); 239 | -------------------------------------------------------------------------------- /files/basic/www/luci-static/resources/view/status/include/15_pon.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 'require baseclass'; 3 | 4 | return baseclass.extend({ 5 | title: _('PON Status'), 6 | 7 | load: function () { 8 | return L.Request.get(L.url('admin/8311/gpon_status')).then(function (res) { 9 | return res.json(); 10 | }); 11 | }, 12 | 13 | render: function (data) { 14 | var fields = [ 15 | _('PON Mode'), data.pon_mode || '?', 16 | _('PON PLOAM Status'), data.status || '?', 17 | _('RX Power / TX Power / TX Bias'), data.power || '?', 18 | _('CPU0 / CPU1 / Optic Temperature'), data.temperature || '?', 19 | _('Module Voltage'), data.voltage || '?', 20 | _('Module Info'), data.module_info || '?', 21 | _('ETH Speed'), data.eth_speed || '?', 22 | _('Active Firmware'), data.active_bank || '?' 23 | ]; 24 | 25 | var table = E('div', { 'class': 'table' }); 26 | 27 | for (var i = 0; i < fields.length; i += 2) { 28 | table.appendChild(E('div', { 'class': 'tr' }, [ 29 | E('div', { 'class': 'td left', 'width': '33%' }, [fields[i]]), 30 | E('div', { 'class': 'td left' }, [fields[i + 1]]) 31 | ])); 32 | } 33 | 34 | return table; 35 | } 36 | }); 37 | -------------------------------------------------------------------------------- /files/bfw/lib/8311_backend.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | _lib_8311 2>/dev/null || . /lib/8311.sh 4 | 5 | _set_8311_gpon_sn() { 6 | uci -qc /ptdata set "factory_conf.GponSN"="key" 7 | uci -qc /ptdata set "factory_conf.GponSN.encryflag"="0" 8 | uci -qc /ptdata set "factory_conf.GponSN.value"="$1" 9 | uci -qc /ptdata commit "factory_conf" 10 | } 11 | 12 | _set_8311_device_sn() { 13 | # this only really changes what's in load_cli and the webui 14 | uci -qc /ptdata set "factory_conf.SerialNumber"="key" 15 | uci -qc /ptdata set "factory_conf.SerialNumber.encryflag"="0" 16 | uci -qc /ptdata set "factory_conf.SerialNumber.value"="$1" 17 | uci -qc /ptdata commit "factory_conf" 18 | } 19 | 20 | _set_8311_vendor_id() { 21 | uci -qc /ptdata set "factory_conf.VendorCode"="key" 22 | uci -qc /ptdata set "factory_conf.VendorCode.encryflag"="0" 23 | uci -qc /ptdata set "factory_conf.VendorCode.value"="$1" 24 | uci -qc /ptdata commit "factory_conf" 25 | } 26 | 27 | _set_8311_reg_id_hex() { 28 | uci -qc /ptdata set "factory_conf.GPONPassWord"="key" 29 | uci -qc /ptdata set "factory_conf.GPONPassWord.encryflag"="1" 30 | uci -qc /ptdata set "factory_conf.GPONPassWord.value"="$(echo -n "$1" | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf | base64)" 31 | uci -qc /ptdata commit "factory_conf" 32 | 33 | uci -qc /ptconf delete "usrconfig_conf.InternetGatewayDevice__DeviceInfo__.RegistrationID" 34 | uci -qc /ptconf commit "usrconfig_conf" 35 | } 36 | 37 | _set_8311_sw_ver() { 38 | uci -qc /ptconf set "sysinfo_conf.SoftwareVersion_$1"="key" 39 | uci -qc /ptconf set "sysinfo_conf.SoftwareVersion_$1.encryflag"="0" 40 | uci -qc /ptconf set "sysinfo_conf.SoftwareVersion_$1.value"="$2" 41 | uci -qc /ptconf commit "sysinfo_conf" 42 | } 43 | 44 | _set_8311_override_active() { 45 | fwenv_set "active_bank" "$1" 46 | } 47 | 48 | _set_8311_hw_ver() { 49 | uci -qc /ptrom/ptconf set "sysinfo_conf.HardwareVersion"="key" 50 | uci -qc /ptrom/ptconf set "sysinfo_conf.HardwareVersion.encryflag"="0" 51 | uci -qc /ptrom/ptconf set "sysinfo_conf.HardwareVersion.value"="$HW_VERSION" 52 | uci -qc /ptrom/ptconf commit "sysinfo_conf" 53 | 54 | uci -qc /ptdata set "factory_conf.HardwareVersion"="key" 55 | uci -qc /ptdata set "factory_conf.HardwareVersion.encryflag"="0" 56 | uci -qc /ptdata set "factory_conf.HardwareVersion.value"="$1" 57 | uci -qc /ptdata commit "factory_conf" 58 | } 59 | 60 | _set_8311_equipment_id() { 61 | ( 62 | while [ ! -f "/tmp/deviceinfo" ]; do 63 | sleep 1 64 | done 65 | 66 | uci -qc /tmp set "deviceinfo.devicetype.value"="$1" 67 | uci -qc /tmp commit "deviceinfo" 68 | ) & 69 | } 70 | 71 | _set_8311_ipaddr() { 72 | sed -r 's#()#\1"'"$1"'"\2#g' -i "/ptrom/ptconf/param_ct.xml" 73 | } 74 | 75 | _set_8311_netmask() { 76 | sed -r 's#()#\1"'"$1"'"\2#g' -i "/ptrom/ptconf/param_ct.xml" 77 | } 78 | 79 | _set_8311_gateway() { 80 | sed -r 's#()#\1"'"$1"'"\2#g' -i "/ptrom/ptconf/param_ct.xml" 81 | } 82 | 83 | _set_8311_lct_mac() { 84 | uci -qc /ptdata set "factory_conf.brmac"="key" 85 | uci -qc /ptdata set "factory_conf.brmac.encryflag"="0" 86 | uci -qc /ptdata set "factory_conf.brmac.value"="$LCT_MAC" 87 | uci -qc /ptdata commit "factory_conf" 88 | } 89 | 90 | _set_8311_iphost_mac() { 91 | uci -qc /ptdata set "factory_conf.internetmac"="key" 92 | uci -qc /ptdata set "factory_conf.internetmac.encryflag"="0" 93 | uci -qc /ptdata set "factory_conf.internetmac.value"="$1" 94 | uci -qc /ptdata commit "factory_conf" 95 | } 96 | -------------------------------------------------------------------------------- /files/bfw/www/image/logo_8311.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/files/bfw/www/image/logo_8311.png -------------------------------------------------------------------------------- /files/common/etc/init.d/_8311-netinit.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | 3 | _lib_8311 2>/dev/null || . /lib/8311.sh 4 | 5 | START=26 6 | 7 | boot() { 8 | # fwenv for setting eth0_0 speed settings with ethtool 9 | ETH_SPEED=$(get_8311_ethtool) 10 | [ -n "$ETH_SPEED" ] && set_8311_ethtool "$ETH_SPEED" 11 | 12 | # LCT VLAN 13 | LCT_VLAN=$(get_8311_lct_vlan) 14 | [ "$LCT_VLAN" -gt 0 ] && set_8311_lct_vlan "$LCT_VLAN" 15 | 16 | # LCT IP Address 17 | set_8311_ipaddr "$(get_8311_ipaddr)" 18 | 19 | # LCT Netmask 20 | set_8311_netmask "$(get_8311_netmask)" 21 | 22 | # LCT Gateway 23 | set_8311_gateway "$(get_8311_gateway)" 24 | 25 | # LCT MAC 26 | set_8311_lct_mac "$(get_8311_lct_mac)" 27 | 28 | # LCT DNS 29 | DNS_SERVER=$(get_8311_dns_server) 30 | [ -n "$DNS_SERVER" ] && set_8311_dns_server "$DNS_SERVER" 31 | 32 | # IP Host MAC 33 | set_8311_iphost_mac "$(get_8311_iphost_mac)" 34 | 35 | ifup "lct" 36 | [ "$LCT_VLAN" -gt 0 ] && ifup "mgmt" 37 | 38 | 39 | # ping daemon 40 | /usr/sbin/8311-pingd.sh & 41 | } 42 | -------------------------------------------------------------------------------- /files/common/etc/init.d/_8311-poninit.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | 3 | _lib_8311 2>/dev/null || . /lib/8311.sh 4 | 5 | START=79 6 | 7 | start() { 8 | # 8311 MOD: fwenv to set Logical ONU ID 9 | LOID=$(get_8311_loid) 10 | [ -n "$LOID" ] && set_8311_loid "$LOID" 11 | 12 | # 8311 MOD: fwenv to set Logical Password 13 | LPWD=$(get_8311_lpwd) 14 | [ -n "$LPWD" ] && set_8311_lpwd "$LPWD" 15 | 16 | # set mib file from mib_file fwenv 17 | MIB_FILE=$(get_8311_mib_file) 18 | [ -n "$MIB_FILE" ] && set_8311_mib_file "$MIB_FILE" 19 | 20 | # fwenv to change the slot presented to the OLT 21 | PON_SLOT=$(get_8311_pon_slot) 22 | [ -n "$PON_SLOT" ] && set_8311_pon_slot "$PON_SLOT" 23 | 24 | # 8311 MOD: Set GPON Serial Number and Vendor ID 25 | GPON_SN=$(get_8311_gpon_sn) 26 | VENDOR_ID=$(get_8311_vendor_id) 27 | if [ -n "$GPON_SN" ]; then 28 | VENDOR_ID="${VENDOR_ID:-$(echo "$GPON_SN" | head -c 4)}" 29 | set_8311_gpon_sn "$GPON_SN" 30 | fi 31 | 32 | [ -n "$VENDOR_ID" ] && set_8311_vendor_id "$VENDOR_ID" 33 | 34 | # 8311 MOD: fwenv to set Device SN 35 | DEVICE_SN=$(get_8311_device_sn) 36 | [ -n "$DEVICE_SN" ] && set_8311_device_sn "$DEVICE_SN" 37 | 38 | # PON Mode (XGS-PON / XG-PON) 39 | PON_MODE=$(get_8311_pon_mode) 40 | set_8311_pon_mode "$PON_MODE" 41 | 42 | # OMCC Version (0x80 - 0xBF) 43 | OMCC_VERSION=$(get_8311_omcc_version) 44 | set_8311_omcc_version "$OMCC_VERSION" 45 | 46 | # OMCI Interoperability Mask (0 - 127) 47 | OMCI_IOP_MASK=$(get_8311_iop_mask) 48 | set_8311_iop_mask "$OMCI_IOP_MASK" 49 | 50 | # 8311 MOD: Set Registration ID 51 | REG_ID_HEX=$(get_8311_reg_id_hex) 52 | set_8311_reg_id_hex "$REG_ID_HEX" 53 | 54 | # 8311 MOD: fwenvs to set IP Host Host Name and Domain Name 55 | IPHOST_HOSTNAME=$(get_8311_iphost_hostname) 56 | set_8311_iphost_hostname "$IPHOST_HOSTNAME" 57 | 58 | IPHOST_DOMAIN=$(get_8311_iphost_domain) 59 | set_8311_iphost_domain "$IPHOST_DOMAIN" 60 | 61 | # 8311 MOD: Set software versions (omci_pipe.sh meg 7 0/1) 62 | SW_VERSION_A=$(get_8311_sw_ver A) 63 | [ -n "$SW_VERSION_A" ] && set_8311_sw_ver "A" "$SW_VERSION_A" 64 | 65 | SW_VERSION_B=$(get_8311_sw_ver B) 66 | [ -n "$SW_VERSION_B" ] && set_8311_sw_ver "B" "$SW_VERSION_B" 67 | 68 | # 8311 MOD: Set hardware version (omci_pipe.sh meg 256 0) 69 | HW_VERSION=$(get_8311_hw_ver) 70 | [ -n "$HW_VERSION" ] && set_8311_hw_ver "$HW_VERSION" 71 | 72 | # Override active bank in software version MEs 73 | OVERRIDE_ACTIVE=$(get_8311_override_active) 74 | [ -n "$OVERRIDE_ACTIVE" ] && set_8311_override_active "$OVERRIDE_ACTIVE" 75 | 76 | # 8311 MOD: Set equipment id (omci_pipe.sh meg 257 0) 77 | EQUIPMENT_ID=$(get_8311_equipment_id) 78 | [ -n "$EQUIPMENT_ID" ] && set_8311_equipment_id "$EQUIPMENT_ID" 79 | } 80 | 81 | boot() { 82 | MODULE_TYPE=$(get_8311_module_type) 83 | if [ "$MODULE_TYPE" = "potron" ] || [ "$MODULE_TYPE" = "fullvision" ]; then 84 | echo "Potrontec or Full Vision module detected, setting optic.common.tx_en_mode to 3" | to_console 85 | uci set "optic.common.tx_en_mode"="3" 86 | else 87 | uci set "optic.common.tx_en_mode"="0" 88 | fi 89 | uci commit "optic" 90 | 91 | # Active fw bank is always valid 92 | ACTIVE=$(active_fwbank) 93 | VALID="img_valid$ACTIVE" 94 | [ "$(fwenv_get "$VALID")" != "true" ] && fwenv_set "$VALID" "true" 95 | 96 | # Check validity of inactive fw bank 97 | INACTIVE=$(inactive_fwbank) 98 | VALID="img_valid$INACTIVE" 99 | [ "$(fwenv_get "$VALID")" != "true" ] && { 100 | alternate_firmware_info &>/dev/null && 101 | fwenv_set "$VALID" "true" || 102 | fwenv_set "$VALID" "false" 103 | } 104 | 105 | start "$@" 106 | 107 | # 8311 MOD: start vlansd script 108 | /usr/sbin/8311-vlansd.sh & 109 | } 110 | -------------------------------------------------------------------------------- /files/common/etc/init.d/_8311-sysinit.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | 3 | _lib_8311 2>/dev/null || . /lib/8311.sh 4 | 5 | START=18 6 | 7 | start() { 8 | CONSOLE_EN=$(get_8311_console_en) 9 | DYING_GASP_EN=$(get_8311_dying_gasp_en) 10 | 11 | if [ "$CONSOLE_EN" != "1" ]; then 12 | echo "Disabling serial console output, set fwenv 8311_console_en to 1 to re-enable" | to_console 13 | UART_TX="low" 14 | else 15 | UART_TX="high" 16 | fi 17 | 18 | if [ "$DYING_GASP_EN" = "1" ]; then 19 | echo "Enabling dying gasp. This will disable serial console input, set fwenv 8311_dying_gasp_en to 0 to re-enable" | to_console 20 | UART_RX="low" 21 | else 22 | UART_RX="high" 23 | fi 24 | 25 | # Delay to give enough time to write to console if UART TX is being disabled 26 | [ "$UART_TX" = "low" ] && sleep 1 27 | 28 | [ -e "/sys/class/gpio/gpio508" ] || echo 508 > "/sys/class/gpio/export" 29 | echo "$UART_RX" > "/sys/class/gpio/gpio508/direction" 30 | 31 | [ -e "/sys/class/gpio/gpio510" ] || echo 510 > "/sys/class/gpio/export" 32 | echo "$UART_TX" > "/sys/class/gpio/gpio510/direction" 33 | 34 | # Move cursor to begining of line to hide garbage created by setting UART_TX 35 | [ "$UART_TX" = "high" ] && echo -n -e "\r" | to_console 36 | 37 | 38 | # Custom hostname suppport 39 | SYS_HOSTNAME=$(get_8311_hostname) 40 | [ -n "$SYS_HOSTNAME" ] && set_8311_hostname "$SYS_HOSTNAME" 41 | 42 | # LuCI i18n support 43 | SYS_LANG=$(get_8311_lang) 44 | [ -n "$SYS_LANG" ] && set_8311_lang "$SYS_LANG" 45 | 46 | # fwenv for setting the root account password hash 47 | ROOT_PWHASH=$(get_8311_root_pwhash) 48 | [ -n "$ROOT_PWHASH" ] && set_8311_root_pwhash "$ROOT_PWHASH" 49 | } 50 | 51 | boot() { 52 | # 8311 MOD: Remove persistent root 53 | _8311_check_persistent_root || return 1 54 | 55 | # 8311 MOD: persistent server and client key 56 | DROPBEAR_RSA_KEY=$(uci -qc /ptconf/8311 get dropbear.rsa_key.value) 57 | DROPBEAR_PUBKEY=$(uci -qc /ptconf/8311 get dropbear.public_key.value) 58 | DROPBEAR_PUBKEY_BASE64=$(uci -qc /ptconf/8311 get dropbear.public_key.encryflag) 59 | 60 | [ -f "/ptconf/8311/dropbear" ] && rm -fv "/ptconf/8311/dropbear" 61 | mkdir -p /ptconf/8311 /ptconf/8311/dropbear /ptconf/8311/uhttpd /ptconf/8311/.ssh 62 | chmod 700 /ptconf/8311/dropbear /ptconf/8311/uhttpd /ptconf/8311/.ssh 63 | ln -fsv /ptconf/8311/.ssh/authorized_keys /ptconf/8311/dropbear/authorized_keys 64 | 65 | if [ -n "$DROPBEAR_RSA_KEY" ]; then 66 | echo "Migrating dropbear.rsa_key to /ptconf/8311/dropbear/dropbear_rsa_host_key" | tee -a /dev/console 67 | 68 | echo "$DROPBEAR_RSA_KEY" | base64 -d > /ptconf/8311/dropbear/dropbear_rsa_host_key 69 | chmod 600 /ptconf/8311/dropbear/dropbear_rsa_host_key 70 | fi 71 | 72 | if [ -n "$DROPBEAR_PUBKEY" ]; then 73 | echo "Migrating dropbear.public_key to /ptconf/8311/.ssh/authorized_keys" | tee -a /dev/console 74 | 75 | if [ "$DROPBEAR_PUBKEY_BASE64" = "1" ]; then 76 | echo "$DROPBEAR_PUBKEY" | base64 -d > /ptconf/8311/.ssh/authorized_keys 77 | else 78 | echo "$DROPBEAR_PUBKEY" > /ptconf/8311/.ssh/authorized_keys 79 | fi 80 | 81 | chmod 600 /ptconf/8311/.ssh/authorized_keys 82 | fi 83 | 84 | start "$@" 85 | 86 | # 8311 MOD: start rx_los script 87 | /usr/sbin/8311-rx_los.sh & 88 | 89 | # Start Reverse ARP Daemon 90 | /usr/sbin/8311-rarpd.sh & 91 | } 92 | -------------------------------------------------------------------------------- /files/common/etc/init.d/sfp_eeprom.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | # Copyright (C) 2013 OpenWrt.org 3 | # Copyright (C) 2013 lantiq.com 4 | # Copyright (C) 2020 Intel Corporation 5 | # Copyright (C) 2021 - 2022 MaxLinear, Inc. 6 | 7 | # define default 8 | pon_sgmii_mode() { 9 | echo 0 10 | } 11 | 12 | . $IPKG_INSTROOT/lib/pon.sh 13 | . $IPKG_INSTROOT/lib/functions.sh 14 | 15 | START=62 16 | SFP_I2C_BINARY=/usr/bin/sfp_i2c 17 | 18 | sfp_i2c() { 19 | #echo "sfp_i2c $*" 20 | $SFP_I2C_BINARY $* 21 | } 22 | 23 | # don't used wrapper above to ensure correct quoting of string 24 | set_string() { 25 | $SFP_I2C_BINARY -i $1 -s "$2" 26 | } 27 | 28 | set_sfp_string() { 29 | local index=$(($1)) 30 | local length=$(($2)) 31 | local hex=$(echo -n "$3" | xxd -p -l $length -c 1) 32 | local end=$((index + length)) 33 | 34 | # write out string 35 | for v in $hex; do 36 | $SFP_I2C_BINARY -i "$index" -w "0x$v" || return $? 37 | index=$((index + 1)) 38 | done 39 | 40 | # pad with NULLs 41 | while [ "$index" -lt "$end" ]; do 42 | $SFP_I2C_BINARY -i "$index" -w 0 || return $? 43 | index=$((index + 1)) 44 | done 45 | 46 | return 0 47 | } 48 | 49 | vendor_config() { 50 | local name 51 | local partno 52 | local revision 53 | local datecode 54 | local oui 55 | local oui_hex 56 | local vendordata 57 | 58 | config_get name default vendor_name 59 | config_get partno default vendor_partno 60 | config_get revision default vendor_rev 61 | config_get datecode default datecode 62 | config_get oui default vendor_oui 63 | config_get vendordata default vendor_data 64 | 65 | [ -n "$name" ] && set_string 0 "$name" 66 | [ -n "$partno" ] && set_string 1 "$partno" 67 | [ -n "$revision" ] && set_string 2 "$revision" 68 | [ -n "$datecode" ] && set_string 4 "$datecode" 69 | [ -n "$vendordata" ] && set_sfp_string 96 32 "$vendordata" 70 | 71 | if [ -n "$oui" ]; then 72 | oui_hex=$(echo $oui | awk 'BEGIN{FS=":"} {printf "0x%2s%2s%2s",$1,$2,$3}') 73 | $SFP_I2C_BINARY -i 36 -w $oui_hex -4 -m 0x00FFFFFF 74 | fi 75 | } 76 | 77 | serialnumber_config() { 78 | local nSerial 79 | 80 | config_get nSerial default serial_no 81 | [ -n "$nSerial" ] && set_string 3 "$nSerial" 82 | } 83 | 84 | bitrate_config() { 85 | local nBitrate 86 | 87 | case $(pon_sgmii_mode) in 88 | 2 | 5) # sgmii_fast or sgmii_fast_auto 89 | nBitrate=25 90 | ;; 91 | 6) # 10G 92 | nBitrate=100 93 | ;; 94 | *) # default mode 95 | nBitrate=10 96 | ;; 97 | esac 98 | 99 | sfp_i2c -1 -l 1 -i 12 -w $nBitrate 100 | } 101 | 102 | eeprom_addr_get() { 103 | local num=$1 104 | local def=$2 105 | local section=${3} 106 | local addr 107 | 108 | addr=$(fw_printenv -n sfp_i2c_addr_eeprom_$num 2>&-) 109 | if [ -z "$addr" ]; then 110 | config_get addr $section addr_eeprom_$num $def 111 | fi 112 | 113 | echo $addr 114 | } 115 | 116 | eeprom_addr_config() { 117 | local addr 118 | local section=${1:-default} 119 | 120 | addr=$(eeprom_addr_get 0 0x50 $section) 121 | [ -n "$addr" ] && sfp_i2c -b $addr 122 | 123 | addr=$(eeprom_addr_get 1 0x51 $section) 124 | [ -n "$addr" ] && sfp_i2c -B $addr 125 | } 126 | 127 | default_sfp_init() { 128 | local eeprom 129 | 130 | config_load sfp_eeprom 131 | 132 | # reset to default values, if no init file exists 133 | [ -e /lib/firmware/sfp_eeprom0_hack.bin ] || sfp_i2c -d yes 134 | vendor_config 135 | serialnumber_config 136 | bitrate_config 137 | 138 | # clone the initial DMI configuration values from the physical EEPROM 139 | local index=256 140 | for x in $(head -c 95 /sys/class/pon_mbox/pon_mbox0/device/eeprom51 | xxd -p -c 1); do 141 | sfp_i2c -i $index -w 0x$x 142 | index=$((index + 1)) 143 | done 144 | 145 | # configure I2C EEPROM addresses 146 | eeprom_addr_config 147 | 148 | # write protection: 0x50 / 0 - 95 149 | sfp_i2c -i 0 -l 96 -p 1 150 | # write protection: 0x51 / 0 - 127 151 | sfp_i2c -i 256 -l 128 -p 1 152 | 153 | # activate write protection for dedicated fields 154 | # 0x51 / 110, writable bits 3 & 6 155 | sfp_i2c -i 366 -p 2 -m 0xB7 156 | # 0x51 / 118, writable bits 0 & 3 157 | sfp_i2c -i 374 -p 2 -m 0xF6 158 | 159 | # check which EEPROM should be the current one (for legacy driver) 160 | config_get eeprom default eeprom 0 161 | # set current EEPROM 162 | sfp_i2c -e $eeprom 163 | } 164 | 165 | boot() { 166 | local enable_bridge 167 | 168 | # check if sfp_i2c driver is available 169 | if [ ! -c /dev/sfp_eeprom0 ]; then 170 | disable 171 | return 0 172 | fi 173 | 174 | config_load sfp_eeprom 175 | config_get_bool enable_bridge factory_bridge enable 0 176 | 177 | # do default init if factory-bridge is disabled 178 | [ "$enable_bridge" = "0" ] && default_sfp_init 179 | 180 | start "$@" 181 | } 182 | 183 | start_dmi_monitoring() { 184 | local eeprom_dmi 185 | local eeprom_serial_id 186 | local sync0 187 | local sync1 188 | 189 | config_load optic 190 | config_get eeprom_dmi sfp_eeprom dmi 191 | config_get eeprom_serial_id sfp_eeprom serial_id 192 | 193 | [ -n "$eeprom_dmi" ] && sync0="-T $eeprom_dmi" 194 | [ -n "$eeprom_serial_id" ] && sync1="-S $eeprom_serial_id" 195 | 196 | # don't use wrapper to avoid leaving this script active in background 197 | $SFP_I2C_BINARY -a $sync0 $sync1 > /dev/console & 198 | 199 | sleep 1 200 | # enable I2C processing 201 | sfp_i2c -P enable 202 | } 203 | 204 | start_factory_bridge() { 205 | local pmd_0 206 | local pmd_1 207 | local sync_0 208 | local sync_1 209 | 210 | config_load sfp_eeprom 211 | config_get pmd_0 factory_bridge pmd_0 212 | config_get pmd_1 factory_bridge pmd_1 213 | [ -n "$pmd_0" ] && sync_0="-S $pmd_0" 214 | [ -n "$pmd_1" ] && sync_1="-T $pmd_1" 215 | 216 | # configure I2C EEPROM addresses 217 | eeprom_addr_config 'factory_bridge' 218 | # disable write protection to see and forward all writes 219 | sfp_i2c -i 0 -l 256 -p 0 220 | sfp_i2c -i 256 -l 256 -p 0 221 | 222 | # don't use wrapper to avoid leaving this script active in background 223 | $SFP_I2C_BINARY -A $sync_0 $sync_1 > /dev/console & 224 | } 225 | 226 | start() { 227 | local enable_bridge 228 | 229 | config_load sfp_eeprom 230 | config_get_bool enable_bridge factory_bridge enable 0 231 | 232 | case "$enable_bridge" in 233 | "0") 234 | start_dmi_monitoring 235 | ;; 236 | "1") 237 | start_factory_bridge 238 | ;; 239 | esac 240 | } 241 | 242 | stop() { 243 | # disable I2C processing 244 | sfp_i2c -P disable 245 | killall -TERM sfp_i2c 246 | } 247 | 248 | debug() { 249 | killall -USR1 sfp_i2c 250 | } 251 | 252 | peek() { 253 | killall -USR2 sfp_i2c 254 | } 255 | 256 | EXTRA_COMMANDS="debug peek" 257 | EXTRA_HELP=\ 258 | " debug toggle debug output of monitoring daemon 259 | peek trigger single debug output of monitoring daemon" 260 | -------------------------------------------------------------------------------- /files/common/etc/init.d/sudo: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | # Copyright (C) 2014 OpenWrt.org 3 | 4 | START=99 5 | 6 | start() { 7 | [ -d /var/lib/sudo ] || { 8 | mkdir -m 0755 -p /var/lib/sudo 9 | chmod 0700 /var/lib/sudo 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /files/common/etc/init.d/urngd: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | 3 | START=00 4 | 5 | NAME=urngd 6 | PROG=/sbin/urngd 7 | 8 | start() { 9 | pgrep -x "$PROG" || "$PROG" & 10 | } 11 | 12 | stop() { 13 | pkill -x "$PROG" 14 | } 15 | -------------------------------------------------------------------------------- /files/common/etc/init.d/zsync.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | 3 | START=99 4 | 5 | start() { 6 | echo "Sync all filesystems" 7 | sync 8 | } 9 | -------------------------------------------------------------------------------- /files/common/etc/mibs/prx300_1V_bell.ini: -------------------------------------------------------------------------------- 1 | # layout: 2 | # ... \n 3 | # .... 4 | 5 | # conventions: 6 | # - \s is used to place a space (ASCII 0x20) 7 | # - \0 is used to place ASCII 0 8 | # - enclose "a b c" in quotes (either single or double) to interpret it as one 9 | # attribute 10 | # 11 | # numbers radix defined by prefix (0x for 16; 0 for 8; nothing for 10) 12 | 13 | # 14 | # Basic list of MEs for OMCI start-up 15 | # 16 | 17 | # PPTP Ethernet UNI (hidden) 18 | ? 11 0x0e01 0 0 0 0x00 1 1 0 2000 0 0xffff 0 0 0 0 0 19 | 20 | # ONU dynamic power management control 21 | 336 0 0x7 0x0 0 0 0 0 0 0x0000000000000000 22 | 23 | #LOID Authentication 24 | ? 65530 0 25 | 26 | ### HH4K / GigaHub MEs 27 | 28 | # ONU data 29 | 2 0 0 30 | 31 | # 10GBASE-T Cardholder 32 | 5 0x0100 49 49 0 " " " " 0 0 0 0 33 | 34 | # 10/100/1000BASTE-T Cardholder 35 | 5 0x0101 47 47 0 " " " " 0 0 0 0 36 | 37 | # VEIP Cardholder 38 | 5 0x010e 48 48 0 " " " " 0 0 0 0 39 | 40 | # ANI Cardholder 41 | 5 0x0180 238 238 0 " " " " 0 0 0 0 42 | 43 | # 10GBASE-T Circuit Pack 44 | 6 0x0100 49 7 " " " " INTC 0 0 0 " " 0 0 0 0 0 45 | 46 | # 10/100/1000BASTE-T Circuit Pack 47 | 6 0x0101 47 1 " " " " INTC 0 0 0 " " 0 0 0 0 0 48 | 49 | # VEIP Circuit Pack 50 | 6 0x010e 48 1 " " " " INTC 0 0 0 " " 0 0 0 0 0 51 | 52 | # ANI Circuit Pack 53 | 6 0x0180 238 1 " " " " INTC 0 0 0 " " 0 8 64 16 0 54 | 55 | # Software image 56 | 7 0 57 | 7 1 58 | 59 | # OLT-G 60 | 131 0 " " " " " " \0\0\0\0\0\0\0\0\0\0\0\0\0\0 61 | 62 | # Power Shedding 63 | 133 0 0 0 0 0 0 0 0 0 0 0 0 64 | 65 | # IP Host 66 | 134 1 0 \x00\x00\x00\x00\x00\x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 "" "" 67 | 68 | # ONU remote debug 69 | 158 0 0 \x00 70 | 71 | # ONU-G 72 | 256 0 INTC 00000000000000 00000000 0 0 0 0 0 0 \x00 \x00 0 3 73 | 74 | # ONU2-G 75 | 257 0 00000000000000000000 0xa0 0 1 1 0 0 1 32 0 0x007f 0 63 1536 76 | 77 | ## T-CONT (US) 78 | 262 0x8000 0xffff 1 1 79 | 262 0x8001 0xffff 1 1 80 | 262 0x8002 0xffff 1 1 81 | 262 0x8003 0xffff 1 1 82 | 262 0x8004 0xffff 1 1 83 | 262 0x8005 0xffff 1 1 84 | 262 0x8006 0xffff 1 1 85 | 262 0x8007 0xffff 1 1 86 | 87 | # ANI-G 88 | 263 0x8001 1 8 48 0 0 5 9 0 0 0 0xff 0xff 0x88B8 0 0x81 0x81 89 | 90 | # UNI-G 91 | 264 0x0e01 0 0 0 0x0e01 92 | 93 | ## Priority Queue (DS) - UNI 0x0e01 94 | 277 0x0e01 0 682 682 0 0x0000 0x0e010007 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x02\xaa\x02\xaa\x02\xaa\x02\xaa \xff\xff 9 0 95 | 277 0x0e02 0 682 682 0 0x0000 0x0e010006 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x02\xaa\x02\xaa\x02\xaa\x02\xaa \xff\xff 9 0 96 | 277 0x0e03 0 682 682 0 0x0000 0x0e010005 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x02\xaa\x02\xaa\x02\xaa\x02\xaa \xff\xff 9 0 97 | 277 0x0e04 0 682 682 0 0x0000 0x0e010004 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x02\xaa\x02\xaa\x02\xaa\x02\xaa \xff\xff 9 0 98 | 277 0x0e05 0 682 682 0 0x0000 0x0e010003 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x02\xaa\x02\xaa\x02\xaa\x02\xaa \xff\xff 9 0 99 | 277 0x0e06 0 682 682 0 0x0000 0x0e010002 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x02\xaa\x02\xaa\x02\xaa\x02\xaa \xff\xff 9 0 100 | 277 0x0e07 0 682 682 0 0x0000 0x0e010001 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x02\xaa\x02\xaa\x02\xaa\x02\xaa \xff\xff 9 0 101 | 277 0x0e08 0 682 682 0 0x0000 0x0e010000 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x02\xaa\x02\xaa\x02\xaa\x02\xaa \xff\xff 9 0 102 | 103 | ## Priority Queue (US) - T-CONT 0x8000 104 | 277 0x8000 0 768 768 0 0x0000 0x80000007 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 105 | 277 0x8001 0 768 768 0 0x0000 0x80000006 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 106 | 277 0x8002 0 768 768 0 0x0000 0x80000005 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 107 | 277 0x8003 0 768 768 0 0x0000 0x80000004 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 108 | 277 0x8004 0 768 768 0 0x0000 0x80000003 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 109 | 277 0x8005 0 768 768 0 0x0000 0x80000002 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 110 | 277 0x8006 0 768 768 0 0x0000 0x80000001 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 111 | 277 0x8007 0 768 768 0 0x0000 0x80000000 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 112 | 113 | ## Priority Queue (US) - T-CONT 0x8001 114 | 277 0x8008 0 768 768 0 0x0000 0x80010007 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 115 | 277 0x8009 0 768 768 0 0x0000 0x80010006 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 116 | 277 0x800a 0 768 768 0 0x0000 0x80010005 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 117 | 277 0x800b 0 768 768 0 0x0000 0x80010004 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 118 | 277 0x800c 0 768 768 0 0x0000 0x80010003 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 119 | 277 0x800d 0 768 768 0 0x0000 0x80010002 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 120 | 277 0x800e 0 768 768 0 0x0000 0x80010001 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 121 | 277 0x800f 0 768 768 0 0x0000 0x80010000 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 122 | 123 | ## Priority Queue (US) - T-CONT 0x8002 124 | 277 0x8010 0 768 768 0 0x0000 0x80020007 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 125 | 277 0x8011 0 768 768 0 0x0000 0x80020006 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 126 | 277 0x8012 0 768 768 0 0x0000 0x80020005 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 127 | 277 0x8013 0 768 768 0 0x0000 0x80020004 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 128 | 277 0x8014 0 768 768 0 0x0000 0x80020003 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 129 | 277 0x8015 0 768 768 0 0x0000 0x80020002 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 130 | 277 0x8016 0 768 768 0 0x0000 0x80020001 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 131 | 277 0x8017 0 768 768 0 0x0000 0x80020000 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 132 | 133 | ## Priority Queue (US) - T-CONT 0x8003 134 | 277 0x8018 0 768 768 0 0x0000 0x80030007 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 135 | 277 0x8019 0 768 768 0 0x0000 0x80030006 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 136 | 277 0x801a 0 768 768 0 0x0000 0x80030005 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 137 | 277 0x801b 0 768 768 0 0x0000 0x80030004 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 138 | 277 0x801c 0 768 768 0 0x0000 0x80030003 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 139 | 277 0x801d 0 768 768 0 0x0000 0x80030002 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 140 | 277 0x801e 0 768 768 0 0x0000 0x80030001 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 141 | 277 0x801f 0 768 768 0 0x0000 0x80030000 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 142 | 143 | ## Priority Queue (US) - T-CONT 0x8004 144 | 277 0x8020 0 768 768 0 0x0000 0x80040007 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 145 | 277 0x8021 0 768 768 0 0x0000 0x80040006 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 146 | 277 0x8022 0 768 768 0 0x0000 0x80040005 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 147 | 277 0x8023 0 768 768 0 0x0000 0x80040004 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 148 | 277 0x8024 0 768 768 0 0x0000 0x80040003 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 149 | 277 0x8025 0 768 768 0 0x0000 0x80040002 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 150 | 277 0x8026 0 768 768 0 0x0000 0x80040001 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 151 | 277 0x8027 0 768 768 0 0x0000 0x80040000 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 152 | 153 | ## Priority Queue (US) - T-CONT 0x8005 154 | 277 0x8028 0 768 768 0 0x0000 0x80050007 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 155 | 277 0x8029 0 768 768 0 0x0000 0x80050006 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 156 | 277 0x802a 0 768 768 0 0x0000 0x80050005 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 157 | 277 0x802b 0 768 768 0 0x0000 0x80050004 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 158 | 277 0x802c 0 768 768 0 0x0000 0x80050003 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 159 | 277 0x802d 0 768 768 0 0x0000 0x80050002 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 160 | 277 0x802e 0 768 768 0 0x0000 0x80050001 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 161 | 277 0x802f 0 768 768 0 0x0000 0x80050000 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 162 | 163 | ## Priority Queue (US) - T-CONT 0x8006 164 | 277 0x8030 0 768 768 0 0x0000 0x80060007 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 165 | 277 0x8031 0 768 768 0 0x0000 0x80060006 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 166 | 277 0x8032 0 768 768 0 0x0000 0x80060005 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 167 | 277 0x8033 0 768 768 0 0x0000 0x80060004 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 168 | 277 0x8034 0 768 768 0 0x0000 0x80060003 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 169 | 277 0x8035 0 768 768 0 0x0000 0x80060002 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 170 | 277 0x8036 0 768 768 0 0x0000 0x80060001 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 171 | 277 0x8037 0 768 768 0 0x0000 0x80060000 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 172 | 173 | ## Priority Queue (US) - T-CONT 0x8007 174 | 277 0x8038 0 768 768 0 0x0000 0x80070007 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 175 | 277 0x8039 0 768 768 0 0x0000 0x80070006 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 176 | 277 0x803a 0 768 768 0 0x0000 0x80070005 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 177 | 277 0x803b 0 768 768 0 0x0000 0x80070004 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 178 | 277 0x803c 0 768 768 0 0x0000 0x80070003 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 179 | 277 0x803d 0 768 768 0 0x0000 0x80070002 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 180 | 277 0x803e 0 768 768 0 0x0000 0x80070001 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 181 | 277 0x803f 0 768 768 0 0x0000 0x80070000 0x0000 0x01 0x00 0x00000000 0x0000 0x0000 \x03\x00\x03\x00\x03\x00\x03\x00 \xff\xff 9 0 182 | 183 | ## Traffic Scheduler (US) 184 | 278 0x8000 0x8000 0x0000 0x01 0x00 185 | 278 0x8001 0x8000 0x0000 0x01 0x00 186 | 278 0x8002 0x8001 0x0000 0x01 0x00 187 | 278 0x8003 0x8001 0x0000 0x01 0x00 188 | 278 0x8004 0x8002 0x0000 0x01 0x00 189 | 278 0x8005 0x8002 0x0000 0x01 0x00 190 | 278 0x8006 0x8003 0x0000 0x01 0x00 191 | 278 0x8007 0x8003 0x0000 0x01 0x00 192 | 278 0x8008 0x8004 0x0000 0x01 0x00 193 | 278 0x8009 0x8004 0x0000 0x01 0x00 194 | 278 0x800a 0x8005 0x0000 0x01 0x00 195 | 278 0x800b 0x8005 0x0000 0x01 0x00 196 | 278 0x800c 0x8006 0x0000 0x01 0x00 197 | 278 0x800d 0x8006 0x0000 0x01 0x00 198 | 278 0x800e 0x8007 0x0000 0x01 0x00 199 | 278 0x800f 0x8007 0x0000 0x01 0x00 200 | 201 | # Virtual Ethernet Interface Point 202 | 329 0x0e01 0 0 \0 0xffff 0xffff 203 | 204 | # Enhanced Security Control 205 | 332 0 206 | 207 | # IPv6 Host (This ME is currently bugged on the WAS-110, it may be fixable with binary mods) 208 | #347 2 0 \x00\x00\x00\x00\x00\x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 0 209 | 210 | -------------------------------------------------------------------------------- /files/common/etc/modules.d/zzz-pon-sfp-i2c: -------------------------------------------------------------------------------- 1 | mod_sfp_i2c fw_name=prx_i2c_aca_fw.bin eeprom0_init=sfp_eeprom0_hack.bin 2 | -------------------------------------------------------------------------------- /files/common/etc/rc.d/S18_8311-sysinit.sh: -------------------------------------------------------------------------------- 1 | ../init.d/_8311-sysinit.sh -------------------------------------------------------------------------------- /files/common/etc/rc.d/S26_8311-netinit.sh: -------------------------------------------------------------------------------- 1 | ../init.d/_8311-netinit.sh -------------------------------------------------------------------------------- /files/common/etc/rc.d/S79_8311-poninit.sh: -------------------------------------------------------------------------------- 1 | ../init.d/_8311-poninit.sh -------------------------------------------------------------------------------- /files/common/etc/uci-defaults/zzz-8311: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | _lib_8311 2>/dev/null || . /lib/8311.sh 3 | 4 | # Configure LCT Interface 5 | LCT_IFNAME=$(uci get "network.lct.ifname" || echo "eth0_0_1_lct") 6 | LCT_MAC="$(get_8311_lct_mac)" 7 | 8 | LCT_DNS=$(get_8311_dns_server) 9 | LCT_VLAN=$(get_8311_lct_vlan) 10 | DB_INT="lct" 11 | if [ "$LCT_VLAN" -gt 0 ] && [ "$LCT_VLAN" -le 4095 ]; then 12 | DB_INT="mgmt" 13 | uci set "network.lct_vlan"="device" 14 | uci set "network.lct_vlan.ifname"="$LCT_IFNAME" 15 | uci set "network.lct_vlan.name"="mgmt" 16 | uci set "network.lct_vlan.type"="8021q" 17 | uci set "network.lct_vlan.vid"="$LCT_VLAN" 18 | 19 | uci set "network.mgmt"="interface" 20 | uci set "network.mgmt.ifname"="mgmt" 21 | uci set "network.mgmt.auto"="1" 22 | uci set "network.mgmt.macaddr"="$LCT_MAC" 23 | uci set "network.mgmt.proto"="static" 24 | uci set "network.mgmt.ipaddr"="$(get_8311_ipaddr)" 25 | uci set "network.mgmt.netmask"="$(get_8311_netmask)" 26 | uci set "network.mgmt.gateway"="$(get_8311_gateway)" 27 | 28 | [ -n "$LCT_DNS" ] && uci set "network.mgmt.dns"="$LCT_DNS" 29 | 30 | uci del "network.lct.ipaddr" 31 | uci del "network.lct.netmask" 32 | uci del "network.lct.gateway" 33 | 34 | uci add_list "firewall.@zone[0].network"="mgmt" 35 | else 36 | uci set "network.lct.ipaddr"="$(get_8311_ipaddr)" 37 | uci set "network.lct.netmask"="$(get_8311_netmask)" 38 | uci set "network.lct.gateway"="$(get_8311_gateway)" 39 | [ -n "$LCT_DNS" ] && uci set "network.lct.dns"="$LCT_DNS" 40 | fi 41 | 42 | uci set "network.lct.auto"="1" 43 | uci set "network.lct.macaddr"="$LCT_MAC" 44 | 45 | uci del_list "firewall.@zone[0].network"="lan" 46 | uci commit "firewall" 47 | 48 | 49 | # Configure IP Host Interface 50 | uci set "network.iphost1.macaddr"="$(get_8311_iphost_mac)" 51 | 52 | # Get rid of warnings about delegated IPv6 prefixes 53 | uci delete "network.globals.ula_prefix" 54 | 55 | 56 | uci commit "network" 57 | 58 | # Configure LuCI 59 | LUCI_DIR="/usr/lib/lua/luci" 60 | if [ -d "$LUCI_DIR" ]; then 61 | TRANS_DIR="$LUCI_DIR/i18n" 62 | 63 | uci set "luci.languages.en"="English" 64 | [ -f "$TRANS_DIR/8311.zh-cn.lmo" ] && uci set "luci.languages.zh_cn"="简体中文 (Chinese Simplified)" 65 | [ -f "$TRANS_DIR/8311.fr.lmo" ] && uci set "luci.languages.fr"="Français (French)" 66 | [ -f "$TRANS_DIR/8311.ja.lmo" ] && uci set "luci.languages.ja"="日本語 (Japanese)" 67 | 68 | SYS_LANG=$(get_8311_lang) 69 | uci set "luci.main.lang"="$SYS_LANG" 70 | 71 | [ -d "/www/luci-static/bootstrap" ] && uci set "luci.main.mediaurlbase"="/luci-static/bootstrap" 72 | 73 | uci commit "luci" 74 | fi 75 | 76 | SYS_HOSTNAME=$(get_8311_hostname) 77 | if [ -n "$SYS_HOSTNAME" ]; then 78 | uci set "system.@system[0].hostname"="$SYS_HOSTNAME" 79 | uci commit "system" 80 | else 81 | SYS_HOSTNAME="prx126-sfp-pon" 82 | fi 83 | 84 | if [ -f "/usr/sbin/dropbear" ]; then 85 | rm -f "/etc/config/dropbear" 86 | touch "/etc/config/dropbear" 87 | 88 | uci batch </dev/null && REDIR_HTTPS="0" 127 | 128 | uci batch </dev/null || . /lib/functions/int.sh 10 | _lib_hexbin &>/dev/null || . /lib/functions/hexbin.sh 11 | 12 | mibs() { 13 | if [ -n "$1" ]; then 14 | me=$(($1)) 15 | $omci md | $pcre -o1 "^\|\s+${me}\s+\|\s+(\d+)\b" 16 | else 17 | $omci md | $pcre -o1 -o2 --om-separator=' ' '^\|\s+(\d+)\s+\|\s+(\d+)\s+' 18 | fi 19 | } 20 | 21 | mib() { 22 | [ -n "$2" ] || return 1 23 | $omci meg "$(($1))" "$(($2))" 24 | } 25 | 26 | mibattr() { 27 | [ -n "$3" ] || return 1 28 | local attr=$(($3)) || return 1 29 | local data=$(mib "$1" "$2") || return $? 30 | 31 | echo "$data" | $pcre -o1 -M "^(?s)-{79}\n(\s*${attr}\s+.+?)\n-{79}$" 32 | } 33 | 34 | mibattrdata() { 35 | local nl=true 36 | local hexstr=false 37 | local me= 38 | local id= 39 | local attr= 40 | 41 | while [ $# -gt 0 ]; do 42 | case "$1" in 43 | -n) 44 | nl=false; 45 | ;; 46 | -x) 47 | hexstr=true 48 | ;; 49 | *) 50 | if [ -z "$me" ]; then 51 | me="$1" 52 | elif [ -z "$id" ]; then 53 | id="$1" 54 | elif [ -z "$attr" ]; then 55 | attr="$1" 56 | else 57 | return 1 58 | fi 59 | ;; 60 | esac 61 | shift 62 | done 63 | 64 | local mibattr=$(mibattr "$me" "$id" "$attr") || return $? 65 | local typesize=$(echo "$mibattr" | head -n1 | $pcre --om-separator ' ' -o1 -o2 '\b(\d+)b\s+(\S+)\s+\S+$') 66 | local bytes=$(echo "$typesize" | cut -d' ' -f1) 67 | local type=$(echo "$typesize" | cut -d' ' -f2) 68 | 69 | local sint=false 70 | [ "$type" = "SINT" ] && sint=true 71 | if $sint || [ "$type" = "BF" ] || [ "$type" = "ENUM" ] || [ "$type" = "PTR" ] || [ "$type" = "UINT" ]; then 72 | local int="0x$(echo "$mibattr" | head -n2 | tail -n1 | $pcre -o1 '^((?:\s+0x[0-9a-f]{2,8})+)' | sed -r -e 's/0x//g' -e 's/\s+//g')" 73 | local inttype="uint" 74 | $sint && inttype="int" 75 | 76 | local size=$((bytes * 8)) 77 | 78 | "$inttype$size" "$int" 79 | elif [ "$type" = "STR" ] || [ "$type" = "TBL" ]; then 80 | local hexdata=$(echo -n "$mibattr" | pcre2grep -o1 -i "^\s*((?:\W0x[0-9A-F]{2}){$bytes})\s*$" | sed -r -e 's/\s+//g' -e 's/0x//g') 81 | if [ "$type" = "STR" ]; then 82 | hexdata=$(echo "$hexdata" | tr -d '\n') 83 | echo "$hexdata" | { ! $hexstr && hex2str || cat; } 84 | ! $hexstr && $nl && echo 85 | else 86 | echo "$hexdata" 87 | fi 88 | else 89 | return 1 90 | fi 91 | } 92 | -------------------------------------------------------------------------------- /files/common/lib/8311.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | _lib_8311() { 4 | return 0 5 | } 6 | 7 | . "/lib/pon.sh" 8 | . "/lib/8311_backend.sh" 9 | 10 | lib_hexbin 2>/dev/null || . /lib/functions/hexbin.sh 11 | 12 | to_console() { 13 | tee -a /dev/console | logger -t "8311" -p daemon.info 14 | } 15 | 16 | strtoupper() { 17 | tr '[a-z]' '[A-Z]' 18 | } 19 | 20 | strtolower() { 21 | tr '[A-Z]' '[a-z]' 22 | } 23 | 24 | ipv4() { 25 | grep -E '^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$' 26 | } 27 | 28 | fwenv_get_8311() { 29 | fwenv_get --8311 "$@" 30 | } 31 | 32 | fwenv_set_8311() { 33 | fwenv_set --8311 "$@" 34 | } 35 | 36 | uci_set() { 37 | if [ -n "$1" ] && [ -n "$2" ]; then 38 | uci set "$1"="$2" 39 | fi 40 | } 41 | 42 | _8311_check_persistent_root() { 43 | # Remove persistent root 44 | PERSIST_ROOT=$(fwenv_get_8311 "persist_root") 45 | if ! { [ "$PERSIST_ROOT" -eq "1" ] 2>/dev/null; }; then 46 | echo "8311_persist_root not enabled, checking bootcmd..." | to_console 47 | BOOTCMD=$(fwenv_get "bootcmd") 48 | if ! { echo "$BOOTCMD" | grep -Eq '^\s*run\s+ubi_init\s*;\s*ubi\s+remove\s+rootfs_data\s*;\s*run\s+flash_flash\s*$'; }; then 49 | echo "Resetting bootcmd to default value and rebooting, set fwenv 8311_persist_root=1 to avoid this" | tee -a /dev/console 50 | 51 | fwenv_set bootcmd "run ubi_init; ubi remove rootfs_data; run flash_flash" 52 | 53 | sync 54 | reboot 55 | return 1 56 | fi 57 | fi 58 | } 59 | 60 | _mib_file() { 61 | if [ ! -f "/tmp/8311-mib-file" ]; then 62 | get_8311_mib_file > "/tmp/8311-mib-file" 63 | fi 64 | 65 | cat "/tmp/8311-mib-file" 66 | } 67 | 68 | _mib_update() { 69 | local ME="$1" 70 | local PARAM="$2" 71 | local VALUE="$3" 72 | local P='("[^"]*"|[^"]\S*)' 73 | 74 | sed -r "s#^(([!?]\s+)?${ME}(\s+$P){${PARAM}}\s+)($P)#\1${VALUE}#g" -i "$(_mib_file)" 75 | } 76 | 77 | get_8311_console_en() { 78 | fwenv_get_8311 "console_en" 79 | } 80 | 81 | get_8311_dying_gasp_en() { 82 | fwenv_get_8311 "dying_gasp_en" 83 | } 84 | 85 | get_8311_gpon_sn() { 86 | fwenv_get_8311 "gpon_sn" | grep -E '^[A-Za-z0-9]{4}[A-Fa-f0-9]{8}$' 87 | } 88 | 89 | set_8311_gpon_sn() { 90 | echo "Setting PON SN: $1" | to_console 91 | _set_8311_gpon_sn "$1" 92 | } 93 | 94 | get_8311_device_sn() { 95 | fwenv_get_8311 "device_sn" 96 | } 97 | 98 | set_8311_device_sn() { 99 | # echo "Setting device SN to: $1" | to_console 100 | _set_8311_device_sn "$1" 101 | } 102 | 103 | get_8311_vendor_id() { 104 | fwenv_get_8311 "vendor_id" | grep -E '^[A-Za-z0-9]{4}$' 105 | } 106 | 107 | set_8311_vendor_id() { 108 | echo "Setting PON vendor ID: $1" | to_console 109 | _mib_update 6 5 "\"$1\"" 110 | _mib_update 256 1 "\"$1\"" 111 | 112 | _set_8311_vendor_id "$1" 113 | } 114 | 115 | get_8311_mib_file() { 116 | local tmp=$(fwenv_get_8311 "mib_file") 117 | local mib='/etc/mibs/prx300_1U.ini' 118 | if [ -n "$tmp" ]; then 119 | if [ -f "/etc/mibs/$tmp" ]; then 120 | mib="/etc/mibs/$tmp" 121 | else 122 | tmp=$(readlink -f "$tmp") 123 | if echo "$tmp" | grep -q -E '^/etc/mibs/' && [ -f "$tmp" ]; then 124 | mib="$tmp" 125 | fi 126 | fi 127 | fi 128 | 129 | echo "$mib" 130 | } 131 | 132 | set_8311_mib_file() { 133 | echo "Setting OMCI MIB file: $1" | to_console 134 | uci -q set "omci.default.mib_file"="$1" 135 | uci commit omci 136 | } 137 | 138 | get_8311_pon_mode() { 139 | fwenv_get_8311 "pon_mode" "xgspon" | strtolower | sed 's/-//g' | grep -E '^xgs?pon$' || echo 'xgspon' 140 | } 141 | 142 | set_8311_pon_mode() { 143 | local display=$(echo "$1" |strtoupper | sed 's/PON/-PON/g') 144 | echo "Setting PON Mode to: $display" | to_console 145 | uci -q set "gpon.ponip.pon_mode"="$1" 146 | uci -q commit "gpon" 147 | } 148 | 149 | get_8311_omcc_version() { 150 | fwenv_get_8311 "omcc_version" "0xA3" | grep -E '^0x(8[2-9A-F]|[9AB][0-9A-F])$' || echo '0xA3' 151 | } 152 | 153 | set_8311_omcc_version() { 154 | echo "Setting OMCC version to: $1" | to_console 155 | uci -q set "omci.default.omcc_version"="$1" 156 | uci -q commit "omci" 157 | } 158 | 159 | get_8311_iop_mask() { 160 | # 0 - 127 161 | fwenv_get_8311 "iop_mask" "18" | grep -E '^(\d|[1-9]\d|1[01]\d|12[0-7])$' || echo '18' 162 | } 163 | 164 | set_8311_iop_mask() { 165 | echo "Setting OMCI Interoperability Mask to: $1" | to_console 166 | uci -q set "gpon.ponip.iop_mask"="$1" 167 | uci -q commit "gpon" 168 | } 169 | 170 | get_8311_reg_id_hex() { 171 | { { fwenv_get_8311 "reg_id_hex" | hex2str; } || echo -n "$(fwenv_get_8311 "reg_id")"; cat /dev/zero; } 2>/dev/null | head -c 36 | str2hex | strtoupper 172 | } 173 | 174 | 175 | set_8311_reg_id_hex() { 176 | local printable=$(echo -n "$1" | hex2printable) 177 | echo "Setting PON registration ID to: $(echo $(echo "$1" | awk '{gsub(/.{2}/,"0x& ")}1')) ($printable)" | to_console 178 | _set_8311_reg_id_hex "$1" 179 | } 180 | 181 | get_8311_sw_ver() { 182 | local i1="A" 183 | local i2="B" 184 | 185 | { [ "$1" = "A" ] || [ "$1" = "B" ]; } && i1="$1" 186 | [ "$image1" = "B" ] && i2="A" 187 | 188 | { fwenv_get_8311 "sw_ver$i1" || fwenv_get_8311 "sw_ver" || fwenv_get_8311 "sw_ver$i2"; } | head -c 14 189 | } 190 | 191 | set_8311_sw_ver() { 192 | [ "$1" != "A" ] && [ "$1" != "B" ] && [ -z "$2" ] && return 1 193 | 194 | echo "Setting PON image $1 version: $2" | to_console 195 | _set_8311_sw_ver "$1" "$2" 196 | } 197 | 198 | get_8311_override_active() { 199 | fwenv_get_8311 override_active | grep -E '^[AB]$' 200 | } 201 | 202 | set_8311_override_active() { 203 | [ "$(active_fwbank)" = "$1" ] && return 0 204 | 205 | echo "Settings PON active bank to: $1" | to_console 206 | _set_8311_override_active "$1" 207 | } 208 | 209 | get_8311_hw_ver() { 210 | fwenv_get_8311 "hw_ver" | head -c 14 211 | } 212 | 213 | get_8311_cp_hw_ver_sync() { 214 | fwenv_get_8311 "cp_hw_ver_sync" 215 | } 216 | 217 | set_8311_hw_ver() { 218 | echo "Setting PON hardware version: $1" | to_console 219 | _mib_update 256 2 "\"$1\"" 220 | 221 | _set_8311_hw_ver "$1" 222 | 223 | local sync_cp_hwver=$(get_8311_cp_hw_ver_sync) 224 | if [ "$(get_8311_cp_hw_ver_sync)" -eq 1 ] 2>/dev/null; then 225 | set_8311_cp_hw_ver_sync "$1" 226 | fi 227 | } 228 | 229 | set_8311_cp_hw_ver_sync() { 230 | echo "Setting PON circuit pack versions to: $1" | to_console 231 | _mib_update 6 4 "\"$1\"" 232 | } 233 | 234 | get_8311_equipment_id() { 235 | fwenv_get_8311 "equipment_id" | head -c 20 236 | } 237 | 238 | set_8311_equipment_id() { 239 | echo "Setting PON equipment ID: $1" | to_console 240 | _mib_update 257 1 "\"$1\"" 241 | 242 | _set_8311_equipment_id "$1" 243 | } 244 | 245 | get_8311_lct_mac() { 246 | if [ ! -f "/tmp/8311-lct-mac" ]; then 247 | local lct_mac=$(fwenv_get_8311 "lct_mac" | grep -i -E '^[0-9a-f]{2}(:[0-9a-f]{2}){5}$') 248 | echo "${lct_mac:-$(pon_mac_get lct)}" | strtoupper > "/tmp/8311-lct-mac" 249 | fi 250 | 251 | cat "/tmp/8311-lct-mac" 252 | } 253 | 254 | set_8311_lct_mac() { 255 | echo "Setting LCT MAC address to: $1" | to_console 256 | _set_8311_lct_mac "$1" 257 | } 258 | 259 | get_8311_iphost_mac() { 260 | if [ ! -f "/tmp/8311-iphost-mac" ]; then 261 | local iphost_mac=$(fwenv_get_8311 "iphost_mac" 2>/dev/null | grep -i -E '^[0-9a-f]{2}(:[0-9a-f]{2}){5}$') 262 | echo "${iphost_mac:-$(pon_mac_get host)}" | strtoupper > "/tmp/8311-iphost-mac" 263 | fi 264 | 265 | cat "/tmp/8311-iphost-mac" 266 | } 267 | 268 | set_8311_iphost_mac() { 269 | echo "Setting IP host MAC address to: $1" | to_console 270 | _set_8311_iphost_mac "$1" 271 | } 272 | 273 | get_8311_iphost_hostname() { 274 | fwenv_get_8311 "iphost_hostname" | head -c 25 275 | } 276 | 277 | set_8311_iphost_hostname() { 278 | [ -n "$1" ] && echo "Setting PON IP host hostname to: $1" | to_console 279 | echo "$1" > "/tmp/8311-iphost-hostname" 280 | } 281 | 282 | get_8311_iphost_domain() { 283 | fwenv_get_8311 "iphost_domain" | head -c 25 284 | } 285 | 286 | set_8311_iphost_domain() { 287 | [ -n "$1" ] && echo "Setting PON IP host domain name to: $1" | to_console 288 | echo "$1" > "/tmp/8311-iphost-domainname" 289 | } 290 | 291 | get_8311_lct_vlan() { 292 | local lct_vlan=$(($(fwenv_get_8311 "lct_vlan" "0"))) 2>/dev/null 293 | [ -n "$lct_vlan" ] && [ "$lct_vlan" -ge 0 ] && [ "$lct_vlan" -le 4095 ] && echo "$lct_vlan" || echo "0" 294 | } 295 | 296 | set_8311_lct_vlan() { 297 | echo "Setting LCT VLAN: $1" | to_console 298 | } 299 | 300 | get_8311_ipaddr() { 301 | [ -f "/tmp/8311-ipaddr" ] || { fwenv_get_8311 "ipaddr" | ipv4 || echo "192.168.11.1"; } > "/tmp/8311-ipaddr" 302 | 303 | cat "/tmp/8311-ipaddr" 304 | } 305 | 306 | set_8311_ipaddr() { 307 | echo "Setting LCT IP address: $1" | to_console 308 | _set_8311_ipaddr "$1" 309 | } 310 | 311 | get_8311_netmask() { 312 | [ -f "/tmp/8311-netmask" ] || { fwenv_get_8311 "netmask" | ipv4 || echo "255.255.255.0"; } > "/tmp/8311-netmask" 313 | 314 | cat "/tmp/8311-netmask" 315 | } 316 | 317 | set_8311_netmask() { 318 | echo "Setting LCT netmask: $1" | to_console 319 | _set_8311_netmask "$1" 320 | } 321 | 322 | get_8311_gateway() { 323 | [ -f "/tmp/8311-gateway" ] || { fwenv_get_8311 "gateway" | ipv4 || get_8311_ipaddr; } > "/tmp/8311-gateway" 324 | 325 | cat "/tmp/8311-gateway" 326 | } 327 | 328 | set_8311_gateway() { 329 | echo "Setting LCT gateway: $1" | to_console 330 | _set_8311_gateway "$1" 331 | } 332 | 333 | get_8311_dns_server() { 334 | [ -f "/tmp/8311-dns" ] || fwenv_get_8311 "dns_server" | ipv4 > "/tmp/8311-dns" 335 | 336 | cat "/tmp/8311-dns" 337 | } 338 | 339 | set_8311_dns_server() { 340 | echo "Setting LCT dns: $1" | to_console 341 | } 342 | 343 | get_8311_https_redirect() { 344 | fwenv_get_8311 'https_redirect' '1' 345 | } 346 | 347 | get_8311_loid() { 348 | fwenv_get_8311 "loid" | head -c 24 349 | } 350 | 351 | set_8311_loid() { 352 | echo "Setting PON Logical ONU ID to: $1" | to_console 353 | uci -q set "omci.default.loid"="$1" 354 | uci -q commit "omci" 355 | } 356 | 357 | get_8311_lpwd() { 358 | fwenv_get_8311 "lpwd" | head -c 12 359 | } 360 | 361 | set_8311_lpwd() { 362 | echo "Setting PON Logical Password to: $1" | to_console 363 | uci -q set "omci.default.lpwd"="$1" 364 | uci -q commit "omci" 365 | } 366 | 367 | get_8311_ethtool() { 368 | fwenv_get_8311 "ethtool_speed" 369 | } 370 | 371 | set_8311_ethtool() { 372 | echo "Setting ethtool speed parameters: $1" | to_console 373 | ethtool -s eth0_0 $1 374 | } 375 | 376 | get_8311_root_pwhash() { 377 | fwenv_get_8311 "root_pwhash" | grep -E '^\$[0-9a-z]+\$.+\$[A-Za-z0-9./]+$' 378 | } 379 | 380 | set_8311_root_pwhash() { 381 | echo "Setting root password hash: $1" | to_console 382 | HASH=$(echo "$1" | sed 's#/#\\/#g') 383 | sed -r "s/(root:)([^:]*)(:.+)/\1${HASH}\3/g" -i /etc/shadow 384 | } 385 | 386 | get_8311_pon_slot() { 387 | fwenv_get_8311 "pon_slot" | grep -E '^[0-9]+$' 388 | } 389 | 390 | set_8311_pon_slot() { 391 | if [ "$1" -gt "1" ] 2>/dev/null && [ "$1" -le "254" ]; then 392 | echo "Setting PON slot to: $1" | to_console 393 | 394 | local MIB_FILE=$(_mib_file) 395 | local PON_SLOT_HEX=$(printf '%.2x\n' "$1") 396 | sed -r "s/^(277\s+(\S+\s+){6})0x01/\10x${PON_SLOT_HEX}/g" -i "$MIB_FILE" 397 | sed -r "s/^(5|6)\s+0x0101/\1 0x01${PON_SLOT_HEX}/g" -i "$MIB_FILE" 398 | sed -r "s/^(([?!]\s+)?\d+)\s+0x0101/\1 0x${PON_SLOT_HEX}01/g" -i "$MIB_FILE" 399 | fi 400 | } 401 | 402 | get_8311_hostname() { 403 | fwenv_get_8311 "hostname" 404 | } 405 | 406 | set_8311_hostname() { 407 | echo "Setting system hostname to: $1" | to_console 408 | echo "$1" > "/proc/sys/kernel/hostname" 409 | } 410 | 411 | get_8311_lang() { 412 | local lang=$(fwenv_get_8311 "lang" "auto") 413 | local LANG=$(echo "$lang" | tr '_' '-') 414 | [ "$lang" = "auto" ] || [ "$lang" = "en" ] || [ -f "/usr/lib/lua/luci/i18n/8311.$LANG.lmo" ] && echo "$lang" || echo "auto" 415 | } 416 | 417 | set_8311_lang() { 418 | echo "Setting LuCI language to: $1" | to_console 419 | } 420 | 421 | get_8311_ping_host() { 422 | if [ ! -f "/tmp/8311-ping-host" ]; then 423 | local PING_HOST=$(fwenv_get_8311 "ping_ip" | ipv4) 424 | 425 | echo "${PING_HOST:-$(get_8311_default_ping_host)}" > "/tmp/8311-ping-host" 426 | fi 427 | 428 | cat "/tmp/8311-ping-host" 429 | } 430 | 431 | get_8311_default_ping_host() { 432 | local ipaddr=$(get_8311_ipaddr) 433 | local netmask=$(get_8311_netmask) 434 | local gateway=$(get_8311_gateway) 435 | 436 | if [ "$ipaddr" != "$gateway" ]; then 437 | echo "$gateway" 438 | else 439 | IFS='.' read -r i1 i2 i3 i4 < "/tmp/8311-module-type" 472 | fi 473 | 474 | cat "/tmp/8311-module-type" 475 | } 476 | 477 | get_8311_base_mac() { 478 | if [ ! -f "/tmp/8311-base-mac" ]; then 479 | local serial=$(dd if=/sys/class/pon_mbox/pon_mbox0/device/eeprom50 bs=1 skip=68 count=12 2>/dev/null) 480 | local suffix=$(echo "$serial" | tail -c 7 | filterhex) 481 | [ -z "$suffix" ] && suffix=$(echo -n "$serial" | sha256sum | head -c 6 | strtoupper) 482 | 483 | { echo -n "10:B3:6F"; echo "$suffix" | sed -r 's/(..)/:\1/g'; } > "/tmp/8311-base-mac" 484 | fi 485 | 486 | cat "/tmp/8311-base-mac" 487 | } 488 | 489 | get_8311_timezone() { 490 | local TZ=$(fwenv_get_8311 "timezone" | sed 's/ /_/g') 491 | [ -f "/usr/share/zoneinfo/$TZ" ] || return 1 492 | 493 | echo "$TZ" | sed 's/_/ /g' 494 | } 495 | 496 | get_8311_ntp_servers() { 497 | fwenv_get_8311 "ntp_servers" 498 | } 499 | 500 | active_fwbank() { 501 | grep -E -o '\brootfsname=rootfs[AB]\b' /proc/cmdline | grep -E -o '[AB]$' 502 | } 503 | 504 | inactive_fwbank() { 505 | local active_bank=$(active_fwbank) 506 | if [ "$active_bank" = "A" ]; then 507 | echo "B" 508 | elif [ "$active_bank" = "B" ]; then 509 | echo "A" 510 | else 511 | return 1 512 | fi 513 | 514 | return 0 515 | } 516 | 517 | get_8311_sfp_vendor() { 518 | fwenv_get_8311 "sfp_vendor" | head -c 16 519 | } 520 | 521 | get_8311_sfp_oui() { 522 | fwenv_get_8311 "sfp_oui" | grep -Ei '^[0-9a-f]{2}(:[0-9a-f]{2}){2}$' 523 | } 524 | 525 | get_8311_sfp_partno() { 526 | fwenv_get_8311 "sfp_partno" | head -c 16 527 | } 528 | 529 | get_8311_sfp_rev() { 530 | fwenv_get_8311 "sfp_rev" | head -c 4 531 | } 532 | 533 | get_8311_sfp_serial() { 534 | fwenv_get_8311 "sfp_serial" | head -c 16 535 | } 536 | 537 | get_8311_sfp_date() { 538 | fwenv_get_8311 "sfp_date" | head -c 8 539 | } 540 | 541 | get_8311_sfp_vendordata() { 542 | fwenv_get_8311 "sfp_vendordata" | head -c 32 543 | } 544 | -------------------------------------------------------------------------------- /files/common/lib/functions/hexbin.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | _lib_hexbin() { 4 | return 0 5 | } 6 | 7 | filterhex() { 8 | sed -r 's/\s+//g' | grep -E '^([0-9A-Fa-f]{2})+$' 9 | } 10 | 11 | str2hex() { 12 | hexdump -v -e '1/1 "%02x"' 13 | } 14 | 15 | hex2str() { 16 | HEX=$(filterhex) 17 | [ -n "$HEX" ] && echo "$HEX" | sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf 18 | } 19 | 20 | str2printable() { 21 | hexdump -v -e '"%_p"' 22 | } 23 | 24 | hex2printable() { 25 | hex2str | str2printable 26 | } 27 | -------------------------------------------------------------------------------- /files/common/lib/functions/int.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | _lib_int() { 3 | return 0 4 | } 5 | 6 | int8() { 7 | int=$(($1 & 0xff)) 8 | [ "$int" -gt $((0x80)) ] && echo $((int - 0x100)) || echo $int 9 | } 10 | 11 | uint8() { 12 | echo $(($1 & 0xff)) 13 | } 14 | 15 | int16() { 16 | int=$(($1 & 0xffff)) 17 | [ "$int" -ge $((0x8000)) ] && echo $((int - 0x10000)) || echo $int 18 | } 19 | 20 | uint16() { 21 | echo $(($1 & 0xffff)) 22 | } 23 | 24 | int32() { 25 | local int=$(($1 & 0xffffffff)) 26 | [ "$int" -ge $((0x80000000)) ] && echo $((int - 0x100000000)) || echo $int 27 | } 28 | 29 | uint32() { 30 | echo $(($1 & 0xffffffff)) 31 | } 32 | 33 | int64() { 34 | echo $(($1)) 35 | } 36 | 37 | uint64() { 38 | printf '%u\n' "$(int64 "$1")" 39 | } 40 | -------------------------------------------------------------------------------- /files/common/lib/preinit/01_urngd: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | /etc/init.d/urngd start 4 | -------------------------------------------------------------------------------- /files/common/lib/preinit/07_create_ptconf: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | _lib_8311 2>/dev/null || . /lib/8311.sh 4 | 5 | _8311_create_ptconf_data() { 6 | ubinfo /dev/ubi0 --name=ptconf &>/dev/null || { 7 | echo "Creating ubi0:ptconf partition" | to_console 8 | ubimkvol /dev/ubi0 -N ptconf -n 7 -S 48 || 9 | ubimkvol /dev/ubi0 -N ptconf -S 48 10 | } 11 | } 12 | 13 | [ "$INITRAMFS" = "1" ] || boot_hook_add preinit_main _8311_create_ptconf_data 14 | -------------------------------------------------------------------------------- /files/common/root/.profile: -------------------------------------------------------------------------------- 1 | alias mtr='/usr/sbin/mtr -b -o "LSRD NBAWVJMX"' 2 | -------------------------------------------------------------------------------- /files/common/sbin/secure_upgrade.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | _lib_8311 2>/dev/null || . /lib/8311.sh 4 | 5 | FIRMWARE_PATH="/tmp/upgrade/firmware.img" 6 | FIRMWARE_OUT="/tmp/firmware.img" 7 | 8 | UPG=false 9 | RESET=true 10 | 11 | _help() { 12 | printf -- 'Utility to handle automatic version string updates.\n\n' 13 | printf -- 'Usage: %s [options]\n\n' "$0" 14 | printf -- 'Options:\n' 15 | printf -- '-u -r --upgrade\tUpdate the image version variables.\n' 16 | printf -- '-n --no-reset\tUpdate the image version variables without performing an omcid restart.\n' 17 | 18 | exit "$1" 19 | } 20 | 21 | while [ $# -gt 0 ]; do 22 | case "$1" in 23 | -u|-r|--upgrade) 24 | UPG=true 25 | ;; 26 | -n|--no-reset) 27 | RESET=false 28 | ;; 29 | -h|--help) 30 | _help 0 31 | ;; 32 | *) 33 | _help 1 34 | ;; 35 | esac 36 | shift 37 | done 38 | 39 | _err() { 40 | echo "$1" >&2 41 | echo "secure_upgrade: $1" | to_console 42 | [ "$2" -ge 0 ] 2>/dev/null && exit "$2" 43 | } 44 | 45 | _info() { 46 | echo "$1" 47 | echo "secure_upgrade: $1" | to_console 48 | } 49 | 50 | FIRMWARE_PATH="/tmp/upgrade/firmware.img" 51 | FW_MATCH=$(fwenv_get_8311 --base64 'fw_match') 52 | FW_MATCH_NUM=$(fwenv_get_8311 'fw_match_num' '1') 53 | 54 | [ -f "$FIRMWARE_PATH" ] || _err "Firmware upgrade file '$FIRMWARE_PATH' does not exist." 1 55 | [ -n "$FW_MATCH" ] || _err "No firmware version match string set in 8311_fw_match fwenv." 1 56 | [ "$FW_MATCH_NUM" -gt 0 ] 2>/dev/null || FW_MATCH_NUM=1 57 | 58 | _info "Checking firmware image '$FIRMWARE_PATH' for string #$FW_MATCH_NUM matching '$FW_MATCH'" 59 | MATCH=$(strings "$FIRMWARE_PATH" | pcre2grep --line-buffered -o1 -m "$FW_MATCH_NUM" -- "$FW_MATCH" | tail -n "+$FW_MATCH_NUM" | head -n1) 60 | [ -n "$MATCH" ] || _err "No match found." 1 61 | 62 | _info "Matching string found: $MATCH" 63 | 64 | $UPG && { 65 | _info "Moving firmware file '$FIRMWARE_PATH' to '$FIRMWARE_OUT'" 66 | mv -fv "$FIRMWARE_PATH" "$FIRMWARE_OUT" 67 | 68 | _info "Setting new 8311_sw_ver fwenvs." 69 | fwenv_set_8311 'sw_verA' "$MATCH" 70 | fwenv_set_8311 'sw_verB' "$MATCH" 71 | 72 | $RESET && { 73 | _info "Restarting OMCId" 74 | /etc/init.d/omcid.sh restart 75 | } 76 | } 77 | 78 | exit 0 79 | -------------------------------------------------------------------------------- /files/common/usr/bin/pcre2grep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/files/common/usr/bin/pcre2grep -------------------------------------------------------------------------------- /files/common/usr/sbin/8311-extvlan-decode.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | _lib_8311_omci &>/dev/null || . /lib/8311-omci-lib.sh 3 | 4 | HEADER=true 5 | TABLE=false 6 | 7 | _help() { 8 | printf -- 'Tool for decoding the extended VLAN tables\n\n' 9 | 10 | printf -- 'Usage %s [options]\n\n' "$0" 11 | 12 | printf -- 'Options:\n' 13 | printf -- '-t --table\tOutput table version instead of user-friendly version\n' 14 | printf -- '-n --no-header\tDo not output informational headers\n' 15 | 16 | printf -- '-h --help\tThis help text\n' 17 | 18 | exit $1 19 | } 20 | 21 | while [ $# -gt 0 ]; do 22 | case "$1" in 23 | -t|--table) 24 | TABLE=true 25 | ;; 26 | -n|--no-header) 27 | HEADER=false 28 | ;; 29 | -h|--help) 30 | _help 0 31 | ;; 32 | 33 | *) 34 | _help 1 35 | ;; 36 | esac 37 | shift 38 | done 39 | 40 | dir() { 41 | [ "$1" = "i" ] && echo "inner" || echo "outer" 42 | } 43 | 44 | filter_priority() { 45 | local dir=$(dir "$1") 46 | 47 | if [ "$2" -le 7 ]; then 48 | echo "$2" 49 | elif [ "$2" -eq 8 ]; then 50 | echo -e "8\t(Do not filter on the $dir priority)" 51 | elif [ "$2" -eq 14 ]; then 52 | if [ "$dir" = "inner" ]; then 53 | echo -e "14\t(Default filter when no other one-tag rule applies)" 54 | else 55 | echo -e "14\t(Default filter when no other two-tag rule applies)" 56 | fi 57 | elif [ "$2" -eq 15 ]; then 58 | if [ "$dir" = "inner" ]; then 59 | echo -e "15\t(No-tag rule; ignore all other VLAN tag filter fields)" 60 | else 61 | echo -e "15\t(Not a double-tag rule; ignore all other outer tag filter fields)" 62 | fi 63 | else 64 | echo -e "$2\t(Reserved)" 65 | fi 66 | } 67 | 68 | filter_vid() { 69 | local dir=$(dir "$1") 70 | 71 | if [ "$2" -lt 4095 ]; then 72 | echo "$2" 73 | elif [ "$2" -eq 4096 ]; then 74 | echo -e "4096\t(Do not filter on the $dir VID)"; 75 | else 76 | echo -e "$2\t(Reserved)"; 77 | fi 78 | } 79 | 80 | filter_tpid_dei() { 81 | local dir=$(dir "$1") 82 | 83 | if [ "$2" -eq 0 ]; then 84 | echo -e "0\t(Do not filter on $dir TPID or DEI)" 85 | elif [ "$2" -eq 4 ]; then 86 | echo -e "4\t(TPID = 0x8100, ignore DEI)" 87 | elif [ "$2" -eq 5 ]; then 88 | echo -e "5\t(TPID = Input TPID, ignore DEI)" 89 | elif [ "$2" -eq 6 ]; then 90 | echo -e "6\t(TPID = Input TPID, DEI = 0)" 91 | elif [ "$2" -eq 7 ]; then 92 | echo -e "7\t(TPID = Input TPID, DEI = 1)" 93 | else 94 | echo -e "$2\t(Reserved)" 95 | fi 96 | } 97 | 98 | filter_ethertype() { 99 | if [ "$1" -eq 0 ]; then 100 | echo -e "0\t(Do not filter on EtherType)" 101 | elif [ "$1" -eq 1 ]; then 102 | echo -e "1\t(0x0800 - IPv4 IPoE)" 103 | elif [ "$1" -eq 2 ]; then 104 | echo -e "2\t(0x8863 / 0x8864 - PPPoE)" 105 | elif [ "$1" -eq 3 ]; then 106 | echo -e "3\t(0x0806 - ARP)" 107 | elif [ "$1" -eq 4 ]; then 108 | echo -e "4\t(0x86DD - IPv6 IPoE)" 109 | elif [ "$1" -eq 5 ]; then 110 | echo -e "5\t(0x888E - EAPOL)" 111 | else 112 | echo -e "$1\t(Reserved)" 113 | fi 114 | } 115 | 116 | filter_extended_criteria() { 117 | if [ "$1" -eq 0 ]; then 118 | echo -e "0\t(Do not filter on extended criteria)" 119 | elif [ "$1" -eq 1 ]; then 120 | echo -e "1\t(DHCPv4)" 121 | elif [ "$1" -eq 2 ]; then 122 | echo -e "2\t(DHCPv6)" 123 | else 124 | echo -e "$1\t(Reserved)" 125 | fi 126 | } 127 | 128 | treatment_remove_tags() { 129 | if [ "$1" -eq 3 ]; then 130 | echo -e "3\t(Discard the frame)" 131 | else 132 | echo "$1" 133 | fi 134 | } 135 | 136 | treatment_priority() { 137 | local dir=$(dir "$1") 138 | 139 | if [ "$2" -le 7 ]; then 140 | echo "$2" 141 | elif [ "$2" -eq 8 ]; then 142 | echo -e "8\t(Copy from the inner priority of received frame)" 143 | elif [ "$2" -eq 9 ]; then 144 | echo -e "9\t(Copy from the outer priority of received frame)" 145 | elif [ "$2" -eq 10 ]; then 146 | echo -e "10\t(Derive priority based on DSCP to P-bit mapping)" 147 | elif [ "$2" -eq 15 ]; then 148 | echo -e "15\t(Do not add an $dir tag)" 149 | else 150 | echo -e "$2\t(Reserved)" 151 | fi 152 | } 153 | 154 | treatment_vid() { 155 | if [ "$2" -lt 4095 ]; then 156 | echo "$2" 157 | elif [ "$2" -eq 4096 ]; then 158 | echo -e "4096\t(Copy from the inner VID of received frame)" 159 | elif [ "$2" -eq 4097 ]; then 160 | echo -e "4097\t(Copy from the outer VID of received frame)" 161 | else 162 | echo -e "$2\t(Reserved)" 163 | fi 164 | } 165 | 166 | treatment_tpid_dei() { 167 | if [ "$2" -eq 0 ]; then 168 | echo -e "0\t(TPID = Inner TPID, DEI = Inner DEI)" 169 | elif [ "$2" -eq 1 ]; then 170 | echo -e "1\t(TPID = Outer TPID, DEI = Outer DEI)" 171 | elif [ "$2" -eq 2 ]; then 172 | echo -e "2\t(TPID = Output TPID, DEI = Inner DEI)" 173 | elif [ "$2" -eq 3 ]; then 174 | echo -e "3\t(TPID = Output TPID, DEI = Outer DEI)" 175 | elif [ "$2" -eq 4 ]; then 176 | echo -e "4\t(TPID = 0x8100)" 177 | elif [ "$2" -eq 6 ]; then 178 | echo -e "6\t(TPID = Output TPID, DEI = 0)" 179 | elif [ "$2" -eq 7 ]; then 180 | echo -e "7\t(TPID = Output TPID, DEI = 1)" 181 | else 182 | echo -e "$2\t(Reserved)" 183 | fi 184 | } 185 | 186 | vlan_parse() { 187 | filter_outer_priority=$((($1 & 0xf0000000) >> 28)) 188 | filter_outer_vid=$((($1 & 0x0fff8000) >> 15)) 189 | filter_outer_tpid_dei=$((($1 & 0x00007000) >> 12)) 190 | 191 | filter_inner_priority=$((($2 & 0xf0000000) >> 28)) 192 | filter_inner_vid=$((($2 & 0x0fff8000) >> 15)) 193 | filter_inner_tpid_dei=$((($2 & 0x00007000) >> 12)) 194 | filter_extended_criteria=$((($2 & 0x00000ff0) >> 4)) 195 | filter_ethertype=$(($2 & 0x0000000f)) 196 | 197 | treatment_remove_tags=$((($3 & 0xc0000000) >> 30)) 198 | treatment_outer_priority=$((($3 & 0x000f0000) >> 16)) 199 | treatment_outer_vid=$((($3 & 0x0000fff8) >> 3)) 200 | treatment_outer_tpid_dei=$(($3 & 0x00000007)) 201 | 202 | treatment_inner_priority=$((($4 & 0x000f0000) >> 16)) 203 | treatment_inner_vid=$((($4 & 0x0000fff8) >> 3)) 204 | treatment_inner_tpid_dei=$(($4 & 0x00000007)) 205 | 206 | if $TABLE; then 207 | echo -ne "${filter_outer_priority}\t${filter_outer_vid}\t${filter_outer_tpid_dei}\t" 208 | echo -ne "${filter_inner_priority}\t${filter_inner_vid}\t${filter_inner_tpid_dei}\t${filter_ethertype}\t${filter_extended_criteria}\t" 209 | echo -ne "${treatment_remove_tags}\t${treatment_outer_priority}\t${treatment_outer_vid}\t${treatment_outer_tpid_dei}\t" 210 | echo -ne "${treatment_inner_priority}\t${treatment_inner_vid}\t${treatment_inner_tpid_dei}" 211 | echo 212 | else 213 | echo -ne "Filter Outer Priority:\t\t" 214 | filter_priority o $filter_outer_priority 215 | echo -ne "Filter Outer VID:\t\t" 216 | filter_vid o $filter_outer_vid 217 | echo -ne "Filter Outer TPID/DEI:\t\t" 218 | filter_tpid_dei o $filter_outer_tpid_dei 219 | 220 | echo -ne "Filter Inner Priority:\t\t" 221 | filter_priority i $filter_inner_priority 222 | echo -ne "Filter Inner VID:\t\t" 223 | filter_vid i $filter_inner_vid 224 | echo -ne "Filter Inner TPID/DEI:\t\t" 225 | filter_tpid_dei i $filter_inner_tpid_dei 226 | 227 | echo -ne "Filter EtherType:\t\t" 228 | filter_ethertype $filter_ethertype 229 | echo -ne "Filter Extended Criteria:\t" 230 | filter_extended_criteria $filter_extended_criteria 231 | 232 | echo -ne "Treatment tags to remove:\t" 233 | treatment_remove_tags $treatment_remove_tags 234 | echo -ne "Treatment outer priority:\t" 235 | treatment_priority o $treatment_outer_priority 236 | echo -ne "Treatment outer VID:\t\t" 237 | treatment_vid o $treatment_outer_vid 238 | echo -ne "Treatment outer TPID/DEI:\t" 239 | treatment_tpid_dei o $treatment_outer_tpid_dei 240 | 241 | echo -ne "Treatment inner priority:\t" 242 | treatment_priority i $treatment_inner_priority 243 | echo -ne "Treatment inner VID:\t\t" 244 | treatment_vid i $treatment_inner_vid 245 | echo -ne "Treatment inner TPID/DEI:\t" 246 | treatment_tpid_dei i $treatment_inner_tpid_dei 247 | fi 248 | } 249 | 250 | 251 | ext_vlan_tables=$(mibs 171) 252 | if [ -z "$ext_vlan_tables" ]; then 253 | echo "No Extended VLAN Tables Detected" >&2 254 | exit 1 255 | fi 256 | 257 | i=0 258 | for ext_vlan_table in $ext_vlan_tables; do 259 | if $HEADER; then 260 | echo "Extended VLAN table $ext_vlan_table" 261 | echo "------------------------" 262 | if $TABLE; then 263 | echo -e "Filter Outer\t\tFilter Inner\t\tFilter Other\tTreatment Outer\t\t\tTreatment Inner" 264 | echo -e "Prio\tVID\tTPIDDEI\tPrio\tVID\tTPIDDEI\tEthTyp\tExtCrit\tTagRem\tPrio\tVID\tTPIDDEI\tPrio\tVID\tTPIDDEI" 265 | fi 266 | fi 267 | [ "$i" -gt 0 ] && echo 268 | 269 | data=$(mibattrdata 171 $ext_vlan_table 6) 270 | for vlan_filter in $data; do 271 | w=$(echo $vlan_filter | sed -r 's/(.{8})/0x\1 /g') 272 | vlan_parse $w 273 | $TABLE || echo 274 | done 275 | i=$((i + 1)) 276 | done 277 | -------------------------------------------------------------------------------- /files/common/usr/sbin/8311-firmware-upgrade.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | _err() { 3 | echo "$1" >&2 4 | exit ${2:-1} 5 | } 6 | 7 | _help() { 8 | printf -- 'Tool for validating and installing prx126-sfp-pon firmware upgrades.\n\n' 9 | printf -- 'Usage: %s [options] \n\n' "$0" 10 | printf -- 'Options:\n' 11 | printf -- '-v|--validate\t\tValidate images from the firmware upgrade tar file.\n' 12 | printf -- '-i|--install\t\tInstall images from the firmware upgrade tar file to the inactive firmware bank.\n' 13 | printf -- '-r|--reboot\t\tReboot after a successful firmware upgrade.\n' 14 | printf -- '-y|--yes\t\tAnswer yes to any prompts.\n' 15 | printf -- '-h|--help\t\tThis help text.\n\n' 16 | printf -- '--\t\t\tDon'"'"'t process any further options, the next parameter is the firmware upgrade tar file.\n' 17 | } 18 | 19 | _yesno() { 20 | local DEFAULT=false 21 | [ "$1" = "y" ] && DEFAULT=true 22 | 23 | local yes 24 | read yes 25 | yes=$(echo "$yes" | tr 'YES' 'yes') 26 | 27 | if [ -n "$yes" ]; then 28 | [ "$yes" = "y" ] || [ "$yes" = "ye" ] || [ "$yes" = "yes" ] 29 | else 30 | $DEFAULT 31 | fi 32 | } 33 | 34 | VALIDATE=false 35 | INSTALL=false 36 | YES=false 37 | REBOOT=false 38 | TAR= 39 | while [ $# -gt 0 ]; do 40 | case "$1" in 41 | -h|--help) 42 | _help 43 | exit 0 44 | ;; 45 | -v|--validate) 46 | VALIDATE=true 47 | ;; 48 | 49 | -i|--install) 50 | INSTALL=true 51 | ;; 52 | -y|--yes) 53 | YES=true 54 | ;; 55 | -r|--reboot) 56 | REBOOT=true 57 | ;; 58 | --) 59 | TAR="$2" 60 | break 61 | ;; 62 | -*) 63 | _help 64 | exit 1 65 | ;; 66 | *) 67 | if [ -n "$TAR" ]; then 68 | _help 69 | exit 1 70 | fi 71 | 72 | TAR="$1" 73 | ;; 74 | esac 75 | shift 76 | done 77 | 78 | if ! $VALIDATE && ! $INSTALL; then 79 | VALIDATE=true 80 | INSTALL=true 81 | fi 82 | 83 | if [ -z "$TAR" ]; then 84 | _help 85 | exit 1 86 | fi 87 | 88 | if [ ! -r "$TAR" ]; then 89 | _err "Upgrade file '$TAR' not found." 90 | fi 91 | 92 | CONTROL=$(tar x -f "$TAR" -O -- control 2>/dev/null) 93 | if [ -z "$CONTROL" ]; then 94 | _err "Invalid firmware upgrade tar, control file not found." 95 | fi 96 | 97 | control_var() { 98 | [ -n "$1" ] || return 1 99 | echo "$CONTROL" | grep "^$1=" | cut -d= -f2- 100 | } 101 | 102 | sha256() { 103 | sha256sum "$@" | awk '{print $1}' 104 | } 105 | 106 | active_fwbank() { 107 | grep -E -o '\brootfsname=rootfs[AB]\b' /proc/cmdline | grep -E -o '[AB]$' 108 | } 109 | 110 | inactive_fwbank() { 111 | local active_bank=$(active_fwbank) 112 | if [ "$active_bank" = "A" ]; then 113 | echo "B" 114 | elif [ "$active_bank" = "B" ]; then 115 | echo "A" 116 | else 117 | return 1 118 | fi 119 | 120 | return 0 121 | } 122 | 123 | fwenv_set() { 124 | [ -n "$1" ] || return 1 125 | 126 | for i in 0 1; do 127 | fw_setenv "$1" "$2" || return $? 128 | done 129 | } 130 | 131 | ubi_default_order() { 132 | case "$1" in 133 | kernelA) echo "0"; ;; 134 | bootcoreA) echo "1"; ;; 135 | rootfsA) echo "2"; ;; 136 | kernelB) echo "3"; ;; 137 | bootcoreB) echo "4"; ;; 138 | rootfsB) echo "5"; ;; 139 | *) return 1; ;; 140 | esac 141 | } 142 | 143 | ubi_dev() { 144 | local NAME="$1" 145 | [ -n "$NAME" ] || _err "Must specify name for UBI volume name." 146 | VOL=$(ubinfo /dev/ubi0 -N "$NAME" 2>/dev/null | grep "Volume ID:" | awk '{print $3}') 147 | [ "$VOL" -ge 0 ] 2>/dev/null || return 1 148 | echo "/dev/ubi0_$VOL" 149 | } 150 | 151 | ubi_size() { 152 | local NAME="$1" 153 | [ -n "$NAME" ] || _err "Must specify name for UBI volume name." 154 | SIZE=$(ubinfo /dev/ubi0 -N "$NAME" 2>/dev/null | grep "Size:" | tr '(),' ' ' | awk '{print $4}') 155 | [ -n "$SIZE" ] || return 1 156 | echo "$SIZE" 157 | } 158 | 159 | ubi_create() { 160 | local NAME="$1" 161 | local SIZE="$2" 162 | local VOL="$3" 163 | 164 | echo "Creating $NAME UBI volume..." 165 | ubimkvol /dev/ubi0 -n "$VOL" -N "$NAME" -s "$SIZE" || ubimkvol /dev/ubi0 -n "$VOL" -N "$NAME" || _err "Error creating $NAME UBI volume." 166 | } 167 | 168 | ubi_resize() { 169 | local NAME="$1" 170 | local SIZE="$2" 171 | [ "$SIZE" -gt 0 ] 2>/dev/null || _err "Size of partition to resize must be > 0." 172 | 173 | echo "Resizing $NAME UBI volume to $SIZE bytes..." 174 | ubirsvol /dev/ubi0 -N "$NAME" -s "$SIZE" || _err "Error resizing $NAME UBI volume." 175 | } 176 | 177 | validate_image() { 178 | local VAR="$1" 179 | local FILE="$2" 180 | local NAME="$3" 181 | local SHA256=$(control_var "SHA256_$VAR") 182 | 183 | [ -z "$SHA256" ] && _err "$NAME hash not found in control file." 184 | echo -n "Validating $NAME image..." 185 | ACTUAL_SHA256=$(tar x -f "$TAR" -O -- "$FILE" 2>/dev/null | sha256) 186 | [ "$ACTUAL_SHA256" = "$SHA256" ] && echo " OK" || { echo " FAILED"; _err "Image $NAME hash '$ACTUAL_SHA256' does not match expected '$SHA256'."; } 187 | } 188 | 189 | install_image() { 190 | local VAR="$1" 191 | local FILE="$2" 192 | local NAME="$3" 193 | local UBI_VOLNAME="$4" 194 | 195 | local SHA256=$(control_var "SHA256_$VAR") 196 | local SIZE=$(control_var "SIZE_$VAR") 197 | 198 | [ -z "$SHA256" ] && _err "$NAME hash not found in control file." 199 | [ -z "$SIZE" ] && _err "$NAME file size not found in control file." 200 | 201 | local UBI=$(ubi_dev "$UBI_VOLNAME") 202 | local UBI_VOL=$(ubi_default_order "$UBI_VOLNAME") 203 | [ "$UBI_VOL" -ge 0 ] 2>/dev/null || _err "Invalid UBI volume '$UBI_VOLNAME'." 204 | if [ -z "$UBI" ]; then 205 | ubi_create "$UBI_VOLNAME" "$SIZE" "$UBI_VOL" 206 | UBI=$(ubi_dev "$UBI_VOLNAME") 207 | [ -n "$UBI" ] || _err "Error finding UBI volume '$UBI_VOLUME' after create." 208 | else 209 | UBI_SIZE=$(ubi_size "$UBI_VOLNAME") 210 | [ -n "$UBI_SIZE" ] || _err "Invalid UBI volume '$UBI_VOLNAME' while resizing." 211 | if [ "$UBI_SIZE" -lt "$SIZE" ]; then 212 | ubi_resize "$UBI_VOLNAME" "$SIZE" 213 | fi 214 | fi 215 | 216 | 217 | echo "Installing $NAME image to $UBI_VOLNAME ($UBI)..." 218 | tar x -f "$TAR" -O -- "$FILE" 2>/dev/null | ubiupdatevol -s "$SIZE" "$UBI" - || _err "Error installing $NAME to '$UBI'." 219 | echo -n "Validating installed $NAME image..." 220 | ACTUAL_SHA256=$(head -c "$SIZE" "$UBI" | sha256) 221 | [ "$ACTUAL_SHA256" = "$SHA256" ] && echo " OK" || { echo " FAILED"; _err "Installed image $NAME hash '$ACTUAL_SHA256' does not match expected '$SHA256'."; } 222 | } 223 | 224 | FW_VERSION=$(control_var FW_VERSION) 225 | FW_REVISION=$(control_var FW_REVISION) 226 | FW_VARIANT=$(control_var FW_VARIANT) 227 | 228 | { [ -n "$FW_VERSION" ] && [ -n "$FW_REVISION" ] && [ "$FW_VARIANT" ]; } || _err "Missing firmware version information." 229 | 230 | echo "New Firmware:" 231 | echo "Version: $FW_VERSION" 232 | echo "Revision: $FW_REVISION" 233 | echo "Variant: $FW_VARIANT" 234 | echo 235 | 236 | if $VALIDATE; then 237 | validate_image "KERNEL" "kernel.bin" "Kernel" 238 | validate_image "BOOTCORE" "bootcore.bin" "Bootcore" 239 | validate_image "ROOTFS" "rootfs.img" "RootFS" 240 | echo 241 | fi 242 | 243 | INSTALL_BANK=$(inactive_fwbank) 244 | echo "Active firmware bank is $(active_fwbank), will install to bank $INSTALL_BANK." 245 | 246 | if $INSTALL; then 247 | LOCK="/tmp/8311-firmware-upgrade.lock" 248 | ( 249 | flock -n 10 || _err "Firmware upgrade already in progress." 250 | 251 | echo 252 | if ! $YES; then 253 | echo -n "Are you sure you want to install this firmware to bank $INSTALL_BANK? (y/N) " 254 | _yesno || exit 1 255 | fi 256 | 257 | install_image "KERNEL" "kernel.bin" "Kernel" "kernel$INSTALL_BANK" 258 | install_image "BOOTCORE" "bootcore.bin" "Bootcore" "bootcore$INSTALL_BANK" 259 | install_image "ROOTFS" "rootfs.img" "RootFS" "rootfs$INSTALL_BANK" 260 | 261 | echo 262 | if ! $YES; then 263 | echo -n "Firmware successfully installed into bank $INSTALL_BANK. Update commit_bank to $INSTALL_BANK? (Y/n) " 264 | _yesno y || exit 0 265 | fi 266 | 267 | fwenv_set "commit_bank" "$INSTALL_BANK" && echo "Set commit_bank to $INSTALL_BANK, reboot to boot new firmware." || _err "Error setting commit_bank to $INSTALL_BANK." 268 | echo 269 | 270 | if ! $YES && ! $REBOOT; then 271 | echo -n "Would you like to reboot to the new firmware now? (y/N) " 272 | _yesno || exit 0 273 | REBOOT=true 274 | fi 275 | 276 | if $REBOOT; then 277 | echo "Rebooting..." 278 | ( sleep 3 && reboot; ) & 279 | fi 280 | 281 | rm -f "$LOCK" 282 | ) 10>"$LOCK" 283 | fi 284 | 285 | exit 0 286 | -------------------------------------------------------------------------------- /files/common/usr/sbin/8311-persist-root-password.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ROOT_PWHASH=$(awk -F: '/^root:/ {print $2}' /etc/shadow) 3 | if [ -z "$ROOT_PWHASH" ]; then 4 | echo "Error getting current root password" >&2 5 | exit 1 6 | fi 7 | 8 | echo "Setting fwenv 8311_root_pwhash to '$ROOT_PWHASH'" 9 | fwenv_set -8 "root_pwhash" "$ROOT_PWHASH" 10 | -------------------------------------------------------------------------------- /files/common/usr/sbin/8311-pingd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | _lib_8311 2>/dev/null || . /lib/8311.sh 4 | 5 | while true ; do 6 | PINGD_ENABLED=$(fwenv_get_8311 "pingd" "1") 7 | # Ping host to help management work 8 | PING_HOST=$(get_8311_ping_host) 9 | 10 | echo "Starting ping to: $PING_HOST" | to_console 11 | 12 | if [ "$PINGD_ENABLED" -ne "0" ] 2>/dev/null; then 13 | ping -i 5 "$PING_HOST" &> /dev/null < /dev/null 14 | sleep 5 15 | else 16 | sleep 30 17 | fi 18 | done 19 | -------------------------------------------------------------------------------- /files/common/usr/sbin/8311-rarpd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | _lib_8311 2>/dev/null || . /lib/8311.sh 3 | 4 | echo "8311 Reverse ARP daemon: start monitoring" | to_console 5 | while true; do 6 | RARP_ENABLED=$(fwenv_get_8311 "reverse_arp" "1") 7 | 8 | myip=$(ip -o -4 a list dev eth0_0_1_lct | pcre2grep -o1 ' inet (\d+\.\d+\.\d+\.\d+)/') 9 | if [ -n "$myip" ] && [ "$RARP_ENABLED" -ne 0 ] 2>/dev/null && [ "$(cat /sys/class/net/eth0_0_1_lct/carrier 2>/dev/null)" -eq 1 ] 2>/dev/null ; then 10 | IFS='.' read -r i1 i2 i3 i4 </dev/null | 15 | pcre2grep --line-buffered -o1 -o2 -o3 --om-separator ' ' '^(\d+)\.\d+ (\S+) > \S+, \S+, length \d+: (?:.+? tell )?(\d+\.\d+\.\d+\.\d+)' | 16 | awk '{ 17 | ip = $3 18 | mac = $2 19 | time = $1 20 | if (!macs[ip] || !times[ip] || macs[ip] != mac || (time - times[ip]) > 15) { 21 | macs[ip] = $2 22 | times[ip] = $1 23 | print "ip neigh replace dev eth0_0_1_lct to " ip " lladdr " mac " nud reachable" 24 | } 25 | }' | 26 | sh 27 | sleep 1 28 | else 29 | sleep 30 30 | fi 31 | done 32 | -------------------------------------------------------------------------------- /files/common/usr/sbin/8311-rx_los.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | PIN=505 3 | 4 | 5 | _lib_8311 2>/dev/null || . /lib/8311.sh 6 | 7 | GPIO="/sys/class/gpio/gpio${PIN}" 8 | [ -d "$GPIO" ] || echo "$PIN" > "/sys/class/gpio/export" 9 | 10 | RX_LOS=$(fwenv_get_8311 "rx_los") 11 | [ "$RX_LOS" -ne 0 ] 2>/dev/null && RX_LOS=true || RX_LOS=false 12 | 13 | 14 | if $RX_LOS; then 15 | echo "8311 RX_LOS daemon: start monitoring LOS alarm" | to_console 16 | while true; do 17 | LOS_VALUE="$(cat "$GPIO/value")" 18 | LOS_ALARM=$([ -d "/sys/devices/virtual/net/gem-omci" ] && { pon alarm_status_get 0 | grep -E -o 'alarm_status=\d+' | cut -d= -f2; } || echo "0") 19 | 20 | if [ "$LOS_VALUE" -ne "$LOS_ALARM" ] 2>/dev/null; then 21 | [ "$LOS_ALARM" -eq 1 ] 2>/dev/null && GPIO_DIR="high" || GPIO_DIR="low" 22 | echo "8311 RX_LOS daemon: setting RX_LOS pin to $GPIO_DIR" | to_console 23 | echo "$GPIO_DIR" > "$GPIO/direction" 24 | fi 25 | sleep 3 26 | done 27 | else 28 | echo "8311 RX_LOS daemon: start disabling RX_LOS" | to_console 29 | while true; do 30 | if [ "$(cat "$GPIO/value")" -ne 0 ]; then 31 | echo "8311 RX_LOS daemon: setting RX_LOS pin to low" | to_console 32 | echo "low" > "$GPIO/direction" 33 | fi 34 | sleep 1 35 | done 36 | fi 37 | -------------------------------------------------------------------------------- /files/common/usr/sbin/8311-support.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo "Generating support archive ..." 3 | echo 4 | OUT="/tmp/support.tar.gz" 5 | TMPDIR=$(mktemp -d) 6 | OUTDIR="$TMPDIR/support" 7 | 8 | mkdir -p "$OUTDIR" 9 | 10 | echo -n "Dumping FW ENVs ..." 11 | fw_printenv | sort -V > "$OUTDIR/fwenvs.txt" 12 | echo " done" 13 | 14 | echo -n "Dumping pontop pages ..." 15 | rm -f "/tmp/pontop.txt" 16 | pontop -b > /dev/null 17 | mv "/tmp/pontop.txt" "$OUTDIR/" 18 | echo " done" 19 | 20 | echo -n "Dumping OMCI MEs ..." 21 | omci_pipe.sh md > "$OUTDIR/omci_pipe_md.txt" 22 | omci_pipe.sh mda > "$OUTDIR/omci_pipe_mda.txt" 23 | echo " done" 24 | 25 | echo -n "Dumping VLAN tables ..." 26 | 8311-extvlan-decode.sh -t > "$OUTDIR/extvlan-tables.txt" && { 27 | printf "\n\n" 28 | 8311-extvlan-decode.sh 29 | } >> "$OUTDIR/extvlan-tables.txt" 30 | echo " done" 31 | 32 | echo -n "Dumping TC Filters ..." 33 | 8311-tc-filter-dump.sh > "$OUTDIR/tc_filters.txt" 34 | echo " done" 35 | 36 | echo -n "Dumping System Log ..." 37 | logread > "$OUTDIR/system_log.txt" 38 | echo " done" 39 | 40 | echo 41 | echo -n "Writing support archive '$OUT' ..." 42 | rm -f "$OUT" 43 | tar -cz -f "$OUT" -C "$TMPDIR" -- support 44 | rm -rf "$TMPDIR" 45 | 46 | echo " done" 47 | 48 | echo 49 | echo "WARNING: This support archive contains potentially sensitive information. Do not share it publically" 50 | -------------------------------------------------------------------------------- /files/common/usr/sbin/8311-tc-filter-dump.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | INTERFACES=$(ip -o li | egrep -o -- '^\d+: \S+[@:]' | awk -F '[ @:]+' '{print $2}' | egrep -- '^(eth|gem|pmapper|tcont|sw)' | egrep -v -- '(-omci|lct)$' | sort -V) 3 | for DEV in $INTERFACES; do 4 | for DIR in ingress egress; do 5 | TC=$(tc filter show dev "$DEV" "$DIR") 6 | if [ -n "$TC" ]; then 7 | echo "--------------- tc filter show dev $DEV $DIR ---------------" 8 | echo "$TC" 9 | echo 10 | echo 11 | fi 12 | done 13 | done 14 | -------------------------------------------------------------------------------- /files/common/usr/sbin/8311-vlansd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | _lib_8311 2>/dev/null || . /lib/8311.sh 4 | 5 | pon_hash() { 6 | /usr/sbin/8311-detect-config.sh -H 7 | } 8 | 9 | FIX_ENABLED=$(fwenv_get_8311 "fix_vlans" "1") 10 | [ "$FIX_ENABLED" -eq 0 ] 2>/dev/null && exit 0 11 | 12 | HOOK="/ptconf/8311/vlan_fixes_hook.sh" 13 | 14 | FIXES="" 15 | [ "$FIX_ENABLED" -eq 1 ] && FIXES="/usr/sbin/8311-fix-vlans.sh" 16 | HOOKCMD=". /lib/8311-vlans-lib.sh && . $HOOK" 17 | 18 | LAST_HASH="" 19 | 20 | echo "8311 VLANs daemon: start monitoring" | to_console 21 | while true ; do 22 | [ -f "$HOOK" ] && { [ -n "$FIXES" ] && CMD="$FIXES && $HOOKCMD" || CMD="$HOOKCMD"; } || CMD="$FIXES" 23 | 24 | if [ -n "$CMD" ] && [ -d "/sys/devices/virtual/net/gem-omci" ]; then 25 | HASH=$(pon_hash) 26 | if [ "$HASH" != "$LAST_HASH" ]; then 27 | if VLANS=$(flock /tmp/8311-fix-vlans.lock -c "$CMD" 2>&1); then 28 | LAST_HASH="$HASH" 29 | echo "8311 VLANs daemon: new configuration detected, ran fix-vlans script:" | to_console 30 | echo "$VLANS" | to_console 31 | fi 32 | fi 33 | fi 34 | 35 | sleep 5 36 | done 37 | -------------------------------------------------------------------------------- /files/common/usr/sbin/alternate_firmware_info: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ -f "/tmp/8311-alt-firmware" ]; then 4 | cat "/tmp/8311-alt-firmware" 5 | exit 0 6 | fi 7 | 8 | _lib_8311 2>/dev/null || . /lib/8311.sh 9 | 10 | _err() { 11 | echo "$1" >&2 12 | exit ${2:-1} 13 | } 14 | 15 | ALTERNAT_BANK=$(inactive_fwbank) 16 | [ -z "$ALTERNAT_BANK" ] && _err "Alternate firmware bank could not be detected!" >&2 17 | 18 | MTDALTROOT=$(grep -e ' "rootfs'"$ALTERNAT_BANK"'"$' /proc/mtd | cut -d: -f 1 | sed 's/mtd/mtdblock/g') 19 | [ -z "$MTDALTROOT" ] && _err "Unable to detect alternate firmeware mtd block device!" 20 | 21 | 22 | MTDALTBLOCK="/dev/$MTDALTROOT" 23 | [ ! -b "$MTDALTBLOCK" ] && _err "MTD block device '$MTDALTBLOCK' does not exist!" 24 | 25 | 26 | MNTDIR=$(mktemp -d /tmp/XXXXXX) 27 | [ -z "$MNTDIR" ] && _err "Failed to create mount directory!" 28 | 29 | FW_VARIANT="unknown" 30 | FW_VERSION="unknown" 31 | FW_REVISION="unknown" 32 | 33 | mount -t squashfs -o ro "$MTDALTBLOCK" "$MNTDIR" || _err "Failed to mount alternate firmware image!" 34 | 35 | VER_8311="$MNTDIR/etc/8311_version" 36 | PTCONF="$MNTDIR/ptrom/ptconf" 37 | SYSINFO="$PTCONF/sysinfo_conf" 38 | STATEOV="$MNTDIR/www/html/stateOverview_ct.html" 39 | BANNER="$MNTDIR/etc/banner" 40 | 41 | if [ -f "$VER_8311" ]; then 42 | cat "$VER_8311" > "/tmp/8311-alt-firmware" 43 | else 44 | if [ -f "$STATEOV" ]; then 45 | BFW_VER=$(grep -A1 8311modver "$STATEOV" | grep -E '\S+ \(\S+)' | sed -r 's#\s*##g' | tr '()' ' ') 46 | if [ -n "$BFW_VER" ]; then 47 | FW_VARIANT="bfw" 48 | FW_VERSION=$(echo "$BFW_VER" | awk '{print $1}') 49 | FW_REVISION=$(echo "$BFW_VER" | awk '{print $2}') 50 | fi 51 | fi 52 | 53 | if [ "$FW_VARIANT" = "unknown" ] && [ -f "$BANNER" ]; then 54 | VER=$(grep -E -o '8311 Community Firmware MOD \[\S+\] - \S+ \(\S+)' "$BANNER" | tr '[]()' ' ') 55 | if [ -n "$VER" ]; then 56 | FW_VARIANT=$(echo "$VER" | awk '{print $5}') 57 | FW_VERSION=$(echo "$VER" | awk '{print $6}') 58 | FW_REVISION=$(echo "$VER" | awk '{print $7}') 59 | else 60 | VER=$(grep -E -o '8311 Community Firmware MOD - \S+ \(\S+)' "$BANNER" | tr '[]()' ' ') 61 | if [ -n "$VER" ]; then 62 | FW_VARIANT="bfw" 63 | FW_VERSION=$(echo "$BFW_VER" | awk '{print $5}') 64 | FW_REVISION=$(echo "$BFW_VER" | awk '{print $6}') 65 | fi 66 | fi 67 | fi 68 | 69 | if [ "$FW_VARIANT" = "unknown" ] && [ -f "$SYSINFO" ]; then 70 | BFW_VER=$(uci -c "$PTCONF" -q get sysinfo_conf.SoftwareVersion.value) 71 | if [ -n "$BFW_VER" ]; then 72 | FW_VARIANT="bfw_stock" 73 | FW_VERSION="$BFW_VER" 74 | FW_REVISION="" 75 | fi 76 | fi 77 | 78 | echo "FW_VARIANT=$FW_VARIANT" > "/tmp/8311-alt-firmware" 79 | echo "FW_VERSION=$FW_VERSION" >> "/tmp/8311-alt-firmware" 80 | echo "FW_REVISION=$FW_REVISION" >> "/tmp/8311-alt-firmware" 81 | fi 82 | 83 | umount "$MNTDIR" 2>/dev/null 84 | rmdir "$MNTDIR" 2>/dev/null 85 | 86 | cat "/tmp/8311-alt-firmware" 87 | exit 0 88 | -------------------------------------------------------------------------------- /files/common/usr/sbin/fwenv_get: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | _help() { 3 | { 4 | printf -- 'Tool to get fwenv value.\n\n' 5 | printf -- 'Usage: %s [options] name [default-value]\n\n' "$0" 6 | printf -- 'Options:\n' 7 | printf -- '-8 --8311\tPrefix fwenv name with "8311_".\n' 8 | printf -- '-b --base64\tSuffix name with "_b64" and decode value as base64.\n' 9 | printf -- '-h --help\tShow this help.\n' 10 | printf -- '--\t\tStop all further options processing.\n' 11 | } >&2 12 | 13 | exit ${1:-1} 14 | } 15 | 16 | B64=false 17 | PREFIX= 18 | SUFFIX= 19 | NAME= 20 | DEFAULT= 21 | 22 | while [ $# -gt 0 ]; do 23 | case "$1" in 24 | --) 25 | shift 26 | break 27 | ;; 28 | -h|--help) 29 | _help 0 30 | ;; 31 | -8|--8311) 32 | PREFIX="8311_" 33 | ;; 34 | -b|--base64) 35 | B64=true 36 | SUFFIX="_b64" 37 | ;; 38 | -*) 39 | _help 1 40 | ;; 41 | *) 42 | [ -n "$DEFAULT" ] && _help 1 43 | [ -n "$NAME" ] && DEFAULT="$1" || NAME="$1" 44 | ;; 45 | esac 46 | shift 47 | done 48 | 49 | [ -n "$NAME" ] || _help 1 50 | 51 | NAME="$PREFIX$NAME$SUFFIX" 52 | 53 | if VALUE=$(fw_printenv -n -- "$NAME" 2>/dev/null) && [ -n "$VALUE" ] && $B64; then 54 | VALUE=$(echo "$VALUE" | base64 -d 2>/dev/null) || VALUE= 55 | fi 56 | 57 | if [ -n "$VALUE" ]; then 58 | echo "$VALUE" 59 | true 60 | else 61 | [ -n "$DEFAULT" ] && echo "$DEFAULT" 62 | false 63 | fi 64 | -------------------------------------------------------------------------------- /files/common/usr/sbin/fwenv_set: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | _help() { 3 | { 4 | printf -- 'Tool to set fwenv value.\n\n' 5 | printf -- 'Usage: %s [options] name [value]\n\n' "$0" 6 | printf -- 'Options:\n' 7 | printf -- '-8 --8311\tPrefix fwenv name with "8311_".\n' 8 | printf -- '-b --base64\tSuffix name with "_b64" and encode value as base64.\n' 9 | printf -- '-h --help\tShow this help.\n' 10 | printf -- '--\t\tStop all further options processing.\n' 11 | } >&2 12 | 13 | exit ${1:-1} 14 | } 15 | 16 | B64=false 17 | PREFIX= 18 | SUFFIX= 19 | NAME= 20 | VALUE= 21 | 22 | while [ $# -gt 0 ]; do 23 | case "$1" in 24 | --) 25 | shift 26 | break 27 | ;; 28 | -h|--help) 29 | _help 0 30 | ;; 31 | -8|--8311) 32 | PREFIX="8311_" 33 | ;; 34 | -b|--base64) 35 | B64=true 36 | SUFFIX="_b64" 37 | ;; 38 | -*) 39 | _help 1 40 | ;; 41 | *) 42 | [ -n "$VALUE" ] && _help 1 43 | [ -n "$NAME" ] && VALUE="$1" || NAME="$1" 44 | ;; 45 | esac 46 | shift 47 | done 48 | 49 | [ -n "$NAME" ] || _help 1 50 | 51 | NAME="$PREFIX$NAME$SUFFIX" 52 | 53 | $B64 && VALUE="$(echo -n "$VALUE" | base64)" 54 | 55 | for i in 0 1; do 56 | fw_setenv -- "$NAME" "$VALUE" || return $? 57 | done 58 | -------------------------------------------------------------------------------- /files/reset/etc/init.d/_8311-reset_fwenvs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | 3 | _lib_8311 2>/dev/null || . /lib/8311.sh 4 | 5 | START=17 6 | 7 | boot() { 8 | FWENV_BACK="/ptconf/8311/fwenvs_backup.env" 9 | if [ ! -f "$FWENV_BACK" ]; then 10 | mkdir -p /ptconf/8311 11 | echo "Backing up existing 8311 fwenvs before resetting them..." | to_console 12 | fw_printenv | pcre2grep '^(8311_[^=]+)=' > "$FWENV_BACK" 13 | 14 | FWENVS=$(cat "$FWENV_BACK" | pcre2grep -o1 '^([^=]+)=') 15 | for FWENV in $FWENVS; do 16 | echo "Clearing fwenv '$FWENV'..." | to_console 17 | fwenv_set "$FWENV" 18 | done 19 | 20 | echo "Rebooting" | to_console 21 | reboot 22 | return 1 23 | fi 24 | } 25 | -------------------------------------------------------------------------------- /files/reset/etc/rc.d/S17_8311-reset_fwenvs.sh: -------------------------------------------------------------------------------- 1 | ../init.d/_8311-reset_fwenvs.sh -------------------------------------------------------------------------------- /i18n/lmo/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/i18n/lmo/.gitkeep -------------------------------------------------------------------------------- /mods/basic-i18n.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | I18N_DIR="$BASE_DIR/i18n" 5 | PO_DIR="$I18N_DIR/po" 6 | LMO_DIR="$I18N_DIR/lmo" 7 | PO2LMO_SRC_DIR="$I18N_DIR/po2lmo" 8 | OUTPUT_DIR="$ROOT_DIR/usr/lib/lua/luci/i18n" 9 | 10 | rm -fv $LMO_DIR/*.lmo 11 | 12 | mkdir -p "$LMO_DIR" 13 | mkdir -p "$OUTPUT_DIR" 14 | 15 | for po_file in "$PO_DIR"/*.po; do 16 | if [ -f "$po_file" ] && ! grep -Pq '\.en\.po$' <<< "$po_file"; then 17 | po_filename=$(basename "$po_file" .po) 18 | lmo_file="$LMO_DIR/$po_filename.lmo" 19 | echo "Compiling $po_file to $lmo_file" 20 | "$TOOLS_DIR/po2lmo.py" "$po_file" "$lmo_file" 21 | fi 22 | done 23 | 24 | echo "Copy lmo to output directory..." 25 | mkdir -pv "$OUTPUT_DIR" 26 | cp -fv "$LMO_DIR"/*.lmo "$OUTPUT_DIR/" 27 | 28 | echo "Success." 29 | -------------------------------------------------------------------------------- /mods/basic-mods.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if ls packages/basic/*.ipk &>/dev/null; then 4 | for IPK in packages/basic/*.ipk; do 5 | echo "Extracting '$(basename "$IPK")' to '$ROOT_DIR'." 6 | tar xfz "$IPK" -O -- "./data.tar.gz" | tar xvz -C "$ROOT_DIR/" 7 | done 8 | fi 9 | 10 | UCI_FW_RULES="$ROOT_DIR/etc/uci-defaults/26-firewall-rules" 11 | 12 | UCI_FW_RULES_HEAD=$(grep -B99999999 '/usr/sbin/ptp4l' "$UCI_FW_RULES" | head -n -1) 13 | UCI_FW_RULES_FOOT=$(grep -A99999999 '/usr/sbin/ptp4l' "$UCI_FW_RULES") 14 | 15 | echo "$UCI_FW_RULES_HEAD" > "$UCI_FW_RULES" 16 | 17 | cat >> "$UCI_FW_RULES" <<'HTTP_RULES' 18 | 19 | if [ -f /usr/sbin/uhttpd ]; then 20 | uci batch << EOF 21 | add firewall rule 22 | set firewall.@rule[-1].name='Allow-HTTP' 23 | set firewall.@rule[-1].src='lan' 24 | set firewall.@rule[-1].proto='tcp' 25 | set firewall.@rule[-1].dest_port='80' 26 | set firewall.@rule[-1].target='ACCEPT' 27 | EOF 28 | 29 | if [ -f /usr/sbin/px5g ]; then 30 | uci batch << EOF 31 | add firewall rule 32 | set firewall.@rule[-1].name='Allow-HTTPs' 33 | set firewall.@rule[-1].src='lan' 34 | set firewall.@rule[-1].proto='tcp' 35 | set firewall.@rule[-1].dest_port='443' 36 | set firewall.@rule[-1].target='ACCEPT' 37 | EOF 38 | fi 39 | fi 40 | 41 | HTTP_RULES 42 | 43 | echo "$UCI_FW_RULES_FOOT" >> "$UCI_FW_RULES" 44 | 45 | 46 | sed -r 's#(\s+start \"\$@\")$#\1 \&#' -i "$ROOT_DIR/etc/init.d/dropbear" 47 | 48 | INITTAB="$ROOT_DIR/etc/inittab" 49 | sed -r 's/^(ttyLTQ0)/#\1/g' -i "$INITTAB" 50 | echo "::askconsole:/bin/login" >> "$INITTAB" 51 | 52 | LUA8311="$ROOT_DIR/usr/lib/lua/8311" 53 | mkdir -pv "$LUA8311" 54 | cat > "$LUA8311/version.lua" <<8311VER 55 | module "8311.version" 56 | 57 | variant = "${FW_VARIANT}" 58 | version = "${FW_VERSION}" 59 | revision = "${FW_REVISION}" 60 | 8311VER 61 | 62 | rm -fv "$ROOT_DIR/etc/mibs/prx300_1U.ini.bk" 63 | 64 | LUCI_MENUD_SYSTEM_JSON="$ROOT_DIR/usr/share/luci/menu.d/luci-mod-system.json" 65 | echo "Patching '$LUCI_MENUD_SYSTEM_JSON' ..." 66 | LUCI_MENUD_SYSTEM=$(jq 'delpaths([["admin/system/flash"], ["admin/system/crontab"], ["admin/system/startup"], ["admin/system/admin/dropbear"], ["admin/system/system"]])' "$LUCI_MENUD_SYSTEM_JSON") 67 | echo "$LUCI_MENUD_SYSTEM" > "$LUCI_MENUD_SYSTEM_JSON" 68 | 69 | LUCI_MENUD_STATUS_JSON="$ROOT_DIR/usr/share/luci/menu.d/luci-mod-status.json" 70 | echo "Patching '$LUCI_MENUD_STATUS_JSON' ..." 71 | LUCI_MENUD_STATUS=$(jq 'delpaths([["admin/status/iptables"], ["admin/status/processes"]])' "$LUCI_MENUD_STATUS_JSON") 72 | echo "$LUCI_MENUD_STATUS" > "$LUCI_MENUD_STATUS_JSON" 73 | 74 | RPCD_LUCI="$ROOT_DIR/usr/libexec/rpcd/luci" 75 | echo "Patching '$RPCD_LUCI' ..." 76 | sed -r 's#passwd %s >/dev/null 2>&1#passwd %s \&>/dev/null \&\& /usr/sbin/8311-persist-root-password.sh \&>/dev/null#' -i "$RPCD_LUCI" 77 | 78 | if [ "$KERNEL_VARIANT" = "bfw" ]; then 79 | rm -rfv "$ROOT_DIR/lib/modules" "$ROOT_DIR/lib/firmware" 80 | cp -va "$ROOT_BFW/lib/modules/." "$ROOT_DIR/lib/modules" 81 | cp -va "$ROOT_BFW/lib/firmware/." "$ROOT_DIR/lib/firmware" 82 | fi 83 | 84 | BFW_FILES=( 85 | ) 86 | 87 | for bfw_file in "${BFW_FILES[@]}"; do 88 | cp -fv "${ROOT_BFW}/${bfw_file}" "${ROOT_DIR}/${bfw_file}" 89 | done 90 | -------------------------------------------------------------------------------- /mods/bfw-mods.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Add MOD Version to webui 4 | STATE_OVCT="$ROOT_DIR/www/html/stateOverview_ct.html" 5 | dos2unix "$STATE_OVCT" 6 | 7 | STATE_OVCT_HEAD=$(grep -B99999999 -A1 -P '' "$STATE_OVCT") 8 | STATE_OVCT_FOOT=$(grep -A99999999 -P '' "$STATE_OVCT" | tail -n +3) 9 | 10 | echo "$STATE_OVCT_HEAD" > "$STATE_OVCT" 11 | cat >> "$STATE_OVCT" < 13 | 14 | [$FW_VARIANT] - $FW_VERSION ($FW_REVISION) 15 | 16 | MOD_VERSION 17 | echo "$STATE_OVCT_FOOT" >> "$STATE_OVCT" 18 | unix2dos "$STATE_OVCT" 19 | 20 | # Modify language files 21 | LANG_EN_GB="$ROOT_DIR/www/language/i18n_en_gb" 22 | dos2unix "$LANG_EN_GB" 23 | 24 | LANG_EN_GB_HEAD=$(grep -B99999999 -P '^\s+"softwarever":' "$LANG_EN_GB") 25 | LANG_EN_GB_FOOT=$(grep -A99999999 -P '^\s+"softwarever":' "$LANG_EN_GB" | tail -n +2) 26 | 27 | echo "$LANG_EN_GB_HEAD" > "$LANG_EN_GB" 28 | cat >> "$LANG_EN_GB" <> "$LANG_EN_GB" 32 | 33 | sed -r 's/("regidtextlength":".+ octets)[^"]+"/\1"/g' -i "$LANG_EN_GB" 34 | unix2dos "$LANG_EN_GB" 35 | 36 | LANG_ZH_CN="$ROOT_DIR/www/language/i18n_zh_cn" 37 | dos2unix "$LANG_ZH_CN" 38 | 39 | LANG_ZH_CN_HEAD=$(grep -B99999999 -P '^\s+"softwarever":' "$LANG_ZH_CN") 40 | LANG_ZH_CN_FOOT=$(grep -A99999999 -P '^\s+"softwarever":' "$LANG_ZH_CN" | tail -n +2) 41 | 42 | echo "$LANG_ZH_CN_HEAD" > "$LANG_ZH_CN" 43 | cat >> "$LANG_ZH_CN" <> "$LANG_ZH_CN" 47 | 48 | sed -r 's/("regidtextlength":".+位)[^"]+"/\1"/g' -i "$LANG_ZH_CN" 49 | unix2dos "$LANG_ZH_CN" 50 | 51 | OLTAUTH_JS="$ROOT_DIR/www/js/oltauth_comn.js" 52 | OLTAUTH_JS_PART1=$(grep -B99999999 'Regid_text.length > 36' "$OLTAUTH_JS" | head -n -1) 53 | OLTAUTH_JS_PART2=$(grep -A99999999 'Regid_text.length > 36' "$OLTAUTH_JS" | tail -n +2 | grep -B99999999 -A1 'function validCheck()') 54 | OLTAUTH_JS_PART3=$(grep -A99999999 'function validCheck()' "$OLTAUTH_JS" | grep -A99999999 'if ( isCnInclude($("#Regid_text").val()) )' | grep -B99999999 -A1 'function validCheckCu()') 55 | OLTAUTH_JS_PART4=$(grep -A99999999 'function validCheckCu()' "$OLTAUTH_JS" | grep -A99999999 'if ( isCnInclude($("#Regid_text").val()) )') 56 | 57 | echo "$OLTAUTH_JS_PART1" > "$OLTAUTH_JS" 58 | cat >> "$OLTAUTH_JS" < 36 ) { 60 | REG_ID_CHECK 61 | echo "$OLTAUTH_JS_PART2" >> "$OLTAUTH_JS" 62 | echo "$OLTAUTH_JS_PART3" >> "$OLTAUTH_JS" 63 | echo "$OLTAUTH_JS_PART4" >> "$OLTAUTH_JS" 64 | 65 | MAIN_HTML="$ROOT_DIR/www/html/main.html" 66 | MAIN_HTML_HEAD=$(grep -B99999999 -P ' "$MAIN_HTML" 70 | cat >> "$MAIN_HTML" <<8311_LOGO 71 | 72 | 73 | 8311_LOGO 74 | echo "$MAIN_HTML_FOOT" >> "$MAIN_HTML" 75 | 76 | # Fix Registration ID default value of "NULL" 77 | sed -r 's#()#\1""\2#g' -i "$ROOT_DIR/ptrom/ptconf/param_ct.xml" 78 | 79 | 80 | BFW_START="$ROOT_DIR/etc/init.d/bfw_start.sh" 81 | 82 | # Push messages about changes to UART to the console 83 | sed -r 's#^(\s*echo \".+\!\!\")$#\1 | to_console#g' -i "$BFW_START" 84 | 85 | BFW_HEAD=$(grep -P -B99999999 '^#read bootcmd, if not default, modify$' "$BFW_START" | head -n -2) 86 | BFW_HEAD2=$(grep -P -A99999999 '^./ptrom/bin/set_bootcmd_env$' "$BFW_START" | tail -n +2 | grep -P -B99999999 '^#set FXM_TXFAULT_EN$' | head -n -1) 87 | BFW_FOOT=$(grep -P -A99999999 '^pon 1pps_event_enable$' "$BFW_START") 88 | 89 | echo "$BFW_HEAD" > "$BFW_START" 90 | echo >> "$BFW_START" 91 | echo "$BFW_HEAD2" >> "$BFW_START" 92 | echo >> "$BFW_START" 93 | cat >> "$BFW_START" <<'BFW_START_MODS' 94 | 95 | _lib_8311 2>/dev/null || . /lib/8311.sh 96 | 97 | # Remove Reservedata as it causes the stick to reboot every few minutes 98 | uci -qc /ptdata delete factory_conf.Reservedata 99 | 100 | # 8311 MOD: Disable factory mode unless specifically enabled 101 | FAC_MODE=$(fwenv_get_8311 factory_mode) 102 | [ "$FAC_MODE" = "1" ] || FAC_MODE=0 103 | 104 | FAC_MODE_FLAG="/ptdata/factorymodeflag" 105 | [ -e "$FAC_MODE_FLAG" ] && CUR_FAC_MODE=1 || CUR_FAC_MODE=0 106 | 107 | FAC_CHANGES="$(uci -qc /ptdata changes factory_conf)" 108 | if [ -n "$FAC_CHANGES" ] || [ "$CUR_FAC_MODE" != "$FAC_MODE" ]; then 109 | mount -o remount,rw /ptdata 110 | 111 | [ -n "$FAC_CHANGES" ] && uci -qc /ptdata commit factory_conf 112 | 113 | if [ "$FAC_MODE" -eq 1 ]; then 114 | touch "$FAC_MODE_FLAG" 115 | else 116 | rm -f "$FAC_MODE_FLAG" 117 | mount -o remount,ro /ptdata 118 | fi 119 | fi 120 | 121 | BFW_START_MODS 122 | 123 | echo "$BFW_FOOT" >> "$BFW_START" 124 | 125 | if [ "$KERNEL_VARIANT" = "basic" ]; then 126 | rm -rfv "$ROOT_DIR/lib/modules" #"$ROOT_DIR/lib/firmware" 127 | cp -va "$ROOT_BASIC/lib/modules/." "$ROOT_DIR/lib/modules" 128 | cp -va "$ROOT_BASIC/lib/firmware/." "$ROOT_DIR/lib/firmware" 129 | fi 130 | -------------------------------------------------------------------------------- /mods/binary-mods.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | OMCID="$ROOT_DIR/opt/intel/bin/omcid" 3 | # Azores 1.0.12 4 | if check_file "$OMCID" "0aa64358a3afaa17b4edfed0077141981bc13322c7d1cf730abc251fae1ecbb1"; then 5 | echo "Patching '$OMCID'..." 6 | 7 | # omcid mod by djGrrr to make default LOID and LPWD empty 8 | printf '\x00\x00\x00\x00\x00\x00' | dd of="$OMCID" conv=notrunc seek=$((0xF42F4)) bs=1 count=6 2>/dev/null 9 | printf '\x00\x00\x00\x00\x00\x00\x00\x00\x00' | dd of="$OMCID" conv=notrunc seek=$((0xF4304)) bs=1 count=9 2>/dev/null 10 | 11 | expected_hash "$OMCID" "cb4c3e631ea783aebf8603298da0b7a2ac0c3750a2d35be0c5f80a93e64228ec" 12 | fi 13 | 14 | # Azores 1.0.19 15 | if check_file "$OMCID" "d696843c3801cb68f9d779ed95bd72299fcb2fa05459c17bac5d346645562067"; then 16 | echo "Patching '$OMCID'..." 17 | 18 | # omcid mod by djGrrr to make default LOID and LPWD empty 19 | printf '\x00\x00\x00\x00\x00\x00' | dd of="$OMCID" conv=notrunc seek=$((0xF43F4)) bs=1 count=6 2>/dev/null 20 | printf '\x00\x00\x00\x00\x00\x00\x00\x00\x00' | dd of="$OMCID" conv=notrunc seek=$((0xF4404)) bs=1 count=9 2>/dev/null 21 | 22 | expected_hash "$OMCID" "0111a39c55f776e9b9756833943a06a19bffe973e601e8a1abb1dfab3647f733" 23 | fi 24 | 25 | 26 | OMCID="$ROOT_DIR/usr/bin/omcid" 27 | # Potrontec 1.18.1 OMCId v8.15.17 28 | if check_file "$OMCID" "82b6746d5385d676765d185a21443fabcab63f193fac7eb56a1a8cd878f029d5"; then 29 | echo "Patching '$OMCID'..." 30 | 31 | # omcid mod by djGrrr to make default LOID and LPWD empty 32 | printf '\x00\x00\x00\x00\x00\x00' | dd of="$OMCID" conv=notrunc seek=$((0x9FBF8)) bs=1 count=6 2>/dev/null 33 | printf '\x00\x00\x00\x00\x00\x00\x00\x00\x00' | dd of="$OMCID" conv=notrunc seek=$((0x9FC08)) bs=1 count=9 2>/dev/null 34 | 35 | expected_hash "$OMCID" "184aad016a0d38da5c3a6fc8451f8b4971be59702d6d10a2bca379b2f9bce7f7" 36 | fi 37 | 38 | # PTXG_CX_V0.03 39 | if check_file "$OMCID" "5217dccf98cf8c75bc1b8ba380a92514511a77c40803a9718651b1f2bb5a9a5a"; then 40 | echo "Patching '$OMCID'..." 41 | 42 | # omcid mod by djGrrr to make default LOID and LPWD empty 43 | printf '\x00\x00\x00\x00\x00\x00' | dd of="$OMCID" conv=notrunc seek=$((0xA04C8)) bs=1 count=6 2>/dev/null 44 | printf '\x00\x00\x00\x00\x00\x00\x00\x00\x00' | dd of="$OMCID" conv=notrunc seek=$((0xA04D8)) bs=1 count=9 2>/dev/null 45 | 46 | # omci_sip_user_data.c - ME 153 function sip_user_update_timeout_handler - fix data length when reading ME 148 attribute username2 47 | printf '\x19' | dd of="$OMCID" conv=notrunc seek=$((0x80C77)) bs=1 count=1 2>/dev/null 48 | 49 | # omci_sip_agent_config_data.c - ME 150 function me_update - fix data lengths when reading ME 136 and 134 attributes 50 | printf '\x02' | dd of="$OMCID" conv=notrunc seek=$((0x82403)) bs=1 count=1 2>/dev/null 51 | printf '\x3C' | dd of="$OMCID" conv=notrunc seek=$((0x825C7)) bs=1 count=1 2>/dev/null 52 | printf '\x04' | dd of="$OMCID" conv=notrunc seek=$((0x825CB)) bs=1 count=1 2>/dev/null 53 | printf '\x16' | dd of="$OMCID" conv=notrunc seek=$((0x825F1)) bs=1 count=1 2>/dev/null 54 | printf '\xB6' | dd of="$OMCID" conv=notrunc seek=$((0x825F5)) bs=1 count=1 2>/dev/null 55 | printf '\xAF\xB6\x00\x10\x24\x16\x00\x04' | dd of="$OMCID" conv=notrunc seek=$((0x82624)) bs=1 count=8 2>/dev/null 56 | printf '\x6C' | dd of="$OMCID" conv=notrunc seek=$((0x8262F)) bs=1 count=1 2>/dev/null 57 | printf '\x02' | dd of="$OMCID" conv=notrunc seek=$((0x82633)) bs=1 count=1 2>/dev/null 58 | 59 | expected_hash "$OMCID" "c1df5decc2aa80a583abf0d8b1a237cc603ceeabd4acee4f7e8bbb6a91fd6848" 60 | fi 61 | 62 | # Potrontec 1.18.1 OMCId v8.15.17 and PTXG_CX_V0.03 63 | LIBPON="$ROOT_DIR/usr/lib/libpon.so.0.0.0" 64 | if check_file "$LIBPON" "401cc97e0f43b6b08a1d27f7be94a9e37fa798a810ae89838776f14b55e66cc1"; then 65 | echo "Patching '$LIBPON'..." 66 | 67 | # NOP system() calls to sfp_i2c 68 | printf '\x00\x00\x00\x00' | dd of="$LIBPON" conv=notrunc seek=$((0x17850)) bs=1 count=4 2>/dev/null 69 | printf '\x00\x00\x00\x00' | dd of="$LIBPON" conv=notrunc seek=$((0x17894)) bs=1 count=4 2>/dev/null 70 | printf '\x00\x00\x00\x00' | dd of="$LIBPON" conv=notrunc seek=$((0x178BC)) bs=1 count=4 2>/dev/null 71 | printf '\x00\x00\x00\x00' | dd of="$LIBPON" conv=notrunc seek=$((0x17940)) bs=1 count=4 2>/dev/null 72 | printf '\x00\x00\x00\x00' | dd of="$LIBPON" conv=notrunc seek=$((0x179D8)) bs=1 count=4 2>/dev/null 73 | printf '\x00\x00\x00\x00' | dd of="$LIBPON" conv=notrunc seek=$((0x17A08)) bs=1 count=4 2>/dev/null 74 | 75 | expected_hash "$LIBPON" "b9deb9b22715a4c4f54307939d94ac7b15e116aa5f5edabea5ba7365d3b807dc" 76 | fi 77 | 78 | # libponnet mod for 1.0.12 to fix management with VEIP mode 79 | LIBPONNET="$ROOT_DIR/usr/lib/libponnet.so.0.0.0" 80 | if check_file "$LIBPONNET" "8075079231811f58dd4cec06ed84ff5d46a06e40b94c14263a56110edfa2a705"; then 81 | echo "Patching '$LIBPONNET'..." 82 | 83 | # patch pon_net_dev_db_add to return 0 instead of -1 when an existing device entry exists 84 | printf '\x00\x00' | dd of="$LIBPONNET" conv=notrunc seek=$((0x51B9A)) bs=1 count=2 2>/dev/null 85 | 86 | # patch file location for IP Host hostname 87 | printf '/tmp/8311-iphost-hostname\x00' | dd of="$LIBPONNET" conv=notrunc seek=$((0x92064)) bs=1 count=26 2>/dev/null 88 | 89 | # patch file location for IP Host domain 90 | printf '/tmp/8311-iphost-domainname\x00' | dd of="$LIBPONNET" conv=notrunc seek=$((0x92090)) bs=1 count=28 2>/dev/null 91 | 92 | expected_hash "$LIBPONNET" "1d92a9cf288f64317f6d82e8f87651fbc07bef53ce3f4f28e73fc17e6041b107" 93 | fi 94 | 95 | # libponnet mod for 1.0.19 to fix management with VEIP mode 96 | if check_file "$LIBPONNET" "f1031d3452f86647dbdf4b6c94abaccdc05b9d3b2c339bf560db0191e799f0c6"; then 97 | echo "Patching '$LIBPONNET'..." 98 | 99 | # patch pon_net_dev_db_add to return 0 instead of -1 when an existing device entry exists 100 | printf '\x00\x00' | dd of="$LIBPONNET" conv=notrunc seek=$((0x51B9A)) bs=1 count=2 2>/dev/null 101 | 102 | # patch file location for IP Host hostnam 103 | printf '/tmp/8311-iphost-hostname\x00' | dd of="$LIBPONNET" conv=notrunc seek=$((0x92084)) bs=1 count=26 2>/dev/null 104 | 105 | # patch file location for IP Host domain 106 | printf '/tmp/8311-iphost-domainname\x00' | dd of="$LIBPONNET" conv=notrunc seek=$((0x920B0)) bs=1 count=28 2>/dev/null 107 | 108 | expected_hash "$LIBPONNET" "baa8d1dc984387aaec12afe8f24338b19b8b162430ebea11d670c924c09cad00" 109 | fi 110 | 111 | # Potrontec 1.18.1 OMCId v8.15.17 112 | if check_file "$LIBPONNET" "05536d164e51c5d412421a347a5c99b6883a53c57c24ed4d00f4b98b79cddfc3"; then 113 | echo "Patching '$LIBPONNET'..." 114 | 115 | # patch pon_net_dev_db_add to return 0 instead of -1 when an existing device entry exists, fixes VEIP management 116 | printf '\x00\x00' | dd of="$LIBPONNET" conv=notrunc seek=$((0x3CDC2)) bs=1 count=2 2>/dev/null 117 | 118 | # patch file location for IP Host hostname 119 | printf '/tmp/8311-iphost-hostname\x00' | dd of="$LIBPONNET" conv=notrunc seek=$((0x6BC40)) bs=1 count=26 2>/dev/null 120 | 121 | # patch file location for IP Host domain 122 | printf '/tmp/8311-iphost-domainname\x00' | dd of="$LIBPONNET" conv=notrunc seek=$((0x6BC0C)) bs=1 count=28 2>/dev/null 123 | 124 | expected_hash "$LIBPONNET" "71e5fa85bde3793cdc1085781e3a1440fc9ef0bb8900c74d144b99be720ba50e" 125 | fi 126 | 127 | # PTXG_CX_V0.03 128 | if check_file "$LIBPONNET" "ac12631273e8cf069aecbba55e02ace987d54ddf70bc0e14211dabf4abc600b7"; then 129 | echo "Patching '$LIBPONNET'..." 130 | 131 | # patch pon_net_dev_db_add to return 0 instead of -1 when an existing device entry exists, fixes VEIP management 132 | printf '\x00\x00' | dd of="$LIBPONNET" conv=notrunc seek=$((0x3D1D2)) bs=1 count=2 2>/dev/null 133 | 134 | # patch file location for IP Host hostname 135 | printf '/tmp/8311-iphost-hostname\x00' | dd of="$LIBPONNET" conv=notrunc seek=$((0x6C050)) bs=1 count=26 2>/dev/null 136 | 137 | # patch file location for IP Host domain 138 | printf '/tmp/8311-iphost-domainname\x00' | dd of="$LIBPONNET" conv=notrunc seek=$((0x6C01C)) bs=1 count=28 2>/dev/null 139 | 140 | expected_hash "$LIBPONNET" "687f88bda014c86e7c6bff59857d10ea3bfe7307d6204bc327c616e8b39b20bc" 141 | fi 142 | 143 | LIBPONHWAL="$ROOT_DIR/ptrom/lib/libponhwal.so" 144 | # libponhwal mods for 1.0.12 to fix Software/Hardware versions and Equipment ID 145 | if check_file "$LIBPONHWAL" "f0e48ceba56c7d588b8bcd206c7a3a66c5c926fd1d69e6d9d5354bf1d34fdaf6"; then 146 | echo "Patching '$LIBPONHWAL'..." 147 | 148 | # patch ponhw_get_hardware_ver to use the correct string length (by rajkosto) 149 | printf '\x0E' | dd of="$LIBPONHWAL" conv=notrunc seek=$((0x278CB)) bs=1 count=1 2>/dev/null 150 | 151 | # patch ponhw_get_software_ver to use the correct string length (by rajkosto) 152 | printf '\x0E' | dd of="$LIBPONHWAL" conv=notrunc seek=$((0x277C7)) bs=1 count=1 2>/dev/null 153 | printf '\x0E' | dd of="$LIBPONHWAL" conv=notrunc seek=$((0x27823)) bs=1 count=1 2>/dev/null 154 | 155 | # patch ponhw_get_equipment_id to use the correct string length (by djGrrr) 156 | printf '\x14' | dd of="$LIBPONHWAL" conv=notrunc seek=$((0x27647)) bs=1 count=1 2>/dev/null 157 | 158 | expected_hash "$LIBPONHWAL" "624aa5875a7bcf4d91a060e076475336622b267ff14b9c8fbb87df30fc889788" 159 | fi 160 | 161 | # libponhwal mods for 1.0.19 to fix Software/Hardware versions and Equipment ID 162 | if check_file "$LIBPONHWAL" "cd157969cd9127d97709a96f3612f6f7c8f0eff05d4586fde178e9c4b7a4d362"; then 163 | echo "Patching '$LIBPONHWAL'..." 164 | 165 | # patch ponhw_get_hardware_ver to use the correct string length (by djGrrr, based on rajkosto's patch for 1.0.12) 166 | printf '\x0E' | dd of="$LIBPONHWAL" conv=notrunc seek=$((0x278A3)) bs=1 count=1 2>/dev/null 167 | 168 | # patch ponhw_get_software_ver to use the correct string length (by djGrrr, based on rajkosto's patch for 1.0.12) 169 | printf '\x0E' | dd of="$LIBPONHWAL" conv=notrunc seek=$((0x2779F)) bs=1 count=1 2>/dev/null 170 | printf '\x0E' | dd of="$LIBPONHWAL" conv=notrunc seek=$((0x277FB)) bs=1 count=1 2>/dev/null 171 | 172 | # patch ponhw_get_equipment_id to use the correct string length (by djGrrr) 173 | printf '\x14' | dd of="$LIBPONHWAL" conv=notrunc seek=$((0x2C2B7)) bs=1 count=1 2>/dev/null 174 | 175 | expected_hash "$LIBPONHWAL" "48f932b62fd22c693bae0aa99962a4821ef18f503eed3822d41d44330cb32db5" 176 | fi 177 | 178 | # libponhwal mods for 1.0.8 to fix Software/Hardware versions and Equipment ID 179 | if check_file "$LIBPONHWAL" "6af1b3b1fba25488fd68e5e2e2c41ab0e178bd190f0ba2617fc32bdfad21e4c4"; then 180 | echo "Patching '$LIBPONHWAL'..." 181 | 182 | # patch ponhw_get_hardware_ver to use the correct string length ((by djGrrr, based on rajkosto's patch for 1.0.12) 183 | printf '\x0E' | dd of="$LIBPONHWAL" conv=notrunc seek=$((0x2738B)) bs=1 count=1 2>/dev/null 184 | 185 | # patch ponhw_get_software_ver to use the correct string length (by djGrrr, based on rajkosto's patch for 1.0.12) 186 | printf '\x0E' | dd of="$LIBPONHWAL" conv=notrunc seek=$((0x27287)) bs=1 count=1 2>/dev/null 187 | printf '\x0E' | dd of="$LIBPONHWAL" conv=notrunc seek=$((0x272E3)) bs=1 count=1 2>/dev/null 188 | 189 | # patch ponhw_get_equipment_id to use the correct string length (by djGrrr) 190 | printf '\x14' | dd of="$LIBPONHWAL" conv=notrunc seek=$((0x27107)) bs=1 count=1 2>/dev/null 191 | 192 | expected_hash "$LIBPONHWAL" "36b20ed9c64de010e14543659302fdb85090efc49e48c193c2c156f6333afaac" 193 | fi 194 | -------------------------------------------------------------------------------- /mods/common-mods.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | BANNER="$ROOT_DIR/etc/banner" 3 | sed -E "s#(^\s+OpenWrt\s+.+$)#\1\n\n 8311 Community Firmware MOD [$FW_VARIANT] - $FW_VERSION ($FW_REVISION)\n https://github.com/djGrrr/8311-was-110-firmware-builder#g" -i "$BANNER" 4 | 5 | UBIMGVARS="$ROOT_DIR/sbin/uboot_img_vars.sh" 6 | echo "Patching '$UBIMGVARS'..." 7 | 8 | UBIMGVARS_HEAD=$(grep -B99999999 -P '^_get_uboot_vars\(\)' "$UBIMGVARS") 9 | UBIMGVARS_FOOT=$(grep -B3 -A99999999 -P '^get_uboot_vars\(\)' "$UBIMGVARS") 10 | 11 | echo "$UBIMGVARS_HEAD" > "$UBIMGVARS" 12 | cat >> "$UBIMGVARS" <<'UBIMGVARS_MOD' 13 | vars="active_bank:8311_override_active img_validA:8311_sw_valA img_validB:8311_sw_valB img_versionA:8311_sw_verA img_versionB:8311_sw_verB commit_bank:8311_override_commit img_activate:8311_override_activate" 14 | 15 | printf "{" 16 | for var in $vars; do 17 | v=$(echo "$var" | cut -d: -f1) 18 | o=$(echo "$var" | cut -d: -f2) 19 | 20 | val=$([ -n "$o" ] && fw_printenv -n "$o" 2>/dev/null || fw_printenv -n "$v" 2>/dev/null) 21 | printf '"%s":"%s"' "$v" "$val" 22 | [ "$v" != "img_activate" ] && printf "," 23 | done 24 | printf "}\n" 25 | UBIMGVARS_MOD 26 | echo "$UBIMGVARS_FOOT" >> "$UBIMGVARS" 27 | 28 | 29 | VEIP_MIB="$ROOT_DIR/etc/mibs/prx300_1V.ini" 30 | echo "Patching '$VEIP_MIB'..." 31 | 32 | VEIP_HEAD=$(grep -P -B99999999 '^# Virtual Ethernet Interface Point$' "$VEIP_MIB" | head -n -1) 33 | VEIP_FOOT=$(grep -P -A99999999 '^# Virtual Ethernet Interface Point$' "$VEIP_MIB") 34 | 35 | echo "$VEIP_HEAD" > "$VEIP_MIB" 36 | # Enable LCT Management interface in VEIP mode 37 | cat >> "$VEIP_MIB" <<'VEIP_LCT' 38 | 39 | # PPTP Ethernet UNI 40 | ? 11 0x0101 0 0 0 0x00 1 1 0 2000 0 0xffff 0 0 0 0 0 41 | 42 | VEIP_LCT 43 | echo "$VEIP_FOOT" >> "$VEIP_MIB" 44 | 45 | 46 | # Copy custom files 47 | cp -va "files/common/." "$ROOT_DIR/" 48 | cp -va "files/${FW_VARIANT}/." "$ROOT_DIR/" 49 | 50 | sed -r 's#^(\s+)(.+ )(\|\| ubimkvol /dev/ubi0 -N rootfs_data)( .+$)#\1\# 8311 MOD: Always try to create rootfs_data at ID 6 first\n\1\2\3 -n 6\4 \3\4#g' -i "$ROOT_DIR/lib/preinit/06_create_rootfs_data" 51 | 52 | # Remove dumb defaults for loid and lpwd 53 | CONFIG_OMCI="$ROOT_DIR/etc/config/omci" 54 | CONFIG_OMCI_FILTERED=$(grep -v -E '(loid|lpwd)' "$CONFIG_OMCI") 55 | echo "$CONFIG_OMCI_FILTERED" > "$CONFIG_OMCI" 56 | 57 | RC_LOCAL="$ROOT_DIR/etc/rc.local" 58 | 59 | RC_LOCAL_HEAD=$(grep -P -B99999999 '^exit 0$' "$RC_LOCAL" | head -n -1) 60 | RC_LOCAL_FOOT=$(grep -P -A99999999 '^exit 0$' "$RC_LOCAL") 61 | 62 | MIN_DELAY=0 63 | DEFAULT_DELAY=15 64 | [ "$FW_VARIANT" = "bfw" ] && DEFAULT_DELAY=30 && MIN_DELAY=10 65 | 66 | echo "$RC_LOCAL_HEAD" > "$RC_LOCAL" 67 | cat >> "$RC_LOCAL" </dev/null || echo "$DEFAULT_DELAY") 71 | [ "\$DELAY" -ge $MIN_DELAY ] 2>/dev/null || DELAY=$MIN_DELAY 72 | [ "\$DELAY" -le "300" ] || DELAY=300 73 | sleep "\$DELAY" && [ ! -f /root/.failsafe ] && [ ! -f /tmp/.failsafe ] && [ ! -f /ptconf/.failsafe ] && /etc/init.d/omcid.sh start 74 | 75 | FAILSAFE 76 | echo "$RC_LOCAL_FOOT" >> "$RC_LOCAL" 77 | chmod +x "$RC_LOCAL" 78 | 79 | 80 | LIB_PON_SH="$ROOT_DIR/lib/pon.sh" 81 | LIB_PON_SH_HEAD=$(grep -P -m 1 -B99999999 '^$' "$LIB_PON_SH") 82 | LIB_PON_SH_TOP=$(grep -P -m 1 -A99999999 '^$' "$LIB_PON_SH" | grep -P -B99999999 '^pon_base_mac_get\(\)') 83 | LIB_PON_SH_FOOT=$(grep -P -A99999999 '^\s+echo \$mac_addr$' "$LIB_PON_SH") 84 | 85 | echo "$LIB_PON_SH_HEAD" > "$LIB_PON_SH" 86 | cat >> "$LIB_PON_SH" <<'PONSHLIB' 87 | 88 | _lib_8311 2>/dev/null || . /lib/8311.sh 89 | PONSHLIB 90 | echo "$LIB_PON_SH_TOP" >> "$LIB_PON_SH" 91 | cat >> "$LIB_PON_SH" <<'PONSHMAC' 92 | # 8311 MOD: Use proper base MAC 93 | local mac_addr="$(get_8311_base_mac)" 94 | 95 | PONSHMAC 96 | echo "$LIB_PON_SH_FOOT" >> "$LIB_PON_SH" 97 | 98 | 99 | cp -fv "8311-xgspon-bypass/8311-detect-config.sh" "8311-xgspon-bypass/8311-fix-vlans.sh" "$ROOT_DIR/usr/sbin/" 100 | cp -fv "8311-xgspon-bypass/8311-vlans-lib.sh" "$ROOT_DIR/lib/" 101 | ln -fsv "/usr/sbin/8311-detect-config.sh" "$ROOT_DIR/root/8311-detect-config.sh" 102 | ln -fsv "/usr/sbin/8311-fix-vlans.sh" "$ROOT_DIR/root/8311-fix-vlans.sh" 103 | ln -fsv "/lib/8311-vlans-lib.sh" "$ROOT_DIR/root/8311-vlans-lib.sh" 104 | mkdir -p "$ROOT_DIR/etc/crontabs" 105 | 106 | touch "$ROOT_DIR/etc/crontabs/root" 107 | 108 | sed -r 's#^(\s+)(start.+)$#\1\# 8311 MOD: Do not auto start omcid\n\1\# \2#g' -i "$ROOT_DIR/etc/init.d/omcid.sh" 109 | 110 | CONFIG_OPTIC="$ROOT_DIR/etc/config/optic" 111 | sed -r "s#(option 'tx_en_mode' ').*(')#\10\2#" -i "$CONFIG_OPTIC" 112 | sed -r "s#(option 'tx_pup_mode' ').*(')#\11\2#" -i "$CONFIG_OPTIC" 113 | 114 | OPTICDB_DEFAULT="$ROOT_DIR/etc/optic-db/default" 115 | sed -r "s#(option 'tx_en_mode' ').*(')#\10\2#" -i "$OPTICDB_DEFAULT" 116 | sed -r "s#(option 'tx_pup_mode' ').*(')#\11\2#" -i "$OPTICDB_DEFAULT" 117 | sed "/option 'dg_dis'/d" -i "$OPTICDB_DEFAULT" 118 | 119 | mkdir -pv "$ROOT_DIR/ptconf" 120 | 121 | # Change load order of mod_sfp_i2c module and add hack that sets the default virtual eeprom to the content of the physical one 122 | rm -fv "$ROOT_DIR/etc/modules.d/20-pon-sfp-i2c" 123 | ln -s "/sys/bus/platform/devices/18100000.ponmbox/eeprom50" "$ROOT_DIR/lib/firmware/sfp_eeprom0_hack.bin" 124 | 125 | 126 | if ls packages/common/busybox_*.ipk &>/dev/null; then 127 | echo "Removing all links to busybox..." 128 | find -L "$ROOT_DIR/" -samefile "$ROOT_DIR/bin/busybox" -exec rm -fv {} + 129 | fi 130 | 131 | if ls packages/common/*.ipk &>/dev/null; then 132 | for IPK in packages/common/*.ipk; do 133 | echo "Extracting '$(basename "$IPK")' to '$ROOT_DIR'." 134 | tar xfz "$IPK" -O -- "./data.tar.gz" | tar xvz -C "$ROOT_DIR/" 135 | done 136 | fi 137 | 138 | DROPBEAR="$ROOT_DIR/etc/init.d/dropbear" 139 | # Fix dropbear init script from newer OpenWRT 140 | sed -r 's/^extra_command "killclients" .+$/EXTRA_COMMANDS="killclients"\nEXTRA_HELP=" killclients Kill ${NAME} processes except servers and yourself"/' -i "$DROPBEAR" 141 | 142 | # Setup custom dropbear configuration links 143 | rm -rfv "$ROOT_DIR/etc/dropbear" 144 | ln -fsv "/ptconf/8311/.ssh" "$ROOT_DIR/root/.ssh" 145 | ln -fsv "/ptconf/8311/dropbear" "$ROOT_DIR/etc/dropbear" 146 | 147 | ln -fsv "../init.d/sysntpd" "$ROOT_DIR/etc/rc.d/S98sysntpd" 148 | -------------------------------------------------------------------------------- /mods/pre-common-mods.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | mv -fv "$ROOT_DIR/sbin/secure_upgrade.sh" "$ROOT_DIR/sbin/secure_upgrade-original.sh" 3 | 4 | if ls packages/remove/*.list &>/dev/null; then 5 | for LIST in packages/remove/*.list; do 6 | echo "Removing files from '$LIST'" 7 | FILES=$(cat "$LIST" | grep -v '/$') 8 | 9 | IFS=$'\n' 10 | for FILE in $(cat "$LIST" | grep -v '/$'); do 11 | rm -fv "$ROOT_DIR/$FILE" || true 12 | done 13 | 14 | for DIR in $(cat "$LIST" | grep '/$' | sort -r -V); do 15 | DIR="$ROOT_DIR/$DIR" 16 | CONTENTS=$(find "$DIR" -mindepth 1 -maxdepth 1 2>/dev/null) && [ -z "$CONTENTS" ] && rmdir -v "$DIR" || true 17 | done 18 | IFS= 19 | done 20 | fi 21 | -------------------------------------------------------------------------------- /mods/reset-mods.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cp -va "files/reset/." "$ROOT_DIR/" 3 | -------------------------------------------------------------------------------- /packages/basic/liblucihttp0_2019-07-05-a34a17d5-1_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/basic/liblucihttp0_2019-07-05-a34a17d5-1_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/basic/libmbedtls12_2.16.12-1_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/basic/libmbedtls12_2.16.12-1_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/basic/libuhttpd-mbedtls_2.2.2-2_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/basic/libuhttpd-mbedtls_2.2.2-2_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/basic/libustream-mbedtls20150806_2020-03-13-40b563b1-1_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/basic/libustream-mbedtls20150806_2020-03-13-40b563b1-1_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/basic/luci-base_git-22.045.73925-36e5c1c-1_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/basic/luci-base_git-22.045.73925-36e5c1c-1_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/basic/luci-lib-ip_git-22.045.73925-36e5c1c-1_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/basic/luci-lib-ip_git-22.045.73925-36e5c1c-1_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/basic/luci-lib-nixio_git-22.045.73925-36e5c1c-1_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/basic/luci-lib-nixio_git-22.045.73925-36e5c1c-1_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/basic/luci-lib-px5g_git-22.045.73925-36e5c1c-1_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/basic/luci-lib-px5g_git-22.045.73925-36e5c1c-1_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/basic/luci-mod-status_git-22.045.73925-36e5c1c-1_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/basic/luci-mod-status_git-22.045.73925-36e5c1c-1_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/basic/luci-mod-system_git-22.045.73925-36e5c1c-1_all.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/basic/luci-mod-system_git-22.045.73925-36e5c1c-1_all.ipk -------------------------------------------------------------------------------- /packages/basic/luci-theme-bootstrap_git-22.045.73925-36e5c1c-1_all.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/basic/luci-theme-bootstrap_git-22.045.73925-36e5c1c-1_all.ipk -------------------------------------------------------------------------------- /packages/basic/px5g-mbedtls_9_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/basic/px5g-mbedtls_9_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/basic/rpcd-mod-luci_20201107_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/basic/rpcd-mod-luci_20201107_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/basic/uhttpd-mod-lua_2020-10-01-3abcc891-1_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/basic/uhttpd-mod-lua_2020-10-01-3abcc891-1_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/basic/uhttpd-mod-ubus_2020-10-01-3abcc891-1_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/basic/uhttpd-mod-ubus_2020-10-01-3abcc891-1_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/basic/uhttpd_2020-10-01-3abcc891-1_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/basic/uhttpd_2020-10-01-3abcc891-1_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/common/busybox_1.36.1-1_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/common/busybox_1.36.1-1_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/common/dropbear_2022.83-1_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/common/dropbear_2022.83-1_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/common/fping_4.2-1_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/common/fping_4.2-1_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/common/htop_3.0.5-1_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/common/htop_3.0.5-1_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/common/libc_1.1.24-2_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/common/libc_1.1.24-2_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/common/libncurses6_6.1-5_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/common/libncurses6_6.1-5_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/common/libpcre2_10.36-1_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/common/libpcre2_10.36-1_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/common/libzstd_1.4.5-2_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/common/libzstd_1.4.5-2_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/common/lrzsz_0.12.20-2_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/common/lrzsz_0.12.20-2_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/common/mtr_0.93-1_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/common/mtr_0.93-1_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/common/nand-utils_2.1.1-1_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/common/nand-utils_2.1.1-1_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/common/nano_6.1-1_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/common/nano_6.1-1_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/common/terminfo_6.1-5_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/common/terminfo_6.1-5_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/common/zoneinfo-africa_2020c-1_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/common/zoneinfo-africa_2020c-1_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/common/zoneinfo-asia_2020c-1_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/common/zoneinfo-asia_2020c-1_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/common/zoneinfo-atlantic_2020c-1_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/common/zoneinfo-atlantic_2020c-1_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/common/zoneinfo-core_2020c-1_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/common/zoneinfo-core_2020c-1_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/common/zoneinfo-europe_2020c-1_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/common/zoneinfo-europe_2020c-1_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/common/zoneinfo-india_2020c-1_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/common/zoneinfo-india_2020c-1_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/common/zoneinfo-northamerica_2020c-1_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/common/zoneinfo-northamerica_2020c-1_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/common/zoneinfo-pacific_2020c-1_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/common/zoneinfo-pacific_2020c-1_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/common/zoneinfo-poles_2020c-1_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/common/zoneinfo-poles_2020c-1_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/common/zoneinfo-simple_2020c-1_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/common/zoneinfo-simple_2020c-1_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/common/zoneinfo-southamerica_2020c-1_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/common/zoneinfo-southamerica_2020c-1_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/common/zstd_1.4.5-2_mips_24kc.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/packages/common/zstd_1.4.5-2_mips_24kc.ipk -------------------------------------------------------------------------------- /packages/remove/luci-app-advanced-reboot_1.0.1-3-1_all.list: -------------------------------------------------------------------------------- 1 | 2 | etc/ 3 | etc/uci-defaults/ 4 | etc/uci-defaults/40_luci-advanced-reboot 5 | usr/ 6 | usr/lib/ 7 | usr/lib/lua/ 8 | usr/lib/lua/luci/ 9 | usr/lib/lua/luci/advanced-reboot/ 10 | usr/lib/lua/luci/advanced-reboot/devices/ 11 | usr/lib/lua/luci/advanced-reboot/devices/linksys-e4200v2-ea4500.lua 12 | usr/lib/lua/luci/advanced-reboot/devices/linksys-ea3500.lua 13 | usr/lib/lua/luci/advanced-reboot/devices/linksys-ea6350v3.lua 14 | usr/lib/lua/luci/advanced-reboot/devices/linksys-ea8300.lua 15 | usr/lib/lua/luci/advanced-reboot/devices/linksys-ea8500.lua 16 | usr/lib/lua/luci/advanced-reboot/devices/linksys-wrt1200ac.lua 17 | usr/lib/lua/luci/advanced-reboot/devices/linksys-wrt1900ac.lua 18 | usr/lib/lua/luci/advanced-reboot/devices/linksys-wrt1900acs.lua 19 | usr/lib/lua/luci/advanced-reboot/devices/linksys-wrt1900acv2.lua 20 | usr/lib/lua/luci/advanced-reboot/devices/linksys-wrt3200acm.lua 21 | usr/lib/lua/luci/advanced-reboot/devices/linksys-wrt32x.lua 22 | usr/lib/lua/luci/advanced-reboot/devices/zyxel-nbg6817.lua 23 | usr/lib/lua/luci/advanced-reboot/devices.disabled/ 24 | usr/lib/lua/luci/advanced-reboot/devices.disabled/linksys-ea9500.lua 25 | usr/lib/lua/luci/controller/ 26 | usr/lib/lua/luci/controller/advanced_reboot.lua 27 | usr/lib/lua/luci/view/ 28 | usr/lib/lua/luci/view/advanced_reboot/ 29 | usr/lib/lua/luci/view/advanced_reboot/advanced_reboot.htm 30 | usr/lib/lua/luci/view/advanced_reboot/alternative_reboot.htm 31 | usr/lib/lua/luci/view/advanced_reboot/applyreboot.htm 32 | usr/lib/lua/luci/view/advanced_reboot/power_off.htm 33 | usr/libexec/ 34 | usr/libexec/rpcd/ 35 | usr/libexec/rpcd/luci.advanced_reboot 36 | usr/share/ 37 | usr/share/advanced-reboot/ 38 | usr/share/advanced-reboot/devices/ 39 | usr/share/advanced-reboot/devices/linksys-e4200v2-ea4500.json 40 | usr/share/advanced-reboot/devices/linksys-e4200v2.json 41 | usr/share/advanced-reboot/devices/linksys-ea3500.json 42 | usr/share/advanced-reboot/devices/linksys-ea4500.json 43 | usr/share/advanced-reboot/devices/linksys-ea6350v3.json 44 | usr/share/advanced-reboot/devices/linksys-ea7300v1.json 45 | usr/share/advanced-reboot/devices/linksys-ea7300v2.json 46 | usr/share/advanced-reboot/devices/linksys-ea7500v1.json 47 | usr/share/advanced-reboot/devices/linksys-ea8300.json 48 | usr/share/advanced-reboot/devices/linksys-ea8500.json 49 | usr/share/advanced-reboot/devices/linksys-mr8300.json 50 | usr/share/advanced-reboot/devices/linksys-wrt1200ac.json 51 | usr/share/advanced-reboot/devices/linksys-wrt1900ac.json 52 | usr/share/advanced-reboot/devices/linksys-wrt1900acs.json 53 | usr/share/advanced-reboot/devices/linksys-wrt1900acv2.json 54 | usr/share/advanced-reboot/devices/linksys-wrt3200acm.json 55 | usr/share/advanced-reboot/devices/linksys-wrt32x.json 56 | usr/share/advanced-reboot/devices/zyxel-nbg6817.json 57 | usr/share/advanced-reboot/devices.disabled/ 58 | usr/share/advanced-reboot/devices.disabled/linksys-ea9500.json 59 | usr/share/advanced-reboot/devices.disabled/netgear-wac510.json 60 | usr/share/luci/ 61 | usr/share/luci/menu.d/ 62 | usr/share/luci/menu.d/luci-app-advanced-reboot.json 63 | usr/share/rpcd/ 64 | usr/share/rpcd/acl.d/ 65 | usr/share/rpcd/acl.d/luci-app-advanced-reboot.json 66 | www/ 67 | www/luci-static/ 68 | www/luci-static/resources/ 69 | www/luci-static/resources/view/ 70 | www/luci-static/resources/view/system/ 71 | www/luci-static/resources/view/system/advanced_reboot.js 72 | -------------------------------------------------------------------------------- /packages/remove/luci-app-commands_git-22.045.73925-36e5c1c-1_all.list: -------------------------------------------------------------------------------- 1 | 2 | usr/ 3 | usr/lib/ 4 | usr/lib/lua/ 5 | usr/lib/lua/luci/ 6 | usr/lib/lua/luci/controller/ 7 | usr/lib/lua/luci/controller/commands.lua 8 | usr/lib/lua/luci/model/ 9 | usr/lib/lua/luci/model/cbi/ 10 | usr/lib/lua/luci/model/cbi/commands.lua 11 | usr/lib/lua/luci/view/ 12 | usr/lib/lua/luci/view/commands.htm 13 | usr/lib/lua/luci/view/commands_public.htm 14 | usr/share/ 15 | usr/share/rpcd/ 16 | usr/share/rpcd/acl.d/ 17 | usr/share/rpcd/acl.d/luci-app-commands.json 18 | -------------------------------------------------------------------------------- /packages/remove/luci-app-firewall_git-22.045.73925-36e5c1c-1_all.list: -------------------------------------------------------------------------------- 1 | 2 | usr/ 3 | usr/lib/ 4 | usr/lib/lua/ 5 | usr/lib/lua/luci/ 6 | usr/lib/lua/luci/controller/ 7 | usr/lib/lua/luci/controller/firewall.lua 8 | usr/share/ 9 | usr/share/rpcd/ 10 | usr/share/rpcd/acl.d/ 11 | usr/share/rpcd/acl.d/luci-app-openvpn.json 12 | www/ 13 | www/luci-static/ 14 | www/luci-static/resources/ 15 | www/luci-static/resources/tools/ 16 | www/luci-static/resources/tools/firewall.js 17 | www/luci-static/resources/view/ 18 | www/luci-static/resources/view/firewall/ 19 | www/luci-static/resources/view/firewall/custom.js 20 | www/luci-static/resources/view/firewall/forwards.js 21 | www/luci-static/resources/view/firewall/rules.js 22 | www/luci-static/resources/view/firewall/snats.js 23 | www/luci-static/resources/view/firewall/zones.js 24 | -------------------------------------------------------------------------------- /packages/remove/luci-app-opkg_git-22.045.73925-36e5c1c-1_all.list: -------------------------------------------------------------------------------- 1 | 2 | usr/ 3 | usr/lib/ 4 | usr/lib/lua/ 5 | usr/lib/lua/luci/ 6 | usr/lib/lua/luci/controller/ 7 | usr/lib/lua/luci/controller/opkg.lua 8 | usr/lib/lua/luci/view/ 9 | usr/lib/lua/luci/view/opkg.htm 10 | www/ 11 | www/luci-static/ 12 | www/luci-static/resources/ 13 | www/luci-static/resources/view/ 14 | www/luci-static/resources/view/opkg.js 15 | -------------------------------------------------------------------------------- /packages/remove/luci-mod-network_git-22.045.73925-36e5c1c-1_all.list: -------------------------------------------------------------------------------- 1 | 2 | etc/ 3 | etc/uci-defaults/ 4 | etc/uci-defaults/50_luci-mod-admin-full 5 | usr/ 6 | usr/lib/ 7 | usr/lib/lua/ 8 | usr/lib/lua/luci/ 9 | usr/lib/lua/luci/controller/ 10 | usr/lib/lua/luci/controller/admin/ 11 | usr/lib/lua/luci/controller/admin/network.lua 12 | usr/libexec/ 13 | usr/libexec/luci-peeraddr 14 | www/ 15 | www/luci-static/ 16 | www/luci-static/resources/ 17 | www/luci-static/resources/view/ 18 | www/luci-static/resources/view/network/ 19 | www/luci-static/resources/view/network/dhcp.js 20 | www/luci-static/resources/view/network/diagnostics.js 21 | www/luci-static/resources/view/network/hosts.js 22 | www/luci-static/resources/view/network/interfaces.js 23 | www/luci-static/resources/view/network/routes.js 24 | www/luci-static/resources/view/network/switch.js 25 | www/luci-static/resources/view/network/wireless.js 26 | -------------------------------------------------------------------------------- /packages/remove/luci-theme-openwrt_git-22.045.73925-36e5c1c-1_all.list: -------------------------------------------------------------------------------- 1 | 2 | etc/ 3 | etc/uci-defaults/ 4 | etc/uci-defaults/30_luci-theme-openwrt 5 | usr/ 6 | usr/lib/ 7 | usr/lib/lua/ 8 | usr/lib/lua/luci/ 9 | usr/lib/lua/luci/view/ 10 | usr/lib/lua/luci/view/themes/ 11 | usr/lib/lua/luci/view/themes/openwrt.org/ 12 | usr/lib/lua/luci/view/themes/openwrt.org/footer.htm 13 | usr/lib/lua/luci/view/themes/openwrt.org/header.htm 14 | www/ 15 | www/luci-static/ 16 | www/luci-static/openwrt.org/ 17 | www/luci-static/openwrt.org/cascade.css 18 | www/luci-static/openwrt.org/tabbg.png 19 | www/luci-static/resources/ 20 | www/luci-static/resources/menu-openwrt.js 21 | -------------------------------------------------------------------------------- /system_sw.ini: -------------------------------------------------------------------------------- 1 | [kernelA] 2 | mode=ubi 3 | image=out/kernel.bin 4 | vol_id=0 5 | #vol_size=3MiB 6 | vol_type=dynamic 7 | vol_name=kernelA 8 | vol_alignment=1 9 | 10 | [bootcoreA] 11 | mode=ubi 12 | image=out/bootcore.bin 13 | vol_id=1 14 | #vol_size=6MiB 15 | vol_type=dynamic 16 | vol_name=bootcoreA 17 | vol_alignment=1 18 | 19 | [rootfsA] 20 | mode=ubi 21 | image=out/rootfs.img 22 | vol_id=2 23 | #vol_size=10MiB 24 | vol_type=dynamic 25 | vol_name=rootfsA 26 | vol_alignment=1 27 | 28 | 29 | [kernelB] 30 | mode=ubi 31 | image=out/kernel.bin 32 | vol_id=3 33 | #vol_size=3MiB 34 | vol_type=dynamic 35 | vol_name=kernelB 36 | vol_alignment=1 37 | 38 | [bootcoreB] 39 | mode=ubi 40 | image=out/bootcore.bin 41 | vol_id=4 42 | #vol_size=6MiB 43 | vol_type=dynamic 44 | vol_name=bootcoreB 45 | vol_alignment=1 46 | 47 | [rootfsB] 48 | mode=ubi 49 | image=out/rootfs.img 50 | vol_id=5 51 | #vol_size=10MiB 52 | vol_type=dynamic 53 | vol_name=rootfsB 54 | vol_alignment=1 55 | 56 | -------------------------------------------------------------------------------- /tools/bfw-crc.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | use strict; 3 | use warnings; 4 | 5 | use Digest::CRC; 6 | 7 | my $ctx = Digest::CRC->new(type => "crc32", init => 0x0, xorout => 0x0, refout => 1, refin => 1, poly => 0x4C11DB7); 8 | while (<>) { 9 | $ctx->add($_); 10 | } 11 | 12 | print pack V=>$ctx->digest 13 | -------------------------------------------------------------------------------- /tools/endianess_swap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | [ -n "$2" ] && [ -f "$1" ] && perl -0777ne 'print pack(q{V*},unpack(q{N*},$_))' "$1" > "$2" 3 | -------------------------------------------------------------------------------- /tools/po2lmo.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import os 4 | import sys 5 | import io 6 | 7 | 8 | def die(msg): 9 | print("ERROR:", msg) 10 | sys.exit(1) 11 | 12 | 13 | class u32_t(int): 14 | def __rshift__(self, other): 15 | return u32_t(int.__rshift__(self, other) & 0xFFFFFFFF) 16 | 17 | def __lshift__(self, other): 18 | return u32_t(int.__lshift__(self, other) & 0xFFFFFFFF) 19 | 20 | def __add__(self, other): 21 | return u32_t(int.__add__(self, other) & 0xFFFFFFFF) 22 | 23 | def __xor__(self, other): 24 | return u32_t(int.__xor__(self, other) & 0xFFFFFFFF) 25 | 26 | def sfh_int8(data, offset = 0): 27 | return int.from_bytes(data[offset:offset+1], byteorder='little', signed=True) 28 | 29 | def sfh_uint16(data, offset = 0): 30 | return int.from_bytes(data[offset:offset+2], byteorder='little') 31 | 32 | # SuperFastHash algorithm from Paul Hsieh (LGPLv2.1) http://www.azillionmonkeys.com/qed/hash.html 33 | def sfh_hash(data): 34 | if data is None: 35 | return 0 36 | if isinstance(data, str): 37 | data = data.encode("utf-8") 38 | size = len(data) 39 | if size <= 0: 40 | return 0 41 | hash = u32_t(size) 42 | rem = size & 3 43 | length = size // 4 44 | for i in range(length): 45 | hash += sfh_uint16(data, i*4) 46 | tmp = sfh_uint16(data, i*4 + 2) << 11 47 | tmp ^= hash 48 | hash = (hash << 16) ^ tmp 49 | hash += hash >> 11 50 | i = length * 4 51 | if rem == 3: 52 | hash += sfh_uint16(data, i) 53 | hash ^= hash << 16 54 | hash ^= sfh_int8(data, i + 2) << 18 55 | hash += hash >> 11 56 | if rem == 2: 57 | hash += sfh_uint16(data, i) 58 | hash ^= hash << 11 59 | hash += hash >> 17 60 | if rem == 1: 61 | hash += sfh_int8(data, i) 62 | hash ^= hash << 10 63 | hash += hash >> 1 64 | hash ^= hash << 3 65 | hash += hash >> 5 66 | hash ^= hash << 4 67 | hash += hash >> 17 68 | hash ^= hash << 25 69 | hash += hash >> 6 70 | return hash & 0xFFFFFFFF 71 | 72 | 73 | MSG_UNSPEC = 0 74 | MSG_CTXT = 1 75 | MSG_ID = 2 76 | MSG_ID_PLURAL = 3 77 | MSG_STR = 4 78 | 79 | class Msg: 80 | def __init__(self): 81 | self.init() 82 | 83 | def init(self, plural_num = 0): 84 | self.plural_num = plural_num 85 | self.ctxt = None 86 | self.id = None 87 | self.id_plural = None 88 | self.val = [ None ] * 10 # list of string 89 | self.cur = MSG_UNSPEC 90 | self.key = None 91 | 92 | 93 | class LmoEntry: 94 | def __init__(self, key_id = 0, plural = 0, offset = 0, length = 0, val = None): 95 | self.key_id = key_id 96 | self.plural = plural 97 | self.offset = offset 98 | self.length = length 99 | self.val = val 100 | self.dup = 0 101 | 102 | 103 | class Lmo: 104 | entries = [] # list of LmoEntry 105 | 106 | def __init__(self, verbose = 0): 107 | self.verbose = verbose 108 | self.skip_dup = False 109 | self.entries = [] 110 | self.msg = Msg() 111 | 112 | def add_entry(self, key_id, plural, val): 113 | entry = LmoEntry() 114 | entry.key_id = key_id 115 | entry.plural = plural 116 | entry.offset = len(self.entries) 117 | entry.length = len(val) 118 | entry.val = val 119 | ent = next((ent for ent in self.entries if ent.key_id == key_id), None) 120 | if ent: 121 | if self.skip_dup: 122 | return None # skip duplicate 123 | entry.dup = 1 124 | ent.dup = 1 125 | self.entries.append(entry) 126 | return entry 127 | 128 | def print_msg(self): 129 | msg = self.msg 130 | if not msg.id and not msg.val[0]: 131 | return 132 | if not msg.val[0]: 133 | self.msg.init() 134 | return 135 | if msg.key is not None: 136 | val = msg.val[0] 137 | self.add_entry(msg.key, 0, val) 138 | elif msg.id and msg.plural_num >= 0: 139 | for i, val in enumerate(msg.val): 140 | if val is None: 141 | continue 142 | if (msg.ctxt and msg.id_plural): 143 | key = "%s\1%s\2%d" % (msg.ctxt, msg.id, i) 144 | elif (msg.ctxt): 145 | key = "%s\1%s" % (msg.ctxt, msg.id) 146 | elif (msg.id_plural): 147 | key = "%s\2%d" % (msg.id, i) 148 | else: 149 | key = msg.id 150 | key_id = sfh_hash(key) 151 | val_id = sfh_hash(val) 152 | if key_id != val_id: 153 | self.add_entry(key_id, msg.plural_num, val) 154 | else: 155 | val = msg.val[0] 156 | prefix = b'\\nPlural-Forms: ' 157 | x = val.find(prefix) 158 | if x > 0: 159 | x += len(prefix) 160 | x2 = val.find(b'\\n', x) 161 | if x2 > 0: 162 | self.add_entry(0, -1, val[x:x2]) 163 | # reinit object msg 164 | self.msg.init() 165 | 166 | def extract_string(self, line): 167 | if line.startswith('#'): 168 | return None 169 | x = line.find('"') 170 | if x < 0: 171 | return None 172 | line = line[x+1:] 173 | line = line.replace(r'\\', '\x02') 174 | line = line.replace(r'\"', '\x01') 175 | x = line.find('"') 176 | if x >= 0: 177 | line = line[:x] 178 | line = line.replace('\x01', '"') 179 | line = line.replace('\x02', '\\') 180 | return line 181 | 182 | def process_line(self, line): 183 | msg = self.msg 184 | if line.startswith('msgctxt "'): 185 | self.print_msg() 186 | msg.ctxt = "" 187 | msg.cur = MSG_CTXT 188 | elif line.startswith('msgid "'): 189 | self.print_msg() 190 | msg.id = "" 191 | msg.cur = MSG_ID 192 | elif line.startswith('msgid 0x') or line.startswith('msgkey 0x'): 193 | self.print_msg() 194 | msg.id = '\x01' 195 | msg.plural_num = 0 196 | x = line.find('0x') 197 | msg.key = int(line[x:], 16) 198 | msg.cur = MSG_UNSPEC # without text data 199 | elif line.startswith('msgid_plural "'): 200 | msg.id_plural = "" 201 | msg.cur = MSG_ID_PLURAL 202 | elif line.startswith('msgstr "') or line.startswith('msgstr['): 203 | msg.plural_num = 0 204 | if line.startswith('msgstr['): 205 | x1 = line.find('[') 206 | x2 = line.find(']') 207 | msg.plural_num = int(line[x1+1:x2]) 208 | if msg.plural_num >= 10: 209 | die("Too many plural forms") 210 | msg.val[msg.plural_num] = b'' 211 | msg.cur = MSG_STR 212 | # read text data 213 | if msg.cur != MSG_UNSPEC: 214 | tmp = self.extract_string(line) 215 | if tmp: 216 | if msg.cur == MSG_CTXT: 217 | msg.ctxt += tmp 218 | if msg.cur == MSG_ID: 219 | msg.id += tmp 220 | if msg.cur == MSG_ID_PLURAL: 221 | msg.id_plural += tmp 222 | if msg.cur == MSG_STR: 223 | msg.val[msg.plural_num] += tmp.encode("utf-8") 224 | 225 | def load_from_text(self, filename): 226 | self.entries = [] 227 | self.msg.init(-1) 228 | with open(filename, "r", encoding='UTF-8') as file: 229 | for line in file: 230 | self.process_line(line.rstrip()) 231 | else: 232 | self.print_msg() # EOF 233 | 234 | def load_from_list(self, entries): 235 | self.entries = entries 236 | 237 | def save_to_bin(self, filename = None): 238 | buf = bytearray(b'\x00' * 0x400000) # 4MiB 239 | offset = 0 240 | elst = [] # new list of LmoEntry() 241 | for i, ent in enumerate(self.entries): 242 | val = ent.val 243 | if isinstance(val, str): 244 | val = val.encode('utf-8') 245 | length = len(val) 246 | buf[offset:offset+length] = val 247 | ek = LmoEntry(ent.key_id, ent.plural, offset, length, val) 248 | ek.dup = ent.dup 249 | elst.append(ek) 250 | offset += length 251 | if offset & 3 != 0: 252 | offset += 4 - (offset & 3) 253 | elst = sorted(elst, key=lambda x: x.key_id) 254 | #if offset & 0xF != 0: 255 | # offset += 0x10 - (offset & 0xF) 256 | table_offset = offset 257 | for i, ent in enumerate(elst): 258 | buf[offset :offset+4] = ent.key_id.to_bytes(4, byteorder='big') 259 | buf[offset+4 :offset+8] = (ent.plural + 1).to_bytes(4, byteorder='big') 260 | buf[offset+8 :offset+12] = ent.offset.to_bytes(4, byteorder='big') 261 | buf[offset+12:offset+16] = ent.length.to_bytes(4, byteorder='big') 262 | if self.verbose and ent.dup: 263 | val = ent.val.decode() if ent.val is not None else "" 264 | print('DUP: 0x%08X (0x%05X) "%s"' % (ent.key_id, ent.offset, val)) 265 | offset += 16 266 | if offset > 0: 267 | buf[offset:offset+4] = table_offset.to_bytes(4, byteorder='big') 268 | offset += 4 269 | buf = buf[:offset] 270 | if filename: 271 | with open(filename, "wb") as file: 272 | file.write(buf) 273 | return buf 274 | 275 | 276 | if __name__ == "__main__": 277 | sys.stdout.reconfigure(encoding='utf-8') 278 | fn_inp = sys.argv[1] 279 | fn_out = sys.argv[2] 280 | lmo = Lmo(verbose = 99) 281 | lmo.skip_dup = False 282 | lmo.load_from_text(fn_inp) 283 | lmo.save_to_bin(fn_out) 284 | print('\nLMO-file saved to "{}"'.format(fn_out)) 285 | 286 | 287 | 288 | 289 | -------------------------------------------------------------------------------- /wholeImage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if { [ "$1" -lt 0 ] || [ "$1" -ge 0 ]; } 2>/dev/null; then 3 | TIMESTAMP="$1" 4 | else 5 | TIMESTAMP=$(date '+%s') 6 | fi 7 | TIMESTAMP=$(($TIMESTAMP & 0xffffffff)) 8 | 9 | cat_data() { 10 | local max=false 11 | local size= 12 | local file= 13 | while [ $# -gt 0 ]; do 14 | case "$1" in 15 | -m) 16 | max=true 17 | ;; 18 | *) 19 | if [ -z "$size" ]; then 20 | size="$((${1}))" 21 | elif [ -z "$file" ]; then 22 | file="${1}" 23 | fi 24 | ;; 25 | esac 26 | shift 27 | done 28 | file="${file:-/dev/null}" 29 | 30 | { cat "$file" ; $max || { cat /dev/zero | LC_ALL=C tr "\000" "\377"; }; } | head -c "$size" 31 | } 32 | 33 | rm -f whole_image/system_sw.img 34 | ubinize -o whole_image/system_sw.img -p 128KiB -m 2048 -s 2048 -v system_sw.ini -Q "$TIMESTAMP" 35 | echo 36 | 37 | OUTIMG="out/whole-image.img" 38 | echo -n "Building '$OUTIMG'..." 39 | 40 | cat_data 0x00100000 "whole_image/uboot-azores-1.0.24.bin" > "$OUTIMG" # uboot 41 | cat_data 0x00040000 "whole_image/ubootenv-azores.img" >> "$OUTIMG" # ubootconfigA 42 | cat_data 0x00040000 "whole_image/ubootenv-azores.img" >> "$OUTIMG" # ubootconfigB 43 | cat_data 0x00040000 >> "$OUTIMG" # gphyfirmware 44 | cat_data 0x00100000 >> "$OUTIMG" # calibration 45 | cat_data 0x01000000 >> "$OUTIMG" # bootcore 46 | cat_data -m 0x06600000 "whole_image/system_sw.img" >> "$OUTIMG" # system_sw 47 | #cat_data 0x00600000 >> "$OUTIMG" # ptdata 48 | #cat_data 0x00140000 "whole_image/res.bin" >> "$OUTIMG" # res 49 | 50 | echo " done" 51 | 52 | FLSIMG="out/whole-image-endian.img" 53 | 54 | echo -n "Creating endian reversed flash image '$FLSIMG'..." 55 | tools/endianess_swap.sh "$OUTIMG" "$FLSIMG" 56 | echo " done" 57 | 58 | touch -d "@$TIMESTAMP" "$OUTIMG" "$FLSIMG" 59 | 60 | #OUTIMG="out/whole-8311.img" 61 | #echo -n "Building '$OUTIMG'..." 62 | 63 | #cat_data 0x00100000 "whole_image/uboot-8311.bin" > "$OUTIMG" # uboot 64 | #cat_data 0x00040000 "whole_image/ubootenv-8311.img" >> "$OUTIMG" # ubootconfigA 65 | #cat_data 0x00040000 "whole_image/ubootenv-8311.img" >> "$OUTIMG" # ubootconfigB 66 | #cat_data 0x00040000 >> "$OUTIMG" # gphyfirmware 67 | #cat_data 0x00100000 >> "$OUTIMG" # calibration 68 | #cat_data 0x01000000 >> "$OUTIMG" # bootcore 69 | #cat_data -m 0x06C00000 "whole_image/system_sw.img" >> "$OUTIMG" # system_sw 70 | #cat_data 0x00140000 "whole_image/res.bin" >> "$OUTIMG" # res 71 | 72 | #touch -d "@$TIMESTAMP" "$OUTIMG" 73 | #echo " done" 74 | -------------------------------------------------------------------------------- /whole_image/res.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/whole_image/res.bin -------------------------------------------------------------------------------- /whole_image/uboot-8311.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/whole_image/uboot-8311.bin -------------------------------------------------------------------------------- /whole_image/uboot-azores-1.0.24.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/whole_image/uboot-azores-1.0.24.bin -------------------------------------------------------------------------------- /whole_image/uboot-azores.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/whole_image/uboot-azores.bin -------------------------------------------------------------------------------- /whole_image/uboot-potron-original.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/whole_image/uboot-potron-original.bin -------------------------------------------------------------------------------- /whole_image/uboot-potron.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/whole_image/uboot-potron.bin -------------------------------------------------------------------------------- /whole_image/ubootenv-8311.img: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/whole_image/ubootenv-8311.img -------------------------------------------------------------------------------- /whole_image/ubootenv-azores.img: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/whole_image/ubootenv-azores.img -------------------------------------------------------------------------------- /whole_image/ubootenv-potron.img: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djGrrr/8311-was-110-firmware-builder/f4e4db3a0cf6bb395ab68d1674fe243bdacc93c4/whole_image/ubootenv-potron.img --------------------------------------------------------------------------------