Difference between revisions of "APITestPage"

From FriendlyELEC WiKi
Jump to: navigation, search
(updated by API)
(烧写系统到eMMC)
Line 1: Line 1:
====烧写系统到eMMC====
+
==Debian10 桌面系统的使用==
=====方法1: 在网页上烧写=====
+
===Debian10桌面系统简介===
使用刷写了FriendlyWrt固件的TF卡启动{{{1}}}, 登录FriendlyWrt页面, 在网页菜单上点击 "系统" -> "eMMC刷机助手" 进入eMMC刷机助手界面, 点击界面上的 "选择文件" 按钮, 选择你要刷写的文件 (官方固件以rk3399-sd开头), 亦可选择第三方固件, 文件支持 .gz 格式的压缩文件, 或者以 .img 作为扩展名的raw格式。<br/><br/>
+
{{DebianBusterDesktop-Intro/zh|NanoPi-R6S}}
选择文件后, 点击 “上传并烧写” 按钮, 开始上传并烧写, 如下图所示:<br/>
+
{{DebianBusterDesktop-Common/zh|NanoPi-R6S}}
[[File:Friendlywrt-emmctools2-cn.png|frameless|600px]]<br/>
+
{{DebianBusterDesktop-WithHDMI/zh|NanoPi-R6S}}
烧写完成后,请弹出SD卡,设备会自动重启, 并从eMMC引导新系统,可留意指示灯的状态, 在系统状态灯闪烁,同时网卡状态灯亮起时,表示系统启动完成, 如果eMMC安装的系统是 FriendlyWrt, 则可以通过点击“进入首页”进入FriendlyWrt管理页面。<br />
+
{{OfficialUbuntuCore/zh|NanoPi-R6S}}
需要注意的是, 如果烧写的是FriendlyElec的固件, 网页烧写需要选用文件名带 "-sd-" 字样的镜像文件, 类拟如下的文件名:
+
==Work with Debian10 Desktop==
{| class="wikitable"
+
===Introduction to Debian10 Desktop===
|-
+
{{DebianBusterDesktop-Intro|NanoPi-R6S}}
  | rk3399-sd-friendlywrt-21.02-YYYYMMDD.img.gz
+
{{DebianBusterDesktop-Common|NanoPi-R6S}}
|-
+
{{DebianBusterDesktop-WithHDMI|NanoPi-R6S}}
  | rk3399-sd-friendlywrt-21.02-docker-YYYYMMDD.img.gz
+
{{OfficialUbuntuCore|NanoPi-R6S}}
|}
+
第三方固件由于命名不规则,你需要确认的是:此固件是支持从eMMC启动的,如果文件格式是7z、zip或者rar格式, 需要先解压缩, 如果文件太大无法写入, 可以先压缩成 .gz 格式再尝试。
+
 
+
=====方法2: 用TF启动卡进行自动烧写=====
+
======烧写系统固件到eMMC======
+
* 此方法是通过SD卡启动一个小型的Linux系统, 然后自动运行一个名为EFlasher的工具来将固件烧写到eMMC中。<br />
+
* 通过LED灯来掌握烧写进度。<br />
+
<br />
+
访问[http://download.friendlyelec.com/{{#replace:{{#replace:{{BASEPAGENAME}}| |}}|/zh|}} 此处的下载地址]下载需要的固件文件(位于"01_系统固件/02_SD卡刷机固件(SD-to-eMMC)"目录)和烧写工具(位于"05_工具软件"目录):<br />
+
{| class="wikitable"
+
|-
+
  | colspan=2 | '''固件文件'''
+
|-
+
  | rk3399-eflasher-friendlywrt-21.02-YYYYMMDD.img.gz
+
  | [[How to Build FriendlyWrt|FriendlyWrt]]系统固件,基于OpenWrt 21.02.3构建,内核版本 5.15.y
+
|-
+
  | rk3399-eflasher-friendlywrt-21.02-docker-YYYYMMDD.img.gz
+
  | 预装了Docker的[[How to Build FriendlyWrt|FriendlyWrt]]系统固件,基于OpenWrt 21.02.3构建,内核版本 5.15.y
+
|-
+
  | rk3399-eflasher-debian-buster-desktop-4.19-arm64-20220725.img.gz
+
  | Debian10系统固件,内核版本 4.19.y
+
|-
+
  | rk3399-eflasher-friendlycore-lite-focal-5.15-arm64-YYYYMMDD.img.gz
+
  | 精简版64位FriendlyCore系统固件,基于Ubuntu core 20.04构建,内核版本 5.15.y
+
|-
+
  | colspan=2 | '''Flash Utility:'''
+
|-
+
  | win32diskimager.rar
+
  | Windows utility. Under Linux users can use "dd"
+
|}
+
详细操作步骤如下:<br />
+
* 准备一张8G或以上容量的SDHC卡;
+
* 下载并解压 固件文件rk3399-eflasher-OSNAME-YYYYMMDD.img.gz 和 工具win32diskimager;
+
* 在Windows下以管理员身份运行 win32diskimager,在界面上选择你的SD卡盘符,选择解压后的[[EFlasher/zh|EFlasher]]固件,点击 Write 按钮烧写到SD卡; 或者在 Linux下使用 dd 命令将 rk3399-eflasher-OSNAME-YYYYMMDD.img 写入 SD卡;
+
* 将SD卡从电脑端弹出,插入{{{1}}}的microSD卡槽;
+
* 连接{{{1}}}的电源,系统会从SD卡启动,并自动启动 [[EFlasher/zh|EFlasher]] 烧写工具将系统安装到 eMMC, 可以通过板载 LED 灯来了解安装进度:
+
{| class="wikitable"
+
|-
+
! 进度
+
! SYS灯 (红灯)
+
! LAN灯(绿灯)
+
! WAN灯(绿灯)
+
|-
+
| 上电开机
+
| 长亮
+
| 灭
+
| 灭
+
|-
+
| 系统启动
+
| 慢闪
+
| 灭
+
| 灭
+
|-
+
| 正在烧写
+
| 快闪
+
| 灭
+
| 灭
+
|-
+
| 烧写完成
+
| 慢闪
+
| 长亮
+
| 长亮
+
|}
+
* 烧写完成后,切断电源,然后从{{{1}}}端弹出SD卡,重新上电开机,{{{1}}}会从eMMC启动你刚刚烧写的系统;
+
======烧写flash镜像文件到eMMC======
+
* 自动烧写(默认行为)
+
1) 从[http://download.friendlyelec.com/{{#replace:{{#replace:{{BASEPAGENAME}}| |}}|/zh|}} 网盘]上下载文件名带 '''eflasher''' 字样的任意固件, 解压后烧进TF卡;<br />
+
2) 重新拨插一次TF卡, PC上会出现一个名为FriendlyARM的盘符(Linux下是FriendlyARM目录), 将 .img 或者 .gz结尾的固件复制进去;<br />
+
3) 编辑TF卡上的 eflasher.conf 配置文件, 修改 autoStart= 后面的值指定为你的固件文件名, 例如:<br />
+
<syntaxhighlight lang="bash">
+
autoStart=openwrt-rockchip-armv8_nanopi-ext4-sysupgrade.img.gz
+
</syntaxhighlight>
+
支持文件名带 "-sd-" 字样的镜像文件, 如下所示:
+
{| class="wikitable"
+
|-
+
  | rk3399-sd-friendlywrt-21.02-YYYYMMDD.img.gz
+
|-
+
  | rk3399-sd-friendlywrt-21.02-docker-YYYYMMDD.img.gz
+
|-
+
  | rk3399-sd-friendlywrt-22.03-YYYYMMDD.img.gz
+
|-
+
  | rk3399-sd-friendlywrt-22.03-docker-YYYYMMDD.img.gz
+
|}
+
4) 安全弹出TF卡, 将TF卡放在{{{1}}}上上电启动, 会自动烧写你的固件, 通过板载 LED 灯来了解安装进度;<br />
+
=====方法3: 通过USB烧写=====
+
======步骤1: 安装USB驱动和工具======
+
从[http://download.friendlyelec.com/{{#replace:{{#replace:{{BASEPAGENAME}}| |}}|/zh|}} 网盘]的tools目录下载瑞芯微的USB驱动: DriverAssitant_v5.1.1.zip, 解压后安装; <br />
+
在相同目录下, 下载瑞芯微开发工具: RKDevTool_Release_v2.84.zip, 解压后备用; <br />
+
======步骤2: 将{{{1}}}与电脑连接, 并进入刷机模式======
+
1) 断开{{{1}}}上连接的USB和电源线, 弹出TF卡;<br />
+
2) 按住Mask按键不放, 插上电源, 保持按住Mask键, 状态灯亮起3秒后即可松开;<br />
+
3) 用USB A-to-A数据线 (也叫USB公对公数据线), 将{{{1}}}与电脑进行连接, 连接方法参照下图, 需要连接靠近外侧的USB端口:<br />
+
[[File:Nanopir4se-usba-to-usba.jpg|frameless|400px]]<br />
+
======步骤3: 烧写固件到eMMC======
+
固件格式一般有两种格式, 一种是单个的image文件, 通常第三方固件会使用这种打包方式, 另一种是多个分区镜像, FriendlyELEC的固件采用这种方式, 下面分别对这两种格式的固件进行说明:
+
* 选项1: 烧写打包成单个image文件的固件<br />
+
在电脑上双击 RKDevTool_Release_v2.84 目录下的 RKDevTool.exe 启动瑞芯微开发工具, 与电脑连接正常的情况下, 瑞芯微开发工具界面上会显示 "发现一个Maskrom设备";<br />
+
在瑞芯微开发工具界面上, 点击 “升级固件”, 再点击 “固件” 按钮, 选择你要烧写的image文件, 点击 “升级” 然后等待烧写完成即可, 完成后设备会自动重启, 并从eMMC启动你刚刚安装的系统;<br />
+
* 选项2: 烧写由多个分区镜像组成的固件<br />
+
根据需要到[http://download.friendlyelec.com/{{#replace:{{#replace:{{BASEPAGENAME}}| |}}|/zh|}} 网盘]上下载对应的压缩包, 在电脑上解压:
+
{| class="wikitable"
+
|-
+
  | colspan=2 | '''固件文件'''
+
|-
+
  | rk3399-usb-friendlywrt-21.02-YYYYMMDD.img.gz
+
  | 精简版[[How to Build FriendlyWrt|FriendlyWrt]]系统固件,基于OpenWrt 21.02.3构建,内核版本 5.15.y
+
|-
+
  | rk3399-usb-friendlywrt-21.02-docker-YYYYMMDD.img.gz
+
  | 预装了Docker的[[How to Build FriendlyWrt|FriendlyWrt]]系统固件,基于OpenWrt 21.02.3构建,内核版本 5.15.y
+
|-
+
  | rk3399-usb-debian-buster-desktop-arm64-YYYYMMDD.img.gz
+
  | Debian10 系统固件,内核版本 4.19.y
+
|-
+
  | rk3399-usb-friendlycore-lite-focal-5.10-arm64-YYYYMMDD.img.gz
+
  | 精简版64位FriendlyCore系统固件,基于Ubuntu core 20.04构建,内核版本 5.15.y
+
|}
+
解压后, 可以看到固件目录下已内置了瑞芯微开发工具和预设好的配置文件, 双击 RKDevTool.exe 启动瑞芯微开发工具, 界面上会显示 "发现一个Maskrom设备", 点击界面上的“执行”按钮, 稍等片刻即可完成烧写, 完成后设备会自动重启, 并从eMMC启动你安装的系统;<br />
+

Revision as of 07:12, 8 February 2023

Contents

1 Debian10 桌面系统的使用

1.1 Debian10桌面系统简介

Debian10 Desktop 是一个轻量级的Debian桌面环境,具有如下特点:

  • 桌面环境采用 LXDE, 多种主题可选, 简洁美观, 占用资源少;
  • 提供基于 Mali GPU 的 OpenGL 支持;
  • 支持Rockhip MPP视频硬编和硬解码;
  • 预装基于mpv的Kodi, SMPlayer播放器, 均支持4K视频硬解码;
  • 预装Chromium浏览器, 支持vpu/gpu硬件加速 (视频硬解限h264/mp4格式);
  • 支持安装Plex Server, Docker与wps等应用, 玩法丰富;

Debian10-lxde.png

1.2 帐户与密码

普通用户:
    用户名: pi
    密码: pi

Root用户:
    默认没有设置root密码,可通过sudo passwd root命令配置root密码

1.3 查看IP地址

由于Debian主机名默认为硬件型号, 所以可以使用ping命令来获得IP地址: ping NanoPi-R6S

1.4 通过ssh登录Debian

使用以下命令:ssh pi@NanoPi-R6S
默认密码为pi

1.5 更新软件包

1.5.1 更换软件源为国内镜像源

编辑/etc/apt/sources.list替换成以下内容:

deb http://mirrors.163.com/debian/ buster main non-free contrib
deb http://mirrors.163.com/debian/ buster-updates main non-free contrib
# deb http://mirrors.163.com/debian/ buster-backports main non-free contrib
deb-src http://mirrors.163.com/debian/ buster main non-free contrib
# deb-src http://mirrors.163.com/debian/ buster-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ buster-backports main non-free contrib
deb http://mirrors.163.com/debian-security/ buster/updates main non-free contrib
deb-src http://mirrors.163.com/debian-security/ buster/updates main non-free contrib

1.5.2 更新软件包列表

$ sudo apt-get update

1.6 安装x11vnc远程桌面

x11vnc是一个VNC服务器, 安装后我们可以不依赖外部的显示设备, 通过网络远程登录Debian桌面。

1.6.1 安装x11vnc

sudo apt-get install x11vnc

1.6.2 设置VNC登录密码

sudo x11vnc -storepasswd /etc/x11vnc.pwd

1.6.3 设置x11vnc在开机时自动启动

新建如下文件:

sudo vi /lib/systemd/system/x11vnc.service

内容如下:

[Unit]
Description=Start x11vnc at startup.
Requires=display-manager.service
After=syslog.target network-online.target
Wants=syslog.target network-online.target
 
[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -display :0 -forever -loop -noxdamage -repeat -rfbauth /etc/x11vnc.pwd -rfbport 5900 -shared -capslock -nomodtweak
ExecStop=/usr/bin/x11vnc -R stop
Restart=on-failure
 
[Install]
WantedBy=multi-user.target

设置systemd服务:

sudo systemctl daemon-reload
sudo systemctl enable x11vnc.service
sudo systemctl start x11vnc

1.6.4 测试远程桌面

在电脑上启动VNC客户端软件, 在地址栏输入: IP地址:5900 连接即可, 效果如下图所示, 图中设备IP地址为192.168.1.123, 使用端口5900进行连接:
Debian10-x11vnc.png

1.7 安装内核头文件

sudo dpkg -i /opt/linux-headers-*.deb

测试编译内核模块:

sudo apt update
sudo apt install git gcc make bc
git clone https://github.com/RinCat/RTL88x2BU-Linux-Driver.git
cd RTL88x2BU-Linux-Driver
make -j$(nproc)
sudo make install
sudo modprobe 88x2bu

1.8 更改时区

1.8.1 检查当前时区

timedatectl

1.8.2 列出所有时区

timedatectl list-timezones

1.8.3 设置时区 (比如上海)

sudo timedatectl set-timezone Asia/Shanghai

1.9 更换开机LOGO和桌面墙纸

替换内核下面的两个文件,重新编译内核:
kernel/logo.bmp
kernel/logo_kernel.bmp
或者使用脚本来操作,如下所示:

  • 下载脚本
git clone https://github.com/friendlyarm/sd-fuse_rk3588.git -b kernel-6.1.y --single-branch
cd sd-fuse_rk3588
  • 编译内核并重新打包固件
convert files/logo.jpg -type truecolor /tmp/logo.bmp
convert files/logo.jpg -type truecolor /tmp/logo_kernel.bmp
LOGO=/tmp/logo.bmp KERNEL_LOGO=/tmp/logo_kernel.bmp ./build-kernel.sh debian-buster-desktop-arm64
sudo ./mk-sd-image.sh debian-buster-desktop-arm64
./mk-emmc-image.sh debian-buster-desktop-arm64

注: 如果你的系统不是debian-buster-desktop-arm64,请根据实际情况指定

1.9.2 更换桌面墙纸

修改如下配置文件:

/home/pi/.config/pcmanfm/LXDE/desktop-items-0.conf

1.9.3 恢复出厂设置

在终端上执行如下命令:

sudo firstboot && sudo reboot

1.10 开机自动启动程序(例如Kodi)

把要开机启动的程序的desktop文件放入~/.config/autostart/目录即可,例如:

mkdir ~/.config/autostart/
cp /usr/share/applications/kodi.desktop ~/.config/autostart/

1.11 取消USB存储设备自动挂载

sudo systemctl mask udisks2
sudo reboot

1.12 设置中文语言与输入法

1.12.1 设置中文语言

输入以下命令,用空格选中 'zh_CN.UTF-8'

sudo dpkg-reconfigure locales

添加环境变量到 .bashrc:

echo "export LC_ALL=zh_CN.UTF-8" >> ~/.bashrc
echo "export LANG=zh_CN.UTF-8" >> ~/.bashrc
echo "export LANGUAGE=zh_CN.UTF-8" >> ~/.bashrc

重启确认一下设置是否生效:

sudo reboot

1.12.2 安装中文输入法

输入如下命令安装fcitx和拼音输入法:

sudo apt update
sudo apt-get install fcitx fcitx-pinyin
sudo apt-get install im-config
sudo apt-get install fcitx-table*
sudo apt-get install fcitx-ui-classic fcitx-ui-light
sudo apt-get install fcitx-frontend-gtk2 fcitx-frontend-gtk3 fcitx-frontend-qt4
sudo apt-get remove --purge scim* ibus*
sudo reboot

重启后, 按Ctrl+Space即可切换中英文输入法, 右上角也出现了输入法图标, 右击右上角的输入法图标, 在弹出菜单中可以切换输入法, 如下图所示:
Debian10-chinese-im.png

1.13 安装Plex多媒体服务器

访问 Plex官网的如下地址: https://www.plex.tv/media-server-downloads/
在下载页面上, 选择 ”Plex Media Server” 分类, 平台选择 ”Linux“, 版本选择 "Ubuntu(16.04+)/Debian(8+) - ARMv8",
下载得到deb包后, 使用 dpkg 命令安装软件包即可:

sudo dpkg -i plexmediaserver_1.31.0.6654-02189b09f_arm64.deb

安装完成后, 在电脑浏览器上输入以下地址登录Plex服务器后台: http://IP地址:32400/web/

1.14 在Debian系统上安装Docker

请参考此链接: How to Install Docker on Debian/zh

1.15 设置WiFi无线链接

1.15.1 图形界面操作

点击右上角的网络图标,选择你要连接的WiFi热点,按界面提示操作即可。

1.15.2 命令行操作

请参考 Use NetworkManager to configure network settings/zh

1.16 测试OpenGL ES性能

在系统菜单 System Tools 中点击 Terminator 打开命令行终端,输入以下命令即可测试:

glmark2-es2

1.17 设置HDMI/DP屏幕分辨率

进入系统菜单 Perferences -> Monitor Settings界面进行设置即可。
推荐分辨率:1920x1080@60Hz

1.18 调节HDMI边界

打开命令行终端,输入命令进行操作,有几个注意事项:
1) 需要登录桌面才能操作,如果Desktop停留在Login是无法设置的;
2) 如果你是在 ssh 登录的终端,请使用与桌面登录相同的用户名,默认是 pi,不能使用root用户,同时,你需要赋值 DISPLAY 变量:

export DISPLAY=:0.0

1.18.1 查询显示器支持哪些分辨率

xrandr -q

输出示例:

Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 8192 x 8192
eDP-1 disconnected primary (normal left inverted right x axis y axis)
HDMI-1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
   1920x1080     60.00*+  50.00  
   1280x720      60.00    50.00  
   720x576       50.00  
   720x480       59.94

1.18.2 设置分辨率

例如设置为 1920X1080@60Hz:

xrandr --output HDMI-1 --mode 1920x1080 --refresh 60

1.18.3 设节HDMI输出边界

For example, the transformation scaling horizontal coordinates by 0.8, vertical coordinates by 1.04 and moving the screen by 35 pixels right and 19 pixels down:

xrandr --output HDMI-1 --transform 0.80,0,-35,0,1.04,-19,0,0,1

1.18.4 开机自动调整

编辑~/.config/autostart/lxrandr-autostart.desktop,将完整的xrandr命令写入到Exec=开头的键中,如下所示:

[Desktop Entry]
Type=Application
Name=LXRandR autostart
Comment=Start xrandr with settings done in LXRandR
Exec=sh -c 'xrandr --output HDMI-1 --mode 1920x1080 --refresh 50 --transform 1.04,0,-35,0,1.05,-30,0,0,1'
OnlyShowIn=LXDE

1.19 Chromium网页浏览器

1.19.1 GPU支持情况

系统预装的Chromium网页浏览器已经默认启用硬件加速,支持WebGL,可以通过输入网址 chrome://gpu 了解硬件加速情况,如下图所示:
Rk35xx-debian-chromium-gpu.png

1.19.2 VPU支持情况

在浏览器上播放一个视频,然后在命令行使用fuser查看mpp设备节点的使用情况来确认已经调用了vpu:

pi@FriendlyElec:~$ fuser /dev/mpp_service
/dev/mpp_service:     3258

如果fuser命令没有内容输出, 则表示当前是软解.

1.19.3 查看支持的硬解格式

在浏览器地址栏输入 about://gpu,翻页到页面最底部,查看 "Video Acceleration Information" 表格;
播放一个视频后,再在浏览器地址栏输入 about://media-internals, 可以查看最近播放的视频是否启用了硬解;

2 FriendlyCore的使用

2.1 FriendlyCore默认帐户

  • 普通用户:
   用户名: pi
   密码: pi
  • Root用户:
   用户名: Root用户:
   密码: fa

2.2 更新软件包

$ sudo apt-get update

2.3 配置网络

2.3.1 设置静态IP地址

默认已将 eth0 配置成 dhcp 自动获取IP地址,要更改配置,可以修改这个文件:

vi /etc/network/interfaces.d/eth0

比如修改成静态IP地址,如下所示:

auto eth0
iface eth0 inet static
    address 192.168.1.231
    netmask 255.255.255.0
    gateway 192.168.1.1

另外两个网口设置了静态IP地址, 设置如下:
eth1: 192.168.2.1
eth2: 192.168.3.1 (注:如果有第三个网口的话)

2.3.2 设置DNS

还需要修改如下文件加入DNS的配置:

vi /etc/systemd/resolved.conf

例如设置为192.168.1.1:

[Resolve]
DNS=192.168.1.1

再用以下命令重新启动systemd-resolved服务:

sudo systemctl restart systemd-resolved.service
sudo systemctl enable systemd-resolved.service

2.3.3 设置使用另一个网络接口

要配置另一个网口, 例如eth1,可以在 /etc/network/interfaces.d/ 下复制 eth0 成 eth1,然后编辑eth1, 把其中的eth0改为eth1, 根据需要指定网络配置:

cp /etc/network/interfaces.d/eth0 /etc/network/interfaces.d/eth1
vi /etc/network/interfaces.d/eth1

2.4 连接WiFi

先用以下命令检查一下系统是否有安装Network-Manager:

which nmcli

如果有安装Network-Manager, 则参考此链接的方法连接WiFi: Use NetworkManager to configure network settings/zh, 如果没有安装, 则参考如下方法配置WiFi,
输入以下命令查询一下WiFi的网络接口,wlan开头的就是WiFi:

ifconfig -a

默认情况下是wlan0,在/etc/network/interfaces.d/目录下新建一个与网络接口同名的配置文件 ,以wlan0为例,用vi命令新建以下文件:

sudo vi /etc/network/interfaces.d/wlan0

wlan0文件的内容如下:

auto lo
iface lo inet loopback
auto wlan0
iface wlan0 inet dhcp
wpa-driver wext
wpa-ssid YourWiFiESSID
wpa-ap-scan 1
wpa-proto RSN
wpa-pairwise CCMP
wpa-group CCMP
wpa-key-mgmt WPA-PSK
wpa-psk YourWiFiPassword

其中,YourWiFiESSID和YourWiFiPassword请替换成你要连接的无线AP名称和密码, 保存文件后输入以下命令, 或者重启以应用配置:

sudo systemctl daemon-reload
sudo systemctl restart networking

需要注意的是,如果你的SD卡在多个硬件上运行,WiFi的网络接口可能会被重命名为wlan1, wlan2等,你可以通过清空这个文件的内容并重启让它恢复为默认值:/etc/udev/rules.d/70-persistent-net.rules。

2.4.1 重点支持的WIFI型号

2.4.1.1 M.2 WiFi Module
  • RTL8822CE
2.4.1.2 Usb Dongle
  • RTL8821CU (Vid: 0BDA, Pid: C811) (测试样品:TP-Link TL-WDN5200H)
  • RTL8812AU (Vid: 0BDA, Pid: 8812)
  • MediaTek MT7662 (Vid: 0E8D, Pid: 7612) (测试样品:COMFAST CF-WU782AC V2)

2.5 安装内核头文件

sudo dpkg -i /opt/linux-headers-*.deb

2.6 配置状态灯

先确定一下系统是否已经存在leds初始化的服务:

sudo systemctl status leds

如果已经存在leds服务, 则通过编辑如下文件改变状态灯的默认行为:

/etc/init.d/leds.sh

早期的固件由于没有leds服务, 需要参考以下指南手动配置状态灯, 首先, 设置开机自动加载以下内核模块:

modprobe ledtrig-netdev
echo ledtrig-netdev > /etc/modules-load.d/ledtrig-netdev.conf

下面的脚本代码将状态灯与网卡相关联, 需要加入到开机自动运行的脚本中:

echo netdev > /sys/class/leds/wan_led/trigger
echo eth0 > /sys/class/leds/wan_led/device_name
echo 1 > /sys/class/leds/wan_led/link
 
echo netdev > /sys/class/leds/lan1_led/trigger
echo eth1 > /sys/class/leds/lan1_led/device_name
echo 1 > /sys/class/leds/lan1_led/link
 
echo netdev > /sys/class/leds/lan2_led/trigger
echo eth2 > /sys/class/leds/lan2_led/device_name
echo 1 > /sys/class/leds/lan2_led/link

3 Work with Debian10 Desktop

3.1 Introduction to Debian10 Desktop

Debian10 Desktop is a light-weighted debian desktop system,it has the following features:

  • Uses LXDE as default desktop;
  • Mali GPU-based OpenGL support;
  • Support Rockhip MPP video hard coding and hard decoding;
  • Pre-installed mpv and smplayer, both support 4K video hardware decoding;
  • Pre-installed Chromium browser, support vpu/gpu hardware acceleration (video hard decoding limited to h264/mp4 format);
  • Compatible with Plex Server and Docker;

Debian10-lxde.png

3.2 Account & Password

Regular Account:
    User Name: pi
    Password: pi

Root:
    the root user account is disabled by default, you may configure the root password through the 'sudo passwd root' command.

3.3 View IP address

Since the Debian Buster hostname is the hardware model by default, you can use the ping command to get the IP address:ping NanoPi-R6S

3.4 Connect to Debian via SSH

Run the following commandssh pi@NanoPi-R6S
The default password is: pi

3.5 Update Software Packages

$ sudo apt-get update

3.6 Install x11vnc Server on Debian for Remote Access

3.6.1 Install x11vnc server

The following command to install x11vnc server:

sudo apt-get install x11vnc

3.6.2 Set your password

sudo x11vnc -storepasswd /etc/x11vnc.pwd

3.6.3 Setup x11vnc server with systemd auto start up

Create service configuration file:

sudo vi /lib/systemd/system/x11vnc.service

Let’s copy and paste the following configuration into our newly create service file:

[Unit]
Description=Start x11vnc at startup.
Requires=display-manager.service
After=syslog.target network-online.target
Wants=syslog.target network-online.target
 
[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -display :0 -forever -loop -noxdamage -repeat -rfbauth /etc/x11vnc.pwd -rfbport 5900 -shared -capslock -nomodtweak
ExecStop=/usr/bin/x11vnc -R stop
Restart=on-failure
 
[Install]
WantedBy=multi-user.target

The following commands to reload the systmd system and to enable and start the x11vnc service:

sudo systemctl daemon-reload
sudo systemctl enable x11vnc.service
sudo systemctl start x11vnc

3.6.4 Testing remote access

Start the VNC client software, input IP:5900 to connect:
Debian10-x11vnc.png

3.7 Install the kernel-header package

sudo dpkg -i /opt/linux-headers-*.deb

try to compile a kernel module:

sudo apt update
sudo apt install git gcc make bc
git clone https://github.com/RinCat/RTL88x2BU-Linux-Driver.git
cd RTL88x2BU-Linux-Driver
make -j$(nproc)
sudo make install
sudo modprobe 88x2bu

3.8 Change time zone

3.8.1 Check the current time zone

timedatectl

3.8.2 List all available time zones

timedatectl list-timezones

3.8.3 Set the time zone (e.g. Shanghai)

sudo timedatectl set-timezone Asia/Shanghai

3.9 Change startup LOGO and Wallpaper

Replace the following two files in the kernel source code directory and recompile the kernel:
kernel/logo.bmp
kernel/logo_kernel.bmp
Or use the script to operate, as shown below:

  • Download scripts:
git clone https://github.com/friendlyarm/sd-fuse_rk3588.git -b kernel-6.1.y --single-branch
cd sd-fuse_rk3588
  • Compile kernel and repackage firmware
convert files/logo.jpg -type truecolor /tmp/logo.bmp
convert files/logo.jpg -type truecolor /tmp/logo_kernel.bmp
LOGO=/tmp/logo.bmp KERNEL_LOGO=/tmp/logo_kernel.bmp ./build-kernel.sh debian-buster-desktop-arm64
sudo ./mk-sd-image.sh debian-buster-desktop-arm64
./mk-emmc-image.sh debian-buster-desktop-arm64

Note: If your system is not debian-buster-desktop-arm64, please specify according to the actual situation

3.9.2 Change Wallpaper

Modify the following configuration file:

/home/pi/.config/pcmanfm/LXDE/desktop-items-0.conf

3.10 Soft Factory Reset

Execute the following command in a terminal:

sudo firstboot && sudo reboot

3.11 Start the program automatically at startup(For example Kodi)

Put the desktop file in the ~/.config/autostart/ directory, for example:

mkdir ~/.config/autostart/
cp /usr/share/applications/kodi.desktop ~/.config/autostart/

3.12 Disable auto-mounting

sudo systemctl mask udisks2
sudo reboot

3.13 Setup Chinese language and Input method

3.13.1 Setup Chinese language

Enter the following command and select 'zh_CN.UTF-8':

sudo dpkg-reconfigure locales

Add environment variables to .bashrc:

echo "export LC_ALL=zh_CN.UTF-8" >> ~/.bashrc
echo "export LANG=zh_CN.UTF-8" >> ~/.bashrc
echo "export LANGUAGE=zh_CN.UTF-8" >> ~/.bashrc

Reboot device:

sudo reboot

3.13.2 Installing Chinese input method

Enter the following command to install fcitx and Pinyin input method:

sudo apt update
sudo apt-get install fcitx fcitx-pinyin
sudo apt-get install im-config
sudo apt-get install fcitx-table*
sudo apt-get install fcitx-ui-classic fcitx-ui-light
sudo apt-get install fcitx-frontend-gtk2 fcitx-frontend-gtk3 fcitx-frontend-qt4
sudo apt-get remove --purge scim* ibus*
sudo reboot

After reboot, press Ctrl+Space to switch between Chinese and English input methods, and the input method icon will appear in the upper right corner, right-click the input method icon in the upper right corner to switch input methods in the pop-up menu, as shown below:
Debian10-chinese-im.png

3.14 Installing Plex Multimedia Server

Visit the Plex website: https://www.plex.tv/media-server-downloads/
On the download page, select the category "Plex Media Server", choose "Linux" for the platform and "Ubuntu(16.04+)/Debian(8+) - ARMv8" for the version,
After downloading the deb package, use the dpkg command to install the package:

sudo dpkg -i plexmediaserver_1.31.0.6654-02189b09f_arm64.deb

After installation, login to the Plex server by typing the following URL into your computer browser: http://IP地址:32400/web/

3.15 Install Docker on Debian

Please refer to: How to Install Docker on Debian

3.16 WiFi Connection

3.16.1 Gui

Click on the icon on the top right in the Debian's main window, select your wanted WiFi hotspot and proceed with prompts

3.16.2 Console

Please visit: Use NetworkManager to configure network settings

3.17 Test OpenGL ES

You can test it by clicking on the Terminator icon to start a commandline utility in the System Tools and run the following commands:

glmark2-es2

3.18 HDMI/DP LCD Resolution

Open the system's menu and go to Perferences -> Monitor Settings to customize your settings.
Recommended resolution: 1920x1080@60Hz

3.19 Adjust HDMI overscan

Open the command line terminal and enter the command to operate, Note:
1) You need to login to the desktop;
2) If you are using ssh terminal, please use the same username as the desktop login. The default is pi. You cannot use the root user. you also need to assign the DISPLAY variable:

export DISPLAY=:0.0

3.19.1 Query which resolutions the display supports

xrandr -q

3.19.2 Set resolution

For example set to 1920X1080@60Hz:

xrandr --output HDMI-1 --mode 1920x1080 --refresh 60

3.19.3 Adjust the HDMI overscan

For example, the transformation scaling horizontal coordinates by 0.8, vertical coordinates by 1.04 and moving the screen by 35 pixels right and 19 pixels down:

xrandr --output HDMI-1 --transform 0.80,0,-35,0,1.04,-19,0,0,1

3.19.4 Automatic adjustment at boot

Edit ~/.config/autostart/lxrandr-autostart.desktop,Write the full xrandr command to the key at the beginning of "Exec= as shown below:

[Desktop Entry]
Type=Application
Name=LXRandR autostart
Comment=Start xrandr with settings done in LXRandR
Exec=sh -c 'xrandr --output HDMI-1 --mode 1920x1080 --refresh 50 --transform 1.04,0,-35,0,1.05,-30,0,0,1'
OnlyShowIn=LXDE

3.20 Chromium web browser

3.20.1 GPU

Chromium web browser has enabled hardware acceleration by default, supports WebGL, and can view hardware acceleration details by entering the URL chrome://gpu, as shown below:
Rk35xx-debian-chromium-gpu.png

3.20.2 VPU

Play a video in the browser, then use fuser on the command line to view the mpp device node to confirm that the vpu interface is being called:

pi@FriendlyElec:~$ fuser /dev/mpp_service
/dev/mpp_service:     3258

If there is no content output from the fuser command, it means software decoding.

3.20.3 Check Supported Hardware Decoding Formats

Enter about://gpu in your browser's address bar and scroll to the bottom of the page to view the "Video Acceleration Information" table.
After playing a video, enter about://media-internals in your browser's address bar to check if hardware decoding was enabled for the most recent playback.

4 Work with FriendlyCore

4.1 FriendlyCore User Account

  • Non-root User:
   User Name: pi
   Password: pi
  • Root:
   User Name: root
   Password: fa

4.2 Update Software Packages

$ sudo apt-get update

4.3 Setup Network Configurations

4.3.1 Set static IP address

By default "eth0" is assigned an IP address obtained via dhcp. If you want to change the setting you need to change the following file:

vi /etc/network/interfaces.d/eth0

For example if you want to assign a static IP to it you can run the following commands:

auto eth0
iface eth0 inet static
    address 192.168.1.231
    netmask 255.255.255.0
    gateway 192.168.1.1

The other two ethernet ports are set up with static IP addresses, as follows:
eth1: 192.168.2.1
eth2: 192.168.3.1 (Note: if there are three network ports)

4.3.2 Set a DNS

You also need to modify the following file to add the DNS configuration:

vi /etc/systemd/resolved.conf

For example, set to 192.168.1.1:

[Resolve]
DNS=192.168.1.1

Restart the systemd-resolved service with the following command:

sudo systemctl restart systemd-resolved.service
sudo systemctl enable systemd-resolved.service

4.3.3 Set up to use another network interface

To change the setting of "eth1" you can add a new file similar to eth0's configuration file under the /etc/network/interfaces.d/ directory.

4.4 Setup Wi-Fi

First, use the following command to check if Network-Manager is installed on your system:

which nmcli

If you have installed it, refer to this link to connect to WiFi: Use NetworkManager to configure network settings, If you do not have Network-Manager installed on your system, please refer to the following method to configure WiFi,
By default the WiFi device is "wlan0". You need to create a configuration file under "/etc/network/interfaces.d/" for WiFi:

vi /etc/network/interfaces.d/wlan0

Here is a sample wlan0 file:

auto lo
iface lo inet loopback
auto wlan0
iface wlan0 inet dhcp
wpa-driver wext
wpa-ssid YourWiFiESSID
wpa-ap-scan 1
wpa-proto RSN
wpa-pairwise CCMP
wpa-group CCMP
wpa-key-mgmt WPA-PSK
wpa-psk YourWiFiPassword

Please replace "YourWiFiESSID" and "YourWiFiPassword" with your WiFiESSID and password. After save and close the file you can connect to your WiFi source by running the following command:

sudo systemctl daemon-reload
sudo systemctl restart networking

After you power on your board it will automatically connect to your WiFi source.
Please note that if you use one TF card to boot multiple boards the WiFi device name will likely be named to "wlan1", "wlan2" and etc. You can reset it to "wlan0" by deleting the contents of the following file and reboot your board: /etc/udev/rules.d/70-persistent-net.rules

4.4.1 WiFi models supported

4.4.1.1 M.2 WiFi Module
  • RTL8822CE
4.4.1.2 Usb Dongle
  • RTL8821CU (Vid: 0BDA, Pid: C811) (Test sample:TP-Link TL-WDN5200H)
  • RTL8812AU (Vid: 0BDA, Pid: 8812)
  • MediaTek MT7662 (Vid: 0E8D, Pid: 7612) (Test sample:COMFAST CF-WU782AC V2)

4.5 Install the kernel-header package

sudo dpkg -i /opt/linux-headers-*.deb

4.6 Config status LEDs

First determine whether the system already exists the leds initialization service:

sudo systemctl status leds

If the leds service already exists, change the default behavior of the LEDs by editing the following file:

/etc/init.d/leds.sh

Since there is no leds service in the early firmware, you need to refer to the following guide to manually configure the LEDs. First, set the following kernel modules to be automatically loaded at boot:

modprobe ledtrig-netdev
echo ledtrig-netdev > /etc/modules-load.d/ledtrig-netdev.conf

Put the following into the autorun script to associate the status leds with the ethernet interface, and you can configure it to behave in other ways by referring to these content:

echo netdev > /sys/class/leds/wan_led/trigger
echo eth0 > /sys/class/leds/wan_led/device_name
echo 1 > /sys/class/leds/wan_led/link
 
echo netdev > /sys/class/leds/lan1_led/trigger
echo eth1 > /sys/class/leds/lan1_led/device_name
echo 1 > /sys/class/leds/lan1_led/link
 
echo netdev > /sys/class/leds/lan2_led/trigger
echo eth2 > /sys/class/leds/lan2_led/device_name
echo 1 > /sys/class/leds/lan2_led/link