Восстановление заводской прошивки Beeline SmartBox GIGA
inflabzВнимание! статья тестовая, работоспособность проверялась на роутере без бэдблоков на NAND-флешке. За убиенные роутеры автор ответственности не несет!
Необходим бэкап только со своего роутера, который делали при прошивке роутера Beeline SmartBox GIGA в OpenWrt
Скачиваем nginx с https://nginx.org/ru/download.html
Распаковываем архив в C:\nginx\
В порт LAN1 роутера подключить компьютер (скорость UART 115200, если используете терминал)
Зажать на роутере Reset 5-10 сек. и подключить питание к роутеру.
В браузере (в режиме инкогнито) открываем http://192.168.1.1/index.html и проверяем вход в Breed
Запускаем PuTTY
IP 192.168.1.1
Telnet, порт 23
и подключаемся к Breed:
Breed for Beeline SmartBox GIGA
Starting breed built-in shell
breed>
Запускаем nginx из C:\nginx\nginx.exe
Смотрим в сетевых подключениях IP-адрес компьютера (обычно Breed выдает 192.168.1.2 или 192.168.1.3 и т.п.)
Проверяем работу nginx открыв в браузере этот адрес
В директорию c:\nginx\html\ помещаем файлы бэкап вашего роутера (директория mtd_backup) и файл beeline_smartbox-giga-initramfs-kernel.bin (это специальная сборка для восстановления, из обычной сборки НЕ подойдёт!!!)
md5 4d1615d48c9196fd7904c157f0b3c118
В консоли Breed набираем команды:
wget http://192.168.1.2/beeline_smartbox-giga-initramfs-kernel.bin
boot mem 0x80001000
Вывод будет примерно таким:
breed> wget http://192.168.1.2/beeline_smartbox-giga-initramfs-kernel.bin; boot mem 0x80001000
Connecting to 192.168.1.2:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8287722/0x7e75ea (7MB) [application/octet-stream]
Saving to address 0x80001000
[==========================================] 100%
Transmission completed in 1.0s.
Trying to boot firmware from 0x80001000 ...
U-Boot firmware image header detected.
Image Name: MIPS OpenWrt Linux-5.4.99
Data Size: 8287658 Bytes
Load Address: 80001000
Entry Point: 80001000
Произойдёт разрыв соединения TELNET (в UART вывод информации, естественно продолжится)
Заморгает синий светодиод, затем будет светить зеленый светодиод и ПК получит IP-адрес (если этого не произошло, перезагружаем роутер и повторяем попытку)
Запускаем PuTTY
IP 192.168.1.1
SSH, порт 22
и подключаемся к OpenWrt и в SSH консоли набираем команды:
cd /tmp
for i in 1 2 3 4 5 6 7 8; do wget http://192.168.1.2/mtd_backup/mtd$i; done
mtd write /tmp/mtd1 "dynamic partition map"
mtd write /tmp/mtd2 "Factory"
mtd write /tmp/mtd3 "Boot Flag"
mtd write /tmp/mtd4 "Kernel 1"
mtd write /tmp/mtd5 "Kernel 2"
mtd write /tmp/mtd6 "File System 1"
mtd write /tmp/mtd7 "File System 2"
mtd write /tmp/mtd8 "Configuration/log"
dd if=/tmp/mtd3 bs=9 count=1
запоминаем/записываем вывод этой команды, это нам понадобится позже
rm -rf mtd*
for i in 9 10 11; do wget http://192.168.1.2/mtd_backup/mtd$i; done
mtd write /tmp/mtd9 "application tmp buffer (Ftool)"
mtd write /tmp/mtd10 "container"
mtd write /tmp/mtd11 "bad block reserved"
Вывод будет примерно таким:
BusyBox v1.33.0 () built-in shell (ash)
OpenWrt 21.02-SNAPSHOT, r15877-7e1ab3b746
=== WARNING! ===================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------
root@OpenWrt:~# cd /tmp
root@OpenWrt:/tmp# for i in 1 2 3 4 5 6 7 8; do wget http://192.168.1.2/mtd_backup/mtd$i; done
Downloading 'http://192.168.1.2/mtd_backup/mtd1'
Connecting to 192.168.1.2:80
Writing to 'mtd1'
mtd1 100% |*******************************| 1024k 0:00:00 ETA
Download completed (1048576 bytes)
Downloading 'http://192.168.1.2/mtd_backup/mtd2'
Connecting to 192.168.1.2:80
Writing to 'mtd2'
mtd2 100% |*******************************| 1024k 0:00:00 ETA
Download completed (1048576 bytes)
Downloading 'http://192.168.1.2/mtd_backup/mtd3'
Connecting to 192.168.1.2:80
Writing to 'mtd3'
mtd3 100% |*******************************| 1024k 0:00:00 ETA
Download completed (1048576 bytes)
Downloading 'http://192.168.1.2/mtd_backup/mtd4'
Connecting to 192.168.1.2:80
Writing to 'mtd4'
mtd4 100% |*******************************| 6144k 0:00:00 ETA
Download completed (6291456 bytes)
Downloading 'http://192.168.1.2/mtd_backup/mtd5'
Connecting to 192.168.1.2:80
Writing to 'mtd5'
mtd5 100% |*******************************| 6144k 0:00:00 ETA
Download completed (6291456 bytes)
Downloading 'http://192.168.1.2/mtd_backup/mtd6'
Connecting to 192.168.1.2:80
Writing to 'mtd6'
mtd6 100% |*******************************| 24576k 0:00:00 ETA
Download completed (25165824 bytes)
Downloading 'http://192.168.1.2/mtd_backup/mtd7'
Connecting to 192.168.1.2:80
Writing to 'mtd7'
mtd7 100% |*******************************| 24576k 0:00:00 ETA
Download completed (25165824 bytes)
Downloading 'http://192.168.1.2/mtd_backup/mtd8'
Connecting to 192.168.1.2:80
Writing to 'mtd8'
mtd8 100% |*******************************| 8192k 0:00:00 ETA
Download completed (8388608 bytes)
root@OpenWrt:/tmp# mtd write /tmp/mtd1 "dynamic partition map"
Unlocking dynamic partition map ...
Writing from /tmp/mtd1 to dynamic partition map ...
root@OpenWrt:/tmp# mtd write /tmp/mtd2 "Factory"
Unlocking Factory ...
Writing from /tmp/mtd2 to Factory ...
root@OpenWrt:/tmp# mtd write /tmp/mtd3 "Boot Flag"
Unlocking Boot Flag ...
Writing from /tmp/mtd3 to Boot Flag ...
root@OpenWrt:/tmp# mtd write /tmp/mtd4 "Kernel 1"
Unlocking Kernel 1 ...
Writing from /tmp/mtd4 to Kernel 1 ...
root@OpenWrt:/tmp# mtd write /tmp/mtd5 "Kernel 2"
Unlocking Kernel 2 ...
Writing from /tmp/mtd5 to Kernel 2 ...
root@OpenWrt:/tmp# mtd write /tmp/mtd6 "File System 1"
Unlocking File System 1 ...
Writing from /tmp/mtd6 to File System 1 ...
root@OpenWrt:/tmp# mtd write /tmp/mtd7 "File System 2"
Unlocking File System 2 ...
Writing from /tmp/mtd7 to File System 2 ...
root@OpenWrt:/tmp# mtd write /tmp/mtd8 "Configuration/log"
Unlocking Configuration/log ...
Writing from /tmp/mtd8 to Configuration/log ...
root@OpenWrt:/tmp# dd if=/tmp/mtd3 bs=9 count=1
Sercomm0
1+0 records in
1+0 records out
Записать метку Sercomm0 или Sercomm1
root@OpenWrt:/tmp# rm -rf mtd*
root@OpenWrt:/tmp# for i in 9 10 11; do wget http://192.168.1.2/mtd_backup/mtd$i; done
Downloading 'http://192.168.1.2/mtd_backup/mtd9'
Connecting to 192.168.1.2:80
Writing to 'mtd9'
mtd9 100% |*******************************| 12288k 0:00:00 ETA
Download completed (12582912 bytes)
Downloading 'http://192.168.1.2/mtd_backup/mtd10'
Connecting to 192.168.1.2:80
Writing to 'mtd10'
mtd10 100% |*******************************| 40960k 0:00:00 ETA
Download completed (41943040 bytes)
Downloading 'http://192.168.1.2/mtd_backup/mtd11'
Connecting to 192.168.1.2:80
Writing to 'mtd11'
mtd11 100% |*******************************| 3584k 0:00:00 ETA
Download completed (3670016 bytes)
root@OpenWrt:/tmp# mtd write /tmp/mtd9 "application tmp buffer (Ftool)"
Unlocking application tmp buffer (Ftool) ...
Writing from /tmp/mtd9 to application tmp buffer (Ftool) ...
root@OpenWrt:/tmp# mtd write /tmp/mtd10 "container"
Unlocking container ...
Writing from /tmp/mtd10 to container ...
root@OpenWrt:/tmp# mtd write /tmp/mtd11 "bad block reserved"
Unlocking bad block reserved ...
Writing from /tmp/mtd11 to bad block reserved ...
Далее перезагружаем роутер и заходим через TELNET/UART в консоль Breed
Если метка Sercomm0 выполняем команду
boot flash 0x400100
Если Sercomm1, то команду
boot flash 0xA00100
Вывод будет примерно таким:
breed> boot flash 0x400100
Trying to boot firmware from 0x00400100 in flash bank 0 ...
Reading data into memory ...
U-Boot firmware image header detected.
Image Name: Linux Kernel Image
Data Size: 4052152 Bytes
Load Address: 81001000
Entry Point: 816ee7b0
Uncompressing data (LZMA) ...
Произойдёт разрыв соединения TELNET
Ожидаем загрузки оригинальной прошивки
Только если загрузка произошла удачно, то можно восстановить оригинальный загрузчик.
В консоли Breed набираем команды:
wget http://192.168.1.2/mtd0
flash erase 0x0 0x100000
flash write 0x0 0x80001000 1048576 (проверяем размер файла mtd0)
mtd0 - файл с оригинальным загрузчиком