20250711荣品RD-RK3588开发板在Android13下的开机自启动的配置步骤

20250711荣品RD-RK3588开发板在Android13下的开机自启动的配置步骤

2025/7/11 9:06

1、

Z:\Android13.0\device\rockchip\common\sepolicy\vendor\file_contexts

rpdzkj mem_test

/vendor/bin/rp_stress_test/cpu_ddr_stress_test.sh u:object_r:mem_test_exec:s0

#for_forlinx
/vendor/bin/autostart_test.sh u:object_r:autostart_test_exec:s0

2、

Z:\Android13.0\device\rockchip\common\sepolicy\vendor\system_server.te

#allow system_server sysfs:file { read open getattr };

for gpu

allow system_server abc:dir { read open getattr };

allow system_server serial_device:chr_file rw_file_perms;

allow system_server sysfs_extcon:file r_file_perms;

for forlinx

allow system_server debug_prop:property_service set;

type autostart_test, domain;
type autostart_test_exec, exec_type,vendor_file_type,file_type;

init_daemon_domain(autostart_test)

allow autostart_test vendor_shell_exec:file rx_file_perms;
allow autostart_test vendor_toolbox_exec:file rx_file_perms;
allow autostart_test console_device:chr_file { open write };
allow autostart_test autostart_test:capability { sys_module };
allow autostart_test vendor_file:system { module_load };

for storage

allow system_server storage_stub_file:dir getattr;

allow system_server zygote:process getpgid;

allow system_server sysfs_net:file r_file_perms;

r_dir_file(system_server, metadata_file)

for forlinx

allow autostart_test serial_device:chr_file { ioctl open read write };

#rk_output_hal

allow system_server rk_output_hal_service:hwservice_manager find;

allow system_server zygote:process { getsched setsched };

allow system_server sysfs_hdmi:file { read open getattr };

add_service(system_server,drm_device_management_service)

binder_call(system_server, rk_output_hal)

binder_call(system_server, zygote)

rw_rockchip_graphic_device(system_server)

get_prop(system_server, vendor_base_prop)

3、新增:【开机自启动脚本文件】

Z:\Android13.0\device\rockchip\rk3588\rk3588_t\autostart_test.sh

#!/vendor/bin/sh

echo "Forlinx:: 2025/4/17 11:39 ::GNSS_CONFIG start!" > /dev/ttyFIQ0

echo "This is a test" > /dev/ttyFIQ0

#echo $(date) > /data/date.txt

#/system/bin/rk3566_android_serial
sleep 30
/system/bin/iptables -t filter -F tetherctrl_FORWARD
#/vendor/bin/clear_drop
echo "Forlinx:: 2025/4/17 11:49 ::GNSS_CONFIG end!" > /dev/ttyFIQ0
/system/bin/uart2tcp

4、

Z:\Android13.0\device\rockchip\rk3588\rk3588_t\rk3588_t.mk

Copyright 2014 The Android Open-Source Project

Licensed under the Apache License, Version 2.0 (the "License");

you may not use this file except in compliance with the License.

You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software

distributed under the License is distributed on an "AS IS" BASIS,

WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the License for the specific language governing permissions and

limitations under the License.

First lunching is T, api_level is 33

PRODUCT_SHIPPING_API_LEVEL := 33

PRODUCT_DTBO_TEMPLATE := $(LOCAL_PATH)/dt-overlay.in

include device/rockchip/common/build/rockchip/DynamicPartitions.mk

include device/rockchip/rk3588/rk3588_t/BoardConfig.mk

include device/rockchip/common/BoardConfig.mk

$(call inherit-product, device/rockchip/rk3588/device.mk)

$(call inherit-product, device/rockchip/common/device.mk)

$(call inherit-product, frameworks/native/build/tablet-10in-xhdpi-2048-dalvik-heap.mk)

DEVICE_PACKAGE_OVERLAYS += $(LOCAL_PATH)/../overlay

PRODUCT_CHARACTERISTICS := tablet

PRODUCT_NAME := rk3588_t

PRODUCT_DEVICE := rk3588_t

PRODUCT_BRAND := rockchip

PRODUCT_MODEL := rk3588_t

PRODUCT_MANUFACTURER := rockchip

PRODUCT_AAPT_PREF_CONFIG := mdpi

add Rockchip properties

#PRODUCT_PROPERTY_OVERRIDES += ro.sf.lcd_density=320

PRODUCT_PROPERTY_OVERRIDES += ro.wifi.sleep.power.down=true

PRODUCT_PROPERTY_OVERRIDES += persist.wifi.sleep.delay.ms=0

PRODUCT_PROPERTY_OVERRIDES += persist.bt.power.down=true

#PRODUCT_PROPERTY_OVERRIDES += vendor.hwc.device.primary=DSI

#PRODUCT_PROPERTY_OVERRIDES += vendor.hwc.device.extend=HDMI-A,eDP

copy test.sh to dir vendor/bin/test.sh

#PRODUCT_COPY_FILES +=device/rockchip/rk356x/rk3566_t/myapp.sh:vendor/bin/myapp.sh
PRODUCT_COPY_FILES +=device/rockchip/rk3588/rk3588_t/uart2tcp:/system/bin/uart2tcp
PRODUCT_COPY_FILES +=device/rockchip/rk3588/rk3588_t/autostart_test.sh:vendor/bin/autostart_test.sh

5、新增。【你需要开机自启动的Native C语言程序,编译之后的二进制文件。】

Z:\Android13.0\device\rockchip\rk3588\rk3588_t\uart2tcp

6、

Z:\Android13.0\system\core\rootdir\init.rc

Define default initial receive window size in segments.

setprop net.tcp_def_init_rwnd 60

Update dm-verity state and set partition.*.verified properties.

verity_update_state

Start standard binderized HAL daemons

class_start hal

class_start core

service autostart_test /vendor/bin/autostart_test.sh
class main
user root
group root
disabled
oneshot

on nonencrypted

class_start main

class_start late_start

on property:sys.init_log_level=*

loglevel ${sys.init_log_level}

on charger

class_start charger

on property:sys.boot_completed=1

bootchart stop

Setup per_boot directory so other .rc could start to use it on boot_completed

exec - system system -- /bin/rm -rf /data/per_boot

mkdir /data/per_boot 0700 system system encryption=Require key=per_boot_ref
start autostart_test

system server cannot write to /proc/sys files,

and chown/chmod does not work for /proc/sys/ entries.

So proxy writes through init.

on property:sys.sysctl.extra_free_kbytes=*

exec -- /system/bin/extra_free_kbytes.sh ${sys.sysctl.extra_free_kbytes}

开机自启动的脚本:OK3588_android_autostart.patch

diff --git a/device/rockchip/common/sepolicy/vendor/file_contexts b/device/rockchip/common/sepolicy/vendor/file_contexts

index 148f9f94f2..69f6c03620 100644

--- a/device/rockchip/common/sepolicy/vendor/file_contexts

+++ b/device/rockchip/common/sepolicy/vendor/file_contexts

@@ -235,6 +235,9 @@

#flash_img

/vendor/bin/flash_img.sh u:object_r:vendor_install_recovery_exec:s0

+#for_forlinx

+/vendor/bin/autostart_test.sh u:object_r:autostart_test_exec:s0

rk dma_buf heaps

/dev/dma_heap/cma u:object_r:dmabuf_system_heap_device:s0

/dev/dma_heap/system-dma32 u:object_r:dmabuf_system_heap_device:s0

diff --git a/device/rockchip/common/sepolicy/vendor/system_server.te b/device/rockchip/common/sepolicy/vendor/system_server.te

index ddce9e9832..2ee867babe 100644

--- a/device/rockchip/common/sepolicy/vendor/system_server.te

+++ b/device/rockchip/common/sepolicy/vendor/system_server.te

@@ -4,6 +4,20 @@ allow system_server abc:dir { read open getattr };

allow system_server serial_device:chr_file rw_file_perms;

allow system_server sysfs_extcon:file r_file_perms;

+# for forlinx

+allow system_server debug_prop:property_service set;

+type autostart_test, domain;

+type autostart_test_exec, exec_type,vendor_file_type,file_type;

+init_daemon_domain(autostart_test)

+allow autostart_test vendor_shell_exec:file rx_file_perms;

+allow autostart_test vendor_toolbox_exec:file rx_file_perms;

+allow autostart_test console_device:chr_file { open write };

+allow autostart_test autostart_test:capability { sys_module };

+allow autostart_test vendor_file:system { module_load };

for storage

allow system_server storage_stub_file:dir getattr;

@@ -12,6 +26,9 @@ allow system_server zygote:process getpgid;

allow system_server sysfs_net:file r_file_perms;

r_dir_file(system_server, metadata_file)

+# for forlinx

+allow autostart_test serial_device:chr_file { ioctl open read write };

#rk_output_hal

allow system_server rk_output_hal_service:hwservice_manager find;

allow system_server zygote:process { getsched setsched };

diff --git a/device/rockchip/rk3588/ok3588_c/autostart_test.sh b/device/rockchip/rk3588/ok3588_c/autostart_test.sh

new file mode 100644

index 0000000000..8d38856413

--- /dev/null

+++ b/device/rockchip/rk3588/ok3588_c/autostart_test.sh

@@ -0,0 +1,4 @@

+#!/vendor/bin/sh

+echo "Forlinx::::::::::::::::::GNSS_CONFIG start!" > /dev/ttyFIQ0

+echo "This is a test" > /dev/ttyFIQ0

+echo "Forlinx::::::::::::::::::GNSS_CONFIG end!" > /dev/ttyFIQ0

diff --git a/device/rockchip/rk3588/ok3588_c/ok3588_c.mk b/device/rockchip/rk3588/ok3588_c/ok3588_c.mk

index 10a61ab86e..cd639f9cc4 100644

--- a/device/rockchip/rk3588/ok3588_c/ok3588_c.mk

+++ b/device/rockchip/rk3588/ok3588_c/ok3588_c.mk

@@ -76,5 +76,6 @@ PRODUCT_PACKAGES += \

BOARD_HDMI_IN_SUPPORT := true

PRODUCT_COPY_FILES += \

  • $(LOCAL_PATH)/bootanimation.zip:/system/media/bootanimation.zip
  • $(LOCAL_PATH)/bootanimation.zip:/system/media/bootanimation.zip \

  • (LOCAL_PATH)/autostart_test.sh:(TARGET_COPY_OUT_VENDOR)/bin/autostart_test.sh

diff --git a/system/core/rootdir/init.rc b/system/core/rootdir/init.rc

index 993c8b11fe..1043adff1b 100644

--- a/system/core/rootdir/init.rc

+++ b/system/core/rootdir/init.rc

@@ -1145,11 +1145,19 @@ on property:vold.decrypt=trigger_shutdown_framework

class_reset_post_data core

class_reset_post_data hal

+service autostart_test /vendor/bin/autostart_test.sh

  • class main

  • user root

  • group root

  • disabled

  • oneshot

on property:sys.boot_completed=1

bootchart stop

Setup per_boot directory so other .rc could start to use it on boot_completed

exec - system system -- /bin/rm -rf /data/per_boot

mkdir /data/per_boot 0700 system system encryption=Require key=per_boot_ref

  • start autostart_test

system server cannot write to /proc/sys files,

and chown/chmod does not work for /proc/sys/ entries.

开机之后确认开机只启动成功的打印LOG:

【大概47s开机自启动脚本跑完。如果需要微调,可以适当修改sleep的时间了!】

BEGIN 2025/7/10 16:28:26
2025/7/10 16:28:27 DDR V1.13 25cee80c4f cym 23/08/11-09:31:58

2025/7/10 16:28:27 LPDDR4X, 1800MHz

2025/7/10 16:28:27 channel0 BW=16 Col=10 Bk=8 CS0 Row=16 CS1 Row=16 CS=2 Die BW=16 Size=2048MB

2025/7/10 16:28:27 channel1 BW=16 Col=10 Bk=8 CS0 Row=16 CS1 Row=16 CS=2 Die BW=16 Size=2048MB

2025/7/10 16:28:27 channel2 BW=16 Col=10 Bk=8 CS0 Row=16 CS1 Row=16 CS=2 Die BW=16 Size=2048MB

2025/7/10 16:28:27 channel3 BW=16 Col=10 Bk=8 CS0 Row=16 CS1 Row=16 CS=2 Die BW=16 Size=2048MB

2025/7/10 16:28:27 Manufacturer ID:0x13

2025/7/10 16:28:27 CH0 RX Vref:29.3%, TX Vref:24.8%,26.8%

2025/7/10 16:28:27 CH1 RX Vref:29.3%, TX Vref:24.8%,26.8%

2025/7/10 16:28:27 CH2 RX Vref:29.7%, TX Vref:26.8%,27.8%

2025/7/10 16:28:27 CH3 RX Vref:29.7%, TX Vref:25.8%,25.8%

2025/7/10 16:28:27 change to F1: 528MHz

2025/7/10 16:28:27 change to F2: 1068MHz

2025/7/10 16:28:27 change to F3: 1560MHz

2025/7/10 16:28:27 change to F0: 1800MHz

2025/7/10 16:28:27 out

2025/7/10 16:28:27 U-Boot SPL board init

2025/7/10 16:28:27 U-Boot SPL 2017.09-g5f53abfa1e-221223 #zzz (Dec 26 2022 - 09:10:09)

2025/7/10 16:28:44 Forlinx:: 2025/4/17 11:39 ::GNSS_CONFIG start!
2025/7/10 16:29:14 Forlinx:: 2025/4/17 11:49 ::GNSS_CONFIG end!

相关推荐
砚凝霜14 分钟前
软考网络工程师|案例分析:华为全套综合实验核心知识点 & 考点总结
网络·华为
小新讲网安2 小时前
WiFi安全攻防实战:WPA3新协议与传统破解技术全解析
开发语言·网络·安全·php·漏洞·nmap·漏洞检测
清水白石0089 小时前
Python 死锁排查全攻略:从线程卡死到锁依赖定位与工程化修复
linux·网络·python
TechWayfarer10 小时前
批量查IP归属地,在线API、脚本、离线库怎么选?三种方案实测对比
网络·python·网络协议·tcp/ip
ryan_99614 小时前
MCP Transport 完整指南:stdio 与 Streamable HTTP 到底怎样传消息
网络·网络协议·http
数据知道17 小时前
网络安全实战:子域名接管实战——从 CNAME 配置错误到完全控制
网络·安全·web安全·网络安全
lf132102717 小时前
用 JSON Schema 管装修节点记录:从照片台账到可校验工程数据
网络·数据库·人工智能·经验分享·物联网·json·智能家居
LayZhangStrive17 小时前
后端通识 - 远程服务调用RPC
网络·网络协议·rpc·sentinel·openfeign·远程服务调用
华清远见成都中心19 小时前
FreeRTOS事件组(Event Group)的工作机制分析
服务器·网络·网络协议
xiaoxiangsiyan19 小时前
RHCE2026云原生路线EX188和EX288完整备考指南
运维·网络·云原生·自动化