This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
openwrt_coding [2009/06/11 03:43] eric |
openwrt_coding [2013/05/21 16:12] (current) eric |
||
---|---|---|---|
Line 3: | Line 3: | ||
//Written by Eric Bishop < | //Written by Eric Bishop < | ||
- | Part I: A Simple Program In C added 8/23/2007 | + | [[openwrt_coding# |
- | Part II: C++ and the Standard Template Library (STL) added 10/10/2007 | + | [[openwrt_coding# |
- | Part III: Building and Using the Kamikaze SDK added 12/9/2007 | + | [[openwrt_coding# |
=====Tutorial Moved To New Location -- 7/ | =====Tutorial Moved To New Location -- 7/ | ||
- | I haven' | + | I haven' |
- | This tutorial now makes use of external stylesheets to fit in with the Gargoyle website theme. I realize this may make it more difficult to download and easily reference on your local computer, so I will continue to make the old version of this tutorial available. This version can be found here. | + | This tutorial now makes use of external stylesheets to fit in with the Gargoyle website theme. I realize this may make it more difficult to download and easily reference on your local computer, so I will continue to make the old version of this tutorial available. This version can be found [[http:// |
Line 22: | Line 22: | ||
- | The code for the examples in this tutorial can be downloaded from here. The example from the first part of the tutorial is in the **openwrt-programming-examples/ | + | The code for the examples in this tutorial can be downloaded from [[http:// |
=====Part I: A Simple Program in C -- 8/ | =====Part I: A Simple Program in C -- 8/ | ||
Line 51: | Line 51: | ||
helloworld: helloworld.o | helloworld: helloworld.o | ||
- | $(CC) $(LDFLAGS) helloworld.o -o helloworld helloworld.o: | + | $(CC) $(LDFLAGS) helloworld.o -o helloworld |
- | helloworld.c $(CC) $(CFLAGS) -c helloworld.c | + | |
+ | helloworld.o: | ||
+ | $(CC) $(CFLAGS) -c helloworld.c | ||
# remove object files and executable when user executes "make clean" | # remove object files and executable when user executes "make clean" | ||
Line 286: | Line 288: | ||
</ | </ | ||
- | Now, ssh into the router. We just copied the package to root's home directory so we are finally ready to install our program. In root's home directory, (where we end up immediately after connecting to the router via ssh) type "ipkg install helloworld_1_mipsel.ipk" | + | Now, ssh into the router. We just copied the package to root's home directory so we are finally ready to install our program. In root's home directory, (where we end up immediately after connecting to the router via ssh) type "ipkg install helloworld_1_mipsel.ipk" |
< | < | ||
Line 704: | Line 706: | ||
Once again, please do **not** contact me about any issues you might have with your own programs. | Once again, please do **not** contact me about any issues you might have with your own programs. | ||
- | =====PART III: Building and Using the Kamikaze SDK===== | + | =====PART III: Building and Using the Kamikaze SDK -- 12/9/2007===== |
The OpenWrt SDK for Kamikaze is available only for 64 bit processors. If you're one of us mere mortals who posesses only one of those antique 32 bit processors, you have a problem. You can sometimes get away with using the //White Russian// SDK if you only need your program to run on the MIPS architecture, | The OpenWrt SDK for Kamikaze is available only for 64 bit processors. If you're one of us mere mortals who posesses only one of those antique 32 bit processors, you have a problem. You can sometimes get away with using the //White Russian// SDK if you only need your program to run on the MIPS architecture, | ||
Line 870: | Line 872: | ||
</ | </ | ||
+ | |||
+ | |||
+ | That's all there is to compiling the SDK The SDK tar.bz2 file is now in the bin subdirectory. You can install it just as I describe above for the White Russian SDK that can be downloaded in its compiled form. | ||
+ | |||
+ | However, if you are working with Kamikaze 7.09 (the latest as of this writing) or before, you're likely to have trouble compiling packages with your newly compiled SDK. There' | ||
+ | |||
+ | **Excerpt from ~/ | ||
+ | < | ||
+ | world: FORCE | ||
+ | $(MAKE) package/ | ||
+ | -( \ | ||
+ | cd package; \ | ||
+ | find . -maxdepth 2 -name Config.in | \ | ||
+ | sed -e ' | ||
+ | xargs -n1 $(MAKE) compile -C; \ | ||
+ | ) | ||
+ | |||
+ | </ | ||
+ | |||
+ | With this, fixed, code: | ||
+ | |||
+ | **Excerpt from ~/ | ||
+ | < | ||
+ | world: FORCE | ||
+ | $(MAKE) package/ | ||
+ | -( \ | ||
+ | cd package; \ | ||
+ | for configfile in `find . -maxdepth 2 -name Config.in` ; do \ | ||
+ | $(MAKE) compile -C `dirname $$configfile` ; \ | ||
+ | done \ | ||
+ | ) | ||
+ | </ | ||
+ | |||
+ | You should now be able to compile your code just as you did with the //White Russian// SDK. | ||
+ | |||
+ | I toyed with the idea of not reiterating, | ||
+ | |||
+ | |||
+ | This tutorial is provided under the [[http:// |