-
平台:Vivado2020.1 XCZU4EV
-
Vivado配置
-
petalinux配置
我的flash为32MB的空间,具体分区应原则根据boot.scr boot.bin image.ub root.jffs2这几个文件的大小来。
从flash启动boot;
从flash启动内核;
从flash启动jffs2根文件系统;
注意擦除块大小要与实际芯片一致;
uboot设置
bootscr的偏置需要与前面分区设置一致;
- 设备树
&qspi {
status = “okay”;
flash@0 {
compatible = “m25p80”;
#address-cells = <1>;
#size-cells = <1>;
reg = <0x0>;
spi-tx-bus-width = <1>;
spi-rx-bus-width = <4>;
spi-max-frequency = <108000000>; /* Based on DC1 spec */
partition@0 {
reg = <0x00000000 0x00900000>;
label = “boot”;
};
partition@1 {
reg = <0x00900000 0x00080000>;
label = “bootenv”;
};
partition@2 {
reg = <0x00980000 0x00800000>;
label = “kernel”;
};
partition@3 {
reg = <0x01180000 0x00e00000>;
label = “jffs2”;
};
partition@4 {
reg = <0x01f80000 0x00080000>;
label = “bootscr”;
};
};
};
还有u-boot-zynq-scr.bbappend文件需要修改,目的都是为了与config的分区参数一致;
- 驱动
更改sf.c中的速度参数,不然启动会很慢,这里设置成50M;
更改spi-nor.c,禁止4k的擦除块模式;
开始编译,编译完成后,linux打印信息如下:
Xilinx Zynq MP First Stage Boot Loader
Release 2020.1 Nov 16 2022 - 08:38:29
NOTICE: ATF running on XCZU4EV/silicon v4/RTL5.1 at 0xfffea000
NOTICE: BL31: v2.2(release):v1.1-5588-g5918e656e
NOTICE: BL31: Built : 09:57:15, Nov 16 2022
U-Boot 2020.01 (Nov 16 2022 - 09:57:13 +0000)
Board: Xilinx ZynqMP
DRAM: 4 GiB
usb dr_mode not found
PMUFW: v1.1
EL Level: EL2
Chip ID: zu4ev
NAND: 0 MiB
MMC: mmc@ff160000: 0, mmc@ff170000: 1
In: serial@ff000000
Out: serial@ff000000
Err: serial@ff000000
Bootmode: QSPI_MODE
Reset reason: EXTERNAL
Net:
ZYNQ GEM: ff0e0000, mdio bus ff0e0000, phyaddr -1, interface rgmii-id
Warning: ethernet@ff0e0000 using MAC address from DT
eth0: ethernet@ff0e0000
Hit any key to stop autoboot: 0
SF: Detected n25q256ax1 with page size 256 Bytes, erase size 64 KiB, total 32 MiB
device 0 offset 0x1f80000, size 0x80000
SF: 524288 bytes @ 0x1f80000 Read: OK
Executing script at 20000000
SF: Detected n25q256ax1 with page size 256 Bytes, erase size 64 KiB, total 32 MiB
device 0 offset 0x980000, size 0x800000
SF: 8388608 bytes @ 0x980000 Read: OK
Loading kernel from FIT Image at 10000000 …
Using ‘conf@system-top.dtb’ configuration
Trying ‘kernel@1’ kernel subimage
Description: Linux kernel
Type: Kernel Image
Compression: gzip compressed
Data Start: 0x100000e8
Data Size: 8120662 Bytes = 7.7 MiB
Architecture: AArch64
OS: Linux
Load Address: 0x00080000
Entry Point: 0x00080000
Hash algo: sha256
Hash value: e87a68efda72250b022d0cf3a1ee09fbd13d35026c3fbf9d8cedeacdd7f86fa1
Verifying Hash Integrity … sha256+ 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: 0x107beb50
Data Size: 38910 Bytes = 38 KiB
Architecture: AArch64
Hash algo: sha256
Hash value: 3c5f4eb7e5426e25484d3d35d4e5defc12a8454da7730d3c1afe76035ad29783
Verifying Hash Integrity … sha256+ OK
Booting using the fdt blob at 0x107beb50
Uncompressing Kernel Image
Loading Device Tree to 000000000fff3000, end 000000000ffff7fd … OK
Starting kernel …
[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[ 0.000000] Linux version 5.4.0-xilinx-v2020.1 (oe-user@oe-host) (gcc version 9.2.0 (GCC)) #1 SMP Wed Nov 16 08:32:44 UTC 2022
[ 0.000000] Machine model: xlnx,zynqmp
[ 0.000000] earlycon: cdns0 at MMIO 0x00000000ff000000 (options ‘115200n8’)
[ 0.000000] printk: bootconsole [cdns0] enabled
[ 0.000000] efi: Getting EFI parameters from FDT:
[ 0.000000] efi: UEFI not found.
[ 0.000000] cma: Reserved 1000 MiB at 0x0000000041