first commit
This commit is contained in:
5
external/packages/bsp/overlays_cix/etc/modprobe.d/blacklist.conf
vendored
Executable file
5
external/packages/bsp/overlays_cix/etc/modprobe.d/blacklist.conf
vendored
Executable file
@@ -0,0 +1,5 @@
|
||||
blacklist r8125
|
||||
blacklist pgdrv
|
||||
blacklist rtk_btusb
|
||||
blacklist amdgpu
|
||||
blacklist armcb_isp
|
||||
4
external/packages/bsp/overlays_cix/etc/profile.d/cix_env.sh
vendored
Executable file
4
external/packages/bsp/overlays_cix/etc/profile.d/cix_env.sh
vendored
Executable file
@@ -0,0 +1,4 @@
|
||||
export KWIN_COMPOSE=O2ES
|
||||
export QT_OPENGL=es2
|
||||
export GDK_GL=gles
|
||||
export GST_GL_API=gles2
|
||||
30
external/packages/bsp/overlays_cix/etc/update-motd.d/41-orangepi-config
vendored
Executable file
30
external/packages/bsp/overlays_cix/etc/update-motd.d/41-orangepi-config
vendored
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) Authors: https://www.armbian.com/authors
|
||||
#
|
||||
# This file is licensed under the terms of the GNU General Public
|
||||
# License version 2. This program is licensed "as is" without any
|
||||
# warranty of any kind, whether express or implied.
|
||||
|
||||
# DO NOT EDIT THIS FILE but add config options to /etc/default/orangepi-motd
|
||||
# any changes will be lost on board support package update
|
||||
|
||||
THIS_SCRIPT="config"
|
||||
MOTD_DISABLE=""
|
||||
|
||||
[[ -f /etc/default/orangepi-motd ]] && . /etc/default/orangepi-motd
|
||||
|
||||
for f in $MOTD_DISABLE; do
|
||||
[[ $f == $THIS_SCRIPT ]] && exit 0
|
||||
done
|
||||
|
||||
#if [[ $(( $RANDOM % 2 )) == 0 ]]; then
|
||||
# if [[ -f /usr/sbin/orangepi-config ]]; then
|
||||
# echo -e "[\e[31m General system configuration (beta)\e[0m: \e[1morangepi-config\e[0m ]\n"
|
||||
# else
|
||||
# echo -e "[\e[31m Menu-driven system configuration (beta)\e[0m: \e[1msudo dpkg -i orangepi-config.deb\e[0m ]\n"
|
||||
# fi
|
||||
#fi
|
||||
|
||||
exit 0
|
||||
|
||||
1
external/packages/bsp/overlays_cix/opt/make_bios_image/.gitignore
vendored
Normal file
1
external/packages/bsp/overlays_cix/opt/make_bios_image/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*.img
|
||||
BIN
external/packages/bsp/overlays_cix/opt/make_bios_image/EFI/BOOT/BOOTX64.EFI
vendored
Normal file
BIN
external/packages/bsp/overlays_cix/opt/make_bios_image/EFI/BOOT/BOOTX64.EFI
vendored
Normal file
Binary file not shown.
BIN
external/packages/bsp/overlays_cix/opt/make_bios_image/bios_flash/FlashUpdate.efi
vendored
Normal file
BIN
external/packages/bsp/overlays_cix/opt/make_bios_image/bios_flash/FlashUpdate.efi
vendored
Normal file
Binary file not shown.
1
external/packages/bsp/overlays_cix/opt/make_bios_image/bios_flash/flash_bios.nsh
vendored
Normal file
1
external/packages/bsp/overlays_cix/opt/make_bios_image/bios_flash/flash_bios.nsh
vendored
Normal file
@@ -0,0 +1 @@
|
||||
FlashUpdate.efi -f bios_v1.0.bin
|
||||
169
external/packages/bsp/overlays_cix/opt/make_bios_image/make_bios_img.sh
vendored
Executable file
169
external/packages/bsp/overlays_cix/opt/make_bios_image/make_bios_img.sh
vendored
Executable file
@@ -0,0 +1,169 @@
|
||||
#!/bin/bash
|
||||
|
||||
# BIOS镜像制作脚本
|
||||
|
||||
set -e
|
||||
|
||||
# 配置变量
|
||||
IMAGE_NAME="opi6plus_bios_image_for_linux_$(date +"%Y%m%d").img"
|
||||
IMAGE_SIZE="100" # 100MB镜像
|
||||
MOUNT_POINT="/tmp/bios_mount"
|
||||
|
||||
# 颜色定义
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m'
|
||||
|
||||
info() { echo -e "${GREEN}[INFO]${NC} $1"; }
|
||||
warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
|
||||
error() { echo -e "${RED}[ERROR]${NC} $1"; }
|
||||
|
||||
# 检查依赖
|
||||
check_dependencies() {
|
||||
local deps=("dosfstools" "parted")
|
||||
for dep in "${deps[@]}"; do
|
||||
if ! command -v $dep &> /dev/null; then
|
||||
info "安装依赖: $dep"
|
||||
sudo apt-get install -y $dep
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# 清理函数
|
||||
cleanup() {
|
||||
if mountpoint -q "$MOUNT_POINT"; then
|
||||
sudo umount "$MOUNT_POINT" 2>/dev/null || true
|
||||
fi
|
||||
if [ -n "$LOOP_DEVICE" ]; then
|
||||
sudo losetup -d "$LOOP_DEVICE" 2>/dev/null || true
|
||||
fi
|
||||
if [ -d "$MOUNT_POINT" ]; then
|
||||
sudo rmdir "$MOUNT_POINT" 2>/dev/null || true
|
||||
fi
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
main() {
|
||||
info "开始制作BIOS镜像..."
|
||||
|
||||
check_dependencies
|
||||
|
||||
if [ ! -d "bios_flash" ] || [ ! -d "EFI" ]; then
|
||||
error "缺少必要的文件夹: bios_flash 或 EFI"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 删除已存在的镜像文件
|
||||
[ -f "$IMAGE_NAME" ] && rm -f "$IMAGE_NAME"
|
||||
|
||||
# 1. 创建100MB镜像文件
|
||||
info "创建${IMAGE_SIZE}MB空白镜像..."
|
||||
dd if=/dev/zero of="$IMAGE_NAME" bs=1M count=$IMAGE_SIZE status=progress
|
||||
sync
|
||||
|
||||
# 2. 使用parted创建分区
|
||||
info "创建分区表和分区..."
|
||||
sudo parted "$IMAGE_NAME" --script mklabel msdos
|
||||
sudo parted "$IMAGE_NAME" --script mkpart primary fat32 1MiB 100%
|
||||
sudo parted "$IMAGE_NAME" --script set 1 boot on
|
||||
|
||||
sync
|
||||
sleep 2
|
||||
|
||||
# 3. 设置循环设备
|
||||
info "设置循环设备..."
|
||||
LOOP_DEVICE=$(sudo losetup --find --show --partscan "$IMAGE_NAME")
|
||||
PARTITION="${LOOP_DEVICE}p1"
|
||||
info "使用循环设备: $LOOP_DEVICE"
|
||||
info "分区: $PARTITION"
|
||||
|
||||
sleep 2
|
||||
|
||||
# 4. 使用wipefs清除文件系统签名(更安全的方法)
|
||||
info "清除文件系统签名..."
|
||||
if command -v wipefs > /dev/null; then
|
||||
sudo wipefs -a "$PARTITION"
|
||||
else
|
||||
warn "wipefs不可用,跳过清除签名步骤"
|
||||
fi
|
||||
|
||||
# 5. 格式化分区
|
||||
info "使用gparted相同命令格式化..."
|
||||
sudo mkfs.fat -F32 -v -I -n "BIOSFLASH" "$PARTITION"
|
||||
|
||||
# 6. 挂载分区
|
||||
info "挂载分区..."
|
||||
sudo mkdir -p "$MOUNT_POINT"
|
||||
sudo mount "$PARTITION" "$MOUNT_POINT"
|
||||
|
||||
# 7. 复制文件
|
||||
info "复制bios_flash文件夹..."
|
||||
sudo cp -r bios_flash "$MOUNT_POINT/"
|
||||
info "复制EFI文件夹..."
|
||||
sudo cp -r EFI "$MOUNT_POINT/"
|
||||
|
||||
# 8. 验证文件
|
||||
info "验证文件复制..."
|
||||
if [ -d "$MOUNT_POINT/bios_flash" ] && [ -d "$MOUNT_POINT/EFI" ]; then
|
||||
info "✅ 文件复制成功"
|
||||
echo "=== 文件列表 ==="
|
||||
ls -la "$MOUNT_POINT"
|
||||
echo ""
|
||||
echo "=== 文件大小 ==="
|
||||
du -sh "$MOUNT_POINT"/*
|
||||
else
|
||||
error "❌ 文件复制失败"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 9. 同步并卸载
|
||||
info "同步数据..."
|
||||
sync
|
||||
sudo umount "$MOUNT_POINT"
|
||||
sudo losetup -d "$LOOP_DEVICE"
|
||||
|
||||
# 10. 最终验证
|
||||
info "最终验证..."
|
||||
echo "=== 分区信息 ==="
|
||||
sudo parted "$IMAGE_NAME" --script print
|
||||
|
||||
echo "=== 文件系统信息 ==="
|
||||
sudo losetup --find --show --partscan "$IMAGE_NAME" > /tmp/loopdev
|
||||
LOOP_DEVICE=$(cat /tmp/loopdev)
|
||||
echo "文件系统检查:"
|
||||
sudo fsck.fat -v "${LOOP_DEVICE}p1" || true
|
||||
sudo losetup -d "$LOOP_DEVICE"
|
||||
rm -f /tmp/loopdev
|
||||
|
||||
echo ""
|
||||
info "✅ 镜像制作完成: $IMAGE_NAME"
|
||||
info "📊 文件大小: $(du -h $IMAGE_NAME | cut -f1)"
|
||||
echo ""
|
||||
info "🔥 烧录命令:"
|
||||
echo "sudo dd if=$IMAGE_NAME of=/dev/sdX bs=4M status=progress oflag=sync"
|
||||
echo ""
|
||||
info "💡 测试方法:"
|
||||
echo "1. 烧录到U盘: sudo dd if=$IMAGE_NAME of=/dev/sdX bs=4M status=progress oflag=sync"
|
||||
echo "2. 在Linux中检查: ls /media/\$USER/BIOSFLASH/"
|
||||
echo "3. 在Windows中应该能看到bios_flash和EFI文件夹"
|
||||
echo ""
|
||||
warn "⚠️ 注意: 将 /dev/sdX 替换为正确的U盘设备路径!"
|
||||
}
|
||||
|
||||
echo "=================================================="
|
||||
info " BIOS镜像制作脚本"
|
||||
echo "=================================================="
|
||||
|
||||
info "当前目录结构:"
|
||||
tree -L 2
|
||||
|
||||
echo ""
|
||||
read -p "是否继续? (y/N): " -n 1 -r
|
||||
echo
|
||||
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
main
|
||||
BIN
external/packages/bsp/overlays_cix/opt/video_h265.mp4
vendored
Normal file
BIN
external/packages/bsp/overlays_cix/opt/video_h265.mp4
vendored
Normal file
Binary file not shown.
32
external/packages/bsp/overlays_cix/usr/bin/blink_gpio.sh
vendored
Executable file
32
external/packages/bsp/overlays_cix/usr/bin/blink_gpio.sh
vendored
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 检查至少提供一个 GPIO 引脚
|
||||
if [ "$#" -lt 1 ]; then
|
||||
echo "Usage: $0 gpio_number1 [gpio_number2 ... gpio_numberN]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 导出和设置方向为输出
|
||||
for gpio in "$@"; do
|
||||
if [ ! -e "/sys/class/gpio/gpio${gpio}" ]; then
|
||||
echo "Exporting GPIO $gpio"
|
||||
echo $gpio > /sys/class/gpio/export
|
||||
fi
|
||||
echo "Setting GPIO $gpio direction to out"
|
||||
echo "out" > /sys/class/gpio/gpio${gpio}/direction
|
||||
done
|
||||
|
||||
# 闪烁逻辑
|
||||
while true; do
|
||||
# 设置 GPIO 高电平
|
||||
for gpio in "$@"; do
|
||||
echo 1 > /sys/class/gpio/gpio${gpio}/value
|
||||
done
|
||||
sleep 1 # 调整为所需的闪烁时间间隔
|
||||
|
||||
# 设置 GPIO 低电平
|
||||
for gpio in "$@"; do
|
||||
echo 0 > /sys/class/gpio/gpio${gpio}/value
|
||||
done
|
||||
sleep 1 # 调整为所需的闪烁时间间隔
|
||||
done
|
||||
27
external/packages/bsp/overlays_cix/usr/bin/cam1_test.sh
vendored
Executable file
27
external/packages/bsp/overlays_cix/usr/bin/cam1_test.sh
vendored
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 通过 sysfs 查找 armcb-00-vid-cap 对应的视频设备
|
||||
find_cam1_device() {
|
||||
for dev in /dev/video*; do
|
||||
dev_name=$(basename "$dev")
|
||||
if [ -f "/sys/class/video4linux/${dev_name}/name" ]; then
|
||||
name=$(cat "/sys/class/video4linux/${dev_name}/name")
|
||||
if [ "$name" = "armcb-00-vid-cap" ]; then
|
||||
echo "$dev"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
VIDEO_DEVICE=$(find_cam1_device)
|
||||
|
||||
if [ -z "$VIDEO_DEVICE" ]; then
|
||||
echo "Error: Cannot find video device for armcb-00-vid-cap"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Using video device: $VIDEO_DEVICE for armcb-00-vid-cap"
|
||||
|
||||
gst-launch-1.0 v4l2src device=$VIDEO_DEVICE ! videoconvert ! autovideosink
|
||||
27
external/packages/bsp/overlays_cix/usr/bin/cam2_test.sh
vendored
Executable file
27
external/packages/bsp/overlays_cix/usr/bin/cam2_test.sh
vendored
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 通过 sysfs 查找 armcb-01-vid-cap 对应的视频设备
|
||||
find_cam2_device() {
|
||||
for dev in /dev/video*; do
|
||||
dev_name=$(basename "$dev")
|
||||
if [ -f "/sys/class/video4linux/${dev_name}/name" ]; then
|
||||
name=$(cat "/sys/class/video4linux/${dev_name}/name")
|
||||
if [ "$name" = "armcb-01-vid-cap" ]; then
|
||||
echo "$dev"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
VIDEO_DEVICE=$(find_cam2_device)
|
||||
|
||||
if [ -z "$VIDEO_DEVICE" ]; then
|
||||
echo "Error: Cannot find video device for armcb-01-vid-cap"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Using video device: $VIDEO_DEVICE for armcb-01-vid-cap"
|
||||
|
||||
gst-launch-1.0 v4l2src device=$VIDEO_DEVICE ! videoconvert ! autovideosink
|
||||
3
external/packages/bsp/overlays_cix/usr/bin/dt_gpio_all_blink.sh
vendored
Executable file
3
external/packages/bsp/overlays_cix/usr/bin/dt_gpio_all_blink.sh
vendored
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
blink_gpio.sh 65 64 106 32 33 108 17 14 18 57 37 40 41 66 69 114 115 34 109 35 36 15 16 56 38 39 70 71
|
||||
52
external/packages/bsp/overlays_cix/usr/bin/dual_cam_test.sh
vendored
Executable file
52
external/packages/bsp/overlays_cix/usr/bin/dual_cam_test.sh
vendored
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 通过 sysfs 查找 armcb-00-vid-cap 对应的视频设备
|
||||
find_cam1_device() {
|
||||
for dev in /dev/video*; do
|
||||
dev_name=$(basename "$dev")
|
||||
if [ -f "/sys/class/video4linux/${dev_name}/name" ]; then
|
||||
name=$(cat "/sys/class/video4linux/${dev_name}/name")
|
||||
if [ "$name" = "armcb-00-vid-cap" ]; then
|
||||
echo "$dev"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
VIDEO_DEVICE1=$(find_cam1_device)
|
||||
|
||||
if [ -z "$VIDEO_DEVICE1" ]; then
|
||||
echo "Error: Cannot find video device for armcb-00-vid-cap"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Using video device: $VIDEO_DEVICE1 for armcb-00-vid-cap"
|
||||
|
||||
# 通过 sysfs 查找 armcb-01-vid-cap 对应的视频设备
|
||||
find_cam2_device() {
|
||||
for dev in /dev/video*; do
|
||||
dev_name=$(basename "$dev")
|
||||
if [ -f "/sys/class/video4linux/${dev_name}/name" ]; then
|
||||
name=$(cat "/sys/class/video4linux/${dev_name}/name")
|
||||
if [ "$name" = "armcb-01-vid-cap" ]; then
|
||||
echo "$dev"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
VIDEO_DEVICE2=$(find_cam2_device)
|
||||
|
||||
if [ -z "$VIDEO_DEVICE2" ]; then
|
||||
echo "Error: Cannot find video device for armcb-01-vid-cap"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Using video device: $VIDEO_DEVICE2 for armcb-01-vid-cap"
|
||||
|
||||
gst-launch-1.0 v4l2src device=$VIDEO_DEVICE1 ! videoconvert ! autovideosink \
|
||||
v4l2src device=$VIDEO_DEVICE2 ! videoconvert ! autovideosink
|
||||
BIN
external/packages/bsp/overlays_cix/usr/bin/gpu_utilization_clock_tracing
vendored
Executable file
BIN
external/packages/bsp/overlays_cix/usr/bin/gpu_utilization_clock_tracing
vendored
Executable file
Binary file not shown.
6
external/packages/bsp/overlays_cix/usr/bin/install_bt_panel.sh
vendored
Executable file
6
external/packages/bsp/overlays_cix/usr/bin/install_bt_panel.sh
vendored
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
#wget -O install.sh \
|
||||
#http://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh
|
||||
|
||||
if [ -f /usr/bin/curl ];then curl -sSO https://download.bt.cn/install/install_panel.sh;else wget -O install_panel.sh https://download.bt.cn/install/install_panel.sh;fi;bash install_panel.sh ssl251104
|
||||
24
external/packages/bsp/overlays_cix/usr/bin/install_qt.sh
vendored
Executable file
24
external/packages/bsp/overlays_cix/usr/bin/install_qt.sh
vendored
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
release=$(lsb_release -cs)
|
||||
|
||||
sudo apt update
|
||||
if [[ $release =~ focal|bionic|buster ]]; then
|
||||
sudo apt-get -y install qt5-default qttools5-dev-tools qtbase5-doc-html qt5-assistant qt5-doc
|
||||
elif [[ $release =~ bullseye|bookworm|jammy|noble ]]; then
|
||||
sudo apt-get -y install qttools5-dev-tools qtbase5-doc-html qt5-assistant qt5-doc qt5-qmake qt5-qmake-bin
|
||||
else
|
||||
echo "Unsupported system!"
|
||||
exit
|
||||
fi
|
||||
|
||||
sudo apt-get -y install qtcreator qmlscene gdb qtdeclarative5-dev qtbase5-examples cmake
|
||||
|
||||
if [[ $release =~ bookworm|noble ]]; then
|
||||
sudo apt-get -y install qt6-wayland qtwayland5
|
||||
sudo apt-get -y install libegl1-mesa-dev libgles2-mesa-dev
|
||||
fi
|
||||
|
||||
sudo chown orangepi:orangepi /usr/lib/aarch64-linux-gnu/qt5/examples -R
|
||||
|
||||
qmake -v
|
||||
103
external/packages/bsp/overlays_cix/usr/bin/install_ros.sh
vendored
Executable file
103
external/packages/bsp/overlays_cix/usr/bin/install_ros.sh
vendored
Executable file
@@ -0,0 +1,103 @@
|
||||
#!/bin/bash
|
||||
|
||||
#mirror_url=http://mirrors.ustc.edu.cn
|
||||
mirror_url=https://repo.huaweicloud.com
|
||||
|
||||
if [[ -n $1 && $1 =~ ros1|ros2 ]]; then
|
||||
version=$1
|
||||
else
|
||||
echo "usage: install_ros.sh ros1/ros2"
|
||||
exit
|
||||
fi
|
||||
|
||||
release=$(lsb_release -cs)
|
||||
|
||||
if [[ $version == "ros1" && $release =~ focal ]]; then
|
||||
|
||||
[[ -f /etc/apt/sources.list.d/ros-latest.list ]] && sudo rm /etc/apt/sources.list.d/ros-latest.list
|
||||
sudo sh -c "echo deb ${mirror_url}/ros/ubuntu $(lsb_release -sc) main > /etc/apt/sources.list.d/ros1.list"
|
||||
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
|
||||
sudo apt update
|
||||
sudo apt install -y ros-noetic-desktop-full
|
||||
|
||||
sudo sh -c 'echo "source /opt/ros/noetic/setup.bash" >> /root/.bashrc'
|
||||
echo "source /opt/ros/noetic/setup.bash" >> /home/orangepi/.bashrc
|
||||
|
||||
sudo apt install -y python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential
|
||||
|
||||
sudo sh -c 'echo "151.101.84.133 raw.githubusercontent.com" >> /etc/hosts'
|
||||
source /opt/ros/noetic/setup.bash
|
||||
sudo rosdep init
|
||||
rosdep update
|
||||
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ $version == "ros2" && $release =~ focal ]]; then
|
||||
|
||||
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
|
||||
echo "deb [arch=$(dpkg --print-architecture)] ${mirror_url}/ros2/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list
|
||||
|
||||
sudo apt update
|
||||
sudo apt install -y ros-galactic-desktop
|
||||
sudo apt install -y ros-dev-tools
|
||||
|
||||
sudo sh -c 'echo "source /opt/ros/galactic/setup.bash" >> /root/.bashrc'
|
||||
echo "source /opt/ros/galactic/setup.bash" >> /home/orangepi/.bashrc
|
||||
|
||||
source /opt/ros/galactic/setup.bash
|
||||
ros2 -h
|
||||
|
||||
exit
|
||||
|
||||
fi
|
||||
|
||||
if [[ $version == "ros2" && $release =~ jammy ]]; then
|
||||
|
||||
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
|
||||
echo "deb [arch=$(dpkg --print-architecture)] ${mirror_url}/ros2/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list
|
||||
|
||||
sudo apt update
|
||||
sudo apt install -y ros-humble-desktop
|
||||
sudo apt install -y ros-dev-tools
|
||||
|
||||
sudo sh -c 'echo "source /opt/ros/humble/setup.bash" >> /root/.bashrc'
|
||||
echo "source /opt/ros/humble/setup.bash" >> /home/orangepi/.bashrc
|
||||
|
||||
source /opt/ros/humble/setup.bash
|
||||
ros2 -h
|
||||
|
||||
exit
|
||||
|
||||
fi
|
||||
|
||||
if [[ $version == "ros2" && $release =~ noble ]]; then
|
||||
|
||||
sudo locale-gen en_US en_US.UTF-8
|
||||
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
|
||||
export LANG=en_US.UTF-8
|
||||
sudo apt install -y software-properties-common curl gnupg2
|
||||
|
||||
sudo sh -c 'echo "deb https://mirrors.huaweicloud.com/ros2/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros2-latest.list'
|
||||
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
|
||||
|
||||
sudo apt update
|
||||
sudo apt install -y ros-jazzy-desktop-full
|
||||
sudo apt install -y python3-colcon-common-extensions \
|
||||
python3-rosdep \
|
||||
python3-rosinstall-generator \
|
||||
python3-pip \
|
||||
build-essential
|
||||
sudo apt install -y ros-dev-tools
|
||||
|
||||
sudo sh -c 'echo "source /opt/ros/jazzy/setup.bash" >> /root/.bashrc'
|
||||
echo "source /opt/ros/jazzy/setup.bash" >> /home/orangepi/.bashrc
|
||||
|
||||
source /opt/ros/jazzy/setup.bash
|
||||
ros2 -h
|
||||
|
||||
exit
|
||||
|
||||
fi
|
||||
|
||||
echo "Unsupported System!"
|
||||
BIN
external/packages/bsp/overlays_cix/usr/bin/isp_app
vendored
Executable file
BIN
external/packages/bsp/overlays_cix/usr/bin/isp_app
vendored
Executable file
Binary file not shown.
4
external/packages/bsp/overlays_cix/usr/bin/reset_ssh.sh
vendored
Executable file
4
external/packages/bsp/overlays_cix/usr/bin/reset_ssh.sh
vendored
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
sudo rm /etc/ssh/ssh_host_*
|
||||
sudo dpkg-reconfigure openssh-server
|
||||
BIN
external/packages/bsp/overlays_cix/usr/bin/serial
vendored
Executable file
BIN
external/packages/bsp/overlays_cix/usr/bin/serial
vendored
Executable file
Binary file not shown.
BIN
external/packages/bsp/overlays_cix/usr/bin/spidev_test
vendored
Executable file
BIN
external/packages/bsp/overlays_cix/usr/bin/spidev_test
vendored
Executable file
Binary file not shown.
37
external/packages/bsp/overlays_cix/usr/bin/test_ros.sh
vendored
Executable file
37
external/packages/bsp/overlays_cix/usr/bin/test_ros.sh
vendored
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ -f /opt/ros/noetic/setup.bash ]]; then
|
||||
|
||||
source /opt/ros/noetic/setup.bash
|
||||
roscore &
|
||||
|
||||
sleep 5
|
||||
|
||||
rosrun turtlesim turtlesim_node &
|
||||
rosrun turtlesim turtle_teleop_key
|
||||
|
||||
fi
|
||||
|
||||
if [[ -f /opt/ros/galactic/setup.bash ]]; then
|
||||
|
||||
source /opt/ros/galactic/setup.bash
|
||||
ros2 run demo_nodes_cpp talker &
|
||||
ros2 run demo_nodes_py listener
|
||||
|
||||
fi
|
||||
|
||||
if [[ -f /opt/ros/humble/setup.bash ]]; then
|
||||
|
||||
source /opt/ros/humble/setup.bash
|
||||
ros2 run demo_nodes_cpp talker &
|
||||
ros2 run demo_nodes_py listener
|
||||
|
||||
fi
|
||||
|
||||
if [[ -f /opt/ros/jazzy/setup.bash ]]; then
|
||||
|
||||
source /opt/ros/jazzy/setup.bash
|
||||
ros2 run demo_nodes_cpp talker &
|
||||
ros2 run demo_nodes_py listener
|
||||
|
||||
fi
|
||||
84
external/packages/bsp/overlays_cix/usr/bin/usb_gadget_setup.sh
vendored
Executable file
84
external/packages/bsp/overlays_cix/usr/bin/usb_gadget_setup.sh
vendored
Executable file
@@ -0,0 +1,84 @@
|
||||
#!/bin/bash
|
||||
|
||||
# USB Gadget 配置脚本
|
||||
# 功能:将设备配置为 USB NCM (网络控制模型) 设备
|
||||
|
||||
set -e # 遇到任何错误立即退出
|
||||
|
||||
GADGET_DIR="/sys/kernel/config/usb_gadget/g1"
|
||||
|
||||
echo "正在设置 USB NCM Gadget..."
|
||||
|
||||
# 检查是否以 root 权限运行
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
echo "错误:请使用 sudo 或以 root 用户运行此脚本"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 检查 configfs 是否已挂载
|
||||
if ! mountpoint -q /sys/kernel/config; then
|
||||
echo "挂载 configfs..."
|
||||
mount -t configfs none /sys/kernel/config || {
|
||||
echo "错误:无法挂载 configfs"
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
|
||||
# 清理现有配置(如果存在)
|
||||
if [ -d "$GADGET_DIR" ]; then
|
||||
echo "清理现有 gadget 配置..."
|
||||
echo "" > "$GADGET_DIR/UDC" 2>/dev/null || true
|
||||
rm -f "$GADGET_DIR/configs/c.1/ncm.usb0"
|
||||
rmdir "$GADGET_DIR/configs/c.1/strings/0x409" 2>/dev/null || true
|
||||
rmdir "$GADGET_DIR/configs/c.1" 2>/dev/null || true
|
||||
rmdir "$GADGET_DIR/functions/ncm.usb0" 2>/dev/null || true
|
||||
rmdir "$GADGET_DIR/strings/0x409" 2>/dev/null || true
|
||||
rmdir "$GADGET_DIR" 2>/dev/null || true
|
||||
sleep 1
|
||||
fi
|
||||
|
||||
# 创建 gadget 目录
|
||||
echo "创建 gadget 目录..."
|
||||
mkdir "$GADGET_DIR"
|
||||
|
||||
# 设置 USB 设备描述符
|
||||
echo "设置设备描述符..."
|
||||
echo 0x35b1 > "$GADGET_DIR/idVendor"
|
||||
echo 0x0009 > "$GADGET_DIR/idProduct"
|
||||
echo 0x0200 > "$GADGET_DIR/bcdDevice"
|
||||
echo 0x0210 > "$GADGET_DIR/bcdUSB"
|
||||
echo "super-speed-plus" > "$GADGET_DIR/max_speed"
|
||||
|
||||
# 设置字符串描述符
|
||||
echo "设置字符串描述符..."
|
||||
mkdir -m 0770 "$GADGET_DIR/strings/0x409"
|
||||
echo "0123456789ABCDEF" > "$GADGET_DIR/strings/0x409/serialnumber"
|
||||
echo "cix" > "$GADGET_DIR/strings/0x409/manufacturer"
|
||||
echo "USB ncm Device" > "$GADGET_DIR/strings/0x409/product"
|
||||
|
||||
# 创建配置
|
||||
echo "创建配置..."
|
||||
mkdir -m 0770 "$GADGET_DIR/configs/c.1"
|
||||
mkdir -m 0770 "$GADGET_DIR/configs/c.1/strings/0x409"
|
||||
echo "ncm" > "$GADGET_DIR/configs/c.1/strings/0x409/configuration"
|
||||
|
||||
# 创建 NCM 功能
|
||||
echo "创建 NCM 功能..."
|
||||
mkdir "$GADGET_DIR/functions/ncm.usb0"
|
||||
|
||||
# 将功能链接到配置
|
||||
echo "链接功能到配置..."
|
||||
ln -s "$GADGET_DIR/functions/ncm.usb0" "$GADGET_DIR/configs/c.1/"
|
||||
|
||||
# 启用 gadget
|
||||
echo "启用 USB 设备控制器..."
|
||||
UDC_DEVICE=$(ls /sys/class/udc/ | head -n1)
|
||||
if [ -n "$UDC_DEVICE" ]; then
|
||||
echo "$UDC_DEVICE" > "$GADGET_DIR/UDC"
|
||||
echo "已启用 UDC: $UDC_DEVICE"
|
||||
else
|
||||
echo "警告:未找到可用的 UDC 设备"
|
||||
fi
|
||||
|
||||
echo "USB NCM Gadget 配置完成!"
|
||||
echo "设备现在应该被识别为 USB 网络设备"
|
||||
11
external/packages/bsp/overlays_cix/usr/bin/v4l2_videos.sh
vendored
Executable file
11
external/packages/bsp/overlays_cix/usr/bin/v4l2_videos.sh
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Video Device and Name Correspondence:"
|
||||
echo "====================================="
|
||||
for dev in /dev/video*; do
|
||||
dev_name=$(basename $dev)
|
||||
if [ -f "/sys/class/video4linux/${dev_name}/name" ]; then
|
||||
name=$(cat "/sys/class/video4linux/${dev_name}/name")
|
||||
echo "$dev : $name"
|
||||
fi
|
||||
done
|
||||
27
external/packages/bsp/overlays_cix/usr/bin/vpu_test.sh
vendored
Executable file
27
external/packages/bsp/overlays_cix/usr/bin/vpu_test.sh
vendored
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo 3 | sudo tee /sys/kernel/debug/amvx/log/group/perf/enable > /dev/null
|
||||
|
||||
echo "开始监控VPU使用率(只显示大于0的情况)..."
|
||||
echo "按 Ctrl+C 停止监控"
|
||||
|
||||
while true
|
||||
do
|
||||
# 读取VPU使用率
|
||||
utilization=$(sudo cat /sys/kernel/debug/amvx/log/group/perf/utilization | awk '{print $3}' | tr -d '%')
|
||||
|
||||
# 只有当使用率大于0时才输出
|
||||
if (( $(echo "$utilization > 0" | bc -l) )); then
|
||||
# 获取当前时间
|
||||
current_time=$(date '+%H:%M:%S')
|
||||
|
||||
# 读取实时FPS信息
|
||||
fps_info=$(sudo cat /sys/kernel/debug/amvx/log/group/perf/realtime_fps)
|
||||
|
||||
# 输出信息
|
||||
echo "VPU Utilization: ${utilization}%"
|
||||
if [ -n "$fps_info" ] && [ "$fps_info" != "null" ]; then
|
||||
echo "$current_time $fps_info"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
15
external/packages/bsp/overlays_cix/usr/lib/systemd/system/isp-daemon.service
vendored
Executable file
15
external/packages/bsp/overlays_cix/usr/lib/systemd/system/isp-daemon.service
vendored
Executable file
@@ -0,0 +1,15 @@
|
||||
[Unit]
|
||||
Description=ISP Daemon
|
||||
After=network.target load-isp-modules.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Environment=LD_LIBRARY_PATH="/usr/share/cix/lib"
|
||||
ExecStart=/usr/bin/isp_app -s 0 &
|
||||
Restart=always
|
||||
RestartSec=1
|
||||
StartLimitInterval=10
|
||||
StartLimitBurst=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
BIN
external/packages/bsp/overlays_cix/usr/share/backgrounds/orangepi/orangepi-default.png
vendored
Executable file
BIN
external/packages/bsp/overlays_cix/usr/share/backgrounds/orangepi/orangepi-default.png
vendored
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 MiB |
79
external/packages/bsp/overlays_cix/usr/src/uart_test/serial.c
vendored
Normal file
79
external/packages/bsp/overlays_cix/usr/src/uart_test/serial.c
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <termios.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if (argc < 2) {
|
||||
printf("Usage: %s <serialport>\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
char *portname = argv[1];
|
||||
|
||||
// 打开串口
|
||||
int fd = open(portname, O_RDWR | O_NOCTTY | O_SYNC);
|
||||
if (fd < 0) {
|
||||
printf("Error opening %s: %s\n", portname, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
// 配置串口
|
||||
struct termios tty;
|
||||
memset(&tty, 0, sizeof tty);
|
||||
if (tcgetattr(fd, &tty) != 0) {
|
||||
printf("Error from tcgetattr: %s\n", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
cfsetospeed(&tty, B115200); // 设置波特率为 115200
|
||||
cfsetispeed(&tty, B115200);
|
||||
|
||||
tty.c_cflag = (tty.c_cflag & ~CSIZE) | CS8; // 8-bit chars
|
||||
tty.c_iflag &= ~IGNBRK; // 禁用break处理
|
||||
tty.c_lflag = 0; // 不使用规范模式
|
||||
tty.c_oflag = 0; // 不执行输出处理
|
||||
tty.c_cc[VMIN] = 0; // 读取不需要字符
|
||||
tty.c_cc[VTIME] = 5; // 0.5秒超时
|
||||
|
||||
tty.c_iflag &= ~(IXON | IXOFF | IXANY); // 关闭流控制
|
||||
tty.c_cflag |= (CLOCAL | CREAD); // 忽略调制解调器状态线,开启接收
|
||||
tty.c_cflag &= ~(PARENB | PARODD); // 关闭奇偶校验
|
||||
tty.c_cflag &= ~CSTOPB; // 无停止位
|
||||
tty.c_cflag &= ~CRTSCTS; // 禁用硬件流控制
|
||||
|
||||
if (tcsetattr(fd, TCSANOW, &tty) != 0) {
|
||||
printf("Error from tcsetattr: %s\n", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
// 向串口写数据
|
||||
char *msg = "Hello, Serial Port!\n";
|
||||
int wlen = write(fd, msg, strlen(msg));
|
||||
if (wlen != strlen(msg)) {
|
||||
printf("Error from write: %d, %d\n", wlen, errno);
|
||||
}
|
||||
tcdrain(fd); // 等待传输完成
|
||||
printf("W: %s", msg);
|
||||
|
||||
// 从串口读数据
|
||||
unsigned char buf[100];
|
||||
int total_read = 0;
|
||||
int rdlen;
|
||||
while ((rdlen = read(fd, buf + total_read, sizeof(buf) - 1 - total_read)) > 0) {
|
||||
total_read += rdlen;
|
||||
if (total_read >= sizeof(buf) - 1 || buf[total_read - 1] == '\n') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (total_read > 0) {
|
||||
buf[total_read] = 0; // 确保字符串正确终止
|
||||
printf("R: %s", buf);
|
||||
}
|
||||
|
||||
// 关闭串口 - 这部分代码将不会被执行,因为循环是无限的
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user