ZYNQ基于Petalinux工具进行Linux驱动敏捷开发(待修订)

587 阅读1分钟

1 配置 Petalinux 工程

source /opt/pkg/petalinux/2018.3/settings.sh
petalinux-config

image.png

  • 在弹出的配置窗口中,进入到“Linux Components Selection--->linux-kernel(linux-xlnx)”菜单下,配置 Linux 内核来源。此处选择“ext-local-src”,也就是本地存放的 Linux内核源码 image.png image.png
  • 接着配置 U-Boot 源码来源,连按两次 ESC 键回到上一级菜单,选择“u-boot (u-boot-xlnx) --->”配置项,按回车设置 U-Boot 源码来源,同样这里我们也是选择“ext-local-src”,也就是本地存放的 U-Boot 源码 image.png image.png

2 配置 Linux内核

image.png

3 配置设备树,生成dtb文件

petalinux-build -c u-boot
  • 在 Petalinux 工 程 中 执 行 编 译 uboot 后 , 会 在 工 程 的components/plnx_workspace/device-tree/device-tree/目录下生成设备树文件,如下图所示: image.png

3.1 添加设备树文件到linux源码

  • 将前面生成的设备树文件(笔者这里生成的设备树文件在 Petalinux 工程的components/plnx_workspace/device-tree/device-tree/目录下)pcw.dtsi、pl.dtsi、system-top.dts 以及 zynq-7000.dtsi 四个文件直接拷贝到内核源码目录下的 arch/arm/boot/dts 目录中 image.png image.png image.png

4 编译 rootfs

image.png

image.png