TP-Link TL-WDR4900 (N900)
Dual Band (concurrent) and Gigabit Ethernet. Advertised as 900 Mbps it has simultaneous Triple-Stream (3×3) radios on both 2.4 GHz and 5 GHz Bands.
There are two very different revisions
- V1.x: target:
mpc85xx
800MHz Freescale PPC P1014 CPU 3 internal antennas (2.4 GHz) and 3 external antennas (5 GHz), available world-wide - V2.x: target:
ar71xx
720MHz Qualcomm/Atheros SoC and 6 external antennas, available in PRC only
- Price: AliExpress - about 100 USD
Supported Versions
Hardware Highlights
Installation
→ Install OpenWrt (generic explanation)
An OpenWrt factory image may be installed via the OEM firmware on both versions. See the generic installation guide for further information.
If you do not speak Chinese and are not familiar with the standard TP-Link firmware, please see the screen shots below for help.
After installation you will want to proceed with first login, basic configuration. You may also wish to install the web user interface LuCI, after which you can manage your router at http://192.168.1.1
Helpful screen shots for installing from Chinese stock firmware
De-brick or OEM installation
Using TFTP + Serial method
Pre-requisites
- a serial connection (e.g. TTL, RS232) from your machine to the router.
- a terminal program (e.g. minicom, screen) set for 115200 Baud, 8 data bits, no parity, 1 stop bit, no flow control.
- It is strongly recommended not to connect the 3.3V (or any) voltage line - use the router's own power supply instead.
- a factory OpenWrt firmware image into your TFTP server folder (see Installation above)
- a wired ethernet connection from your computer to one of the router's LAN ports.
- IP address on this connection should be statically set to 192.168.1.x/24.
- a TFTP server started on your local machine
- must be listening on the same link/IP address as the wired ethernet connection to the router
- v1.x models prefer the server address 192.168.0.66, v2.0 prefers 192.168.1.100
v1.x Flash Write Procedure
This section applies to v1.x only! (version 2.0 method)
- Router should be unplugged (power off), your serial line connected, terminal open and TFTP server installed not yet running.
- Copy your desired OpenWrt image for the TPlink-WDR4900 into your TFTP server folder and rename it into
openwrt.bin
(to save some typing within the flash procedure). - First goal is to get the command prompt from the U-Boot bootloader on your router.
- Plug in your router and be ready to type “
vl
” just after you see the lineAutobooting in 1 seconds
(Spamming “vl
” around this point helps):
U-Boot 2010.12-svn15934 (Dec 11 2012 - 16:23:49) CPU: P1014, Version: 1.0, (0x80f10110) Core: E500, Version: 5.1, (0x80212151) Clock Configuration: CPU0:800 MHz, CCB:400 MHz, DDR:333.333 MHz (666.667 MT/s data rate) (Asynchronous), IFC:100 MHz L1: D-cache 32 kB enabled I-cache 32 kB enabled Board: P1014RDB SPI: ready DRAM: 128 MiB L2: 256 KB enabled Using default environment PCIe1: Root Complex of mini PCIe Slot, x1, regs @ 0xffe0a000 01:00.0 - 168c:abcd - Network controller PCIe1: Bus 00 - 01 PCIe2: Root Complex of PCIe Slot, x1, regs @ 0xffe09000 03:00.0 - 168c:0033 - Network controller PCIe2: Bus 02 - 03 In: serial Out: serial Err: serial Net: initialization for Atheros AR8327/AR8328 AR8327/AR8328 v1.1 is found! eTSEC1 Autobooting in 1 seconds
In case you failed the right timing just reboot again until the prompt appears
=>
- (optional) Now lets check what kind of parameters the u-boot loader expects (e.g file name of firmware, IP via TFTP & load address).
Type tftpboot
& press ENTER …
=> tftpboot Check for phy link status Speed: 1000, full duplex Using eTSEC1 device TFTP from server 192.168.0.104; our IP address is 192.168.0.136 Filename 'uImage'. Load address: 0x1000000 Loading: T T T T T T T T T T Retry count exceeded; starting again
- As you can see, uboot expects a firmware image file name “
uImage
” at TFTP server address192.168.0.104
,
then, just change you local ip into 192.168.0.104
and start your TFTP server.
- Start the uBoot's TFTP client to download the image from your local machine by typing:
tftpboot 0x1000000 openwrt.bin
+ ENTER
=> tftpboot 0x1000000 openwrt.bin Check for phy link status Speed: 1000, full duplex Using eTSEC1 device TFTP from server 192.168.0.104; our IP address is 192.168.0.136 Filename 'openwrt.bin'. Load address: 0x1000000 Loading: ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ### done Bytes transferred = 16252928 (f80000 hex)
- The last line needs to show a size of f80000 hex, otherwise your image is unsuitable.
- To select the SPI flash memory type: sf probe 0
=> sf probe 0 SF: Detected S25FL128S_65k with page size 256, total 16 MiB 16384 KiB S25FL128S_64K at 0:0 is now current device
- Now we need to erase parts of the flash memory to be able to copy your fresh loaded firmware into it,
just type in the prompt sf erase 0x60000 0xf80000
:
=> sf erase 0x60000 0xf80000 SPI flash erase successful
- Now just copy the image to the right place by typing
sf write 0x1000000 0x60000 0xf80000
=> sf write 0x1000000 0x60000 0xf80000 SPI flash write successful
- So, in case your image is the correct one, you should do just a single reboot to have a working TL-WRD4900 back on your desk.
Type reset
or just un-plug and re-plug the power of your router and watch the boot process.
=> reset
v2.0 Flash Write Procedure
This section applies to v2.0 only! (version 1.x method)
- Be sure the router is powered off (there's a handy power switch beside the power line).
- Connect your serial and ethernet cables to your computer.
- Open your terminal for the serial connection.
- Power on the router
- When you see
Autobooting in 1 seconds
, quickly type “tpl
” to access the command line.- there is no harm at all typing “
tpl
” repeatedly from the moment you power on, I often start when I see the U-Boot bootloader header.
- Start the TFTP server running on your computer.
- At the
ap135>
prompt, type the following commands:tftpboot 0x81000000 openwrt.bin
(where openwrt.bin is the name of your firmware image)erase 0x9f020000 +0x7c0000
cp.b 0x81000000 0x9f020000 0x7c0000
bootm 0x9f020000
- Congratulations!
Reset Button Method (no serial cable needed)
If you want to de-brick/upgrade your router using TFTP without a serial cable follow these steps:
Pre-requisites
- Copy a working & full OpenWrt sysupgrade image into your TFTP server folder (e.g: https://downloads.openwrt.org/barrier_breaker/14.07/mpc85xx/generic/openwrt-mpc85xx-generic-tl-wdr4900-v1-squashfs-sysupgrade.bin) so it will be found under the path /wdr4900v1_tp_recovery.bin You can also use the image used for reverting to stock firmware if you prefer to do so, but it has to be placed under the same path.
- A TFTP server started on your local machine on LAN address 192.168.0.66/24.
- Connect your LAN-port to one of the routers LAN
Procedure
- Router should be unplugged (power off) and TFTP server installed not yet running.
- Copy your desired OpenWrt image for the TPlink-WDR4900 into your TFTP server folder and rename it into
wdr4900v1_tp_recovery.bin
(as the router will search for this file). - Make sure your card has address 192.168.0.66.
- Start the tftp server and make sure it is listening on 192.168.0.66
- Plug in your router and keep the WPS/Reset button pressed until the tftp server confirms the transfer is done
- Wait for the router to reboot, the new image will then be loaded
- A pack ready for doing this, containing TFTPD32 server and the latest TP-Link firmware, can be found here: https://forum.openwrt.org/viewtopic.php?pid=236428#p236428
- Also there's a video of the process: http://www.youtube.com/watch?v=54PAS0gvW2k
TFTP server log may contain info about firmware image name that router requested. Something like:
Read request for file <wr841nv8_tp_recovery.bin> . Mode octet [21/11 09:45:27.574]
Failsafe / reset
On the v1 units, the only way that I have been able to get the router into failsafe mode is to quickly and repeatedly press the WPS/Reset button starting before the front panel “star” LED started flashing. When that LED finally lit, it appeared to go directly into the rapid-flashing “failsafe” indication. If the WPS LED lights (rightmost, “yin-yang arrows”), it may be that you started clicking the button a little early in the boot sequence.
For what you can do in failsafe, go to the OpenWrt Failsafe Mode page.
Another user writes:
After all else failed, I found http://www.binaryfriend.ru/2012/10/how-to-hard-reset-openwrt-on-tp-link-1043nd. Extremely simple. Please see the original page for more info. Summary:
- Power the router up;
- After powering up track the SYS light when it starts to blink, when it does press and hold the QSS button till SYS lights starts to blink faster – router goes to recovery mode;
- Telnet to the router on 192.168.1.1 – no password needed (if your computer doesn’t gets IP address from DHCP assign it manually for i.e. 192.168.1.200 with netmask of 255.255.255.0);
- In telnet terminal type `mtd -r erase rootfs_data` to reset OpenWrt to it’s defaults.
Reverting to stock firmware
You can revert to stock firmware by following these steps:
- Download / copy with SCP this firmware to the /tmp folder of the router: https://www.dropbox.com/sh/g8dyafqrato12pc/AADtSjx_MVot7asdqeRtvVVza?dl=0
- Optionally check MD5 hash: 1148EFD09C6D9B07E6A01259A4EBEF72
- Rename to firmware.bin (less chance for spelling errors and unsupported characters)
- Open a SSH session to the router, cd to /tmp
- Execute the following command: mtd -r write firmware.bin firmware
- Wait until the router reboots
Note: You can only flash this firmware version because it has no BOOT in the filename. This image and OpenWrt images are the exact same size. Other images from TP-Link do have BOOT in the filename and these files are also more bytes than this one, then to create your own flashable image, follow the below method:
In order to create your own bootable file download firmware from TP-Link and execute the following command (change the if= filename in case you downloaded a different version):
dd if=wdr4900nv1_en_3_14_3_up_boot\(130320\).bin of=wdr4900nv1.bin skip=769 bs=512
You can then transfer the resulting file and flash this using the mtd method described elsewhere in this document.
mtd write wdr4900nv1.bin firmware
Specific Configuration
VLAN
Using the same switch port for both tagged and untagged traffic works on this router (used for instance in IP-TV). Previous versions of OpenWrt required a patch for the switch driver (see the related ticket). In 15.05 this is no longer needed; VLAN works out of the box.
Switch Ports (v1.x)
Numbers 2-5 are Ethernet Ports 1-4 as labeled on the unit, number 1 is “Internet” (WAN) on the unit, 0 is the internal connection to the router itself.
Port | Switch port |
---|---|
CPU | 0 |
WAN | 1 |
LAN 1 | 2 |
LAN 2 | 3 |
LAN 3 | 4 |
LAN 4 | 5 |
(not used ?) | 6 |
Switch Ports (v2.x)
Numbers 2-5 are Ethernet Ports 1-4 as labeled on the unit, number 1 is “Internet” (WAN) on the unit, 6 is the internal connection to the router itself, and 0 is another CPU, because this router has two.
Port | Switch port |
---|---|
Second CPU | 0 |
WAN | 1 |
LAN 1 | 2 |
LAN 2 | 3 |
LAN 3 | 4 |
LAN 4 | 5 |
CPU | 6 |
Example
Port Mirroring
Hardware port mirroring is supported in v1/(v2?)
Here's an example of configuring port mirroring in /etc/config/network for mirroring port 1 to port 5 (You may need to restart the router for port mirroring changes to take effect):
config switch option name 'switch0' option reset '1' option enable_vlan '1' option enable_mirror_rx '1' option enable_mirror_tx '1' option mirror_source_port '1' option mirror_monitor_port '5'
Hardware
Info
Version 1.x | Version 2.x | |
---|---|---|
Instruction set | PowerPC | MIPS |
Vendor | Freescale Semiconductor | Qualcomm Atheros |
TP-Link prod.page | N900 | |
bootloader | U-Boot 2010.12-svn15934 for PowerPC | U-Boot ? fork of mainline U-Boot version 1.1.4 (2005-12-17) for MIPS ? |
System-On-Chip | Freescale MPC85xx | QCA9558-AT4A |
CPU/Speed | PPC P1014@800MHz | MIPS 74Kc Vers. 5.0 720 MHz |
Flash-Chip | S25FL128S | Winbond W25Q64FVSIG |
Flash size | 16384 KiB | 8192 KiB |
RAM-Chip | H5TQ1G63DFR | H5PS5162GFR |
RAM size | 128 MiB | 128 MiB |
Wireless1 | Chip: AR9381-AL1A w/ 3×3 MIMO for 2.4GHz | SoC: QCA9558-AT4A w/ 3×3 MIMO for 2.4GHz |
Wireless2 | Chip: AR9580-AR1A w/ 3×3 MIMO for 5GHz | Chip: AR9580-AR1A w/ 3×3 MIMO for 5GHz |
Switch | AR8327N-AL1A | AR8327N-BL1A |
USB | 2 (USB 2.0) | 2 (USB 2.0) |
Serial | Yes | Yes |
JTAG | Yes | Yes |
Antennas] | 3 external, 3 internal(2.4GHz) | 6 external |
Photos
Version 1.x
Version 2.0
Serial
Serial console is available on the JP2 (v1.x) or J1 (v2.0) connector - see PCB photos above.
DO NOT CONNECT VCC. Use only TX/RX/GND.
Baud Rate: 115200
Data Bits: 8
Parity: No
Stop Bits: 1
Factory firmware login credentials: (v1.x only)
* username: root
* password: 5up
Note:
Be extremely careful when soldering a serial console on TP-Link TL-WDR4900 - the design of the PCB is not well suited for soldering and important paths/connections are near the soldering points. We have now 3 Routers which are dead, just because we used too much solder...
Recommendations for soldering a serial console header to the v1.x
The through-holes for the console header are bare copper which grow an oxide layer over time. To successfully solder you must either use an aggressive flux (the residue of which must be carefully and fully removed after soldering e.g. with an ultrasonic bath), or abrade the surface to mechanically remove the oxide layer before soldering (so that the pads change from a dull brown to a shiny pink copper), e.g. with an abrasive rubber - being careful not to remove the green solder-resist around the pads.
The PCB has extensive ground planes which rapidly carries heat away from the area being soldered. You may need to use a higher power temperature controlled soldering iron, a higher iron tip temperature, or a low temperature solder. The surrounding area of PCB can also be preheated with hot air.
JTAG
→ port.jtag general information about the JTAG port, JTAG cable, etc.
How to connect to the JTAG Port of this specific device:
Insert photo of PCB with markings for JTAG port
Boot Logs
OEM bootlog
COPY HERE THE BOOTLOG WITH THE ORIGINAL FIRMWARE
OpenWrt bootlog
[ 0.000000] Memory CAM mapping: 64/64 Mb, residual: 0Mb [ 0.000000] Linux version 4.19.53 (buildbot@1be523fcdeb0) (gcc version 7.4.0 (OpenWrt GCC 7.4.0 r10307-629e6538a1)) #0 Sat Jun 22 11:17:48 2019 [ 0.000000] Using Freescale P1014 machine description [ 0.000000] Found legacy serial port 0 for /soc@ffe00000/serial@4500 [ 0.000000] mem=ffe04500, taddr=ffe04500, irq=0, clk=399999996, speed=0 [ 0.000000] ----------------------------------------------------- [ 0.000000] phys_mem_size = 0x8000000 [ 0.000000] dcache_bsize = 0x20 [ 0.000000] icache_bsize = 0x20 [ 0.000000] cpu_features = 0x0000000010010128 [ 0.000000] possible = 0x0000000010010128 [ 0.000000] always = 0x0000000000000020 [ 0.000000] cpu_user_features = 0x84e08000 0x08000000 [ 0.000000] mmu_features = 0x00020010 [ 0.000000] ----------------------------------------------------- [ 0.000000] TL-WDR4900 v1 board from TP-Link [ 0.000000] barrier-nospec: using isync; sync as speculation barrier [ 0.000000] barrier-nospec: patched 199 locations [ 0.000000] Top of RAM: 0x8000000, Total RAM: 0x8000000 [ 0.000000] Memory hole size: 0MB [ 0.000000] Zone ranges: [ 0.000000] DMA [mem 0x0000000000000000-0x0000000007ffffff] [ 0.000000] Normal empty [ 0.000000] Movable zone start for each node [ 0.000000] Early memory node ranges [ 0.000000] node 0: [mem 0x0000000000000000-0x0000000007ffffff] [ 0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff] [ 0.000000] On node 0 totalpages: 32768 [ 0.000000] DMA zone: 288 pages used for memmap [ 0.000000] DMA zone: 0 pages reserved [ 0.000000] DMA zone: 32768 pages, LIFO batch:7 [ 0.000000] MMU: Allocated 1088 bytes of context maps for 255 contexts [ 0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768 [ 0.000000] pcpu-alloc: [0] 0 [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 32480 [ 0.000000] Kernel command line: console=ttyS0,115200 [ 0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes) [ 0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes) [ 0.000000] software IO TLB: Cannot allocate buffer [ 0.000000] Memory: 123144K/131072K available (4836K kernel code, 220K rwdata, 1096K rodata, 152K init, 221K bss, 7928K reserved, 0K cma-reserved) [ 0.000000] Kernel virtual memory layout: [ 0.000000] * 0xfffdf000..0xfffff000 : fixmap [ 0.000000] * 0xfe000000..0xfe000000 : early ioremap [ 0.000000] * 0xc9000000..0xfe000000 : vmalloc & ioremap [ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1 [ 0.000000] NR_IRQS: 512, nr_irqs: 512, preallocated irqs: 16 [ 0.000000] mpic: Resetting [ 0.000000] mpic: Setting up MPIC " OpenPIC " version 1.2 at ffe40000, max 1 CPUs [ 0.000000] mpic: ISU size: 256, shift: 8, mask: ff [ 0.000000] mpic: Initializing for 256 sources [ 0.000000] time_init: decrementer frequency = 49.999999 MHz [ 0.000000] time_init: processor frequency = 799.999992 MHz [ 0.000011] clocksource: timebase: mask: 0xffffffffffffffff max_cycles: 0xb88126fc8, max_idle_ns: 440795204701 ns [ 0.000020] clocksource: timebase mult[14000007] shift[24] registered [ 0.000030] clockevent: decrementer mult[cccccc9] shift[32] cpu[0] [ 0.000074] pid_max: default: 32768 minimum: 301 [ 0.000264] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes) [ 0.000276] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes) [ 0.002982] random: get_random_u32 called from bucket_table_alloc.isra.19+0x148/0x1ac with crng_init=0 [ 0.003246] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns [ 0.003261] futex hash table entries: 256 (order: -1, 3072 bytes) [ 0.003695] NET: Registered protocol family 16 [ 0.008767] Found FSL PCI host bridge at 0x00000000ffe09000. Firmware bus number: 0->255 [ 0.008782] PCI host bridge /pcie@ffe09000 (primary) ranges: [ 0.008795] MEM 0x00000000a0000000..0x00000000bfffffff -> 0x00000000a0000000 [ 0.008804] IO 0x00000000ffc10000..0x00000000ffc1ffff -> 0x0000000000000000 [ 0.008826] /pcie@ffe09000: PCICSRBAR @ 0xfff00000 [ 0.008832] setup_pci_atmu: end of DRAM 8000000 [ 0.009181] Found FSL PCI host bridge at 0x00000000ffe0a000. Firmware bus number: 0->255 [ 0.009192] PCI host bridge /pcie@ffe0a000 ranges: [ 0.009203] MEM 0x0000000080000000..0x000000009fffffff -> 0x0000000080000000 [ 0.009212] IO 0x00000000ffc00000..0x00000000ffc0ffff -> 0x0000000000000000 [ 0.009238] /pcie@ffe0a000: PCICSRBAR @ 0xfff00000 [ 0.009244] setup_pci_atmu: end of DRAM 8000000 [ 0.010547] PCI: Probing PCI hardware [ 0.010649] fsl-pci ffe09000.pcie: PCI host bridge to bus 9000:00 [ 0.010664] pci_bus 9000:00: root bus resource [io 0x0000-0xffff] [ 0.010674] pci_bus 9000:00: root bus resource [mem 0xa0000000-0xbfffffff] [ 0.010685] pci_bus 9000:00: root bus resource [bus 00-ff] [ 0.010697] pci_bus 9000:00: busn_res: [bus 00-ff] end is updated to ff [ 0.010726] pci 9000:00:00.0: [1957:012b] type 01 class 0x0b2000 [ 0.010753] pci 9000:00:00.0: reg 0x10: [mem 0xfff00000-0xffffffff] [ 0.010801] pci 9000:00:00.0: supports D1 D2 [ 0.010807] pci 9000:00:00.0: PME# supported from D0 D1 D2 D3hot D3cold [ 0.011825] pci 9000:01:00.0: [168c:0033] type 00 class 0x028000 [ 0.011862] pci 9000:01:00.0: reg 0x10: [mem 0xa0000000-0xa001ffff 64bit] [ 0.011900] pci 9000:01:00.0: reg 0x30: [mem 0x00000000-0x0000ffff pref] [ 0.011972] pci 9000:01:00.0: supports D1 [ 0.011978] pci 9000:01:00.0: PME# supported from D0 D1 D3hot [ 0.024964] pci 9000:00:00.0: PCI bridge to [bus 01-ff] [ 0.024987] pci 9000:00:00.0: bridge window [mem 0xa0000000-0xa00fffff] [ 0.025088] pci_bus 9000:01: busn_res: [bus 01-ff] end is updated to 01 [ 0.025101] pci_bus 9000:00: busn_res: [bus 00-ff] end is updated to 01 [ 0.025231] fsl-pci ffe0a000.pcie: PCI host bridge to bus a000:02 [ 0.025248] pci_bus a000:02: root bus resource [io 0x20000-0x2ffff] (bus address [0x0000-0xffff]) [ 0.025258] pci_bus a000:02: root bus resource [mem 0x80000000-0x9fffffff] [ 0.025269] pci_bus a000:02: root bus resource [bus 02-ff] [ 0.025279] pci_bus a000:02: busn_res: [bus 02-ff] end is updated to ff [ 0.025306] pci a000:02:00.0: [1957:012b] type 01 class 0x0b2000 [ 0.025330] pci a000:02:00.0: reg 0x10: [mem 0xfff00000-0xffffffff] [ 0.025376] pci a000:02:00.0: supports D1 D2 [ 0.025383] pci a000:02:00.0: PME# supported from D0 D1 D2 D3hot D3cold [ 0.026280] pci a000:02:00.0: Primary bus is hard wired to 0 [ 0.026294] pci a000:02:00.0: bridge configuration invalid ([bus 01-01]), reconfiguring [ 0.026403] pci a000:03:00.0: [168c:abcd] type 00 class 0x020000 [ 0.026416] pci a000:03:00.0: AR9381 fixup applied [ 0.026447] pci a000:03:00.0: reg 0x10: [mem 0x80000000-0x8001ffff 64bit] [ 0.026484] pci a000:03:00.0: reg 0x30: [mem 0x00000000-0x0000ffff pref] [ 0.026557] pci a000:03:00.0: supports D1 [ 0.026563] pci a000:03:00.0: PME# supported from D0 D1 D3hot [ 0.036975] pci a000:02:00.0: PCI bridge to [bus 03-ff] [ 0.036996] pci a000:02:00.0: bridge window [mem 0x80000000-0x800fffff] [ 0.037094] pci_bus a000:03: busn_res: [bus 03-ff] end is updated to 03 [ 0.037106] pci_bus a000:02: busn_res: [bus 02-ff] end is updated to 03 [ 0.037135] PCI: Cannot allocate resource region 0 of device 9000:00:00.0, will remap [ 0.037150] PCI: Cannot allocate resource region 0 of device a000:02:00.0, will remap [ 0.037169] PCI 9000:00 Cannot reserve Legacy IO [io 0x0000-0x0fff] [ 0.037174] PCI a000:02 Cannot reserve Legacy IO [io 0x20000-0x20fff] [ 0.037199] pci 9000:00:00.0: BAR 0: no space for [mem size 0x00100000] [ 0.037210] pci 9000:00:00.0: BAR 0: failed to assign [mem size 0x00100000] [ 0.037225] pci 9000:01:00.0: BAR 6: assigned [mem 0xa0020000-0xa002ffff pref] [ 0.037235] pci 9000:00:00.0: PCI bridge to [bus 01] [ 0.037244] pci 9000:00:00.0: bridge window [io 0x0000-0xffff] [ 0.037255] pci 9000:00:00.0: bridge window [mem 0xa0000000-0xbfffffff] [ 0.037265] pci_bus 9000:00: Some PCI device resources are unassigned, try booting with pci=realloc [ 0.037275] pci_bus 9000:00: resource 4 [io 0x0000-0xffff] [ 0.037282] pci_bus 9000:00: resource 5 [mem 0xa0000000-0xbfffffff] [ 0.037289] pci_bus 9000:01: resource 0 [io 0x0000-0xffff] [ 0.037295] pci_bus 9000:01: resource 1 [mem 0xa0000000-0xbfffffff] [ 0.037308] pci a000:02:00.0: BAR 0: no space for [mem size 0x00100000] [ 0.037317] pci a000:02:00.0: BAR 0: failed to assign [mem size 0x00100000] [ 0.037330] pci a000:03:00.0: BAR 6: assigned [mem 0x80020000-0x8002ffff pref] [ 0.037339] pci a000:02:00.0: PCI bridge to [bus 03] [ 0.037348] pci a000:02:00.0: bridge window [io 0x20000-0x2ffff] [ 0.037358] pci a000:02:00.0: bridge window [mem 0x80000000-0x9fffffff] [ 0.037367] pci_bus a000:02: Some PCI device resources are unassigned, try booting with pci=realloc [ 0.037377] pci_bus a000:02: resource 4 [io 0x20000-0x2ffff] [ 0.037384] pci_bus a000:02: resource 5 [mem 0x80000000-0x9fffffff] [ 0.037390] pci_bus a000:03: resource 0 [io 0x20000-0x2ffff] [ 0.037397] pci_bus a000:03: resource 1 [mem 0x80000000-0x9fffffff] [ 0.044149] Registering qe_ic with sysfs... [ 0.045799] clocksource: Switched to clocksource timebase [ 0.046426] NET: Registered protocol family 2 [ 0.046894] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes) [ 0.046921] TCP established hash table entries: 1024 (order: 0, 4096 bytes) [ 0.046939] TCP bind hash table entries: 1024 (order: 0, 4096 bytes) [ 0.046955] TCP: Hash tables configured (established 1024 bind 1024) [ 0.047034] UDP hash table entries: 256 (order: 0, 4096 bytes) [ 0.047055] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes) [ 0.047203] NET: Registered protocol family 1 [ 0.047275] PCI: CLS 32 bytes, default 32 [ 0.048475] Crashlog allocated RAM at address 0x3f00000 [ 0.049957] workingset: timestamp_bits=14 max_order=15 bucket_order=1 [ 0.054960] squashfs: version 4.0 (2009/01/31) Phillip Lougher [ 0.054974] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc. [ 0.064279] io scheduler noop registered [ 0.064292] io scheduler deadline registered (default) [ 0.082499] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled [ 0.083924] console [ttyS0] disabled [ 0.083971] serial8250.0: ttyS0 at MMIO 0xffe04500 (irq = 42, base_baud = 24999999) is a 16550A [ 0.778183] console [ttyS0] enabled [ 0.782311] console [ttyS0] disabled [ 0.785936] ffe04500.serial: ttyS0 at MMIO 0xffe04500 (irq = 42, base_baud = 24999999) is a 16550 [ 1.456298] console [ttyS0] enabled [ 1.460531] fsl_espi ffe07000.spi: cs=0, init_csmode=0x100008 [ 1.467654] m25p80 spi0.0: s25fl128s (16384 Kbytes) [ 1.472748] 5 fixed-partitions partitions found on MTD device spi0.0 [ 1.479118] Creating 5 MTD partitions on "spi0.0": [ 1.483915] 0x000000000000-0x000000050000 : "u-boot" [ 1.489365] 0x000000050000-0x000000060000 : "dtb" [ 1.494494] 0x000000060000-0x000000fe0000 : "firmware" [ 1.501141] 2 tplink-fw partitions found on MTD device firmware [ 1.507099] Creating 2 MTD partitions on "firmware": [ 1.512071] 0x000000000000-0x00000022c5f0 : "kernel" [ 1.517518] 0x00000022c5f0-0x000000f80000 : "rootfs" [ 1.522885] mtd: device 4 (rootfs) set to be root filesystem [ 1.529271] 1 squashfs-split partitions found on MTD device rootfs [ 1.535486] 0x000000460000-0x000000f80000 : "rootfs_data" [ 1.541356] 0x000000fe0000-0x000000ff0000 : "config" [ 1.546758] 0x000000ff0000-0x000001000000 : "caldata" [ 1.552269] fsl_espi ffe07000.spi: at 0x(ptrval) (irq = 59) [ 1.558190] libphy: Fixed MDIO Bus: probed [ 1.562845] libphy: Freescale PowerQUICC MII Bus: probed [ 1.574470] switch0: Atheros AR8327 rev. 4 switch registered on mdio@ffe24000 [ 2.172247] fsl-gianfar soc@ffe00000:ethernet@b0000: enabled errata workarounds, flags: 0x4 [ 2.190865] fsl-gianfar soc@ffe00000:ethernet@b0000 eth0: mac: 64:66:b3:de:ef:b5 [ 2.198279] fsl-gianfar soc@ffe00000:ethernet@b0000 eth0: Running with NAPI enabled [ 2.205938] fsl-gianfar soc@ffe00000:ethernet@b0000 eth0: RX BD ring size for Q[0]: 256 [ 2.213943] fsl-gianfar soc@ffe00000:ethernet@b0000 eth0: TX BD ring size for Q[0]: 256 [ 2.222085] ucc_geth_driver: QE UCC Gigabit Ethernet Controller [ 2.228348] mpc-i2c ffe03000.i2c: timeout 1000000 us [ 2.233478] mpc-i2c ffe03100.i2c: timeout 1000000 us [ 2.238655] booke_wdt: powerpc book-e watchdog driver loaded [ 2.245056] NET: Registered protocol family 10 [ 2.252175] Segment Routing with IPv6 [ 2.255930] NET: Registered protocol family 17 [ 2.260423] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this. [ 2.273380] 8021q: 802.1Q VLAN Support v1.8 [ 2.277594] drmem: No dynamic reconfiguration memory found [ 2.284915] hctosys: unable to open rtc device (rtc0) [ 2.292470] random: fast init done [ 2.296939] VFS: Mounted root (squashfs filesystem) readonly on device 31:4. [ 2.304457] Freeing unused kernel memory: 152K [ 2.308977] Run /sbin/init as init process [ 2.455912] random: crng init done [ 2.647785] init: Console is alive [ 2.651370] init: - watchdog - [ 3.261050] kmodloader: loading kernel modules from /etc/modules-boot.d/* [ 3.313790] usbcore: registered new interface driver usbfs [ 3.319383] usbcore: registered new interface driver hub [ 3.324756] usbcore: registered new device driver usb [ 3.332697] Button Hotplug driver version 0.4.1 [ 3.338789] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver [ 3.346186] ehci-fsl: Freescale EHCI Host controller driver [ 3.352622] ehci-platform: EHCI generic platform driver [ 3.358987] fsl-ehci fsl-ehci.0: Freescale On-Chip EHCI Host Controller [ 3.365658] fsl-ehci fsl-ehci.0: new USB bus registered, assigned bus number 1 [ 3.382758] fsl-ehci fsl-ehci.0: irq 28, io mem 0xffe22000 [ 3.401809] fsl-ehci fsl-ehci.0: USB 2.0 started, EHCI 1.00 [ 3.407883] hub 1-0:1.0: USB hub found [ 3.411853] hub 1-0:1.0: 1 port detected [ 3.419233] input: buttons as /devices/platform/buttons/input/input0 [ 3.426617] kmodloader: done loading kernel modules from /etc/modules-boot.d/* [ 3.436193] init: - preinit - [ 3.737167] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready [ 3.758397] usb 1-1: new high-speed USB device number 2 using fsl-ehci [ 3.923847] hub 1-1:1.0: USB hub found [ 3.927970] hub 1-1:1.0: 4 ports detected [ 4.770063] fsl-gianfar soc@ffe00000:ethernet@b0000 eth0: Link is Up - 1Gbps/Full - flow control off [ 4.779305] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready [ 6.853972] mount_root: jffs2 not ready yet, using temporary tmpfs overlay [ 6.870228] urandom-seed: Seed file not found (/etc/urandom.seed) [ 6.928116] procd: - early - [ 6.931594] procd: - watchdog - [ 7.757536] procd: - watchdog - [ 7.760874] procd: - ubus - [ 7.815163] procd: - init - [ 8.096689] kmodloader: loading kernel modules from /etc/modules.d/* [ 8.128753] Loading modules backported from Linux version v4.19.32-0-g3a2156c839c7 [ 8.136359] Backport generated by backports.git v4.19.32-1-0-g1c4f7569 [ 8.177551] urngd: v1.0.0 started. [ 8.184950] xt_time: kernel timezone is -0000 [ 8.284527] PPP generic driver version 2.4.2 [ 8.294397] NET: Registered protocol family 24 [ 8.349469] ath9k 9000:01:00.0: Direct firmware load for pci_wmac0.eeprom failed with error -2 [ 8.358114] ath9k 9000:01:00.0: Falling back to syfs fallback for: pci_wmac0.eeprom [ 8.510336] ath: EEPROM regdomain: 0x0 [ 8.510343] ath: EEPROM indicates default country code should be used [ 8.510345] ath: doing EEPROM country->regdmn map search [ 8.510354] ath: country maps to regdmn code: 0x3a [ 8.510357] ath: Country alpha2 being used: US [ 8.510359] ath: Regpair used: 0x3a [ 8.519210] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht' [ 8.520466] ieee80211 phy0: Atheros AR9300 Rev:4 mem=0xc9660000, irq=17 [ 8.527800] ath9k a000:03:00.0: Direct firmware load for pci_wmac1.eeprom failed with error -2 [ 8.536453] ath9k a000:03:00.0: Falling back to syfs fallback for: pci_wmac1.eeprom [ 8.876210] ath: EEPROM regdomain: 0x0 [ 8.876217] ath: EEPROM indicates default country code should be used [ 8.876219] ath: doing EEPROM country->regdmn map search [ 8.876228] ath: country maps to regdmn code: 0x3a [ 8.876231] ath: Country alpha2 being used: US [ 8.876233] ath: Regpair used: 0x3a [ 8.885110] ieee80211 phy1: Selected rate control algorithm 'minstrel_ht' [ 8.886374] ieee80211 phy1: Atheros AR9300 Rev:3 mem=0xc96a0000, irq=18 [ 8.914046] kmodloader: done loading kernel modules from /etc/modules.d/* [ 20.312377] jffs2_scan_eraseblock(): End of filesystem marker found at 0x0 [ 20.333857] jffs2_build_filesystem(): unlocking the mtd device... [ 20.333865] done. [ 20.341981] jffs2_build_filesystem(): erasing all blocks after the end marker... [ 21.524469] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready [ 21.582541] br-lan: port 1(eth0.1) entered blocking state [ 21.587965] br-lan: port 1(eth0.1) entered disabled state [ 21.593602] device eth0.1 entered promiscuous mode [ 21.598407] device eth0 entered promiscuous mode [ 21.662418] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready [ 21.721320] IPv6: ADDRCONF(NETDEV_UP): eth0.2: link is not ready [ 22.562086] fsl-gianfar soc@ffe00000:ethernet@b0000 eth0: Link is Up - 1Gbps/Full - flow control off [ 22.571347] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready [ 22.578996] br-lan: port 1(eth0.1) entered blocking state [ 22.584430] br-lan: port 1(eth0.1) entered forwarding state [ 22.590479] IPv6: ADDRCONF(NETDEV_CHANGE): eth0.2: link becomes ready [ 22.628350] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready [ 47.444238] done. [ 47.446196] jffs2: notice: (2260) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found. [ 47.590629] overlayfs: upper fs does not support tmpfile.
QEMU test environment
In case you are interested to run a virtual test environment for your PPC based WDR4900 platform QEMU is a good helper. It cannot run the downloadable kernel image but at least a slightly modfied version. Here are the basic steps to get a initial setup up and runnung.
Install QEMU for your Linux distribution. It should be at least 2.1.2. The process was only tested with that version. Create a buildroot environment. If you do not want to read every single bit of information over there use these commands. We assume that we only want to build the stable Barrier Breaker version.
# cd ~ # mkdir buildroot # cd buildroot # git clone git://git.openwrt.org/14.07/openwrt.git # cd openwrt # ./scripts/feeds update -a # ./scripts/feeds install -a
Select your target platform
# make menuconfig Target System -> Freescale MPC85xx [*]
Save changes and leave setup. Create the default configuration for the platform
# make defconfig
Activate some essential buildroot configuration options.
# make menuconfig Target images -> ramdisk [*] Kernel modules -> filesystems -> kmod-fs-ext4 [*]
Save changes and leave setup. Now head over to kernel configuration and define critical settings that the kernel can run inside QEMU.
# make kernel_menuconfig Platform support -> Freescale machine type -> qemu generic platform [*] device drivers -> character devices -> serial drivers -> serial port on open plaform bus [ ]
If you miss one of the two your VM will not boot or have no accessible console. Have a look the open firmware serial bus must be disabled!. Additionally we should enable drivers to access QEMU disks and network cards
device drivers -> virtio drivers -> activate all menu items [*] device drivers -> block devices -> Virtio block driver [*] device drivers -> network device support -> virtio network driver [*]
Create the kernel image with
make -j 8
Finally we have a standalone kernel image with an initial root ramdisk included. So we could already start the VM. To get into better shape create a separate folder to hold the image and create a QCOW2 disk with a single ext4 filesystem that can be mounted inside the VM.
# cd ~ # mkdir vm # cd vm # cp ~/buildroot/openwrt/bin/mpc85xx/openwrt-mpc85xx-generic-zImage . # qemu-img create -f qcow2 hdd.qcow2 4G # su # modprobe nbd max_part=8 # qemu-nbd --connect=/dev/nbd0 ./hdd.qcow2 # fdisk /dev/nbd0 (... create partition ...) # mkfs.ext4 /dev/nbd0p1 # qemu-nbd --disconnect /dev/nbd0 # exit
This is what our VM folder should look like now:
ls -al ~/vm drwx------. 7 e500 e500 4096 24. Dez 10:02 . drwxr-xr-x. 6 e500 e500 4096 18. Dez 20:31 .. -rw-r--r--. 1 e500 e500 136839168 24. Dez 10:03 hdd.qcow2 -rw-r--r--. 1 e500 e500 4360017 24. Dez 09:46 openwrt-mpc85xx-generic-zImage
Now the VM is ready to start.
qemu-system-ppc -kernel ~/vm/openwrt-mpc85xx-generic-zImage \ -nographic -append "console=ttyS0" -m 1024 -M ppce500 \ -drive file=~/vm/hdd.qcow2,if=virtio