The stock bootloader stays in place, so U-Boot is packaged as the payload it accepts as a kernel and chainloaded from it. It brings up NAND through NMBM, reads the kernel FIT from flash and applies the device tree overlay matching the media present in the combo port, so a single image serves both the copper PHY and the SFP cage. The media is sensed on pio 23, the cage's mod-def0, which a seated module pulls low. The environment tests it with "if gpio input 23", and that reads as true for a low pin: gpio input returns the pin level as its exit status. The SPI-NAND is driven four-bit. The stock loader, shipped in the vendor SDK as target/linux/mt7981/KN-1012/boot.bin, embeds an FDT whose spi_nand@0 reads spi-max-frequency = <0x3197500>; spi-rx-bus-width = <0x04>; spi-tx-bus-width = <0x04>; on the same spi@1100a000 declaring support_quad, tick_dly = <2> and sample_sel = <0>; MediaTek's own mt7981-rfb device tree carries the identical pair at the identical 52 MHz. Without the two properties spi-uclass defaults the slave to one lane and the SPI-NAND core silently picks the single-bit read variant. The tx width also selects the four-lane program op, which this build reaches only when NMBM has to create its management table; the stock loader programs this part four-bit already. The same build serves the Keenetic and the Netcraze variant of the board. The board support commits add a device profile for each brand, and the two profiles produce differently named images, so the TFTP recovery loop asks for each name in turn: the board has no populated console to correct the name from. A single brand-neutral name was rejected because it would match no built artifact, which breaks the default tftpboot for both variants rather than for one. The U-Boot device tree names the board Keenetic KN-1012 for both: the hardware is the same and the build does not read the brand from flash. The Kconfig entries the build relies on come as separate patches, and both stay local: the NMBM symbols belong to the NMBM code this tree carries, and a MediaTek bool that selects the kernel image header, with the generic text offset base redeclared under it so the defconfig can set it, was declined upstream. U-Boot wants a board there instead, and this board cannot load its OS from upstream U-Boot without NMBM. The kernel image header carries a text_offset of 0x80000: the stock kernel FIT loads at 0x48080000, 0x80000 above the 2 MiB base the loader works from, and the chainloader mirrors that placement. A zero offset, which TEXT_BASE alone would give, has not been tried on this loader. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <f@lex.la> Link: https://github.com/openwrt/openwrt/pull/24820 Signed-off-by: Jonas Jelonek <jonas@jonasjelonek.de>
OpenWrt Project is a Linux operating system targeting embedded devices. Instead of trying to create a single, static firmware, OpenWrt provides a fully writable filesystem with package management. This frees you from the application selection and configuration provided by the vendor and allows you to customize the device through the use of packages to suit any application. For developers, OpenWrt is the framework to build an application without having to build a complete firmware around it; for users this means the ability for full customization, to use the device in ways never envisioned.
Sunshine!
Download
Built firmware images are available for many architectures and come with a package selection to be used as WiFi home router. To quickly find a factory image usable to migrate from a vendor stock firmware to OpenWrt, try the Firmware Selector.
If your device is supported, please follow the Info link to see install instructions or consult the support resources listed below.
An advanced user may require additional or specific package. (Toolchain, SDK, ...) For everything else than simple firmware download, try the wiki download page:
Development
To build your own firmware you need a GNU/Linux, BSD or macOS system (case sensitive filesystem required). Cygwin is unsupported because of the lack of a case sensitive file system.
Requirements
You need the following tools to compile OpenWrt, the package names vary between distributions. A complete list with distribution specific packages is found in the Build System Setup documentation.
binutils bzip2 diff find flex gawk gcc-6+ getopt grep install libc-dev libz-dev
make4.1+ perl python3.8+ rsync subversion unzip which
Quickstart
-
Run
./scripts/feeds update -ato obtain all the latest package definitions defined in feeds.conf / feeds.conf.default -
Run
./scripts/feeds install -ato install symlinks for all obtained packages into package/feeds/ -
Run
make menuconfigto select your preferred configuration for the toolchain, target system & firmware packages. -
Run
maketo build your firmware. This will download all sources, build the cross-compile toolchain and then cross-compile the GNU/Linux kernel & all chosen applications for your target system.
Related Repositories
The main repository uses multiple sub-repositories to manage packages of
different categories. All packages are installed via the OpenWrt package
manager called opkg. If you're looking to develop the web interface or port
packages to OpenWrt, please find the fitting repository below.
-
LuCI Web Interface: Modern and modular interface to control the device via a web browser.
-
OpenWrt Packages: Community repository of ported packages.
-
OpenWrt Routing: Packages specifically focused on (mesh) routing.
-
OpenWrt Video: Packages specifically focused on display servers and clients (Xorg and Wayland).
Support Information
For a list of supported devices see the OpenWrt Hardware Database
Documentation
Support Community
- Forum: For usage, projects, discussions and hardware advise.
- Support Chat: Channel
#openwrton oftc.net.
Developer Community
- Bug Reports: Report bugs in OpenWrt
- Dev Mailing List: Send patches
- Dev Chat: Channel
#openwrt-develon oftc.net.
License
OpenWrt is licensed under GPL-2.0
