|
1 | 1 | # PetaLinux |
2 | | -Recently, I have tried to implement YOLOv2 Accelerator in PetaLinux v2018.2. And here, I just want to share the experience and PetaLinux create steps to help other people re-implement this accelerator.(In Ubuntu 16.04 with Vivado v2018.2 and PetaLinux 2018.2) |
| 2 | +If you want to create your own Petaliunx verison based on specfic hardware design, pls follow below steps. |
3 | 3 |
|
4 | 4 | ## Prepare for Petalinux |
5 | | -First, make sure that you have installed PetaLinux and Vivado in Ubuntu 16.04(See the official Xilinx manual and User Guide or just google or bing it) . After you have installed PetaLinux and Vivado, you should source related settings.sh in order to use petalinux and cross-compiler tool-chain in shell. like these two cmds: __source /opt/pkg/petalinux/settings.sh__ and __source /opt/Xilinx/Vivado/2018.2/settings64.sh__. Then, copy two files (hardware description file __design_1_wrapper.hdf__ and bitstream file __design_1_wrapper.bit__ that generated from Vivado project)to one directory. |
| 5 | +First, make sure that you have installed PetaLinux and Vivado in Linux env (See Xilinx's PetaLinux Tools Documentation: Reference Guide (UG1144)) . After that, you should source related settings.sh in order to use petalinux and cross-compiler tool-chain in shell. like these cmds: __source 2019.2/petalinux/settings.sh__ and __source 2019.2/Vivado/2018.2/settings64.sh__. Then, copy two files (hardware description file __design_1_wrapper.hdf__ and bitstream file __design_1_wrapper.bit__ that generated from Vivado project)to one directory (suggest include the bitstream within hdf file). |
6 | 6 |
|
7 | 7 | ## Create PetaLinux Project and modify the Device-tree to reserve memory |
8 | | -Use petalinux-create cmd to create one petalinux project. If you dont know how to create one project, you can type __petalinux-create -h or --help__ to get help and more informations. Here, I just type __petalinux-create -t project -n yolov2 --template zynq__ to create a petalinux project named yolov2. Then, __cd yolov2/project-spec/meta-user/recipes-bsp/device-tree/files/__ to find the __system-user.dtsi__ and modify it like below: |
| 8 | +Use petalinux-create cmd to create one petalinux project. If you dont know how to create one project, you can type __petalinux-create -h or --help__ to get help and more informations. Here, I just type __petalinux-create -t project -n yolov2 --template zynqMP__ to create a petalinux project named yolov2. Then, __cd yolov2/project-spec/meta-user/recipes-bsp/device-tree/files/__ to find the __system-user.dtsi__ and modify it like below: |
9 | 9 |
|
10 | 10 | ``` |
11 | 11 | /include/ "system-conf.dtsi" |
@@ -55,20 +55,79 @@ Here, I just follow the wiki to reserve one continued memories for yolov2(Zedboa |
55 | 55 | [https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18841683/Linux+Reserved+Memory](https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18841683/Linux+Reserved+Memory) |
56 | 56 |
|
57 | 57 | ## Config project with .hdf file |
58 | | -Third, back to the project directory __yolov2/__, and use type this cmd to initilize your project: __petalinux-config --get-hw-description DIR_where_you_put_the_design_1_wrapper.hdf__. Then, it will come to one menu like below: |
59 | | - |
| 58 | +Third, back to the project directory __yolov2/__, and use type this cmd to initilize your project: __petalinux-config --get-hw-description DIR_where_you_put_the_design_1_wrapper.hdf__. In menu __Subsystem AUTO Hardware Settings__, check your board's UART and SD/SDIO config (some boards have multiple UARTS). |
| 59 | +THen, in menu __Image Packaging Configuration__, select __INITRAMFS__ option, and set INITRAMFS/INITRD Image name as __petalinux-image-minimal__. (Here, just follow UG1144). |
60 | 60 |
|
61 | | -Here, I like to set rootfs from SD card(Just set __Image packaing configration-->file system type or rootfs(I forgot it...)--> SD card__). So that, the files that you used can be saved in SD card when you power-off it. And, then save configuraiton and exit. You will have to wait for a long time(I think that it will donwloads somethings from Internet or just do some configs. Make sure that your computer can access the Internet). |
| 61 | +## SSH config |
| 62 | +For SSH, just mutually select openSSH or dropbear, otherwise the ssh's speed would be very slow. |
62 | 63 |
|
63 | | -## Further config or build project |
64 | | -If you have other configuraitons, you can use __petalinux-config or petalinux-config -c XXX__ to further config this project. More informations are available in __petalinux-config -h__. After configuraiotn, you can type __petalinux-build__ to build the whole project. After that, type __petalinux-package -boot --fsbl image/linux/zynq_fsbl.elf --fpga --u-boot --force__ to generate BOOT.BIN. Finally, you will get three files for petalinux: __BOOT.BIN, image.ub and rootfs.cpio__. |
65 | | - |
| 64 | +OpenSSH RootFS Configuration. |
| 65 | +$ petalinux-config -c rootfs |
66 | 66 |
|
67 | | -## Partition SD Card and unzip rootfs |
68 | | -Just use Disks tool in ubuntu to partition SD card into two file systems: one FAT and one EXT4. Copy BOOT.BIN and image.ub into FAT file system and copy rootfs.cpio into EXT4 fs.(If you meet permission denied, use sudo). In EXT4 fs, type cmd __sudo pax -rvf rootfs.cpio__ to unzip the rootfs. Then, umount EXT4 and FAT. Here, the Petalinux has been implemented. |
| 67 | +Filesystem Packages - console - network - openssh - openssh → Y |
| 68 | + |
| 69 | +Filesystem Packages - console - network - openssh - openssh-* → Y |
| 70 | + |
| 71 | +Image Features - "imagefeature-ssh-server-openssh" → Y |
| 72 | + |
| 73 | +Filesystem Packages - console - network - dropbear → N |
| 74 | + |
| 75 | +Image Features - "imagefeature-ssh-server-dropbear" → N |
| 76 | + |
| 77 | +Filesystem Packages - misc - "packagegroup-core-ssh-dropbear" - "packagegroup-core-ssh-dropbear" → N |
| 78 | + |
| 79 | + |
| 80 | +DropBear RootFS Configuratoin. |
| 81 | +$petalinux-config -c rootfs |
| 82 | + |
| 83 | +Filesystem Packages - console - network - dropbear → Y |
| 84 | + |
| 85 | +Image Features - imagefeature-ssh-server-dropbear → Y |
| 86 | + |
| 87 | +Filesystem Packages - misc - packagegroup-core-ssh-dropbear - packagegroup-core-ssh-dropbear → Y |
| 88 | + |
| 89 | +Filesystem Packages - console - network - openssh - openssh → N |
| 90 | + |
| 91 | +Filesystem Packages - console - network - openssh - openssh-* → N |
| 92 | + |
| 93 | +Image Features - imagefeature-ssh-server-openssh → N |
69 | 94 |
|
70 | | -## Download related files and Test YOLOv2 Accelerator |
71 | | -Use ssh or other protocol to transmit related files into EXT4 fs, files that yolov2 accelerator needs are available in previous steps. like below: |
72 | | - |
73 | | -type cmd __chmod 777 yolov2_4port_n4m32.elf__ to make it can be executed. Then, type __./yolov2_4port_n4m32.elf one_pic_name.jpg__ to test it. Then, you will get the prediction results and saved as one picture named __predictions.png__. |
74 | | - |
| 95 | +## Root login |
| 96 | +Then, for some new Petalinux veriosn (2021 or later), default login is not root, if you want to modify it, just follow: |
| 97 | +75610 - PetaLinux: How to SSH and SCP to Xilinx Evaluation Boards As The root User Using Dropbear |
| 98 | +2021年9月23日•Knowledge |
| 99 | +TITLE |
| 100 | +75610 - PetaLinux: How to SSH and SCP to Xilinx Evaluation Boards As The root User Using Dropbear |
| 101 | +DESCRIPTION |
| 102 | +In PetaLinux or Yocto, how can I SSH and SCP to Xilinx Evaluation boards as the root user using dropbear? |
| 103 | + |
| 104 | +SOLUTION |
| 105 | +In Yocto or PetaLinux, root login is disabled by default for SSH or SCP. |
| 106 | + |
| 107 | +In order to allow SSH as the root user you need to enable the "debug-tweaks" feature in PetaLinux or Yocto using any of the below methods. |
| 108 | + |
| 109 | +In 2019.2 and prior releases, enabling debug-tweaks also enables auto-login. |
| 110 | +This procedure applies to both Xilinx Evaluation and Custom boards. |
| 111 | +PetaLinux: |
| 112 | + |
| 113 | +Method 1: |
| 114 | + |
| 115 | +In 2019.2 and prior releases, you can enable debug-tweaks from the petalinux-config options as shown below. |
| 116 | + |
| 117 | + |
| 118 | +$ petalinux-config ---> Yocto Settings ---> [*] Enable Debug Tweaks |
| 119 | + |
| 120 | +In 2020.1 and later releases, you can enable debug-tweaks from the petalinux-config options as shown below. |
| 121 | + |
| 122 | +$ petalinux-config -c rootfs ---> Image Features ---> [*] debug-tweaks |
| 123 | + |
| 124 | +$ petalinux-config -c rootfs ---> Image Features ---> [*] auto-login |
| 125 | + |
| 126 | +[75610 - PetaLinux: How to SSH and SCP to Xilinx Evaluation Boards As The root User Using Dropbear](https://support.xilinx.com/s/article/75610?language=en_US#:~:text=In%20Yocto%20or%20PetaLinux%2C%20root%20login%20is%20disabled,and%20prior%20releases%2C%20enabling%20debug-tweaks%20also%20enables%20auto-login.) |
| 127 | + |
| 128 | +## build project |
| 129 | +After configuraiotn, you can type __petalinux-build__ to build the whole project. After that, type petalinux-build |
| 130 | +petalinux-package --boot --format BIN --fsbl images/linux/zynqmp_fsbl.elf --fpga images/linux/system.bit --u-boot --force to generate BOOT.BIN. Finally, you will get three files for petalinux: __BOOT.BIN, image.ub and rootfs.cpio__. |
| 131 | + |
| 132 | +## Partition SD Card and unzip rootfs |
| 133 | +Just use Disks tool in ubuntu to partition SD card into two file systems: one FAT and one EXT4. Copy BOOT.BIN and image.ub into FAT file system. (because INITRAM use memory ram as rootfs included in BOOT.BIN) |
0 commit comments