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!

相关推荐
火山上的企鹅2 小时前
Codex实战:APP远程升级服务搭建(三)后台管理页面(APK 上传、版本管理、多应用页签)
服务器·网络·数据库·oracle·qgc
caimouse2 小时前
Reactos 第 9 章 设备驱动 — 9.5 一组PnP设备驱动模块的实例
网络·windows
袁小皮皮不皮3 小时前
3.HCIP OSPF补充知识(优化版)
服务器·网络·数据库·网络协议·智能路由器
志栋智能3 小时前
超自动化巡检:知识沉淀与团队协作的新载体
大数据·运维·网络·数据库·人工智能·自动化
酣大智4 小时前
策略路由PBR--企业双出口实验
网络·智能路由器·策略路由·pbr
袁小皮皮不皮4 小时前
1.HCIP BFD 学习笔记(优化版)
服务器·网络·笔记·网络协议·学习·智能路由器·ip
梁辰兴5 小时前
计算机网络基础:数据加密模型
网络·计算机网络·计算机·数据加密·计算机网络基础·梁辰兴·数据加密模型
fofantasy5 小时前
NSK LH12AN 微型导轨技术手册
运维·网络·数据库·经验分享·规格说明书
网络系统管理5 小时前
第八届江苏技能状元大赛“信息通信网络运行管理”项目技术文件
网络
福建佰胜张工5 小时前
3HNA006643-001 BRACKET ZB/CCIB:ABB 喷涂机器人关键结构件深度解析
网络·机器人