当前位置:   article > 正文

ZC706+petalinux+vivado最小系统建立实践_unable to access the tftpboot folder /tftpboot!!!

unable to access the tftpboot folder /tftpboot!!!

1.首先搭建硬件环境(导出hdf文件)

1)进入vivado工程选择合适的板子型号,题主的板卡是zc706,芯片型号如下:

2)创建IPdesign

3)本文硬件上,将在ZYNQ Processing system里启用TTC、UART、SD以及之后可能用到的USB、Ethernet(网口0在bank1,bank1电压要选1.8V,否则报错)

 MDIO也得选

4)然后automation自动连接外设

 5)generate block design and generate output products

 选择global

6)create HDL wrapper

7) 然后综合和implement,最后export hardware 生成hdf硬件描述语言

 2.petalinux构建镜像文件

2.1步骤:

1.创建petalinux工程

2.将.hdf文件导入petalinux工程中

3.配置petalinux工程(配置内核,配置uboot,以及根文件系统)

4.编译petalinux工程(uboot镜像,内核镜像,rootfs,bitstream,fsbl镜像文件)

5.启动开发板子

 2.2实践:

进入petalinux目录

命令说明

petalinux -boot 启动开发板

petalinux -build编译

petalinux -config 配置

petalinux -create 创建

petalinux -package 打包

  1. z@ubuntu:~/PetaLinux2019.1$ petalinux-create --help
  2. petalinux-create (c) 2005-2019 Xilinx, Inc.
  3. This command creates a new PetaLinux Project or component
  4. Usage:
  5. petalinux-create [options] <-t|--type <TYPE> <-n|--name <COMPONENT_NAME>
  6. Required:
  7. -t, --type <TYPE> Available type:
  8. * project : PetaLinux project
  9. * apps : Linux user application
  10. * modules : Linux user module
  11. -n, --name <COMPONENT_NAME> specify a name for the component or
  12. project. It is OPTIONAL to create a
  13. PROJECT. If you specify source BSP when
  14. you create a project, you are not
  15. required to specify the name.
  16. Options:
  17. -p, --project <PROJECT> specify full path to a PetaLinux project
  18. this option is NOT USED for PROJECT CREATION.
  19. default is the working project.
  20. --force force overwriting an existing component
  21. directory.
  22. -h, --help show function usage
  23. --enable this option applies to all types except
  24. project.
  25. enable the created component
  26. Options for project:
  27. --template <TEMPLATE> zynqMP|zynq|microblaze
  28. user needs specify which template to use.
  29. -s|--source <SOURCE> specify a PetaLinux BSP as a project
  30. source.
  31. Options for apps:
  32. --template <TEMPLATE> <c|c++|autoconf|install>
  33. c : c user application(default)
  34. c++ : c++ user application
  35. autoconf: autoconf user application
  36. install: install data only
  37. -s, --source <SOURCE> valid source name format:
  38. *.tar.gz, *.tgz, *.tar.bz2, *.tar,
  39. *.zip, app source directory
  40. Options for modules: (No specific options for modules)
  41. EXAMPLES:
  42. Create project from PetaLinux Project BSP:
  43. $ petalinux-create -t project -s <PATH_TO_PETALINUX_PROJECT_BSP>
  44. Create project from template:
  45. For microblaze project,
  46. $ petalinux-create -t project -n <PROJECT> --template microblaze
  47. For zynq project,
  48. $ petalinux-create -t project -n <PROJECT> --template zynq
  49. For zynqMP project,
  50. $ petalinux-create -t project -n <PROJECT> --template zynqMP
  51. Create an app and enable it:
  52. $ petalinux-create -t apps -n myapp --enable
  53. The application "myapp" will be created with c template in:
  54. <PROJECT>/project-spec/meta-user/recipes-apps/myapp
  55. Create an module and enable it:
  56. $ petalinux-create -t modules -n mymodule --enable
  57. The module "mymodule" will be created with template in:
  58. <PROJECT>/project-spec/meta-user/recipes-modules/mymodule

1.创建工程

  1. z@ubuntu:~/PetaLinux2019.1$ petalinux-create -t project --template zynq -n zynq_linux
  2. INFO: Create project: zynq_linux
  3. INFO: New project successfully created in /home/z/PetaLinux2019.1/zynq_linux

2.将hdf 文件导入到工程中

导入成功进入字符图形配置界面

下面要配置开发板的调试串口

 

默认为uart_1为调试串口

首次运行比较慢。

直接运行petalinux-config直接打开界面

  1. z@ubuntu:~/PetaLinux2019.1/zynq_linux$ petalinux-config --get-hw-description /home/z/hdf/petalinux_smallsystem.sdk/
  2. INFO: Getting hardware description...
  3. INFO: Rename design_1_wrapper.hdf to system.hdf
  4. [INFO] generating Kconfig for project
  5. [INFO] menuconfig project
  6. *** End of the configuration.
  7. *** Execute 'make' to start the build or try 'make help'.
  8. [INFO] sourcing bitbake
  9. [INFO] generating plnxtool conf
  10. [INFO] generating meta-plnx-generated layer
  11. [INFO] generating user layers
  12. [INFO] generating machine configuration
  13. [INFO] generating bbappends for project . This may take time !

 因为太慢了我把处理器的内核改了一下,改成3GB,八核。然后终于成功了。

3.下面:petalinux-config -c u-boot 等待一段时间跳出图形化界面

然后在另外一个终端打开字符图形化界面:

同理

4.petalinux-config -c kernel

5.petalinux-config -c rootfs

6.编译整个petalinux工程,也可以单独编译0

petalinux-build

 最后生成的结果是在images/linux生成镜像文件

7.制作启动镜像文件BOOT.bin文件

boot.bin是多个镜像文件组合而成的,包括fsbl镜像文件,bitstream镜像文件,用户程序镜像文件

petalinux-package --boot --fsbl --fpga --u-boot --force

--boot:生成BOOT.bin镜像文件

--fsbl:用于指向fsbl镜像文件路径

--fpga:用于指向bitstream文件

--u-boot 用于指定u-boot(用户镜像文件)

--force :强制覆盖

  1. z@ubuntu:~/PetaLinux2019.1/zynq_linux/images/linux$ petalinux-package --boot --fsbl ./zynq_fsbl.elf --fpga ./system.bit --u-boot ./u-boot.elf --force
  2. INFO: File in BOOT BIN: "/home/z/PetaLinux2019.1/zynq_linux/images/linux/zynq_fsbl.elf"
  3. INFO: File in BOOT BIN: "/home/z/PetaLinux2019.1/zynq_linux/images/linux/system.bit"
  4. INFO: File in BOOT BIN: "/home/z/PetaLinux2019.1/zynq_linux/images/linux/u-boot.elf"
  5. INFO: Generating Zynq binary package BOOT.BIN...
  6. ****** Xilinx Bootgen v2019.1
  7. **** Build date : May 11 2019-11:15:10
  8. ** Copyright 1986-2019 Xilinx, Inc. All Rights Reserved.
  9. INFO: Binary is ready.
  10. WARNING: Unable to access the TFTPBOOT folder /tftpboot!!!
  11. WARNING: Skip file copy to TFTPBOOT folder!!!

image.ub包括kernel,设备树和根文件系统。所有我们只需提供image.ub和BOOT.bin文件就可以了。

8.制作SD启动卡

将image.ub和BOOT.bin拷贝到SD卡的FAT32分区,再插入SD卡启动板卡。

首先将SD卡用读卡器读入,读入进入虚拟机,在虚拟机中查看板卡的挂载点:

  1. z@ubuntu:~/PetaLinux2019.1/zynq_linux/images/linux$ df -h
  2. Filesystem Size Used Avail Use% Mounted on
  3. udev 1.5G 0 1.5G 0% /dev
  4. tmpfs 298M 8.8M 290M 3% /run
  5. /dev/sda1 984G 36G 898G 4% /
  6. tmpfs 1.5G 212K 1.5G 1% /dev/shm
  7. tmpfs 5.0M 4.0K 5.0M 1% /run/lock
  8. tmpfs 1.5G 0 1.5G 0% /sys/fs/cgroup
  9. vmhgfs-fuse 932G 623G 309G 67% /mnt/hgfs
  10. tmpfs 298M 48K 298M 1% /run/user/1000
  11. /dev/sdb1 60G 3.4G 57G 6% /media/z/DA18-EBFA

这张卡是旧卡,要把这个设备点卸载掉,创建一个新的FAT32分区。

z@ubuntu:~/PetaLinux2019.1/zynq_linux/images/linux$ umount /media/z/DA18-EBFA 

然后再用df命令就找不到挂载点了

下面我们要创建FAT32分区,

  1. z@ubuntu:~/PetaLinux2019.1/zynq_linux/images/linux$ sudo fdisk /dev/sdb
  2. Welcome to fdisk (util-linux 2.27.1).
  3. Changes will remain in memory only, until you decide to write them.
  4. Be careful before using the write command.
  5. Command (m for help): m
  6. Help:
  7. DOS (MBR)
  8. a toggle a bootable flag
  9. b edit nested BSD disklabel
  10. c toggle the dos compatibility flag
  11. Generic
  12. d delete a partition
  13. F list free unpartitioned space
  14. l list known partition types
  15. n add a new partition
  16. p print the partition table
  17. t change a partition type
  18. v verify the partition table
  19. i print information about a partition
  20. Misc
  21. m print this menu
  22. u change display/entry units
  23. x extra functionality (experts only)
  24. Script
  25. I load disk layout from sfdisk script file
  26. O dump disk layout to sfdisk script file
  27. Save & Exit
  28. w write table to disk and exit
  29. q quit without saving changes
  30. Create a new label
  31. g create a new empty GPT partition table
  32. G create a new empty SGI (IRIX) partition table
  33. o create a new empty DOS partition table
  34. s create a new empty Sun partition table
  35. Command (m for help):

查看设备分区:

  1. Command (m for help): p
  2. Disk /dev/sdb: 59.7 GiB, 64088965120 bytes, 125173760 sectors
  3. Units: sectors of 1 * 512 = 512 bytes
  4. Sector size (logical/physical): 512 bytes / 512 bytes
  5. I/O size (minimum/optimal): 512 bytes / 512 bytes
  6. Disklabel type: dos
  7. Disk identifier: 0x06f41121
  8. Device Boot Start End Sectors Size Id Type
  9. /dev/sdb1 32768 125173759 125140992 59.7G c W95 FAT32 (LBA)

现在把这个分区删掉:

  1. Command (m for help): d
  2. Selected partition 1
  3. Partition 1 has been deleted.

下面创建新的分区

  1. Command (m for help): p
  2. Disk /dev/sdb: 59.7 GiB, 64088965120 bytes, 125173760 sectors
  3. Units: sectors of 1 * 512 = 512 bytes
  4. Sector size (logical/physical): 512 bytes / 512 bytes
  5. I/O size (minimum/optimal): 512 bytes / 512 bytes
  6. Disklabel type: dos
  7. Disk identifier: 0x06f41121
  8. Command (m for help): n
  9. Partition type
  10. p primary (0 primary, 0 extended, 4 free)
  11. e extended (container for logical partitions)
  12. Select (default p):
  13. Using default response p.
  14. Partition number (1-4, default 1): 1
  15. First sector (2048-125173759, default 2048):
  16. Last sector, +sectors or +size{K,M,G,T,P} (2048-125173759, default 125173759):
  17. Created a new partition 1 of type 'Linux' and of size 59.7 GiB.

指定分区为FAT32

  1. Command (m for help): t
  2. Selected partition 1
  3. Partition type (type L to list all types): L
  4. 0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris
  5. 1 FAT12 27 Hidden NTFS Win 82 Linux swap / So c1 DRDOS/sec (FAT-
  6. 2 XENIX root 39 Plan 9 83 Linux c4 DRDOS/sec (FAT-
  7. 3 XENIX usr 3c PartitionMagic 84 OS/2 hidden or c6 DRDOS/sec (FAT-
  8. 4 FAT16 <32M 40 Venix 80286 85 Linux extended c7 Syrinx
  9. 5 Extended 41 PPC PReP Boot 86 NTFS volume set da Non-FS data
  10. 6 FAT16 42 SFS 87 NTFS volume set db CP/M / CTOS / .
  11. 7 HPFS/NTFS/exFAT 4d QNX4.x 88 Linux plaintext de Dell Utility
  12. 8 AIX 4e QNX4.x 2nd part 8e Linux LVM df BootIt
  13. 9 AIX bootable 4f QNX4.x 3rd part 93 Amoeba e1 DOS access
  14. a OS/2 Boot Manag 50 OnTrack DM 94 Amoeba BBT e3 DOS R/O
  15. b W95 FAT32 51 OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor
  16. c W95 FAT32 (LBA) 52 CP/M a0 IBM Thinkpad hi ea Rufus alignment
  17. e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a5 FreeBSD eb BeOS fs
  18. f W95 Ext'd (LBA) 54 OnTrackDM6 a6 OpenBSD ee GPT
  19. 10 OPUS 55 EZ-Drive a7 NeXTSTEP ef EFI (FAT-12/16/
  20. 11 Hidden FAT12 56 Golden Bow a8 Darwin UFS f0 Linux/PA-RISC b
  21. 12 Compaq diagnost 5c Priam Edisk a9 NetBSD f1 SpeedStor
  22. 14 Hidden FAT16 <3 61 SpeedStor ab Darwin boot f4 SpeedStor
  23. 16 Hidden FAT16 63 GNU HURD or Sys af HFS / HFS+ f2 DOS secondary
  24. 17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fb VMware VMFS
  25. 18 AST SmartSleep 65 Novell Netware b8 BSDI swap fc VMware VMKCORE
  26. 1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fd Linux raid auto
  27. 1c Hidden W95 FAT3 75 PC/IX bc Acronis FAT32 L fe LANstep
  28. 1e Hidden W95 FAT1 80 Old Minix be Solaris boot ff BBT
  29. Partition type (type L to list all types): c
  30. Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'.

保存退出:

  1. Command (m for help): w
  2. The partition table has been altered.
  3. Calling ioctl() to re-read partition table.
  4. Syncing disks.

格式化:

  1. z@ubuntu:~/PetaLinux2019.1/zynq_linux/images/linux$ sudo mkfs.vfat -F 32 -n boot /dev/sdb1
  2. mkfs.fat 3.0.28 (2015-05-16)
  3. mkfs.fat: warning - lowercase labels might not work properly with DOS or Windows

然后手动挂载查看挂载点df -h

拷贝文件:

z@ubuntu:~/PetaLinux2019.1/zynq_linux/images/linux$ cp -a BOOT.BIN image.ub /media/z/boot/

同步和卸载:

  1. z@ubuntu:~/PetaLinux2019.1/zynq_linux/images/linux$ sync
  2. z@ubuntu:~/PetaLinux2019.1/zynq_linux/images/linux$ umount /media/z/boot

用户名和密码默认都是root. 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/2023面试高手/article/detail/172300
推荐阅读
相关标签
  

闽ICP备14008679号