在ZC702上运行Linux(1) - 运行Pre-built images

Xilinx针对ZC702提供了Linux Porting。参考文档在http://wiki.xilinx.com/源码在http://git.xilinx.com/ 拿到板子的第一步当然是先跑一下Pre-built images看看,一者可以验证板子好坏,再者可以看看Linux已经完成了那些功能,做到了哪一步。毕竟,站在巨人的肩膀上才能看的更高,走的更远。 最新的Pre-built images在http://wiki.xilinx.com/zynq-release-14-3拷贝以下文件到SD卡上,SW16配置成00110,就可以在ZC702上启动Linux了。BOOT.BINdevicetree.dtbuImageuramdisk.image.gz 串口上的输出如下:  U-Boot 2012.04.01-00304-g7639205 (Oct 23 2012 - 08:29:31) DRAM:  1 GiBWARNING: Caches not enabledMMC:   SDHCI: 0Using default environment In:    serialOut:   serialErr:   serialNet:   zynq_gemHit any key to stop autoboot:  0Copying Linux from SD to RAM...Device: SDHCIManufacturer ID: 3OEM: 5344Name: SU08GTran Speed: 25000000Rd Block Len: 512SD version 2.0High Capacity: YesCapacity: 7.4 GiBBus Width: 4-bitreading uImage 2725416 bytes readreading devicetree.dtb 4366 bytes readreading uramdisk.image.gz 5252253 bytes read## Booting kernel from Legacy Image at 03000000 ...   Image Name:   Linux-3.5.0-14.3-build2   Created:      2012-10-23  18:12:23 UTC   Image Type:   ARM Linux Kernel Image (uncompressed)   Data Size:    2725352 Bytes = 2.6 MiB   Load Address: 00008000   Entry Point:  00008000   Verifying Checksum ... OK## Loading init Ramdisk from Legacy Image at 02000000 ...   Image Name:   Created:      2012-10-03  21:10:37 UTC   Image Type:   ARM Linux RAMDisk Image (gzip compressed)   Data Size:    5252189 Bytes = 5 MiB   Load Address: 00800000   Entry Point:  00800000   Verifying Checksum ... OK## Flattened Device Tree blob at 02a00000   Booting using the fdt blob at 0x02a00000   Loading Kernel Image ... OKOK   Loading Ramdisk to 1fafd000, end 1ffff45d ... OK   Loading Device Tree to 1faf8000, end 1fafc10d ... OK Starting kernel ... Uncompressing Linux... done, booting the kernel.Booting Linux on physical CPU 0Linux version 3.5.0-14.3-build2 (linnj@xsjpsgv107) (gcc version 4.6.1 (Sourcery CodeBench Lite 2011.09-50) ) #1 SMP PREEMPT Tue Oct 23 11:12:17 PDT 2012CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387dCPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cacheMachine: Xilinx Zynq Platform, model: Xilinx Zynq ZC702bootconsole [earlycon0] enabledcma: CMA: reserved 16 MiB at 2e800000Memory policy: ECC disabled, Data cache writeallocPERCPU: Embedded 7 pages/cpu @c0e2a000 s6784 r8192 d13696 u32768Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 259840Kernel command line: console=ttyPS0,115200 root=/dev/ram rw ip=192.168.1.10:::255.255.255.0:ZC702:eth0 earlyprintkPID hash table entries: 4096 (order: 2, 16384 bytes)Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)Memory: 1024MB = 1024MB totalMemory: 1011624k/1011624k available, 36952k reserved, 270336K highmemVirtual kernel memory layout:    vector  : 0xffff0000 - 0xffff1000   (   4 kB)    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)    vmalloc : 0xf0000000 - 0xff000000   ( 240 MB)    lowmem  : 0xc0000000 - 0xef800000   ( 760 MB)    pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)    modules : 0xbf000000 - 0xbfe00000   (  14 MB)      .text : 0xc0008000 - 0xc048e060   (4633 kB)      .init : 0xc048f000 - 0xc04b4a80   ( 151 kB)      .data &colon; 0xc04b6000 - 0xc04f3c20   ( 248 kB)       .bss : 0xc04f3c44 - 0xc051f104   ( 174 kB)Preemptible hierarchical RCU implementation.        Dump stacks of tasks blocking RCU-preempt GP.NR_IRQS:128Zynq clock initxlnx,ps7-ttc-1.00.a #0 at 0xf0000000, irq=43sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 4294967286msConsole: colour dummy device 80x30Calibrating delay loop... 1332.01 BogoMIPS (lpj=6660096)pid_max: default: 32768 minimum: 301Mount-cache hash table entries: 512CPU: Testing write buffer coherency: okCPU0: thread -1, cpu 0, socket 0, mpidr 80000000hw perfevents: enabled with ARMv7 Cortex-A9 PMU driver, 7 counters availableSetting up static identity map for 0x351160 - 0x351194L310 cache controller enabledl2x0: 8 ways, CACHE_ID 0x410000c8, AUX_CTRL 0x72360000, Cache size: 524288 BMap SLCR registersCPU1: Booted secondary processorCPU1: thread -1, cpu 1, socket 0, mpidr 80000001Brought up 2 CPUsSMP: Total of 2 processors activated (2664.03 BogoMIPS).devtmpfs: initializedNET: Registered protocol family 16DMA: preallocated 256 KiB pool for atomic coherent allocationsxgpiops e000a000.gpio: gpio at 0xe000a000 mapped to 0xf0008000registering platform device 'pl330' id 0registering platform device 'arm-pmu' id 0registering platform device 'zynq-dvfs' id 0hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.hw-breakpoint: maximum watchpoint size is 4 bytes.MIO pin 47 not assigned(00001220)xslcr xslcr.0: at 0xF8000000 mapped to 0xF8000000bio: create slab <bio-0> at 0SCSI subsystem initializedusbcore: registered new interface driver usbfsusbcore: registered new interface driver hubusbcore: registered new device driver usbLinux video capture interface: v2.00Switching to clocksource xttcpss_timer1NET: Registered protocol family 2IP route cache hash table entries: 32768 (order: 5, 131072 bytes)TCP established hash table entries: 131072 (order: 8, 1048576 bytes)TCP bind hash table entries: 65536 (order: 7, 786432 bytes)TCP: Hash tables configured (established 131072 bind 65536)TCP: reno registeredUDP hash table entries: 512 (order: 2, 16384 bytes)UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)NET: Registered protocol family 1RPC: 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 initrdFreeing initrd memory: 5128Kxscugtimer xscugtimer.0: ioremap fe00c200 to f000a200 with size 400pl330 dev 0 probe successhighmem bounce pool size: 64 pagesjffs2: version 2.2. (NAND) (SUMMARY)  © 2001-2006 Red Hat, Inc.msgmni has been set to 1489io scheduler noop registeredio scheduler deadline registeredio scheduler cfq registered (default)e00console [ttyPS0] enabled, bootconsole disabledconsole [ttyPS0] enabled, bootconsole disabledxdevcfg f8007000.devcfg: ioremap f8007000 to f005e000 with size 100brd: module loadedloop: module loadedxqspips e000d000.spi: master is unqueued, this is deprecatedm25p80 spi1.0: n25q128 (16384 Kbytes)7 ofpart partitions found on MTD device spi1.0Creating 7 MTD partitions on "spi1.0":0x000000000000-0x000000080000 : "qspi-fsbl"0x000000080000-0x000000100000 : "qspi-u-boot"0x000000100000-0x000000600000 : "qspi-linux"0x000000600000-0x000000620000 : "qspi-device-tree"0x000000620000-0x000000700000 : "qspi-user"0x000000700000-0x000000800000 : "qspi-scratch"0x000000800000-0x000001000000 : "qspi-rootfs"xqspips e000d000.spi: at 0xE000D000 mapped to 0xF0060000, irq=51GEM: BASEADDRESS hw: e000b000 virt: f0062000XEMACPS mii bus: probedeth0, pdev->id -1, baseaddr 0xe000b000, irq 54ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driverxusbps-ehci xusbps-ehci.0: Xilinx PS USB EHCI Host Controllerxusbps-ehci xusbps-ehci.0: new USB bus registered, assigned bus number 1xusbps-ehci xusbps-ehci.0: irq 53, io mem 0x00000000xusbps-ehci xusbps-ehci.0: USB 2.0 started, EHCI 1.00hub 1-0:1.0: USB hub foundhub 1-0:1.0: 1 port detectedInitializing USB Mass Storage driver...usbcore: registered new interface driver usb-storageUSB Mass Storage support registered.Xilinx PS USB Device Controller driver (Apr 01, 2011)mousedev: PS/2 mouse device common for all micei2c /dev entries driverxi2cps e0004000.i2c: 100 kHz mmio e0004000 irq 57si570 1-005d: registered si570 with default frequency 156250000 Hzsi570 1-005d: set initial output frequency 148500000 Hzi2c i2c-0: Added multiplexed i2c bus 1i2c i2c-0: Added multiplexed i2c bus 2at24 3-0054: 1024 byte 24c08 EEPROM, writable, 1 bytes/writei2c i2c-0: Added multiplexed i2c bus 3i2c i2c-0: Added multiplexed i2c bus 4rtc-pcf8563 5-0051: chip found, driver version 0.4.3rtc-pcf8563 5-0051: low voltage detected, date/time is not reliable.rtc-pcf8563 5-0051: rtc core: registered rtc-pcf8563 as rtc0i2c i2c-0: Added multiplexed i2c bus 5i2c i2c-0: Added multiplexed i2c bus 6i2c i2c-0: Added multiplexed i2c bus 7i2c i2c-0: Added multiplexed i2c bus 8pca954x 0-0074: registered 8 multiplexed busses for I2C switch pca9548gspca_main: v2.14.0 registeredusbcore: registered new interface driver uvcvideoUSB Video Class driver (1.1.1)mpcore_wdt: MPcore Watchdog Timer: 0.1. mpcore_noboot=0 mpcore_margin=60 sec (nowayout= 0)xwdtps f8005000.swdt: Xilinx Watchdog Timer at 0xf0068000 with timeout 10ssdhci: Secure Digital Host Controller Interface driversdhci: Copyright(c) Pierre Ossmansdhci-pltfm: SDHCI platform and OF driver helpermmc0: Invalid maximum block size, assuming 512 bytesmmc0: SDHCI controller on e0100000.sdhci [e0100000.sdhci] using ADMAusbcore: registered new interface driver usbhidusbhid: USB HID core driverTCP: cubic registeredNET: Registered protocol family 17VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4Registering SWP/SWPB emulation handlerrtc-pcf8563 5-0051: low voltage detected, date/time is not reliable.rtc-pcf8563 5-0051: setting system clock to 2013-07-02 06:48:15 UTC (1372747695)GEM: lp->tx_bd ee842000 lp->tx_bd_dma 2e842000 lp->tx_skb ee0f5780GEM: lp->rx_bd ee841000 lp->rx_bd_dma 2e841000 lp->rx_skb ee0f5680GEM: MAC 0x00350a00, 0x00002201, 00:0a:35:00:01:22mmc0: new high speed SDHC card at address e624mmcblk0: mmc0:e624 SU08G 7.40 GiB mmcblk0: p1 p2usb 1-1: new full-speed USB device number 2 using xusbps-ehcihub 1-1:1.0: USB hub foundhub 1-1:1.0: 4 ports detectedusb 1-1.3: new low-speed USB device number 3 using xusbps-ehciinput: PIXART USB OPTICAL MOUSE as /devices/amba.0/e0002000.usb/xusbps-ehci.0/usb1/1-1/1-1.3/1-1.3:1.0/input/input0hid-generic 0003:093A:2510.0001: input: USB HID v1.11 Mouse [PIXART USB OPTICAL MOUSE] on usb-xusbps-ehci.0-1.3/input0GEM: phydev ee386400, phydev->phy_id 0x1410e40, phydev->addr 0x7eth0, phy_addr 0x7, phy_id 0x01410e40eth0, attach [Marvell 88E1116R] phy driverIP-Config: Complete:     device=eth0, addr=192.168.1.10, mask=255.255.255.0, gw=255.255.255.255     host=ZC702, domain=, nis-domain=(none)     bootserver=255.255.255.255, rootserver=255.255.255.255, rootpath=RAMDISK: gzip image found at block 0VFS: Mounted root (ext2 filesystem) on device 1:0.devtmpfs: mountedFreeing init memory: 148KStarting rcS...++ Mounting filesystem++ Setting up mdev++ Starting telnet daemon++ Starting http daemon++ Starting ftp daemon++ Starting ssh daemonrcS Completezynq>zynq> df -hFilesystem                Size      Used Available Use% Mounted onnone                    504.5M         0    504.5M   0% /tmp/dev/mmcblk0p1            1.8G      7.9M      1.8G   0% /mntzynq> 可以看出: U-Boot是基于2012.04.01的Linux kernel版本是3.5.0GCC tool chain版本是4.6.1 对Cortex-A9,1 BogoMIPS=1 CPU MHz。双核2664.03 BogoMIPS印证了CPU的主频是667MHz。 ZC702 IP地址配置成了static: 192.168.1.10把ZC702, laptop, 和公司的Ethernet cable接到一个LanSwitch上,给VMPlayer下的Ubuntu配置了static IP: 192.168.1.20,laptop可以正常上网。ZC702和Ubuntu之间可以ping通,延迟大约在0.5-1.2ms范围内。以后跑TFTP和NFS就方便多了。网口线序自适应就是方便啊。 一些需要注意的点:1. 现在用bootm命令启动Linux,以前是用go命令。2. ramdisk的名字改成了uramdisk.image.gz (带U-Boot header),以前是ramdisk8M.image.gz3. Linux kernel缺省情况下(配置文件用的是 xilinx_zynq_defconfig) 不再把device tree硬编码在16 MB,而是在bootm命令参数里面指定。目前kernel还可以把device tree硬编码在固定地址 (16MB),但是未来有可能会移除这个特性。 已知的问题:根据wiki上的说明,ZC706用是dual QSPI,而Linux没有配置quad enable bit。解决办法是在U-BOOT阶段,用命令"sf probe"修正这个问题。 U-BOOT的配置:zynq-uboot> pribaudrate=115200bootcmd=run modebootbootdelay=3devicetree_image=devicetree.dtbethact=zynq_gemethaddr=00:0a:35:00:01:22fdt_high=0x20000000initrd_high=0x20000000ipaddr=10.10.70.102jtagboot=echo TFTPing Linux to RAM...;tftp 0x3000000 ${kernel_image};tftp 0x2A00000 ${devicetree_image};tftp 0x2000000 ${ramdisk_image};bootm 0x3000000 0x2000000 0x2A00000kernel_image=uImagekernel_size=0x140000modeboot=run sdbootnand_kernel_size=0x400000nand_ramdisk_size=0x400000nandboot=echo Copying Linux from NAND flash to RAM...;nand read 0x3000000 0x200000 ${nand_kernel_size};nand read 0x2A00000 0x700000 0x20000;echo Copying ramdisk...;nand read 0x2000000 0x900000 ${nand_ramdisk_size};bootm 0x3000000 0x2000000 0x2A00000norboot=echo Copying Linux from NOR flash to RAM...;cp 0xE2100000 0x3000000 ${kernel_size};cp 0xE2600000 0x2A00000 0x20000;echo Copying ramdisk...;cp 0xE3000000 0x2000000 ${ramdisk_size};bootm 0x3000000 0x2000000 0x2A00000qspiboot=echo Copying Linux from QSPI flash to RAM...;cp 0xFC100000 0x3000000 ${kernel_size};cp 0xFC600000 0x2A00000 0x20000;echo Copying ramdisk...;cp 0xFC800000 0x2000000 ${ramdisk_size};bootm 0x3000000 0x2000000 0x2A00000ramdisk_image=uramdisk.image.gzramdisk_size=0x200000sdboot=echo Copying Linux from SD to RAM...;mmcinfo;fatload mmc 0 0x3000000 ${kernel_image};fatload mmc 0 0x2A00000 ${devicetree_image};fatload mmc 0 0x2000000 ${ramdisk_image};bootm 0x3000000 0x2000000 0x2A00000serverip=10.10.70.101stderr=serialstdin=serialstdout=serial Environment size: 1551/65532 byteszynq-uboot> 来源:赛灵思中文社区论坛