新建Petalinux工程:
petalinux-create -t project --template zynq -n <NAME>
导入vivado hdf文件:
petalinux-config --get-hw-description=<hdf所在目录>
打包启动镜像:
petalinux-package --boot --fsbl --fpga --uboot --force
烧录进SD卡流程:
1 2 3 4 5 6 7 8 9 10
| #!/bin/sh
sudo rm -rf /media/sunlee/BOOT/* sudo rm -rf /media/sunlee/rootfs/*
sudo cp BOOT.BIN image.ub /media/sunlee/BOOT/ sudo tar -zxvf rootfs.tar.gz -C /media/sunlee/rootfs/
sudo umount /media/sunlee/BOOT sudo umount /media/sunlee/rootfs
|
更换hdf文件后重新生成设备树:
petalinux-config -c device-tree
将工程打包为BSP文件:
petalinux-package --bsp -p <plnx-proj-root> \ --hwsource <hw-project-root> --output MY.BSP
根据BSP文件新建petalinux工程:
petalinux-create -t project -s ./BSP0.bsp
Petalinux安装问题:
1 2 3 4 5 6 7
| sudo dpkg --add-architecture i386 sudo apt update
sudo locale-gen en_US en_US.UTF-8 sudo dpkg-reconfigure locales
export LANG=en_US.UTF-8
|
交叉编译内核:
1 2
| make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- xilinx_zynq_defconfig make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage -j4
|
u-boot tftp启动
1 2 3 4 5 6
| setenv bitstream_load_address 0x100000 setenv bitstream_image system.bit setenv bitstream_size 0x300000 setenv kernel_image zImage setenv devicetree_image system.dtb setenv sdboot 'run uenvboot; echo Copying Linux from tftp to RAM... && load mmc 0 ${bitstream_load_address} ${bitstream_image} && fpga loadb 0 ${bitstream_load_address} ${bitstream_size} && load mmc 0 ${kernel_load_address} ${kernel_image} && load mmc 0 ${devicetree_load_address} ${devicetree_image} && bootz ${kernel_load_address} - ${devicetree_load_address};'
|
内核不打印找log(不好使)
1 2
| cat ./System.map | grep -n __log_buf 57604:c0a40d7c b __log_buf
|
u-boot启动内核失败
uEnv.txt (换行符Linux(LF))
1 2 3 4 5 6 7 8 9
| serverip=192.168.5.195 bitstream_load_address=0x100000 bitstream_image=system.bit bitstream_size=0x300000 kernel_image=zImage devicetree_image=system.dtb kernel_load_address=0x2080000 devicetree_load_address=0x2000000 sdboot=run uenvboot; echo Copying Linux... && tftpboot ${bitstream_load_address} system.bit && fpga loadb 0 ${bitstream_load_address} ${bitstream_size} && tftpboot ${kernel_load_address} ${kernel_image} && tftpboot ${devicetree_load_address} ${devicetree_image} && bootz ${kernel_load_address} - ${devicetree_load_address};
|
1saveenv boot_cmd ‘run uenvboot;run boot_cmd’