zyboをJTAGブートする

ここを参考に
http://www.wiki.xilinx.com/Prepare+Boot+Medium

zyboのイメージはこれを使った(ちなみにカーネルはPetalinuxだった)
https://github.com/ucb-bar/fpga-images-zybo

ハードウェアの準備

1. ZYBOのジャンパをJTAGにする
2. ZYBOの電源をONにする
3. Programe FPGAから.bitを一度書いておく(これをやっとくとうまくいくことが多い)
4. XilinxプラットフォームケーブルをZYBOのJTAGピンに挿す(ピンヘッダはあらかじめはんだ付けしておく)

5. XilinxプラットフォームケーブルをPCのUSBポートに挿す(ライトがオレンジに点滅する)

Xilinx SDK上での作業

1. Xilinx Tools>XSCT Consoleを選択してXSCT Consoleを開く

2.XMDコマンドを入力して、XMDプロンプトに入る
3. 以下を実行する 

xmd% connect arm hw
xmd% dow fsbl.elf

xmd% con
(...少し待つ)
xmd% stop
→これをやらないとDDRがResetしてるとかのエラーがでる)

xmd% dow -data devicetree.dtb 0x2a00000
xmd% dow -data uramdisk.image.gz 0x2000000
xmd% dow -data uImage 0x3000000
xmd% dow u-boot
xmd% con

4. 上のconを実行すると、u-bootが起動する。
シリアルコンソールをZYBOにつなげると、u-bootプロンプトが表示される。
5. u-bootで以下を入力してLinuxを起動する

u-boot> bootm 0x3000000 0x2000000 0x2a000000
zynq-uboot> bootm 0x3000000 0x2000000 0x2a00000
## Booting kernel from Legacy Image at 03000000 ...
   Image Name:   Linux-3.15.0-xilinx-06044-g6fd59
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3386680 Bytes = 3.2 MiB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 02000000 ...
   Image Name:
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    8162373 Bytes = 7.8 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 02a00000
   Booting using the fdt blob at 0x2a00000
   Loading Kernel Image ... OK
   Loading Ramdisk to 0eb7d000, end 0f345c45 ... OK
   Loading Device Tree to 0eb78000, end 0eb7cd41 ... OK

Starting kernel ...

Booting Linux on physical CPU 0x0
Linux version 3.15.0-xilinx-06044-g6fd59fe (dsoung@a8) (gcc version 4.9.2 (Sourcery CodeBench Lite 2015.05-17) ) #1 SMP PREEMPT Fri Jul 8 13:08:02 PDT 2016
CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: Xilinx Zynq
cma: CMA: reserved 128 MiB at 06800000
Memory policy: Data cache writealloc
PERCPU: Embedded 8 pages/cpu @cfda2000 s9088 r8192 d15488 u32768
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 65024
Kernel command line: console=ttyPS0,115200 root=/dev/ram rw earlyprintk
PID hash table entries: 1024 (order: 0, 4096 bytes)
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 113644K/262144K available (4596K kernel code, 233K rwdata, 1568K rodata, 196K init, 196K bss, 148500K reserved, 0K highmem)
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    vmalloc : 0xd0800000 - 0xff000000   ( 744 MB)
    lowmem  : 0xc0000000 - 0xd0000000   ( 256 MB)
    pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
    modules : 0xbf000000 - 0xbfe00000   (  14 MB)
      .text : 0xc0008000 - 0xc060d41c   (6166 kB)
      .init : 0xc060e000 - 0xc063f380   ( 197 kB)
      .data : 0xc0640000 - 0xc067a7a0   ( 234 kB)
       .bss : 0xc067a7ac - 0xc06ab9cc   ( 197 kB)
Preemptible hierarchical RCU implementation.
        Dump stacks of tasks blocking RCU-preempt GP.
        RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
NR_IRQS:16 nr_irqs:16 16
ps7-slcr mapped to d0802000
zynq_clock_init: clkc starts at d0802100
Zynq clock init
sched_clock: 16 bits at 52kHz, resolution 18904ns, wraps every 1238917140ns
ps7-ttc #0 at d0804000, irq=43
Console: colour dummy device 80x30
Calibrating delay loop... 1292.69 BogoMIPS (lpj=6463488)
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 0x45bef8 - 0x45bf50
L310 cache controller enabled
l2x0: 8 ways, CACHE_ID 0x410000c8, AUX_CTRL 0x72760000, Cache size: 512 kB
CPU1: Booted secondary processor
CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
Brought up 2 CPUs
SMP: Total of 2 processors activated.
CPU: All CPU(s) started in SVC mode.
devtmpfs: initialized
VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
regulator-dummy: no parameters
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
cpuidle: using governor ladder
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.ps7-ocmc: ZYNQ OCM pool: 256 KiB @ 0xd0880000
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.
Switched to clocksource ttc_clocksource
NET: Registered protocol family 2
TCP established hash table entries: 2048 (order: 1, 8192 bytes)
TCP bind hash table entries: 2048 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP: reno registered
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...
Freeing initrd memory: 7968K (ceb7d000 - cf345000)
hw perfevents: enabled with ARMv7 Cortex-A9 PMU driver, 7 counters available
futex hash table entries: 512 (order: 3, 32768 bytes)
jffs2: version 2.2. (NAND) (SUMMARY)  ゥ 2001-2006 Red Hat, Inc.
msgmni has been set to 493
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
dma-pl330 f8003000.ps7-dma: Loaded driver for PL330 DMAC-2364208
dma-pl330 f8003000.ps7-dma:     DBUFF-128x8bytes Num_Chans-8 Num_Peri-4 Num_Events-16
e0001000.serial: ttyPS0 at MMIO 0xe0001000 (irq = 82, base_baud = 6250000) is a xuartps
console [ttyPS0] enabled
xdevcfg f8007000.ps7-dev-cfg: ioremap 0xf8007000 to d0868000
[drm] Initialized drm 1.1.0 20060810
brd: module loaded
loop: module loaded
m25p80 spi0.0: found s25fl129p1, expected n25q128
m25p80 spi0.0: s25fl129p1 (16384 Kbytes)
4 ofpart partitions found on MTD device spi0.0
Creating 4 MTD partitions on "spi0.0":
0x000000000000-0x000000400000 : "qspi-fsbl-uboot"
0x000000400000-0x000000900000 : "qspi-linux"
0x000000900000-0x000000920000 : "qspi-device-tree"
0x000000920000-0x000001000000 : "qspi-user"
e1000e: Intel(R) PRO/1000 Network Driver - 2.3.2-k
e1000e: Copyright(c) 1999 - 2014 Intel Corporation.
libphy: XEMACPS mii bus: probed
xemacps e000b000.ps7-ethernet: invalid address, use assigned
xemacps e000b000.ps7-ethernet: MAC updated 32:0d:56:f3:14:2f
xemacps e000b000.ps7-ethernet: pdev->id -1, baseaddr 0xe000b000, irq 54
uio_pdrv_genirq 43c00000.htif: failed to get IRQ
uio_pdrv_genirq: probe of 43c00000.htif failed with error -22
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci-pci: EHCI PCI platform driver
ULPI transceiver vendor/product ID 0x0424/0x0007
Found SMSC USB3320 ULPI transceiver.
ULPI integrity check: passed.
zynq-ehci zynq-ehci.0: Xilinx Zynq USB EHCI Host Controller
zynq-ehci zynq-ehci.0: new USB bus registered, assigned bus number 1
zynq-ehci zynq-ehci.0: irq 53, io mem 0x00000000
zynq-ehci zynq-ehci.0: USB 2.0 started, EHCI 1.00
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
usbcore: registered new interface driver usb-storage
mousedev: PS/2 mouse device common for all mice
i2c /dev entries driver
zynq-edac f8006000.ps7-ddrc: ecc not enabled
cpufreq_cpu0: failed to get cpu0 regulator: -19
cpufreq: __cpufreq_add_dev: CPU0: Running at unlisted freq: 650000 KHz
cpufreq: __cpufreq_add_dev: CPU0: Unlisted initial frequency changed to: 666667 KHz
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: no vqmmc regulator found
mmc0: no vmmc regulator found
mmc0: SDHCI controller on e0100000.ps7-sdio [e0100000.ps7-sdio] using ADMA
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
TCP: cubic registered
NET: Registered protocol family 17
Registering SWP/SWPB emulation handler
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
ALSA device list:
  No soundcards found.
Freeing unused kernel memory: 196K (c060e000 - c063f000)
INIT:  mmcblk0: p1 SDU1  14.6 GiB address 59b4
version 2.88 booting
Starting Bootlog daemon: bootlogd.
Creating /dev/flash/* device nodes
random: dd urandom read with 10 bits of entropy available
FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
Configuring network interfaces... done.
starting Busybox inet Daemon: inetd... done.
INIT: Entering runlevel: 5
Starting Dropbear SSH server: dropbear.
Stopping Bootlog daemon: bootlogd.
Starting tcf-agent: OK

 _____       _           _      _
| ___ \     | |         | |    (_)
| |_/ / ___ | |_   __ _ | |     _  _ __   _   _ __  __
|  __/ / _ \| __| / _` || |    | || '_ \ | | | |\ \/ /
| |   |  __/| |_ | (_| || |____| || | | || |_| | >  <
\_|    \___| \__| \__,_|\_____/|_||_| |_| \__,_|/_/\_\

PetaLinux v2013.10 (Yocto 1.4) zynq ttyPS0

zynq login: