Uboot Unlock
Tip
It is safer to use the OpenWrt/Initramfs method since there is no risk of the device rebooting on you.
OpenWrt/Initramfs method
-
Check MTD layout:
cat /proc/mtdShould show
mtd0: 02000000 00010000 "spi0.0"(32MB flash) -
Verify current bytes:
dd if=/dev/mtd0 bs=1 skip=$((0x105050)) count=4 2>/dev/null | hexdump -CExpected:
00000000 01 00 a0 13(unpatched) -
Read entire flash:
dd if=/dev/mtd0 of=/tmp/flash.bin bs=1M -
Create backup:
cp /tmp/flash.bin /tmp/flash_backup.bin -
Apply patch:
printf '\x00\x00\xa0\xe3' | dd of=/tmp/flash.bin bs=1 seek=$((0x105050)) conv=notrunc 2>/dev/null -
Verify patch in file:
dd if=/tmp/flash.bin bs=1 skip=$((0x105050)) count=4 2>/dev/null | hexdump -CShould show:
00000000 00 00 a0 e3 -
Write to flash:
mtd write /tmp/flash.bin /dev/mtd0Takes 1-2 minutes. Wait for completion.
-
Verify patch in flash:
dd if=/dev/mtd0 bs=1 skip=$((0x105050)) count=4 2>/dev/null | hexdump -CShould show:
00000000 00 00 a0 e3 -
Reboot:
reboot -
Test:
- Watch for
Hit any key to stop autoboot: 3 2 1 - Press any key
- Should get U-Boot prompt
- Watch for
uBoot shell method
Warning
The hardware watchdog will reboot the device every 5 minutes if it isn’t pinged. Execute these commands quickly to avoid the device rebooting in the middle of the process.
Read entire 64KB sector containing patch (offset 0x100000)
sf probe && sf read 0x84000000 0x100000 0x10000 Patch the 4 bytes at offset 0x5050 within the sector
mw 0x84005050 0xe3a00000 Verify patch in memory
md 0x84005050 1 Erase sector (64KB at 0x100000)
sf erase 0x100000 0x10000 Write patched sector back
sf write 0x84000000 0x100000 0x10000 Verify in flash
sf read 0x85000000 0x105050 0x4 && md 0x85000000 1 SPI dump method
If you have the firmware dump and can flash it externally:
cp firmware_dump.bin patched_firmware_dump.bin
printf '\x00\x00\xa0\xe3' | dd of=patched_firmware_dump.bin bs=1 seek=$((0x105050)) conv=notruncVerify
dd if=patched_firmware_dump.bin bs=1 skip=$((0x105050)) count=4 2>/dev/null | hexdump -CFlash to device using JTAG/SPI programmer