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/

### 如何在 Uni-app Vue3 鸿蒙系统中集成和使用 ECharts #### 安装依赖库 要在Uni-app项目中引入ECharts,首先需要安装`echarts`包。可以通过npm或yarn完成此操作。 ```bash npm install echarts --save ``` 或者 ```bash yarn add echarts ``` 这一步骤确保了项目的node_modules目录下有最新版本的ECharts库文件[^2]。 #### 创建图表组件 创建一个新的Vue单文件组件用于封装ECharts实例。这里假设命名为`MyChart.vue`: ```vue <template> <div ref="chartRef" :style="{ width: '100%', height: '400px' }"></div> </template> <script setup lang="ts"> import { onMounted, ref, watchEffect } from "vue"; // 导入整个 ECharts 库 import * as echarts from "echarts"; const props = defineProps({ option: { type: Object, required: true, }, }); const chartRef = ref<HTMLDivElement | null>(null); onMounted(() => { nextTick().then(() => { const myChart = echarts.init(chartRef.value!); // 使用刚指定的配置项和数据显示图表。 myChart.setOption(props.option); }); }); </script> ``` 上述代码展示了如何初始化并设置ECharts选项,在模板里定义了一个容器用来承载图表,并利用`ref`获取DOM节点以便后续调用ECharts API方法. #### 在页面中使用自定义图表组件 接下来可以在任何其他`.vue`文件中注册并使用这个新创建的图表组件: ```vue <template> <view class="container"> <!-- 引入我们之前做的 MyChart 组件 --> <my-chart :option="barOptions"/> </view> </template> <script setup lang="ts"> import MyChart from "@/components/MyChart.vue"; // 替换成实际路径 import { reactive } from "vue"; const barOptions = reactive({ title: { text: "某地区蒸发量和降水量", subtext: "纯属虚构" }, tooltip: { trigger: "axis" }, legend: { data: ["蒸发量", "降水量"] }, xAxis: [ { type: "category", data: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"] } ], yAxis: [{type: "value"}], series: [ { name: "蒸发量", type: "bar", data: [2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3] }, { name: "降水量", type: "bar", data: [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3] } ] }); </script> ``` 这段脚本说明了怎样向父级组件传递数据给子组件中的ECharts实例,从而动态更新图表内容. #### 处理鸿蒙环境下的兼容性问题 对于HarmonyOS设备而言,由于其特殊的渲染机制和服务框架结构,可能需要额外处理某些特定场景下的适配工作。比如调整样式以适应不同屏幕尺寸、优化性能表现等。此外还需注意API差异带来的影响,确保所使用的功能均能在目标平台上正常运作[^1].
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值