From: Pete <pe...@pu...> - 2008-04-13 22:50:41
|
Marq, what version of the gumstix filesystem are you running? This seems to be an older version which I'm not familiar with. However, what you want to do is pretty simple and the same example would work well in either this setup or the init I'm more familiar with. Basically, the start scripts are just sh scripts with a set of predefined functions (start, stop, restart, some others). So, you take the outline, and fill in what the start function needs to do. There are lots of examples you can find for doing init scripts using google. My example based on your example is below. Marq Rasmussen wrote: > I am trying to add 2 programs to the startup of the gumstix and have never > wrote a script file. > Here is what my /ect/init.d files looks like > -------------------------------------------------------- > # pwd > /etc/init.d > # ls -l > -rw------- 1 root root 881 Dec 31 16:23 S10robostix > -rwxr-xr-x 1 root root 1108 Oct 26 2006 S20urandom > -rwxr-xr-x 1 root root 3308 Nov 6 2006 S30bluetooth > -rwxr-xr-x 1 root root 340 Oct 26 2006 S40network > -rwxr-xr-x 1 root root 743 Nov 6 2006 S50bonjour > -rwxr-xr-x 1 root root 966 Nov 6 2006 S50dropbear > -rwxr-xr-x 1 root root 480 Nov 6 2006 S50httpd > -rwxr-xr-x 1 root root 230 Oct 26 2006 rc.modules > -rwxr-xr-x 1 root root 2269 Nov 6 2006 rc.udev > -rwxr-xr-x 1 root root 430 Oct 26 2006 rcS > ------------------------------------------------------------------------------------ > I was going to make a file called S60HeliStartup. > What do I put in the file? I was looking at the bluetooth one and was going > to copy the outline. > This is my best guess on what to put in the file, could any help me out? > ---------------------------------------------------------------------------------------------------- > #!/bin/sh > # > # Start/stop the Heli i2c-io file and IMU control code > # > > set -e #### WHAT DOES THIS DO????????? > > PATH=/myfiles > NAME=heliStartup > DESC="Helicopter startup sequence" > i2c-load --reset 0x0b write i2c-io.hex > sleep 1 > /myfiles/IMU_control > ----------------------------------------------------------------------------------------------------- > > Thanks for your help guys!!!! > -Marq > > The following excerpt should work just fine for starting your app. Fill in the stop code however you want, but it's not required. Just put it in /etc/init.d and name it S60StartHeli I guess. In newer versions of init on the gumstix, the directory /etc/init.d contains the scripts without numbers, and then there are symlinks to the scripts in the rcX.d directories. # S60StartHeli init file PATH=/sbin:/bin:/usr/bin:/myfiles case "$1" in start) i2c-load --reset 0x0b write i2c-io.hex sleep 1 /myfiles/IMU_control ;; stop) ;; restart) stop start ;; *) echo "Usage: StartHeli {start|stop|restart}" exit 1 esac exit 0 > Ryan Rapetti wrote: > >> mlq wrote: >> >>> Hi, >>> >>> Is there a way to create an image that runs a user defined program upon >>> powering up the gumstix? >>> >>> Thanks, >>> ~Mark >>> >>> >> Add a startup script, I think they're in /etc/init.d or >> /etc/rc.d(haven't looked in a while). Look at what's there to get an >> idea of what to name yours (they're of the form $&&****, $ is a letter, >> && is a 2 digit number, and the rest is a name indicating what is does), >> and be aware that they are executed in numerical order, so S20Something >> will execute before S30SomethingElse, so if you need a network >> connection (or something) to run your program, make sure the connection >> (or whatever) is up before you start your app. >> >> Ryan >> >> ------------------------------------------------------------------------- >> This SF.net email is sponsored by: Microsoft >> Defy all challenges. Microsoft(R) Visual Studio 2008. >> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >> _______________________________________________ >> gumstix-users mailing list >> gum...@li... >> https://lists.sourceforge.net/lists/listinfo/gumstix-users >> >> >> > > |