Posts made by 大法师
-
早期版本 Ubuntu22.04 rknn toolkit lite2环境部署
默认Ubuntu22预装python3.10,暂时与RKNN 本机开发环境不一致,需要单独安装python3.9版本。
step1:增加源
sudo add-apt-repository ppa:deadsnakes/ppa sudo apt update sudo apt-mark unhold libexpat1 sudo apt install python3.9* -y #sudo update-alternatives --list python #sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 #sudo update-alternatives --config python3
setp 2:安装pip3
sudo apt-mark unhold libcurl4 sudo apt install curl -y curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py python3.9 get-pip.py export PATH=/home/ubuntu/.local/bin:$PATH pip3 -V pip3 install numpy --upgrade pip3 install opencv-python #check opencv python3.9 -c "import cv2; print(cv2.__version__)"
step 3: 安装rknn toolkit lite2
git clone https://gitee.com/yanyitech/rknpu2.git sudo cp -arf rknpu2/runtime/RK3588/Linux/librknn_api/aarch64/* /usr/lib/ git clone https://gitee.com/yanyitech/rknn-toolkit2.git pip3 install rknn-toolkit2/rknn_toolkit_lite2/packages/rknn_toolkit_lite2-1.4.0-cp39-cp39-linux_aarch64.whl
step 4: 验证运行环境
cd rknn-toolkit2/rknn_toolkit_lite2/examples/inference_with_lite ubuntu@coolpi:~/rknn-toolkit2/rknn_toolkit_lite2/examples/inference_with_lite$ python3.9 test.py --> Load RKNN model done --> Init runtime environment I RKNN: [10:19:55.691] RKNN Runtime Information: librknnrt version: 1.4.0 (a10f100eb@2022-09-09T09:07:14) I RKNN: [10:19:55.691] RKNN Driver Information: version: 0.8.0 I RKNN: [10:19:55.691] RKNN Model Information: version: 1, toolkit version: 1.4.0-c15f5e0b(compiler version: 1.4.0 (c73777b51@2022-09-05T12:06:01)), target: RKNPU v2, target platform: rk3588, framework name: PyTorch, framework layout: NCHW done --> Running model resnet18 -----TOP 5----- [812]: 0.9996696710586548 [404]: 0.0002492684288881719 [657]: 1.632158637221437e-05 [833]: 1.0159346857108176e-05 [466 895]: 9.02384545042878e-06 done
-
每个开发者都需要的私有化git服务器
基于Coolpi 4B搭建流行的gitlab服务器,一步到位。
gitlab_install.shubuntu@coolpi:~$ ./gitlab_install.sh libcurl4 was already not on hold. Reading package lists... Done Building dependency tree... Done Reading state information... Done curl is already the newest version (7.81.0-1ubuntu1.6). 0 upgraded, 0 newly installed, 0 to remove and 230 not upgraded. Detected operating system as Ubuntu/jammy. Checking for curl... Detected curl... Checking for gpg... Detected gpg... Running apt-get update... done. Installing apt-transport-https... done. Installing /etc/apt/sources.list.d/gitlab_gitlab-ce.list...done. Importing packagecloud gpg key... done. Running apt-get update... done. The repository is setup! You can now install packages. ubuntu@coolpi:~$
选择你需要的版本,安装它
ubuntu@coolpi:~$ sudo apt install gitlab-ce=15.6.0-ce.0 Reading package lists... Done Building dependency tree... Done Reading state information... Done The following NEW packages will be installed: gitlab-ce 0 upgraded, 1 newly installed, 0 to remove and 230 not upgraded. Need to get 1,148 MB of archives. After this operation, 3,869 MB of additional disk space will be used. Get:1 https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu jammy/main arm64 gitlab-ce arm64 15.6.0-ce.0 [1,148 MB] Fetched 1,148 MB in 1min 10s (16.3 MB/s) Selecting previously unselected package gitlab-ce. (Reading database ... 148928 files and directories currently installed.) Preparing to unpack .../gitlab-ce_15.6.0-ce.0_arm64.deb ... Unpacking gitlab-ce (15.6.0-ce.0) ... Setting up gitlab-ce (15.6.0-ce.0) ... It looks like GitLab has not been configured yet; skipping the upgrade script. *. *. *** *** ***** ***** .****** ******* ******** ******** ,,,,,,,,,***********,,,,,,,,, ,,,,,,,,,,,*********,,,,,,,,,,, .,,,,,,,,,,,*******,,,,,,,,,,,, ,,,,,,,,,*****,,,,,,,,,. ,,,,,,,****,,,,,, .,,,***,,,, ,*,. _______ __ __ __ / ____(_) /_/ / ____ _/ /_ / / __/ / __/ / / __ `/ __ \ / /_/ / / /_/ /___/ /_/ / /_/ / \____/_/\__/_____/\__,_/_.___/ Thank you for installing GitLab! GitLab was unable to detect a valid hostname for your instance. Please configure a URL for your GitLab instance by setting `external_url` configuration in /etc/gitlab/gitlab.rb file. Then, you can start your GitLab instance by running the following command: sudo gitlab-ctl reconfigure For a comprehensive list of configuration options please see the Omnibus GitLab readme https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md Help us improve the installation experience, let us know how we did with a 1 min ute survey: https://gitlab.fra1.qualtrics.com/jfe/form/SV_6kVqZANThUQ1bZb?installation=omnib us&release=15-6 ubuntu@coolpi:~$
修改默认配置文件,重新部署初始化配置
ubuntu@coolpi:~$ sudo vim /etc/gitlab/gitlab.rb ... #external_url 'http://gitlab.example.com' external_url 'http://192.168.1.172' ... ubuntu@coolpi:~$ sudo gitlab-ctl reconfigure ... Notes: Default admin account has been configured with following details: Username: root Password: You didn't opt-in to print initial root password to STDOUT. Password stored to /etc/gitlab/initial_root_password. This file will be cleaned up in first reconfigure run after 24 hours. NOTE: Because these credentials might be present in your log files in plain text, it is highly recommended to reset the password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password. gitlab Reconfigured!
初始root用户密码请查看文件
ubuntu@coolpi:~$ sudo cat /etc/gitlab/initial_root_password [sudo] password for ubuntu: # WARNING: This value is valid only in the following conditions # 1. If provided manually (either via `GITLAB_ROOT_PASSWORD` environment variable or via `gitlab_rails['initial_root_password']` setting in `gitlab.rb`, it was provided before database was seeded for the first time (usually, the first reconfigure run). # 2. Password hasn't been changed manually, either via UI or via command line. # # If the password shown here doesn't work, you must reset the admin password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password. Password: HQQY3tBsOGOW2jd2gmiLDROf3fEnKH8CW3ZFnikPlHg= # NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.
浏览器访问http://localhost 或者 http://192.168.1.172
-
Ubuntu audio record and play
GUI: apt install audacity CLI: arecord -D hw:2,0 -d 10 -r 48000 -c 2 -f S16_LE test.wav aplay -D hw:2,0 test.wav
-
Ubuntu docker user guide
Check your linux system whether installed docker, if done skip this step.
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null apt update apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
Non-root users need to add sudo prefix. This operation is complicated. Now use the following operation to remove it.
sudo groupadd docker sudo gpasswd -a ${USER} docker sudo systemctl restart docker exit or open a new terminal shell
Run hello-world image
coolpi@coolpi:~$ docker version Client: Docker Engine - Community Version: 20.10.22 API version: 1.41 Go version: go1.18.9 Git commit: 3a2c30b Built: Thu Dec 15 22:27:17 2022 OS/Arch: linux/arm64 Context: default Experimental: true Server: Docker Engine - Community Engine: Version: 20.10.22 API version: 1.41 (minimum version 1.12) Go version: go1.18.9 Git commit: 42c8b31 Built: Thu Dec 15 22:25:29 2022 OS/Arch: linux/arm64 Experimental: false containerd: Version: 1.6.14 GitCommit: 9ba4b250366a5ddde94bb7c9d1def331423aa323 runc: Version: 1.1.4 GitCommit: v1.1.4-0-g5fd4c4d docker-init: Version: 0.19.0 GitCommit: de40ad0 coolpi@coolpi:~$ docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 7050e35b49f5: Pull complete Digest: sha256:aa0cc8055b82dc2509bed2e19b275c8f463506616377219d9642221ab53cf9fe Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (arm64v8) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/ coolpi@coolpi:~$
-
RE: Ubuntu22.04 如何安装Python3-dev
参考如下
sudo apt-mask unhold python3* python3-* libpython3* libexpat1 sudo apt install python3-dev
-
TF卡镜像Wifi预配置
Debian或Ubuntu镜像使用离线刷机方法,镜像写入完成后,在system-boot分区根目录,新建文件wifi.txt,内容参考如下:
ssid="你要连接的wifi名" passwd="wifi密码"
插上TF到CoolPi主板,自动连接Wifi
-
Coolpi 4b EMMC镜像备份导出方法
用户基于我们发布是镜像系统,安装软件或进行其他配置之后,如果想备份系统,有很多方法可以实现,我这里提供一个比较简单的思路供大家参考。
前置条件:
- 假如您手边有一张已经做好系统的TF卡
- 各种改动后的EMMC系统
核心操作步骤:
- 从EMMC启动系统,登陆桌面并打开终端命令行更改卷标
sudo su fatlabel /dev/mmcblk0p1 emmc-boot e2label /dev/mmcblk0p2 emmc-rootfs vim /boot/firmware/cmdline.txt 将writable替换为emmc-rootfs 然后保存退出 vim /etc/fstab 将writable替换为emmc-rootfs 然后保存退出 sync;
-
插入TF卡,重启系统
-
默认优先从TF卡引导系统,进入系统之后,可以挂载EMMC分区进行备份压缩
-
Rockchip NPU2 SDK
RKNPU2 provides an advanced interface to access Rockchip NPU.
-
Rockchip rknn toolkit2
RKNN-Toolkit2 is a software development kit for users to perform model conversion, inference and performance evaluation on PC and Rockchip NPU platforms (RK3588, RK3588S).
RKNN-Toolkit-Lite2 provides Python programming interfaces for Rockchip NPU platform (RK3588, RK3588S) to help users deploy RKNN models and accelerate the implementation of AI applications.
-
Rockchip RK3588 kernel dts解析之显示模块
RK3588 的VOP (video output process)分为4个Port
port 分辨率 VP0 4K VP1 4K VP2 4K VP3 1080P
支持8个图层,每个图层可以灵活分配到每个Video Port上。
RK3588 支持的显示接口
- 2个DP
- 2个HDMI/eDP 共用接口
- 2个MIPI DSI
- BT656/BT1120
转自
https://blog.csdn.net/weixin_43245753/article/details/123496204 -
图形显示官方介绍
https://opensource.rock-chips.com/wiki_Graphics
如下链接文章写的比较好,值得研究。
https://blog.csdn.net/xgbing/article/details/79969640摘一部分:
简单的理解 drm里有crtc,plane,connector这三个东西,可以理解 connector就是屏幕,比如一个hdmi一个connector num, 一个dsi一个connector num crtc表示vop, 一个屏幕一般对应一个crtc plane就是图层,比如视频层在plane2,UI在plane1, 视频在UI上面
-
基于Cool Pi 4 Model B 安装宝塔面板
宝塔是什么,可以查看demo页面
apt-get install wget curl wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh sudo bash install.sh 安装成功后,保存账户信息用于内网面板登陆 ================================================================== Congratulations! Installed successfully! ================================================================== 外网面板地址: http://xxx.226.28.51:8888/dc404f6c 内网面板地址: http://192.168.3.xx:8888/dc404f6c username: xxxx password: xxxx If you cannot access the panel, release the following panel port [8888] in the security group 若无法访问面板,请检查防火墙/安全组是否有放行面板[8888]端口 ================================================================== Time consumed: 9 Minute! ubuntu@coolpi:~$
-
Ubuntu Disk speed Test
root@coolpi:/home/ubuntu# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS sda 8:0 0 223.6G 0 disk ├─sda1 8:1 0 300M 0 part └─sda2 8:2 0 223.3G 0 part / zram0 254:0 0 0B 0 disk root@coolpi:/home/ubuntu# root@coolpi:/home/ubuntu# parted /dev/sda print 型号:ATA KINGSTON SA400S3 (scsi) 磁盘 /dev/sda: 240GB 扇区大小 (逻辑/物理):512B/512B 分区表:msdos 磁盘标志: 编号 起始点 结束点 大小 类型 文件系统 标志 1 1049kB 316MB 315MB primary fat32 2 316MB 240GB 240GB primary ext4 root@coolpi:/home/ubuntu# root@coolpi:/home/ubuntu# hdparm -t --direct /dev/sda /dev/sda: Timing O_DIRECT disk reads: 610 MB in 3.00 seconds = 203.18 MB/sec root@coolpi:/home/ubuntu#
-
Ubuntu22 install pip3
ubuntu@coolpi:~$ sudo apt install python3-pip Reading package lists... Done Building dependency tree... Done Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: python3-distutils : Depends: python3:any (>= 3.10.5-0~) Depends: python3-lib2to3 (= 3.10.6-1~22.04) but 3.10.4-0ubuntu1 is to be installed E: Unable to correct problems, you have held broken packages. ubuntu@coolpi:~$
maybe the system hold some packages. Please take a try use command:
apt-mask unhold python3* python3-* libpython3* apt install python3-pip
-
Debian11 桌面编译内核
使用1017镜像版本,需要额外执行如下指令完成环境搭建
sudo su apt-mark unhold libssl1.1 libdpkg-perl libc-dev-bin libc6 libc6-dev apt update apt install gcc make git python libncurses5-dev openssl libssl-dev build-essential pkg-config libc6-dev bison flex
下载内核本地编译
mkdir test;cd test git clone https://gitee.com/yanyitech/coolpi-kernel.git cd coolpi-kernel ./build-kernel.sh 编译完成,在out目录生成内核二进制文件、设备树以及驱动包 coolpi@coolpi:~/test/coolpi-kernel$ ls -lh out/ total 150M -rw-r--r-- 1 coolpi coolpi 137M 10月 17 13:33 modules.tar.gz -rw-r--r-- 1 coolpi coolpi 137K 10月 17 13:33 rk3588s-cp4.dtb -rw-r--r-- 1 coolpi coolpi 13M 10月 17 13:33 vmlinuz 查看当前磁盘挂载状态 coolpi@coolpi:~/test/coolpi-kernel$ df -h Filesystem Size Used Avail Use% Mounted on udev 1.9G 8.0K 1.9G 1% /dev tmpfs 373M 1.5M 371M 1% /run /dev/mmcblk2p2 29G 12G 16G 44% / tmpfs 1.9G 209M 1.7G 12% /dev/shm tmpfs 5.0M 4.0K 5.0M 1% /run/lock /dev/mmcblk2p1 300M 27M 273M 9% /boot/firmware tmpfs 373M 32K 373M 1% /run/user/1000 根据需要进行内核文件替换更新 coolpi@coolpi:~/test/coolpi-kernel$ ls -l /boot/firmware/ total 27084 -rwxr-xr-x 1 root root 176 1月 1 2021 cmdline.txt -rwxr-xr-x 1 root root 64 8月 31 09:25 config.txt -rwxr-xr-x 1 root root 8775086 8月 31 09:25 initrd.img -rwxr-xr-x 1 root root 8128296 10月 17 11:11 modules.tar.gz -rwxr-xr-x 1 root root 139847 10月 17 11:11 rk3588s-cp4.dtb -rwxr-xr-x 1 root root 10673011 10月 17 11:11 vmlinuz coolpi@coolpi:~/test/coolpi-kernel$
-
Coolpi 4b bootloader命令行升级方法
针对Cool Pi 4B主板,如需更新u-boot操作如下:
0823版本请升级到0904
-
下载0904版本bin文件
uboot.zip -
解压zip,将bin文件拷贝到U盘或Tf卡根目录
-
将U盘或Tf卡插入主板,连接Debug串口到PC电脑,打开串口终端工具,主板通电,连续输入大写CP中止u-boot自动启动
备注:请注意U盘启动或升级仅支持插入USB3 下层端口
-
在u-boot shell命令行窗口,
针对串口输出信息如下的主板
COOLPI LOADER BY YANYI(Aug 23 2022) DRAM: 3.7 GiB CR: M/C/I Using default environment
A) 如果是从U盘导入文件升级步骤 usb reset load usb 0:1 0x800000 uboot.img mtd erase nor0 0x200000 0x500000 mtd write nor0 0x800000 0x200000 0x500000 擦除与写入过程请勿断电或重启
B) 如果是从TF卡导入文件升级步骤 mmc dev 1 load mmc 1:1 0x800000 uboot.img mtd erase nor0 0x200000 0x500000 mtd write nor0 0x800000 0x200000 0x500000 擦除与写入过程请勿断电或重启
-
等待执行完毕,确认无异常后,断电或reset即可。
-
升级完成后,串口输出信息如下
COOLPI LOADER BY YANYI(Sep 03 2022) DRAM: 3.7 GiB Using default environment
后续的升级指令封装为 c update usb|tf|mmc tf卡升级测试: CPBOOT# v COOLPI LOADER BY YANYI(Sep 03 2022) aarch64-none-linux-gnu-gcc (GNU Toolchain for the A-profile Architecture 10.3-21 GNU ld (GNU Toolchain for the A-profile Architecture 10.3-2021.07 (arm-10.29)) 1 CPBOOT# c update tf reading uboot.img 5242880 bytes read in 428 ms (11.7 MiB/s) wait for erase... uboot upgrade ok... CPBOOT# reset u盘升级测试: CPBOOT# v COOLPI LOADER BY YANYI(Sep 03 2022) aarch64-none-linux-gnu-gcc (GNU Toolchain for the A-profile Architecture 10.3-21 GNU ld (GNU Toolchain for the A-profile Architecture 10.3-2021.07 (arm-10.29)) 1 CPBOOT# c update usb resetting USB... Bus usb@fc880000: USB EHCI 1.00 scanning bus usb@fc880000 for devices... 2 USB Device(s) found scanning usb for storage devices... 1 Storage Device(s) found reading uboot.img 5242880 bytes read in 363 ms (13.8 MiB/s) wait for erase... uboot upgrade ok... CPBOOT# reset 备注:请注意U盘启动或升级仅支持插入USB3 下层端口
-
-
Ubuntu qt5 support
Ubuntu20.04之后的版本已移除qt5-default,如需要安装,请执行如下命令:
sudo apt-get install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools
-
Ubuntu 22.04 桌面版本 内核编译
环境补充安装:
sudo ln -sf /usr/bin/python2 /usr/bin/python sudo apt install flex bison
可选执行
sudo dpkg-reconfigure dash
(注意弹框选择No)
测试代码下载与编译
ubuntu@coolpi:~$ mkdir test ubuntu@coolpi:~$ cd test/ ubuntu@coolpi:~/test$ git clone https://gitee.com/yanyitech/coolpi-kernel.git 正克隆到 'coolpi-kernel'... remote: Enumerating objects: 88605, done. remote: Counting objects: 100% (88605/88605), done. remote: Compressing objects: 100% (75148/75148), done.
...
查看远程仓库
ubuntu@coolpi:~/test/$ git remote -v origin https://gitee.com/yanyitech/coolpi-kernel.git (fetch) origin https://gitee.com/yanyitech/coolpi-kernel.git (push)
编译
ubuntu@coolpi:~/test/$ ./build-kernel.sh
修改内核配置
ubuntu@coolpi:~/test/$ make ARCH=arm64 menuconfig