PS Software Petalinux

This is a simple manual on how to prepare the linux environment that can be deployed on the board.

Setup Vmware

If you want to use “Host ↔︎ Guest” File sharing

sudo vmhgfs-fuse .host:/ /mnt/hgfs/ -o allow_other -o uid=1000

Requirments:

Make sure to download petalinux beforehand, it takes 2 hours to download

Build a demo sample

These are board steps to build a sample, specific demos need the proper options picked on rootfs and kernel

petalinux-build
TODO: we need the bit file produced by the xilinx vivado

petalinux-package --boot --fsbl images/linux/zynq_fsbl.elf --fpga images/linux/system.bit --u-boot
petalinux-package --prebuilt --fpga images/linux/system.bit

Boot the hardware

Specific samples

VGA demo

PCIe Demo

To run the pcie demo you only need the boot.bin file from the prebuild folder on the samples repo. petalinux image is not needed. Place boot.bin on the sdcard and plug the sdcard on the board.

Please set VCCADJ (VCCO for bank 34) to 3.3V, changing the DIP S2 to 0001

Connect the board on the PCIe slot of the host computer. make sure you don’t have the external power plugged in the board.

Power the computer.

PCIe host linux machine setup

Install ubuntu 18.04. (last tested with 18.04.03)

To use a custom (unsigned) driver with new Linux systems you need to disable "Secure Boot" option in BIOS. It prevents "permission failed" errors while insmod/modprobe commands.

sudo apt-get install build-essential checkinstall
sudo apt-get install linux-headers-$(uname -r)
sudo apt-get install libaio1 libaio-dev
sudo apt-get install git
git clone https://github.com/Xilinx/dma_ip_drivers.git
git clone https://github.com/Xilinx/dma_ip_drivers.git
cd dma_ip_drivers/XDMA/linux-kernel/xdma/
make

if you are kernel 5 you might get some compiling errors, and you will need to patch your code

1) The interface of linux/swait.h changed from the previous versions of the kernel..
Inside libxdma.c 

replace
- swait_event_interruptible_timeout
+ swait_event_interruptible_timeout_exclusive 
and
- swake_up 
+ swake_up_one

2) The 5.0 kernel dropped the type argument to access_ok()
Inside cdev_ctrl.c 

replace
- result = !access_ok(VERIFY_WRITE, (void __user *)arg,
+ result = !access_ok((void __user *)arg,
and
- result =  !access_ok(VERIFY_READ, (void __user *)arg,
+ result =  !access_ok( (void __user *)arg,
cd ../tools
make
cd ../tests
chmod +x *.sh
sudo ./load_driver.sh
sudo ./run_test.sh
cd ../tools
#Set LEDS
sudo ./reg_rw /dev/xdma0_user 0x00000000 32 1
#Read DIP Switches
sudo ./reg_rw /dev/xdma0_user 0x00000000

Related documents

Old linux kernel driver code from 65444. Just for reference