Try   HackMD

Linux Cheat Sheet

General

Check system information:

uname -a
cat /proc/cpuinfo
cat /proc/meminfo
cat /proc/interrupts
sudo lshw
lscpu
lsblk
lsusb
lspci

Empty trash:

rm -rf ~/.local/share/Trash/*

IP Address

Using netplan file:

sudo nano /etc/netplan/50-cloud-init.yaml

Add this to the file:

network:
  version: 2
  renderer: NetworkManager
    ethernets:
      eth0:
        dhcp4: no
        addresses: [192.168.2.99/24]
        gateway4: 192.168.2.1
        nameservers:
          addresses: [8.8.8.8,8.8.4.4]

Using interfaces file:

sudo nano /etc/network/interfaces

Add this to the file:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.1.99
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1
dns-nameserver 8.8.8.8
dns-nameserver 8.8.4.4

auto eth1
iface eth1 inet dhcp

Minicom

Install minicom:

sudo apt-get install minicom

Check which serial port a device connected to:

dmesg | grep tty

Connect to specific device in minicom:

sudo minicom --device /dev/ttyUSB1

PetaLinux

Create PetaLinux project:

petalinux-create --type project --template zynq --name peta_project

Configure HW using HDF file:

petalinux-config --get-hw-description=../hdf_folder/

Configure HW using XSA file:

petalinux-config --get-hw-description=../design_1_wrapper.xsa

Configure rootfs boot source:

Image Packaging Configuration → Root filesystem type (xxxx) → EXT4 (SD/eMMC/SATA/USB)

Enable gcc command:

petalinux-config -c rootfs

Filesystem Packages → misc → packagegruop-core-buildessential

Enable iptables command:

petalinux-config -c kernel

Networking support → Networking options → Network packet filtering framework (Netfilter) → (Enable all)

petalinux-config -c rootfs

Filesystem Packages → misc → iptables

Build PetaLinux:

petalinux-build

Build results are generated in images/linux

Package BOOT.BIN image:

petalinux-package --boot --force --fsbl images/linux/zynq_fsbl.elf --fpga ../vivado/vivado.runs/impl_1/design_1_wrapper.bit --u-boot

Write the boot image to the BOOT partition:

sudo cp BOOT.BIN boot.scr image.ub /media/username/BOOT/
sync

Write the rootfs image to the root partition:

sudo tar xf rootfs.tar.gz -C /media/username/root/
sync