PetaLinux学习笔记三

12 篇文章 5 订阅

在此记录我使用petalinux搭建zynq_linux的过程。

这次搭建zedboard_linux的信息:
① 启动方式为SD卡。
② BOOT.BIN、image.ub、system.dtb放在SD卡的FAT分区。根文件系统是SD卡,解压rootfs.tar.gz到SD卡的EXT4分区。
③ 串口终端是具有root权限的。
④ linux只使用了CPU0,CPU1被预留了出来。DDR只使用了256MB,后256MB也被预留出来了。可通过cat /proc/meminfocat /proc/cpuinfo确认。
⑤ 将BOOT.BIN烧写到QSPI_FLASH中,即可实现从QSPI_FLASH启动,引导在SD卡中的内核、根文件系统、设备树。
⑥ 为后续LINUX+FREERTOS做准备。

以下是搭建步骤:

一、从vivado中导入硬件信息。新建linux_base.sdk文件夹。
二、 执行下面的命令。

petalinux-create --type project --template zynq --name zedboard 
cd zedboard 
petalinux-config --get-hw-description ../linux_base.sdk

三、按照下面配置,未提到的都保持默认。

Advanced bootable images storage Settings中:
boot image settings —>选择SD卡
uboot-env选择flash
kernel image settings —>选择SD卡
jffs2 rootfs:选择flash
dtb image:选择sd卡

DTG Settings 中:
console=ttyPS0,115200 earlyprintk root=/dev/mmcblk0p2 rw rootwait rootfstype=ext4 mem=256M maxcpus=1

Image Packaging Configuration中:
Root filesystem type —>选择SD类型

Ethernet Settings中:
设置静态IP地址。
IP address:10.113.214.205
IP netmask:255.255.255.0
IP gateway:10.113.214.1

在Yocto Settings中:
勾选Enable Debug Tweaks,可以取消每次开机串口终端输入用户名密码。

四、配置U-BOOT。

petalinux-config -c u-boot

Boot media中:
配置为SD卡启动。

五、执行下面命令,编译,生成BOOT.BIN。

petalinux-build  
petalinux-package --boot --fsbl ./images/linux/zynq_fsbl.elf --fpga --u-boot --force

六、拷贝BOOT.BIN 、system.dtb 、image.ub到SD卡FAT32分区。拷贝rootfs.tar.gz到SD卡EXT4分区,解压。

linux搭建成功。而且只使用了第一个核。设置为SD卡启动。U-BOOT会在SD卡找system.dtb和image.ub文件,找到后继续引导linux。

问题:发现串口终端没有root权限。无法ifconfig,ping,mount等。

七、解决串口终端没有root权限的问题。

原因是rootfs.tar.gz权限的问题。要按照以下方法之一:
①:
sudo tar -zxvpf rootfs.tar.gz
cd rootfs
sudo rsync -av ./ /media/alinx/EXT
②:图形界面以管理员方式“sudo nautilus”进行解压和复制。

八、BOOT.BIN可烧写到QSPI_FLASH里。

BOOT.BIN是FSBL、BITstream、UBOOT 打包而成,就是引导作用。
这种做法适用于QSPI_FLASH比较小,启动方式又被确定为QSPI_FLASH无法改变的情况。

九、通过cat /proc/meminfocat /proc/cpuinfo确认系统信息,如下。

root@zedboard:~# cat /proc/meminfo
MemTotal:         250548 kB
MemFree:          224928 kB
MemAvailable:     235276 kB
Buffers:            7632 kB
Cached:             7560 kB
SwapCached:            0 kB
Active:            12344 kB
Inactive:           4708 kB
Active(anon):       1896 kB
Inactive(anon):       80 kB
Active(file):      10448 kB
Inactive(file):     4628 kB
Unevictable:           0 kB
Mlocked:               0 kB
HighTotal:             0 kB
HighFree:              0 kB
LowTotal:         250548 kB
LowFree:          224928 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:          1860 kB
Mapped:             4688 kB
Shmem:               120 kB
Slab:               5004 kB
SReclaimable:       1644 kB
SUnreclaim:         3360 kB
KernelStack:         624 kB
PageTables:          184 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:      125272 kB
Committed_AS:      13452 kB
VmallocTotal:     770048 kB
VmallocUsed:           0 kB
VmallocChunk:          0 kB
CmaTotal:          16384 kB
CmaFree:           16112 kB
root@zedboard:~# cat /proc/cpuinfo
processor       : 0
model name      : ARMv7 Processor rev 0 (v7l)
BogoMIPS        : 666.66
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpd32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x3
CPU part        : 0xc09
CPU revision    : 0

Hardware        : Xilinx Zynq Platform
Revision        : 0003
Serial          : 0000000000000000

确认linux只使用了CPU0,CPU1被预留了出来。DDR只使用了256MB,后256MB也被预留出来了。

十、附录开机启动信息


U-Boot 2017.01 (Nov 28 2019 - 16:33:17 +0800)

Board: Xilinx Zynq
DRAM:  ECC disabled 512 MiB
MMC:   sdhci@e0100000: 0 (SD)
SF: Detected s25fl256s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   ZYNQ GEM: e000b000, phyaddr ffffffff, interface rgmii-id
eth0: ethernet@e000b000
U-BOOT for zedboard

Hit any key to stop autoboot:  0
Device: sdhci@e0100000
Manufacturer ID: 41
OEM: 3432
Name: SDTran Speed: 50000000
Rd Block Len: 512
SD version 3.0
High Capacity: Yes
Capacity: 7.4 GiB
Bus Width: 4-bit
Erase Group Size: 512 Bytes
reading image.ub
3761528 bytes read in 336 ms (10.7 MiB/s)
Device: sdhci@e0100000
Manufacturer ID: 41
OEM: 3432
Name: SDTran Speed: 50000000
Rd Block Len: 512
SD version 3.0
High Capacity: Yes
Capacity: 7.4 GiB
Bus Width: 4-bit
Erase Group Size: 512 Bytes
reading system.dtb
13924 bytes read in 21 ms (647.5 KiB/s)
## Loading kernel from FIT Image at 10000000 ...
   Using 'conf@2' configuration
   Verifying Hash Integrity ... OK
   Trying 'kernel@0' kernel subimage
     Description:  Linux Kernel
     Type:         Kernel Image
     Compression:  uncompressed
     Data Start:   0x100000d4
     Data Size:    3746312 Bytes = 3.6 MiB
     Architecture: ARM
     OS:           Linux
     Load Address: 0x00008000
     Entry Point:  0x00008000
     Hash algo:    sha1
     Hash value:   022056ef6202724bed20e6374ebf4196c1586bae
   Verifying Hash Integrity ... sha1+ OK
## Flattened Device Tree blob at 11800000
   Booting using the fdt blob at 0x11800000
   Loading Kernel Image ... OK
   Loading Device Tree to 07ff9000, end 07fff663 ... OK

Starting kernel ...

Booting Linux on physical CPU 0x0
Linux version 4.9.0-xilinx-v2017.4 (alinx@ubuntu) (gcc version 6.2.1 20161016 (Linaro GCC 6.2-2016.11) ) #1 SMP PREEMPT Thu Nov 28 16:36:49 CST 2019
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
cma: Reserved 16 MiB at 0x0f000000
Memory policy: Data cache writealloc
percpu: Embedded 14 pages/cpu @cedcb000 s25932 r8192 d23220 u57344
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 65024
Kernel command line: console=ttyPS0,115200 earlyprintk root=/dev/mmcblk0p2 rw rootwait rootfstype=ext4 mem=256M maxcpus=1
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: 233140K/262144K available (6144K kernel code, 199K rwdata, 1460K rodata, 1024K init, 229K bss, 12620K reserved, 16384K cma-reserved, 0K highmem)
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
    vmalloc : 0xd0800000 - 0xff800000   ( 752 MB)
    lowmem  : 0xc0000000 - 0xd0000000   ( 256 MB)
    pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
    modules : 0xbf000000 - 0xbfe00000   (  14 MB)
      .text : 0xc0008000 - 0xc0700000   (7136 kB)
      .init : 0xc0900000 - 0xc0a00000   (1024 kB)
      .data : 0xc0a00000 - 0xc0a31fc0   ( 200 kB)
       .bss : 0xc0a31fc0 - 0xc0a6b658   ( 230 kB)
Preemptible hierarchical RCU implementation.
        Build-time adjustment of leaf fanout to 32.
        RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
RCU: Adjusting geometry for rcu_fanout_leaf=32, nr_cpu_ids=2
NR_IRQS:16 nr_irqs:16 16
efuse mapped to d0800000
slcr mapped to d0802000
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 d0802100
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 d080a000, 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 - 0x100058
Brought up 1 CPUs
SMP: Total of 1 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
pinctrl core: initialized pinctrl subsystem
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 @ 0xd0840000
zynq-pinctrl 700.pinctrl: zynq pinctrl initialized
e0001000.serial: ttyPS0 at MMIO 0xe0001000 (irq = 25, base_baud = 3125000) is a xuartps
console [ttyPS0] enabled
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: 2048 (order: 1, 8192 bytes)
TCP bind hash table entries: 2048 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
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.
hw perfevents: enabled with armv7_cortex_a9 PMU driver, 7 counters available
futex hash table entries: 512 (order: 3, 32768 bytes)
workingset: timestamp_bits=30 max_order=16 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)
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
xdevcfg f8007000.devcfg: ioremap 0xf8007000 to d082a000
[drm] Initialized
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.etherne:00: attached PHY driver [Marvell 88E1510] (mii_bus:phy_addr=e000b000.etherne:00, irq=-1)
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
mousedev: PS/2 mouse device common for all mice
i2c /dev entries driver
cdns-wdt f8005000.watchdog: Xilinx Watchdog Timer at d0946000 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.sdhci [e0100000.sdhci] using ADMA
ledtrig-cpu: registered to indicate activity on CPUs
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
NET: Registered protocol family 10
sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
NET: Registered protocol family 17
can: controller area network core (rev 20120528 abi 9)
NET: Registered protocol family 29
can: raw protocol (rev 20120528)
can: broadcast manager protocol (rev 20161123 t)
can: netlink gateway (rev 20130117) 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: Problem switching card into high-speed mode!
mmc0: new SDHC card at address 0001
mmcblk0: mmc0:0001 SD 7.39 GiB
 mmcblk0: p1 p2
EXT4-fs (mmcblk0p2): recovery complete
EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
VFS: Mounted root (ext4 filesystem) on device 179:2.
devtmpfs: mounted
Freeing unused kernel memory: 1024K (c0900000 - c0a00000)
INIT: version 2.88 booting
random: fast init done
Starting udev
udevd[705]: starting version 3.2
udevd[706]: starting eudev-3.2
EXT4-fs (mmcblk0p2): re-mounted. Opts: data=ordered
FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
hwclock: can't open '/dev/misc/rtc': No such file or directory
Thu Nov 28 08:38:30 UTC 2019
hwclock: can't open '/dev/misc/rtc': No such file or directory
Starting internet superserver: inetd.
INIT: Entering runlevel: 5
Configuring network interfaces... IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
done.
Starting Dropbear SSH server: dropbear.
hwclock: can't open '/dev/misc/rtc': No such file or directory
Starting syslogd/klogd: done
Starting tcf-agent: OK

root@zedboard:~# macb e000b000.ethernet eth0: link up (1000/Full)
IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

root@zedboard:~#

  • 2
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
### 回答1: PetaLinux是一款基于开源Linux发行版的嵌入式开发工具,用于构建、定制和部署嵌入式Linux系统。2018.3是PetaLinux的版本号,代表其发布的时间和更新内容。 PetaLinux2018.3在之前版本的基础上进行了一些改进和优化。首先,该版本加入了对新的硬件平台的支持,包括新的处理器架构和外设。这意味着开发者可以在更多的硬件平台上使用PetaLinux进行嵌入式系统开发,提高了平台的可扩展性和灵活性。 其次,PetaLinux2018.3在功能上也有所增强。它提供了更多的开发工具和工程模板,使开发者在构建嵌入式系统时更加方便和高效。此外,该版本还改进了系统的性能和稳定性,增加了对多线程和多核处理的支持,提升了系统的并行处理能力。 此外,PetaLinux2018.3还新增了一些软件包和驱动程序,使开发者能够更好地支持各种外设和功能。它还引入了更多的编译器和调试工具,方便开发者进行代码编译和调试,并提供了更多的文档和示例代码,帮助开发者更好地了解和使用PetaLinux。 总之,PetaLinux2018.3是一个经过改进和优化的嵌入式开发工具,提供了更多的硬件支持和功能增强。它可以帮助开发者更方便、高效地构建和定制嵌入式Linux系统,为嵌入式开发提供了更多的选择和可能性。 ### 回答2: PetaLinux是Xilinx公司推出的一款基于Yocto Project构建的嵌入式Linux开发工具。旨在为Xilinx的Zynq和UltraScale系列FPGA提供一个高度优化的Linux发行版。PetaLinux 2018.3是PetaLinux的一个版本,它包含了一些新的功能和改进。 PetaLinux 2018.3版本主要的更新包括对Yocto Project 2.6和Linux内核4.14的支持。这意味着开发人员可以使用最新版本的软件和驱动程序来构建他们的嵌入式Linux系统。该版本还提供了对新硬件平台的支持,包括Zynq UltraScale+ MPSoC ZCU102和ZCU104评估板。 PetaLinux 2018.3还加强了与Xilinx Vivado工具的集成,简化了从硬件设计到软件开发的流程。开发人员可以使用Vivado工具生成硬件设计文件,并直接从PetaLinux中进行导入和配置。这样可以提高整体开发效率,减少开发时间和风险。 此外,PetaLinux 2018.3还增强了对容器化应用程序的支持。开发人员可以使用Docker等容器技术在嵌入式Linux系统中运行和管理应用程序。这为开发人员提供了更大的灵活性和便利性,可以轻松构建和管理复杂的嵌入式应用。 总体而言,PetaLinux 2018.3为开发人员提供了更多的选择和工具来构建高度定制的嵌入式Linux系统。通过与Xilinx Vivado工具集成,支持最新版本的软件和驱动程序,以及对容器化应用程序的增强支持,开发人员可以更加轻松地进行嵌入式系统开发,并在不同的硬件平台上实现高性能和可靠性。 ### 回答3: Petalinux 2018.3是Xilinx公司开发的嵌入式Linux解决方案的一个版本。它是基于开源项目Yocto Project的,旨在帮助开发者构建用于Xilinx器件的定制化Linux操作系统。 Petalinux 2018.3提供了一套完整的工具链,使开发者可以轻松地构建、配置和定制嵌入式Linux系统。它支持多种开发板和处理器架构,包括Zynq-7000和Zynq UltraScale+等。通过使用Petalinux,开发者可以轻松地将Linux操作系统和Xilinx硬件平台结合起来,提供强大的嵌入式计算和图像处理能力。 Petalinux 2018.3具有许多强大的功能。首先,它提供了一个易于使用的界面,使开发者可以快速设置和配置嵌入式Linux系统。其次,它支持全面的嵌入式硬件和软件开发,包括设备驱动程序、文件系统、应用程序等。此外,Petalinux 2018.3还提供了丰富的软件开发工具,如交叉编译器、调试器和性能分析工具,以帮助开发者更好地进行嵌入式软件开发。 总的来说,Petalinux 2018.3是一个强大而灵活的嵌入式Linux解决方案,使开发者能够快速构建和定制嵌入式系统。无论是在工业自动化、智能交通、网络通信等领域,Petalinux 2018.3都能为开发者提供强大的工具和支持,并为他们带来更高效的开发体验。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Ta o

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值