zynq-mpsoc系列之用petalinux生成zcu102的BOOT.bin文件
作者:卢浩
时间:2017.2.28
转载请注明出处
首先我们来了解一下petalinux-package的用法
Usage:
petalinux-package --boot [options]
Options for boot image package:
-h|--help Display help messages
--force Force overwrite the boot binary image
--format <FORMAT> Avaiable formats:
For Zynq:
* BIN (default): generate BIN file to be put to
Flash or SD for Zynq to boot from it.
For MicroBlaze:
* MCS: generate MCS file
--fsbl <FSBL_ELF> Path to FSBL ELF image location.
For Zynq:
Default is images/linux/zynq_fsbl.elf
For ZynqMP:
Default is images/linux/zynqmp_fsbl.elf
For MicroBlaze:
Default is images/linux/fs-boot.elf
Please use "--fsbl none" for no fsbl if required.
--fpga <BITSTREAM> Path to FPGA bitstream image location
Default is: images/linux/*.bit (The one copied from the HDF)
--atf [<ATF_IMG>] ZynqMP only. Path to ATF
--pmufw [<PMUFW_ELF>] Path to the PMUFW ELF location
Optional and applicable only for ZynqMP.
* path to the PMUFW ELF image
default: <PROJECT>/prebuilt/linux/images/pmufw.elf
* By default, pre-built pmufw is packed without specifying this option.
To skip packing pmufw use --pmufw no
--u-boot [<U_BOOT_IMG>] Path to the u-boot image location.
Not valid for DOWNLOAD.BIT
For Zynq:
* path to the u-boot ELF image
default: <PROJECT>/images/linux/u-boot.elf
For MicroBlaze:
* path to the u-boot-s.bin image
default: <PROJECT>/images/linux/u-boot-s.bin
--kernel [<KERNEL_ING>] Path to the kernel image location
Not valid for DOWNLOAD.BIT
Default: <PROJECT>/images/linux/image.ub
--add <DATA_FILE> Path to the data to add
--offset <OFFSET> offset of previously specified data file, u-boot
, or kernel image.
--bmm <BMM_FILE> Bitstream BMM file. Valid for MicroBlaze only.
It will be used to generate the download.bit with
bootloader in the bram. Default will be the BMM
file in the same directory as the FPGA bitstream.
This is deprecated and an MMI file should be used instead.
--mmi <MMI_FILE> Bitstream MMI file. Valid for MicroBlaze only.
It will be used to generate the download.bit with
bootloader in the bram. Default will be the MMI
file in the same directory as the FPGA bitstream.
--flash-size <FLASH_SIZE> Flash size in MBytes of the PROM device is targeted.
It must be power of 2.
Only valid for MicroBlaze MCS format.
If this value is not specified. It will auto detect
the system flash configured from system config.
If it is parallel flash, it will auto detect flash
size.
If it is SPI flash, the default is 16 Mbytes.
--flash-intf <INTERFACE> Flash interface. Available options:
Only valid for MicroBlaze MCS
* SERIALx1
* SPIx1
* SPIx2
* SPIx4
* BPIx8
* BPIx16
* SMAPx8
* SMAPx16
* SMAPx32
If not specified, it will auto detect the system
flash configured from system config.
If it is parallel flash, it will auto detect flash
width. If it is SPI flash, the default will be SPIx1.
-o, --output <PKGNAME> Generated boot image name
-p, --project <PROJECT> PetaLinux SDK project location.
Default is the working project.
--cpu <DESTINATE CPU> ZynqMP only. destination CPU of the data file
--file-attribute <DATA File ATTR> Zynq/ZynqMP only. data file file-attribute
--bif-attribute <ATTRIBUTE> Zynq/ZynqMP only. name of BIF attribute
--bif-attribute-value <VALUE> Zynq/ZynqMP only. value of the attribute specified by
--attribute argument
--fsblconfig <BIF FSBL CONFIG> Zynq/ZynqMP only. BIF fsbl config value
--bif <BIF> Zynq/ZynqMP only. BIF file. It overrides all
other settings:
--fsbl, --fpga, --u-boot, --add, --fsblconfig,
--file-attribute, --bif-attribute and
--bif-attribute-value.
--boot-device <BOOT_DEV> valid for BIN for Zynq and ZynqMP only.
sd | flash
default will be the one selected from system select menu
of boot image settings
EXAMPLES:
Package BOOT.BIN for ZynqMP:
$ petalinux-package --boot --fsbl <FSBL_ELF> --fpga <BITSTREAM> --u-boot --pmufw <PMUFW_ELF>
It will generate a BOOT.BIN in your working directory with:
* specified <BITSTREAM>
* specified <FSBL_ELF>
* specified < PMUFW_ELF > *
* newly built u-boot image which is <PROJECT>/images/linux/u-boot.elf
petalinux-package --boot [options]
Options for boot image package:
-h|--help Display help messages
--force Force overwrite the boot binary image
--format <FORMAT> Avaiable formats:
For Zynq:
* BIN (default): generate BIN file to be put to
Flash or SD for Zynq to boot from it.
For MicroBlaze:
* MCS: generate MCS file
--fsbl <FSBL_ELF> Path to FSBL ELF image location.
For Zynq:
Default is images/linux/zynq_fsbl.elf
For ZynqMP:
Default is images/linux/zynqmp_fsbl.elf
For MicroBlaze:
Default is images/linux/fs-boot.elf
Please use "--fsbl none" for no fsbl if required.
--fpga <BITSTREAM> Path to FPGA bitstream image location
Default is: images/linux/*.bit (The one copied from the HDF)
--atf [<ATF_IMG>] ZynqMP only. Path to ATF
--pmufw [<PMUFW_ELF>] Path to the PMUFW ELF location
Optional and applicable only for ZynqMP.
* path to the PMUFW ELF image
default: <PROJECT>/prebuilt/linux/images/pmufw.elf
* By default, pre-built pmufw is packed without specifying this option.
To skip packing pmufw use --pmufw no
--u-boot [<U_BOOT_IMG>] Path to the u-boot image location.
Not valid for DOWNLOAD.BIT
For Zynq:
* path to the u-boot ELF image
default: <PROJECT>/images/linux/u-boot.elf
For MicroBlaze:
* path to the u-boot-s.bin image
default: <PROJECT>/images/linux/u-boot-s.bin
--kernel [<KERNEL_ING>] Path to the kernel image location
Not valid for DOWNLOAD.BIT
Default: <PROJECT>/images/linux/image.ub
--add <DATA_FILE> Path to the data to add
--offset <OFFSET> offset of previously specified data file, u-boot
, or kernel image.
--bmm <BMM_FILE> Bitstream BMM file. Valid for MicroBlaze only.
It will be used to generate the download.bit with
bootloader in the bram. Default will be the BMM
file in the same directory as the FPGA bitstream.
This is deprecated and an MMI file should be used instead.
--mmi <MMI_FILE> Bitstream MMI file. Valid for MicroBlaze only.
It will be used to generate the download.bit with
bootloader in the bram. Default will be the MMI
file in the same directory as the FPGA bitstream.
--flash-size <FLASH_SIZE> Flash size in MBytes of the PROM device is targeted.
It must be power of 2.
Only valid for MicroBlaze MCS format.
If this value is not specified. It will auto detect
the system flash configured from system config.
If it is parallel flash, it will auto detect flash
size.
If it is SPI flash, the default is 16 Mbytes.
--flash-intf <INTERFACE> Flash interface. Available options:
Only valid for MicroBlaze MCS
* SERIALx1
* SPIx1
* SPIx2
* SPIx4
* BPIx8
* BPIx16
* SMAPx8
* SMAPx16
* SMAPx32
If not specified, it will auto detect the system
flash configured from system config.
If it is parallel flash, it will auto detect flash
width. If it is SPI flash, the default will be SPIx1.
-o, --output <PKGNAME> Generated boot image name
-p, --project <PROJECT> PetaLinux SDK project location.
Default is the working project.
--cpu <DESTINATE CPU> ZynqMP only. destination CPU of the data file
--file-attribute <DATA File ATTR> Zynq/ZynqMP only. data file file-attribute
--bif-attribute <ATTRIBUTE> Zynq/ZynqMP only. name of BIF attribute
--bif-attribute-value <VALUE> Zynq/ZynqMP only. value of the attribute specified by
--attribute argument
--fsblconfig <BIF FSBL CONFIG> Zynq/ZynqMP only. BIF fsbl config value
--bif <BIF> Zynq/ZynqMP only. BIF file. It overrides all
other settings:
--fsbl, --fpga, --u-boot, --add, --fsblconfig,
--file-attribute, --bif-attribute and
--bif-attribute-value.
--boot-device <BOOT_DEV> valid for BIN for Zynq and ZynqMP only.
sd | flash
default will be the one selected from system select menu
of boot image settings
EXAMPLES:
Package BOOT.BIN for ZynqMP:
$ petalinux-package --boot --fsbl <FSBL_ELF> --fpga <BITSTREAM> --u-boot --pmufw <PMUFW_ELF>
It will generate a BOOT.BIN in your working directory with:
* specified <BITSTREAM>
* specified <FSBL_ELF>
* specified < PMUFW_ELF > *
* newly built u-boot image which is <PROJECT>/images/linux/u-boot.elf
首先我来介绍生成一个简单的BOOT.bin文件,包含fsbl,u-boot.elf,bl31.elf;
输入如下命令:
$ petalinux-package --boot --fsbl images/linux/zynqmp_fsbl.elf --u-boot=images/linux/u-boot.elf --pmufw no --atf --force
下面是输入命令之后的打印信息:
INFO: File in BOOT BIN: "/home/luhao/xilinx/peta_project/xilinx-zcu102-2016.4/images/linux/zynqmp_fsbl.elf"
INFO: File in BOOT BIN: "/home/luhao/xilinx/peta_project/xilinx-zcu102-2016.4/images/linux/bl31.elf"
INFO: File in BOOT BIN: "/home/luhao/xilinx/peta_project/xilinx-zcu102-2016.4/images/linux/u-boot.elf"
INFO: Generating zynq binary package BOOT.BIN...
INFO: Binary is ready.
INFO: File in BOOT BIN: "/home/luhao/xilinx/peta_project/xilinx-zcu102-2016.4/images/linux/zynqmp_fsbl.elf"
INFO: File in BOOT BIN: "/home/luhao/xilinx/peta_project/xilinx-zcu102-2016.4/images/linux/bl31.elf"
INFO: File in BOOT BIN: "/home/luhao/xilinx/peta_project/xilinx-zcu102-2016.4/images/linux/u-boot.elf"
INFO: Generating zynq binary package BOOT.BIN...
INFO: Binary is ready.
petalinux-package --boot 用来生成一个BOOT.bin目标文件;
--fsbl images/linux/zynqmp_fsbl.elf 代表着fsbl的路径;
--u-boot=images/linux/u-boot.elf 代表着u-boot.elf的路径;
--pmufw no 表示禁用pmufw,如果不加no,默认路径就是image/linux/pmufw.elf;
--force是覆盖之前生成的BOOT.bin文件;
bl31.elf是atf文件,arm加密固件;
如果需要加入bit文件,请加入如下选项
--fpga images/linux/design_1_wrapper.bit