0235186182
The vendor flash layout of the Linksys E8450 is problematic as it uses the SPI-NAND chip without any wear-leveling while at the same time wasting a lot of space for padding. Use an all-UBI layout instead, storing the kernel+dtb+squashfs in uImage.FIT standard format in UBI volume 'fit', the read-write overlay in UBI volume 'rootfs_data' as well as reduntant U-Boot environments 'ubootenv' and 'ubootenv2', and a 'recovery' kernel+dtb+initramfs uImage.FIT for dual-boot. ** WARNING ** THIS PROCEDURE CAN EASILY BRICK YOUR DEVICE PERMANENTLY IF NOT CARRIED OUT VERY CAREFULLY AND EXACTLY AS DESCRIBED! Step 0 * Configure your PC to have the static IPv4 address 192.168.1.254/24 * Provide bin/targets/mediatek/mt7622 via TFTP Now continue EITHER with step 1A or 1B, depending on your preference (and on having serial console wired up or not). Step 1A (Using the vendor web interface (or non-UBI OpenWrt install)) In order to update to the new bootloader and UBI-based firmware, use the web browser of your choice to open the routers web-interface accessible on http://192.168.1.1 * Navigate to 'Configuration' -> 'Administration' -> 'Firmware Upgrade' * Upload the file openwrt-mediatek-mt7622-linksys_e8450-ubi-initramfs-recovery.itb and proceed with the upgrade. * Once OpenWrt comes up, use SCP to upload the new bootloader files to /tmp on the router: *-mt7622-linksys_e8450-ubi-preloader.bin *-mt7622-linksys_e8450-ubi-bl31-uboot.fip * Connect via SSH as you will now need to replace the bootloader in the Flash. ssh root@192.168.1.1 (the usual warnings) * First of all, backup all the flash now: for mtd in /dev/mtdblock*; do dd if=$mtd of=/tmp/$(basename $mtd); done * Then use SCP to copy /tmp/mtdblock* from the router and keep them safe. You will need them should you ever want to return to the factory firmware! * Now flow the uploaded files: mtd -e /dev/mtd0 write /tmp/*linksys_e8450-ubi-preloader.bin /dev/mtd0 mtd -e /dev/mtd1 write /tmp/*linksys_e8450-ubi-bl31-uboot.fip /dev/mtd1 If and only if both writes look like the completed successfully reboot the router. Now continue with step 2. Step 1B (Using the vendor bootloader serial console) * Use the serial to backup all /dev/mtd* devices before using the stock firmware (you got root shell when connected to serial). * Then reboot and select 'U-Boot Console' in the boot menu. * Copy the following lines, one by one: tftpboot 0x40080000 openwrt-mediatek-mt7622-linksys_e8450-ubi-preloader.bin tftpboot 0x40100000 openwrt-mediatek-mt7622-linksys_e8450-ubi-bl31-uboot.fip nand erase 0x0 0x180000 nand write 0x40080000 0x0 0x180000 reset Now continue with step 2 Step 2 Once the new bootchain comes up, the loader will initialize UBI and the ubootenv volumes. It will then of course fail to find any bootable volume and hence resort to load kernel via TFTP from server 192.168.1.254 while giving itself the address 192.168.1.1 The requested file is called openwrt-mediatek-mt7622-linksys_e8450-ubi-initramfs-recovery.itb and your TFTP server should provide exactly that :) It will be written to UBI as recovery image and booted. You can then continue and flash the production OS image, either by using sysupgrade in the booted initramfs recovery OS, or by using the bootloader menu and TFTP. That's it. Go ahead and mess around with a bootchain built almost completely from source (only DRAM calibration blobs are fitted in bl2, and the irreplacable on-chip ROM loader remains, of course). And enjoy U-Boot built with many great features out-of-the-box. You can access the bootloader environment from within OpenWrt using the 'fw_printenv' and 'fw_setenv' commands. Don't be afraid, once you got the new bootchain installed the device should be fairly unbrickable (holding reset button before and during power-on resets things and allows reflashing recovery image via TFTP) Special thanks to @dvn0 (Devan Carpenter) for providing amazingly fast infra for test-builds, allowing for `make clean ; make -j$(nproc)` in less than two minutes :) Signed-off-by: Daniel Golle <daniel@makrotopia.org>
107 lines
1.7 KiB
Plaintext
107 lines
1.7 KiB
Plaintext
// SPDX-License-Identifier: (GPL-2.0-only OR MIT)
|
|
|
|
/dts-v1/;
|
|
#include "mt7622-linksys-e8450.dtsi"
|
|
|
|
/ {
|
|
model = "Linksys E8450";
|
|
compatible = "linksys,e8450", "mediatek,mt7622";
|
|
|
|
aliases {
|
|
label-mac-device = &wan;
|
|
};
|
|
};
|
|
|
|
&snand {
|
|
mediatek,bmt-v2;
|
|
mediatek,bmt-table-size = <0x1000>;
|
|
|
|
partitions {
|
|
compatible = "fixed-partitions";
|
|
#address-cells = <1>;
|
|
#size-cells = <1>;
|
|
|
|
partition@0 {
|
|
label = "Preloader";
|
|
reg = <0x00000 0x0080000>;
|
|
read-only;
|
|
};
|
|
|
|
partition@80000 {
|
|
label = "ATF";
|
|
reg = <0x80000 0x0040000>;
|
|
};
|
|
|
|
partition@c0000 {
|
|
label = "u-boot";
|
|
reg = <0xc0000 0x0080000>;
|
|
};
|
|
|
|
partition@140000 {
|
|
label = "u-boot-env";
|
|
reg = <0x140000 0x0080000>;
|
|
};
|
|
|
|
factory: partition@1c0000 {
|
|
label = "factory";
|
|
reg = <0x1c0000 0x0100000>;
|
|
};
|
|
|
|
partition@300000 {
|
|
label = "devinfo";
|
|
reg = <0x300000 0x020000>;
|
|
};
|
|
|
|
partition@320000 {
|
|
label = "senv";
|
|
reg = <0x320000 0x020000>;
|
|
};
|
|
|
|
partition@360000 {
|
|
label = "bootseq";
|
|
reg = <0x360000 0x020000>;
|
|
};
|
|
|
|
partition@500000 {
|
|
label = "firmware1";
|
|
compatible = "denx,fit";
|
|
openwrt,cmdline-match = "mtdparts=master";
|
|
reg = <0x500000 0x1E00000>;
|
|
};
|
|
|
|
partition@2300000 {
|
|
label = "firmware2";
|
|
compatible = "denx,fit";
|
|
openwrt,cmdline-match = "mtdparts=slave";
|
|
reg = <0x2300000 0x1E00000>;
|
|
};
|
|
|
|
partition@4100000 {
|
|
label = "data";
|
|
reg = <0x4100000 0x1900000>;
|
|
};
|
|
|
|
partition@5100000 {
|
|
label = "mfg";
|
|
reg = <0x5a00000 0x1400000>;
|
|
};
|
|
};
|
|
};
|
|
|
|
&wmac {
|
|
mediatek,mtd-eeprom = <&factory 0x0000>;
|
|
status = "okay";
|
|
};
|
|
|
|
&wmac1 {
|
|
mediatek,mtd-eeprom = <&factory 0x05000>;
|
|
};
|
|
|
|
&gmac0 {
|
|
mtd-mac-address = <&factory 0x7fff4>;
|
|
};
|
|
|
|
&wan {
|
|
mtd-mac-address = <&factory 0x7fffa>;
|
|
};
|