Start on Startup Guide
Edit this on GitLab
Start Program on Boot (Linux)
Edit this on GitLab
There are a couple of ways that you can start a program on boot.
Start Before Login
/etc/rc5.d/ One is putting a script into the /etc/rc5.d/ to start your application. In this case the script’s file name must start with “S99”. This script will start as PetaLinux is booting, but before you get to the login screen. These steps will walk you through using this method:
-
Power on the NIU3E
-
Break into uboot by spamming the ESC key.
-
Disable the sata write protect by running:
mw.l 0x83c10094 0
-
Boot Petalinux by running:
run sataboot
-
Once booted create a script file in /etc/rc5.d/, named S99runNAIExecutable. Note – the file name must start with S99. The rest of the file name can be anything you like.
-
Edit your script file with vi: vi S99runNAIExecutable
-
Add the two following lines to the file: echo "running Sample:" ./<EXECUTABLE_FILE_NAME_&_PATH> Replace <EXECUTABLE_FILE_NAME_&_PATH> with the path and file name of your executable you want started when petalinux starts.
-
Save the file and exit vi.
-
Change the scripts permissions with:
chmod 777 S99runNAIExecutable
-
Copy your executable onto the NIU3E if it isn’t already there, along with the NAI lib files. Make sure the libs are stored in /usr/lib and the executable has execute permissions.
At this point you should be able to reboot the NIU3A and see your application start when petalinux has started.
The first four steps above are used to disable the write protection of the SATA on the NIU3E.
Start After Login
/etc/profile The second method is similar to the first method, however this method will only start the app after the user logs into the NIU3E. The steps are:
-
Power on the NIU3E
-
Break into uboot by spamming the ESC key.
-
Disable the sata write protect by running:
mw.l 0x83c10094 0
-
Boot Petalinux by running:
run sataboot
-
Once booted edit the file profile located in /etc: vi /etc/profile
-
At the end of the file add a line to your executable, for example: /home/root/helloworld.elf
-
Save the file and exit vi.
-
Copy your executable onto the NIU3E if it isn’t already there. Make sure the executable has execute permissions.
At this point you should be able to reboot the NIU3E and see your application start when petalinux has started and the user has logged in.