详细的安装步骤参考:petalinux安装步骤
编译petalinux
运行环境
source ~/petalinux/settings.sh
创建项目
petalinux-create -t project --template zynqMP --name h1_petalinux_test
导入硬件配置
cp XXX.hdf h1_petalinux_test/
cd h1_petalinux_test
petalinux-config --get-hw-description=.
配置和编译
petalinux-config -c kernel
petalinux-config -c u-boot
petalinux-config -c rootfs
petalinux-build //编译
生成BOOT.BIN
cd image/linux
petalinux-package --boot --format BIN --fsbl zynqmp_fsbl.elf --u-boot u-boot.elf --pmufw pmufw.elf --fpga *.bit --force
添加驱动模块
在文件系统中添加编译好的app
petalinux-create -t apps --template install --name myapp --enable
cd project-spec/meta-user/recipes-apps/myapp/files/
rm myapp
cp /XXX/myapp myapp // myapp 为应用程序的可执行文件
petalinux-build
可在/usr/bin下看到自己的应用程序(板卡运行)
板卡运行
cd image/linux/
拷贝BOOT.BIN image.ub 到SD卡中
应用程序编译
/home/ubuntu1604/petalinux/tools/linux-i386/aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc
petalinux 自动登录
petalinux-config
Select Yocto-settings > Enable debug-tweaks
Save the configuration and exit
petalinux-build
应用程序自启动
petalinux-create -t apps --template install -n myapp-init --enable
cd project-spec/meta-user/recipes-apps/myapp-init/
修改 myapp-init.bb文件
#
# This file is the myapp-init recipe.
#
SUMMARY = "Simple myapp-init application"
SECTION = "PETALINUX/apps"
LICENSE = "MIT"
LIC_FILES_CHKSUM =
"file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = "file://myapp-init \
"
S = "${WORKDIR}"
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
inherit update-rc.d
INITSCRIPT_NAME = "myapp-init"
INITSCRIPT_PARAMS = "start 99 S ."
do_install() {
install -d ${D}${sysconfdir}/init.d
install -m 0755 ${S}/myapp-init ${D}${sysconfdir}/init.d/myapp-init
}
FILES_${PN} += "${sysconfdir}/*"
cd files
修改文件 myapp-init
/usr/bin/myapp
文章参考:ug1144-petalinux-tools-reference-guide.pdf