1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216 | mtd
Usage: mtd [<options> ...] <command> [<arguments> ...] <device>[:<device>...]
The device is in the format of mtdX (eg: mtd4) or its label.
mtd recognizes these commands:
unlock unlock the device
refresh refresh mtd partition
erase erase all data on device
verify <imagefile>|- verify <imagefile> (use - for stdin) to device
write <imagefile>|- write <imagefile> (use - for stdin) to device
jffs2write <file> append <file> to the jffs2 partition on the device
resetbc <device> reset the uboot boot counter
fixseama fix the checksum in a seama header on first boot
fixwrg fix the checksum in a wrg header on first boot
Following options are available:
-q quiet mode (once: no [w] on writing,
twice: no status messages)
-n write without first erasing the blocks
-r reboot after successful command
-f force write without trx checks
-e <device> erase <device> before executing the command
-d <name> directory for jffs2write, defaults to "tmp"
-j <name> integrate <file> into jffs2 data when writing an image
-s <number> skip the first n bytes when appending data to the jffs2 partiton, defaults to "0"
-p <number> write beginning at partition offset
-l <length> the length of data that we want to dump
-c datasize amount of data to be used for checksum calculation (for fixtrx / fixseama / fixwrg / fixwrgg)
-t <partition> write TP-Link recovery-flag to <partition> (for write)
Example: To write linux.trx to mtd4 labeled as linux and reboot afterwards
mtd -r write linux.trx linux
root@OpenWrt-wt1520:~# cat /proc/mtd
dev: size erasesize name
mtd0: 00030000 00001000 "u-boot"
mtd1: 00010000 00001000 "u-boot-env"
mtd2: 00010000 00001000 "factory"
mtd3: 007b0000 00001000 "firmware"
mtd4: 00156849 00001000 "kernel"
mtd5: 006597b7 00001000 "rootfs"
mtd6: 003c3000 00001000 "rootfs_data"
BusyBox v1.31.1 () built-in shell (ash)
_______ ________ __
| |.-----.-----.-----.| | | |.----.| |_
| - || _ | -__| || | | || _|| _|
|_______|| __|_____|__|__||________||__| |____|
|__| W I R E L E S S F R E E D O M
-----------------------------------------------------
OpenWrt SNAPSHOT, r14553-7dc78d1d28
[11:36:04:364] U-Boot 1.1.3 (Sep 13 2012 - 16:39:43)
[11:36:04:369]
[11:36:04:373] Board: Ralink APSoC DRAM: 32 MB
[11:36:04:378] relocate_code Pointer at: 81fb4000
[11:36:04:385] spi_wait_nsec: 42
[11:36:04:388] spi device id: ef 40 17 0 0 (40170000)
[11:36:04:395] find flash: W25Q64BV
[11:36:04:401] raspi_read: from:30000 len:1000
[11:36:04:408] .*** Warning - bad CRC, using default environment
[11:36:04:421]
[11:36:04:422] ============================================
[11:36:04:430] Ralink UBoot Version: 4.0.1.0
[11:36:04:436] --------------------------------------------
[11:36:04:444] ASIC 5350_MP (Port5<->None)
[11:36:04:449] DRAM_CONF_FROM: Boot-Strapping
[11:36:04:455] DRAM_TYPE: SDRAM
[11:36:04:458] DRAM_SIZE: 256 Mbits
[11:36:04:462] DRAM_WIDTH: 16 bits
[11:36:04:465] DRAM_TOTAL_WIDTH: 16 bits
[11:36:04:470] TOTAL_MEMORY_SIZE: 32 MBytes
[11:36:04:475] Flash component: SPI Flash
[11:36:04:480] Date:Sep 13 2012 Time:16:39:43
[11:36:04:486] ============================================
[11:36:04:494] icache: sets:256, ways:4, linesz:32 ,total:32768
[11:36:04:502] dcache: sets:128, ways:4, linesz:32 ,total:16384
[11:36:04:512]
[11:36:04:512] ##### The CPU freq = 360 MHZ ####
[11:36:04:518] estimate memory size =32 Mbytes
[11:36:04:528]
[11:36:04:529] Please choose the operation:
[11:36:04:534] 1: Load system code to SDRAM via TFTP.
[11:36:04:542] 2: Load system code then write to Flash via TFTP.
[11:36:04:551] 3: Boot system code via Flash (default).
[11:36:04:559] 4: Entr boot command line interface.
[11:36:04:566] 7: Load Boot Loader code then write to Flash via Serial.
[11:36:04:577] 9: Load Boot Loader code then write to Flash via TFTP.
[11:36:05:586] <0x08><0x08><0x08> 4 <0x08><0x08><0x08> 3 <0x08><0x08><0x08> 2 <0x08><0x08><0x08> 1 <0x08><0x08><0x08> 0
[11:36:09:596]
[11:36:09:596] 3: System Boot system code via Flash.
[11:36:09:601] ## Booting image at bc050000 ...
[11:36:09:606] raspi_read: from:50000 len:40
[11:36:09:611] . Image Name: MIPS OpenWrt Linux-5.4.67
[11:36:09:618] Created: 2020-09-25 2:31:36 UTC
[11:36:09:626] Image Type: MIPS Linux Kernel Image (lzma compressed)
[11:36:09:636] Data Size: 1402889 Bytes = 1.3 MB
[11:36:09:643] Load Address: 80000000
[11:36:09:648] Entry Point: 80000000
[11:36:09:652] raspi_read: from:50040 len:156809
[11:36:09:659] ...................... Verifying Checksum ... OK
[11:36:11:162] Uncompressing Kernel Image ... OK
[11:36:14:176] No initrd
[11:36:14:182] ## Transferring control to Linux (at address 80000000) ...
[11:36:14:193] ## Giving linux memsize in MB, 32
[11:36:14:198]
[11:36:14:198] Starting kernel ...
[11:36:14:198]
[11:36:14:204] [ 0.000000] Linux version 5.4.67 (johndoe@jd-ubuntu) (gcc version 8.4.0 (OpenWrt GCC 8.4.0 r13903-f206461153)) #0 Fri Sep 25 02:31:36 2020
[11:36:14:225] [ 0.000000] SoC Type: Ralink RT5350 id:1 rev:3
[11:36:14:233] [ 0.000000] printk: bootconsole [early0] enabled
[11:36:14:243] [ 0.000000] CPU0 revision is: 0001964c (MIPS 24KEc)
[11:36:14:254] [ 0.000000] MIPS: machine is Nexx WT1520 (8M)
[11:36:14:264] [ 0.000000] Initrd not found or empty - disabling initrd
[11:36:14:276] [ 0.000000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[11:36:14:290] [ 0.000000] Primary data cache 16kB, 4-way, VIPT, no aliases, linesize 32 bytes
[11:36:14:305] [ 0.000000] Zone ranges:
[11:36:14:309] [ 0.000000] Normal [mem 0x0000000000000000-0x0000000001ffffff]
[11:36:14:321] [ 0.000000] Movable zone start for each node
[11:36:14:330] [ 0.000000] Early memory node ranges
[11:36:14:337] [ 0.000000] node 0: [mem 0x0000000000000000-0x0000000001ffffff]
[11:36:14:350] [ 0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000001ffffff]
[11:36:14:373] [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 8128
[11:36:14:386] [ 0.000000] Kernel command line: console=ttyS0,57600 rootfstype=squashfs,jffs2
[11:36:14:402] [ 0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes, linear)
[11:36:14:416] [ 0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes, linear)
[11:36:14:431] [ 0.000000] Writing ErrCtl register=00049b0e
[11:36:14:440] [ 0.000000] Readback ErrCtl register=00049b0e
[11:36:14:448] [ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[11:36:14:464] [ 0.000000] Memory: 26856K/32768K available (3479K kernel code, 170K rwdata, 492K rodata, 1228K init, 186K bss, 5912K reserved, 0K cma-reserved)
[11:36:14:492] [ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[11:36:14:504] [ 0.000000] NR_IRQS: 256
[11:36:14:512] [ 0.000000] random: get_random_bytes called from 0x8040d9ac with crng_init=0
[11:36:14:526] [ 0.000000] CPU Clock: 360MHz
[11:36:14:533] [ 0.000000] clocksource: systick: mask: 0xffff max_cycles: 0xffff, max_idle_ns: 583261500 ns
[11:36:14:550] [ 0.000000] systick: running - mult: 214748, shift: 32
[11:36:14:560] [ 0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 10618113593 ns
[11:36:14:577] [ 0.000018] sched_clock: 32 bits at 180MHz, resolution 5ns, wraps every 11930464253ns
[11:36:14:624] [ 0.015721] Calibrating delay loop... 239.10 BogoMIPS (lpj=478208)
[11:36:14:638] [ 0.059904] pid_max: default: 32768 minimum: 301
[11:36:14:647] [ 0.069413] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[11:36:14:661] [ 0.083925] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[11:36:14:685] [ 0.108620] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[11:36:14:706] [ 0.128025] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[11:36:14:719] [ 0.141591] pinctrl core: initialized pinctrl subsystem
[11:36:14:730] [ 0.153266] NET: Registered protocol family 16
[11:36:14:809] [ 0.231950] rt2880_gpio 10000600.gpio: registering 22 gpios
[11:36:14:820] [ 0.243117] rt2880_gpio 10000600.gpio: registering 22 irq handlers
[11:36:14:837] [ 0.257215] workqueue: max_active 576 requested for napi_workq is out of range, clamping between 1 and 512
[11:36:14:864] [ 0.286953] clocksource: Switched to clocksource MIPS
[11:36:14:879] [ 0.299932] NET: Registered protocol family 2
[11:36:14:890] [ 0.310338] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[11:36:14:905] [ 0.327073] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[11:36:14:921] [ 0.342308] TCP bind hash table entries: 1024 (order: 0, 4096 bytes, linear)
[11:36:14:935] [ 0.356295] TCP: Hash tables configured (established 1024 bind 1024)
[11:36:14:948] [ 0.369318] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[11:36:14:960] [ 0.382396] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[11:36:14:974] [ 0.396906] NET: Registered protocol family 1
[11:36:14:990] [ 0.413224] rt-timer 10000100.timer: maximum frequency is 3662Hz
[11:36:15:008] [ 0.431491] workingset: timestamp_bits=30 max_order=13 bucket_order=0
[11:36:15:035] [ 0.458645] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[11:36:15:050] [ 0.470268] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[11:36:15:105] [ 0.528185] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[11:36:15:122] [ 0.543482] printk: console [ttyS0] disabled
[11:36:15:132] [ 0.552108] 10000c00.uartlite: ttyS0 at MMIO 0x10000c00 (irq = 20, base_baud = 2500000) is a Palmchip BK-3103
[11:36:15:148] [ 0.571868] printk: console [ttyS0] enabled
[11:36:15:158] [ 0.571868] printk: console [ttyS0] enabled
[11:36:15:166] [ 0.588434] printk: bootconsole [early0] disabled
[11:36:15:176] [ 0.588434] printk: bootconsole [early0] disabled
[11:36:15:200] [ 0.623846] spi spi0.0: force spi mode3
[11:36:15:222] [ 0.645078] spi-nor spi0.0: s25fl064k (8192 Kbytes)
[11:36:15:232] [ 0.655035] 4 fixed-partitions partitions found on MTD device spi0.0
[11:36:15:245] [ 0.667782] Creating 4 MTD partitions on "spi0.0":
[11:36:15:255] [ 0.677420] 0x000000000000-0x000000030000 : "u-boot"
[11:36:15:266] [ 0.689630] 0x000000030000-0x000000040000 : "u-boot-env"
[11:36:15:279] [ 0.702617] 0x000000040000-0x000000050000 : "factory"
[11:36:15:292] [ 0.715210] 0x000000050000-0x000000800000 : "firmware"
[11:36:15:314] [ 0.737217] 2 uimage-fw partitions found on MTD device firmware
[11:36:15:327] [ 0.749205] Creating 2 MTD partitions on "firmware":
[11:36:15:337] [ 0.759210] 0x000000000000-0x000000156849 : "kernel"
[11:36:15:348] [ 0.771546] 0x000000156849-0x0000007b0000 : "rootfs"
[11:36:15:360] [ 0.783909] mtd: device 5 (rootfs) set to be root filesystem
[11:36:15:377] [ 0.800238] 1 squashfs-split partitions found on MTD device rootfs
[11:36:15:390] [ 0.812805] 0x0000003ed000-0x0000007b0000 : "rootfs_data"
[11:36:15:404] [ 0.827235] libphy: Fixed MDIO Bus: probed
[11:36:15:422] [ 0.845433] rt3050-esw 10110000.esw: link changed 0x00
[11:36:15:437] [ 0.860124] mtk_soc_eth 10100000.ethernet eth0: mediatek frame engine at 0xb0100000, irq 5
[11:36:15:454] [ 0.877891] rt2880_wdt 10000120.watchdog: Initialized
[11:36:15:468] [ 0.891408] NET: Registered protocol family 10
[11:36:15:488] [ 0.911833] Segment Routing with IPv6
[11:36:15:501] [ 0.919596] NET: Registered protocol family 17
[11:36:15:505] [ 0.928774] 8021q: 802.1Q VLAN Support v1.8
[11:36:15:531] [ 0.954139] VFS: Mounted root (squashfs filesystem) readonly on device 31:5.
[11:36:15:558] [ 0.981183] Freeing unused kernel memory: 1228K
[11:36:15:569] [ 0.990324] This architecture does not have kernel memory protection.
[11:36:15:581] [ 1.003222] Run /sbin/init as init process
[11:36:16:047] [ 1.471010] random: fast init done
[11:36:18:815] [ 4.238784] init: Console is alive
[11:36:18:823] [ 4.246567] init: - watchdog -
[11:36:21:932] [ 7.356919] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[11:36:22:395] [ 7.820094] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[11:36:22:421] [ 7.845716] init: - preinit -
[11:36:24:475] [ 9.900574] random: procd: uninitialized urandom read (4 bytes read)
[11:36:24:589] [ 10.014234] random: jshn: uninitialized urandom read (4 bytes read)
[11:36:24:757] [ 10.182146] random: jshn: uninitialized urandom read (4 bytes read)
[11:36:27:265] [ 12.690362] rt3050-esw 10110000.esw: link changed 0x00
[11:36:27:499] Press the [f] key and hit [enter] to enter failsafe mode
[11:36:27:510] Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
[11:36:31:678] - failsafe button reset was pressed -
[11:36:31:707] - failsafe -
[11:36:33:300] Waiting for kernel randomness to be initialised...
[11:36:35:336] [ 20.763112] random: crng init done
[11:36:35:343] [ 20.769995] random: 3 urandom warning(s) missed due to ratelimiting
[11:36:35:359] Generating 1024 bit rsa key, this may take a while...
[11:36:39:267] Public key portion is:
|