### System Preparation and Installation Commands Source: https://github.com/ysurac/openmptcprouter/wiki/Install-or-update-the-VPS Standard commands to update system packages and execute the OpenMPTCProuter installation script. The script requires root privileges and supports specific kernel versions. ```bash apt-get update && apt-get upgrade ``` ```bash wget -O - https://www.openmptcprouter.com/server/debian-x86_64.sh | KERNEL="6.12" sh ``` ```bash wget https://www.openmptcprouter.com/server/debian-x86_64.sh KERNEL="6.12" sh debian-x86_64.sh ``` -------------------------------- ### Build OpenMPTCProuter for x86/x64 Targets Source: https://context7.com/ysurac/openmptcprouter/llms.txt Builds OpenMPTCProuter for x86 and x86_64 architectures, supporting both physical installations and virtual machines. It includes options for image formats, partitioning, and instructions for physical, VirtualBox, VMware, and Hyper-V installations. ```bash # x86_64 build with VM image formats OMR_TARGET="x86_64" OMR_KERNEL="6.12" OMR_IMG="yes" OMR_PARTSIZE="1024" ./build.sh # Configuration generates multiple formats: # - omr-x86-64-generic-ext4-combined.img (raw disk image) # - omr-x86-64-generic-squashfs-combined.img.gz # - omr-x86-64-generic.vdi (VirtualBox) # - omr-x86-64-generic.vmdk (VMware) # - omr-x86-64-generic.vhdx (Hyper-V) # Physical installation gunzip omr-x86-64-*.img.gz dd bs=4M if=omr-x86-64-*.img of=/dev/sda conv=fsync # VirtualBox installation # 1. Create new VM (Linux 2.6/3.x/4.x/5.x 64-bit) # 2. Use existing VDI file # 3. Configure network: Adapter 1 (WAN1), Adapter 2 (WAN2), Adapter 3 (LAN) # 4. Start VM # VMware installation # 1. Create new VM # 2. Use existing VMDK file # 3. Network adapters: WAN interfaces + LAN interface # 4. Power on # Hyper-V installation New-VM -Name "OpenMPTCProuter" -MemoryStartupBytes 1GB -VHDPath "omr-x86-64-generic.vhdx" Add-VMNetworkAdapter -VMName "OpenMPTCProuter" -SwitchName "WAN1" Add-VMNetworkAdapter -VMName "OpenMPTCProuter" -SwitchName "WAN2" Start-VM -Name "OpenMPTCProuter" ``` -------------------------------- ### Enable Advanced Network Kernel Features Source: https://context7.com/ysurac/openmptcprouter/llms.txt Provides configuration for kernel modules supporting traffic control, VLANs, and bridging. Includes a practical example for setting up a VLAN interface. ```bash CONFIG_PACKAGE_kmod-bridge=y CONFIG_PACKAGE_kmod-8021q=y CONFIG_PACKAGE_kmod-sched=y ip link add link eth0 name eth0.100 type vlan id 100 ip addr add 192.168.100.1/24 dev eth0.100 ip link set eth0.100 up ``` -------------------------------- ### Legacy Kernel Installation Source: https://github.com/ysurac/openmptcprouter/wiki/Install-or-update-the-VPS Installation command for legacy MPTCP support using kernel 5.4. Ensure the router side also utilizes kernel 5.4 for compatibility. ```bash wget -O - https://www.openmptcprouter.com/server/debian-x86_64.sh | KERNEL="5.4" sh ``` -------------------------------- ### Configure USB Network Adapter Modules Source: https://context7.com/ysurac/openmptcprouter/llms.txt Lists kernel module packages for enabling USB-based network interfaces and modems. Includes runtime diagnostic commands for hardware verification. ```bash CONFIG_PACKAGE_kmod-usb-net-cdc-ether=y CONFIG_PACKAGE_kmod-usb-net-qmi-wwan=y CONFIG_PACKAGE_kmod-usb-serial-option=y lsusb dmesg | grep -i usb ip link show ``` -------------------------------- ### C LZMA Encoder Allocator Setup Source: https://github.com/ysurac/openmptcprouter/blob/develop/common/package/boot/uboot-ipq40xx/src/lib/lzma/lzma.txt Illustrates the setup of memory allocators for the LZMA encoder. It shows how to define custom allocation and deallocation functions, which can be optimized for specific memory management strategies. ```c static void *SzAlloc(void *p, size_t size) { p = p; return MyAlloc(size); } static void SzFree(void *p, void *address) { p = p; MyFree(address); } static ISzAlloc g_Alloc = { SzAlloc, SzFree }; ``` -------------------------------- ### Deploy MPTCP server on VPS Source: https://context7.com/ysurac/openmptcprouter/llms.txt Installs and configures the OpenMPTCProuter server component on a Debian VPS. This process involves executing an installation script, handling potential certificate issues, and retrieving configuration keys. ```bash # Install with kernel 6.12 (recommended) wget -O - https://www.openmptcprouter.com/server/debian-x86_64.sh | KERNEL="6.12" sh # Alternative method wget https://www.openmptcprouter.com/server/debian-x86_64.sh KERNEL="6.12" sh debian-x86_64.sh # Fix certificate errors if needed apt-get install -y ca-certificates sed -i '/^mozilla\/DST_Root_CA_X3/s/^/!/' /etc/ca-certificates.conf update-ca-certificates -f # Retrieve configuration keys post-reboot cat /root/openmptcprouter_config.txt ``` -------------------------------- ### Configure bootloader and partitions Source: https://github.com/ysurac/openmptcprouter/wiki/Router-install Update the primary boot partition and sync boot configuration binaries to the device flash to ensure the system boots correctly from the new installation. ```shell echo 0 > /proc/boot_info/rootfs/primaryboot cat /proc/boot_info/getbinary_bootconfig > /tmp/bootconfig.bin cat /proc/boot_info/getbinary_bootconfig1 > /tmp/bootconfig1.bin mtd write /tmp/bootconfig.bin /dev/mtd2 mtd write /tmp/bootconfig1.bin /dev/mtd3 ``` -------------------------------- ### Configure BusyBox Utilities for OpenMPTCProuter Source: https://context7.com/ysurac/openmptcprouter/llms.txt Customizes BusyBox utilities by enabling specific features and configurations within the build system. This allows for enhanced system administration capabilities like user management, network diagnostics, and process control. Example usage commands are provided after building. ```bash # Enhanced BusyBox configuration (in config file) CONFIG_BUSYBOX_CUSTOM=y CONFIG_BUSYBOX_CONFIG_ADDUSER=y # User management CONFIG_BUSYBOX_CONFIG_DELUSER=y CONFIG_BUSYBOX_CONFIG_CHPASSWD=y CONFIG_BUSYBOX_CONFIG_ARP=y # Network tools CONFIG_BUSYBOX_CONFIG_ARPING=y CONFIG_BUSYBOX_CONFIG_TELNET=y CONFIG_BUSYBOX_CONFIG_NOHUP=y # Process management CONFIG_BUSYBOX_CONFIG_PKILL=y CONFIG_BUSYBOX_CONFIG_TIMEOUT=y CONFIG_BUSYBOX_CONFIG_WATCH=y CONFIG_BUSYBOX_CONFIG_IOSTAT=y # System monitoring CONFIG_BUSYBOX_CONFIG_STAT=y CONFIG_BUSYBOX_CONFIG_STTY=y # Terminal control CONFIG_BUSYBOX_CONFIG_DIFF=y # File comparison CONFIG_BUSYBOX_CONFIG_BASE64=y # Encoding CONFIG_BUSYBOX_CONFIG_BC=y # Calculator # Feature flags CONFIG_BUSYBOX_CONFIG_FEATURE_VI_UNDO=y CONFIG_BUSYBOX_CONFIG_FEATURE_PS_LONG=y CONFIG_BUSYBOX_CONFIG_FEATURE_STAT_FILESYSTEM=y CONFIG_BUSYBOX_CONFIG_FEATURE_DATE_NANO=y # Example usage after build # User management adduser newuser echo "newuser:password" | chpasswd # Network diagnostics arping -c 4 192.168.1.1 watch -n 1 'ip -s link' # System monitoring iostat 1 5 stat /etc/config/network ``` -------------------------------- ### Configure VPS Network Firewall Rules Source: https://context7.com/ysurac/openmptcprouter/llms.txt Defines the necessary firewall port requirements for services like SSH, Shadowsocks, and VPNs. Provides implementation examples for UFW, iptables, and cloud provider security groups. ```bash ufw allow 65000:65535/tcp ufw allow 65000:65535/udp ufw allow 443/tcp ufw enable iptables -A INPUT -p tcp --dport 65000:65535 -j ACCEPT iptables -A INPUT -p udp --dport 65000:65535 -j ACCEPT iptables -A INPUT -p tcp --dport 443 -j ACCEPT iptables -A INPUT -p icmp -j ACCEPT iptables-save > /etc/iptables/rules.v4 ``` -------------------------------- ### Configure build system environment variables Source: https://context7.com/ysurac/openmptcprouter/llms.txt Environment variables control the build process including image generation, kernel selection, and directory management. These variables allow for repeatable and customized build configurations. ```bash export OMR_DIST="openmptcprouter" export OMR_TARGET="x86_64" export OMR_KERNEL="6.1" export OMR_PACKAGES="full" export OMR_ALL_PACKAGES="yes" export OMR_IMG="yes" export OMR_KEEPBIN="no" export OMR_PARTSIZE="512" export OMR_LIBC="musl" export OMR_FEED_URL="https://github.com/ysurac/openmptcprouter-feeds" export OMR_FEED_SRC="develop" # Build with custom configuration OMR_TARGET="r4s" OMR_KERNEL="6.6" OMR_PARTSIZE="1024" ./build.sh -j8 ``` -------------------------------- ### Enable MPTCP Kernel Options and Testing Source: https://context7.com/ysurac/openmptcprouter/llms.txt Covers kernel configuration flags for MPTCP, including congestion control and path management. Includes commands to verify MPTCP settings on a running system. ```bash CONFIG_KERNEL_MPTCP=y CONFIG_KERNEL_MPTCP_FULLMESH=y CONFIG_KERNEL_TCP_CONG_BBR=y ip mptcp endpoint show ip mptcp limits show sysctl -a | grep mptcp ``` -------------------------------- ### MPC7xxx System and Board Initialization (C) Source: https://github.com/ysurac/openmptcprouter/blob/develop/common/package/boot/uboot-ipq40xx/src/board/evb64260/bootseq.txt Initializes essential system components after basic hardware setup. This includes setting up the stack pointer, Global Offset Table (GOT), calling CPU-specific initialization, and performing board-level early setup routines. ```c setup stack pointer (r1) setup GOT call cpu_init_f debug leds board_init_f: (common/board.c) board_early_init_f: remap gt regs? map PCI mem/io map device space clear out interrupts init_timebase env_init serial_init console_init_f display_options ``` -------------------------------- ### Build OpenMPTCProuter for Raspberry Pi Targets Source: https://context7.com/ysurac/openmptcprouter/llms.txt Instructions for building OpenMPTCProuter specifically for Raspberry Pi models (2, 3, 4, 5). It specifies the target architecture and kernel version, then executes the build script. It also includes steps for flashing the resulting image to an SD card and post-installation access details. ```bash # Raspberry Pi 4 configuration (config-rpi4) # Architecture: aarch64_cortex-a72 OMR_TARGET="rpi4" OMR_KERNEL="6.6" ./build.sh # Raspberry Pi 5 configuration (config-rpi5) # Architecture: aarch64_cortex-a76 OMR_TARGET="rpi5" OMR_KERNEL="6.12" ./build.sh # Raspberry Pi 3 configuration (config-rpi3) # Architecture: aarch64_cortex-a53 OMR_TARGET="rpi3" OMR_KERNEL="6.1" ./build.sh # Raspberry Pi 2 configuration (config-rpi2) # Architecture: arm_cortex-a7_neon-vfpv4 OMR_TARGET="rpi2" OMR_KERNEL="5.4" ./build.sh # Installation to SD card gunzip omr-rpi4-*.img.gz # On Linux dd bs=4M if=omr-rpi4-*.img of=/dev/mmcblk0 conv=fsync status=progress # On macOS dd bs=4m if=omr-rpi4-*.img of=/dev/rdisk2 conv=sync # On Windows (use Win32DiskImager or Rufus) # Post-installation # 1. Insert SD card into Raspberry Pi # 2. Connect Ethernet cable # 3. Power on # 4. Access via http://192.168.100.1 or SSH to root@192.168.100.1 ``` -------------------------------- ### Certificate Error Resolution Source: https://github.com/ysurac/openmptcprouter/wiki/Install-or-update-the-VPS Command to fix potential SSL/TLS certificate errors by updating CA certificates and modifying the local trust store configuration. ```bash apt-get install -y ca-certificates && sed -i '/^mozilla\/DST_Root_CA_X3/s/^/!/' /etc/ca-certificates.conf && update-ca-certificates -f ``` -------------------------------- ### Build OpenMPTCProuter firmware images Source: https://context7.com/ysurac/openmptcprouter/llms.txt Utilizes the build.sh script to generate custom firmware images for specific hardware targets. Users can define the target platform, kernel version, and package sets via environment variables. ```bash # Clone the repository git clone https://github.com/Ysurac/openmptcprouter.git cd openmptcprouter git checkout master # Build for x86_64 platform with kernel 6.1 OMR_TARGET="x86_64" OMR_FEED_SRC="master" OMR_KERNEL="6.1" ./build.sh # Build for Raspberry Pi 4 with kernel 5.4 OMR_TARGET="rpi4" OMR_FEED_SRC="master" OMR_KERNEL="5.4" ./build.sh -j4 # Build with custom package set OMR_TARGET="x86_64" OMR_KERNEL="6.6" OMR_PACKAGES="full" ./build.sh # Build all packages (not just selected) OMR_TARGET="x86_64" OMR_ALL_PACKAGES="yes" OMR_KERNEL="6.1" ./build.sh ``` -------------------------------- ### Install OpenMPTCProuter Development Server via Shell Source: https://github.com/ysurac/openmptcprouter/wiki/Snapshots This command downloads and executes the OpenMPTCProuter server installation script for Debian/Ubuntu. It supports custom kernel versions via the KERNEL environment variable and allows disabling Fail2ban by setting the FAIL2BAN environment variable. ```shell wget -O - https://www.openmptcprouter.com/server-test/debian-x86_64.sh | KERNEL="6.18" sh ``` ```shell FAIL2BAN="no" wget -O - https://www.openmptcprouter.com/server-test/debian-x86_64.sh | KERNEL="6.18" sh ``` -------------------------------- ### Verify device partition set Source: https://github.com/ysurac/openmptcprouter/wiki/Router-install Check the current boot partition set before proceeding with firmware installation. If the primaryboot file reads 0, a Teltonika software update is required prior to the installation. ```shell cat /proc/boot_info/rootfs/primaryboot ``` -------------------------------- ### MPC7xxx Post-Relocation Initialization (C) Source: https://github.com/ysurac/openmptcprouter/blob/develop/common/package/boot/uboot-ipq40xx/src/board/evb64260/bootseq.txt Performs final initialization steps after code relocation. This includes trap handling, flash memory setup, memory allocation initialization, and miscellaneous board-specific configurations. ```c trap_init flash_init: (board/evb64260/flash.c) setup bd flash info cpu_init_r: (cpu/mpc7xxx/cpu_init.c) nothing mem_malloc_init malloc_bin_reloc spi_init (r or f)??? (CONFIG_ENV_IS_IN_EEPROM) env_relocated misc_init_r(bd): (board/evb64260/evb64260.c) mpsc_init2 ``` -------------------------------- ### Build OpenMPTCProuter for Embedded Router Targets Source: https://context7.com/ysurac/openmptcprouter/llms.txt Build firmware for various commercial embedded routers, including Linksys, Banana Pi, FriendlyElec, GL.iNet, Ubiquiti, and Teltonika. This snippet outlines the build command with specific target names and kernel versions, and mentions common installation methods like web interface or TFTP. ```bash # Linksys WRT3200ACM/WRT32X (Marvell Armada 385) # Architecture: arm_cortex-a9_vfpv3-d16 OMR_TARGET="wrt3200acm" OMR_KERNEL="6.1" ./build.sh # Flash via web interface or TFTP recovery # Banana Pi R2/R3/R4 (MediaTek) OMR_TARGET="bpi-r3" OMR_KERNEL="6.6" ./build.sh # Architecture: aarch64_cortex-a53 # FriendlyElec NanoPi R2S/R4S/R5S (Rockchip) OMR_TARGET="r4s" OMR_KERNEL="6.6" ./build.sh # Architecture: aarch64_generic # GL.iNet routers OMR_TARGET="gl-mt6000" OMR_KERNEL="6.6" ./build.sh # Architecture: aarch64_cortex-a53 # Ubiquiti EdgeRouter X OMR_TARGET="ubnt-erx" OMR_KERNEL="5.4" ./build.sh # Architecture: mipsel_24kc # Teltonika RUTX series (4G/5G industrial routers) OMR_TARGET="rutx12" OMR_KERNEL="6.6" ./build.sh # Architecture: arm_cortex-a7_neon-vfpv4 # Installation typically via: # 1. Web interface (System > Backup/Flash Firmware) # 2. TFTP recovery mode # 3. Serial console and U-Boot # Refer to device-specific documentation ``` -------------------------------- ### Bridge Configuration using brctl Source: https://context7.com/ysurac/openmptcprouter/llms.txt This snippet demonstrates how to configure a network bridge named 'br0' using the 'brctl' command. It adds network interfaces 'eth0' and 'eth1' to the bridge and brings the bridge interface up. This is a fundamental step for network bridging. ```bash brctl addbr br0 brctl addif br0 eth0 brctl addif br0 eth1 ip link set br0 up ``` -------------------------------- ### MPC7xxx Assembly Boot Entry Points Source: https://github.com/ysurac/openmptcprouter/blob/develop/common/package/boot/uboot-ipq40xx/src/board/evb64260/bootseq.txt Defines the entry points for cold and warm boots in the MPC7xxx assembly code. The 'start' label branches to 'boot_cold' for a cold boot, while 'start_warm' branches to 'boot_warm' for a warm reboot. ```assembly start: b boot_cold start_warm: b boot_warm ``` -------------------------------- ### MPC7xxx Cold/Warm Boot Initialization Sequence (Assembly) Source: https://github.com/ysurac/openmptcprouter/blob/develop/common/package/boot/uboot-ipq40xx/src/board/evb64260/bootseq.txt Handles core system initialization for both cold and warm boots, including cache management, memory configuration, address translation, and setting up the initial execution environment in flash. ```assembly boot_cold: boot_warm: clear bats init l2 (if enabled) init altivec (if enabled) invalidate l2 (if enabled) setup bats (from defines in config_EVB) enable_addr_trans: (if MMU enabled) enable MSR_IR and MSR_DR jump to in_flash ``` -------------------------------- ### MPC7xxx Flash Execution and DRAM Initialization (Assembly) Source: https://github.com/ysurac/openmptcprouter/blob/develop/common/package/boot/uboot-ipq40xx/src/board/evb64260/bootseq.txt Sets up the L1 data cache and initializes the SDRAM. This involves configuring memory timings, detecting DIMM configurations, and setting up various bus and device timings. ```assembly in_flash: enable l1 dcache gal_low_init: (board/evb64260/sdram_init.S) config SDRAM (CFG, TIMING, DECODE) init scratch regs (810 + 814) detect DIMM0 (bank 0 only) config SDRAM_PARA0 to 256/512Mbit bl sdram_op_mode detect bank0 width write scratch reg 810 config SDRAM_PARA0 with results config SDRAM_PARA1 with results detect DIMM1 (bank 2 only) config SDRAM_PARA2 to 256/512Mbit detect bank2 width write scratch reg 814 config SDRAM_PARA2 with results config SDRAM_PARA3 with results setup device bus timings/width setup boot device timings/width setup CPU_CONF (0x0) setup cpu master control register 0x160 setup PCI0 TIMEOUT setup PCI1 TIMEOUT setup PCI0 BAR setup PCI1 BAR setup MPP control 0-3 setup GPP level control setup Serial ports multiplex ``` -------------------------------- ### C LZMA Encoder Initialization and Property Setting Source: https://github.com/ysurac/openmptcprouter/blob/develop/common/package/boot/uboot-ipq40xx/src/lib/lzma/lzma.txt Shows the process of initializing an LZMA encoder and setting its properties. This involves creating an encoder handle, initializing properties, and then applying these properties to the encoder. ```c CLzmaEncHandle enc; enc = LzmaEnc_Create(&g_Alloc); if (enc == 0) return SZ_ERROR_MEM; LzmaEncProps_Init(&props); res = LzmaEnc_SetProps(enc, &props); ``` -------------------------------- ### Define Board-Specific Clocks Source: https://github.com/ysurac/openmptcprouter/blob/develop/common/package/boot/uboot-ipq40xx/src/doc/device-tree-bindings/clock/nvidia,tegra20-car.txt Demonstrates the setup of fixed-frequency oscillator clocks at the board level and establishes the link to the Tegra20 CAR controller node. This is required to provide the 32KHz and oscillator inputs to the CAR module. ```dts / { clocks { #address-cells = <1>; #size-cells = <0>; osc: clock { compatible = "fixed-clock"; #clock-cells = <0>; clock-frequency = <12000000>; }; }; i2c@7000d000 { pmic@34 { compatible = "ti,tps6586x"; reg = <0x34>; clk_32k: clock { compatible = "fixed-clock"; #clock-cells = <0>; clock-frequency = <32768>; }; }; }; &tegra_car { clocks = <&clk_32k> <&osc>; }; }; ``` -------------------------------- ### Set OpenMPTCProuter LAN IP via SSH Source: https://github.com/ysurac/openmptcprouter/wiki/OpenMPTCProuter-configuration Updates the local area network IP address using the Unified Configuration Interface (UCI). This command modifies the network configuration, commits the changes, and initiates a system reboot to apply the new IP address. ```shell uci set network.lan.ipaddr='your-static-ip-address' && uci commit && reboot ``` -------------------------------- ### MPC7xxx Code Relocation and Board Initialization (C/Assembly) Source: https://github.com/ysurac/openmptcprouter/blob/develop/common/package/boot/uboot-ipq40xx/src/board/evb64260/bootseq.txt Manages the relocation of the executable code and clears the BSS section. It then calls the board-specific initialization function 'board_init_r' to set up board structures and function pointers. ```assembly setup monitor alloc board info struct init bd struct relocate_code: (cpu/mpc7xxx/start.S) copy,got,clearbss board_init_r(bd, dest_addr) (common/board.c) setup bd function pointers ``` -------------------------------- ### Reboot device Source: https://github.com/ysurac/openmptcprouter/wiki/Router-install Execute a system reboot to apply changes and initiate the new firmware environment. ```shell reboot ``` -------------------------------- ### Transfer firmware image via SCP Source: https://github.com/ysurac/openmptcprouter/wiki/Router-install Securely copy the OpenWrt factory image to the router's temporary directory using the root credentials configured in the device Web-UI. ```shell scp -O openmptcprouter-*-factory.ubi root@192.168.1.1:/tmp ``` -------------------------------- ### Flash firmware to device memory Source: https://github.com/ysurac/openmptcprouter/wiki/Router-install Utilize the ubiformat command to write the factory firmware image directly to the specified MTD device partition. ```shell ubiformat /dev/mtd16 -y -f /tmp/openwrt-factory.bin ``` -------------------------------- ### Loading Indicator Animation (CSS) Source: https://github.com/ysurac/openmptcprouter/blob/develop/common/package/boot/uboot-ipq40xx/src/httpd/vendors/oem/flashing.html This CSS code defines a spinning loading indicator animation. It uses keyframes to rotate an element, creating a visual cue for ongoing processes. No external dependencies are required. ```css h1,p,body{margin:0;padding:0}html,body{font:13px/20px Tahoma,sans-serif;background:#FFF;color:#000;text-align:center;height:100%}#m{padding:30px 0}#m>*{padding:20px}h1{font:bold 40px/40px Arial}#l{height:30px;width:30px;margin:30px auto;-webkit-animation:r 1s infinite linear;-moz-animation:r 1s infinite linear;-o-animation:r 1s infinite linear;animation:r 1s infinite linear;border-left:5px solid #FFF;border-right:5px solid #FFF;border-bottom:5px solid #000;border-top:5px solid #000;border-radius:100%}@-webkit-keyframes r{from{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(359deg)}}@-moz-keyframes r{from{-moz-transform:rotate(0deg)}to{-moz-transform:rotate(359deg)}}@-o-keyframes r{from{-o-transform:rotate(0deg)}to{-o-transform:rotate(359deg)}}@keyframes r{from{transform:rotate(0deg)}to{transform:rotate(359deg)}} ```