UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Observer ishahak
Observer
650 Views
Registered: ‎01-31-2018

Knowledge share: Preparing an UltraZed for Petalinux

Hi,

I'm sharing it here in order to justify the tremendous effort it took me to learn all this...

 

The idea is to boot with Petalinux from the SD-card of the carrier board, and to get the filesystem through NFS.

 

SD-card

The SD-card is formatted for FAT32 and should contain two files:

 

* image.ub - the linux kernel and the device tree (the .ub is generated based on the file fitImage.its-1.0-r0)

* BOOT.BIN - this file holds the FPGA bitstream and the boot sequence up to the kernel: FSBL and U-Boot. (it is generated by this command: petalinux-package --boot --fsbl images/linux/zynqmp_fsbl.elf --fpga hw_platform/system_wrapper.bit --uboot --force)

 

NFS

to enable NFS in Petalinux, run these commands:

petalinux-config

> select "Image packaging", check "NFS" and set the path to /home/NFSShare

> exit and save

 

The file system for the board is NFS served by an Ubuntu virtual machine. I was downloading Ubuntu 16.03.4 64-bit from osboxes: https://www.osboxes.org/ubuntu/

Then to setup NFS there, run all this on a terminal:

> sudo apt install nfs-common

> sudo mkdir -p /usr/nfs/shared-rootfs

> sudo chown osboxes:osboxes /usr/nfs/shared-rootfs

> sudo apt install nfs-server

> sudo vi /etc/exports

>>enter

#the following is done to avoid the mess when using arrow keys

:set nocompatible [return]

>>append:

/usr/nfs/shared-rootfs *(rw,sync,insecure,no_root_squash,no_subtree_check) 

>> exit vi

#refresh with new settings

> sudo exportfs -ra

 

The share can be tested from a Mac machine:

sudo mkdir /Volumes/ubu

sudo mount <IP for Ubuntu>:/usr/nfs/shared-rootfs /Volumes/ubu/

ls /Volumes/ubu

 

Note: as for the rootfs content, although generated by petalinux-build as 'rootfs.cpio.gz', I preferred using "buildroot" for generating my own rootfs. It builds incrementally and much quicker, and allows defining an "overlay" files tree where I can put my version-controlled files to be included into the final rootfs. See my other post.

 

UltraZed

Setup the 4 switches on the UZ to be 1=off 2=on 3=off 4=on, when 'off' means close to the numbers.

 

When booting the board with a connected terminal (on Win10: Tera-Term. On Mac: minicom -D /dev/cu.SLAB_USBtoUART -b 115200):

> Hit enter to stop at U-Boot.

You'll get a ZynqMP> prompt.

 

Then give the following commands:

#reset to default of U-Boot variables:

env default -f -a

 

#setup MAC address. Will also affect the kernel! 

#Default is 00:0a:35:00:22:01 but when having multiple cards you must make it unique!

setenv ethaddr 00:0a:35:00:22:03 

 

#fix kernel loader - dev 1 is the SD card

setenv cp_kernel2ram 'echo "[[cp_kernel2ram]]"; mmc dev 1 && mmcinfo && fatload mmc 1 ${netstart} ${kernel_img}'

 

#bootargs for the kernel

 

# the generic-uio is related to me adding system-user.dtsi with &axi2regs_0 {compatible =  "generic-uio";};

 

#the last part reserves the last 512MB for memory-mapped operations with the FPGA

# also requiring petalinux-config -c kernel and hitting 'y' for Device drivers > Userspace -> <*> Userspace io platform

 

setenv bootargs 'console=ttyPS0,115200n8 earlyprintk ip=dhcp root=/dev/nfs rootfstype=nfs nfsroot=192.168.0.120:/usr/nfs/shared-rootfs,port=2049,tcp rw loglevel=7 nfsrootdebug uio_pdrv_genirq.of_id="generic-uio" clk_ignore_unused mem=1536M memmap=1536M@512M'

 

saveenv

 

turn off-on

 

Hoping it will help others!

Tags (2)