install script

本文档详细介绍了如何在Ubuntu系统中更新源并安装常用工具、VMware Tools、QT、MySQL、SQLite、NFS服务器以及Petalinux。首先,通过阿里云镜像更新Ubuntu源,然后安装基础软件和开发环境。接着,配置NFS服务,建立共享文件夹,并安装Petalinux工具链,以进行Zynq UltraScale+ MPSoC平台的开发。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

vi /etc/apt/sources.list

----------------------------------------

deb https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

deb-src https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

deb-src https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

deb-src https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

deb-src https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

deb-src https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

----------------------------------------

//安装基础工具、编译器

sudo apt-get install vim net-tools gcc g++

//安装vmwmware tools(在线安装,不会出现兼容性问题)

sudo apt-get install open-vm-tools open-vm-tools-desktop

//安装QT(断网安装,免账号注册)

sudo /opt/tools/qt-opensource-linux-x64-5.14.2.run

//创建QT快捷方式

sudo vim /usr/share/applications/qtcreator.desktop

----------------------------------------

[Desktop Entry]

Type=Application

Name=qtcreator

Comment=QtCreator

Icon=/opt/Qt5.14.2/qt-logo.jpg

Exec=/opt/Qt5.14.2/Tools/QtCreator/bin/qtcreator

Terminal=false

Categories=Development;IDE;C++;

----------------------------------------

开始菜单,查找Qt, 右键图标,Add to Favorites

//解决Qt make报错问题。14:48:09: Could not start process "make" -j2

sudo apt-get install build-essential

//安装OpenGL库

sudo apt-get install libgl1-mesa-dev

//开机自动设置 vmware 共享文件夹

sudo vim rc.local

----------------------------------------

#!/bin/sh -e

sudo /usr/bin/vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other -o uid=1000 -o gid=1000 -o umask=022

----------------------------------------

sudo chmod +x rc.local

//安装数据库

sudo apt-get install mysql-server mysql-client libmysqlclient-dev

libmysqlcppconn-dev qtbase5-private-dev

sudo apt-get install sqlite3

//change ubuntu default system shell /bin/sh from dash to bash. 输入命令,Configuring dash 选择“No”,回车确认

sudo dpkg-reconfigure dash

sudo apt-get install gnome-control-center

sudo mv /etc/localtime /etc/localtime.bak

sudo ln -s /usr/share/zoneinfo/GMT0 /etc/localtime

==petalinux 安装==============================================================

//依赖库

sudo apt-get install -y iproute2 gawk python3 python 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 pylint3 libtinfo5

//安装nfs

sudo apt-get install nfs-kernel-server

//配置NFS 的工作目录

sudo mkdir -p /home/user/work

sudo gedit /etc/exports

----------------------------------------

在尾部添加/home/user/work *(rw,sync,no_root_squash,no_subtree_check)

----------------------------------------

//令重启 rpcbind 服务

sudo /etc/init.d/rpcbind restart

//重启 nfs 服务

sudo /etc/init.d/nfs-kernel-server restart

//测试NFS

//通过下面命令挂载 NFS,在本机将 NFS 工作路径挂载在/mnt 目录,127.0.0.1 就是本机 IP

sudo mount -t nfs 127.0.0.1:/home/user/work/nfs /mnt/nfs

//进入/mnt,新建一个 test 目录测试一下,可以在/home/user/work 目录同步看到 test 文件夹

cd /mnt

mkdir test

//创建安装目录,配置权限

sudo -s

mkdir -p /opt/petalinux/2022.2

chgrp user /opt/petalinux/2022.2

chown user /opt/petalinux/2022.2

su user

//安装Petalinux(Zynq UltraScale+ MPSoC 版本)

//sudo vim /var/log/petalinux2022.2_install.log 创建日志文件并保存。

sudo chmod 777 /var/log/petalinux2022.2_install.log

sudo ./petalinux-v2022.2-10141622-installer.run --dir /opt/petalinux/2022.2 --platform "arm aarch64" --log /var/log/petalinux2022.2_install.log

=================Whole Compile Step====================

cd ~/work/petaprj/ps

source /opt/petalinux/2022.2/settings.sh

echo $PETALINUX

petalinux-create -t project -n petalinux --template zynqMP

cd ~/work/petaprj/ps/petalinux

//拷贝vivado生成的xsa文件,然后生成工程。

petalinux-config --get-hw-description ../hardware/petalinux/

// localcache config

copy downloads dir to ~/work/local/

copy sstate_aarch64/aarch64 dir to ~/work/local/

sudo chmod 777 -R local/

//config

Image Packaging Configuration->Root filesystem type (EXT4 (SD/eMMC/SATA/USB))

Image Packaging Configuration->(/dev/mmcblk1p2) Device node of SD device

Yocto Settings ---> Add pre-mirror url ---> file:///home/user/work/local/downloads

Yocto Settings ---> Local sstate feeds settings ---> /home/user/work/local/aarch64

Yocto Settings ---> [ ] Enable Network sstate feeds

Yocto Settings ---> [*] Enable BB NO NETWORK //This is mandatory when you do not have network access on build machines.

sudo gedit project-spec/meta-user/conf/petalinuxbsp.conf

----------------------------------------

DL_DIR = "/home/user/work/local/downloads"

SSTATE_DIR = "/home/user/work/local/aarch64"

sudo gedit project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi

----------------------------------------

/include/ "system-conf.dtsi"

/ {

};

/* SD */

&sdhci1 {

disable-wp;

no-1-8-v;

};

/* USB */

&dwc3_0 {

status = "okay";

dr_mode = "host";

};

sudo chmod 666 components/yocto/layers/core/meta/files/common-licenses/*

petalinux-build

=====================Compile Finish====================

//generic boot image

cd images/linux

petalinux-package --boot --u-boot --fpga --force

//根据指导文档格式化SD卡,然后拷贝uboot文件到BOOT分区。

sudo cp images/linux/BOOT.BIN /media/user/BOOT/

sudo cp images/linux/image.ub /media/user/BOOT/

sudo cp images/linux/system.dtb /media/user/BOOT/

sudo cp images/linux/boot.scr /media/user/BOOT/

sudo tar -xzvf ~/work/petaprj/ps/petalinux/images/linux/rootfs.tar.gz -C /media/user/ROOTFS

sudo sync

=====================Burn SD Card Finish====================

petalinux-build -x mrproper

============================================

问题: computer hangs while petalinux-build do_compile

Check the CPUs and Memory. CPU thread too much or insufficient memory.

If used virtul machine, try to change the vm setting. You also can change the petalinux-config.

$ petalinux-config ---> Yocto Settings ---> Parallel thread execution ---> (10) sets number of bb threads (BB_NUMBER_THREADS)

$ petalinux-config ---> Yocto Settings ---> Parallel thread execution ---> (10) sets number of parallel make -j threads (PARALLEL_MAKE)

Yocto Override Syntax Changes

The [:]colon character replaces the use of [ _ ] underscore referring to an override.

Please check the link for more information:https://docs.yoctoproject.org/migration-guides/migration-3.4.html#override-syntax-changes.

git://sourceware.org/git/binutils-gdb.git;branch=binutils-2_37-branch;protocol=git

dtb dts

sudo /opt/petalinux/2022.2/components/yocto/buildtools/sysroots/x86_64-petalinux-linux/usr/bin/dtc -I dtb -O dts ~/work/test/system.dtb -o ~/work/test/system.dts

问题: ERROR: binutils-2.37-r0 do_package_write_rpm_setscene: Error executing a python function in exec_func_python() autogenerated:

...Not enough memory, increase memory or decrease cpu cores&threads.

$ petalinux-config ---> Yocto Settings ---> Parallel thread execution ---> (1) sets number of bb threads (BB_NUMBER_THREADS)

$ petalinux-config ---> Yocto Settings ---> Parallel thread execution ---> (1) sets number of parallel make -j threads (PARALLEL_MAKE)

问题: WARNING: u-boot-tools-1_2021.07-r0 do_populate_sysroot_setscene: No sstate archive obtainable, will run full task instead.

Yocto Settings ---> [*] Enable Network sstate feeds http://petalinux.xilinx.com/sswreleases/rel-v${PETALINUX_VER}/aarch64/sstate-cache

Yocto Settings ---> [ ] Enable BB NO NETWORK

问题: ERROR: pmu-rom-native-2022.2-r0 do_fetch: Network access disabled through BB_NO_NETWORK (or set indirectly due to use of BB_FETCH_PREMIRRORONLY) but access requested with command /usr/bin/env wget -t 2 -T 30 --passive-ftp -P /home/user/work/local/downloads 'http://petalinux.xilinx.com/sswreleases/rel-v2022/downloads/openDownload%3Ffilename%3DPMU_ROM.tar.gz' (for url http://petalinux.xilinx.com/sswreleases/rel-v2022/downloads/openDownload%3Ffilename%3DPMU_ROM.tar.gz)

问题: {standard input}: Error: open CFI at the end of file; missing .cfi_endproc directive aarch64-xilinx-linux-g++: fatal error: Killed signal terminated program cc1plus

Insufficient memory.

问题: libfdt fdt_check_header(): FDT_ERR_BADMAGIC BootOrder not defined EFI boot manager: Cannot load any image

sudo cp images/linux/boot.scr /media/user/BOOT/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值