我用 Linux 内核 4.4.7 编译了最新的 OpenWRT,并将其刷入 Netgear WNDR3700v2。这是串行端口的启动日志。
U-Boot 1.1.4 (Jan 15 2015 - 11:30:07)
AP96 (AR7161 rev 2) U-Boot
DRAM: 128 MB
Flash: Macronix MX25L12835E (16 MB)
Using default environment
Clocks: CPU:680MHz, DDR:340MHz, AHB:170MHz, Ref:40MHz
In: serial
Out: serial
Err: serial
Net: ag7100_enet_initialize...
No valid address in Flash. Using fixed MAC Address
No valid address in Flash. Using fixed MAC Address
GMAC: cfg1 0xf cfg2 0x7014
eth0: 00:03:7f:09:0b:ad
eth0 up
GMAC: cfg1 0xf cfg2 0x7014
eth1: 00:03:7f:09:0b:ad
eth1 up
eth0, eth1
Hit any key to stop autoboot: 0
### SQUASHFS loading 'image/uImage' to 0x80800000
### SQUASHFS load complete: 1376256 bytes loaded to 0x80800000
## Booting image at 80800000 ...
Image Name: MIPS OpenWrt Linux-4.4.7
Created: 2016-04-17 22:20:11 UTC
Image Type: MIPS Linux Kernel Image (lzma compressed)
Data Size: 1330577 Bytes = 1.3 MB
Load Address: 80060000
Entry Point: 80060000
Verifying Checksum at 0x80800040 ... OK
Uncompressing Kernel Image ... OK
Starting kernel ...
[ 0.000000] Linux version 4.4.7 (wesley@localhost) (gcc version 5.3.0 (OpenWrt GCC 5.3.0 r49195) ) #3 Mon Apr 18 06:37:58 UTC 2016
[ 0.000000] bootconsole [early0] enabled
[ 0.000000] CPU0 revision is: 00019374 (MIPS 24Kc)
[ 0.000000] SoC: Atheros AR7161 rev 2
[ 0.000000] Determined physical RAM map:
[ 0.000000] memory: 08000000 @ 00000000 (usable)
[ 0.000000] Initrd not found or empty - disabling initrd
[ 0.000000] No valid device tree found, continuing without
[ 0.000000] Zone ranges:
[ 0.000000] Normal [mem 0x0000000000000000-0x0000000007ffffff]
[ 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] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[ 0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 32512
[ 0.000000] Kernel command line: board=WNDR3700 mtdparts=spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,15872k(firmware),64k(art)ro console=ttyS0,115200 rootfstype=squashfs,jffs2 noinitrd
[ 0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
[ 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] Writing ErrCtl register=00000000
[ 0.000000] Readback ErrCtl register=00000000
[ 0.000000] Memory: 125204K/131072K available (2932K kernel code, 152K rwdata, 744K rodata, 260K init, 200K bss, 5868K reserved, 0K cma-reserved)
[ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] NR_IRQS:51
[ 0.000000] Clocks: CPU:680.000MHz, DDR:340.000MHz, AHB:170.000MHz, Ref:40.000MHz
[ 0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 5621354254 ns
[ 0.000008] sched_clock: 32 bits at 340MHz, resolution 2ns, wraps every 6316128254ns
[ 0.007780] Calibrating delay loop... 452.19 BogoMIPS (lpj=2260992)
[ 0.070505] pid_max: default: 32768 minimum: 301
[ 0.075225] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.081837] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.090915] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.101352] NET: Registered protocol family 16
[ 0.106751] MIPS: machine is NETGEAR WNDR3700/WNDR3800/WNDRMAC
[ 2.752903] registering PCI controller with io_map_base unset
[ 2.765999] PCI host bridge to bus 0000:00
[ 2.770151] pci_bus 0000:00: root bus resource [mem 0x10000000-0x16ffffff]
[ 2.777007] pci_bus 0000:00: root bus resource [io 0x0000]
[ 2.782574] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]
[ 2.789346] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[ 2.797331] pci 0000:00:11.0: fixup device configuration
[ 2.804098] pci 0000:00:12.0: fixup device configuration
[ 2.810875] pci 0000:00:11.0: BAR 0: assigned [mem 0x10000000-0x1000ffff]
[ 2.817657] pci 0000:00:12.0: BAR 0: assigned [mem 0x10010000-0x1001ffff]
[ 2.824462] pci 0000:00:11.0: using irq 40 for pin 1
[ 2.829416] pci 0000:00:12.0: using irq 41 for pin 1
[ 2.835081] clocksource: Switched to clocksource MIPS
[ 2.841158] NET: Registered protocol family 2
[ 2.846252] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[ 2.853221] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[ 2.859613] TCP: Hash tables configured (established 1024 bind 1024)
[ 2.866051] UDP hash table entries: 256 (order: 0, 4096 bytes)
[ 2.871887] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[ 2.878381] NET: Registered protocol family 1
[ 2.883579] futex hash table entries: 256 (order: -1, 3072 bytes)
[ 2.902548] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 2.908438] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[ 2.920214] io scheduler noop registered
[ 2.924143] io scheduler deadline registered (default)
[ 2.929696] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[ 2.936431] console [ttyS0] disabled
[ 2.960048] serial8250.0: ttyS0 at MMIO 0x18020000 (irq = 11, base_baud = 10625000) is a 16550A
[ 2.968754] console [ttyS0] enabled
[ 2.968754] console [ttyS0] enabled
[ 2.975715] bootconsole [early0] disabled
[ 2.975715] bootconsole [early0] disabled
[ 2.986372] m25p80 spi0.0: found mx25l12805d, expected m25p80
[ 2.992122] m25p80 spi0.0: mx25l12805d (16384 Kbytes)
[ 2.997236] 4 cmdlinepart partitions found on MTD device spi0.0
[ 3.003137] Creating 4 MTD partitions on "spi0.0":
[ 3.007942] 0x000000000000-0x000000050000 : "u-boot"
[ 3.014619] 0x000000050000-0x000000070000 : "u-boot-env"
[ 3.021309] 0x000000070000-0x000000ff0000 : "firmware"
[ 3.040253] 2 netgear-fw partitions found on MTD device firmware
[ 3.046298] 0x000000070000-0x0000001b6440 : "kernel"
[ 3.052382] 0x0000001b6440-0x000000ff0000 : "rootfs"
[ 3.058685] mtd: device 4 (rootfs) set to be root filesystem
[ 3.064391] 1 squashfs-split partitions found on MTD device rootfs
[ 3.070612] 0x000000410000-0x000000ff0000 : "rootfs_data"
[ 3.077349] 0x000000ff0000-0x000001000000 : "art"
[ 3.084250] Realtek RTL8366S ethernet switch driver version 0.2.2
[ 3.090429] rtl8366s rtl8366s: using GPIO pins 5 (SDA) and 7 (SCK)
[ 3.096695] rtl8366s rtl8366s: RTL8366 ver. 1 chip found
[ 3.142470] libphy: rtl8366s: probed
[ 3.466770] eth0: Atheros AG71xx at 0xb9000000, irq 4, mode:RGMII
[ 3.786924] ag71xx ag71xx.1: connected to PHY at rtl8366s:04 [uid=001cc960, driver=Generic PHY]
[ 3.796246] eth1: Atheros AG71xx at 0xba000000, irq 5, mode:RGMII
[ 3.804209] NET: Registered protocol family 10
[ 3.811932] NET: Registered protocol family 17
[ 3.816496] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.
[ 3.829205] 8021q: 802.1Q VLAN Support v1.8
[ 3.839848] VFS: Mounted root (squashfs filesystem) readonly on device 31:4.
[ 3.847744] Freeing unused kernel memory: 260K (8041f000 - 80460000)
[ 4.768274] init: Console is alive
[ 4.771859] init: - watchdog -
[ 5.751955] usbcore: registered new interface driver usbfs
[ 5.757566] usbcore: registered new interface driver hub
[ 5.762950] usbcore: registered new device driver usb
[ 5.772288] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 5.780101] ehci-platform: EHCI generic platform driver
[ 5.785453] ehci-platform ehci-platform: EHCI Host Controller
[ 5.791230] ehci-platform ehci-platform: new USB bus registered, assigned bus number 1
[ 5.799247] ehci-platform ehci-platform: irq 3, io mem 0x1b000000
[ 5.825113] ehci-platform ehci-platform: USB 2.0 started, EHCI 1.00
[ 5.832136] hub 1-0:1.0: USB hub found
[ 5.836185] hub 1-0:1.0: 2 ports detected
[ 5.842660] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 5.850013] ohci-platform: OHCI generic platform driver
[ 5.855357] ohci-platform ohci-platform: Generic Platform OHCI controller
[ 5.862157] ohci-platform ohci-platform: new USB bus registered, assigned bus number 2
[ 5.870155] ohci-platform ohci-platform: irq 14, io mem 0x1c000000
[ 5.939900] hub 2-0:1.0: USB hub found
[ 5.943895] hub 2-0:1.0: 2 ports detected
[ 5.949443] init: - preinit -
[ 6.475369] eth0: link up (1000Mbps/Full duplex)
它挂在这里几秒钟,然后一遍又一遍地自行重新启动。既然日志只提供了这些信息,我应该怎么做才能知道那里发生了什么?
顺便说一下,如果我用 4.1.20 替换 Linux 内核 4.4.7,它可以正常启动。
答案1
从 bootargs 启用调试日志以查看更多日志。 loglevel 是内核 bootargs,您可以设置相应的标志来显示更多日志。
loglevel= 所有日志级别小于控制台日志级别的内核消息都将打印到控制台。也可以使用 klogd 或其他程序更改它。日志级别定义如下:
0 (KERN_EMERG) system is unusable
1 (KERN_ALERT) action must be taken immediately
2 (KERN_CRIT) critical conditions
3 (KERN_ERR) error conditions
4 (KERN_WARNING) warning conditions
5 (KERN_NOTICE) normal but significant condition
6 (KERN_INFO) informational
7 (KERN_DEBUG) debug-level messages