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++

Web Server

Altera_Forum
Honored Contributor II
2,386 Views

Hello, 

 

I'm using the uCLinux ported by Microtronix. I'm trying to use the web server but I can't see the initial page.  

I use the open core ethernet. I built the filesystem as described in the linux quick start guide. I can use ftp and telnet but when I type the 

IP in the web browser, I can't see the web page. 

 

Can someone help me? 

 

Thanks a lot, 

 

Marco
0 Kudos
19 Replies
Altera_Forum
Honored Contributor II
719 Views

If you log in and run ps, does boa appear in the process list?

0 Kudos
Altera_Forum
Honored Contributor II
719 Views

boa is running 

I have also started boa with boa -c /home/httpd
0 Kudos
Altera_Forum
Honored Contributor II
719 Views

A silly question, but /home/httpd does have stuff, and you're either running boa as root or have the permissions set properly?

0 Kudos
Altera_Forum
Honored Contributor II
719 Views

- under /home/httpd are the files index.html and ukit.jpg (Microtronix example) 

- boa is started by rc script (see below). 

In difference to the example, I added the line /bin/ifconfig... 

# !/bin/sh# # system startup. 

# set up the hostname 

/bin/hostname Nios2 

# expand and mount the ramdisk 

/bin/expand /ramfs.img /dev/ram0 

/bin/mount -t ext2 /dev/ram0 /var -n 

/bin/expand /ramfs.img /dev/ram1 

/bin/mount -t ext2 /dev/ram1 /tmp -n 

# mount proc file system 

/bin/mount -t proc proc /proc -n 

# mount sysfs 

/bin/mount -t sysfs sysfs /sys -n 

# manually assign ip address (uncomment and edit as appropriate)# note: first ifattach (no args) sets local loopback 

/bin/ifattach# /bin/ifattach --addr 10.1.1.99 --mask 255.255.255.0 --net 10.1.1.0 --gw 10.1.1.11 --if eth0 

 

/bin/ifconfig eth0 192.168.1.239 netmask 255.255.255.0 

 

# try and get ip address automatically...# /bin/mkdir /var/dhcpc# /bin/dhcpcd -NRY & 

# start up the internet superserver 

/bin/inetd & 

# start up the web server 

/bin/boa & 

# mount Linux server:# (uncomment and edit as appropriate)# /bin/mount -t nfs 192.168.1.30:/home /mnt/nfs -n -o nolock 

# mount master ide disk partition(s):# (uncomment and edit as appropriate)# /bin/mount /dev/hda1 /mnt/ide0 -n 

# that's it... success 

exit 0
0 Kudos
Altera_Forum
Honored Contributor II
719 Views

and what are the contents of /home/httpd/?

0 Kudos
Altera_Forum
Honored Contributor II
719 Views

In home/httpd there are only the files index.html and ukit.jpg 

index.html is a html script. These files are working.
0 Kudos
Altera_Forum
Honored Contributor II
719 Views

Ok, can you be more clear about how you don't see the web page? Do you get a 404 response? Does the query time out and you get nothing?

0 Kudos
Altera_Forum
Honored Contributor II
719 Views

When I enter the IP in the web browser, the browser found the IP, but the site is not loaded. 

I have logged the network traffic (with Ethereal). The traffic stopped after 5 packets. 

I can't attach the log-file today, because it's located on another PC.
0 Kudos
Altera_Forum
Honored Contributor II
719 Views

What is the result if you try it manually, i.e. from some other (preferably unix) computer: 

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

--- Quote Start ---  

telnet [ip of board] 80 

GET / HTTP/1.1 

Host: [ip of board][/b] 

--- Quote End ---  

 

 

(note that you have to hit enter twice after the Host: line. 

 

What do you get back, if anything? (note: you&#39;re using telnet to be an HTTP/1.1 client with the board as server; you can do this from the board itself if that&#39;s your only unix system available.)
0 Kudos
Altera_Forum
Honored Contributor II
719 Views

I have captured the ethernet packets, as I called the website. 

There are 2 HTTP Packets 

1. packet GET /index.html HTTP/1.1 

2. packet Continuation 

The second packet includes the last 77bytes of index.html. But where is the beginning data from index.html? 

 

Next, I tried to create a new smaller index.html. 

<html> 

<head><title>Test</title></head> 

<body bgcolor="white" text="black"> 

<td>Hello</td> 

</body> 

</html> 

 

J copied this new index.html into home/httpd 

 

Now I can see it in the web browser. 

As I now captured the traffic, I saw 2 packets again. 

1. packet GET /index.html HTTP/1.1 

2. packet HPPT/1.0 200 OK (text/html) 

This 2. packet includes the index.html. 

 

Whats wrong with the bigger index.html? Where is the first data? And what is the packet Continuation?
0 Kudos
Altera_Forum
Honored Contributor II
719 Views

What direction were those packets in? If you could label every packet with its direction, that would be helpful.

0 Kudos
Altera_Forum
Honored Contributor II
719 Views

Here is the summary of the Traffic. IP 192.168.1.233 is my PC and IP 192.168.1.239 is the uClinux board. 

Frame number 1 - 9 is the small index.html -> its ok 

Frame number 11 - 19 is the large index.html (index_old.html) -> not ok 

 

No. Time Source Destination Protocol Info 

1 0.000000 192.168.1.233 192.168.1.239 TCP 1059 > http [SYN] Seq=0 Ack=0 Win=64240 Len=0 MSS=1460 

2 0.004007 192.168.1.239 192.168.1.233 TCP http > 1059 [SYN, ACK] Seq=0 Ack=1 Win=5840 Len=0 MSS=1460 

3 0.004033 192.168.1.233 192.168.1.239 TCP 1059 > http [ACK] Seq=1 Ack=1 Win=64240 Len=0 

4 0.004553 192.168.1.233 192.168.1.239 HTTP GET /index.html HTTP/1.1 

5 0.005852 192.168.1.239 192.168.1.233 TCP http > 1059 [ACK] Seq=1 Ack=266 Win=6432 Len=0 

6 0.017285 192.168.1.239 192.168.1.233 HTTP HTTP/1.0 200 OK (text/html) 

7 0.153002 192.168.1.233 192.168.1.239 TCP 1059 > http [ACK] Seq=266 Ack=347 Win=63894 Len=0 

8 10.017317 192.168.1.239 192.168.1.233 TCP http > 1059 [FIN, ACK] Seq=347 Ack=266 Win=6432 Len=0 

9 10.017377 192.168.1.233 192.168.1.239 TCP 1059 > http [ACK] Seq=266 Ack=348 Win=63894 Len=0 

10 10.027148 192.168.1.233 192.168.1.239 TCP [TCP ZeroWindow] [TCP Dup ACK 9#1] 1059 > http [RST] Seq=266 Ack=348 Win=0 Len=0 

11 11.036714 192.168.1.233 192.168.1.239 TCP 1060 > http [SYN] Seq=0 Ack=0 Win=64240 Len=0 MSS=1460 

12 11.037430 192.168.1.239 192.168.1.233 TCP http > 1060 [SYN, ACK] Seq=0 Ack=1 Win=5840 Len=0 MSS=1460 

13 11.037454 192.168.1.233 192.168.1.239 TCP 1060 > http [ACK] Seq=1 Ack=1 Win=64240 Len=0 

14 11.037967 192.168.1.233 192.168.1.239 HTTP GET /index_old.html HTTP/1.1 

15 11.039311 192.168.1.239 192.168.1.233 TCP http > 1060 [ACK] Seq=1 Ack=338 Win=6432 Len=0 

16 11.050942 192.168.1.239 192.168.1.233 HTTP Continuation 

17 11.050983 192.168.1.233 192.168.1.239 TCP [TCP Dup ACK 13#1] 1060 > http [ACK] Seq=338 Ack=1 Win=64240 Len=0 SLE=2575009540 SRE=2575009617 

18 21.045938 192.168.1.239 192.168.1.233 TCP http > 1060 [FIN, ACK] Seq=1102 Ack=338 Win=6432 Len=0 

19 21.045984 192.168.1.233 192.168.1.239 TCP [TCP Dup ACK 13#2] 1060 > http [ACK] Seq=338 Ack=1 Win=64240 Len=0 SLE=2575009540 SRE=2575009618
0 Kudos
Altera_Forum
Honored Contributor II
719 Views

So what do you get in response if you do: 

 

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

--- Quote Start ---  

telnet 192.168.1.239 80 

GET /index_old.html HTTP/1.1 

Host: 192.168.1.239[/b] 

--- Quote End ---  

 

 

(note the extra blank line at the end.) 

 

What does the server send back to you?
0 Kudos
Altera_Forum
Honored Contributor II
719 Views

do you mean 

telnet 

open 192.168.1.239 80 ? 

Then I have no response until the timeout is reached.
0 Kudos
Altera_Forum
Honored Contributor II
719 Views

Can you use a unix box or telnet from cygwin under windows? I&#39;m not familiar with the toy tools that come with windows, and I don&#39;t think that windows telnet is powerful enough to do this sort of debugging.

0 Kudos
Altera_Forum
Honored Contributor II
719 Views

I have tested with telnet under linux. I created 2 testcases. Case 1 was a small website. In case 2, I added some characters to this website. 

 

result case 1: 

Marco@linux:~> telnet 192.168.1.239 80 

Trying 192.168.1.239... 

Connected to 192.168.1.239. 

Escape character is &#39;^]&#39;. 

GET / HTTP/1.1 

Host: 192.168.1.239 

 

HTTP/1.0 200 OK 

Date: Tue, 30 Nov 1999 00:03:35 GMT 

Server: Boa/0.93.15 

Connection: close 

Content-Type: text/html 

Content-Length: 525 

Last-Modified: Tue, 30 Nov 1999 00:52:25 GMT 

 

<html> 

<head><title>Microtronix uKit</title></head> 

<body bgcolor="white" text="black"> 

<td>Hello html test xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</td> 

<td>Hello html test xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</td> 

<td>Hello html test xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</td> 

<td>Hello html test xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</td> 

<td>Hello html test xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</td> 

<td>Hello xxxxxxxxxxxxxx</td> 

</body> 

</html> 

 

Connection closed by foreign host. 

Marco@linux:~> 

 

result case 2 

Marco@linux:~> telnet 192.168.1.239 80 

Trying 192.168.1.239... 

Connected to 192.168.1.239. 

Escape character is &#39;^]&#39;. 

GET / HTTP/1.1 

Host: 192.168.1.239 

 

 

Connection closed by foreign host. 

Marco@linux:~>
0 Kudos
Altera_Forum
Honored Contributor II
719 Views

Ok, so we can see where it&#39;s failing, at least (at Boa&#39;s end, before it tries to do anything at all). 

 

Man it would be nice to strace boa to see what it&#39;s up to. 

 

Failing that, can you cat the file on the filesystem? I mean, just make sure that any old process can read it successfully. 

 

Also, can you try creating an html file of roughly the same size as old_index.html just to try to eliminate size as an issue?
0 Kudos
Altera_Forum
Honored Contributor II
719 Views

I made some tests with filetransfer over ftp yesterday. 

I can transfer files with any filesize (small and large files) to the uCLinux board. 

but I couldn&#39;t download these files from uClinux board to the PC. 

I only could download files with size smaller than approximately 520bytes. 

That means files fitting in one ethernet packet.  

I think there is a problem with tx-buffering in the ethernet kernel driver. 

When I compile the kernel, I receive some warnings in open_eth.c.
0 Kudos
Altera_Forum
Honored Contributor II
719 Views

Hello, 

I solved my problem. I think the reason was the clock delay (phase) for the SDRAM. 

To solve the problem I changed the CPU clock in 2x Ozsillator clock (65.536MHz). 

The delay for the SDRAM clock is 170 degree. 

Now it runs on the Microtronix Cyclone 1C20 Developement board.
0 Kudos
Reply