rk3568系统buildroot开发笔记

编译异常

in from _bz2 import BZ2Compressor, BZ2Decompressor ModuleNotFoundError: No module named ‘_bz2’

sudo apt-get install libbz2-dev
然后删掉
rk356x_bsp_bak/rk356x_bsp/build-iot/buildroot_output/rockchip_rk3568_iot/build/host-python3-3.10.5
重新编译

ERROR: Feature ‘webengine-system-libxml2’ was enabled, but the pre-condition ‘config.unix && libs.webengine-libxml2’ failed.

查看日志,原因的编译xml2的时候没开icu

> main.cpp:4:2: error: #error libxml icu not enabled
>     4 | #error libxml icu not enabled
>       |  ^~~~~

把这个libxml2-2.9.14 项目删了重新编译过就行了

error: there are no arguments to ‘uloc_openAvailableByType’ that depend on a template parameter, so a declaration of ‘uloc_openAvailableByType’ must be available [-fpermissive]

undefined reference to `icu_70::UnicodeSet::getRangeStart(int) const’

uloc_openAvailableByType(ULOC_AVAILABLE_WITH_LEGACY_ALIASES, &status);

编译的时候缺少头文件

去这里把 intl-objects.h 头文件加上

#include “unicode/uloc.h”

加上以后发现还是不行, 看了下文件路径这次编译是来源于系统的头文件,Ubuntu18.04 icu版本低,

下载
icu70 https://github.com/unicode-org/icu/releases/tag/release-70-1
icu-release-70-1/icu4c/source$ ./configure
./configure
make -12
sudo make install
//卸载掉原来系统的icu,不然依赖会错误
apt autoremove libicu-dev

unicode/uchar.h: No such file or directory

和上面一样

web_engine_context.cpp:799:23: error: ‘struct content::ContentMainParams’ has no member named ‘setup_signal_handlers’

2024-02-27T12:10:04 799 | contentMainParams.setup_signal_handlers = false;

    content::ContentMainParams contentMainParams(m_mainDelegate.get());
#if defined(OS_WIN)
    contentMainParams.setup_signal_handlers = false;
    contentMainParams.sandbox_info = staticSandboxInterfaceInfo();
sudo chmod 666 web_engine_context.cpp

CMake support for versions ❤️.17 is deprecated since Meson 0.62.0

wget https://cmake.org/files/v3.18/cmake-3.18.0-rc1-Linux-x86_64.tar.gz
tar zxvf cmake-3.16.7-Linux-x86_64.tar.gz
sudo mv cmake-3.16.7-Linux-x86_64 /opt/cmake-3.16.7
sudo ln -sf /opt/cmake-3.16.7/bin/* /usr/bin/
cmake --version

error: Package requirements (pango >= 1.8.0 pangoxft >= 1.8.0) were not met:

/home/genvict/rk356x_bsp/buildroot/configs/rockchip/x11.config

注释掉openbox

# BR2_PACKAGE_OPENBOX=y   

make: *** No rule to make target ‘xwayland’,

大致原因就是 缺少xwayland 的库 ,这个是一个独立的packet,他在新的buildroot里面可以找到

然后把它拷贝到sdk 的buildroot里面再编译

meson.build:41:2: ERROR: Problem encountered: Failed to find matched library

Message: Building for aarch64|bifrost-g52|g13p0||x11-wayland-gbm|O3

2024-03-28T21:47:35

2024-03-28T21:47:35 …/build-iot/buildroot_output/rockchip_rk3568_iot/build/rockchip-mali-master/meson.build:41:2: ERROR: Problem encountered: Failed to find matched library

找不到 x11-wayland-gbm 这个名字的库,
原厂没有默认编译出来这个库 , 拿wayland-gdm换名字先跳过
因为想要编译Xwayland  ,那么 xorg又一定要开

libgtk3 Can’t find cairo-pdf.h

024-05-24T09:16:03 configure: error:
2024-05-24T09:16:03 *** Can't find cairo-pdf.h. You must build Cairo with the pdf
2024-05-24T09:16:03 *** backend enabled.
BR2_PACKAGE_CAIRO=y
BR2_PACKAGE_CAIRO_PDF=y

ffmpeg 不支持rk硬件加速

# fflpay
BR2_PACKAGE_FFMPEG_FFMPEG=y
BR2_PACKAGE_FFMPEG_GPL=y
BR2_PACKAGE_FFMPEG_NONFREE=y
BR2_PACKAGE_FFMPEG_FFPLAY=y
BR2_PACKAGE_FFMPEG_FFPROBE=y
BR2_PACKAGE_FFMPEG_XCBGRAB=y
BR2_PACKAGE_FFMPEG_AVRESAMPLE=y
BR2_PACKAGE_FFMPEG_POSTPROC=y
#额外追加
BR2_PACKAGE_FFMPEG_EXTRACONF="--enable-version3 --enable-libdrm --enable-rkmpp"

ffmpeg ERROR: rockchip_mpp not found using pkg-config

先注释掉, 后面再打开重新编译, 属于一个 编译先后顺序的问题 , 待优化
BR2_PACKAGE_FFMPEG_EXTRACONF="--enable-version3 --enable-libdrm --enable-rkmpp"

qt5x11extras安装失败

package/libgtk3/Config.in:15:error: recursive dependency detected!

注释了libgtk3的服务编译

然后整个系统重新编译

qt5base编译异常

多线程编译导致的冲突, 再运行异常就行

运行异常

hdmi插拔变蓝屏

eth0 被重命名成了 FE0

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth0", NAME="FE0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth1", NAME="FE1"

删除这个规则


#!/bin/bash

ROOT_DIR="$SDK_DIR/build-$VANXOAK_CUSTOMER_NAME/buildroot_output/rockchip_rk3568_$VANXOAK_CUSTOMER_NAME/target"

cd $ROOT_DIR
rm usr/lib/udev/rules.d/70-persistent-net.rules

exit 0

ubuntu22.04的 用户密码 哈希在新系统用不了

通过搜索mkpasswd了解到,他们的生成逻辑

2024-03-16T18:07:09 /usr/bin/sed -i -e s,^root:[^:]*:,root:"`/home/genvict/rk356x_bsp/build-iot/buildroot_output/rockchip_rk3568_iot/host/bin/mkpasswd -m "sha-256" "rockchip"`":, /home/genvict/rk356x_bsp/build-iot/buildroot_output/rockchip_rk3568_iot/target/etc/shadow

这个命令是使用 sed 工具在文件 /etc/shadow 中替换 root 用户的密码哈希值。

它使用了 mkpasswd 命令生成新的哈希值,然后将其插入到 /etc/shadow 文件中。

这样可以更新 root 用户的密码。

根据命令中的参数 -e s,root:[:]*:,root:“/home/genvict/rk356x_bsp/build-iot/buildroot_output/rockchip_rk3568_iot/host/bin/mkpasswd -m “sha-256” “rockchip””:,可以看出密码是由 mkpasswd 命令生成的,使用 SHA-256 算法,密码参数为 “rockchip”。

调试过程

root@genvict:/home/genvict/rk356x_bsp# /home/genvict/rk356x_bsp/build-iot/buildroot_output/rockchip_rk3568_iot/host/bin/mkpasswd -m "sha-256" "rockchip"
$5$Io6X2mN7E$JPD0hMz4yfaShTVLhdVEUBTbzhh/28Lw91h4HVm.xrB
root@genvict:/home/genvict/rk356x_bsp# /home/genvict/rk356x_bsp/build-iot/buildroot_output/rockchip_rk3568_iot/host/bin/mkpasswd -m "sha-256" "root"
$5$K335JxjbL$RyZFucOlv1Rw93D0NPe6IVFA63JM2xwuP0eeimkh/V.

# 注意他每次运行的结果都不一样

开机加载eth业务

buildroot 编译出来的systemd默认用 /etc/systemd/network/01-ETH0-static.network 这种方式加载网卡信息

[Match]
Name=eth0  # 根据你的实际网卡名称修改

[Network]
Address=192.168.1.100/24  # 设置静态 IP 地址和子网掩码
Gateway=192.168.1.1  # 设置网关地址
DNS=8.8.8.8  # 设置 DNS 服务器地址

如果要支持旧版那种方式 /etc/network/interfaces.d/eth0

需要启用这些服务 , 以及他的一类关联

[Unit]
Description=Raise network interfaces
Documentation=man:interfaces(5)
DefaultDependencies=no
Requires=ifupdown-pre.service
Wants=network.target
After=local-fs.target network-pre.target apparmor.service systemd-sysctl.service systemd-modules-load.service ifupdown-pre.service
Before=network.target shutdown.target network-online.target
Conflicts=shutdown.target

[Install]
WantedBy=multi-user.target
WantedBy=network-online.target

[Service]
Type=oneshot
EnvironmentFile=-/etc/default/networking
ExecStart=/sbin/ifup -a --read-environment
ExecStop=/sbin/ifdown -a --read-environment --exclude=lo
RemainAfterExit=true
TimeoutStartSec=5min

切换Xorg异常 Failed to load /usr/lib/xorg/modules/drivers/modesetting_drv.so: /usr/lib/xorg/modules/drivers/modesetting_drv.so: undefined symbol: glamor_egl_create_textured_pixmap

看依赖是没开GLAMOR_HAS_GBM, 但其实有开,原因不明

最后从原厂debian的deb包里面各种偷龙转凤,根本原因应该是依赖问题

具体是哪个 没仔细找

weston启动异常

参考https://wayland.pages.freedesktop.org/weston/toc/running-weston.html#running-weston-from-a-systemd-service

weston
Date: 2024-03-29 CST
[14:46:37.241] weston 11.0.1
               https://wayland.freedesktop.org
               Bug reports to: https://gitlab.freedesktop.org/wayland/weston/issues/
               Build: 11.0.1
[14:46:37.242] Command line: weston
[14:46:37.242] OS: Linux, 4.19.232, #2 SMP Sat Mar 16 18:54:51 CST 2024, aarch64
[14:46:37.242] Flight recorder: enabled
[14:46:37.242] warning: XDG_RUNTIME_DIR "/var/run" is not configured
correctly.  Unix access mode must be 0700 (current mode is 0755),
and must be owned by the user UID 0 (current owner is UID 0).
Refer to your distribution on how to get it, or
http://www.freedesktop.org/wiki/Specifications/basedir-spec
on how to implement it.
/etc/xdg/weston/weston.ini.d/02-desktop.ini: "shell/background-image" from "/usr/share/weston/pattern.png" to "/usr/share/backgrounds/background_linux.jpg"
/etc/xdg/weston/weston.ini.d/02-desktop.ini: "shell/background-type" from "tile" to "scale"
/etc/xdg/weston/weston.ini.d/02-desktop.ini: "shell/panel-position" from "top" to "bottom"
[14:46:37.245] Using config file '/etc/xdg/weston/weston.ini'
[14:46:37.246] Output repaint window is 7 ms maximum.
[14:46:37.248] Loading module '/usr/lib/libweston-11/drm-backend.so'
[14:46:37.261] initializing drm backend
[14:46:37.261] Entering mirror mode.
[14:46:37.261] Trying logind launcher...
[14:46:37.262] logind: cannot find systemd session for uid: 0 -61
[14:46:37.262] logind: cannot setup systemd-logind helper error: (No data available), using legacy fallback
[14:46:37.262] fatal: your system should either provide the logind D-Bus API, or use seatd.
[14:46:37.262] fatal: failed to create compositor backend
Internal warning: debug scope 'drm-backend' has not been destroyed.

ffplay运行异常Could not initialize SDL - x11 not available

SDL库没支持X11

需要先删除 sdl ffmpeg相关的编译再重新编译

BR2_PACKAGE_FFMPEG_FFMPEG=y
BR2_PACKAGE_FFMPEG_GPL=y
BR2_PACKAGE_FFMPEG_NONFREE=y
BR2_PACKAGE_FFMPEG_FFPLAY=y
BR2_PACKAGE_FFMPEG_FFPROBE=y
BR2_PACKAGE_FFMPEG_XCBGRAB=y
BR2_PACKAGE_FFMPEG_AVRESAMPLE=y
BR2_PACKAGE_FFMPEG_POSTPROC=y
BR2_PACKAGE_SDL2_X11=y
BR2_PACKAGE_SDL2_KMSDRM=y
BR2_PACKAGE_SDL2_OPENGLES=y
BR2_PACKAGE_SDL2_GFX=y
BR2_PACKAGE_SDL2_IMAGE=y
BR2_PACKAGE_SDL2_MIXER=y
BR2_PACKAGE_SDL2_NET=y
BR2_PACKAGE_SDL2_TTF=y

PulseAudio 运行异常

systemctl stop pulseaudio
  1. 然后,创建所需的 cookie 文件。你可以使用 touch 命令来创建空的文件,如果文件已经存在,touch 命令不会做任何事情:
touch /var/run/pulse/.config/pulse/cookie
touch /var/run/pulse/.pulse-cookie
  1. 确保 PulseAudio 有足够的权限来访问这些文件。你可以使用 chown 命令来改变文件的所有者,假设你的 PulseAudio 服务以 ‘pulse’ 用户运行:
chown pulse:pulse /var/run/pulse/.config/pulse/cookie
chown pulse:pulse /var/run/pulse/.pulse-cookie
  1. 最后,重新启动 PulseAudio 服务:
systemctl start pulseaudio

amixer 运行异常

ALSA lib pulse.c:242:(pulse_connect) PulseAudio: Unable to connect: Access denied

amixer: Mixer attach default error: Connection refused

确保 PulseAudio 服务正在运行

在命令行中输入 pulseaudio --check,如果没有返回任何东西,那就表示 PulseAudio 服务正在运行。
如果返回错误信息,那就代表 PulseAudio 服务没有运行,你可以尝试使用 pulseaudio --start 命令启动它。

检查用户是否有权限访问 PulseAudio

在命令行中输入 groups 查看当前用户所在的用户组。如果列表中没有 pulse-access 或 audio,那就表示当前用户没有访问 PulseAudio 的权限。
你可以使用 usermod -aG pulse-access your_username 或 usermod -aG audio your_username 命令把用户添加到这些组。

如果以上方法都不行,你可以尝试使用 ALSA 而不是 PulseAudio。

webengine是否支持webrtc

测试方案

用程序访问https://zegodev.github.io/webrtcDemo-js/webrtccheck/index.html#

点击测试

程序源码

需要针对自己的文件路径做调整

TEMPLATE = app
QT = core gui
SOURCES = main.cpp

QT += widgets 
QT += webengine 
QT += webenginewidgets
INCLUDEPATH += /home/genvict/rk356x_bsp/build-iot/buildroot_output/rockchip_rk3568_iot/host/aarch64-buildroot-linux-gnu/sysroot/usr/include/qt5/QtWebEngineWidgets
#include <QApplication>
#include <QWebEngineView>
#include <QWebEngineProfile>
#include <QWebEnginePage>
#include <QWebEngineSettings>

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QWebEngineView* view = new QWebEngineView();
    QWebEngineProfile* profile = new QWebEngineProfile(view);
    QWebEnginePage* page = new QWebEnginePage(profile, view);

    QObject::connect(profile, &QWebEngineProfile::downloadRequested, [](QWebEngineDownloadItem* download) {
        download->accept();
    });

    QObject::connect(page, &QWebEnginePage::featurePermissionRequested, [page](const QUrl &securityOrigin, QWebEnginePage::Feature feature) {
        if (feature == QWebEnginePage::MediaAudioCapture ||
            feature == QWebEnginePage::MediaVideoCapture) {
            page->setFeaturePermission(securityOrigin, feature, QWebEnginePage::PermissionGrantedByUser);
        }
    });


    QWebEngineSettings::globalSettings()->setAttribute(QWebEngineSettings::JavascriptEnabled, true);

    view->setPage(page);

    QString url = "https://zegodev.github.io/webrtcDemo-js/webrtccheck/index.html#";
    if (argc > 1) {
         if (QString(argv[1]) != "--no-sandbox") {
            url = argv[1];
        }
    }

    view->load(QUrl(url));
    QObject::connect(view, &QWebEngineView::loadFinished, [view](bool ok) {
        if (ok) {
            view->show();
        } else {
            // Handle the error
        }
    });

    return app.exec();
}

#!/bin/bash

source  /home/genvict/rk356x_bsp/build-iot/buildroot_output/rockchip_rk3568_iot/host/environment-setup 

qmake


make


解决方法

hdmi 原生接口空载上电无显示, 默认激活

enum drm_connector_status dw_hdmi_phy_read_hpd(struct dw_hdmi *hdmi,
					       void *data)
{
	//修改为默认连接状态
	return connector_status_connected;

	return hdmi_readb(hdmi, HDMI_PHY_STAT0) & HDMI_PHY_HPD ?
		connector_status_connected : connector_status_disconnected;
}

系统默认功放被USB摄像头插入后替换

固定rockchiprk809co为默认声卡

#!/bin/bash

# 使用 awk 从 /proc/asound/rockchiprk809co/pcm0p/info 文件中获取 id
id=$(cat /proc/asound/rockchiprk809co/pcm0p/info | awk 'NR==1 {print $2}')

# 将 id 写入 /etc/asound.conf 文件
echo "defaults.ctl.card $id" > /etc/asound.conf
echo "defaults.pcm.card $id" >> /etc/asound.conf
echo "defaults.timer.card $id" >> /etc/asound.conf

amixer cset name='Playback Path' SPK_HP

ldconfig not find

config BR2_PACKAGE_GLIBC_UTILS
	bool "Install glibc utilities"
	help
	  Enabling this option will compile and install the getconf,
	  ldconfig, ldd and locale glibc utilities for the target.

Systemd 系统环境变量加载

#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See systemd-system.conf(5) for details.

[Manager]
#LogLevel=info
#LogTarget=journal-or-kmsg
#LogColor=yes
#LogLocation=no
#DumpCore=yes
#ShowStatus=yes
#CrashChangeVT=no
#CrashShell=no
#CrashReboot=no
#CtrlAltDelBurstAction=reboot-force
#CPUAffinity=1 2
#NUMAPolicy=default
#NUMAMask=
#RuntimeWatchdogSec=0
#RebootWatchdogSec=10min
#ShutdownWatchdogSec=10min
#KExecWatchdogSec=0
#WatchdogDevice=
#CapabilityBoundingSet=
#NoNewPrivileges=no
#SystemCallArchitectures=
#TimerSlackNSec=
#StatusUnitFormat=description
#DefaultTimerAccuracySec=1min
#DefaultStandardOutput=journal
#DefaultStandardError=inherit
#DefaultTimeoutStartSec=90s
DefaultTimeoutStopSec=5s
#DefaultTimeoutAbortSec=
#DefaultRestartSec=100ms
#DefaultStartLimitIntervalSec=10s
#DefaultStartLimitBurst=5
#DefaultEnvironment=
#DefaultCPUAccounting=no
#DefaultIOAccounting=no
#DefaultIPAccounting=no
#DefaultBlockIOAccounting=no
#DefaultMemoryAccounting=yes
#DefaultTasksAccounting=yes
#DefaultTasksMax=
#DefaultLimitCPU=
#DefaultLimitFSIZE=
#DefaultLimitDATA=
#DefaultLimitSTACK=
#DefaultLimitCORE=
#DefaultLimitRSS=
#DefaultLimitNOFILE=1024:524288
#DefaultLimitAS=
#DefaultLimitNPROC=
#DefaultLimitMEMLOCK=
#DefaultLimitLOCKS=
#DefaultLimitSIGPENDING=
#DefaultLimitMSGQUEUE=
#DefaultLimitNICE=
#DefaultLimitRTPRIO=
#DefaultLimitRTTIME=

DefaultEnvironment=DISPLAY=:0 QT_QPA_PLATFORM=xcb QT_QPA_PLATFORM_PLUGIN_PATH=/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms QT_QPA_FONTDIR=/usr/share/fonts QML2_IMPORT_PATH=/usr/lib/aarch64-linux-gnu/qt5/qml QTWEBENGINEPROCESS_PATH=/usr/lib/aarch64-linux-gnu/qt5/libexec/QtWebEngineProcess

journal日志切割

#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See journald.conf(5) for details.

[Journal]
Storage=auto
Compress=yes
Seal=yes
#SplitMode=uid
SyncIntervalSec=1m
#RateLimitIntervalSec=30s
#RateLimitBurst=10000
SystemMaxUse=250M
#SystemKeepFree=
SystemMaxFileSize=50M
#SystemMaxFiles=100
#RuntimeMaxUse=
#RuntimeKeepFree=
#RuntimeMaxFileSize=
#RuntimeMaxFiles=100
#MaxRetentionSec=
#MaxFileSec=1month
#ForwardToSyslog=yes
#ForwardToKMsg=no
#ForwardToConsole=no
#ForwardToWall=yes
#TTYPath=/dev/console
#MaxLevelStore=debug
#MaxLevelSyslog=debug
#MaxLevelKMsg=notice
#MaxLevelConsole=info
#MaxLevelWall=emerg
#LineMax=48K
#ReadKMsg=yes

用户环境变量加载

export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/genvict/bin"
export LD_LIBRARY_PATH="/usr/local/lib"

export DISPLAY=:0

export QT_QPA_PLATFORM=xcb
export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/lib/qt/plugins/platforms
export QT_QPA_FONTDIR=/usr/share/fonts
export QML2_IMPORT_PATH=/usr/qml
export QTWEBENGINEPROCESS_PATH=/usr/libexec/QtWebEngineProcess

libqxcb库缺失

qt5x11extras 没有编译出来

aplay -l 没有rockchiprk809co声卡

**** List of PLAYBACK Hardware Devices ****

card 0: rockchiphdmi [rockchip,hdmi], device 0: rockchip,hdmi i2s-hifi-0 [rockchip,hdmi i2s-hifi-0]

Subdevices: 1/1

Subdevice #0: subdevice #0

内核dts没开

修改分区表后系统死机

TIME ] Timed out waiting for device /dev/disk/by-partlabel/oem.

[DEPEND] Dependency failed for /oem.

[DEPEND] Dependency failed for File…on /dev/disk/by-partlabel/oem.

[ TIME ] Timed out waiting for device ▒▒ev/disk/by-partlabel/userdata.

[DEPEND] Dependency failed for File…ev/disk/by-partlabel/userdata.

[DEPEND] Dependency failed for /userdata.

去/etc/fstab 去掉 oem 和 userdata

system开机加载,他们发现缺失所以卡顿了

  • 5
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

交叉编译之王 hahaha

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值