You are on page 1of 5

Componentality Oy Ratakatu 47, 53100 Lappeenranta, Finland Tel.: +35 04! 5!!"01! #mail: $ale$%&omponentality.&om 'e(: )ttp:**+++.&omponentality.

&om

Step By Step Guide for Starting "Hello, World!" on OpenWRT


Installation. ,ll a&tion$ o- t)i$ $tep $)ould (e per-ormed (y a non.root u$er. /ire&torie$ +it) $pa&e$ in t)eir -ull pat) are not allo+ed. 1. 0n$tall 123 (y runnin4 t)e -ollo+in4 &ommand$ in t)e terminal. Re$pond po$iti5ely +)en a$ked to &on-irm. sudo apt-get update sudo apt-get install subversion build-essential ". Create open+rt -older in t)e )ome -older. mkdir ~/openwrt 3. Open it cd ~/openwrt 4. /o+nload Open'RT ,ttitude ,d6u$tment, (y runnin4 t)e -ollo+in4 &ommand: svn co svn://svn.openwrt.org/openwrt/branches/attitude_adjustment 5. Open attitude_adjustment -older cd attitude_adjustment !. /o+nload and in$tall all a5aila(le -eed$ ./scripts/feeds update -a ./scripts/feeds install a 7. O(tain a li$t o- mi$$in4 pa&ka4e$ -or $u&&e$$-ul (uild, u$in4 t)e -ollo+in4 &ommand: make menuconfig 0- t)e in$tallation o- Open'RT i$ not inter-ered +it) anyt)in4, a$ e5iden&ed (y t)e a($en&e o- error$, pro&eed to $tep . Ot)er+i$e you +ill (e noti-ied o- t)e mi$$in4 pa&ka4e$ in t)e -ollo+in4 +ay: Build dependenc : !lease install ncurses. "#issing libncurses.so or ncurses.h$ 7nder 7(untu 1".10 operatin4 $y$tem (uild re8uired t)e -ollo+in4 pa&ka4e$: n&ur$e$, 9li(, :37 a+k, and 4it. Command$ t)at in$tall t)e mi$$in4 pa&ka4e$: sudo apt-get install libncurses%-dev sudo apt-get install &lib'g-dev

Componentality Oy Ratakatu 47, 53100 Lappeenranta, Finland Tel.: +35 04! 5!!"01! #mail: $ale$%&omponentality.&om 'e(: )ttp:**+++.&omponentality.&om

sudo apt-get install gawk sudo apt-get install git-core /urin4 in$tallation you;ll )a5e to enter root.u$er;$ pa$$+ord and a4ree i- a$ked to &on-irm in$tallation. 0t)e li$t o- mi$$in4 pa&ka4e$ di--er$ -rom t)e a(o5e li$t, you &an u$e t)e -ollo+in4 &ommand -or -indin4 t)e ne&e$$ary pa&ka4e apt-cache search (( enter t)e name o- t)e mi$$in4 &omponent o(tained t)rou4) make menu&on-i4 in (ra&ket$. <ou mi4)t al$o -ind )elp-ul t)e ta(le o- t)e mo$t -re8uent i$$ue$ t)at i$ a5aila(le at t)e -ollo+in4 addre$$: )ttp:**+iki.open+rt.or4*do&*)o+to*(uildroot.e=i4en&e >?Ta(le o- kno+n prere8ui$ite$ and t)eir &orre$pondin4 pa&ka4e$@A. 1ele&t t)e &olumn +it) your operatin4 $y$tem and t)e line +it) t)e mi$$in4 pa&ka4e and -ind +)at you need to in$tall at t)e &ro$$in4. ')en all ne&e$$ary &omponent$ are in$talled you;ll $ee a &on-i4uration menu >a 4rey +indo+ on a (lue (a&k4roundA . T)e $ettin4$ $)ould (e t)e -ollo+in4: Tar4et $y$tem . ,t)ero$ ,R7===*,RB=== 1u(tar4et . /e5i&e$ +it) 3,3/ -la$) >mo$tly CikrotikA Tar4et pro-ile . ,t)ero$ 'iFi >at)5kA B. 1a5e $ettin4$ and e=it 10. 0n attitude_adjustment -older $tart t)e (uild, u$in4 make &ommand ,ttentionD Euild take$ ".! )our$.

II. Package assembly 1. Create a -older -or $our&e &ode$. Lo&ate it in t)e Open'RT root cd ../ mkdir hello cd hello ,$ a re$ult you $)ould 4et a )ello -older in t)e open+rt -older, ne=t to attitude_adjustment -older. 0n &a$e o- an aut)or, it i$ /home/user/openwrt/hello ". Create t+o -ile$ )ello.& and Cake-ile in t)i$ -older. T)e -ir$t -ile +ill &ontain t)e $our&e &ode on C and t)e $e&ond one F (uild rule$. touch hello.c touch #akefile ) file name with a capital letter Eot) -ile$ &ontain: hello.c )include *stdio.h+ void main"$ , printf"(-ello. /orld01n($2 3

Componentality Oy Ratakatu 47, 53100 Lappeenranta, Finland Tel.: +35 04! 5!!"01! #mail: $ale$%&omponentality.&om 'e(: )ttp:**+++.&omponentality.&om

#akefile .45667894: .tar.g& .c override :6;<=4 >? -/all -@A -g hello:hello.c all: hello hello.tar.g& B.tar.g&: C7D?E"subst .tar.g&..EF$ B.tar.g&: B.c Fmkdir -p ./E"C7D$-A.' Fcp EG #akefile ./E"C7D$-A.' tar -c& -f EF ./E"C7D$-A.' 0n t)i$ &a$e, )ello.& &ontain$ a &ode o- $imple 4reetin4 to a &on$ole, and Cake-ile &ompile$ t)e &ode, (uildin4 on t)e plat-orm, &reate$ tar.49 ar&)i5e +it) a $our&e &ode and a make -ile in it, a$ +ell a$ a -older +it) $imilar &ontent. ,ttentionD Geepin4 ta($ i$ a mu$tD <ou &an 5eri-y t)e a&&ura&y (y runnin4 t)e -ollo+in4 &ommand$ >in H*open+rt*)elloA make all ./hello T)e -ir$t one +ill &olle&t, &ompile and &reate an ar&)i5e +it) a -older. T)e $e&ond one +ill laun&) t)e e=e&uti5e -ile &ompiled -or t)e plat-orm o- t)e &urrent ma&)ine. ?Iello, 'orldD@ in t)e &on$ole indi&ate$ t)at t)i$ $tep +a$ per-ormed $u&&e$$-ully. 3. T)en, &reate a )ello -older in ~/openwrt/attitude_adjustment/feeds/packages/utils -older cd ../ cd attitude_adjustment/feeds/packages/utils/ mkdir hello and open it cd hello/ 4. Create a make -ile in it -or Open'RT touch makefile 5. Re&ord t)e -ollo+in4 data in it include E"H@!C7D$/rules.mk !I=_J<#9:?hello !I=_K9D47@J:?A !I=_D9;9<49:?' !I=_B57;C_C7D:?E"!I=_J<#9$-E"!I=_K9D47@J$.E"!I=_D9;9<49$ !I=_4@5D:9:?hello.tar.g& !I=_4@5D:9_5D;:?file:///home/user/openwrt/hello/ include E"7J:;5C9_C7D$/package.mk

Componentality Oy Ratakatu 47, 53100 Lappeenranta, Finland Tel.: +35 04! 5!!"01! #mail: $ale$%&omponentality.&om 'e(: )ttp:**+++.&omponentality.&om

define !ackage/hello 49:H7@J:?utils :<H9=@DL:?5tilities H7H;9:?-/ endef define !ackage/hello/description -ello /orld endef define !ackage/hello/Build/:ompile E"#<I9$ -: E"!I=_B57;C_C7D$ hello endef define !ackage/hello/install E"7J4H<;;_C7D$ E"'$/bin/ E"7J4H<;;_B7J$ E"!I=_B57;C_C7D$/hello E"'$/bin/hello endef E"eval E"call Build!ackage.hello$$

,ttentionD Cake $ure to &)an4e u$er name in !I=_4@5D:9_5D;. III. Compilation 1. ,-ter proper make -ile$ H*open+rt*attitudeJad6u$tment -older: .*$&ript$*-eed$ update .i .*$&ript$*-eed$ in$tall )ello ". Open &on-i4uration menu on&e a4ain make menu&on-i4 3. Find our pa&ka4e 7tilite$ ....K )ello ,nd put LCM pa&ka4e parameter to it 4. Nre$$ #=it t+o time$ to e=it and $a5e 5. Run t)e -ollo+in4 &ommand make pa&ka4e*)ello*&ompile 0n &a$e o- $u&&e$$-ul &ompilation, a ready )elloJ0.1Jar71==.ipk e=e&uti5e -ile +ill appear in H*open+rt*attitudeJad6u$tment*(in*ar71==*pa&ka4e$ -or $tartin4 on Fle=Road. IV. Moving and installation &on-i4urin4 run t)e -ollo+in4 &ommand$ -rom

Componentality Oy Ratakatu 47, 53100 Lappeenranta, Finland Tel.: +35 04! 5!!"01! #mail: $ale$%&omponentality.&om 'e(: )ttp:**+++.&omponentality.&om

1. Co5e )elloJ0.1Jar71==.ipk pa&ka4e to Fle=Road and in$tall it. ,$ an option you &an &opy )elloJ0. 1Jar71==.ipk to t)e root -older o- t)e de5i&e u$in4 1CN utility. ". 0n$tall t)e pa&ka4e u$in4 opkg install /root/hello_A-'_arM'NN.ipk &ommand. 3. <ou &an &)e&k it$ operation (y enterin4 t)e pa&ka4e name a$ a &ommand in t)e &on$ole hello ?Iello, 'orldD@ in t)e &on$ole indi&ate$ $u&&e$$-ul &ompletion o- all operation$.