我认为比较容易制作的启动盘是从SD卡启动,但实际中很需要直接从QSPI启动。
那么本文是在制作从SD卡的基础上完成的。如果你有不清楚,那就先看看我的另篇博客 petalinux 2018.2 在ubuntu 16 下的工程制作并启动实验 链接是:https://blog.csdn.net/leon_zeng0/article/details/82766521
那篇文章介绍从SD 启动的制作过程。
与从SD启动不同的只有2点:参数设置,打包下载。
1: 参数设置通过运行 petalinux-config 来实现。设置的内容就是从QSPI启动,媒介存在QSPI。
在Linux计算机上运行以下步骤,将引导模式更改为QSPI闪存(以下操作参见ug1167 page82)。
a: 切换到PetaLinux项目的根目录:
$ cd
b: 启动顶级系统配置菜单:
$ petalinux-config
c: 选择子系统AUTO硬件设置(Subsystem AUTO Hardware Settings)。
d: 选择“高级可启动映像存储设置”(Advanced Bootable Images Storage Settings)。
- 选择启动映像设置(boot image settings)。
- 选择图像存储介质(Image Storage Media)。
- 选择启动设备作为主闪存(primary flash)。
e: 在“高级可启动映像存储设置”子菜单下:
- 选择内核映像设置(kernel image settings).。
- 选择图像存储介质(Image Storage Media)。
- 选择存储设备作为主闪存(primary flash)。
f: 保存配置设置并退出配置向导。
g: 使用Petalinux-build命令重建
以下就用图来表示:
上面就是设置的一些界面。
2:设置完后按照SD卡启动盘制作过程一样编译, petalinux-build
或者分几步完成:
petalinux-config -c bootloader
petalinux-build -c bootloader
petalinux-config -c u-boot
petalinux-build -c u-boot
petalinux-build
3: 打包 petalinux-package
3.1:打包有2种方式,一种和SD卡制作打包一样
petalinux-package --boot --fsbl
这种方式不包括 imag.ub
操作示例如下:我这里是先cd ~/pro/gpio/images/linux,否则要加路径。
liwenz@ubuntu:~/pro/gpio/images/linux$ petalinux-package --boot --fsbl zynq_fsbl.elf --fpga system.bit --u-boot
INFO: Getting system flash information...
rlwrap: warning: your $TERM is 'xterm-256color' but rlwrap couldn't find it in the terminfo database. Expect some problems.: Inappropriate ioctl for device
INFO: File in BOOT BIN: "/home/liwenz/pro/gpio/images/linux/zynq_fsbl.elf"
INFO: File in BOOT BIN: "/home/liwenz/pro/gpio/images/linux/system.bit"
INFO: File in BOOT BIN: "/home/liwenz/pro/gpio/images/linux/u-boot.elf"
INFO: Generating zynq binary package BOOT.BIN...
****** Xilinx Bootgen v2018.2
**** Build date : Jun 14 2018-20:09:18
** Copyright 1986-2018 Xilinx, Inc. All Rights Reserved.
INFO: Binary is ready.
liwenz@ubuntu:~/pro/gpio/images/linux$
3.2:还有一种方式就是包含imag.ub, 命令如下:
petalinux-package --boot --fsbl
包含imag.ub 的方式不同点就是 后面多了 --kernel 这个option。
操作示例如下:我这里是先cd ~/pro/gpio/images/linux,否则要加路径。
liwenz@ubuntu:~/pro/gpio/images/linux$ petalinux-package --boot --fsbl zynq_fsbl.elf --fpga system.bit --u-boot --kernel
INFO: Getting system flash information...
rlwrap: warning: your $TERM is 'xterm-256color' but rlwrap couldn't find it in the terminfo database. Expect some problems.: Inappropriate ioctl for device
INFO: File in BOOT BIN: "/home/liwenz/pro/gpio/images/linux/zynq_fsbl.elf"
INFO: File in BOOT BIN: "/home/liwenz/pro/gpio/images/linux/system.bit"
INFO: File in BOOT BIN: "/home/liwenz/pro/gpio/images/linux/u-boot.elf"
INFO: File in BOOT BIN: "/home/liwenz/pro/gpio/images/linux/image.ub"
INFO: Generating zynq binary package BOOT.BIN...
****** Xilinx Bootgen v2018.2
**** Build date : Jun 14 2018-20:09:18
** Copyright 1986-2018 Xilinx, Inc. All Rights Reserved.
INFO: Binary is ready.
liwenz@ubuntu:~/pro/gpio/images/linux$
这2种方式对应不同的下载方式。
3.3:包含image.ub的这种方式适合用SDK 软件里的 Program Flash。
这个方式应该先把启动方式拨为QSPI,然后才烧写。
具体操作是先菜单 Xilinx->Program FPGA 下载流文件,然后Xilinx->Program FLASH 选择这个BOOT.BIN,然后下载,要等待一些时间才能完成。
3.4: 不包含image.ub的这种方式适合用SD卡启动烧写。
把BOOT.BIN 改名BOOT_qspi.BIN,然后复制到sd卡里,利用sd卡启动方式 启动板卡
然后在petalinux终端或者说串口终端:
mount /dev/mmcblk0p1 /mnt 这步是安装SD 卡,
flashcp /mnt/BOOT_QSPI.BIN /dev/mtd0 烧写BOOT 文件到/dev/mtd0
flashcp /mnt/image.ub /dev/mtd2 烧写image.ub 文件到/dev/mtd2
如果已经SD 卡启动了,不想取下SD卡,也可以用tftp 方式,我就是这样的。
把BOOT.BIN 复制到ubuntu 的tftp 目录,然后在petalinux终端或者说串口终端:
tftp -gr BOOT.BIN 192.168.1.102
tftp -gr image.ub 192.168.1.102
这样传送文件到petalinux 主机这边,然后与上面类似操作:
flashcp BOOT.BIN /dev/mtd0
flashcp image.ub /dev/mtd2
烧写后,当然要拨到QSPI启动方式,就可以启动了。
下面是我的启动过程,想对比就看一下,本文介绍到此结束。
U-Boot 2018.01 (Oct 02 2018 - 23:01:35 -0400) Xilinx Zynq ZC702
Board: Xilinx Zynq
Silicon: v3.1
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@e0001000
Out: serial@e0001000
Err: serial@e0001000
Board: Xilinx Zynq
Silicon: v3.1
Net: ZYNQ GEM: e000b000, phyaddr ffffffff, interface rgmii-id
eth0: ethernet@e000b000
U-BOOT for gpio
ethernet@e000b000 Waiting for PHY auto negotiation to complete.... done
BOOTP broadcast 1
BOOTP broadcast 2
DHCP client bound to address 192.168.1.100 (1001 ms)
Hit any key to stop autoboot: 0
SF: Detected s25fl256s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
device 0 offset 0x520000, size 0xa80000
SF: 11010048 bytes @ 0x520000 Read: OK
## Loading kernel from FIT Image at 10000000 ...
Using '[email protected]' configuration
Verifying Hash Integrity ... OK
Trying 'kernel@1' kernel subimage
Description: Linux kernel
Type: Kernel Image
Compression: gzip compressed
Data Start: 0x10000104
Data Size: 3938599 Bytes = 3.8 MiB
Architecture: ARM
OS: Linux
Load Address: 0x00008000
Entry Point: 0x00008000
Hash algo: sha1
Hash value: e13b9ecf3782574634833c1e5de913f6211baacf
Verifying Hash Integrity ... sha1+ OK
## Loading ramdisk from FIT Image at 10000000 ...
Using '[email protected]' configuration
Trying 'ramdisk@1' ramdisk subimage
Description: petalinux-user-image
Type: RAMDisk Image
Compression: gzip compressed
Data Start: 0x103c5224
Data Size: 6027083 Bytes = 5.7 MiB
Architecture: ARM
OS: Linux
Load Address: unavailable
Entry Point: unavailable
Hash algo: sha1
Hash value: 704620c8f1cea630f65708da329c54a2bdd29959
Verifying Hash Integrity ... sha1+ OK
## Loading fdt from FIT Image at 10000000 ...
Using '[email protected]' configuration
Trying '[email protected]' fdt subimage
Description: Flattened Device Tree blob
Type: Flat Device Tree
Compression: uncompressed
Data Start: 0x103c1b2c
Data Size: 13880 Bytes = 13.6 KiB
Architecture: ARM
Hash algo: sha1
Hash value: 92d3602da3cc447cb6f1ba5817997be5065d9e25
Verifying Hash Integrity ... sha1+ OK
Booting using the fdt blob at 0x103c1b2c
Uncompressing Kernel Image ... OK
Loading Ramdisk to 07a40000, end 07fff74b ... OK
Loading Device Tree to 07a39000, end 07a3f637 ... OK
Starting kernel ...
Booting Linux on physical CPU 0x0
Linux version 4.14.0-xilinx-v2018.2 (oe-user@oe-host) (gcc version 7.2.0 (GCC)) #1 SMP PREEMPT Tue Oct 2 21:49:51 EDT 2018
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
bootconsole [earlycon0] enabled
Memory policy: Data cache writealloc
cma: Reserved 16 MiB at 0x1f000000
percpu: Embedded 16 pages/cpu @debc6000 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: 487168K/524288K available (6144K kernel code, 238K rwdata, 1560K rodata, 1024K init, 153K bss, 20736K 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 - 0xc0a3b900 ( 239 kB)
.bss : 0xc0a3b900 - 0xc0a61e44 ( 154 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 = 6249999) is a xuartps
`¬Ëk½±•[ttyPS0] enabled
console [ttyPS0] enabled
bootconsole [earlycon0] disabled
bootconsole [earlycon0] disabled
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
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: 5888K
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)
RTL8211E Gigabit Ethernet e000b000.ethernet-ffffffff:00: attached PHY driver [RTL8211E Gigabit Ethernet] (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
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 e083e000 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
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 0001
Freeing unused kernel memory: 1024K
INIT: mmcblk0: mmc0:0001 ASTC 7.44 GiB (ro)
mmcblk0: p1
version 2.88 booting
Starting udev
udevd[730]: starting version 3.2.2
udevd[731]: starting eudev-3.2.2
hwclock: can't open '/dev/misc/rtc': No such file or directory
Wed Oct 3 03:02:51 UTC 2018
hwclock: can't open '/dev/misc/rtc': No such file or directory
Starting internet superserver: inetd.
Configuring packages on first boot....
(This may take several minutes. Please do not power off the machine.)
Running postinst /etc/rpm-postinsts/100-sysvinit-inittab...
update-rc.d: /etc/init.d/run-postinsts exists during rc.d purge (continuing)
Removing any system startup links for run-postinsts ...
/etc/rcS.d/S99run-postinsts
INIT: Entering runlevel: 5
Configuring network interfaces... IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
udhcpc (v1.24.1) started
Sending discover...
macb e000b000.ethernet eth0: link up (100/Full)
IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
Sending discover...
Sending select for 192.168.1.100...
Lease of 192.168.1.100 obtained, lease time 7200
/etc/udhcpc.d/50default: Adding DNS 192.168.1.1
done.
Starting Dropbear SSH server: Generating key, this may take a while...
Public key portion is:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCJi+O15fozYa/ldQai43tvVhVktqtQb8qg86m0rZJLUHTd1+ApBe3xbpewANrf4qrkGlbfEIlZY3/ZK2viI1dXhj425XbOCBN8Ch8uwhjeK4nNM2OTRGE1VLdyMsJlv6rLpmhJWX0W3/AqGOzNv0KZb9Aw25ZPN58WFShHLXMcSDT/wvwLyjJAVYEDY+qcKW/jOGTMUOL0NpikenB3tMIRgFCB2uT3eGSotTl0dNsBecRpDuv+BeShOspIn/6lRPV/Ok8l7g5zrLOPx3IA5maRE8mjedYvVFVj5ldssnL6P7gm8ic/fMsn8hzicLAzvhHA6jXaNd3tZLnBc0IXWbG3 root@gpio
Fingerprint: md5 32:72:99:5d:6b:77:db:57:db:a8:42:27:1a:89:4a:74
dropbear.
hwclock: can't open '/dev/misc/rtc': No such file or directory
Starting syslogd/klogd: done
Starting tcf-agent: OK
PetaLinux 2018.2 gpio /dev/ttyPS0
gpio login: root
Password:
root@gpio:~#