Skip to content

Commit dac2c27

Browse files
authored
Add support for EasePi-R2 device
1 parent 53c44d2 commit dac2c27

12 files changed

Lines changed: 355 additions & 0 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
verbosity=7
2+
bootlogo=false
3+
console=both
4+
earlycon=on
5+
extraargs=rw rootwait
6+
extraboardargs=net.ifnames=0 max_loop=128
7+
overlay_prefix=rk3588
8+
fdtfile=rockchip/rk3588-easepi-r2.dtb
9+
rootdev=/dev/mmcblk0p2
10+
rootfstype=btrfs
11+
rootflags=compress=zstd:6
12+
docker_optimizations=on
13+
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u
14+
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# DO NOT EDIT THIS FILE
2+
#
3+
# Please edit /boot/armbianEnv.txt to set supported parameters
4+
#
5+
6+
setenv load_addr "0x9000000"
7+
setenv overlay_error "false"
8+
# default values
9+
setenv rootdev "/dev/mmcblk0p1"
10+
setenv verbosity "1"
11+
setenv console "both"
12+
setenv bootlogo "false"
13+
setenv rootfstype "ext4"
14+
setenv rootflags "rw,errors=remount-ro"
15+
setenv docker_optimizations "on"
16+
setenv earlycon "off"
17+
18+
echo "Boot script loaded from ${devtype} ${devnum}"
19+
20+
if test -e ${devtype} ${devnum} ${prefix}armbianEnv.txt; then
21+
load ${devtype} ${devnum} ${load_addr} ${prefix}armbianEnv.txt
22+
env import -t ${load_addr} ${filesize}
23+
fi
24+
25+
if test "${logo}" = "disabled"; then setenv logo "logo.nologo"; fi
26+
27+
if test "${console}" = "display" || test "${console}" = "both"; then setenv consoleargs "console=tty1"; fi
28+
if test "${console}" = "serial" || test "${console}" = "both"; then setenv consoleargs "console=ttyS2,1500000 ${consoleargs}"; fi
29+
if test "${earlycon}" = "on"; then setenv consoleargs "earlycon ${consoleargs}"; fi
30+
if test "${bootlogo}" = "true"; then setenv consoleargs "bootsplash.bootfile=bootsplash.armbian ${consoleargs}"; fi
31+
32+
# get PARTUUID of first partition on current boot device the boot script was loaded from
33+
part uuid ${devtype} ${devnum}:1 partuuid
34+
35+
setenv bootargs "root=${rootdev} rootwait rootfstype=${rootfstype} rootflags=${rootflags} ${consoleargs} consoleblank=0 loglevel=${verbosity} ubootpart=${partuuid} usb-storage.quirks=${usbstoragequirks} ${extraargs} ${extraboardargs}"
36+
37+
if test "${docker_optimizations}" = "on"; then setenv bootargs "${bootargs} cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory swapaccount=1"; fi
38+
39+
load ${devtype} ${devnum} ${ramdisk_addr_r} ${prefix}uInitrd
40+
load ${devtype} ${devnum} ${kernel_addr_r} ${prefix}Image
41+
42+
load ${devtype} ${devnum} ${fdt_addr_r} ${prefix}dtb/${fdtfile}
43+
fdt addr ${fdt_addr_r}
44+
fdt resize 65536
45+
for overlay_file in ${overlays}; do
46+
if load ${devtype} ${devnum} ${load_addr} ${prefix}dtb/rockchip/overlay/${overlay_prefix}-${overlay_file}.dtbo; then
47+
echo "Applying kernel provided DT overlay ${overlay_prefix}-${overlay_file}.dtbo"
48+
fdt apply ${load_addr} || setenv overlay_error "true"
49+
fi
50+
done
51+
for overlay_file in ${user_overlays}; do
52+
if load ${devtype} ${devnum} ${load_addr} ${prefix}overlay-user/${overlay_file}.dtbo; then
53+
echo "Applying user provided DT overlay ${overlay_file}.dtbo"
54+
fdt apply ${load_addr} || setenv overlay_error "true"
55+
fi
56+
done
57+
if test "${overlay_error}" = "true"; then
58+
echo "Error applying DT overlays, restoring original DT"
59+
load ${devtype} ${devnum} ${fdt_addr_r} ${prefix}dtb/${fdtfile}
60+
else
61+
if load ${devtype} ${devnum} ${load_addr} ${prefix}dtb/rockchip/overlay/${overlay_prefix}-fixup.scr; then
62+
echo "Applying kernel provided DT fixup script (${overlay_prefix}-fixup.scr)"
63+
source ${load_addr}
64+
fi
65+
if test -e ${devtype} ${devnum} ${prefix}fixup.scr; then
66+
load ${devtype} ${devnum} ${load_addr} ${prefix}fixup.scr
67+
echo "Applying user provided fixup script (fixup.scr)"
68+
source ${load_addr}
69+
fi
70+
fi
71+
booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
72+
73+
# Recompile with:
74+
# mkimage -C none -A arm -T script -n 'flatmax load script' -d /boot/boot.cmd /boot/boot.scr
Binary file not shown.
Binary file not shown.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# /etc/balance_irq
2+
# EasePi-R2 中断负载均衡配置
3+
# RK3588 8核: CPU0-CPU3 (A76大核), CPU4-CPU7 (A55小核)
4+
# 映射关系: 1->CPU0, 2->CPU1, 3->CPU2, 4->CPU3, 5->CPU4, 6->CPU5, 7->CPU6, 8->CPU7
5+
#
6+
# 策略说明:
7+
# - 4路RTL8125BG 2.5G网卡通过独立PCIe连接,RX/TX队列需分散到大核
8+
# - SATA中断分配到小核
9+
# - USB中断分散到小核
10+
# - 配置改好后运行 balethirq.pl 即时生效
11+
#
12+
# 注意:设备名需与 /proc/interrupts 中显示的名称一致
13+
# udev重命名后的网卡名为 eth0/eth01/eth02/eth03
14+
# SATA地址来源: DTS启用sata1(fe230000)和sata2(fe250000)
15+
16+
# ==========================
17+
# 1. eth0 - RTL8125BG (PCIe 0004:41:00.0)
18+
# ==========================
19+
eth0-0 2
20+
eth0-1 3
21+
eth0-16 1
22+
eth0-18 2
23+
24+
# ==========================
25+
# 2. eth01 - RTL8125BG (PCIe 0001:11:00.0)
26+
# ==========================
27+
eth01-0 4
28+
eth01-1 1
29+
eth01-16 3
30+
eth01-18 4
31+
32+
# ==========================
33+
# 3. eth02 - RTL8125BG (PCIe 0002:21:00.0)
34+
# ==========================
35+
eth02-0 2
36+
eth02-1 4
37+
eth02-16 1
38+
eth02-18 3
39+
40+
# ==========================
41+
# 4. eth03 - RTL8125BG (PCIe 0003:31:00.0)
42+
# ==========================
43+
eth03-0 3
44+
eth03-1 1
45+
eth03-16 4
46+
eth03-18 2
47+
48+
# ==========================
49+
# 5. SATA (DTS: sata1=fe220000, sata2=fe230000)
50+
# ==========================
51+
ahci[fe220000.sata] 6
52+
ahci[fe230000.sata] 7
53+
54+
# ==========================
55+
# 6. USB
56+
# ==========================
57+
xhci-hcd:usb1 5
58+
xhci-hcd:usb3 6
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# lirc 守护进程配置文件
2+
# 飞牛EasePi-R2默认配置
3+
4+
[lircd]
5+
nodaemon = False
6+
driver = default
7+
device = /dev/lirc0
8+
output = /var/run/lirc/lircd
9+
pidfile = /var/run/lirc/lircd.pid
10+
listen = 0.0.0.0:8765
11+
connect = 127.0.0.1
12+
# config file 会自动去/etc/lirc/lircd.conf找
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# This file is for lirc configuration
2+
# EasePi-R2 default lirc configuration
3+
# You can add your remote configuration here
4+
5+
# Default template - replace with your recorded remote
6+
begin remote
7+
name EasePi-R2-Remote
8+
bits 16
9+
flags SPACE_ENC|CONST_LENGTH
10+
eps 30
11+
aeps 100
12+
header 8993 4470
13+
one 557 1666
14+
zero 557 555
15+
ptrail 557
16+
repeat 8993 2216
17+
pre_data_bits 16
18+
pre_data 0x4040
19+
gap 107434
20+
toggle_bit_mask 0x0
21+
begin codes
22+
KEY_POWER 0x00FF
23+
KEY_UP 0x01FE
24+
KEY_DOWN 0x02FD
25+
KEY_LEFT 0x03FC
26+
KEY_RIGHT 0x04FB
27+
KEY_OK 0x05FA
28+
KEY_BACK 0x06F9
29+
KEY_MENU 0x07F8
30+
KEY_HOME 0x08F7
31+
KEY_VOLUMEUP 0x09F6
32+
KEY_VOLUMEDOWN 0x0AF5
33+
end codes
34+
end remote
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
#
3+
# rc.local
4+
#
5+
# This script is executed at the end of each multiuser runlevel.
6+
# Make sure that the script will "exit 0" on success or any other
7+
# value on error.
8+
#
9+
# In order to enable or disable this script just change the execution
10+
# bits.
11+
#
12+
# By default this script does nothing.
13+
14+
# 执行飞牛自定义服务
15+
[[ -x "/etc/custom_service/start_service.sh" ]] && bash /etc/custom_service/start_service.sh &
16+
17+
# 中断负载均衡
18+
[[ -x "/usr/bin/balethirq.pl" ]] && perl /usr/bin/balethirq.pl >/dev/null 2>&1 &
19+
20+
# RTC时钟同步(HYM8563)
21+
if [ -c /dev/rtc0 ]; then
22+
hwclock --hctosys >/dev/null 2>&1 &
23+
fi
24+
25+
# 红外初始化
26+
[[ -x "/usr/local/ir/fix_infrared.sh" ]] && bash /usr/local/ir/fix_infrared.sh >/dev/null 2>&1 &
27+
28+
# 蓝牙初始化
29+
[[ -x "/usr/local/bluetooth/fix_bluetooth.sh" ]] && bash /usr/local/bluetooth/fix_bluetooth.sh >/dev/null 2>&1 &
30+
31+
# WiFi初始化
32+
[[ -x "/usr/local/wifi/fix_wifi.sh" ]] && bash /usr/local/wifi/fix_wifi.sh >/dev/null 2>&1 &
33+
34+
exit 0
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# EasePi-R2 4G模块网络接口命名
2+
# 将USB 4G模块(RNDIS)重命名为4Gnet
3+
SUBSYSTEM=="net", ACTION=="add", SUBSYSTEMS=="usb", DRIVERS=="rndis_host", NAME="4Gnet"
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
# EasePi-R2 蓝牙初始化脚本
3+
# AP6255 WiFi+BT Combo模块 (BCM43455)
4+
# DTS中uart9已定义bluetooth子节点(compatible="brcm,bcm4345c5")
5+
# 主线内核hci_bcm驱动通过serdev自动初始化,hciattach仅作fallback
6+
7+
echo "[BT] 开始蓝牙初始化..."
8+
9+
# 检查rfkill状态并解除阻塞
10+
rfkill unblock all 2>/dev/null || true
11+
12+
# 等待serdev自动初始化(DTS bluetooth子节点 -> hci_bcm serdev绑定)
13+
if [ ! -d /sys/class/bluetooth/hci0 ]; then
14+
echo "[BT] 等待serdev自动初始化..."
15+
for i in $(seq 1 5); do
16+
sleep 1
17+
[ -d /sys/class/bluetooth/hci0 ] && break
18+
done
19+
fi
20+
21+
# Fallback: serdev未自动初始化时,手动hciattach
22+
if [ ! -d /sys/class/bluetooth/hci0 ]; then
23+
# uart9在RK3588主线内核中对应ttyS9
24+
for tty_dev in /dev/ttyS9 /dev/ttyS1; do
25+
if [ -c "$tty_dev" ]; then
26+
echo "[BT] 尝试通过 $tty_dev 初始化AP6255蓝牙..."
27+
hciattach "$tty_dev" bcm43xx 1500000 flow bdaddr 2>/dev/null && break
28+
hciattach "$tty_dev" any 1500000 flow 2>/dev/null && break
29+
fi
30+
done
31+
sleep 1
32+
fi
33+
34+
# 确保蓝牙服务开机自启
35+
systemctl enable bluetooth 2>/dev/null || true
36+
37+
# 启动蓝牙服务
38+
if ! systemctl is-active --quiet bluetooth; then
39+
echo "[BT] 启动蓝牙服务..."
40+
systemctl start bluetooth 2>/dev/null || true
41+
fi
42+
43+
# 检查蓝牙适配器是否已上电
44+
if [ -d /sys/class/bluetooth/hci0 ]; then
45+
hciconfig hci0 up 2>/dev/null || true
46+
hciconfig hci0 piscan 2>/dev/null || true
47+
echo "[BT] 蓝牙初始化完成"
48+
else
49+
echo "[BT] 警告:蓝牙设备未就绪"
50+
echo "[BT] 请检查: 1) DTS uart9 bluetooth节点 2) hci_bcm驱动 3) /dev/ttyS9"
51+
fi
52+
53+
exit 0

0 commit comments

Comments
 (0)