diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..4edd5ac --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.bin filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore index 9361608..39b5561 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ openwrt-imagebuilder* -bin/ +mt7620 sha256sum* diff --git a/README.md b/README.md index dcc627f..d13a0d5 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,28 @@ # OpenWRT for TP-Link MR200v1 -Turn on the device while pushing the WPS button until the WPS light turns -on. At that point, the bootloaders integrated tftp client with the ip -address of 192.168.1.1, tries to connect to a tftp server running at -address 192.168.0.66 and getting the file named ArcherC2V1_tp_recovery.bin. -so you need to be running a tftp server with the ip/netmask of -192.168.0.66/23 and connect it to lan port1. It is vital that your firmware -includes the bootloader at the very beginning (without any extra tp-link -header) as the bootloader will start writing the firmware to flash with the -starting address of 0x00000000. +**Follow all steps at own risk!** + +Before downloading anything, consider reading the blog post: + + + +## Recovery image preparation + +The recovery image is used to replace the stock firmware with OpenWRT via +TFTP. Citing the MR200 OpenWRT +[manual](https://openwrt.org/toh/tp-link/archer-mr200): + +> Turn on the device while pushing the WPS button until the WPS light turns +> on. At that point, the bootloaders integrated tftp client with the ip +> address of 192.168.1.1, tries to connect to a tftp server running at +> address 192.168.0.66 and getting the file named +> **ArcherC2V1_tp_recovery.bin**. so you need to be running a tftp server +> with the ip/netmask of 192.168.0.66/23 and connect it to lan port1. It is +> vital that your firmware includes the bootloader at the very beginning +> (without any extra tp-link header) as the bootloader will start writing +> the firmware to flash with the starting address of 0x00000000. + +Manual recovery image preparation: ```bash cd firmware @@ -16,8 +30,18 @@ dd bs=512 obs=512 skip=1 count=256 if=Archer\ MR200v1_0.9.1_1.2_up_boot_v004a.0\ cat ArcherMR200_bootloader.bin openwrt-19.07.6-ramips-mt7620-ArcherMR200-squashfs-sysupgrade.bin > ArcherC2V1_tp_recovery.bin ``` -More at MR200 OpenWRT -[manual](https://openwrt.org/toh/tp-link/archer-mr200). +Manual recovery image upload using TFTP: + +```bash +sudo pacman -S atftp +sudo mkdir -p /srv/atftp +sudo cp firmware/ArcherC2V1_tp_recovery.bin /srv/atftp +sudo chown -R atftp:atftp /srv/atftp +sudo ifconfig enp0s31f6 192.168.0.66/23 +sudo systemctl start atftpd.service +# Optionally test TFTP server is working properly +#curl -O tftp:/192.168.0.66/ArcherC2V1_tp_recovery.bin +``` ## Revert to TP-Link stock firmware @@ -29,7 +53,7 @@ cd firmware dd bs=512 obs=512 skip=257 count=15744 if=Archer\ MR200v1_0.9.1_1.2_up_boot_v004a.0\ Build\ 180502\ Rel.53881n.bin of=extracted_firmware.bin scp extracted_firmware.bin root@openwrt:/tmp /usr/bin/ssh root@openwrt -mtd -r write stock.bin firmware +mtd -r write extracted_firmware.bin firmware ``` ## 4G signal LED integration @@ -48,6 +72,8 @@ reboot ## Custom image with built in LED signal integration +Manual custom image build steps: + ```bash pacman -S --needed base-devel ncurses zlib gawk git gettext openssl libxslt wget unzip python wget https://downloads.openwrt.org/snapshots/targets/ramips/mt7620/openwrt-imagebuilder-ramips-mt7620.Linux-x86_64.tar.xz @@ -57,11 +83,12 @@ ln -s ../files . make image PROFILE=tplink_archer-mr200 PACKAGES="curl" FILES=files/ ``` -The sysupgrade -[file](./openwrt-imagebuilder-ramips-mt7620.Linux-x86_64/bin/targets/ramips/mt7620/openwrt-ramips-mt7620-tplink_archer-mr200-squashfs-sysupgrade.bin) -is available at +The sysupgrade file is available at `openwrt-imagebuilder-ramips-mt7620.Linux-x86_64/bin/targets/ramips/mt7620/openwrt-ramips-mt7620-tplink_archer-mr200-squashfs-sysupgrade.bin` -and includes `curl` and the LED script. +after the build and includes `curl` and the LED script. + +Alternatively, the steps are automated in a [build.sh](./build.sh) script. +After running, the custom image file is conveniently symlinked to `mt7620`. ## Credit diff --git a/build.sh b/build.sh index 0791d6b..ec30474 100755 --- a/build.sh +++ b/build.sh @@ -5,7 +5,6 @@ dlUrl="https://downloads.openwrt.org/snapshots/targets/ramips/mt7620" folderName="openwrt-imagebuilder-ramips-mt7620.Linux-x86_64" sumsFile="sha256sums" ascFile="$sumsFile.asc" -outDir="bin" sudo pacman -q -S --needed base-devel ncurses zlib gawk git gettext openssl libxslt wget unzip python gnupg @@ -43,11 +42,11 @@ else tar xJf "$archive" fi -mkdir -p "$outDir" cd "$folderName" ln -s ../files . make image PROFILE=tplink_archer-mr200 PACKAGES="curl" FILES=files/ -cp ./bin/targets/ramips/mt7620/openwrt-ramips-mt7620-tplink_archer-mr200-squashfs-sysupgrade.bin "../$outDir/ArcherC2V1_tp_recovery.bin" +cd .. +ln -s "$folderName/bin/targets/ramips/mt7620/" . diff --git a/firmware/Archer MR200v1_0.9.1_1.2_up_boot_v004a.0 Build 180502 Rel.53881n.bin b/firmware/Archer MR200v1_0.9.1_1.2_up_boot_v004a.0 Build 180502 Rel.53881n.bin index 316e38e..5825d8f 100644 Binary files a/firmware/Archer MR200v1_0.9.1_1.2_up_boot_v004a.0 Build 180502 Rel.53881n.bin and b/firmware/Archer MR200v1_0.9.1_1.2_up_boot_v004a.0 Build 180502 Rel.53881n.bin differ diff --git a/firmware/ArcherC2V1_tp_recovery.bin b/firmware/ArcherC2V1_tp_recovery.bin index 2b736e2..c39d86a 100644 Binary files a/firmware/ArcherC2V1_tp_recovery.bin and b/firmware/ArcherC2V1_tp_recovery.bin differ diff --git a/firmware/ArcherMR200_bootloader.bin b/firmware/ArcherMR200_bootloader.bin index 1158638..019c249 100644 Binary files a/firmware/ArcherMR200_bootloader.bin and b/firmware/ArcherMR200_bootloader.bin differ diff --git a/firmware/README.md b/firmware/README.md new file mode 100644 index 0000000..097fd44 --- /dev/null +++ b/firmware/README.md @@ -0,0 +1,9 @@ +# Firmware + +The file +`Archer MR200v1_0.9.1_1.2_up_boot_v004a.0 Build 180502 Rel.53881n.bin` is +the firmware used in the process and is used during build and stored here +in case that reverting bac kto stock is required. + +Other files here are stored for achiving purpose - all the files are +created against the OpenWRT version of `v19.07.6`. diff --git a/firmware/extracted_firmware.bin b/firmware/extracted_firmware.bin index 1462425..fb95dc3 100644 Binary files a/firmware/extracted_firmware.bin and b/firmware/extracted_firmware.bin differ diff --git a/firmware/openwrt-19.07.6-ramips-mt7620-ArcherMR200-squashfs-sysupgrade.bin b/firmware/openwrt-19.07.6-ramips-mt7620-ArcherMR200-squashfs-sysupgrade.bin index f22d89c..e08f152 100644 Binary files a/firmware/openwrt-19.07.6-ramips-mt7620-ArcherMR200-squashfs-sysupgrade.bin and b/firmware/openwrt-19.07.6-ramips-mt7620-ArcherMR200-squashfs-sysupgrade.bin differ diff --git a/prepare.sh b/prepare.sh new file mode 100644 index 0000000..d414edd --- /dev/null +++ b/prepare.sh @@ -0,0 +1,20 @@ +#/bin/bash + +sysupgradeUrl="http://downloads.openwrt.org/releases/19.07.7/targets/ramips/mt7620" +sysupgradeFile="openwrt-19.07.7-ramips-mt7620-ArcherMR200-squashfs-sysupgrade.bin" +bootloaderFile="ArcherMR200_bootloader.bin" +recoveryFile="ArcherC2V1_tp_recovery.bin" + +dd bs=512 obs=512 skip=1 count=256 if=Archer\ MR200v1_0.9.1_1.2_up_boot_v004a.0\ Build\ 180502\ Rel.53881n.bin of="$bootloaderFile" +cat "$bootloaderFile" "$sysupgradeFile" > "$recoveryFile" + +atftpDir="/srv/atftp" +sudo pacman -S atftp +sudo mkdir -p "$atftpDir" +sudo cp "$recoveryFile" "$atftpDir" +sudo chown -R atftp:atftp "$atftpDir" +sudo ifconfig enp0s31f6 192.168.0.66/23 +sudo systemctl start atftpd.service + +echo "Now connect the MR200 router via LAN1 and restart it while holding WPS button." +