Skip to content

Commit daefadd

Browse files
authored
Merge pull request #3525 from ifroncy01/main
Add support for EasePi-A2/R2 devices
2 parents d4a62eb + dac2c27 commit daefadd

32 files changed

Lines changed: 1663 additions & 232 deletions

File tree

build-armbian/armbian-files/common-files/etc/model_database.conf

Lines changed: 227 additions & 232 deletions
Large diffs are not rendered by default.
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=rk3568
8+
fdtfile=rockchip/rk3568-easepi-a2.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: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# 红外模块加载配置
2+
gpio_ir_recv
3+
ir_nec_decoder
4+
lirc_dev
5+
lirc_i2c
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
[[ -x "/etc/custom_service/start_service.sh" ]] && bash /etc/custom_service/start_service.sh &
15+
# oled初始化命令
16+
bash /usr/local/oled/oled_init.sh >/dev/null 2>&1 &
17+
# ir初始化命令
18+
#bash /usr/local/ir/fix_infrared.sh >/dev/null 2>&1 &
19+
20+
# 蓝牙初始化
21+
[[ -x "/usr/local/bluetooth/fix_bluetooth.sh" ]] && bash /usr/local/bluetooth/fix_bluetooth.sh >/dev/null 2>&1 &
22+
23+
# WiFi初始化
24+
[[ -x "/usr/local/wifi/fix_wifi.sh" ]] && bash /usr/local/wifi/fix_wifi.sh >/dev/null 2>&1 &
25+
26+
exit 0
27+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# table easepi_remote, type: nec
2+
0x22dc KEY_POWER
3+
0x2282 KEY_MENU
4+
0x22ca KEY_UP
5+
0x22d2 KEY_DOWN
6+
0x2299 KEY_LEFT
7+
0x22c1 KEY_RIGHT
8+
0x22ce KEY_ENTER
9+
0x2295 KEY_BACK
10+
0x2288 KEY_HOME
11+
0x2280 KEY_VOLUMEUP
12+
0x2281 KEY_VOLUMEDOWN
13+
0x2287 KEY_0
14+
0x2292 KEY_1
15+
0x2293 KEY_2
16+
0x22cc KEY_3
17+
0x228e KEY_4
18+
0x228f KEY_5
19+
0x22c8 KEY_6
20+
0x228a KEY_7
21+
0x228b KEY_8
22+
0x22c4 KEY_9
23+
0x228d KEY_SETUP
24+
0x2285 KEY_PAGEUP
25+
0x2286 KEY_PAGEDOWN
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[Unit]
2+
Description=EasePi A2 OLED Display (Go)
3+
After=network.target
4+
StartLimitIntervalSec=0
5+
ConditionPathExists=/dev/i2c-3
6+
7+
[Service]
8+
Type=simple
9+
ExecStart=/usr/local/oled/oled --silent
10+
Restart=always
11+
RestartSec=3
12+
13+
[Install]
14+
WantedBy=multi-user.target
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/bash
2+
# EasePi-A2 蓝牙初始化脚本 (v2 - with GPIO reset)
3+
# AP6255 WiFi+BT Combo module (BCM43455)
4+
# BT uses UART8 (ttyS8) with GPIO0_20 (BT_RESET) and GPIO0_34 (BT_WAKE)
5+
6+
echo "[BT] 开始蓝牙初始化..."
7+
8+
# RF kill unblock
9+
rfkill unblock all 2>/dev/null || true
10+
11+
# Load HCI UART driver
12+
modprobe hci_uart 2>/dev/null || true
13+
14+
# GPIO reset sequence for BCM43455
15+
# BT,reset_gpio = GPIO0_20, BT,wake_gpio = GPIO0_34
16+
BT_RESET=20
17+
BT_WAKE=34
18+
echo ${BT_RESET} > /sys/class/gpio/export 2>/dev/null || true
19+
echo ${BT_WAKE} > /sys/class/gpio/export 2>/dev/null || true
20+
sleep 0.1
21+
echo out > /sys/class/gpio/gpio${BT_RESET}/direction 2>/dev/null || true
22+
echo out > /sys/class/gpio/gpio${BT_WAKE}/direction 2>/dev/null || true
23+
# Power on sequence: RESET low -> WAKE low -> RESET high -> WAKE high
24+
echo 0 > /sys/class/gpio/gpio${BT_RESET}/value 2>/dev/null || true
25+
echo 0 > /sys/class/gpio/gpio${BT_WAKE}/value 2>/dev/null || true
26+
sleep 0.05
27+
echo 1 > /sys/class/gpio/gpio${BT_RESET}/value 2>/dev/null || true
28+
sleep 0.1
29+
echo 1 > /sys/class/gpio/gpio${BT_WAKE}/value 2>/dev/null || true
30+
sleep 0.2
31+
32+
# Try hciattach with firmware loading
33+
hciattach /dev/ttyS8 bcm43xx 1500000 flow -t 10 2>/dev/null && {
34+
sleep 1
35+
if [ -d /sys/class/bluetooth/hci0 ]; then
36+
hciconfig hci0 up 2>/dev/null || true
37+
echo "[BT] 蓝牙初始化完成"
38+
fi
39+
} || {
40+
echo "[BT] bcm43xx failed, trying generic..."
41+
hciattach /dev/ttyS8 any 1500000 flow 2>/dev/null
42+
sleep 1
43+
if [ -d /sys/class/bluetooth/hci0 ]; then
44+
echo "[BT] 蓝牙初始化完成 (generic mode)"
45+
else
46+
echo "[BT] 警告:蓝牙设备未就绪"
47+
echo "[BT] 请检查: 1) GPIO reset timing 2) UART pinmux 3) hci_bcm driver"
48+
fi
49+
}
50+
51+
# Cleanup GPIO exports
52+
echo ${BT_RESET} > /sys/class/gpio/unexport 2>/dev/null || true
53+
echo ${BT_WAKE} > /sys/class/gpio/unexport 2>/dev/null || true
54+
55+
# Ensure bluetooth service is started
56+
systemctl enable bluetooth 2>/dev/null || true
57+
systemctl start bluetooth 2>/dev/null || true
58+
59+
exit 0

0 commit comments

Comments
 (0)