関連記事
EBAZ4205を使って、FPGAを使ったシステム開発の環境を構築する
EBAZ4205でLinuxを動かして見る
petalinuxをBuildrootでビルドする
はじめに
本家のドキュメント
このドキュメントを参照しながら、EBAZ4205でLinuxを動かして見みます。最新のVivado, Vitis, Petalinuxを使ってみます。
ハードウエア情報(.xsaファイル)の作成
EBAZ4205のボードのハードウエア情報は、How to Buildのvivadoの項目に記載されてる方法で、xsaファイルの作成を行いました。
vivado 2024.1, vitis 2024.1はWindowsにインストールしています。
> git clone https://github.com/KeitetsuWorks/EBAZ4205.git
> cd EBAZ4205
> cd vivado
> C:\Xilinx\Vivado\2024.1\bin\unwrapped\win64.o\vvgl.exe C:\Xilinx\Vivado\2024.1\bin\vivado.bat
ebaz4205.tcl
をTcl Consoleで実行する。
Flow NavigatorのGenerate Bitstreamを実行する
File -> Export -> Export Hardwareを実行する
include bitstreamをチェックする
EBAZ4205/vivado/ebaz4205/ebaz4205_wrapper.xsaに保存される
Petalinuxのインストール
petaLinuxの作成環境は、linuxが必要なので、WSL2の環境で行います。
petalinux-v2024.1-05202009-installer.run
をダウンロードする。
WSL2環境に次のパッケージをインストールする。
sudo apt-get install xterm libtool texinfo gcc-multilib
sudo apt-get install libtinfo5
mkdir -p ~/petalinux
cd /mnt/c/Users/masat/Downloads
./petalinux-v2024.1-05202009-installer.run ~/petalinux/
petalinux-util --webtalk off
Enter target directory for SDK
と聞かれるので、~/petalinux/
を入力する。
インストーラの引数に、~/petalinux/
を指定しているが、無視されているらしい。
次のコマンドで、petalinux
の環境変数を設定する。
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
source ~/petalinux/settings.sh
.xsaファイルの場所を指定して、buildする。
$ petalinux-create --type project --template zynq --name ebaz4205_linux
$ cd ebaz4205_linux/
$ petalinux-config --get-hw-description=/mnt/c/Users/masat/xilinx/linux/EBAZ4205/vivado/ebaz4205/ebaz4205_wrapper.xsa
$ petalinux-build
ビルド中に、NANDに関するエラーが発生したので、/EBAZ4205/vivado/ebaz4205/でNAND Flashを無効にして再度ビルドする。
$ petalinux-build -x mrproper
$ petalinux-build
同じエラーが発生
petalinux-config で、NAND Flashを無効にする。
改めてビルドすとビルド成功。
BOOT.BINを作成する(wicファイル作成の場合は、不要かもしれません。)
$ petalinux-package boot --u-boot
wicファイルを作成する
$ petalinux-package wic
/home/masa/ebaz4205/ebaz4205_linux/images/linux/petalinux-sdimage.wic
が作成された。
これをSDカードに書き込んで起動する。
これでKernelは起動したが、rootfsが見つからないエラーが発生した。
U-bootのシェルで、次のコマンドを実行する。
U-boot起動中に3秒以内に何かキーを押すと、U-bootのシェルを起動できる。
setenv bootargs "root=/dev/mmcblk0p2 rw rootwait console=ttyPS0,115200"
saveenv
再度起動すると、rootfsが見つかり、ログイン画面が表示された。
ログインはID:petalinux, パスワードは、最初のログイン時に設定する。
起動時のメッセージを載せておきます。
U-Boot 2024.01 (May 14 2024 - 03:31:48 +0000)
CPU: Zynq 7z010
Silicon: v3.1
DRAM: ECC disabled 256 MiB
Core: 19 devices, 14 uclasses, devicetree: board
Flash: 0 Bytes
NAND: 0 MiB
MMC: mmc@e0100000: 0
Loading Environment from FAT... *** Warning - some problems detected reading environment; recovered successfully
OK
In: serial@e0001000
Out: serial@e0001000
Err: serial@e0001000
Net: Could not get PHY for eth0: addr -19
No ethernet found.
Hit any key to stop autoboot: 0
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found U-Boot script /boot.scr
3473 bytes read in 14 ms (242.2 KiB/s)
## Executing script at 03000000
Trying to load boot images from mmc0
4924664 bytes read in 428 ms (11 MiB/s)
## Booting kernel from Legacy Image at 00200000 ...
Image Name: Linux-6.6.10-xilinx-v2024.1-g3af
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 4924600 Bytes = 4.7 MiB
Load Address: 00200000
Entry Point: 00200000
Verifying Checksum ... OK
## Flattened Device Tree blob at 00100000
Booting using the fdt blob at 0x100000
Working FDT set to 100000
Could not get PHY for eth0: addr -19
Could not get PHY for eth0: addr -19
Loading Kernel Image
Loading Device Tree to 0dabd000, end 0dac47a7 ... OK
Working FDT set to dabd000
Starting kernel ...
Booting Linux on physical CPU 0x0
Linux version 6.6.10-xilinx-v2024.1-g3af4295e00ef (oe-user@oe-host) (arm-xilinx-linux-gnueabi-gcc (GCC) 12.2.0, GNU ld (GNU Binutils) 2.39.0.20220819) #1 SMP PREEMPT Sat Apr 27 05:22:24 UTC 2024
CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
OF: fdt: Machine model: xlnx,zynq-7000
Memory policy: Data cache writealloc
cma: Reserved 16 MiB at 0x0f000000 on node -1
Zone ranges:
Normal [mem 0x0000000000000000-0x000000000fffffff]
HighMem empty
Movable zone start for each node
Early memory node ranges
node 0: [mem 0x0000000000000000-0x000000000fffffff]
Initmem setup node 0 [mem 0x0000000000000000-0x000000000fffffff]
percpu: Embedded 12 pages/cpu s17940 r8192 d23020 u49152
Kernel command line: root=/dev/mmcblk0p2 rw rootwait console=ttyPS0,115200
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
Built 1 zonelists, mobility grouping on. Total pages: 65024
mem auto-init: stack:all(zero), heap alloc:off, heap free:off
Memory: 231128K/262144K available (7168K kernel code, 251K rwdata, 2124K rodata, 1024K init, 146K bss, 14632K reserved, 16384K cma-reserved, 0K highmem)
SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
rcu: Preemptible hierarchical RCU implementation.
rcu: RCU event tracing is enabled.
rcu: RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
efuse mapped to (ptrval)
slcr mapped to (ptrval)
GIC physical location is 0xf8f01000
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
rcu: srcu_init: Setting srcu_struct sizes based on contention.
zynq_clock_init: clkc starts at (ptrval)
Zynq clock init
sched_clock: 64 bits at 167MHz, resolution 6ns, wraps every 4398046511103ns
clocksource: arm_global_timer: mask: 0xffffffffffffffff max_cycles: 0x26703d7dd8, max_idle_ns: 440795208065 ns
Switching to timer-based delay loop, resolution 6ns
Console: colour dummy device 80x30
Calibrating delay loop (skipped), value calculated using timer frequency.. 333.33 BogoMIPS (lpj=1666666)
CPU: Testing write buffer coherency: ok
CPU0: Spectre v2: using BPIALL workaround
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
Setting up static identity map for 0x100000 - 0x100060
rcu: Hierarchical SRCU implementation.
rcu: Max phase no-delay instances is 1000.
smp: Bringing up secondary CPUs ...
CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
CPU1: Spectre v2: using BPIALL workaround
smp: Brought up 1 node, 2 CPUs
SMP: Total of 2 processors activated (666.66 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
futex hash table entries: 512 (order: 3, 32768 bytes, linear)
pinctrl core: initialized pinctrl subsystem
NET: Registered PF_NETLINK/PF_ROUTE protocol family
DMA: preallocated 256 KiB pool for atomic coherent allocations
thermal_sys: Registered thermal governor 'step_wise'
cpuidle: using governor menu
platform axi: Fixed dependency cycle(s) with /axi/interrupt-controller@f8f01000
amba f8801000.etb: Fixed dependency cycle(s) with /replicator/out-ports/port@1/endpoint
amba f8803000.tpiu: Fixed dependency cycle(s) with /replicator/out-ports/port@0/endpoint
amba f8804000.funnel: Fixed dependency cycle(s) with /replicator/in-ports/port/endpoint
amba f889c000.ptm: Fixed dependency cycle(s) with /axi/funnel@f8804000/in-ports/port@0/endpoint
amba f889d000.ptm: Fixed dependency cycle(s) with /axi/funnel@f8804000/in-ports/port@1/endpoint
hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.
hw-breakpoint: maximum watchpoint size is 4 bytes.
e0001000.serial: ttyPS0 at MMIO 0xe0001000 (irq = 26, base_baud = 6249999) is a xuartps
printk: console [ttyPS0] enabled
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
mc: Linux media interface: v0.10
videodev: 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
FPGA manager framework
Advanced Linux Sound Architecture Driver Initialized.
vgaarb: loaded
clocksource: Switched to clocksource arm_global_timer
NET: Registered PF_INET protocol family
IP idents hash table entries: 4096 (order: 3, 32768 bytes, linear)
tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
TCP established hash table entries: 2048 (order: 1, 8192 bytes, linear)
TCP bind hash table entries: 2048 (order: 3, 32768 bytes, linear)
TCP: Hash tables configured (established 2048 bind 2048)
UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
NET: Registered PF_UNIX/PF_LOCAL protocol family
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp-with-tls transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
PCI: CLS 0 bytes, default 64
armv7-pmu f8891000.pmu: hw perfevents: no interrupt-affinity property, guessing.
hw perfevents: enabled with armv7_cortex_a9 PMU driver, 7 counters available
workingset: timestamp_bits=30 max_order=16 bucket_order=0
jffs2: version 2.2. (NAND) (SUMMARY) c 2001-2006 Red Hat, Inc.
io scheduler mq-deadline registered
io scheduler kyber registered
io scheduler bfq registered
zynq-pinctrl 700.pinctrl: zynq pinctrl initialized
dma-pl330 f8003000.dma-controller: Loaded driver for PL330 DMAC-241330
dma-pl330 f8003000.dma-controller: DBUFF-128x8bytes Num_Chans-8 Num_Peri-4 Num_Events-16
brd: module loaded
loop: module loaded
CAN device driver interface
macb e000b000.ethernet eth0: Cadence GEM rev 0x00020118 at 0xe000b000 irq 39 (00:0a:35:00:1e:53)
e1000e: Intel(R) PRO/1000 Network Driver
e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
usbcore: registered new interface driver usb-storage
i2c_dev: i2c /dev entries driver
cdns-wdt f8005000.watchdog: Xilinx Watchdog Timer with timeout 10s
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
ledtrig-cpu: registered to indicate activity on CPUs
clocksource: ttc_clocksource: mask: 0xffff max_cycles: 0xffff, max_idle_ns: 537538477 ns
timer #0 at (ptrval), irq=42
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
pl353-smc e000e000.memory-controller: no matching children
fpga_manager fpga0: Xilinx Zynq FPGA Manager registered
mmc0: SDHCI controller on e0100000.mmc [e0100000.mmc] using ADMA
NET: Registered PF_INET6 protocol family
Segment Routing with IPv6
In-situ OAM (IOAM) with IPv6
sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
NET: Registered PF_PACKET protocol family
can: controller area network core
NET: Registered PF_CAN protocol family
can: raw protocol
can: broadcast manager protocol
can: netlink gateway - max_hops=1
mmc0: new high speed SDHC card at address 1234
Registering SWP/SWPB emulation handler
mmcblk0: mmc0:1234 SA16G 14.4 GiB
mmcblk0: p1 p2
of-fpga-region fpga-region: FPGA Region probed
of_cfs_init
of_cfs_init: OK
clk: Disabling unused clocks
ALSA device list:
No soundcards found.
EXT4-fs (mmcblk0p2): recovery complete
EXT4-fs (mmcblk0p2): mounted filesystem a34145e8-3127-40b5-9420-9eeb16815c44 r/w with ordered data mode. Quota mode: disabled.
VFS: Mounted root (ext4 filesystem) on device 179:2.
devtmpfs: mounted
Freeing unused kernel image (initmem) memory: 1024K
Run /sbin/init as init process
INIT: version 3.04 booting
FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
Starting udev
Starting version 251.8+
EXT4-fs (mmcblk0p2): re-mounted a34145e8-3127-40b5-9420-9eeb16815c44 r/w. Quota mode: disabled.
hwclock: can't open '/dev/misc/rtc': No such file or directory
Fri Mar 9 12:34:56 UTC 2018
hwclock: can't open '/dev/misc/rtc': No such file or directory
random: crng init done
hwclock: can't open '/dev/misc/rtc': No such file or directory
INIT: Entering runlevel: 5
Configuring network interfaces... macb e000b000.ethernet eth0: validation of with support 00,00000000,00000000,00006000 and advertisement 00,00000000,00000000,00000000 failed: -EINVAL
macb e000b000.ethernet eth0: Could not attach PHY (-22)
RTNETLINK answers: Invalid argument
Starting OpenBSD Secure Shell server: sshd
done.
Starting rpcbind daemon...done.
starting statd: done
Starting internet superserver: inetd.
NFS daemon support not enabled in kernel
Starting syslogd/klogd: done
Starting tcf-agent: OK
********************************************************************************************
The PetaLinux source code and images provided/generated are for demonstration purposes only.
Please refer to https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/2741928025/Moving+from+PetaLinux+to+Production+Deployment
for more details.
********************************************************************************************
PetaLinux 2024.1+release-S05201002 ebaz4205_linux ttyPS0
ebaz4205_linux login: petalinux
Password:
ebaz4205_linux:~$ free -m
total used free shared buff/cache available
Mem: 248536 11108 216436 244 20992 230692
Swap: 0 0 0
ebaz4205_linux:~$
関連記事
EBAZ4205を使って、FPGAを使ったシステム開発の環境を構築する
EBAZ4205でLinuxを動かして見る
petalinuxをBuildrootでビルドする