NotePublic/Ecology/FireFly/ROC-RK3566-PC/ROC-RK3566-PC_简要说明.md

244 lines
6.1 KiB
Markdown
Raw Permalink Normal View History

# ROC-RK3566-PC 简要说明
## 1. 常用连接
1. [产品说明](https://www.t-firefly.com/product/industry/rocrk3566pc.html?theme=pc)
2. [购买链接](https://item.taobao.com/item.htm?ft=t&id=645236303484)
3. [资源下载](https://www.t-firefly.com/doc/download/106.html)
4. [Linux SDK 提取码1234](https://www.t-firefly.com/doc/download/106.html#other_447)
5. [Firefly Linux 开发指南](https://wiki.t-firefly.com/zh_CN/Firefly-Linux-Guide/index.html)
6. [Firefly Linux Buildroot 开发](https://wiki.t-firefly.com/zh_CN/Firefly-Linux-Guide/manual_buildroot.html#buildroot-kai-fa)
## 2. 镜像烧录
### 2.1. Loader 模式
一种方式是断开 Type-C 数据线
1. 按住设备上的 RECOVERY (恢复)键(靠近耳机处)并保持。
2. 连接 Type-C 数据线(电源)
3. 大约两秒钟后,松开 RECOVERY 键。
另一种方式是接上 Type-C 数据线
1. 按住设备上的 RECOVERY (恢复)键并保持。
2. 短按一下 RESET复位键。
3. 大约两秒钟后,松开 RECOVERY 键。
然后使用 RKDevTool 进行烧录。
### 2.2. MaskRom 模式
操作步骤如下:
1. 设备断开 Type-C 数据线(电源)
2. 按住 设备上的 Maskrom 按键 。
3. 设备插入Type-C 数据线(电源)。
4. 稍候片刻,之后松开按键。
然后使用 RKDevTool 进行烧录。
板子同时贴有 NOR Flash若 EMMC 为空,而 NOR Flash 中有烧录过文件,则需要短接 NOR Flash 附近的 D0 和 GND 测试点进入 Maskrom 模式,下图为短接点。此时升级固件需要参考章节[《切换升级存储器》](https://wiki.t-firefly.com/zh_CN/ROC-RK3566-PC/03-upgrade_firmware_with_flash.html)
![MaskRom 短接点](./img/ROC-RK3566-PC_简要说明/maskrom_test_points_flash.jpg)
## 3. 调试串口
连接方式如图:
![调试串口连接](./img/ROC-RK3566-PC_简要说明/debug_connection.jpg)
参数:
- 波特率1500000
- 数据位8
- 停止位1
- 奇偶校验:无
- 流控:无
## 4. SDK
推荐在 Ubuntu 18.04 系统环境下进行开发,若使用其它系统版本,可能需要对编译环境做相应调整。
安装依赖工具:
```bash
sudo apt-get install repo git ssh make gcc libssl-dev liblz4-tool p7zip-full \
expect g++ patchelf chrpath gawk texinfo chrpath diffstat binfmt-support \
qemu-user-static live-build bison flex fakeroot cmake bc vim time rsync \
unzip device-tree-compiler python-pip ncurses-dev python-pyelftools
```
### 4.1. Linux 4.19 固件v1.3.0b
从参考连接中下载全部 rk356x_linux_release_v1.3.0b_20221213_firefly_split.* 文件。
```bash
# 解压
mkdir ~/proj/
cd ~/proj/
cat path/to/rk356x_linux_release_v1.3.0b_20221213_split_dir/*firefly_split* | tar -xzv
# 导出数据
.repo/repo/repo sync -l
.repo/repo/repo sync -c --no-tags
.repo/repo/repo start firefly --all
# 后续可以使用以下命令更新 SDK
.repo/repo/repo sync -c --no-tags
```
#### 4.1.1 Buildroot 固件
回到 SDK 根目:
```bash
# 配置环境变量
source envsetup.sh rockchip_rk3566
# 选择配置文件
./build.sh roc-rk3566-pc-buildroot.mk
# 全自动编译
./build.sh
# 部分编译:编译 u-boot
./build.sh uboot
# 部分编译:配置 kernel
cd kernel
make ARCH=arm64 firefly_linux_defconfig menuconfig
make ARCH=arm64 savedefconfig
mv defconfig arch/arm64/configs/firefly_linux_defconfig
cd ..
# 部分编译:编译 kernel
./build.sh kernel
# 部分编译:编译 recovery
./build.sh recovery
# 部分编译:配置 Buildroot
make menuconfig
make savedefconfig
# 部分编译:编译 Buildroot 根文件系统
# 注:确保作为普通用户编译 Buildroot 根文件系统,避免不必要的错误。
./build.sh buildroot
# 打包固件:更新各部分镜像链接到 rockdev/ 目录
./mkfirmware.sh
# 打包固件:生成 update image完整固件会保存到 rockdev/pack/ 目录
./build.sh updateimg
# 生成 buildroot sdksdk 工具链路径在 buildroot/output/rockchip_rk3566/host
cd buildroot
make sdk
cd ..
```
#### 4.1.2 Ubuntu 固件
下载根文件系统:[Ubuntu 根文件系统(64位)](https://www.t-firefly.com/doc/download/106.html),放到 SDK 路径下
```bash
7z x ubuntu-aarch64-rootfs.7z
mkdir ubuntu_rootfs
mv ubuntu-aarch64-rootfs.img ubuntu_rootfs/rk356x_ubuntu_rootfs.img
# 配置环境变量
source envsetup.sh rockchip_rk3566
# 选择配置文件
./build.sh roc-rk3566-pc-ubuntu.mk
# 全自动编译
./build.sh
# 部分编译:编译 u-boot
./build.sh uboot
# 部分编译:配置 kernel
cd kernel
make ARCH=arm64 firefly_linux_defconfig menuconfig
make ARCH=arm64 savedefconfig
mv defconfig arch/arm64/configs/firefly_linux_defconfig
cd ..
# 部分编译:编译 kernel
./build.sh kernel
# 部分编译:编译 recovery
./build.sh recovery
# 打包固件:更新各部分镜像链接到 rockdev/ 目录
./mkfirmware.sh
# 打包固件:生成 update image完整固件会保存到 rockdev/pack/ 目录
./build.sh updateimg
```
## 5. 系统配置
### 5.1. SSH
官方发布的 SDK 默认已开启 ssh用户为”root”密码为”firefly”。
### 5.2. Buildroot 系统
- 用户root
- 密码firefly
#### 5.2.1. 以太网配置
Buildroot 的网络配置需要使用到 /etc/network/interfaces 配置文件,配置完成之后,运行:
```bash
/etc/init.d/S40network restart
```
即可重启网络。手动调试可以直接使用:
```bash
ifdown -a
# 和
ifup -a
```
来重启网络。
配置文件举例:
如下配置文件将 eth0 网卡设置为动态 IP 地址,将 eth1 设置为静态 IP 地址
```bash
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
auto eth1
iface eth1 inet static
address 192.168.2.2
netmask 255.255.255.0
broadcast 192.168.2.255
gateway 192.168.2.1
```
注意:/etc/network/interfaces 的文件格式要求比较严格,如果遇到:
```bash
Error: either "local" is duplicate, or "/24" is a garbage.
```
那么很有可能是配置文件中多了一个空格。
### 5.3. Ubuntu 系统
#### 5.3.1. 以太网配置
```bash
cd /etc/systemd/network
touch eth0.network
vim eth0.network
```
```eth0.network
[Match]
Name=eth0
[Network]
Address=192.168.2.2/24
Gateway=192.168.2.1
DNS=114.114.114.114
```
```bash
systemctl enable systemd-networkd
systemctl disable NetworkManager
```