petaLinux常用命令汇总

1
Create a new project from a reference BSP file.
$ petalinux-create -t project -s
用于从官方下载的BSP中抽取数据产生工程。

2
Create a new project based on the MicroBlaze™ template.
$ petalinux-create -t project -n –template microblaze
用于让petalinux工具包,从系统中抽取模板,产生工程。

3
Initialize a PetaLinux project within the project directory with an external HDF.
$ petalinux-config –get-hw-description=
用于指定一个位于工程目录之外的包含HDF的文件夹用于搜索。

4
Initialize a PetaLinux project from within the directory containing an HDF.
$ petalinux-config –get-hw-description -p <%PATH-TO-PETALINUX-PROJECT%>
用于指定一个petalinux工程目录。在工程目录的子目录中,搜索存放HDF文件。

5
Initialize a PetaLinux project from a neutral location
$ petalinux-config –get-hw-description <%PATH-TO-HDF%> -p <%PATH-TO-PETALINUX-PROJECT%>
用于指定一个petalinux工程目录。并指定一个单独的HDF文件。

6
Start the menuconfig for the system-level configuration:
$ petalinux-config

Parse the configuration onto Kconfig without opening the GUI, for the root filesystem:
$ petalinux-config -c rootfs –oldconfig

Load the Linux kernel configuration with a specific default configuration:
$ petalinux-config -c kernel –defconfig xilinx_zynq_base_trd_defconfig

Load the u-boot configuration with a specific default configuration:
$ petalinux-config -c u-boot –defconfig xilinx_zynqmp_zcu102_defconfig

Generate the source code for fsbl/fs-boot:
$ petalinux-config -c bootloader

7
Build the entire PetaLinux project
$ petalinux-build

Build the kernel forcefully
$ petalinux-build -c kernel -f

Compile a kernel forcefully
$ petalinux-build -c kernel -x compile -f

Clean all build collaterals from the U-Boot component of the PetaLinux project.
$ petalinux-build -c u-boot -x cleansstate

Create an updated FIT image from the current contents of the deploy area.
$ petalinux-build -x package

Clean all build collaterals. It removes build/, ${TMPDIR} and images. This will bring the
project to its initial state
$ petalinux-build -x mrproper

Clear the build area of the PetaLinux project for archiving as a BSP or for revision
control. This example retains the images directory of the project
$ petalinux-build -x distclean

8
Download and boot a pre-built bitstream (and FSBL for Zynq-7000 or Zynq UltraScale+
MPSoC) via JTAG to a physical board.
$ petalinux-boot –jtag –prebuilt 1

Download and boot a pre-built U-Boot elf via JTAG to a physical board.
$ petalinux-boot –jtag –prebuilt 2

(For Zynq-7000, it downloads:
- bitstream pre-built/linux/implementation/download.bit
- fsbl pre-built/linux/images/zynq_fsbl.elf
- u-boot pre-built/linux/images/u-boot.elf)
(For Zynq UltraScale+ MPSoC, it downloads:
- bitstream pre-built/linux/implementation/download.bit
- fsbl pre-built/linux/images/zynqmp_fsbl.elf
- ATF pre-built/linux/images/bl31.elf
- u-boot pre-built/linux/images/u-boot.elf
- pmufw pre-built/linux/images/pmufw.elf)

Download and boot a pre-built kernel image via JTAG to a physical board
$ petalinux-boot –jtag –prebuilt 3

(For Zynq-7000, it downloads:
- bitstream pre-built/linux/implementation/download.bit
- fsbl pre-built/linux/images/zynq_fsbl.elf
- DTB pre-built/linux/images/system.dtb
- kernel pre-built/linux/images/zImage)
(For Zynq UltraScale+ MPSoC, it downloads:
- bitstream pre-built/linux/implementation/download.bit
- fsbl pre-built/linux/images/zynqmp_fsbl.elf
- kernel pre-built/linux/images/Image
- DTB pre-built/linux/images/system.dtb
- ATF pre-built/linux/images/bl31.elf
- pmufw pre-built/linux/images/pmufw.elf)

Download and boot a built U-Boot image via JTAG to a physical board
$ petalinux-boot –jtag –u-boot

(For Zynq-7000, it downloads:
- fsbl images/linux/zynq_fsbl.elf
- U-Boot images/linux/u-boot.elf.
° For Zynq UltraScale+ MPSoC, it downloads:
- fsbl images/linux/zynqmp_fsbl.elf
- U-Boot images/linux/u-boot.elf
- ATF images/linux/bl31.elf
- pmufw images/linux/pmufw.elf)

Download and boot a built kernel image via JTAG to a physical board.
$ petalinux-boot –jtag –kernel

(For Zynq-7000, it boots:
- fsbl images/linux/zynq_fsbl.elf
- DTB images/linux/system.dtb
- kernel images/linux/zImage
° For Zynq UltraScale+ MPSoC, it boots:
- fsbl images/linux/zynqmp_fsbl.elf
- kernel images/linux/Image
- DTB images/linux/system.dtb
- ATF images/linux/bl31.elf
- pmufw images/linux/pmufw.elf)

9
Load and boot a pre-built U-Boot elf via QEMU.
$ petalinux-boot –qemu –prebuilt 2

Load and boot a pre-built U-Boot elf via QEMU in root mode.
$ petalinux-boot –qemu –root –prebuilt 2

10
Create a BOOT.BIN file for a Zynq family device (including Zynq-7000 and Zynq UltraScale+ MPSoC).
$ petalinux-package –boot –format BIN –fsbl <%PATH-TO-FSBL%> –u-boot -o <%PATH-TO-OUTPUT-WITH-FILE-NAME%>

Create a BOOT.BIN file for a Zynq family device that includes a PL bitstream and FIT image.
$ petalinux-package –boot –format BIN –fsbl <%PATH-TO-FSBL%> –u-boot –fpga <%PATH-TO-BITSTREAM%> –kernel -o <%PATH-TO-OUTPUT%>

Create a BOOT.BIN file for a Zynq UltraScale+ MPSoC device that includes a PMU firmware.
$ petalinux-package –boot –u-boot –kernel –pmufw <%PATH_TO_PMUFW%>

11
Clean the project and then generate the BSP installation image (.BSP file)
$ petalinux-package –bsp –clean -o <%PATH-TO-BSP%> -p <%PATH-TO-PROJECT%>

Generate the BSP installation image that includes a reference hardware definition
$ petalinux-package –bsp –hwsource <%PATH-TO-HW-EXPORT%> -o <%PATH-TO-BSP%> -p <%PATH-TO-PROJECT%>

Generate the BSP installation image from a neutral location
$ petalinux-package –bsp -p <%PATH-TO-PROJECT%> -o <%PATH-TO-BSP%>

12
Generate uImage
$ petalinux-package –image -c kernel –format uImage
(The uImage is in <%plnx-proj-root%>/images/linux directory)

13
Include a specific bitstream in the pre-built area.
$ petalinux-package –prebuilt –fpga <%BITSTREAM%>

Include a specific data file in the pre-built area.
$ petalinux-package –prebuilt -a <%APP%>:images/<%APP%>

14
Launch the GNU GDB debugger
$ petalinux-util –gdb

Launch a specific Linux kernel image.
$ petalinux-util –jtag-logbuf -i <%PATH-TO-IMAGE%>

Launch the JTAG logger from a neutral location. This workflow is for Zynq-7000 devices only
$ petalinux-util –jtag-logbuf -i <%PATH-TO-IMAGE%> -p <%PATH-TO-PROJECT%>

To find the default bitstream of a project:
$ petalinux-util –find-hdf-bitstream

To find the bitstream of a hdf:
$ petalinux-util –find-hdf-bitstream –hdf-file <%path to hdf file%>

Toggle the WebTalk feature off.
$ petalinux-util –webtalk off

文章来源:Huskar_Liu的博客