Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12590 Discussions

port goahead web server to nios2 uclinux

Altera_Forum
Honored Contributor II
3,403 Views

hi all:

 

I ported goahead websrver to nio2 use hippo's toolschain.

 

GoAhead WebServer 2.1 is a fully-featured, open-source embedded Web server that leverages Active Server Pages, embedded JavaScript, and in-process CGI forms processing (GoForms™) to deliver highly efficient and effective dynamic web page creation. Its source code is available free on the GoAhead website (http://www.goahead.com/webserver/wsregister.htm) to developers without royalties or proprietary lock-ins and is subject to the terms specified in the GoAhead .

 

The following step is my process:

1)download goahead webserver source code(webs218.tar.gz) from internet.

2)tar xzvf webs218.tar.gz

3)in the ../ws031202/LINUX dir,rework the original Makefile.

 

The original Make file is follow: attached

4)edit misc.c in the ../ws031202 dir

commet follow code:

//static int strnlen(char_t *s, unsigned int n);

 

/************************************************** ****************************/

/*

* Return the length of a string limited by a given length

*/

 

//static int strnlen(char_t *s, unsigned int n)

//{

// unsigned int len;

 

// len = gstrlen(s);

// return min(len, n);

//}

 

 

5)open the terminal ,cd ../ws031202/LINUX dir

6) PATH=$PATH:~/buildroot/build_nio2/staging_dir/bin

7)make

8)cp webs to ../rootfs/bin,cp ../ws031202/web dir to ../rootfs

9)rebuild kernel for inramfs use command "make ARCH=nios2nommu CROSS_COMPILE=nios2-linux-uclibc-"

10)nios2-linux-uclibc-strip vmlinux

11) under nios sdk shell,use command "nio2-download -g vmlinux" to download the vmlinux to your target board

12)open the windows terminal,cd /bin

13) exec command "hostname localhost"

14) exec command "webs"

 

now your goahead webserver is running on your target board.you can open your IE,then type your target board IP to visit the demo HTML.

 

 

ps: because I am a linux beginner.So my rework Makefile maybe have some bugs.if anyone find any mistakes,please tell me right here. Thanks.

0 Kudos
15 Replies
Altera_Forum
Honored Contributor II
842 Views

Hi Alex, 

 

Good work. 

Please try out the new kernel. And let me know. 

 

You can use subversion to help tracking your works. 

Try "which svn", if you don't have it, install it with "yum install subversion". (for fedora core) 

 

1. create the svn store, and check your original as rev1. 

cd ~ mkdir mysvn svnadmin create mysvn/webs tar xzvf webs218.tar.gz svn import ws031202 file:///home/alex/mysvn/webs/ws031202 -m="initial" rm -rf ws031202 svn co file:///home/alex/mysvn/webs/ws031202 

 

2. make your change to Makefile, misc.c .... 

build and test.... 

 

3. after you finished, or when you want to save your change to store, as rev2 

cd ws031202 svn commit -m="update for nios2 uclinux" svn diff -r1:2 >webs.diff 

Then you can send webs.diff to others 

 

4. when other get your diff file, he can apply the patch and get the same update from yours. 

tar xzvf webs218.tar.gz cd ws031202 patch -p0 <webs.diff 

 

The subversion is very helpful. You can find more usages from the subversion guide on their web.
0 Kudos
Altera_Forum
Honored Contributor II
842 Views

Hi hippo: 

 

Thank you for suggestion. 

 

I have completed the diff file. 

 

Can you tell me how to upload attached file in the forum?
0 Kudos
Altera_Forum
Honored Contributor II
842 Views

Great. 

You can attach files in the "post your ip" area. Or you can add your diff file in line here.
0 Kudos
Altera_Forum
Honored Contributor II
842 Views

the goahead webserver diff: 

 

Index: LINUX/Makefile 

=================================================================== 

--- LINUX/Makefile &#65288;&#20462;&#35746;&#29256; 1&#65289; 

+++ LINUX/Makefile &#65288;&#20462;&#35746;&#29256; 2&#65289; 

@@ -9,6 +9,11 @@ 

 

all: compile  

 

+CC = nios2-linux-uclibc-gcc  

+AR = nios2-linux-uclibc-ar  

+LD = nios2-linux-uclibc-ld 

+OBJCOPY = nios2-linux-uclibc-objcopy 

ARCH = libwebs.a 

NAME = webs 

 

@@ -56,11 +61,11 @@ 

../security.o ../sym.o ../uemf.o ../url.o ../value.o  

../md5c.o ../um.o ../umui.o ../websda.o ../emfdb.o  

../webrom.o ../webs.o ../websuemf.o main.o 

-CFLAGS = -DWEBS -DUEMF -DOS="LINUX" -DLINUX $(UMSW) $(DASW) $(SSLSW) $(IFMODSW) 

+CFLAGS = -DWEBS -DUEMF -DOS="LINUX" -DLINUX -Dfork=vfork -D__uClinux__ $(UMSW) $(DASW) $(SSLSW) $(IFMODSW) 

OTHERS = -DB_STATS -DB_FILL -DDEBUG 

DEBUG = -g -Wall 

IFLAGS = -I..  

-LDFLAGS = $(SSLLIB) $(IFMODLIB) 

+LDFLAGS = $(SSLLIB) $(IFMODLIB) -elf2flt="-s 64000" -Wl,-v -Wl,-d 

 

compile: $(NAME) 

 

@@ -75,7 +80,7 @@ 

#  

$(NAME): Makefile $(ARCH) 

$(CC) -o $(NAME) $(DEBUG)  

- $(CFLAGS) $(IFLAGS)  

+ $(CFLAGS)  

main.o $(ARCH) $(LDFLAGS)  

 

clean: 

@@ -152,4 +157,4 @@ 

# Transition rules (add -o to put object in right directory) 

#  

.c.o: 

- cc -c -o $@ $(DEBUG) $(CFLAGS) $(IFLAGS) $< 

+ $(CC) -c -o $@ $(DEBUG) $(CFLAGS) $(IFLAGS) $< 

Index: misc.c 

=================================================================== 

--- misc.c &#65288;&#20462;&#35746;&#29256; 1&#65289; 

+++ misc.c &#65288;&#20462;&#35746;&#29256; 2&#65289; 

@@ -58,7 +58,7 @@ 

 

static int dsnprintf(char_t **s, int size, char_t *fmt, va_list arg, 

int msize); 

-static int strnlen(char_t *s, unsigned int n); 

+//static int strnlen(char_t *s, unsigned int n); 

static void put_char(strbuf_t *buf, char_t c); 

static void put_string(strbuf_t *buf, char_t *s, int len, 

int width, int prec, enum flag f); 

@@ -425,13 +425,13 @@ 

* Return the length of a string limited by a given length 

*/ 

 

-static int strnlen(char_t *s, unsigned int n) 

-{ 

- unsigned int len; 

+//static int strnlen(char_t *s, unsigned int n) 

+//{ 

+// unsigned int len; 

 

- len = gstrlen(s); 

- return min(len, n); 

-} 

+// len = gstrlen(s); 

+// return min(len, n); 

+//} 

 

/******************************************************************************/ 

/*
0 Kudos
Altera_Forum
Honored Contributor II
842 Views

hi:  

 

I got a applet.diff for gahead webs. 

 

I run svn diff -r1:2 >webs.diff 

 

But not success complete.How can I solve it? Thanks. 

 

[alex@localhost ws031202]$ patch -p0 <applet.diff 

(Stripping trailing CRs from patch.) 

patching file webs.h 

Hunk# 1 FAILED at 85. 

1 out of 1 hunk FAILED -- saving rejects to file webs.h.rej 

(Stripping trailing CRs from patch.) 

patching file webs.c 

Hunk# 1 succeeded at 22 with fuzz 1. 

Hunk# 2 FAILED at 258. 

Hunk# 3 FAILED at 280. 

patch unexpectedly ends in middle of line 

Hunk# 4 FAILED at 1161. 

3 out of 4 hunks FAILED -- saving rejects to file webs.c.rej 

[alex@localhost ws031202]$
0 Kudos
Altera_Forum
Honored Contributor II
842 Views

Where do you get the applet.diff?

0 Kudos
Altera_Forum
Honored Contributor II
842 Views

 

--- Quote Start ---  

originally posted by hippo@Mar 2 2006, 09:42 PM 

where do you get the applet.diff? 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=13088) 

--- quote end ---  

 

--- Quote End ---  

 

 

I got the diff in a goahead bbs as follow: 

 

http://www.prolix.ro/dokuwiki/documentatio...et_does_not_run (http://www.prolix.ro/dokuwiki/documentation:goahead:general#java_applet_does_not_run

 

 

I copy the lines to blank text file,then I rename the file is *.diff
0 Kudos
Altera_Forum
Honored Contributor II
842 Views

They failed in white space, because we cut them from web page. 

Use "-l" option in patch to ignore white space. 

 

Remove the old ws031202 dir, untar again, then apply patch, 

patch -l -p0 <applet.diff
0 Kudos
Altera_Forum
Honored Contributor II
842 Views

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

I ported goahead websrver to nio2 use hippo&#39;s toolschain.[/b] 

--- Quote End ---  

 

 

Hi, 

can you help in doing the same but under the IDE ? 

 

Warm Regards
0 Kudos
Altera_Forum
Honored Contributor II
842 Views

 

--- Quote Start ---  

originally posted by mfm@Apr 5 2006, 02:05 PM 

<div class='quotetop'>quote  

--- quote end ---  

 

--- quote start ---  

i ported goahead websrver to nio2 use hippo&#39;s toolschain. 

--- Quote End ---  

 

 

Hi, 

can you help in doing the same but under the IDE ? 

 

Warm Regards 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=14072)</div> 

[/b] 

--- Quote End ---  

 

 

Hi MFM: 

 

If you want to use goahead webserver in nios2 linux, you must use toolchains cross compile it. The IDE is difficult to compile it. I think the best way is build your nios2 toolchains under linux.
0 Kudos
Altera_Forum
Honored Contributor II
842 Views

hi alex, i followed ur steps to port the webserver. everything seems fine but i cant access the demo webpage. i can ping my de2 but cant access it with web browser. 

 

here are some of my questions: 

1. must i follow the Buildrootguide to build the toolchain? i&#39;m totally new and i used the BinaryToolchain for newbies. 

 

2. step 9: shud i run that cmd under ~/ws031202/LINUX dir or under ~/uClinux-dist-test/ dir? is it this cmd is suppose to replace the &#39;make linux image&#39; as in uClinuxDist? 

 

3. step 10: whr shud i run this cmd? i tried the vmlinux file under ~/uClinux-dist-test/linux-2.6.xx/ (<= sry cant remember the numbers...) is it correct? 

 

Pls help. thank you in advance. 

 

ps. i&#39;m totally new n i hope my q doesnt sound stupid. i&#39;ll b glad if u would like to suggest anything.
0 Kudos
Altera_Forum
Honored Contributor II
842 Views

Hi alex,I followed your steps to port the webserver.When I arrived the 10) step,I met the following err: 

 

[w@localhost w]$ cd uClinux-dist-test 

[w@localhost uClinux-dist-test]$ make ARCH=nios2nommu CROSS_COMPILE=nios2-linux- 

uclibc- 

make -C tools/ucfront 

make[1]: Entering directory `/home/w/uClinux-dist-test/tools/ucfront&#39; 

make[1]: Nothing to be done for `all&#39;. 

make[1]: Leaving directory `/home/w/uClinux-dist-test/tools/ucfront&#39; 

... ...  

... ... 

... ... 

[ -d /home/w/uClinux-dist-test/images ] || mkdir -p /home/w/uClinux-dist-test/im 

ages 

cp /home/w/uClinux-dist-test/linux-2.6.x/arch/nios2nommu/boot/zImage /home/w/uCl 

inux-dist-test/images/zImage 

make[2]: Leaving directory `/home/w/uClinux-dist-test/vendors/Altera/nios2nommu&#39; 

make[1]: Leaving directory `/home/w/uClinux-dist-test/vendors&#39; 

 

 

[w@localhost uClinux-dist-test]$ nios2-linux-uclibc-strip vmlinux 

 

nios2-linux-uclibc-strip: &#39;vmlinux&#39;: No such file 

 

 

 

Then I do it by the following way,but I do not know if it is correct.Could you tell me what does the command "nios2-linux-uclibc-strip" mean? 

 

 

 

[w@localhost uClinux-dist-test]$ nios2-linux-uclibc-strip images/zImage 

[w@localhost uClinux-dist-test]$ 

0 Kudos
Altera_Forum
Honored Contributor II
842 Views

hi all: 

i follow Alex&#39;s work and complete. Could you teach me how to add IP in goahead?......thank all!.... http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/biggrin.gif
0 Kudos
Altera_Forum
Honored Contributor II
842 Views

Hi All, 

 

I am trying to port Go Ahead into REX OS for Qualcomm Mobile phones. Can I follow same steps for that OS too? 

 

I have tried the normal porting methods, but getting thousands of errors. Since I am new to this, expecting your support. 

 

Thanks
0 Kudos
Altera_Forum
Honored Contributor II
842 Views

For those trying to access current releases of the Goahead-Webserver, it is now being hosted by Embedthis Software at: embedthis.com under products.

0 Kudos
Reply