THANNA-OS

Build Petalinux

Dependencies

  • Install Petalinux-Tools-Dependencies (Ubuntu 22.04.3 LTS):

sudo apt-get install -y iproute2 gawk python3 python2.7 build-essential gcc git make net-tools libncurses5-dev tftpd zlib1g-dev libssl-dev flex bison libselinux1 gnupg wget git-core diffstat chrpath socat xterm autoconf libtool tar unzip texinfo zlib1g-dev gcc-multilib automake zlib1g:i386 screen pax gzip cpio python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev pylint
  • Maybe you have to activate i386 architecture: dpkg --add-architecture i386 and install libtool-bin

  • Link libtinfo.so.6 to libtinfo.so.5 sudo ln -s /usr/lib/x86_64-linux-gnu/libtinfo.so.6 /usr/lib/x86_64-linux-gnu/libtinfo.so.5

  • Install Petalinux-Tools 2023.2: Download

  • Source Petalinux-Tools-Settings: source <PETALINUX-TOOLS-PATH>/settings.sh

Build

  1. cd thannaOS

  2. make

Caching

To preserve the petalinux sstate-cache and downloaded requirements for building the kernel you can create two directories somewhere on your filesystem outside the repository.

Example:

  • Create directories (replace $USER with your actual username)

    • download-dir: /home/$USER/petalinux/2023.2/downloads

    • sstate-cache-dir: /home/$USER/petalinux/2023.2/sstate-cache/arm

  • Create file thannaOS/project-spec/meta-user/conf/petalinuxbsp.conf

    DL_DIR = "/home/$USER/petalinux/2023.2/downloads"
    SSTATE_DIR = "/home/$USER/petalinux/2023.2/sstate-cache/arm"
    

Boot

Boot from SD

non persistent rootfs

  • Make sure Boot-Jumpers are set to SD-Boot

  • Format SD-Card with FAT32

  • cp images/linux/{BOOT.BIN,boot.scr,image.ub} <PATH_TO_SDMOUNT>

persistent rootfs

  • follow the steps described in the xilinx wiki to format the sd-card

  • run petalinux-config, navigate to Image Packaging Configuration->Root filesystem type and change it to EXT4 (SD/eMMC/SATA/USB), save and exit

  • rebuild the project (petalinux-build, etc.)

  • sudo dd if=./images/linux/rootfs.ext4 of=/dev/sdX (sdX is the ext4 partition you created before)

  • sudo e2fsck -f /dev/sdX

  • sudo resize2fs /dev/sdX

  • copy boot files to boot-partition cp images/linux/{BOOT.BIN,boot.scr,image.ub} <PATH_TO_SDMOUNT>

Boot from JTAG

  • Make sure Boot-Jumpers are set to JTAG-Boot

  • Start the hardware-server: hw_server

  • Download to Zybo-Board: petalinux-boot --jtag --fpga --kernel ./images/linux/uImage

  • Connect to SSH/UART

Connecting to the Board

UART

  • Make sure your user has access to /dev/ttyUSB*

    sudo usermod -aG $USER dialout
    newgrp dialout
    
  • screen /dev/ttyUSB1 115200

SSH

  • plug in ethernet cable

  • set a password for user petalinux: passwd petalinux

  • look up ip address with ip a

  • connect to petalinux@XXX.XXX.XXX.XXX

VSCode-Remote

  • Add the following to your ssh_config (on the system vscode is running)

    Host XXX.XXX.XXX.XXX
        Hostname XXX.XXX.XXX.XXX
        User petalinux
        StrictHostKeyChecking no
    
  • Connect via VSCode

Committing changes

  • As stated here “A PetaLinux project should be cleaned using petalinux-build -x mrproper before submitting to the source control.” or just run make clean