4,246 Lines
  • Shell 39.4%
  • C 25.5%
  • Markdown 16.5%
  • Python 14.4%
  • Yaml 3.4%
  • JSON 0.5%
  • INI 0.3%
README.md

OpenNGFW: OpenNetgearFirmware

   ___                      _   _  ____ _______        __
  / _ \ _ __   ___ _ __    | \ | |/ ___|  ___\ \      / /
 | | | | '_ \ / _ \ '_ \   |  \| | |  _| |_   \ \ /\ / / 
 | |_| | |_) |  __/ | | |  | |\  | |_| |  _|   \ V  V /  
  \___/| .__/ \___|_| |_|  |_| \_|\____|_|      \_/\_/   
       |_|                                               
 OpenNetgearFirmware - High-Performance Embedded Linux for Netgear Routers

OpenNGFW (OpenNetgearFirmware) is a minimal, modular, high-performance embedded Linux distribution built with Buildroot (BR2_EXTERNAL), specifically engineered for the Netgear R6300v2 (Broadcom BCM4708 Cortex-A9 dual-core) and ARMv7 platforms.


✨ Features

  • ⚡ Modern Linux Kernel (6.6 LTS): Upstream long-term stable Linux kernel with Broadcom Northstar (BCM4708) support, native WireGuard (CONFIG_WIREGUARD=y), and full Netfilter IPv4/IPv6 subsystem.
  • 🛡️ Clean & Lean Userland: Fast BusyBox initramfs with musl libc, Zsh shell with Powerlevel10k styling, and Dropbear SSH daemon.
  • 💾 Universal USB Storage & Automatic Persistence:
    • Automatically mounts ext4 USB flash drives at /mnt/usb on boot.
    • Transparent OverlayFS on /etc (/mnt/usb/persist/etc_upper) — network configurations, WireGuard keys, and service units automatically survive reboots with zero manual sync.
    • Persistent /root and /home mounts.
  • 📦 Native Package Manager (apkg / pkg):
    • Written in V (compiled to C/ARM binary) for blazingly fast package operations on embedded hardware.
    • Installs binaries, libraries, and utilities directly to USB storage (/mnt/usb/opt).
    • Available packages: netclient, ufw, git, btop, htop, nano, fastfetch.
  • 🌐 WireGuard & Netmaker Netclient Integration:
    • Out-of-the-box automatic zero-trust mesh networking.
    • Full systemd unit translation shim (systemctl) to run daemons natively on SysVinit.
  • 🕒 Resilient Time Synchronization:
    • Fake hardware clock (last_time) timestamp restore on boot.
    • Multi-provider HTTP header & NTP time synchronization daemon (S45time).
  • 🔨 1-Click Reproducible Build System:
    • Single setup.sh command to bootstrap host dependencies, toolchains, and build trees.
    • Sub-minute incremental kernel rebuilds (make linux-rebuild) and rootfs packaging (make rootfs).
    • Automatic Netgear .chk firmware generation with proper TRX v1 and Fletcher checksums (make chk).

🚀 Quick Start & Building

1. Prerequisites (Ubuntu / Debian / Arch / Fedora)

Clone the repository:

git clone https://code.weexnes.dev/OpenNGFW.git
cd OpenNGFW

2. Setup Host Environment

Run the one-command setup script to verify dependencies and fetch Buildroot LTS:

./setup.sh

3. Build the Firmware

Full Build from scratch:

make r6300v2
# or: ./build.sh r6300v2

Fast Incremental Rebuild (20-30 seconds): After modifying overlay files, scripts, or kernel configs, you can instantly repack and generate the flashable image without rebuilding Buildroot:

make chk

Both build commands will generate the flashable image:

  • build/r6300v2/images/openngfw.chk (and artifacts/r6300v2/openngfw.chk)

⚡ Flashing the Router

Connect your PC to any LAN port of the Netgear R6300v2 via Ethernet:

# Find your network interface name (e.g. eth0 or enp0s20f0u1u4)
ip link

# Flash using nmrpflash:
sudo nmrpflash -i <your-interface> -f build/r6300v2/images/openngfw.chk

Then power-cycle the router when prompted. The router will flash the kernel/rootfs partition and reboot into OpenNGFW!


💻 On-Device Usage

USB Storage & Persistence Setup

Format a USB drive with an ext4 filesystem on your PC:

sudo mkfs.ext4 -L OPENNGFW /dev/sdX1

Plug the USB drive into either USB port on the router. OpenNGFW will automatically detect, mount, and activate /etc overlay persistence and /root storage on boot!

Package Manager (pkg / apkg)

Install packages to your USB drive with simple commands:

pkg update
pkg list
pkg install netclient
pkg install ufw
pkg install git

Starting Services

Manage services with the lightweight systemctl runner:

systemctl start netclient
systemctl status netclient
systemctl restart netclient

📁 Repository Structure

.
├── setup.sh                         # 1-Click host environment & toolchain setup
├── check-environment.sh             # Validates host build dependencies
├── build.sh                         # Main build orchestrator
├── clean.sh                         # Safe cleanup utility
├── Makefile                         # Top-level Makefile wrapper
├── versions.env                     # Pinned component versions & source checksums
├── .env.example                     # Environment template
│
├── br2-external/                    # Buildroot External Tree (OPENNGFW)
│   ├── external.desc                # BR2_EXTERNAL descriptor
│   ├── external.mk                  # Package inclusion makefile
│   ├── Config.in                    # Package configuration menu
│   ├── configs/
│   │   ├── r6300v2_defconfig        # Netgear R6300v2 production defconfig
│   │   └── generic_arm_test_defconfig # QEMU ARMv7-A validation defconfig
│   └── board/
│       └── netgear/r6300v2/         # Kernel config, patches, and rootfs overlay
│
├── packages/                        # Standalone Package Management
│   ├── apkg/                        # apkg package manager source (V / C)
│   ├── builder/                     # Package archive packaging tool (build_packages.py)
│   └── repo/                        # Local repository server & index
│
├── scripts/                         # Firmware packing & recovery tools
│   ├── make_netgear_image.py        # Generates OpenWrt-spec TRX & Netgear CHK images
│   ├── fetch-sources.sh             # Downloads & verifies Buildroot LTS tarball
│   └── verify-output.sh             # Static artifact validator
│
├── docs/                            # Documentation
│   ├── architecture.md              # System architecture specification
│   ├── development.md               # Developer guide
│   └── recovery.md                  # CFE bootloader & TFTP recovery guide
│
└── tests/                           # Static syntax & integrity tests
    ├── test-build.sh                # Directory hierarchy & permission tests
    └── test-configs.sh              # Defconfig & kernel configuration validation

📜 License

  • Buildroot: GPL-2.0
  • Linux Kernel: GPL-2.0-only
  • OpenNGFW Configurations & Tools: MIT
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover