konosubakonoakua / blog

https://konosubakonoakua.github.io/blog/
MIT License
0 stars 0 forks source link

[hw][fpga][xilinx] petalinux 2019.1 setup #97

Open konosubakonoakua opened 4 days ago

konosubakonoakua commented 4 days ago

Dependencies

Switch to bash

sudo dpkg-reconfigure dash #####choose NO

Install dependecies

sudo apt update
sudo apt -y install libtool-bin \
  python2 gcc make perl tofrodos iproute2 gawk git \
  xvfb net-tools tftp-hpa tftpd-hpa flex bison \
  screen pax gzip tar gnupg wget diffstat chrpath \
  socat xterm autoconf libtool tar unzip texinfo \
  gcc-multilib build-essential libselinux1 \
  zlib1g-dev zlib1g-dev:i386 \
  libsdl1.2-dev libglib2.0-dev \
  libssl-dev libncurses5-dev libncursesw5 \
  nfs-kernel-server openssh-server \
  expect

Config tftp server (optional).

sudo mkdir -p /tftpboot
sudo chown rf:rf /tftpboot
chmod 777 /tftpboot
sudo cp -f /etc/default/tftpd-hpa /etc/default/tftpd-hpa.bak

sudo tee /etc/default/tftpd-hpa << EOF
# /etc/default/tftpd-hpa

TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/tftpboot"
TFTP_ADDRESS=":69"
TFTP_OPTIONS="-l -c -s"
EOF

sudo service tftpd-hpa restart

Install ssh server

sudo apt-get install openssh-server
# vim /etc/ssh/sshd_config
konosubakonoakua commented 4 days ago

petalinux installation (ubuntu 18 & below)

create a fake python2 pkg status

sudo tee -a /var/lib/dpkg/status << EOF

Package: python
Status: install ok installed
Maintainer: Fake Entry <fake@example.com>
Architecture: all
Version: 2.7.17
Description: fake package for petalinux

EOF

sudo ln -s /usr/bin/python2.7 /usr/bin/python

If not, petalinux 2019 won't find python, and will raise error.

ERROR: You are missing the following system tools required by PetaLinux:
 - python

run the installer

export INSTALLER=~/Downloads/petalinux-v2019.1-final-installer.run
$INSTALLER /tools/petalinux/2019.1/
# need confirm with licenses
konosubakonoakua commented 3 days ago

sstate cache

create /tools/petalinux if not exists

sudo mkdir -p /tools/petalinux
sudo chown rf:rf /tools/petalinux
mkdir -p /tools/petalinux/sstate/2019.1
tar xvzf ~/Downloads/sstate-rel-v2019.1.tar.gz -C /tools/petalinux/sstate/2019.1
konosubakonoakua commented 3 days ago

trouble shoot

build failed (libc version)

I'm using ubuntu22, so I use docker instaled. https://github.com/z4yx/petalinux-docker

petalinux on docker (ubuntu 22)

build

docker build \
  --build-arg PETA_VERSION=2019.1 \
  --build-arg PETA_RUN_FILE=petalinux-v2019.1-final-installer.run \
  -t petalinux:2019.1 \
  .

launch

docker run -ti --rm \
  -e DISPLAY=$DISPLAY --net="host" \
  -v /tmp/.X11-unix:/tmp/.X11-unix \
  -v $HOME/.Xauthority:/home/vivado/.Xauthority \
  -v /tools/petalinux/sstate/2019.1:/tools/petalinux/sstate/2019.1 \
  -v /tftpboot:/tftpboot \
  -v $(pwd):/home/vivado/project \
  petalinux:2019.1 \
  /bin/bash

oneliner

tee -a ~/.bashrc << EOF
alias petadocker2019='docker run -it --rm -e DISPLAY=$DISPLAY --net="host" -v /tmp/.X11-unix:/tmp/.X11-unix -v $HOME/.Xauthority:/home/vivado/.Xauthority -v /tools/petalinux/sstate/2019.1:/tools/petalinux/sstate/2019.1 -v /tftpboot:/tftpboot -v $(pwd):/home/vivado/project petalinux:2019.1 /bin/bash -c '
EOF
source ~/.bashrc
konosubakonoakua commented 2 days ago

nfs setup

Config nfs (optional, used for Linux rootfs mount).

sudo mkdir -p /nfsroot
sudo chown -R rf:rf /nfsroot

[!CAUTION] /nfsroot is very similar with /nfsboot, never make a typo like this!!! 🚨🚨🚨😱😱😱

sudo cp -f /etc/exports /etc/exports.bak
sudo tee -a /etc/exports << EOF
/nfsroot *(rw,sync,no_root_squash)
EOF

if encountered: VFS:Unable to mount root fs via NFS, tring floppy:

sudo cp -f /etc/default/nfs-kernel-server /etc/default/nfs-kernel-server.bak
sudo tee -a /etc/default/nfs-kernel-server << EOF
RPCNFSDOPTS="--nfs-version 2,3,4 --debug --syslog"
EOF
sudo systemctl restart nfs-kernel-server

restart after modifications.

sudo service nfs-kernel-server restart

show shared folders

showmount -e

refresh on the fly

sudo exportfs -rv

test nfs

sudo mkdir -p /mnt/nfs
sudo mount -t nfs 127.0.0.1:/nfsroot /mnt/nfs

references

konosubakonoakua commented 2 days ago

references