嵌入式Linux在Zynq-Device上的意外崩溃(Zybo)

时间:2016-10-18 10:16:13

标签: linux linux-kernel embedded-linux xilinx zynq

我们按照wiki-xilinx-linux web page的说明创建了一个系统Zybo +嵌入式Linux内核(我想说我们没有使用PetaLinux,但是我们用Xilinx工具构建了所有文件) 。 当我们打开系统时,一切正常,这是启动时的输出:

 U-Boot 2016.07-03720-g95e11f6-dirty (Oct 17 2016 - 02:56:48 -0700)

Model: Zynq ZYBO Development Board
Board: Xilinx Zynq
I2C:   ready
DRAM:  ECC disabled 512 MiB
MMC:   sdhci@e0100000: 0
SF: Detected S25FL128S_64K with page size 256 Bytes, erase size 64 KiB, total 16 MiB
*** Warning - bad CRC, using default environment

In:    serial@e0001000
Out:   serial@e0001000
Err:   serial@e0001000
Model: Zynq ZYBO Development Board
Board: Xilinx Zynq
Net:   ZYNQ GEM: e000b000, phyaddr 0, interface rgmii-id
I2C EEPROM MAC address read failed
eth0: ethernet@e000b000
Hit any key to stop autoboot:  0 
Device: sdhci@e0100000
Manufacturer ID: 3
OEM: 8368
Name: NCard 
Tran Speed: 50000000
Rd Block Len: 512
SD version 3.0
High Capacity: Yes
Capacity: 3.7 GiB
Bus Width: 4-bit
Erase Group Size: 512 Bytes
reading uEnv.txt
** Unable to read file uEnv.txt **
Copying Linux from SD to RAM...
reading uImage
3843104 bytes read in 367 ms (10 MiB/s)
reading devicetree.dtb
10331 bytes read in 17 ms (592.8 KiB/s)
reading uramdisk.image.gz
5310018 bytes read in 504 ms (10 MiB/s)
## Booting kernel from Legacy Image at 02080000 ...
   Image Name:   Linux-4.6.0-xilinx-22285-g0e4e40
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3843040 Bytes = 3.7 MiB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 04000000 ...
   Image Name:   
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    5309954 Bytes = 5.1 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 02000000
   Booting using the fdt blob at 0x2000000
   Loading Kernel Image ... OK
   Loading Ramdisk to 1e601000, end 1eb11602 ... OK
   Loading Device Tree to 1e5fb000, end 1e60085a ... OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0x0
Linux version 4.6.0-xilinx-22285-g0e4e407-dirty (leonardo@ubuntu) (gcc version 4.9.2 (Sourcery CodeBench Lite 2015.05-17) ) #1 SMP PREEMPT Mon Oct 17 03:54:44 PDT 2016
CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: xlnx,zynq-7000
bootconsole [earlycon0] enabled
cma: Reserved 16 MiB at 0x1f000000
Memory policy: Data cache writealloc
percpu: Embedded 12 pages/cpu @debcc000 s19776 r8192 d21184 u49152
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 130048
Kernel command line: console=ttyPS0,115200 root=/dev/mmcblk0p2 rw earlyprintk rootfstype=ext4 rootwait devtmpfs.mount=1
PID hash table entries: 2048 (order: 1, 8192 bytes)
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Memory: 489332K/524288K available (5304K kernel code, 230K rwdata, 1844K rodata, 1024K init, 222K bss, 18572K reserved, 16384K cma-reserved, 0K highmem)
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
    vmalloc : 0xe0800000 - 0xff800000   ( 496 MB)
    lowmem  : 0xc0000000 - 0xe0000000   ( 512 MB)
    pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
    modules : 0xbf000000 - 0xbfe00000   (  14 MB)
      .text : 0xc0008000 - 0xc07fb004   (8141 kB)
      .init : 0xc0800000 - 0xc0900000   (1024 kB)
      .data : 0xc0900000 - 0xc0939b60   ( 231 kB)
       .bss : 0xc0939b60 - 0xc09714e8   ( 223 kB)
Preemptible hierarchical RCU implementation.
    Build-time adjustment of leaf fanout to 32.
    RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
RCU: Adjusting geometry for rcu_fanout_leaf=32, nr_cpu_ids=2
NR_IRQS:16 nr_irqs:16 16
efuse mapped to e0800000
slcr mapped to e0802000
L2C: platform modifies aux control register: 0x72360000 -> 0x72760000
L2C: DT/platform modifies aux control register: 0x72360000 -> 0x72760000
L2C-310 erratum 769419 enabled
L2C-310 enabling early BRESP for Cortex-A9
L2C-310 full line of zeros enabled for Cortex-A9
L2C-310 ID prefetch enabled, offset 1 lines
L2C-310 dynamic clock gating enabled, standby mode enabled
L2C-310 cache controller enabled, 8 ways, 512 kB
L2C-310: CACHE_ID 0x410000c8, AUX_CTRL 0x76760001
zynq_clock_init: clkc starts at e0802100
Zynq clock init
sched_clock: 64 bits at 325MHz, resolution 3ns, wraps every 4398046511103ns
clocksource: arm_global_timer: mask: 0xffffffffffffffff max_cycles: 0x4af477f6aa, max_idle_ns: 440795207830 ns
Switching to timer-based delay loop, resolution 3ns
clocksource: ttc_clocksource: mask: 0xffff max_cycles: 0xffff, max_idle_ns: 551318127 ns
timer #0 at e080a000, irq=17
Console: colour dummy device 80x30
Calibrating delay loop (skipped), value calculated using timer frequency.. 650.00 BogoMIPS (lpj=3250000)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
CPU: Testing write buffer coherency: ok
CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
Setting up static identity map for 0x100000 - 0x100058
CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
Brought up 2 CPUs
SMP: Total of 2 processors activated (1300.00 BogoMIPS).
CPU: All CPU(s) started in SVC mode.
devtmpfs: initialized
VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
pinctrl core: initialized pinctrl subsystem
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
cpuidle: using governor menu
hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.
hw-breakpoint: maximum watchpoint size is 4 bytes.
zynq-ocm f800c000.ocmc: ZYNQ OCM pool: 256 KiB @ 0xe0880000
zynq-pinctrl 700.pinctrl: zynq pinctrl initialized
vgaarb: loaded
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
media: Linux media interface: v0.10
Linux video capture interface: v2.00
pps_core: LinuxPPS API ver. 1 registered
pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
PTP clock support registered
EDAC MC: Ver: 3.0.0
Advanced Linux Sound Architecture Driver Initialized.
clocksource: Switched to clocksource arm_global_timer
NET: Registered protocol family 2
TCP established hash table entries: 4096 (order: 2, 16384 bytes)
TCP bind hash table entries: 4096 (order: 3, 32768 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
UDP hash table entries: 256 (order: 1, 8192 bytes)
UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
Trying to unpack rootfs image as initramfs...
rootfs image is not initramfs (no cpio magic); looks like an initrd
Freeing initrd memory: 5188K (de601000 - deb12000)
hw perfevents: enabled with armv7_cortex_a9 PMU driver, 7 counters available
futex hash table entries: 512 (order: 3, 32768 bytes)
workingset: timestamp_bits=28 max_order=17 bucket_order=0
jffs2: version 2.2. (NAND) (SUMMARY)  © 2001-2006 Red Hat, Inc.
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
dma-pl330 f8003000.dmac: Loaded driver for PL330 DMAC-241330
dma-pl330 f8003000.dmac:    DBUFF-128x8bytes Num_Chans-8 Num_Peri-4 Num_Events-16
e0001000.serial: ttyPS0 at MMIO 0xe0001000 (irq = 143, base_baud = 6250000) is a xuartps
�console [ttyPS0] enabled
console [ttyPS0] enabled
bootconsole [earlycon0] disabled
bootconsole [earlycon0] disabled
xdevcfg f8007000.devcfg: ioremap 0xf8007000 to e086c000
[drm] Initialized drm 1.1.0 20060810
brd: module loaded
loop: module loaded
CAN device driver interface
libphy: MACB_mii_bus: probed
macb e000b000.ethernet eth0: Cadence GEM rev 0x00020118 at 0xe000b000 irq 145 (00:0a:35:00:01:22)
RTL8211E Gigabit Ethernet e000b000.etherne:00: attached PHY driver [RTL8211E Gigabit Ethernet] (mii_bus:phy_addr=e000b000.etherne:00, irq=-1)
e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k
e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci-pci: EHCI PCI platform driver
usbcore: registered new interface driver usb-storage
mousedev: PS/2 mouse device common for all mice
i2c /dev entries driver
EDAC MC: ECC not enabled
Xilinx Zynq CpuIdle Driver started
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
sdhci-pltfm: SDHCI platform and OF driver helper
mmc0: SDHCI controller on e0100000.sdhci [e0100000.sdhci] using DMA
ledtrig-cpu: registered to indicate activity on CPUs
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
NET: Registered protocol family 10
sit: IPv6 over IPv4 tunneling driver
NET: Registered protocol family 17
can: controller area network core (rev 20120528 abi 9)
NET: Registered protocol family 29
can: raw protocol (rev 20120528)
can: broadcast manager protocol (rev 20120528 t)
can: netlink gateway (rev 20130117) max_hops=1
Registering SWP/SWPB emulation handler
hctosys: unable to open rtc device (rtc0)
ALSA device list:
mmc0: new high speed SDHC card at address b368
  No soundcards found.
mmcblk0: mmc0:b368 NCard 3.72 GiB 
 mmcblk0: p1 p2
RAMDISK: gzip image found at block 0
EXT4-fs warning (device ram0): ext4_update_dynamic_rev:746: updating to rev 1 because of new feature flag, running e2fsck is recommended
EXT4-fs (ram0): mounted filesystem without journal. Opts: (null)
VFS: Mounted root (ext4 filesystem) on device 1:0.
Starting rcS...
++ Mounting filesystem
mount: mounting /dev/mmcblk0p1 on /mnt failed: No such file or directory
mount: mounting /dev/mmcblk0 on /mnt failed: No such file or directory
++ Setting up mdev
++ Starting telnet daemon
++ Starting http daemon
++ Starting ftp daemon
++ Starting ssh daemon
random: sshd urandom read with 1 bits of entropy available
rcS Complete
zynq> 
zynq> 
zynq> 

问题在于,经过一些指示后,系统会因此输出而崩溃:

zynq> EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
VFS: Mounted root (ext4 filesystem) on device 179:2.
Trying to move old root to /initrd ... /initrd does not exist. Ignored.
Unmounting old root
Trying to free ramdisk memory ... failed
devtmpfs: error mounting -2
Unable to handle kernel NULL pointer dereference at virtual address 00000020
pgd = c0004000
[00000020] *pgd=00000000
Internal error: Oops - BUG: 17 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 0 PID: 10 Comm: migration/0 Not tainted 4.6.0-xilinx-22285-g0e4e407-dirty #1
Hardware name: Xilinx Zynq Platform
task: de060040 ti: de06a000 task.ti: de06a000
PC is at set_section_perms+0x8c/0x110
LR is at set_section_perms+0x18/0x110
pc : [<c0113404>]    lr : [<c0113390>]    psr: 80000093
sp : de06bec0  ip : dc4f3018  fp : 00000600
r10: 00000000  r9 : 00000000  r8 : 00000001
r7 : 00000003  r6 : c0902468  r5 : 00000000  r4 : c0908508
r3 : 00000000  r2 : c0000000  r1 : 00000003  r0 : 00000009
Flags: Nzcv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment none
Control: 18c5387d  Table: 1c4f804a  DAC: 00000051
Process migration/0 (pid: 10, stack limit = 0xde06a210)
Stack: (0xde06bec0 to 0xde06c000)
bec0: c0908508 00000003 00000001 de0db780 de0db780 de0db998 00000003 c0908508
bee0: c09065c0 00000000 00000000 c01134f4 de04df70 00000001 a0000013 de04df84
bf00: 00000003 00000000 00000000 c011355c c011354c c017c420 de04df30 debccf64
bf20: de06a000 debccf68 00000000 c017c4f8 c017c478 de06a000 de02db40 c090cd94
bf40: 00000001 c0135454 de060040 de02d9c0 00000000 de02db40 c0135218 00000000
bf60: 00000000 c0132a40 4dff1176 00000001 00000000 de02db40 00000000 00030003
bf80: de06bf80 de06bf80 00000000 00000000 de06bf90 de06bf90 de06bfac de02d9c0
bfa0: c0132968 00000000 00000000 c0106ef8 00000000 00000000 00000000 00000000
bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
bfe0: 00000000 00000000 00000000 00000000 00000013 00000000 dfefe0f2 77e519c8
[<c0113404>] (set_section_perms) from [<c01134f4>] (update_sections_early+0x6c/0xc4)
[<c01134f4>] (update_sections_early) from [<c011355c>] (__fix_kernmem_perms+0x10/0x1c)
[<c011355c>] (__fix_kernmem_perms) from [<c017c420>] (multi_cpu_stop+0xb0/0x108)
[<c017c420>] (multi_cpu_stop) from [<c017c4f8>] (cpu_stopper_thread+0x80/0xb0)
[<c017c4f8>] (cpu_stopper_thread) from [<c0135454>] (smpboot_thread_fn+0x23c/0x254)
[<c0135454>] (smpboot_thread_fn) from [<c0132a40>] (kthread+0xd8/0xec)
[<c0132a40>] (kthread) from [<c0106ef8>] (ret_from_fork+0x14/0x3c)
Code: e1520003 2a00001b e5943014 e1a0baa2 (e599a020) 
---[ end trace 07a0838423ee7708 ]---
note: migration/0[10] exited with preempt_count 2

很明显,&#34;挂载文件系统&#34;:

出错
zynq> EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
VFS: Mounted root (ext4 filesystem) on device 179:2.
Trying to move old root to /initrd ... /initrd does not exist. Ignored.
Unmounting old root
Trying to free ramdisk memory ... failed
devtmpfs: error mounting -2

为什么会这样?为什么在我能用系统做所有事情之前,我突然崩溃了?是的,当我对它做任何事情而不是我正在使用它时,系统崩溃了。 有什么建议可以解决这个问题吗?为了不再有这些崩溃?

1 个答案:

答案 0 :(得分:1)

在Linux内核命令行中,我可以看到“root=/dev/mmcblk0p2”,并且目标也是以初始ramdisk映像“uramdisk.image.gz”启动的。因此,ramdisk映像中的init进程或脚本应负责从SD安装真实文件系统,即从/ dev / mmcblk0p2安装,并删除ramdisk的已用内存。要缩小问题范围,您需要分析ramdisk映像中用于挂载实际文件系统的步骤,并确保在/ dev / mmcblk0p2中的SD内部闪烁正确的RFS。我还可以看到一些缺少目录来挂载/ dev / mmcblk0p1和/ dev / mmcblk0。

++ Mounting filesystem
mount: mounting /dev/mmcblk0p1 on /mnt failed: No such file or directory
mount: mounting /dev/mmcblk0 on /mnt failed: No such file or directory

简单来说,检查ramdisk映像中的init脚本,确保正确安装RFS。