Skip to content

Commit

Permalink
feat(petalinux): add support for KR260
Browse files Browse the repository at this point in the history
  • Loading branch information
nikAizuddin committed May 17, 2023
1 parent d1527c3 commit 97e7a16
Show file tree
Hide file tree
Showing 37 changed files with 6,074 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,9 @@
[submodule "project/yocto/rpi4b/layers/meta-user/recipes-apps/ros2-helloworld-python/files/ros2_helloworld_python"]
path = project/yocto/rpi4b/layers/meta-user/recipes-apps/ros2-helloworld-python/files/ros2_helloworld_python
url = https://github.com/extra2000/ros2_helloworld_python.git
[submodule "project/petalinux/kr260/project-spec/meta-user/recipes-apps/ros2-helloworld-cpp/files/ros2-helloworld-cpp"]
path = project/petalinux/kr260/project-spec/meta-user/recipes-apps/ros2-helloworld-cpp/files/ros2-helloworld-cpp
url = https://github.com/extra2000/ros2-helloworld-cpp.git
[submodule "project/petalinux/kr260/project-spec/meta-user/recipes-apps/ros2-helloworld-python/files/ros2_helloworld_python"]
path = project/petalinux/kr260/project-spec/meta-user/recipes-apps/ros2-helloworld-python/files/ros2_helloworld_python
url = https://github.com/extra2000/ros2_helloworld_python.git
114 changes: 114 additions & 0 deletions docs/petalinux/kr260.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Xilinx KR260


## Prerequisites

Requirements:
* [extra2000/xilinx-toolkit v3.x image](https://github.com/extra2000/xilinx-toolkit)
* Vitis `v2022.1` and PetaLinux `v2022.1 Update 3`
* [Kria KR260 Starter Kit 2022.1 BSP Update 1](https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/embedded-design-tools/2022-1.html)
* [KR260 board that have it's firmware updated with 2022.1_update3_BOOT.BIN](https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/1641152513/Kria+K26+SOM#Boot-Firmware-Updates)

Allow source files to be mounted into container:
```
chcon -R -t container_file_t project
```


## Building PetaLinux

Spawn new container:
```
podman run -it --rm \
--network=host \
--userns="keep-id:uid=1000,gid=1000" \
-v ${PWD}/project:${PWD}/project:rw \
-v xilinx-tools-v2022-1:/tools/Xilinx:ro \
--workdir ${PWD}/project/petalinux \
--security-opt label=type:xilinx_toolkit_podman.process \
localhost/extra2000/xilinx-toolkit:latest \
bash
source /tools/Xilinx/PetaLinux/2022.1/tool/settings.sh
```

Create project:
```
petalinux-create \
--force \
--type project \
--source ../third-party/xilinx-kr260-starterkit-v2022.1-*.bsp \
--name kr260
```

Restore replaced configs and remove old backup (should be executed by host, not by container):
```
git restore project/petalinux/kr260
git clean -f project/petalinux/kr260.old
```

`cd` into `kr260/`:
```
cd kr260
```

Get hardware description:
```
petalinux-config --get-hw-description hardware/xilinx-kr260-starterkit-2022.1/kr260_starter_kit.xsa
```

Build and package `rootfs`, and then build for WIC `images/linux/petalinux-sdimage.wic` for SD card:
```
petalinux-build
petalinux-package \
--boot \
--u-boot
petalinux-package \
--wic \
--images-dir ./images/linux/ \
--bootfiles "ramdisk.cpio.gz.u-boot,boot.scr,Image,system.dtb,system-zynqmp-sck-kr-g-revB.dtb" \
--disk-name "sda"
```

Build and package `sysroot` (SDK):
```
petalinux-build --sdk
petalinux-package --sysroot
```

**NOTE: Later to source SDK:**
```
source images/linux/sdk/environment-setup-cortexa72-cortexa53-xilinx-linux
```

Exit the container.


## Flashing to SD Card

Insert SD card and execute the following command:
```
sudo dd \
bs=4M \
if=project/petalinux/kr260/images/linux/petalinux-sdimage.wic \
iflag=fullblock \
oflag=direct \
status=progress \
of=/dev/sdX
sudo sync
```


## Testing

Insert SD card into KR260 board, connect USB to your computer, and power on the board. Use the following `screen` command to access shell:
```
screen /dev/ttyUSB1 115200
```

Then, follow [Testing](../yocto/common/testing.md) instructions. To exit from `screen`, do `CTRL` + `A` and then type `:quit`.


## Known Issues

* Warnings from `project/petalinux/kr260/components/yocto/layers/meta-ros/meta-ros2-humble/generated-recipes/iceoryx/iceoryx-posh_2.0.2-3.bb` can be safely ignored.
* Running with QEMU is not possible (I haven't figured out how to boot QEMU with the starter kit BSP).
12 changes: 12 additions & 0 deletions project/petalinux/kr260/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
*/*/config.old
*/*/rootfs_config.old
build/
images/linux/
pre-built/linux/
.petalinux/*
!.petalinux/metadata
*.o
*.jou
*.log
/components/plnx_workspace
/components/yocto
Loading

0 comments on commit 97e7a16

Please sign in to comment.