02 System auto-start service
This document uses systemd to implement system startup scripts or programs
1 System auto-start service added to firmware
First, you need to mount the root directory system files. For detailed instructions, see "VI. Others → 01 Modification of the root directory file system"
# 进入挂载目录
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_root
After completing the above operations, burn the image into the development board to realize the system self-start service
2 Manually configure system startup services
Power on the development board and execute the following command
# 在 /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.service
Check whether the development board has started the service. If it has started normally, restart the development board to check whether the service can be started normally.