読者です 読者をやめる 読者になる 読者になる

zybo でlinux

作業環境

viadoインストール

xilinxからwebインストールを落とす

chmod 777 Xilinx_Vivado_SDK_2014.4_1119_1_Lin64.bin
./Xilinx_Vivado_SDK_2014.4_1119_1_Lin64.bin

あとはウィンドウにしたがってインストール。


インストール後パスを通す。「.bashrc」の最後に以下を追加

PATH="$PATH":/opt/Xilinx/Vivado/2014.4/bin:/opt/Xilinx/DocNav:/opt/Xilinx/SD    K/2014.4/bin:/opt/Xilinx/SDK/2014.4/gnu/arm/lin/bin

zybo_base_sytemのインプリメント

とりあえず
vivadoを立ち上げて、open_projectでzybo_base_system/source/vivado/hw/zybo_bsd/zybo_bsd.xprを読み込む
bdにcritical_warningがでるが無視
myledに変える等はやらずにgenerate_bitstreamして成功

U-Boot コンパイル

オプションなのでやらなくてもいいかもしれないがやる

git clone -b master-next https://github.com/DigilentInc/u-boot-Digilent-Dev.git
cd u-boot-Digilent-Dev
make CROSS_COMPILE=arm-xilinx-linux-gnueabi- zynq_zybo_config
make CROSS_COMPILE=arm-xilinx-linux-gnueabi-
cp u-boot ../zybo_base_system/sd_image/u-boot.elf

資料だとzynq_zybo_configがzynq_ZYBO_configとなっているがこれだとエラー

Boot.bin作成

vivadoでzybo_bsdのプロジェクトを開いた状態から

  1. file→Export→Export Hardware(設定でinclude bitstreamにcheckしてOK
  2. File→Launch SDK(設定デフォルトでOK)

あとは資料とほぼ同じ。

Linux カーネルコンパイル

事前にmkimageが必要

sudo apt-get install u-boot-tools

んで

git clone -b master-next https://github.com/DigilentInc/Linux-Digilent-Dev.git
cd Linux-Digilent-Dev/ 
make ARCH=arm CROSS_COMPILE=arm-xilinx-linux-gnueabi- xilinx_zynq_defconfig
make ARCH=arm CROSS_COMPILE=arm-xilinx-linux-gnueabi-
make ARCH=arm CROSS_COMPILE=arm-xilinx-linux-gnueabi- UIMAGE_LOADADDR=0x8000 uImage

DTBを作る、RAMDISK準備

DTSファイルは編集せずそのままにしておく
RAMDISKはzedboardのプロジェクトからとってくる。
zedboad_OOB_design.zip

cp ~/Downloadshttp://www.digilentinc.com/Data/Products/ZEDBOARD/ZedBoard_OOB_Design.zip ./
mkimage -A arm -T ramdisk -c gzip -d ./ramdisk8M.image.gz uramdisk.image.gz
./scripts/dtc/dtc -I dts -O dtb -o ../devicetree.dtb arch/arm/boot/dts/zynq-zybo.dts

SDにコピー

  1. devicetree.dtb
  2. uramdisk.image.gz
  3. uImage
  4. BOOT.bin

の4つをSDにコピー

起動

ZYBOにSDをさして、ジャンパをSDに設定して電源を入れる。
ls /dev/ttyUSB*で確認して
ttyUSB0とttyUSB1ができてたが、ttyUSB1の方がコンソールだった。

sudo apt-get install minicom
sudo minicom -D/dev/ttyUSB1

リセットをして起動ログを確認

MAC Addr: 00 1E C0 AC 85 3F 


U-Boot 2014.01-00005-gc29bed9 (Dec 31 2014 - 18:29:40)

I2C:   ready
Memory: ECC disabled
DRAM:  512 MiB
MMC:   zynq_sdhci: 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
Out:   serial
Err:   serial
Net:   Gem.e000b000
Hit any key to stop autoboot:  0 
Device: zynq_sdhci
Manufacturer ID: 2
OEM: 544d
Name: SA08G 
Tran Speed: 50000000
Rd Block Len: 512
SD version 3.0
High Capacity: Yes
Capacity: 7.4 GiB
Bus Width: 4-bit
reading uEnv.txt
** Unable to read file uEnv.txt **
Copying Linux from SD to RAM...
reading uImage
3819368 bytes read in 338 ms (10.8 MiB/s)
reading devicetree.dtb
7374 bytes read in 16 ms (449.2 KiB/s)
reading uramdisk.image.gz
3694172 bytes read in 327 ms (10.8 MiB/s)
## Booting kernel from Legacy Image at 03000000 ...
   Image Name:   Linux-3.14.0-xilinx-13567-g906a2
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3819304 Bytes = 3.6 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) | 切断 | ttyUSB1                              Data Size:    3694108 Bytes = 3.5 MiBinicom 2.7 | VT102 | 切断 | ttyUSB1                              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 1f7a9000, end 1fb2ee1c ... OK
   Loading Device Tree to 1f7a4000, end 1f7a8ccd ... OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 3.14.0-xilinx-13567-g906a2c9 (ippei@ippei-ThinkPad-T440s) (gcc version 44
[    0.000000] CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] Machine model: Xilinx Zynq
[    0.000000] bootconsole [earlycon0] enabled
[    0.000000] cma: CMA: reserved 128 MiB at 17400000
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] PERCPU: Embedded 8 pages/cpu @dfb9e000 s10752 r8192 d13824 u32768
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 130048
[    0.000000] Kernel command line: console=ttyPS0,115200 root=/dev/ram rw earlyprintk
[    0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Memory: 371800K/524288K available (5133K kernel code, 319K rwdata, 1888K rodata, 206K )
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
[    0.000000]     vmalloc : 0xe0800000 - 0xff000000   ( 488 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xe0000000   ( 512 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0xc0008000 - 0xc06e3a0c   (7023 kB)
[    0.000000]       .init : 0xc06e4000 - 0xc0717a00   ( 207 kB)
[    0.000000]       .data : 0xc0718000 - 0xc0767d40   ( 320 kB)
[    0.000000]        .bss : 0xc0767d4c - 0xc0c9eb88   (5340 kB)
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000]  RCU lockdep checking is enabled.
[    0.000000]  Dump stacks of tasks blocking RCU-preempt GP.
[    0.000000]  RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
[    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
[    0.000000] NR_IRQS:16 nr_irqs:16 16
[    0.000000] ps7-slcr mapped to e0802000
[    0.000000] zynq_clock_init: clkc starts at e0802100
[    0.000000] Zynq clock init
[    0.000017] sched_clock: 64 bits at 325MHz, resolution 3ns, wraps every 3383112499200ns
[    0.008504] ps7-ttc #0 at e0804000, irq=43
[    0.013560] Console: colour dummy device 80x30
[    0.017898] Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar
[    0.025982] ... MAX_LOCKDEP_SUBCLASSES:  8
[    0.030003] ... MAX_LOCK_DEPTH:          48
[    0.034175] ... MAX_LOCKDEP_KEYS:        8191
[    0.038591] ... CLASSHASH_SIZE:          4096
[    0.042947] ... MAX_LOCKDEP_ENTRIES:     16384
[    0.047418] ... MAX_LOCKDEP_CHAINS:      32768
[    0.051921] ... CHAINHASH_SIZE:          16384
[    0.056364]  memory used by lock dependency info: 3695 kB
[    0.061807]  per task-struct memory footprint: 1152 bytes
[    0.067257] Calibrating delay loop... 1292.69 BogoMIPS (lpj=6463488)
[    0.110960] pid_max: default: 32768 minimum: 301
[    0.116272] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.122813] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.137439] CPU: Testing write buffer coherency: ok
[    0.143741] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.149380] Setting up static identity map for 0x4deb20 - 0x4deb78
[    0.155751] L310 cache controller enabled
[    0.159710] l2x0: 8 ways, CACHE_ID 0x410000c8, AUX_CTRL 0x72760000, Cache size: 512 kB
[    0.240368] CPU1: Booted secondary processor
[    0.328285] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.329295] Brought up 2 CPUs
[    0.342164] SMP: Total of 2 processors activated.
[    0.346864] CPU: All CPU(s) started in SVC mode.
[    0.354972] devtmpfs: initialized
[    0.365692] VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
[    0.380019] regulator-dummy: no parameters
[    0.393176] NET: Registered protocol family 16
[    0.401859] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.415455] cpuidle: using governor ladder
[    0.419507] cpuidle: using governor menu
[    0.446231] syscon f8000000.ps7-slcr: regmap [mem 0xf8000000-0xf8000fff] registered
[    0.458132] hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.
[    0.466253] hw-breakpoint: maximum watchpoint size is 4 bytes.
[    0.472460] zynq-ocm f800c000.ps7-ocmc: ZYNQ OCM pool: 256 KiB @ 0xe0880000
[    0.544128] bio: create slab <bio-0> at 0
[    0.553669] vgaarb: loaded
[    0.558158] SCSI subsystem initialized
[    0.564554] usbcore: registered new interface driver usbfs
[    0.570402] usbcore: registered new interface driver hub
[    0.576141] usbcore: registered new device driver usb
[    0.582636] media: Linux media interface: v0.10
[    0.587465] Linux video capture interface: v2.00
[    0.592668] pps_core: LinuxPPS API ver. 1 registered
[    0.597502] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.i>
[    0.607063] PTP clock support registered
[    0.611983] EDAC MC: Ver: 3.0.0
[    0.618231] Advanced Linux Sound Architecture Driver Initialized.
[    0.634309] DMA-API: preallocated 4096 debug entries
[    0.639150] DMA-API: debugging enabled by kernel config
[    0.645010] Switched to clocksource arm_global_timer
[    0.707511] NET: Registered protocol family 2
[    0.714528] TCP established hash table entries: 4096 (order: 2, 16384 bytes)
[    0.721677] TCP bind hash table entries: 4096 (order: 5, 147456 bytes)
[    0.729620] TCP: Hash tables configured (established 4096 bind 4096)
[    0.736059] TCP: reno registered
[    0.739196] UDP hash table entries: 256 (order: 2, 20480 bytes)
[    0.745376] UDP-Lite hash table entries: 256 (order: 2, 20480 bytes)
[    0.752870] NET: Registered protocol family 1
[    0.759153] RPC: Registered named UNIX socket transport module.
[    0.765068] RPC: Registered udp transport module.
[    0.769665] RPC: Registered tcp transport module.
[    0.774395] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.781911] Trying to unpack rootfs image as initramfs...
[    0.788795] rootfs image is not initramfs (no cpio magic); looks like an initrd
[    0.820323] Freeing initrd memory: 3604K (df7a9000 - dfb2e000)
[    0.826402] hw perfevents: enabled with ARMv7 Cortex-A9 PMU driver, 7 counters available
[    0.840411] futex hash table entries: 512 (order: 3, 32768 bytes)
[    0.853977] jffs2: version 2.2. (NAND) (SUMMARY)  �© 2001-2006 Red Hat, Inc.
[    0.861593] msgmni has been set to 989
[    0.866920] io scheduler noop registered
[    0.870726] io scheduler deadline registered
[    0.875266] io scheduler cfq registered (default)
[    0.897507] dma-pl330 f8003000.ps7-dma: Loaded driver for PL330 DMAC-2364208
[    0.904418] dma-pl330 f8003000.ps7-dma:      DBUFF-128x8bytes Num_Chans-8 Num_Peri-4 Num_Events-16
[    0.916671] e0001000.serial: ttyPS0 at MMIO 0xe0001000 (irq = 82, base_baud = 3125000) is a xuartps
[    0.926076] console [ttyPS0] enabled
[    0.926076] console [ttyPS0] enabled
[    0.933128] bootconsole [earlycon0] disabled
[    0.933128] bootconsole [earlycon0] disabled
[    0.944412] xdevcfg f8007000.ps7-dev-cfg: ioremap 0xf8007000 to e0866000
[    0.954240] [drm] Initialized drm 1.1.0 20060810
[    0.992506] brd: module loaded
[    1.014600] loop: module loaded
[    1.030724] m25p80 spi0.0: found s25fl128s1, expected n25q128
[    1.036831] m25p80 spi0.0: s25fl128s1 (16384 Kbytes)
[    1.041849] 4 ofpart partitions found on MTD device spi0.0
[    1.047318] Creating 4 MTD partitions on "spi0.0":
[    1.052036] 0x000000000000-0x000000400000 : "qspi-fsbl-uboot"
[    1.066176] 0x000000400000-0x000000900000 : "qspi-linux"
[    1.076221] 0x000000900000-0x000000920000 : "qspi-device-tree"
[    1.086682] 0x000000920000-0x000001000000 : "qspi-user"
[    1.106090] e1000e: Intel(R) PRO/1000 Network Driver - 2.3.2-k
[    1.111847] e1000e: Copyright(c) 1999 - 2013 Intel Corporation.
[    1.123578] libphy: XEMACPS mii bus: probed
[    1.130170] xemacps e000b000.ps7-ethernet: pdev->id -1, baseaddr 0xe000b000, irq 54
[    1.140714] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.147725] ehci-pci: EHCI PCI platform driver
[    1.152806] ULPI transceiver vendor/product ID 0x0424/0x0007
[    1.158549] Found SMSC USB3320 ULPI transceiver.
[    1.163104] ULPI integrity check: passed.
[    1.168100] zynq-ehci zynq-ehci.0: Xilinx Zynq USB EHCI Host Controller
[    1.175653] zynq-ehci zynq-ehci.0: new USB bus registered, assigned bus number 1
[    1.205099] zynq-ehci zynq-ehci.0: irq 53, io mem 0x00000000
[    1.225073] zynq-ehci zynq-ehci.0: USB 2.0 started, EHCI 1.00
[    1.237861] hub 1-0:1.0: USB hub found
[    1.241847] hub 1-0:1.0: 1 port detected
[    1.249897] usbcore: registered new interface driver usb-storage
[    1.258730] mousedev: PS/2 mouse device common for all mice
[    1.266471] i2c /dev entries driver
[    1.278846] zynq-edac f8006000.ps7-ddrc: ecc not enabled
[    1.285114] cpufreq_cpu0: failed to get cpu0 regulator: -19
[    1.293568] Xilinx Zynq CpuIdle Driver started
[    1.299870] sdhci: Secure Digital Host Controller Interface driver
[    1.306062] sdhci: Copyright(c) Pierre Ossman
[    1.310341] sdhci-pltfm: SDHCI platform and OF driver helper
[    1.316582] mmc0: no vqmmc regulator found
[    1.320610] mmc0: no vmmc regulator found
[    1.365057] mmc0: SDHCI controller on e0100000.ps7-sdio [e0100000.ps7-sdio] using ADMA
[    1.383889] usbcore: registered new interface driver usbhid
[    1.389549] usbhid: USB HID core driver
[    1.400553] TCP: cubic registered
[    1.403800] NET: Registered protocol family 17
[    1.408760] Registering SWP/SWPB emulation handler
[    1.416160] regulator-dummy: disabling
[    1.420631] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
[    1.435694] mmc0: new high speed SDHC card at address 1234
[    1.443924] mmcblk0: mmc0:1234 SA08G 7.42 GiB 
[    1.454764]  mmcblk0: p1
[    1.455152] ALSA device list:
[    1.455157]   No soundcards found.
[    1.468383] RAMDISK: gzip image found at block 0
[    1.882799] EXT2-fs (ram0): warning: mounting unchecked fs, running e2fsck is recommended
[    1.891270] VFS: Mounted root (ext2 filesystem) on device 1:0.
[    1.898044] devtmpfs: mounted
[    1.901325] Freeing unused kernel memory: 204K (c06e4000 - c0717000)
Starting rcS...
++ Mounting filesystem
++ Setting up mdev
++ Configure static IP 192.168.1.10
++ Starting telnet daemon
++ Starting http daemon
++ Starting ftp daemon
++ Starting dropbear (ssh) daemon
[    2.675609] random: dropbear urandom read with 7 bits of entropy available
++ Starting OLED Display
insmod: can't read '/lib/modules/3.14.0-xilinx-13567-g906a2c9/pmodoled-gpio.ko': No such file or direy
++ Exporting LEDs & SWs
rcS Complete
zynq>