I have a script (let's say Hello World), that I want to include to my embedded Linux. I'm using Buildroot and want to start the script in Busybox. But because I'm cross-compiling for the target I'm not sure where to put that script, that in the end it's gonna be compiled and can be executed in Busybox.
a shell-script does not need to be compiled, in order to be run: the nature of scripts is to be run directly by an interpreter (your shell-implementation).
hence, you only need to put the script into a place where it will be found by your shell. for administrator-installed scripts, the preferred place is
/usr/local/sbin if the script is to be run in "administrator mode").
make sure that the script has proper permissions.
# cp /path/to/script/hello_world.sh /usr/local/bin # chown root.root /usr/local/bin/hello_world.sh # chmod a+x /usr/local/bin/hello_world.sh # hello_world.sh Hi there! #
If you want the script to run at start up and you are using the
busybox init process in your system then place a script in the
You need to make sure that your script file name is of the form
where X is some integer that specifies the order that it is executed in - the lower the X value the earlier that the script will run. Depending on how you configured
buildroot you should see some scripts similarly named already in your
/etc/init.d directory. I am assuming above that you have not edited your
inittab file to disable the running of these scripts of course.
Cross compiling is not an issue at all since the script is not compiled and is just executed using
bash if you have chosen to build
bash package into your
I've found there are several ways to do so. I created an fs-overlay, hit make, and it was part of the Image.
Thanks for the advice.