Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Specifications: SOC: Atheros AR9344 @ 560MHz RAM: 2x Winbond W9751G6KB-25 (128 MiB) FLASH: Hynix H27U1G8F2BTR (128 MiB) WIFI1: Atheros AR9340 5.0GHz (SoC) WIFI2: Atheros AR9280 2.4GHz SWITCH: Atheros AR8236 (5x Gigabit (1x WAN, 4x LAN) LED: 1x Power-LED, 1 x RGB Tricolor-LED INPUT: One Reset Button USB: One USB 2.0 Port UART: JP1 on PCB (Labeled UART), 3.3v-Level, 115200n8 (GND, TX, RX, VCC - GND is next to the UART silk screen) Flashing Instructions: If your device still has vulnerable firmware, then existing installation instructions can be used. Devices currently running ar17xx firmware can be upgraded directly. If your firmware is too new, there are two options - temporarily adding a SPI-NOR flash to boot initramfs from (recommended) - patching NAND image with initramfs with external programmer (recommended if and only if you have access to 360-clip, or similar device, that doesn't require desoldering a TSOP48 chip)) Since this device is brought over from an old AR71xx, there's already a wiki-page with detailed instructions: <https://openwrt.org/toh/meraki/z1> Installing from SPI-NOR: - Download pre-built image from <https://github.com/Leo-PL/OpenWrt-Meraki-Z1> or assemble your own by splicing router-u-boot <https://github.com/CodeFetch/router-u-boot> image for TP-Link WDR4300 with Z1 initramfs in uImage format. To build uImage initramfsf from source, remove the "KERNEL_INITRAMFS" variable from target/linux/ath79/image/nand.mk for Z1. Put the U-boot image at offset 0, initramfs at offset 131072. - Write the image to an 8MB (or greater) SPI flash - Temporarily bridge - or solder in a 220-ohm resistor between pins 6 and 8 of the SPI-NOR chip to override boot source to SPI - When the initramfs first boots, write the standard initramfs to NAND, to both 'kernel' and 'recovery' partitions $ mtd write /tmp/openwrt-ath79-nand-meraki_z1-initramfs-kernel.bin kernel $ mtd write /tmp/openwrt-ath79-nand-meraki_z1-initramfs-kernel.bin recovery Now you can disconnect the resistor and try to boot the system from NAND. If it works, continue with installation, as described for legacy method using vulnerable stock firmware. - When done, you can remove SPI-NOR chip and the resistor altogether, it can be reused to perform installation on other devices, or act as a recovery boot source if needed, if the recovery initramfs fails for any reason. Installing by patching NAND - If you'd like to desolder NAND to perform this, I highly advise against it, use SPI-NOR method above instead. - If you have external programmer and a NAND clip, read out the whole chip image, while keeping the device in reset by shorting SRST (pin 11) to ground in JTAG connector, and store a backup in a safe place. - Patch the chip image with initramfs for raw NAND from <https://github.com/Leo-PL/OpenWrt-Meraki-Z1>, by using a script there, or manually: $ dd if=openwrt-ath79-nand-meraki_z1-initramfs-kernel-rawnand.bin of=z1_dump.img bs=135168 seek=1 conv=notrunc $ dd if=openwrt-ath79-nand-meraki_z1-initramfs-kernel-rawnand.bin of=z1_dump.img bs=135168 seek=65 conv=notrunc This will write the initramfs to both kernel and recovery partitions, which is highly recommended, as due to device architecture it is notoriously hard to unbrick. - Write the image back to the NAND, again, keeping the CPU in the reset. - When the unit boots to initramfs, proceed as per existing instructions for volnerable firmware. Legacy installation on vulnerable stock firmware: The gist: 1. Get a root-shell on the device (see wiki). (needs UART access) 2. make a backup (to a PC/safe location) of the existing Meraki firmware. 3. copy over the OpenWrt initramfs kernel for the Z1. This gets written into the kernel NAND partition. (Verify that written image is complete!) After the following reboot and successfull boot of the staging OpenWrt initramfs image: 4. Free up space by removing Meraki firmware partitions from UBI volume to free up space for OpenWrt (example given for the latest wired-14 version): $ ubirmvol -N storage /dev/ubi0 $ ubirmvol -N rootfs-wired-14-202005181203-G201ba9ed-rel-gazebo-1 /dev/ubi0 $ ubirmvol -N rootfs-wired-14-202005181203-G201ba9ed-rel-gazebo-2 /dev/ubi0 4. copy over the sysupgrade.bin for the router and use sysupgrade to make the installation permanent. Notable changes from ar71xx support: - LED colors are now different, because nu801 userspace driver is used for the RGB LED. Acknowledgments: - Hal Martin, for providing additional devices for research, including one modded for SPI boot and with removable NAND - Christian Lamparter for initial device tree and image configuration Signed-off-by: Christian Lamparter <[email protected]> [Finished support, updated commit message with new installation methods] Signed-off-by: Lech Perczak <[email protected]>
- Loading branch information