I . Lab Steps l
- Insert the SD card and boot your board using an NFS file system
- Login to the root file system using:
- user name: root
- password:
- Change directory to the standard initscript directory/etc/init.d
- cd /etc/init.d
- Open a file for editing calledhelloworld.shin the/etc/init.ddirectory.
- vi helloworld.sh
- NOTE:In all of these labs if you are not familiar with vi or would like to use a graphical editor like emacs you can also edit these files on the NFS share you have mounted. For example if using the SDK defaults you can edit the files in the/targetNFS/directory instead.
- Add the following lines to the helloworld.sh file
#!/bin/sh
- echo ""
- echo "Hello from Sitara!!!"
- echo ""
- Give the init script executable permissions so that it can be run
- chmod +x helloworld.sh
- The init script has been created, but it has not been linked into the list of scripts to run on boot. To do so you will need to create a symlink to the script in the proper run level directory. The default run level is 5 so the symlink will be created there.
- cd /etc/rc5.d
- ln -s ../init.d/helloworld.sh S99helloworld
- You can now reboot your board using the following command
- init 6
II . systemd
vi /lib/systemd/system/myinit.service
[Unit]
Description=My init scripts
[Service]
ExecStart=/etc/init.d/myinitscript.sh
StandardOutput=journal+console
[Install]
WantedBy=multi-user.target
vi /etc/init.d/myinitscript.sh
#!/bin/sh
echo ""
echo "Hello from Sitara!!!"
echo ""