AM335X-PAC Series User Manual version 2.0.4 Page: 82
Copyright © 2021 ICP DAS Co., Ltd. All Rights Reserved. E-mail: [email protected]
4.3.4.
Execute the application on LinPAC AM335x PAC at boot time
User can refer to below steps to auto-execute demo ‘helloworld’ at boot time in LinPAC AM335x
PAC.
1.
Copy SDK demo ‘examples/common/helloworld’ to ‘/usr/sbin’ directory
2.
Create script file in ‘
/etc/init.d
’ directory. Check the ‘/etc/init.d/pppon’ or ‘/etc/init.d/single’
file for an example.
User can use ‘
vi
’ command to create the script file in ‘/etc/init.d’ directory and add below script
language to the file.
3.
Type ‘
chmod 755 /etc/init.d/hello
’ command to change the access permissions for the file.
4.
Use ‘
update-rc.d
’ command to add the script ‘hello’ automatically.
5.
Reboot the LinPAC. After setting the file, the LP-22xx/52xx/8x2x/9x2x will execute binary
‘helloworld’ at boot time.
#!/bin/sh
### BEGIN INIT INFO
# Provides: ICP DAS
# Required-Start:
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start and stop hello
# Description: hello
### END INIT INFO
helloworld > /tmp/test.log
root@
LinPAC-AM335x:~#
chmod +x /etc/init.d/hello
root@
LinPAC-AM335x:~#
update-rc.d hello defaults
root@
LinPAC-AM335x:~#
vi /etc/init.d/hello