System Auto-Start Service
This document uses systemd to implement system auto-start scripts or programs.
1 Adding a System Auto-Start Service to the Firmware
First, you need to mount the root filesystem. For the detailed procedure, see "6. Other → 01 Modifying the Root Filesystem".
# 进入挂载目录
sudo chroot /mnt/GM_3568JHF_root /bin/bash
# vim 创建或打开系统文件,编辑系统自启服务(以 rotate_screen.service 为例)
vim /etc/systemd/system/rotate_screen.service
# 编辑完成后,退出 vim,启用系统服务
systemctl enable rotate_screen.servic
# 取消挂载
sudo umount -l /mnt/GM_3568JHF_rootAfter completing the above operations, flash the image into the development board to enable the system auto-start service.
2 Manually Configure a System Auto-Start Service
Power on the development board and run the following commands.
# 在 /etc/systemd/system/ 目录下,创建服务配置文件
sudo vim /etc/systemd/system/rotate_screen.service
# 编辑完成后,重新加载系统服务
sudo systemctl daemon-reload
# 启用服务
sudo systemctl enable rotate_screen.service
#启动服务
sudo systemctl start rotate_screen.serviceCheck whether the development board has started the service. If it starts normally, restart the development board to check whether the service auto-starts at boot.
