开发环境: vivado 2017.4, ubuntu 16.04
开发板: ax7010
编译器: gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf
u-boot: u-boot-xlnx-v2017.4
linux内核: linux-xlnx-xilinx-v2017.4
rootfs: debian文件系统
1.u-boot
make ARCH=arm zynq_zc702_defconfig
make ARCH=arm menuconfig
- BOOT media->support QSPI/SPI flash

- 编译
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
- 编译成功后生产的是 u-boot,重命名为 u-boot.elf,用于生成 BOOT.bin文件
2.linux内核
make ARCH=arm xilinx_zynq_defconfig
make ARCH=arm menuconfig
- Device Drivers->Memory Technology Device(MTD) surport->Self-contained MTD device drivers->support most SPI Flash

- Device Drivers->Common Clock Framework->Digilent axi_dynclk Driver

- Device Drivers->Graphics support-> Digilent VGA/HDMI DRM Encoder Driver

- 编译
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
- 编译成功后生成的 ./arch/arm/boot/zImage 即为内核文件
3.devicetree.dtb
&qspi {
is-dual = <0>;
num-cs = <1>;
spi-rx-bus-width = <4>;
spi-tx-bus-width = <4>;
status = "okay";
flash0: flash@0 {
compatible = "n25q512a","micron,m25p80";
reg = <0x0>;
spi-max-frequency = <50000000>;
partition@0x00000000 {
label = "boot";
reg = <0x00000000 0x00500000>;
};
partition@0x00500000 {
label = "bootenv";
reg = <0x00500000 0x00020000>;
};
partition@0x00520000 {
label = "kernel";
reg = <0x00520000 0x00a80000>;
};
partition@0x00fa0000 {
label = "devicetree";
reg = <0x00fa0000 0x00020000>;
};
partition@0x00fc0000 {
label = "bitstream";
reg = <0x00fc0000 0x00500000>;
};
};
};
/dts-v1/;
/include/ "zynq-7000.dtsi"
/include/ "pl.dtsi"
/include/ "pcw.dtsi"
/ {
chosen {
bootargs = "console=ttyPS0,115200 root=/dev/mmcblk0p2 rw earlyprintk rootfstype=ext4 rootwait earlycon";
stdout-path = "serial0:115200n8";
};
aliases {
ethernet0 = &gem0;
serial0 = &uart1;
spi0 = &qspi;
};
memory {
device_type = "memory";
reg = <0x0 0x20000000>;
};
usb_phy0: usb_phy@0 {
compatible = "ulpi-phy";
reg = <0xe0002000 0x1000>;
view-port = <0x0170>;
drv-vbus;
};
};
&i2c0 {
clock-frequency = <100000>;
};
&usb0 {
dr_mode = "host";
usb-phy = <&usb_phy0>;
};
&sdhci0 {
u-boot,dm-pre-reloc;
};
&uart1 {
u-boot,dm-pre-reloc;
};
&flash0 {
compatible = "micron,m25p80", "w25q256", "spi-flash";
};
&gem0 {
phy-handle = <ðernet_phy>;
ethernet_phy: ethernet-phy@1 {
reg = <1>;
device_type = "ethernet-phy";
};
};
&amba_pl {
hdmi_encoder_0:hdmi_encoder {
compatible = "digilent,drm-encoder";
digilent,edid-i2c = <&i2c0>;
};
xilinx_drm {
compatible = "xlnx,drm";
xlnx,vtc = <&v_tc_0>;
xlnx,connector-type = "HDMIA";
xlnx,encoder-slave = <&hdmi_encoder_0>;
clocks = <&axi_dynclk_0>;
dglnt,edid-i2c = <&i2c0>;
planes {
xlnx,pixel-format = "rgb888";
plane0 {
dmas = <&axi_vdma_0 0>;
dma-names = "dma";
};
};
};
};
&axi_dynclk_0 {
compatible = "digilent,axi-dynclk";
clocks = <&clkc 15>;
};
&v_tc_0 {
compatible = "xlnx,v-tc-5.01.a";
};
dtc -I dts -O dtb -o devicetree.dtb system-top.dts
4.BOOT.bin
- BOOT.bin由FSBL.elf,FPGA.bit,u-boot.elf打包生成
- FSBL.elf
- FPGA.bit
- u-boot.elf
- Xilinx SDK->Xilinx->Create Boot Image->依次添加FSBL.elf,FPGA.bit,u-boot.elf->Create Image

- BOOT.bin即在上图Output path路径下
5.根文件系统
- 将SD卡分为两个区
- Part1 fat32 用于存储BOOT.bin zImage devicetree.dtb
- Part2 ext4 用于存储根文件系统


- 此处使用的是黑金提供的debian系统,写入SD卡ext4fs分区即可。假定挂载路径为/media/dingz/rootfs:
tar -zxvfp debian_rootfs.tar.gz -C /media/dingz/rootfs
6.修改bootargs与bootcmd
- 开发板启动方式设为SD卡启动,连接串口,打开超级终端,autoboot前按下任意键,进入u-boot命令行

setenv bootargs 'console=ttyPS0,115200 root=/dev/mmcblk0p2 rw earlyprintk rootfstype=ext4 rootwait earlycon'
setenv bootcmd 'fatload mmc 0:1 0x2080000 zImage;fatload mmc 0:1 0x2000000 devicetree.dtb;bootz 0x2080000 - 0x2000000'
saveenv
print
boot

7.相关网站