System Auto-Start Services
This document uses systemd to implement auto-start scripts or programs.
1 Add a system auto-start service into the firmware
First, mount the root filesystem. For details, see "Others → 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 steps above, flash the image to 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 board has started the service. If it starts normally, reboot the board to verify that the service auto-starts at boot.
