Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
toh:d-link:dir-300 [2019/02/12 21:39] – 432 warning added tmomastoh:d-link:dir-300 [2019/11/23 05:46] – [Original Firmware flash layout] sefralgon
Line 26: Line 26:
  
 ===== First Time Installation... ===== ===== First Time Installation... =====
 +
 +Before you install, you might need to back up the original firmware. It can be done in multiple ways, including but not limited to using UART and/or Telnet. The most important partition is Board/RadioCfg, which is physically located at last 64KiB of flash chip.
 +
 +==== Original Firmware flash layout ====
 +<code>
 +# cat /proc/mtd
 +dev: size erasesize name
 +mtd0: 00400000 00010000 "spiflash"
 +mtd1: 001ce000 00010000 "rootfs"
 +mtd2: 003b0000 00010000 "upgrade"
 +mtd3: 00010000 00010000 "rgdb"
 +mtd4: 00020000 00010000 "RedBoot"
 +mtd5: 00010000 00010000 "Board/RadioCfg"
 +mtd6: 00010000 00010000 "LangPack"
 +mtd7: 00400000 00010000 "flash"
 +</code>
 +
 +Partition sizes correspond to DIR-300 v1.05_a319 firmware. While upgrade partition has multiple sections, only ''rootfs'' has got its own mtd device file. 
 +
 +^ Layer0    raw flash, **mtd0** and **mtd7**, 4096 KiB  |||||||
 +^ Layer1    **mtd4** \\ ''RedBoot'' \\ 128 KiB  |  **mtd2** \\ ''upgrade'' \\ 3776 KiB  |||||  **mtd6** \\ ''LangPack'' \\ 64 KiB  |  **mtd3** \\ ''rgdb'' \\ 64 KiB  |  **mtd5** \\ ''Board/RadioCfg'' \\ 64 KiB  |
 +^ Layer2   |::: **No device** \\ ''kernel'' \\ 512 KiB  |  PackImg \\ header \\ 32B  |  **mtd1** \\ ''rootfs'' \\ 1848 KiB  |  empty \\ space \\ 8160B  | **No device** \\ ''data'' \\ 1408 KiB |:::|:::|:::|
 +
 +When original firmware is flashed onto the router, first 96B are stripped, since it's a header of some kind. The rest of it is written directly to ''upgrade'' partition. Knowing this allows restoring original firmware from an alternative firmware, such as OpenWrt. A command such as ''tail -c +97 dir300a.bin > upgrade.bin'' allows to prepare file suitable for writing directly onto mtd partition.
 +
 +The data on the end of upgrade partition is likely remaining from past installation of some alt firmware and not used for anything.
 +
 ==== Flash Layout ==== ==== Flash Layout ====
 First let's have a quick view at the [[docs:techref:flash.layout|Flash Layout]] with the stock firmware and once OpenWrt has been installed onto the device. This helper understanding what mtd/sysupgrade does.\\ First let's have a quick view at the [[docs:techref:flash.layout|Flash Layout]] with the stock firmware and once OpenWrt has been installed onto the device. This helper understanding what mtd/sysupgrade does.\\
  • Last modified: 2024/02/12 08:58
  • by 127.0.0.1