Ubuntu 18 is using systemd, and there are three things we need to do
1) Create a service file and put it in /etc/systemd/system/
let say the file be board-init.service, with the below content
[Unit]
Description=Board initializations
DefaultDependencies=no
[Service]
Type=oneshot
ExecStart=/etc/board-init.sh
[Install]
WantedBy=sysinit.target
2) create your board-init.sh script file, and put it in /etc/
3) Create a soft link in the /etc/systemd/system/sysinit.target.wants to the service file w created
cd /etc/systemd/system/sysinit.target.wants
ln -s /etc/systemd/system/board-init.service board-init.service
reboot the board. To see the output of the script type
journalctl -u board-init -b