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 [2018/08/30 13:10] kofectoh:d-link:dir-300 [2019/11/23 05:46] – [Original Firmware flash layout] sefralgon
Line 1: Line 1:
 ====== D-Link DIR-300 Rev.A1 (Airlink AR335W/AR430W) ====== ====== D-Link DIR-300 Rev.A1 (Airlink AR335W/AR430W) ======
 +
 +{{section>meta:infobox:432_warning#infobox_for_dataentries&noheader&nofooter&noeditbutton}}
 +
 |:!: Note: For D-Link DIR-300 Rev.B (other hardware (HW), please see **[[toh:d-link:dir-300revb|D-Link DIR-300 Rev.B]]**.| |:!: Note: For D-Link DIR-300 Rev.B (other hardware (HW), please see **[[toh:d-link:dir-300revb|D-Link DIR-300 Rev.B]]**.|
  
Line 23: 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.\\
Line 273: Line 303:
 openwrt-ath25-generic-squashfs-rootfs.bin openwrt-ath25-generic-squashfs-rootfs.bin
 </code> </code>
 +Connect to telnet to 192.168.1.10 port 9000
 <code> <code>
 fis init fis init
Line 280: Line 311:
 load -r -b %{FREEMEMLO} openwrt-ath25-generic-squashfs-rootfs.bin load -r -b %{FREEMEMLO} openwrt-ath25-generic-squashfs-rootfs.bin
 fis create rootfs fis create rootfs
-</code> 
-If your router have already had DD-WRT installed, there will be a chance that the existing bootloader is MicroRedboot. In that case, the router boots rather fast, you cannot telnet to 192.168.1.1 9000 at start up. You will have to use Reset button to access Redboot. See http://www.dd-wrt.com/wiki/index.php/Micro_Redboot for more detail. 
- 
-If you have already followed this guide and your router is running OpenWrt, but because of some reason you still want to reflash using the bootloader you can access Redboot after 10-11 seconds from powering the device up with the following command: 
- 
-<code> 
-telnet 192.168.1.10 9000 
 </code> </code>
 ==== via Bootloader ==== ==== via Bootloader ====
Line 462: Line 486:
 ==== SD-card slot mod ==== ==== SD-card slot mod ====
 There is a working mod to add a SD-card slot to your DIR-300. Follow the instructions [[http://tinyhack.com/2010/04/04/d-link-dir-300-serial-port-and-sd-mod/|here.]] There is a working mod to add a SD-card slot to your DIR-300. Follow the instructions [[http://tinyhack.com/2010/04/04/d-link-dir-300-serial-port-and-sd-mod/|here.]]
 +==== OpenWrt bootlog ==== 
 +<WRAP bootlog> 
 +<nowiki> 
 +[    0.000000] Linux version 4.14.67 (kofec@E5420Mint) (gcc version 7.3.0 (OpenWrt GCC 7.3.0 r7981-a6e11ccb13)) #0 Wed Aug 29 19:00:58 2018 
 +[    0.000000] bootconsole [early0] enabled 
 +[    0.000000] CPU0 revision is: 00019064 (MIPS 4KEc) 
 +[    0.000000] Determined physical RAM map: 
 +[    0.000000]  memory: 01000000 @ 00000000 (usable) 
 +[    0.000000] Initrd not found or empty - disabling initrd 
 +[    0.000000] Primary instruction cache 16kB, VIPT, 4-way, linesize 16 bytes. 
 +[    0.000000] Primary data cache 16kB, 4-way, VIPT, no aliases, linesize 16 bytes 
 +[    0.000000] Zone ranges: 
 +[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000000ffffff] 
 +[    0.000000] Movable zone start for each node 
 +[    0.000000] Early memory node ranges 
 +[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000000ffffff] 
 +[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000000ffffff] 
 +[    0.000000] On node 0 totalpages: 4096 
 +[    0.000000] free_area_init_node: node 0, pgdat 8039ed20, node_mem_map 80403020 
 +[    0.000000]   Normal zone: 32 pages used for memmap 
 +[    0.000000]   Normal zone: 0 pages reserved 
 +[    0.000000]   Normal zone: 4096 pages, LIFO batch:0 
 +[    0.000000] random: get_random_bytes called from 0x803a2724 with crng_init=0 
 +[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768 
 +[    0.000000] pcpu-alloc: [0] 0  
 +[    0.000000] Built 1 zonelists, mobility grouping off.  Total pages: 4064 
 +[    0.000000] Kernel command line: console=ttyS0,9600 rootfstype=squashfs,jffs2 
 +[    0.000000] PID hash table entries: 64 (order: -4, 256 bytes) 
 +[    0.000000] Dentry cache hash table entries: 2048 (order: 1, 8192 bytes) 
 +[    0.000000] Inode-cache hash table entries: 1024 (order: 0, 4096 bytes) 
 +[    0.000000] Memory: 12076K/16384K available (2952K kernel code, 137K rwdata, 364K rodata, 184K init, 198K bss, 4308K reserved, 0K cma-reserved) 
 +[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1 
 +[    0.000000] NR_IRQS: 128 
 +[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 20774570075 ns 
 +[    0.000044] sched_clock: 32 bits at 92MHz, resolution 10ns, wraps every 23342213114ns 
 +[    0.093925] Calibrating delay loop... 183.70 BogoMIPS (lpj=918528) 
 +[    0.247254] pid_max: default: 32768 minimum: 301 
 +[    0.303331] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes) 
 +[    0.381815] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes) 
 +[    0.478520] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns 
 +[    0.595452] futex hash table entries: 256 (order: -1, 3072 bytes) 
 +[    0.670236] NET: Registered protocol family 16 
 +[    0.725362] Can't analyze schedule() prologue at 8031ebb8 
 +[    0.874847] clocksource: Switched to clocksource MIPS 
 +[    0.941291] NET: Registered protocol family 2 
 +[    0.996916] TCP established hash table entries: 1024 (order: 0, 4096 bytes) 
 +[    1.079706] TCP bind hash table entries: 1024 (order: 0, 4096 bytes) 
 +[    1.155501] TCP: Hash tables configured (established 1024 bind 1024) 
 +[    1.232162] UDP hash table entries: 256 (order: 0, 4096 bytes) 
 +[    1.301397] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes) 
 +[    1.377303] NET: Registered protocol family 1 
 +[    1.429005] PCI: CLS 0 bytes, default 16 
 +[    1.459740] Radio config found at offset 0xf8 (0x1f8) 
 +[    1.549079] Crashlog allocated RAM at address 0xf00000 
 +[    1.630362] workingset: timestamp_bits=30 max_order=12 bucket_order=0 
 +[    1.739465] squashfs: version 4.0 (2009/01/31) Phillip Lougher 
 +[    1.808609] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc. 
 +[    1.992085] io scheduler noop registered 
 +[    2.038321] io scheduler deadline registered (default) 
 +[    2.100486] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled 
 +[    2.196960] serial8250: ttyS0 at MMIO 0x11100000 (irq = 9, base_baud = 5750000) is a 16550A 
 +[    2.296346] console [ttyS0] enabled 
 +[    2.379633] bootconsole [early0] disabled 
 +[    2.480695] ar2315-spiflash ar2315-spiflash.0: 4096 Kbytes flash detected 
 +[    2.575388] Searching for RedBoot partition table in spiflash at offset 0x3d0000 
 +[    3.039138] Searching for RedBoot partition table in spiflash at offset 0x3e0000 
 +[    3.502859] 6 RedBoot partitions found on MTD device spiflash 
 +[    3.572014] Creating 6 MTD partitions on "spiflash": 
 +[    3.631853] 0x000000000000-0x000000030000 : "RedBoot" 
 +[    3.704474] 0x000000030000-0x000000160000 : "vmlinux.bin.l7" 
 +[    3.784163] 0x000000160000-0x0000003e0000 : "rootfs" 
 +[    3.849281] mtd: device 2 (rootfs) set to be root filesystem 
 +[    3.917851] 1 squashfs-split partitions found on MTD device rootfs 
 +[    3.992372] 0x0000002d0000-0x0000003e0000 : "rootfs_data" 
 +[    4.074338] 0x0000003e0000-0x0000003ef000 : "FIS directory" 
 +[    4.152968] 0x0000003ef000-0x0000003f0000 : "RedBoot config" 
 +[    4.232712] 0x0000003f0000-0x000000400000 : "boardconfig" 
 +[    4.376558] eth0: Atheros AR231x: 00:1e:58:85:6f:8e, irq 4 
 +[    4.519858] IP17xx: Found IP175C at 0:00 
 +[    4.688305] libphy: ar231x_eth_mii: probed 
 +[    4.906966] eth0: attached PHY driver [IC+ IP17xx] (mii_bus:phy_addr=0:00) 
 +[    4.996733] NET: Registered protocol family 17 
 +[    5.050827] 8021q: 802.1Q VLAN Support v1.8 
 +[    5.158519] VFS: Mounted root (squashfs filesystem) readonly on device 31:2. 
 +[    5.245421] Freeing unused kernel memory: 184K 
 +[    5.298969] This architecture does not have kernel memory protection. 
 +[    5.694951] random: fast init done 
 +[    8.640944] init: Console is alive 
 +[    8.683616] init: - watchdog - 
 +[   11.214585] kmodloader: loading kernel modules from /etc/modules-boot.d/
 +[   11.470643] kmodloader: done loading kernel modules from /etc/modules-boot.d/
 +[   11.569761] init: - preinit - 
 +[   15.415089] eth0: link up (100Mbps/full duplex) 
 +[   17.957847] mount_root: jffs2 not ready yet, using temporary tmpfs overlay 
 +[   18.098917] urandom-seed: Seed file not found (/etc/urandom.seed) 
 +[   18.544184] procd: - early - 
 +[   18.580065] procd: - watchdog - 
 +[   19.630296] procd: - watchdog - 
 +[   19.671190] procd: - ubus - 
 +[   19.946288] random: ubusd: uninitialized urandom read (4 bytes read) 
 +[   20.025809] random: ubusd: uninitialized urandom read (4 bytes read) 
 +[   20.102960] random: ubusd: uninitialized urandom read (4 bytes read) 
 +[   20.188693] procd: - init - 
 +[   21.166424] kmodloader: loading kernel modules from /etc/modules.d/
 +[   21.251507] Loading modules backported from Linux version wt-2017-11-01-0-gfe248fc2c180 
 +[   21.347929] Backport generated by backports.git v4.14-rc2-1-31-g86cf0e5d 
 +[   22.287420] ath: EEPROM regdomain: 0x0 
 +[   22.287470] ath: EEPROM indicates default country code should be used 
 +[   22.287484] ath: doing EEPROM country->regdmn map search 
 +[   22.287530] ath: country maps to regdmn code: 0x3a 
 +[   22.287553] ath: Country alpha2 being used: US 
 +[   22.287568] ath: Regpair used: 0x3a 
 +[   22.290628] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht' 
 +[   22.297900] ath5k: phy0: Atheros AR2317 chip found (MAC: 0x90, PHY: 0x48) 
 +[   22.496682] kmodloader: done loading kernel modules from /etc/modules.d/
 +[   24.792537] urandom_read: 4 callbacks suppressed 
 +[   24.792579] random: jshn: uninitialized urandom read (4 bytes read) 
 +[   25.144620] random: jshn: uninitialized urandom read (4 bytes read) 
 +[   26.378829] random: jshn: uninitialized urandom read (4 bytes read) 
 +[   43.626312] jffs2_scan_eraseblock(): End of filesystem marker found at 0x0 
 +[   44.015184] jffs2_build_filesystem(): unlocking the mtd device...  
 +[   44.015243] done. 
 +[   44.112911] jffs2_build_filesystem(): erasing all blocks after the end marker...  
 +[   59.213539] eth0: link up (100Mbps/full duplex) 
 +[   59.431960] br-lan: port 1(eth0.1) entered blocking state 
 +[   59.497131] br-lan: port 1(eth0.1) entered disabled state 
 +[   59.563771] device eth0.1 entered promiscuous mode 
 +[   59.621607] device eth0 entered promiscuous mode 
 +[   60.637489] br-lan: port 1(eth0.1) entered blocking state 
 +[   60.702589] br-lan: port 1(eth0.1) entered forwarding state 
 +[   67.826211] done. 
 +[   67.849791] jffs2: notice: (650) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found. 
 +[   70.107830] overlayfs: upper fs does not support tmpfile. 
 +[  137.135206] random: crng init done 
 +</nowiki> 
 +</WRAP>\\
  
 ===== Tags ===== ===== Tags =====
 [[meta:tags|How to add tags]] [[meta:tags|How to add tags]]
 {{tag>AR2317 FastEthernet 1NIC 1WNIC 5Port JTAG 802.11bg 1Ant DetachableAntenna 16RAM 4Flash MIPS MIPS32 4KEc}} {{tag>AR2317 FastEthernet 1NIC 1WNIC 5Port JTAG 802.11bg 1Ant DetachableAntenna 16RAM 4Flash MIPS MIPS32 4KEc}}
  • Last modified: 2024/02/12 08:58
  • by 127.0.0.1