基于Zedboard的PetaLinux

两种方式创建petalinux项目,没有bsp根据cpu架构选择zynq、zynqMP,官方支持包启动petalinux
在这里插入图片描述
在这里插入图片描述

1 下载安装板级支持包

这些板子直接可以从官方下载到板级支持包,有了板级支持包,我们就可以直接从板级支持包生成PetaLinux项目。

https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/embedded-design-tools.html

在这里插入图片描述
下载下来放到虚拟机里面。之后我们就就根据这个BSP(板级支持包的简写,下同),来创建PetaLinux项目。

2 生成项目

不使用 --template


petalinux-create -t project -s avnet-digilent-zedboard-v2018.3-final.bsp  -n my_zed 

INFO: Create project: my_zed
INFO: New project successfully created in /home/

3 板级config

petalinux-config 如果不加参数就是对板级的特性进行配置。另外可以有三个-c参数分别是 u-boot,kernel,rootfs.

在这里插入图片描述

cd 到项目内

petalinux-config

在这里插入图片描述

Linux components selections

在这里插入图片描述

auto components selection

在这里插入图片描述

subsystem auto hardware settings

在这里插入图片描述

memory settings

在这里插入图片描述

ethernet settings

在这里插入图片描述

serial settings

在这里插入图片描述

sd settings

在这里插入图片描述

uboot env partition settings

选择flash
bootenv
在这里插入图片描述

在这里插入图片描述

BOOT image settings

BOOT.BIN选择sd卡在这里插入图片描述

kernel image settings

image.ub选择sd卡
在这里插入图片描述

jffs2 rootfs image settings

选择flash
在这里插入图片描述

dtb image settings

选择boot image

在这里插入图片描述在这里插入图片描述

DTG settings

devicetree
在这里插入图片描述

uboot config

在这里插入图片描述

image package settings

在这里插入图片描述
rootfs type
在这里插入图片描述

[INFO] generating Kconfig for project
[INFO] menuconfig project


*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

[INFO] sourcing bitbake
[INFO] generating plnxtool conf
[INFO] generating meta-plnx-generated layer
[INFO] generating bbappends for project . This may take time ! 
[INFO] generating u-boot configuration files
[INFO] generating kernel configuration files
[INFO] generating kconfig for Rootfs
[INFO] oldconfig rootfs
[INFO] generating petalinux-user-image.bb
[INFO] successfully configured project

4 config u-boot

在这里插入图片描述

在这里插入图片描述

5 config kernel

在这里插入图片描述

6 config rootfs

在这里插入图片描述

7 build

petalinux-build

build 结束,image/linux目录有生成的u-boot, kernel,rootfs.

在这里插入图片描述

[INFO] building project
[INFO] sourcing bitbake
INFO: bitbake petalinux-user-image
Loading cache: 100% |############################################| Time: 0:00:00
Loaded 3444 entries from dependency cache.
Parsing recipes: 100% |##########################################| Time: 0:00:03
Parsing of 2569 .bb files complete (2536 cached, 33 parsed). 3445 targets, 149 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
Initialising tasks: 100% |#######################################| Time: 0:00:07
Checking sstate mirror object availability: 100% |###############| Time: 0:00:41
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
NOTE: Tasks Summary: Attempted 3082 tasks of which 2257 didn't need to be rerun and all succeeded.
INFO: Copying Images from deploy to images
INFO: Creating images/linux directory
NOTE: Failed to copy built images to tftp dir:  /tftpboot
[INFO] successfully built project

8 package

petalinux-package --boot --format BIN --fsbl images/linux/zynq_fsbl.elf --u-boot images/linux/u-boot.elf --fpga images/linux/*.bit

9 上板测试

准备SD卡

EXT4和FAT
参照https://blog.csdn.net/lulugay/article/details/83240981《MPSoC PYNQ框架集成VCU-1.VCU在ZCU104上运行》

移植ubuntu

boot.bin 和image.ub fat
把Ubuntu的rootfs烧写进SD卡的ext4分区
sudo pax -rvf rootfs.cpio

//将rootfs解压到SD 卡的ext4 分区, 假设该分区挂载到了/media/rootfs/

$ sync
$ sudo chown root:root /media/rootfs/
$ sudo chmod 755 /media/rootfs/
//更改权限,否则启动以后会出现问题
 0
Device: mmc@e0100000
Manufacturer ID: 27
OEM: 5048
Name: SD04G
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 image.ub
9999872 bytes read in 558 ms (17.1 MiB/s)
## Loading kernel from FIT Image at 10000000 ...
   Using 'conf@system-top.dtb' configuration
   Verifying Hash Integrity ... OK
   Trying 'kernel@1' kernel subimage
     Description:  Linux kernel
     Type:         Kernel Image
     Compression:  gzip compressed
     Data Start:   0x10000108
     Data Size:    3941028 Bytes = 3.8 MiB
     Architecture: ARM
     OS:           Linux
     Load Address: 0x00008000
     Entry Point:  0x00008000
     Hash algo:    sha1
     Hash value:   913e587881af6967e71d5d1fd0646158252795fc
   Verifying Hash Integrity ... sha1+ OK
## Loading ramdisk from FIT Image at 10000000 ...
   Using 'conf@system-top.dtb' configuration
   Trying 'ramdisk@1' ramdisk subimage
     Description:  petalinux-user-image
     Type:         RAMDisk Image
     Compression:  gzip compressed
     Data Start:   0x103c62e8
     Data Size:    6040972 Bytes = 5.8 MiB
     Architecture: ARM
     OS:           Linux
     Load Address: unavailable
     Entry Point:  unavailable
     Hash algo:    sha1
     Hash value:   ab8b32a7be7beccddd90bf31538c19aa867a6599
   Verifying Hash Integrity ... sha1+ OK
## Loading fdt from FIT Image at 10000000 ...
   Using 'conf@system-top.dtb' configuration
   Trying 'fdt@system-top.dtb' fdt subimage
     Description:  Flattened Device Tree blob
     Type:         Flat Device Tree
     Compression:  uncompressed
     Data Start:   0x103c24ac
     Data Size:    15740 Bytes = 15.4 KiB
     Architecture: ARM
     Hash algo:    sha1
     Hash value:   657732bc34b444f329ba295694f1c705b11788eb
   Verifying Hash Integrity ... sha1+ OK
   Booting using the fdt blob at 0x103c24ac
   Uncompressing Kernel Image ... OK
   Loading Ramdisk to 07a3d000, end 07fffd8c ... OK
   Loading Device Tree to 07a36000, end 07a3cd7b ... OK

Starting kernel ...

Booting Linux on physical CPU 0x0
Linux version 4.14.0-xilinx-v2018.3 (oe-user@oe-host) (gcc version 7.3.0 (GCC)) #1 SMP PREEMPT Tue Sep 29 14:24:18 UTC 2020
CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
OF: fdt: Machine model: Zynq Zed Development Board
bootconsole [earlycon0] enabled
Memory policy: Data cache writealloc
cma: Reserved 16 MiB at 0x1f000000
percpu: Embedded 16 pages/cpu @debc5000 s34764 r8192 d22580 u65536
Built 1 zonelists, mobility grouping on.  Total pages: 130048
Kernel command line: console=ttyPS0,115200 earlyprintk
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: 487152K/524288K available (6144K kernel code, 238K rwdata, 1564K rodata, 1024K init, 152K bss, 20752K 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 - 0xc0700000   (7136 kB)
      .init : 0xc0900000 - 0xc0a00000   (1024 kB)
      .data : 0xc0a00000 - 0xc0a3b880   ( 239 kB)
       .bss : 0xc0a3b880 - 0xc0a61bc4   ( 153 kB)
Preemptible hierarchical RCU implementation.
        RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
        Tasks RCU enabled.
RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 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 333MHz, resolution 3ns, wraps every 4398046511103ns
clocksource: arm_global_timer: mask: 0xffffffffffffffff max_cycles: 0x4ce07af025, max_idle_ns: 440795209040 ns
Switching to timer-based delay loop, resolution 3ns
clocksource: ttc_clocksource: mask: 0xffff max_cycles: 0xffff, max_idle_ns: 537538477 ns
timer #0 at e080a000, irq=17
Console: colour dummy device 80x30
Calibrating delay loop (skipped), value calculated using timer frequency.. 666.66 BogoMIPS (lpj=3333333)
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 - 0x100060
Hierarchical SRCU implementation.
smp: Bringing up secondary CPUs ...
CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
smp: Brought up 1 node, 2 CPUs
SMP: Total of 2 processors activated (1333.33 BogoMIPS).
CPU: All CPU(s) started in SVC mode.
devtmpfs: initialized
random: get_random_u32 called from bucket_table_alloc+0x1c4/0x204 with crng_init=0
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)
pinctrl core: initialized pinctrl subsystem
random: fast init done
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 @ 0xe0840000
zynq-pinctrl 700.pinctrl: zynq pinctrl initialized
e0001000.serial: ttyPS0 at MMIO 0xe0001000 (irq = 25, base_baud = 3125000) is a xuartps
`▒▒׋▒Led
console [ttyPS0] enabled
bootconsole [earlycon0] disabled
bootconsole [earlycon0] disabled
XGpio: /amba_pl/gpio@41200000: registered, base is 1019
XGpio: /amba_pl/gpio@41210000: registered, base is 1011
XGpio: /amba_pl/gpio@41220000: registered, base is 1003
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
FPGA manager framework
fpga-region fpga-full: FPGA Region probed
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...
Freeing initrd memory: 5900K
hw perfevents: no interrupt-affinity property for /pmu@f8891000, guessing.
hw perfevents: enabled with armv7_cortex_a9 PMU driver, 7 counters available
workingset: timestamp_bits=30 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)
io scheduler mq-deadline registered
io scheduler kyber registered
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
brd: module loaded
loop: module loaded
m25p80 spi0.0: found s25fl256s1, expected n25q512a
m25p80 spi0.0: s25fl256s1 (32768 Kbytes)
4 ofpart partitions found on MTD device spi0.0
Creating 4 MTD partitions on "spi0.0":
0x000000000000-0x000000500000 : "boot"
0x000000500000-0x000000520000 : "bootenv"
0x000000520000-0x000000fa0000 : "kernel"
0x000000fa0000-0x000002000000 : "spare"
libphy: Fixed MDIO Bus: probed
CAN device driver interface
libphy: MACB_mii_bus: probed
macb e000b000.ethernet eth0: Cadence GEM rev 0x00020118 at 0xe000b000 irq 27 (00:0a:35:00:1e:53)
Marvell 88E1510 e000b000.ethernet-ffffffff:00: attached PHY driver [Marvell 88E1510] (mii_bus:phy_addr=e000b000.ethernet-ffffffff:00, irq=POLL)
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
chipidea-usb2 e0002000.usb: e0002000.usb supply vbus not found, using dummy regulator
ULPI transceiver vendor/product ID 0x0451/0x1507
Found TI TUSB1210 ULPI transceiver.
ULPI integrity check: passed.
ci_hdrc ci_hdrc.0: EHCI Host Controller
ci_hdrc ci_hdrc.0: new USB bus registered, assigned bus number 1
ci_hdrc ci_hdrc.0: USB 2.0 started, EHCI 1.00
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
i2c /dev entries driver
IR NEC protocol handler initialized
IR RC5(x/sz) protocol handler initialized
IR RC6 protocol handler initialized
IR JVC protocol handler initialized
IR Sony protocol handler initialized
IR SANYO protocol handler initialized
IR Sharp protocol handler initialized
IR MCE Keyboard/mouse protocol handler initialized
IR XMP protocol handler initialized
cdns-wdt f8005000.watchdog: Xilinx Watchdog Timer at e088c000 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
mmc0: SDHCI controller on e0100000.mmc [e0100000.mmc] using ADMA
ledtrig-cpu: registered to indicate activity on CPUs
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
fpga_manager fpga0: Xilinx Zynq FPGA Manager registered
NET: Registered protocol family 10
Segment Routing with IPv6
sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
NET: Registered protocol family 17
can: controller area network core (rev 20170425 abi 9)
NET: Registered protocol family 29
can: raw protocol (rev 20170425)
can: broadcast manager protocol (rev 20170425 t)
can: netlink gateway (rev 20170425) max_hops=1
Registering SWP/SWPB emulation handler
hctosys: unable to open rtc device (rtc0)
of_cfs_init
of_cfs_init: OK
ALSA device list:
  No soundcards found.
mmc0: new high speed SDHC card at address 0007
Freeing unused kernel memory: 1024K
mmcblk0: mmc0:0007 SD04G 3.71 GiB
INIT:  mmcblk0: p1 p2
version 2.88 booting
Starting udev
udevd[751]: starting version 3.2.2
udevd[752]: starting eudev-3.2.2
EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
Tue Sep 29 14:26:28 UTC 2020
Starting internet superserver: inetd.
INIT: Entering runlevel: 5
Configuring network interfaces... IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
udhcpc (v1.24.1) started
Sending discover...
Sending discover...
macb e000b000.ethernet eth0: link up (1000/Full)
IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
Sending discover...
No lease, forking to background
done.
Starting Dropbear SSH server: Generating key, this may take a while...
Public key portion is:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCQO3WpI5jObzWJbDRCgm6GF196ZipWcE2mUCEBKDzH4seBGNN1Jd1ItSeD0a30jWyceKKpP3cMsBj+TeSkGALtgfbDAvKtRZQhkgayxeB8vDJaY23PRTv5ZqhGrD3y/WhsTdB7D3TDY75Q8P8BLCXchHXEHj4Qt1qi5kkVFYArN0uFhIRHdSpbWYQQ9A1KA1vN8A3UWQ3GaVePL/3GvrRP+YA/0F/cpqxNnwfJJ+HK5TjPtBe+0B/4q1krZS94C70KO/gMeQ7G/8BCvQqKJBEzuECUx42lR2LOvet9puz9WhKvv7Ny6IJEvP02tXf0oD2JxzMe8FKeSPIsuYav4jfd root@avnet-digilent-zedboard-2018_3
Fingerprint: md5 54:a0:e7:01:86:22:36:f8:2e:c2:ff:5e:a8:02:bd:3c
dropbear.
Starting syslogd/klogd: done
Starting tcf-agent: OK

PetaLinux 2018.3 avnet-digilent-zedboard-2018_3 /dev/ttyPS0

avnet-digilent-zedboard-2018_3 login: root
Password:
root
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是在Petalinux中实现Zynq-7000系列芯片USB 3.0驱动和测试程序的步骤: 1. 创建Petalinux项目 在Petalinux中创建一个新项目,选择Zynq-7000系列芯片作为目标设备,选择需要的组件和驱动。在“Image Packaging Configuration”选项中,选择“rootfs”和“device tree”进行打包。 2. 添加USB 3.0驱动 在Petalinux项目中添加USB 3.0驱动。首先,在Linux内核中启用USB 3.0驱动选项,然后添加xhci-hcd驱动程序。可以通过在Petalinux中进行IP核的添加来实现。 3. 编译内核和根文件系统 使用Petalinux工具链编译内核和根文件系统。在Petalinux项目中,使用以下命令来编译内核和根文件系统: ``` petalinux-build -c kernel petalinux-build -c rootfs ``` 4. 修改设备树文件 修改设备树文件以支持USB 3.0。添加以下节点: ``` usb3@e0002000 { compatible = "xlnx,zynqmp-dwc3"; reg = <0x0 0xe0002000 0x0 0x1000>; interrupts = <0x0 0x1d 0x4>; interrupt-names = "macirq"; clocks = <0x1 0x22>; clock-names = "hfclk"; status = "okay"; }; ``` 5. 修改系统启动脚本 修改Petalinux系统的启动脚本,使其加载USB 3.0驱动。在启动脚本中添加以下命令: ``` insmod /lib/modules/$(uname -r)/kernel/drivers/usb/host/xhci-hcd.ko ``` 6. 测试USB 3.0 在Petalinux系统中使用以下命令来测试USB 3.0: ``` lsusb -t ``` 如果USB 3.0驱动程序正常工作,将会看到设备树中的USB 3.0控制器节点,并且可以检测到已连接的USB 3.0设备。 以上是在Petalinux中实现Zynq-7000系列芯片USB 3.0驱动和测试程序的基本步骤,具体的实现细节和配置可能因具体情况而异,需要根据实际需要进行调整。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值