This commit is contained in:
hehaoyang 2023-11-11 13:41:44 +08:00
parent f7bb4ebe19
commit 7c99d56524
12 changed files with 308 additions and 136 deletions

31
QT/打包项目.md Normal file
View File

@ -0,0 +1,31 @@
# 打包项目
```
sudo apt install patchelf
git clone https://github.com/probonopd/linuxdeployqt --depth=1
cd linuxdeployqt
vi CMakeLists.txt
```
* 将 find_program 开始到 # set version and build number 之间的代码注释掉
* 切换到 ./tools/linuxdeployqt 下, 这里还有个 CMakeLists.txt 要改, find_package 这里根据QT版本是啥写啥, 后面 target_link_libraries也要同步修改
```
#find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) #修改前
find_package(Qt5 REQUIRED COMPONENTS Core) #修改后
#target_link_libraries(linuxdeployqt Qt${QT_VERSION_MAJOR}::Core) #修改前
target_link_libraries(linuxdeployqt Qt5::Core) #修改后
```
* 同目录下还有个 main.cpp 要改, 51行到54行版本检测注释掉, 192行到213行的libc版本检测注释掉
```
cmake CMakeLists.txt
make
```

View File

@ -0,0 +1,67 @@
# 开机启动
### 复制程序到 /opt 目录下
```
cp /root/works/console_app/console_app /opt/app
```
### 创建启动脚本
* 切换目录, 并创建文件
```
cd /opt
vim run.sh
```
* run.sh 文件内容
```
#! /bin/bash
cd /opt/
./app
```
### 创建服务
* 切换目录, 并创建文件
```
vim /etc/systemd/system/app.service
```
* app.service 文件内容
```
[Unit]
Description=app server
[Service]
Type=simple
ExecStart=/opt/run.sh
Restart=on-failure
RestartSec=5s
[Install]
WantedBy=multi-user.target
```
### 重新加载 Systemd
```
systemctl daemon-reload
```
### 启动服务
```
systemctl start app.service
```
### 开机启动
```
systemctl enable app.service
```

View File

@ -40,7 +40,7 @@ apt upgrade -y
执行
```
apt --fix-broken install
apt --fix-broken install -y
```
出现错误:
@ -50,5 +50,5 @@ apt --fix-broken install
执行命令
```
dpkg -i --force-overwrite /var/cache/apt/archives/libc6-arm64-cross_2.31-0ubuntu9.9cross1_all.deb
apt upgrade
apt upgrade -y
```

View File

@ -13,4 +13,6 @@ mv /var/lib/dpkg/info/ /var/lib/dpkg/info_old/
mkdir /var/lib/dpkg/info/
apt-get update
apt-get install qt5-default qtcreator -y
```

View File

@ -0,0 +1,76 @@
# 系统环境配置(编译FFmpeg)
#### 编译环境配置
```
apt updata
apt upgrade
apt -y install \
autoconf \
automake \
build-essential \
cmake \
git-core \
libass-dev \
libfreetype6-dev \
libsdl2-dev \
libtool \
libva-dev \
libvdpau-dev \
libvorbis-dev \
libxcb1-dev \
libxcb-shm0-dev \
libxcb-xfixes0-dev \
pkg-config \
texinfo \
wget \
zlib1g-dev
apt -y install \
nasm \
yasm \
libx264-dev \
libx265-dev \
libnuma-dev \
libvpx-dev \
libfdk-aac-dev \
libmp3lame-dev \
libopus-dev
```
#### 解压
```
tar -xvf ffmpeg-4.2.9.tar.xz
cd ffmpeg-4.2.9/
./configure --prefix=/usr/local/ffmpeg --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-filter=delogo --enable-debug --disable-optimizations --enable-shared --enable-pthreads
make -j4
make install
```
#### 添加环境变量
* 在 /etc/profile 文件最后一行添加
```
export PATH=/usr/local/ffmpeg/bin:$PATH
```
* 设置生效
```
source /etc/profile
```
* 在 /etc/ld.so.conf 文件最后一行添加
```
/usr/local/ffmpeg/lib/
```
* 设置生效
```
ldconfig
```

View File

@ -10,6 +10,7 @@ apt install software-properties-common -y
```
add-apt-repository "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ xenial-security main"
add-apt-repository "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ xenial main multiverse restricted universe"
```
* 软件源更新
@ -58,7 +59,7 @@ apt-get install libtiff5-dev -y
* 安装JPEG-2000图像工具包
```
apt-get install libjasper-dev -y
apt install libjasper1 libjasper-dev
```
* 安装png图像工具包
@ -92,8 +93,17 @@ cd build
```
* 配置CMake
```
cmake -D CMAKE_BUILD_TYPE=Release -D OPENCV_GENERATE_PKGCONFIG=ON -D BUILD_PNG=NO -D BUILD_JASPER=NO -D BUILD_TIFF=NO -D WITH_PNG=NO -D WITH_JASPER=NO -D WITH_TIFF=NO -D CMAKE_INSTALL_PREFIX=/usr/local ..
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D BUILD_PNG=NO \
-D BUILD_JASPER=NO \
-D BUILD_TIFF=NO \
-D WITH_PNG=NO \
-D WITH_JASPER=NO \
-D WITH_TIFF=NO \
-D CMAKE_INSTALL_PREFIX=/usr/local ..
```
* 编译

View File

@ -7,121 +7,61 @@
## 环境准备
* 下载sdk 到 /home/heahoyang/works/quectel 目录
<!-- ```
# 用户名 wangguixin@sztvis.com
# 密码 lzm850206
git clone https://git-master.quectel.com/smart/rk3568_ubuntu_r60_v1.3.2.git
``` -->
```
git clone http://192.168.1.223:3000/hehaoyang/rk3568_ubuntu_r60_v1.3.2.git
# 切换分支
```
* 拷贝 qemu-user-static_7.2+dfsg-5ubuntu2.2_amd64.deb 到 /home/heahoyang/works/quectel, 并安装
```
sudo dpkg -i qemu-user-static_7.2+dfsg-5ubuntu2.2_amd64.deb
```
* 下载sdk 到 /home/heahoyang/works/quectel 目录
```
# 用户名 wangguixin@sztvis.com
# 密码 lzm850206
git clone https://git-master.quectel.com/smart/rk3568_ubuntu_r60_v1.3.2.git
```
* 拷贝 git.tar.gz 文件到 ./yocto/meta-rockchip/recipes-multimedia/rockchip-rkaiq/files/ 目录下,并修改文件 ./yocto/meta-rockchip/recipes-multimedia/rockchip-rkaiq/rockchip-rkaiq.bb
```
@@ -17,8 +17,8 @@ inherit freeze-rev local-git
SRCREV = "${@oe.utils.version_less_or_equal('RK_ISP_VERSION', '1', '0123456789012345678901234567890123456789', '${AUTOREV}', d)}"
SRC_URI = " \
- git://github.com/JeffyCN/mirrors.git;protocol=https;nobranch=1;branch=rkaiq-2022_09_22; \
file://rkaiq_daemons.sh \
+ file://git.tar.gz \
"
```
* 拷贝 dl-1.3.2.tar.gz 文件 到 /home/heahoyang/works/quectel 目录, 并解压
```
tar -zxvf dl-1.3.2.tar.gz
sudo chmod 777 -R dl
```
* 拷贝 downloads-sg368z.tar.gz 目录 到 /home/heahoyang/works/quectel 目录, 并按照 yocto_readme.txt 指引操作。
```
tar -zxvf downloads-sg368z.tar.gz
sudo chmod 777 -R downloads-sg368z
```
* 修改 ./yocto/build/conf/include/common.conf 文件 中 DL_LIR 参数
```
DL_DIR ?= "/home/hehaoyang/works/quectel/downloads-sg368z"
```
* 修改 /home/hehaoyang/works/quectel/rk3568_ubuntu_r60_v1.3.2/buildroot/Config.in 文件 BR2_DL_DIR参 数配置选项,修改 default 参数
```
default "/home/hehaoyang/works/quectel/dl"
```
#### 创建、进入容器
* 拷贝 smartlinux-docker-ubuntu2004_v1.2.tar.gz 到 /home/heahoyang/works/quectel 目录
* 拷贝 smartlinux-docker-lsubuntu2004_v1.2.tar.gz 到 /home/heahoyang/works/quectel 目录
```
hehaoyang@server:~/works/quectel$ docker load -i smartlinux-docker-ubuntu2004_v1.2.tar.gz
hehaoyang@server:~/works/quectel$ docker run --privileged -v /home/hehaoyang/works/quectel/dl:/home/hehaoyang/works/quectel/dl -v /home/hehaoyang/works/quectel/downloads-sg368z:/home/hehaoyang/works/quectel/downloads-sg368z -v /home/hehaoyang/works/quectel/rk3568_ubuntu_r60_v1.3.2/:/home/hehaoyang/works/quectel/rk3568_ubuntu_r60_v1.3.2/ -it 0bf5597a5df5 /bin/bash
hehaoyang@server:~/works/quectel$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
897f9de6d565 0bf5597a5df5 "/bin/bash" 5 hours ago Exited (1) 5 minutes ago nice_ptolemy
hehaoyang@server:~/works/quectel$ docker start 897f9de6d565
897f9de6d565
hehaoyang@server:~/works/quectel$ docker attach 897f9de6d565
```
### 将安全目录添加到全局的Git配置中
```
git config --global --add safe.directory /home/hehaoyang/works/quectel/rk3568_ubuntu_r60_v1.3.2
git config --global --add safe.directory /home/hehaoyang/works/quectel/downloads-sg368z/git2/github.com.thkukuk.libnsl
git config --global --add safe.directory /home/hehaoyang/works/quectel/downloads-sg368z/git2/github.com.JeffyCN.mirrors.git
git config --global --add safe.directory /home/hehaoyang/works/quectel/downloads-sg368z/git2/salsa.debian.org.debian.ncurses.git
git config --global --add safe.directory /home/hehaoyang/works/quectel/downloads-sg368z/git2/sourceware.org.git.bzip2-tests.git
git config --global --add safe.directory /home/hehaoyang/works/quectel/downloads-sg368z/git2/github.com.file.file.git
git config --global --add safe.directory /home/hehaoyang/works/quectel/downloads-sg368z/git2/gitlab.freedesktop.org.pkg-config.pkg-config.git
git config --global --add safe.directory /home/hehaoyang/works/quectel/downloads-sg368z/git2/github.com.rpm-software-management.rpm
docker load -i smartlinux-docker-ubuntu2004_v1.2.tar.gz
docker run --privileged -v /home/hehaoyang/works/quectel/rk3568_ubuntu_r60_v1.3.2/:/home/hehaoyang/works/quectel/rk3568_ubuntu_r60_v1.3.2/ -it 0bf5597a5df5 /bin/bash
```
### 编译
```
apt-get update
apt-get install rsyslog curl -y
apt-get install libxslt1-dev -y
apt-get install asciidoc -y
apt-get install -y rsyslog curl libxslt1-dev asciidoc
cd /home/hehaoyang/works
usermod -u 1001 quectel
cd /home/hehaoyang/works/quectel/rk3568_ubuntu_r60_v1.3.2/yocto/poky/scripts/postinst-intercepts/
chmod 664 ./*
chmod 755 postinst_intercept
cd ../../../../
su quectel
cd /home/hehaoyang/works/quectel/rk3568_ubuntu_r60_v1.3.2/
source build-quec.sh
build-all-image-yocto
exit
chown -v -R quectel /home/hehaoyang/works/quectel/
su quectel
cd /home/hehaoyang/works/quectel/rk3568_ubuntu_r60_v1.3.2/
source build-quec.sh
envsetup_yocto
rebake qti-ubuntu-robotics-image
exit
apt update
apt upgrade
su quectel
cd /home/hehaoyang/works/quectel/rk3568_ubuntu_r60_v1.3.2/
git config --global --add safe.directory /home/hehaoyang/works/quectel/rk3568_ubuntu_r60_v1.3.2
source build-quec.sh
build-all-image-yocto
# source build-quec.sh
# envsetup_yocto
# rebake qti-ubuntu-robotics-image
# cd ../../
# build-all-image-yocto
# 还需要验证下方这个方法是否可行
# source build-quec.sh
# build-all-image-yocto
# 然后再做其他的事情
```

View File

@ -0,0 +1,12 @@
# 编译项目
## 环境配置
* 拷贝 "testcase.cpp" 文件到 /root/works/testcase/ 目录下
*
```
gcc -o testcase testcase.cpp -I/root/works/testcase/ -I/root/works/testcase/rkrga -I/usr/local/include -L/root/works/testcase -lObjectEventDetect -lrknn_api -L/usr/local/lib -lopencv_imgproc -lopencv_videoio -lopencv_imgcodecs -lopencv_highgui -lopencv_core -lm -lpthread -ldl -lstdc++
```

View File

@ -15,12 +15,12 @@ sudo mkfs -t ext4 /dev/sdb
#### 挂载硬盘分区
```
sudo mount -t ext4 /dev/sdb /devdata
sudo chown tvis:tvis devdata
sudo mount -t ext4 /dev/sdb /home/hehaoyang/works/quectel
sudo chown hehaoyang:hehaoyang /home/hehaoyang/works/quectel
```
#### 配置硬盘在系统启动自动挂载
* 在文件 /etc/fstab 中加入如下配置
```
/dev/sdb /devdata ext4 defaults 0 0
/dev/sdb /home/hehaoyang/works/quectel ext4 defaults 0 0
```

View File

@ -0,0 +1,5 @@
# 查找文件大小
```
du -h --max-depth=1 /
```

19
Ubuntu/清理日志.md Normal file
View File

@ -0,0 +1,19 @@
# 清理日志
#### 禁用系统日志
```
systemctl disable rsyslog
```
#### 查看当前日志的占用情况
```
journalctl --disk-usage
```
#### 只保留50M
```
journalctl --vacuum-size=50M
```

View File

@ -42,8 +42,18 @@ then
if [ -n "$result" ]
then
# 打印机驱动重新加载成功
PrintPhoto DS-RX1HS $1
# 设置文件格式
lpoptions -o StpImageType=$1
# 设置打印模式
lpoptions -o ColorModel=$2
# 设置打印尺寸
lpoptions -o PageSize=$3
# 打印文件
PrintPhoto DS-RX1HS $4
echo "TRUE"
else
# 打印机驱动重新加载失败